delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2013/05/21/15:25:36

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=BpsnxBe5sxWvAoJAwTVQxC0n37l6
X0F0RcDU6wxvneuIZM0Y5DUsGjyXw7ggHLyhEPx0SjqL913DrqwAV2EPaU3IwfDB
G13/4ptVQmxt0CKp6YfnkGFSD0cxyD6AyJz19HpZMtmcSqBBcdooxMczF0kwDK8k
C1v2Mh0EcWAKEuI=
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=3qgGbChOO8NUYJzUDBNPc+mNZXU=; b=iq
Xhl/Y5UFubMoigRUX2Vapovkp/oh7J8ddsb0t3IG7RjYyfyEFKmnrQLAbJDdlQij
QiJ/g3Orx8EOBkmi3S6Xg5616ICabua/NqiImaqB60pb2IwTLxbcBvwBwD+UYyzK
olhS8cuF+Drc5jmcKPlxyPDeo/QIOvDtsBnhJc80k=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
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
Mime-Version: 1.0 (Mac OS X Mail 6.3 \(1503\))
Subject: Re: Inconsistency with coreutils: _Static_assert()
From: Denis Excoffier <cygwin AT Denis-Excoffier DOT org>
In-Reply-To: <20130521160846.GP2406@calimero.vinschen.de>
Date: Tue, 21 May 2013 21:25:02 +0200
Message-Id: <4DB22033-B92B-45C0-81F3-72D10CBDA8C0@Denis-Excoffier.org>
References: <97bfaa4aab229c706de5732905c96b44 AT denis-excoffier DOT org> <20130521160846 DOT GP2406 AT calimero DOT vinschen DOT de>
To: cygwin AT cygwin DOT com
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id r4LJPVwA010229

On 2013-05-21 18:08, Corinna Vinschen wrote:
> On May 21 17:59, Denis Excoffier wrote:
>> 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).
> 
> 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.

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


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019