This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
[PATCH] Enable XSI extensions by default
- From: Sebastian Huber <sebastian dot huber at embedded-brains dot de>
- To: newlib at sourceware dot org
- Date: Fri, 25 Aug 2017 07:29:03 +0200
- Subject: [PATCH] Enable XSI extensions by default
- Authentication-results: sourceware.org; auth=none
This test program
#include <strings.h>
int f(int i)
{
return ffs(i);
}
resulted in the follwing GCC warning
warning: implicit declaration of function 'ffs' [-Wimplicit-function-declaration]
This is not the case for glibc and FreeBSD. On FreeBSD __XSI_VISBLE is
by default defined to 700. Do this also on Newlib.
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
---
newlib/libc/include/sys/features.h | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/newlib/libc/include/sys/features.h b/newlib/libc/include/sys/features.h
index c9133af57..4102903bc 100644
--- a/newlib/libc/include/sys/features.h
+++ b/newlib/libc/include/sys/features.h
@@ -96,13 +96,13 @@ extern "C" {
* _GNU_SOURCE
* All of the above plus GNU extensions
*
* _BSD_SOURCE (deprecated by _DEFAULT_SOURCE)
* _SVID_SOURCE (deprecated by _DEFAULT_SOURCE)
* _DEFAULT_SOURCE (or none of the above)
- * POSIX-1.2008 with BSD and SVr4 extensions
+ * POSIX-1.2008 with BSD, SVr4 and XSI extensions
*/
#ifdef _GNU_SOURCE
#undef _ATFILE_SOURCE
#define _ATFILE_SOURCE 1
#undef _DEFAULT_SOURCE
@@ -131,12 +131,14 @@ extern "C" {
#if defined(_DEFAULT_SOURCE)
#undef _POSIX_SOURCE
#define _POSIX_SOURCE 1
#undef _POSIX_C_SOURCE
#define _POSIX_C_SOURCE 200809L
+#undef _XOPEN_SOURCE
+#define _XOPEN_SOURCE 700
#endif
#if !defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE) && \
((!defined(__STRICT_ANSI__) && !defined(_ANSI_SOURCE)) || \
(_XOPEN_SOURCE - 0) >= 500)
#define _POSIX_SOURCE 1
@@ -197,13 +199,13 @@ extern "C" {
* SUSv2 XSI extensions; enabled with _XOPEN_SOURCE >= 500.
*
* __XSI_VISIBLE >= 600
* SUSv3 XSI extensions; enabled with _XOPEN_SOURCE >= 600.
*
* __XSI_VISIBLE >= 700
- * SUSv4 XSI extensions; enabled with _XOPEN_SOURCE >= 700.
+ * SUSv4 XSI extensions; enabled by default, or with _XOPEN_SOURCE >= 700.
*
* __ISO_C_VISIBLE >= 1999
* ISO C99; enabled with gcc -std=c99 or newer (on by default since GCC 5),
* any version of C++, or with _ISOC99_SOURCE, _POSIX_C_SOURCE >= 200112L,
* or _XOPEN_SOURCE >= 600.
*
--
2.12.3