From patchwork Tue Aug 20 18:49:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ren=C3=A9_Scharfe?= X-Patchwork-Id: 11104483 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D572613B1 for ; Tue, 20 Aug 2019 18:49:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B248022DD3 for ; Tue, 20 Aug 2019 18:49:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=web.de header.i=@web.de header.b="pXBAFvBj" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730473AbfHTStP (ORCPT ); Tue, 20 Aug 2019 14:49:15 -0400 Received: from mout.web.de ([212.227.17.12]:44785 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727358AbfHTStP (ORCPT ); Tue, 20 Aug 2019 14:49:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=dbaedf251592; t=1566326950; bh=Og80N+Ad7uRHhySFkoIsOMrUSM0MA1F8+wrUlhgXf4U=; h=X-UI-Sender-Class:To:Cc:From:Subject:Date; b=pXBAFvBjj2uV1DCJrTo12iKHL6Il+VVWU6/pzAnUxZDUyfbfTlyYcDwIR4pY93bDL 5Dx+MgUkWwgOllFQk/U5o3xIX97sPcPBFmONnPwcpXc0PcTQo6wDy7BKpBhABi8Sj9 M724PXTtFAGdoUSUaJ77WAtFNdXIcqD7rQZYKQu8= X-UI-Sender-Class: c548c8c5-30a9-4db5-a2e7-cb6cb037b8f9 Received: from [192.168.178.23] ([79.203.24.71]) by smtp.web.de (mrweb102 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MddFQ-1haoJe1ypQ-00PJM1; Tue, 20 Aug 2019 20:49:10 +0200 X-Mozilla-News-Host: news://nntp.public-inbox.org:119 To: Git Mailing List Cc: Junio C Hamano , Johannes Schindelin From: =?utf-8?q?Ren=C3=A9_Scharfe?= Subject: [PATCH] parseopt: move definition of enum parse_opt_result up Message-ID: <58e5dd7b-d577-a1d9-c704-44642f553323@web.de> Date: Tue, 20 Aug 2019 20:49:07 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 Content-Language: en-US X-Provags-ID: V03:K1:V/CWpWz7Wx2rtM8p+PoczLd23+mDZePG3L77LqFCPu/H00yU9J+ mI+EIHAOLOUI02u812fb/by3doJHH1fjwhJ8l5C+ifnILw7J7HSsrvmar9V83HcX1bSJKer iJqHjYMWQhuHPkEoqLgK9ZSuRqBQoZ+9uJqhOE6lH3C4t3QxqlAl0ezUIOgHNqNMgSHY1mV MfRK54aXjvyTRJgwNWvzg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:CqHWHH/zUhQ=:WUj///VIUV3YqUEl/EQpwJ 25Wr7B3OAIAy+3cJVzLoX8dfKYsECbZgx9gftofDfYF4yJmxgOxl2KGzRvVk+W6UGFTE9NlH5 m3ysXAtfZmGqjrXuClxeSW1lRoHGZcT9bIT3/E3IvT5dMBMbSkmAjDSp73qcrbEs0cxnQf3uA qfEEAWDLpu8k0s5+E9go0m4d2CA2qXm/YWCIndD+/Vo2ET2SHFxeb+gqzdH5//RPxrUpUA/hS tB4ZGCQU0rUt/pudslGGrHH66MI7Fn+KazR0se/fc2fHkv4BWbSi9E6KGtOdpgIbv9bUG3SGy L3d0tcPKTGkvWCqlo+xzHIa4+GJUuIcaES5pXpdWZxrwofns3cuh+xCIkNkpD2BUbDZC6M4fX YJ22zp6/Fy9knYG8Ah+Qdg+VrzZoECUk6dO4dln7fuPBlZq45YzAL9PhTEY7ExJgrECqwfCv5 l+A1+ZGGcURy5NomkjFJNG9dCnpyQ4nViL87Zj7cgMLcfegO74ra3CtWxv6Oq33s2IHkjjqL6 1TvpbTpbtG3W8Ji3riWyMunFVqvLpHuuy4dnV+n+pfw5+9hAP88PvVIuQuv8Nyv5CV4Lgs6ky l/6OaBYoxVUu039qYyjk5W3N6TKn0c5QB76AfgWvAN9w7vNFjix76UKhjqSIUnIdCcZYR/yKx hAzPO50DiWwLNf7TYLvyQbvw4tKCwxS+RqXReJpF89aoPQV901EcPqXUqc/L+MVaBCKfNJP2m vuziJWwmWTu8HH8RQDdshhXZxNHVV1TpNAcqyKvn75o9dgJUv4aN1falO4mKqsLWai224cyls 6chuO44L+A2yVjty+KMSIZOfPJzdHM0WZUnw6sBbgymII+C5EEONCbXVONQDwRWLmh+PAQ9Rv jm1Gc2x64P/sydH9/greW7S4D6KEEYdyf4S5VCwdlemSFse4+m8aayzK9dzO+4PrrkBQvqFg6 UE3KapK7LL9VQZR3whS8S3unHuAJLUo0ZBGw7FgvwCISsBxy+9VAVa56T+pIBggv8KlHyPnOJ EUANB4BrAGnYeNqE9TKaguy+1c1eI4wZsE25oiTl29PtLkC3fEAjIELVJY871Mpn0dhmj/LCL e3CnxulxHqAuWeKq0QT7Zvbs3QD50oK2IYEe9aVwfbHrsmEqGX8YgVX4BCDLRoz75mWCfMKh1 ZQUDA= Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Define enum parse_opt_result before using it in a typedef. This avoids the following compiler warning: ./parse-options.h:53:14: error: ISO C forbids forward references to 'enum' types [-Werror,-Wpedantic] typedef enum parse_opt_result parse_opt_ll_cb(struct parse_opt_ctx_t *ctx, ^ While GCC and Clang both accept such a forward reference by default, other compilers might be less forgiving. Signed-off-by: René Scharfe --- parse-options.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) -- 2.23.0 diff --git a/parse-options.h b/parse-options.h index a4bd40bb6a..38a33a087e 100644 --- a/parse-options.h +++ b/parse-options.h @@ -46,6 +46,15 @@ enum parse_opt_option_flags { PARSE_OPT_COMP_ARG = 1024 }; +enum parse_opt_result { + PARSE_OPT_COMPLETE = -3, + PARSE_OPT_HELP = -2, + PARSE_OPT_ERROR = -1, /* must be the same as error() */ + PARSE_OPT_DONE = 0, /* fixed so that "return 0" works */ + PARSE_OPT_NON_OPTION, + PARSE_OPT_UNKNOWN +}; + struct option; typedef int parse_opt_cb(const struct option *, const char *arg, int unset); @@ -241,15 +250,6 @@ const char *optname(const struct option *opt, int flags); /*----- incremental advanced APIs -----*/ -enum parse_opt_result { - PARSE_OPT_COMPLETE = -3, - PARSE_OPT_HELP = -2, - PARSE_OPT_ERROR = -1, /* must be the same as error() */ - PARSE_OPT_DONE = 0, /* fixed so that "return 0" works */ - PARSE_OPT_NON_OPTION, - PARSE_OPT_UNKNOWN -}; - /* * It's okay for the caller to consume argv/argc in the usual way. * Other fields of that structure are private to parse-options and should not