From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by sourceware.org (Postfix) with ESMTPS id 8629F386F029 for ; Fri, 11 Sep 2020 12:22:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 8629F386F029 Received: by mail-wm1-x341.google.com with SMTP id k18so4585172wmj.5 for ; Fri, 11 Sep 2020 05:22:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=AUYk8Vo5slEx9t6u+cTsQFvD/Zk2Uzycaf2JEDqmzYc=; b=PWDIawrEkXrIYl5LQfQQ97R1FFJa7XLVGAQUk7pFLFRMxufxyn6CuDjYetkN4c4H8L jkkOU+5Tsq9+ilkPeo89eParculrlwRcthu+QfSxKjTYx4zqjWzJgtUoPl0AzgUj18Ts 4bZe2t7258qGyeYyGE/GRqm/45Y11bgIXqamAcFIuUqa+cwZ1P266ebDuVFvTe2gnNjT tDl8ekDvNcD3RyyeDgS/i4SJ+mpIPWPZ18ptSXFtUdpVCbZMy4gc88U9uVBKBKC0/4Aa n+V6l4Ty1uKl9T3+9496jbnxrZc18OWFrdsCOhLVWdn3c1SK/lM9xJSbeUvwHIjkpeU0 R0Qg== X-Gm-Message-State: AOAM5332pQIvRB4EXr1ZTe4Sb4Zp7ItOzeqDANksjf5rl6wfxd0fr9VY KBksVixnDVNQKPGjiOP1hW8ZTiRMZD1Wpw== X-Google-Smtp-Source: ABdhPJx/RaGmyORhO52R8kS2iD3bh4IgdVP601aELrAl1onELMKwlx5oj5sgDqMD5xL/xKUheleoEg== X-Received: by 2002:a1c:f402:: with SMTP id z2mr1919617wma.87.1599826921146; Fri, 11 Sep 2020 05:22:01 -0700 (PDT) Received: from localhost.localdomain (static.42.136.251.148.clients.your-server.de. [148.251.136.42]) by smtp.gmail.com with ESMTPSA id y6sm4295669wrn.41.2020.09.11.05.22.00 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 11 Sep 2020 05:22:00 -0700 (PDT) From: Christophe Lyon To: gcc-patches@gcc.gnu.org, bkorb@gnu.org Subject: [PATCH] fixincludes/fixfixes.c: Fix 'set but not used' warning. Date: Fri, 11 Sep 2020 12:21:59 +0000 Message-Id: <1599826919-5148-1-git-send-email-christophe.lyon@linaro.org> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-14.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Sep 2020 12:22:03 -0000 pz_tmp_base and pz_tmp_dot are always set, but used only when _PC_NAME_MAX is defined. This patch moves their declaration and definition undef #ifdef _PC_NAME_MAX to avoid this warning. 2020-09-11 Torbjörn SVENSSON Christophe Lyon fixincludes/ * fixfixes.c (pz_tmp_base, pz_tmp_dot): Define only with _PC_NAME_MAX. --- fixincludes/fixfixes.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fixincludes/fixfixes.c b/fixincludes/fixfixes.c index 034e15d..5b23a8b 100644 --- a/fixincludes/fixfixes.c +++ b/fixincludes/fixfixes.c @@ -738,8 +738,10 @@ main( int argc, char** argv ) { tFixDesc* pFix; char* pz_tmptmp; +#ifdef _PC_NAME_MAX char* pz_tmp_base; char* pz_tmp_dot; +#endif if (argc != 5) { @@ -772,12 +774,12 @@ main( int argc, char** argv ) pz_tmptmp = XNEWVEC (char, strlen (argv[4]) + 5); strcpy( pz_tmptmp, argv[4] ); +#ifdef _PC_NAME_MAX /* Don't lose because "12345678" and "12345678X" map to the same file under DOS restricted 8+3 file namespace. Note that DOS doesn't allow more than one dot in the trunk of a file name. */ pz_tmp_base = basename( pz_tmptmp ); pz_tmp_dot = strchr( pz_tmp_base, '.' ); -#ifdef _PC_NAME_MAX if (pathconf( pz_tmptmp, _PC_NAME_MAX ) <= 12 /* is this DOS or Windows9X? */ && pz_tmp_dot != (char*)NULL) strcpy (pz_tmp_dot+1, "X"); /* nuke the original extension */ -- 2.7.4