From patchwork Fri Apr 15 09:37:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yvan Roux X-Patchwork-Id: 11747 Received: (qmail 47943 invoked by alias); 15 Apr 2016 09:37:15 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 47927 invoked by uid 89); 15 Apr 2016 09:37:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=2016-04-15 X-HELO: mail-yw0-f173.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to; bh=B/pIL9JoF5TUYjpJgkvXkxS1dWYrDxrWmrLuLMZruoY=; b=QYHQ14Z/9HIjydVMe/zWU5lU+L9Z8BOeL6xF266K404FS6ERaP0kadR+uHlwcEKWY0 EP0F+3vvVDHyndqVBlWoZ6+IeyHJzIXm8c1Mh17Mpzho+pA04dGYFaSWVr72BiSMDzo7 L8tQf8EautHd0meerVVEywJB5Syascq5DzJUcltlwq0uSxdNbe5jrDZzsyt/Lo5fd6RX 04JozlajEZCukHAvq1XeZSvmL8kUKLFd5HxH9loYRxo6Sb9tOI0xm3DpEUsbY/mf1v0C e8CgWdy+/Oau9Gau2slMJ9yvAHctbLnwhpyci6Y4gi0EP5mQQ+dCLM3luYln7G3PSyWg kKKA== X-Gm-Message-State: AOPr4FXZyY6b7kd+LLWPXjr0cfdXfV6spUghpmSwA7XPrqhYXhmN3xQnSg+pbNjw1rE6QBuCNfP2QRxnH9vpggID MIME-Version: 1.0 X-Received: by 10.13.252.67 with SMTP id m64mr12526508ywf.67.1460713022821; Fri, 15 Apr 2016 02:37:02 -0700 (PDT) Date: Fri, 15 Apr 2016 11:37:02 +0200 Message-ID: Subject: [PATCH] Fix ambiguous 'else' [-Wparentheses] From: Yvan Roux To: libc-alpha@sourceware.org Hi, GCC trubnk fails to build glibc since revision r234949 which enhanced -Wparentheses (to address https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70436). This simple patch fixes the ambiguity. Tested with an x86_84 build configured with --disable-werror and no warning emitted. Thanks, Yvan 2016-04-15 Yvan Roux * stdlib/setenv.c (unsetenv): Fix ambiguous 'else'. * nis/nis_call.c (nis_server_cache_add): Likewise. diff --git a/nis/nis_call.c b/nis/nis_call.c index 3fa37e4..cb7839a 100644 --- a/nis/nis_call.c +++ b/nis/nis_call.c @@ -680,16 +680,18 @@ nis_server_cache_add (const_nis_name name, int search_parent, /* Choose which entry should be evicted from the cache. */ loc = &nis_server_cache[0]; if (*loc != NULL) - for (i = 1; i < 16; ++i) - if (nis_server_cache[i] == NULL) - { + { + for (i = 1; i < 16; ++i) + if (nis_server_cache[i] == NULL) + { + loc = &nis_server_cache[i]; + break; + } + else if ((*loc)->uses > nis_server_cache[i]->uses + || ((*loc)->uses == nis_server_cache[i]->uses + && (*loc)->expires > nis_server_cache[i]->expires)) loc = &nis_server_cache[i]; - break; - } - else if ((*loc)->uses > nis_server_cache[i]->uses - || ((*loc)->uses == nis_server_cache[i]->uses - && (*loc)->expires > nis_server_cache[i]->expires)) - loc = &nis_server_cache[i]; + } old = *loc; *loc = new; diff --git a/stdlib/setenv.c b/stdlib/setenv.c index da61ee0..e66045f 100644 --- a/stdlib/setenv.c +++ b/stdlib/setenv.c @@ -278,18 +278,20 @@ unsetenv (const char *name) ep = __environ; if (ep != NULL) while (*ep != NULL) - if (!strncmp (*ep, name, len) && (*ep)[len] == '=') - { - /* Found it. Remove this pointer by moving later ones back. */ - char **dp = ep; - - do - dp[0] = dp[1]; - while (*dp++); - /* Continue the loop in case NAME appears again. */ - } - else - ++ep; + { + if (!strncmp (*ep, name, len) && (*ep)[len] == '=') + { + /* Found it. Remove this pointer by moving later ones back. */ + char **dp = ep; + + do + dp[0] = dp[1]; + while (*dp++); + /* Continue the loop in case NAME appears again. */ + } + else + ++ep; + } UNLOCK;