X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org Date: Wed, 8 Feb 2012 15:06:57 +0100 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: is broken Message-ID: <20120208140657.GJ25129@calimero.vinschen.de> Mail-Followup-To: cygwin AT cygwin DOT com References: <4F3279AC DOT 2010705 AT redhat DOT com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <4F3279AC.2010705@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: 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 On Feb 8 06:33, Eric Blake wrote: > STC showing that sysmacros doesn't work when included indirectly in C99 > mode: > > $ cat foo.c > #include > int main() { return makedev(0,0); } > $ gcc -o foo foo.c > $ gcc -o foo foo.c --std=c99 > /tmp/ccT40f0H.o:foo.c:(.text+0x1e): undefined reference to > `_gnu_dev_makedev' > collect2: ld returned 1 exit status And why is that so? Here's the definition of _ELIDABLE_INLINE in _ansi.h: /* The traditional meaning of 'extern inline' for GCC is not to emit the function body unless the address is explicitly taken. However this behaviour is changing to match the C99 standard, which uses 'extern inline' to indicate that the function body *must* be emitted. If we are using GCC, but do not have the new behaviour, we need to use extern inline; if we are using a new GCC with the C99-compatible behaviour, or a non-GCC compiler (which we will have to hope is C99, since there is no other way to achieve the effect of omitting the function if it isn't referenced) we just use plain 'inline', which c99 defines to mean more-or-less the same as the Gnu C 'extern inline'. */ #if defined(__GNUC__) && !defined(__GNUC_STDC_INLINE__) /* We're using GCC, but without the new C99-compatible behaviour. */ #define _ELIDABLE_INLINE extern __inline__ _ATTRIBUTE ((__always_inline__)) #else /* We're using GCC in C99 mode, or an unknown compiler which we just have to hope obeys the C99 semantics of inline. */ #define _ELIDABLE_INLINE __inline__ #endif I really don't care for strict compiler modes, but shouldn't that have taken care of the problem? If not, PTC. > Another STC showing that sysmacros is broken as a standalone header: > > $ cat bar.c > #include > int main() { return makedev(0,0); } > $ gcc -o foo foo.c > In file include from foo.c:1:0: > /usr/include/sys/sysmacros.h:14:18: error: expected `=', `,', `;', > `asm', or `__attribute__' before `int' This one's easy. We just have to include sys/types.h. I apply a patch. Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader 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