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: 65886 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp1076002qge; Fri, 15 Apr 2016 02:37:25 -0700 (PDT) X-Received: by 10.66.74.138 with SMTP id t10mr27826747pav.22.1460713045622; Fri, 15 Apr 2016 02:37:25 -0700 (PDT) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id t13si3138550pas.225.2016.04.15.02.37.25 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 Apr 2016 02:37:25 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-68887-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org; spf=pass (google.com: domain of libc-alpha-return-68887-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-68887-patch=linaro.org@sourceware.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:date:message-id:subject:from:to :content-type; q=dns; s=default; b=xmFau4n1B+HFR5dqj/vGu3GeJcPWd GyC3oGUsKBH0hP0cmu5/CU9JVBJ7cVJYjsZngPyH+McLfV7B7URaDd8AF+tN+gF7 omQV+Q79KVyBbgxd5vxOhJMqQbg/A0lMzdvZPd1sMxuMpOH4JRRtMwRk0dKFC0h3 MuGukMu0UNU5lw= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:date:message-id:subject:from:to :content-type; s=default; bh=mKrEGPf9lsAXHXcCldJjULiWiB0=; b=onz 4m4ccm5V8Bv5iWvbQeICB/kw4ntJCd7OBtmM+Bt2NuonejL8PHvjCEBLIfDD1Q2f HkorcN3vauGocGmvQaceMOx1wvZMzKeZzmOIswmY7yBOuJV5Rjdhvs5HriO9Zu3z GcdR8zpUNA7vdldI0Bmdiwn4QXX0g0yghNfEbBp8= 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;