This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Inconsistency with coreutils: _Static_assert()


Hello,

I compile coreutils-8.21 under Cygwin (Windows XP). I'm using
gcc-4.8.0 with no problem, except that under _any_ snapshot posterior to
plain 1.7.18, i obtain the following (with plain 1.7.18, or under
gcc-4.5.3 it works perfectly):

---------------
...
depbase=`echo src/chroot.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
gcc -std=gnu99 -I. -I./lib -Ilib -I./lib -Isrc -I./src -g -O2 -MT src/chroot.o -MD -MP -MF $depbase.Tpo -c -o src/chroot.o src/chroot.c &&\
mv -f $depbase.Tpo $depbase.Po
In file included from /usr/include/sys/stdio.h:14:0,
                 from /usr/include/stdio.h:62,
                 from ./lib/stdio.h:43,
                 from src/chroot.c:21:
src/chroot.c: In function 'set_additional_groups':
./lib/verify.h:181:8: error: expected specifier-qualifier-list before 'typedef'
        _Static_assert (R, DIAGNOSTIC);          \
        ^
./lib/verify.h:166:16: note: in expansion of macro '_GL_VERIFY_TYPE'
     (!!sizeof (_GL_VERIFY_TYPE (R, DIAGNOSTIC)))
                ^
./lib/verify.h:230:25: note: in expansion of macro '_GL_VERIFY_TRUE'
 # define verify_true(R) _GL_VERIFY_TRUE (R, "verify_true (" #R ")")
                         ^
src/system.h:247:35: note: in expansion of macro 'verify_true'
 #define X2NREALLOC(P, PN) ((void) verify_true (sizeof *(P) != 1), \
                                   ^
src/chroot.c:103:16: note: in expansion of macro 'X2NREALLOC'
         gids = X2NREALLOC (gids, &n_gids_allocated);
                ^
Makefile:6662: recipe for target 'src/chroot.o' failed
make: *** [src/chroot.o] Error 1
---------------

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).

With line 271 of /usr/include/sys/cdefs.h commented out, everything is
fine.

I suppose that /usr/include/sys/cdefs.h should be adjusted (if
compilation under GCC >= 4.6 is desired). For coreutils also,
_Static_assert() should be _tested_ (as part of configure) instead of
to rely on some GCC version.

Regards,

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]