This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: A small issue with _GNU_SOURCE
- From: Jon TURNEY <jon dot turney at dronecode dot org dot uk>
- To: newlib at sourceware dot org
- Date: Wed, 25 Feb 2015 16:04:57 +0000
- Subject: Re: A small issue with _GNU_SOURCE
- Authentication-results: sourceware.org; auth=none
- References: <54E5ECE5 dot 1020909 at dronecode dot org dot uk> <20150219143345 dot GK26084 at calimero dot vinschen dot de> <54EC72A1 dot 3080507 at dronecode dot org dot uk> <20150224132857 dot GG437 at calimero dot vinschen dot de>
On 24/02/2015 13:28, Corinna Vinschen wrote:
On Feb 24 12:46, Jon TURNEY wrote:
* libc/include/sys/cdefs.h (_GNU_SOURCE): Move check so it has an
effect when _XOPEN_SOURCE is also defined.
Looks good, with a single nit:
+/* Deal with _GNU_SOURCE, which implies everything and the kitchen sink */
+#ifdef _GNU_SOURCE
Before defining _XOPEN_SOURCE this should undef _XOPEN_SOURCE to avoid
potential compiler warnings about a redefined macro. With this change,
please apply.
Done.
But even now, I'm not sure this is quite right.
$ cat test.c
#include <string.h>
int main()
{
strdup("test");
return ffsll(0);
}
$ gcc test.c -Wall -ansi
test.c: In function âmainâ:
test.c:7:2: warning: implicit declaration of function âffsllâ
I think this should also warn about no prototype for strdup(), because
that shouldn't be in scope due to __STRICT_ANSI__, which cdefs.h doesn't
even consider...