* [PATCH] Enable XSI extensions by default
@ 2017-08-25 6:15 Sebastian Huber
2017-08-25 14:25 ` Corinna Vinschen
2017-08-26 2:19 ` Yaakov Selkowitz
0 siblings, 2 replies; 7+ messages in thread
From: Sebastian Huber @ 2017-08-25 6:15 UTC (permalink / raw)
To: newlib
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Enable XSI extensions by default
2017-08-25 6:15 [PATCH] Enable XSI extensions by default Sebastian Huber
@ 2017-08-25 14:25 ` Corinna Vinschen
2017-08-26 2:19 ` Yaakov Selkowitz
1 sibling, 0 replies; 7+ messages in thread
From: Corinna Vinschen @ 2017-08-25 14:25 UTC (permalink / raw)
To: newlib; +Cc: Yaakov Selkowitz
[-- Attachment #1: Type: text/plain, Size: 591 bytes --]
On Aug 25 07:29, Sebastian Huber wrote:
> 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.
Sounds right to me, but I'd like to have Yaakov's input as our
local header standarizer :)
Yaakov?
Corinna
--
Corinna Vinschen
Cygwin Maintainer
Red Hat
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Enable XSI extensions by default
2017-08-25 6:15 [PATCH] Enable XSI extensions by default Sebastian Huber
2017-08-25 14:25 ` Corinna Vinschen
@ 2017-08-26 2:19 ` Yaakov Selkowitz
2017-08-28 10:47 ` Corinna Vinschen
2017-08-29 19:15 ` [PATCH] include: fix ffs, fls guards Yaakov Selkowitz
1 sibling, 2 replies; 7+ messages in thread
From: Yaakov Selkowitz @ 2017-08-26 2:19 UTC (permalink / raw)
To: newlib
On 2017-08-25 00:29, Sebastian Huber wrote:
> 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]
Then the guards on ffs need to be fixed to match glibc.
> This is not the case for glibc and FreeBSD. On FreeBSD __XSI_VISBLE is
> by default defined to 700. Do this also on Newlib.
Nak. glibc does *not* enable XSI extensions by default.
--
Yaakov
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Enable XSI extensions by default
2017-08-26 2:19 ` Yaakov Selkowitz
@ 2017-08-28 10:47 ` Corinna Vinschen
2017-08-29 19:15 ` [PATCH] include: fix ffs, fls guards Yaakov Selkowitz
1 sibling, 0 replies; 7+ messages in thread
From: Corinna Vinschen @ 2017-08-28 10:47 UTC (permalink / raw)
To: newlib
[-- Attachment #1: Type: text/plain, Size: 889 bytes --]
On Aug 25 14:18, Yaakov Selkowitz wrote:
> On 2017-08-25 00:29, Sebastian Huber wrote:
> > 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]
>
> Then the guards on ffs need to be fixed to match glibc.
glibc man page claims
_POSIX_C_SOURCE >= 200809L
|| /* Glibc since 2.19: */ _DEFAULT_SOURCE
|| /* Glibc versions <= 2.19: */ _BSD_SOURCE ||
_SVID_SOURCE
> > This is not the case for glibc and FreeBSD. On FreeBSD __XSI_VISBLE is
> > by default defined to 700. Do this also on Newlib.
>
> Nak. glibc does *not* enable XSI extensions by default.
>
> --
> Yaakov
Corinna
--
Corinna Vinschen
Cygwin Maintainer
Red Hat
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] include: fix ffs, fls guards
2017-08-26 2:19 ` Yaakov Selkowitz
2017-08-28 10:47 ` Corinna Vinschen
@ 2017-08-29 19:15 ` Yaakov Selkowitz
2017-08-29 19:37 ` Corinna Vinschen
1 sibling, 1 reply; 7+ messages in thread
From: Yaakov Selkowitz @ 2017-08-29 19:15 UTC (permalink / raw)
To: newlib
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
---
newlib/libc/include/strings.h | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/newlib/libc/include/strings.h b/newlib/libc/include/strings.h
index 35fcdc092..122f2fcd6 100644
--- a/newlib/libc/include/strings.h
+++ b/newlib/libc/include/strings.h
@@ -50,12 +50,14 @@ void bzero(void *, size_t); /* LEGACY */
#if __BSD_VISIBLE
void explicit_bzero(void *, size_t);
#endif
-#if __XSI_VISIBLE
+#if __MISC_VISIBLE || __POSIX_VISIBLE < 200809 || __XSI_VISIBLE >= 700
int ffs(int) __pure2;
#endif
-#if __BSD_VISIBLE
+#if __GNU_VISIBLE
int ffsl(long) __pure2;
int ffsll(long long) __pure2;
+#endif
+#if __BSD_VISIBLE
int fls(int) __pure2;
int flsl(long) __pure2;
int flsll(long long) __pure2;
--
2.14.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] include: fix ffs, fls guards
2017-08-29 19:15 ` [PATCH] include: fix ffs, fls guards Yaakov Selkowitz
@ 2017-08-29 19:37 ` Corinna Vinschen
2017-08-29 21:50 ` Joel Sherrill
0 siblings, 1 reply; 7+ messages in thread
From: Corinna Vinschen @ 2017-08-29 19:37 UTC (permalink / raw)
To: newlib
[-- Attachment #1: Type: text/plain, Size: 1024 bytes --]
On Aug 29 12:58, Yaakov Selkowitz wrote:
> Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
> ---
> newlib/libc/include/strings.h | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/newlib/libc/include/strings.h b/newlib/libc/include/strings.h
> index 35fcdc092..122f2fcd6 100644
> --- a/newlib/libc/include/strings.h
> +++ b/newlib/libc/include/strings.h
> @@ -50,12 +50,14 @@ void bzero(void *, size_t); /* LEGACY */
> #if __BSD_VISIBLE
> void explicit_bzero(void *, size_t);
> #endif
> -#if __XSI_VISIBLE
> +#if __MISC_VISIBLE || __POSIX_VISIBLE < 200809 || __XSI_VISIBLE >= 700
> int ffs(int) __pure2;
> #endif
> -#if __BSD_VISIBLE
> +#if __GNU_VISIBLE
> int ffsl(long) __pure2;
> int ffsll(long long) __pure2;
> +#endif
> +#if __BSD_VISIBLE
> int fls(int) __pure2;
> int flsl(long) __pure2;
> int flsll(long long) __pure2;
> --
> 2.14.1
ACK, please push.
Thanks,
Corinna
--
Corinna Vinschen
Cygwin Maintainer
Red Hat
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] include: fix ffs, fls guards
2017-08-29 19:37 ` Corinna Vinschen
@ 2017-08-29 21:50 ` Joel Sherrill
0 siblings, 0 replies; 7+ messages in thread
From: Joel Sherrill @ 2017-08-29 21:50 UTC (permalink / raw)
To: newlib
We had two targets (or1k and epiphany) for RTEMS that were
using gcc 4.9.x with the current newlib snapshot. They
were giving no prototype warnings for flsl(). The targets
on gcc 7.2 were not giving that warning on the same code.
Would you expect this to fix that?
--joel
On 8/29/2017 2:15 PM, Corinna Vinschen wrote:
> On Aug 29 12:58, Yaakov Selkowitz wrote:
>> Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
>> ---
>> newlib/libc/include/strings.h | 6 ++++--
>> 1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/newlib/libc/include/strings.h b/newlib/libc/include/strings.h
>> index 35fcdc092..122f2fcd6 100644
>> --- a/newlib/libc/include/strings.h
>> +++ b/newlib/libc/include/strings.h
>> @@ -50,12 +50,14 @@ void bzero(void *, size_t); /* LEGACY */
>> #if __BSD_VISIBLE
>> void explicit_bzero(void *, size_t);
>> #endif
>> -#if __XSI_VISIBLE
>> +#if __MISC_VISIBLE || __POSIX_VISIBLE < 200809 || __XSI_VISIBLE >= 700
>> int ffs(int) __pure2;
>> #endif
>> -#if __BSD_VISIBLE
>> +#if __GNU_VISIBLE
>> int ffsl(long) __pure2;
>> int ffsll(long long) __pure2;
>> +#endif
>> +#if __BSD_VISIBLE
>> int fls(int) __pure2;
>> int flsl(long) __pure2;
>> int flsll(long long) __pure2;
>> --
>> 2.14.1
>
> ACK, please push.
>
>
> Thanks,
> Corinna
>
--joel
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2017-08-29 19:37 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-25 6:15 [PATCH] Enable XSI extensions by default Sebastian Huber
2017-08-25 14:25 ` Corinna Vinschen
2017-08-26 2:19 ` Yaakov Selkowitz
2017-08-28 10:47 ` Corinna Vinschen
2017-08-29 19:15 ` [PATCH] include: fix ffs, fls guards Yaakov Selkowitz
2017-08-29 19:37 ` Corinna Vinschen
2017-08-29 21:50 ` Joel Sherrill
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).