This is the mail archive of the newlib@sourceware.org mailing list for the newlib 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] |
On Feb 19 14:02, Jon TURNEY wrote: > Consider the following: > > $ cat test.c > > #include <string.h> > > int main() > { > strdup("test"); > return ffsll(0); > } > > ffsll() is a GNU extension and should be prototyped when _GNU_SOURCE is > defined. > > strdup() is in SUSv2 and requires _XOPEN_SOURCE=500 > > $ gcc test.c -Wall -ansi -D_XOPEN_SOURCE=500 > test.c: In function âmainâ: > test.c:8:2: warning: implicit declaration of function âffsllâ > > I think this is correct > > $ gcc test.c -Wall -ansi -D_GNU_SOURCE > > Since _GNU_SOURCE implies _XOPEN_SOURCE=700, this is as expected. > > $ gcc test.c -Wall -ansi -D_XOPEN_SOURCE=500 -D_GNU_SOURCE > test.c: In function âmainâ: > test.c:8:2: warning: implicit declaration of function âffsllâ > > This looks like a problem with the way _GNU_SOURCE has been added to > newlib's sys/cdefs.h. _XOPEN_SOURCE causes _POSIX_C_SOURCE to be defined, > which prevents _GNU_SOURCE from being considered. > > I'm not sure about the right way to fix this. Maybe by changing the evaluation order in sys/cdefs.h. _GNU_SOURCE implies "everything and the kitchen sink" as the comment says, #define __POSIX_VISIBLE 200809 #define __XSI_VISIBLE 700 #define __BSD_VISIBLE 1 #define __ISO_C_VISIBLE 2011 #define __GNU_VISIBLE 1 so it might be prudent to check for _GNU_SOURCE before checking for _XOPEN_SOURCE, instead of checking only if _POSIX_SOURCE/_POSIX_C_SOURCE is not set. Corinna -- Corinna Vinschen Cygwin Maintainer Red Hat
Attachment:
pgpW1p_CTC33K.pgp
Description: PGP signature
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |