From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 44905 invoked by alias); 24 Nov 2016 02:59:40 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 44833 invoked by uid 89); 24 Nov 2016 02:59:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.8 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=H*Ad:U*roland X-HELO: mailbackend.panix.com X-Gm-Message-State: AKaTC02HAozkFpi79BvC4U7oW9SLWtX6YRLOQo704oXsC6ynWhFPzLAaxxzBmNfCPUSkl4n/m5HDu9jfUbUx8g== X-Received: by 10.194.52.42 with SMTP id q10mr109978wjo.50.1479956366447; Wed, 23 Nov 2016 18:59:26 -0800 (PST) MIME-Version: 1.0 In-Reply-To: References: <1405537923-28692-1-git-send-email-jim@meyering.net> <20140716201505.34FF22C398F@topped-with-meat.com> From: Zack Weinberg Date: Thu, 24 Nov 2016 02:59:00 -0000 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] assert.h: allow gcc to detect assert(a = 1) errors To: Jim Meyering Cc: Roland McGrath , libc-alpha Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-SW-Source: 2016-11/txt/msg00868.txt.bz2 On Wed, Nov 23, 2016 at 9:21 PM, Jim Meyering wrote: [...] Not commenting on anything else, but... > We *do* need that __STRICT_ANSI__ disjunct. > Otherwise, this would evoke no warning: > > $ gcc -isystem. -I. -Werror=3Dpedantic k.c > In file included from k.c:1:0: > k.c: In function =E2=80=98main=E2=80=99: > k.c:2:23: warning: ISO C forbids braced-groups within expressions [-Wpe= dantic] > int main() { assert ( ({1;}) ); return 0; } ... Would you please file a feature-request with the gcc people asking for something that turns __extension__ back off? It would be nice to be able to get this right even in __STRICT_ANSI__ mode. I'm imagining that your macro could look like #define assert(expr) \ __extension__ ({ \ if (__noextension__ (expr)) \ ; \ else __assert_failed (...); \ (void)0; \ }) (Make clear that the parentheses in __noextension__(...) need to not count for the purpose of -Wparentheses.) zw