X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:reply-to :references:mime-version:content-type:in-reply-to; q=dns; s= default; b=F48VucZoM8zEnTEa3UM6oHJ9Ri27HGxTi7cDOreIXuiZqmlhlq+mZ 8LiEmTDSg5cLjcglg69in+MiLYnI4zZMIwF2E6Ur+FYm5Ow6Twuc+dJ5V/AQpsKj 8JZzGpgdlpBwQLhFYFnqqu1631U8F/MwTDTeVw2vzt0F5HZuoPTXwI= 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:date:from:to:subject:message-id:reply-to :references:mime-version:content-type:in-reply-to; s=default; bh=PUy7RFamPRA9qKsC40Rzp+auFGQ=; b=vpWlXY4aqOssUOfmI7W5m7mfuANO x1xpD5ymsqySdV/8DvYa4xaFkgI8ncjlP1br3U7E7o+UAoZ0+dOye3qPm28WzbkN kY5g+yNdLBt27ob/Eu+SNbVs2P5QzZmMERqVgNMEwcaSDhsXa/nfctHKZB2Q6ylH XfB1CWgQyOl/DUQ= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.1 Date: Wed, 22 May 2013 10:53:10 +0200 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: Inconsistency with coreutils: _Static_assert() Message-ID: <20130522085310.GV2406@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <97bfaa4aab229c706de5732905c96b44 AT denis-excoffier DOT org> <20130521160846 DOT GP2406 AT calimero DOT vinschen DOT de> <4DB22033-B92B-45C0-81F3-72D10CBDA8C0 AT Denis-Excoffier DOT org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <4DB22033-B92B-45C0-81F3-72D10CBDA8C0@Denis-Excoffier.org> User-Agent: Mutt/1.5.21 (2010-09-15) On May 21 21:25, Denis Excoffier wrote: > On 2013-05-21 18:08, Corinna Vinschen wrote: > > On May 21 17:59, Denis Excoffier wrote: > >> I have narrowed the problem down to /usr/include/sys/cdefs.h, where > >> (line 271) you have _Static_assert defined: > >> #define _Static_assert(x, y) __Static_assert(x, __COUNTER__) > >> > >> This definition occurs even under GCC 4.6.0 (and later) where > >> _Static_assert() indeed works. As a consequence, it no longer works as > >> expected in coreutils-8.21/lib/verify.h (lines 24 and 181). > > > > Sorry, but I don't grok this sentence. Since the cdefs.h version > > works as expected, it does not work in coreutils' verify.h? Who > > exactly is wrong, cdefs.h or verify.h? And *what* exactly is wrong > > with the definition? > As soon as you are under GCC >= 4.6, _Static_assert() works directly, > hence line 271 of cdefs.h is not needed. More than that, when you > (re)define it to something else, the original behavior is no longer > available, and e.g. coreutils (that is "verify.h") fails to compile. > > You should (IMHO) change cdefs.h in order to read (as far as only > _Static_assert is concerned): > > #if defined(__cplusplus) && __cplusplus >= 201103L > . . . (same) . . . > #elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L > . . . (same) . . . > #elif (4 < __GNUC__ || (__GNUC__ == 4 && 6 <= __GNUC_MINOR__)) && !defined __cplusplus > /* Do nothing: _Static_assert() works as per C11 */ > #else > /* Not supported. Implement them using our versions. */ > . . . (same) . . . > #endif > > I don't really know if the lines above correctly take care of > __STRICT_ANSI__ but you get the idea. I tried it, and it looks like the definition of _Static_assert in gcc >= 4.6 is independent of __STRICT_ANSI__. Can you test this patch to sys/cdefs.h, please? Index: sys/cdefs.h =================================================================== RCS file: /cvs/src/src/newlib/libc/include/sys/cdefs.h,v retrieving revision 1.4 diff -u -p -r1.4 cdefs.h --- sys/cdefs.h 22 Apr 2013 10:28:05 -0000 1.4 +++ sys/cdefs.h 22 May 2013 08:52:51 -0000 @@ -267,7 +267,9 @@ #define _Alignof(x) __alignof(x) #define _Noreturn __dead2 #define _Thread_local __thread -#ifdef __COUNTER__ +#if __GNUC_PREREQ__(4, 6) && !defined(__cplusplus) +/* Do nothing: _Static_assert() works as per C11 */ +#elif defined(__COUNTER__) #define _Static_assert(x, y) __Static_assert(x, __COUNTER__) #define __Static_assert(x, y) ___Static_assert(x, y) #define ___Static_assert(x, y) typedef char __assert_ ## y[(x) ? 1 : -1] Thanks, Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple