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