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:content-type:mime-version:subject:from :in-reply-to:date:content-transfer-encoding:message-id :references:to; q=dns; s=default; b=d+4kW26333E56zfNoRIj4YGiA97I MRUtAyEZYX7JkOjCnVcw1gziOsqd49Wp5giZOQqEHk4uBFqgSK/purJuVjYXHU26 BawKA345YpmE12ivCUy3UxlyXtfhVBZWUC48sUjANmjaSSvkxCXlU9hpRQ7ZXQkx ZIVW2HrkBECOUSI= 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:content-type:mime-version:subject:from :in-reply-to:date:content-transfer-encoding:message-id :references:to; s=default; bh=NkN2U5kfHGbMBsqBX4DLakPYNhY=; b=UL BnapmB4xybQfCLtVzpNapgiw10ROUtkTe09ZxpOzS34b9IlDNSx1Wd52AZX+FMJT neqxzCFk3VAGHl2MCgKQwpDb5+ZzNurgNPqbmehAfu5y19m3vAvyyNAjnoSEvebg 71TUYAGCfYuJFEXseUH4Z3lQqH8uAl5uZTpLFI+6w= 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=-3.1 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RCVD_IN_DNSWL_NONE,RCVD_IN_HOSTKARMA_YE autolearn=ham version=3.3.1 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 6.3 \(1503\)) Subject: Re: Inconsistency with coreutils: _Static_assert() From: Denis Excoffier In-Reply-To: <20130522085310.GV2406@calimero.vinschen.de> Date: Wed, 22 May 2013 18:17:18 +0200 Message-Id: <7E8B4273-EEA0-4E04-B1F5-B097290EE0B4@Denis-Excoffier.org> 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> <20130522085310 DOT GV2406 AT calimero DOT vinschen DOT de> To: cygwin AT cygwin DOT com Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id r4MGHk4E023775 On 2013-05-22 10:53, Corinna Vinschen wrote: > 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] > This patch works perfectly. Thank you. Denis Excoffier. -- 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