From 3f2e46a4948c846023275eb7a8c86ede0313cd2f Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Wed, 4 Sep 2013 15:25:42 +0000 Subject: Remove --disable-versioning. --- include/libc-symbols.h | 4 ++-- include/shlib-compat.h | 8 ++------ 2 files changed, 4 insertions(+), 8 deletions(-) (limited to 'include') diff --git a/include/libc-symbols.h b/include/libc-symbols.h index a3b6274bad..5f603a2864 100644 --- a/include/libc-symbols.h +++ b/include/libc-symbols.h @@ -322,7 +322,7 @@ for linking") past the last element in SET. */ #define symbol_set_end_p(set, ptr) ((ptr) >= (void *const *) &__stop_##set) -#if DO_VERSIONING +#ifdef SHARED # define symbol_version(real, name, version) \ _symbol_version(real, name, version) # define default_symbol_version(real, name, version) \ @@ -466,7 +466,7 @@ for linking") versioned_symbol (libc, __real_foo, foo, GLIBC_2_1); libc_hidden_ver (__real_foo, foo) */ -#if defined SHARED && defined DO_VERSIONING && !defined NO_HIDDEN +#if defined SHARED && !defined NO_HIDDEN # ifndef __ASSEMBLER__ # define __hidden_proto_hiddenattr(attrs...) \ __attribute__ ((visibility ("hidden"), ##attrs)) diff --git a/include/shlib-compat.h b/include/shlib-compat.h index 979b5929e3..955c6aeea2 100644 --- a/include/shlib-compat.h +++ b/include/shlib-compat.h @@ -19,13 +19,9 @@ #ifndef _SHLIB_COMPAT_H #define _SHLIB_COMPAT_H 1 -#if defined DO_VERSIONING -/* Since there is just one set of .d files generated, we need to - include this unconditionally to have the dependency noticed properly. */ -#include /* header generated by abi-versions.awk */ -#endif +#ifdef SHARED -#if defined SHARED && defined DO_VERSIONING +# include /* The file abi-versions.h (generated by scripts/abi-versions.awk) defines symbols like `ABI_libm_GLIBC_2_0' for each version set in the source -- cgit v1.2.3 From b92a20b5603bfb7cd7cd775f3ca9099731ac63cf Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Wed, 4 Sep 2013 20:47:21 +0000 Subject: conformtest: Fix namespace testing. --- ChangeLog | 10 ++++++++++ conform/conformtest.pl | 4 +++- include/complex.h | 2 ++ include/fenv.h | 4 ++-- 4 files changed, 17 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/ChangeLog b/ChangeLog index 15602cef32..1f291278b6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2013-09-04 Joseph Myers + + * conform/conformtest.pl (newtoken): Treat tokens not allowed as + errors. + (top level): Treat second token from macro or constant entries for + allowed headers as allowed. + * include/complex.h: Condition internal declarations on + [!_ISOMAC]. + * include/fenv.h: Condition include of and internal + declarations on [!_ISOMAC]. 2013-09-04 Chris Leonard diff --git a/conform/conformtest.pl b/conform/conformtest.pl index ec2e9c308b..8b97d0dfc7 100644 --- a/conform/conformtest.pl +++ b/conform/conformtest.pl @@ -236,6 +236,8 @@ sub newtoken { for ($idx = 0; $idx <= $#allow; ++$idx) { return if (poorfnmatch ($allow[$idx], $token)); } + + $errors{$token} = 1; } @@ -786,7 +788,7 @@ while ($#headers >= 0) { if (/^element *({([^}]*)}|([^ ]*)) *({([^}]*)}|([^ ]*)) *([A-Za-z0-9_]*) *(.*)/) { push @allow, $7; } elsif (/^(macro|constant|macro-constant|macro-int-constant) +([a-zA-Z0-9_]*) *(?:{([^}]*)} *)?(?:([>= +# ifndef _ISOMAC /* Return the complex inverse hyperbolic sine of finite nonzero Z, with the imaginary part of the result subtracted from pi/2 if ADJ is nonzero. */ extern complex float __kernel_casinhf (complex float z, int adj); extern complex double __kernel_casinh (complex double z, int adj); extern complex long double __kernel_casinhl (complex long double z, int adj); +# endif #endif diff --git a/include/fenv.h b/include/fenv.h index 9f90d17090..925d4b50c3 100644 --- a/include/fenv.h +++ b/include/fenv.h @@ -1,8 +1,8 @@ #ifndef _FENV_H #include -#include #ifndef _ISOMAC +# include /* Now define the internal interfaces. */ extern int __feclearexcept (int __excepts); @@ -22,7 +22,6 @@ libm_hidden_proto (feholdexcept) libm_hidden_proto (feupdateenv) libm_hidden_proto (fetestexcept) libm_hidden_proto (feclearexcept) -#endif /* Rounding mode context. This allows functions to set/restore rounding mode only when the desired rounding mode is different from the current rounding @@ -32,5 +31,6 @@ struct rm_ctx fenv_t env; bool updated_status; }; +#endif #endif -- cgit v1.2.3 From 5bb43a43199e2bc3f729b858d26c47e91fd56621 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Fri, 20 Sep 2013 21:24:53 +0200 Subject: Make __ffs hidden --- ChangeLog | 10 ++++++++++ include/string.h | 1 + ports/ChangeLog.alpha | 5 +++++ ports/ChangeLog.arm | 4 ++++ ports/ChangeLog.m68k | 4 ++++ ports/ChangeLog.tile | 4 ++++ ports/sysdeps/alpha/alphaev67/ffs.S | 1 + ports/sysdeps/alpha/ffs.S | 1 + ports/sysdeps/arm/armv6t2/ffs.S | 1 + ports/sysdeps/m68k/ffs.c | 1 + ports/sysdeps/tile/ffs.c | 1 + string/ffs.c | 1 + sysdeps/i386/ffs.c | 1 + sysdeps/i386/i686/ffs.c | 1 + sysdeps/powerpc/ffs.c | 1 + sysdeps/s390/ffs.c | 1 + sysdeps/x86_64/ffs.c | 1 + 17 files changed, 39 insertions(+) (limited to 'include') diff --git a/ChangeLog b/ChangeLog index 70a44080eb..a7791b2f0b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2013-09-20 Andreas Schwab + + * include/string.h (__ffs): Declare as hidden. + * string/ffs.c (__ffs): Define as hidden. + * sysdeps/i386/ffs.c (__ffs): Likewise. + * sysdeps/i386/i686/ffs.c (__ffs): Likewise. + * sysdeps/powerpc/ffs.c (__ffs): Likewise. + * sysdeps/s390/ffs.c (__ffs): Likewise. + * sysdeps/x86_64/ffs.c (__ffs): Likewise. + 2013-09-20 Alexandre Oliva * NEWS: Mention malloc probes. diff --git a/include/string.h b/include/string.h index d6d859491e..8323412240 100644 --- a/include/string.h +++ b/include/string.h @@ -90,6 +90,7 @@ extern char *__strsep_g (char **__stringp, const char *__delim); libc_hidden_proto (__strsep_g) libc_hidden_proto (strnlen) libc_hidden_proto (memmem) +libc_hidden_proto (__ffs) libc_hidden_builtin_proto (memchr) libc_hidden_builtin_proto (memcpy) diff --git a/ports/ChangeLog.alpha b/ports/ChangeLog.alpha index e47d46f12b..1b58cb8670 100644 --- a/ports/ChangeLog.alpha +++ b/ports/ChangeLog.alpha @@ -1,3 +1,8 @@ +2013-09-20 Andreas Schwab + + * sysdeps/alpha/alphaev67/ffs.S (__ffs): Define as hidden. + * sysdeps/alpha/ffs.S (__ffs): Likewise. + 2013-09-11 Andreas Schwab * sysdeps/unix/sysv/linux/alpha/bits/fcntl.h (__O_TMPFILE): diff --git a/ports/ChangeLog.arm b/ports/ChangeLog.arm index bff557c732..d7b29e5f97 100644 --- a/ports/ChangeLog.arm +++ b/ports/ChangeLog.arm @@ -1,3 +1,7 @@ +2013-09-20 Andreas Schwab + + * sysdeps/arm/armv6t2/ffs.S (__ffs): Define as hidden. + 2013-09-18 Dinar Temirbulatov [BZ #15640] diff --git a/ports/ChangeLog.m68k b/ports/ChangeLog.m68k index ba9865a9da..4f933c6f92 100644 --- a/ports/ChangeLog.m68k +++ b/ports/ChangeLog.m68k @@ -1,3 +1,7 @@ +2013-09-20 Andreas Schwab + + * sysdeps/m68k/ffs.c (__ffs): Define as hidden. + 2013-09-04 Joseph Myers * sysdeps/unix/sysv/linux/m68k/mmap64.c: New file. diff --git a/ports/ChangeLog.tile b/ports/ChangeLog.tile index 5ad254c5ff..79d15b464c 100644 --- a/ports/ChangeLog.tile +++ b/ports/ChangeLog.tile @@ -1,3 +1,7 @@ +2013-09-20 Andreas Schwab + + * sysdeps/tile/ffs.c (__ffs): Define as hidden. + 2013-08-21 Ondřej Bílka * sysdeps/tile/jmpbuf-offsets.h: Fix typos. diff --git a/ports/sysdeps/alpha/alphaev67/ffs.S b/ports/sysdeps/alpha/alphaev67/ffs.S index e4531525a7..9b3463cbc6 100644 --- a/ports/sysdeps/alpha/alphaev67/ffs.S +++ b/ports/sysdeps/alpha/alphaev67/ffs.S @@ -47,4 +47,5 @@ ENTRY(__ffs) END(__ffs) weak_alias (__ffs, ffs) +libc_hidden_def (__ffs) libc_hidden_builtin_def (ffs) diff --git a/ports/sysdeps/alpha/ffs.S b/ports/sysdeps/alpha/ffs.S index def0f25d77..d1f0c83719 100644 --- a/ports/sysdeps/alpha/ffs.S +++ b/ports/sysdeps/alpha/ffs.S @@ -85,6 +85,7 @@ $ffsl..ng: END(ffsl) weak_alias (__ffs, ffs) +libc_hidden_def (__ffs) libc_hidden_builtin_def (ffs) weak_extern (ffsl) weak_alias (ffsl, ffsll) diff --git a/ports/sysdeps/arm/armv6t2/ffs.S b/ports/sysdeps/arm/armv6t2/ffs.S index b2c88b9460..9f999306ff 100644 --- a/ports/sysdeps/arm/armv6t2/ffs.S +++ b/ports/sysdeps/arm/armv6t2/ffs.S @@ -32,4 +32,5 @@ END (__ffs) weak_alias (__ffs, ffs) weak_alias (__ffs, ffsl) +libc_hidden_def (__ffs) libc_hidden_builtin_def (ffs) diff --git a/ports/sysdeps/m68k/ffs.c b/ports/sysdeps/m68k/ffs.c index fd4e5ffaed..a3c1a0d02b 100644 --- a/ports/sysdeps/m68k/ffs.c +++ b/ports/sysdeps/m68k/ffs.c @@ -36,6 +36,7 @@ __ffs (x) return 32 - cnt; } weak_alias (__ffs, ffs) +libc_hidden_def (__ffs) libc_hidden_builtin_def (ffs) #undef ffsl weak_alias (__ffs, ffsl) diff --git a/ports/sysdeps/tile/ffs.c b/ports/sysdeps/tile/ffs.c index 93ad9801bd..eb982a6dd3 100644 --- a/ports/sysdeps/tile/ffs.c +++ b/ports/sysdeps/tile/ffs.c @@ -27,6 +27,7 @@ __ffs (int x) return __builtin_ffs (x); } weak_alias (__ffs, ffs) +libc_hidden_def (__ffs) libc_hidden_builtin_def (ffs) #undef ffsll diff --git a/string/ffs.c b/string/ffs.c index a645224f07..916c5c3483 100644 --- a/string/ffs.c +++ b/string/ffs.c @@ -46,6 +46,7 @@ __ffs (i) return table[x >> a] + a; } weak_alias (__ffs, ffs) +libc_hidden_def (__ffs) libc_hidden_builtin_def (ffs) #if ULONG_MAX == UINT_MAX diff --git a/sysdeps/i386/ffs.c b/sysdeps/i386/ffs.c index 47496dcf79..77d2e60b76 100644 --- a/sysdeps/i386/ffs.c +++ b/sysdeps/i386/ffs.c @@ -41,6 +41,7 @@ __ffs (x) return cnt; } weak_alias (__ffs, ffs) +libc_hidden_def (__ffs) libc_hidden_builtin_def (ffs) #undef ffsl weak_alias (__ffs, ffsl) diff --git a/sysdeps/i386/i686/ffs.c b/sysdeps/i386/i686/ffs.c index 5c97050e87..cde1c99566 100644 --- a/sysdeps/i386/i686/ffs.c +++ b/sysdeps/i386/i686/ffs.c @@ -39,6 +39,7 @@ __ffs (x) return cnt + 1; } weak_alias (__ffs, ffs) +libc_hidden_def (__ffs) libc_hidden_builtin_def (ffs) #undef ffsl weak_alias (__ffs, ffsl) diff --git a/sysdeps/powerpc/ffs.c b/sysdeps/powerpc/ffs.c index e0fee46b32..deba0cdd09 100644 --- a/sysdeps/powerpc/ffs.c +++ b/sysdeps/powerpc/ffs.c @@ -35,6 +35,7 @@ __ffs (int x) return 32 - cnt; } weak_alias (__ffs, ffs) +libc_hidden_def (__ffs) libc_hidden_builtin_def (ffs) #if ULONG_MAX == UINT_MAX #undef ffsl diff --git a/sysdeps/s390/ffs.c b/sysdeps/s390/ffs.c index 807441da64..2dbb7430e2 100644 --- a/sysdeps/s390/ffs.c +++ b/sysdeps/s390/ffs.c @@ -63,6 +63,7 @@ __ffs (x) } weak_alias (__ffs, ffs) +libc_hidden_def (__ffs) libc_hidden_builtin_def (ffs) #if ULONG_MAX == UINT_MAX #undef ffsl diff --git a/sysdeps/x86_64/ffs.c b/sysdeps/x86_64/ffs.c index 27013d6ae6..07ee7dd4ab 100644 --- a/sysdeps/x86_64/ffs.c +++ b/sysdeps/x86_64/ffs.c @@ -35,4 +35,5 @@ __ffs (int x) return cnt + 1; } weak_alias (__ffs, ffs) +libc_hidden_def (__ffs) libc_hidden_builtin_def (ffs) -- cgit v1.2.3 From 1484e65736f4cab27e5051e0f06be8470e69af82 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Mon, 4 Nov 2013 15:43:57 +0000 Subject: Define __STDC_IEC_559* based on __GCC_IEC_559*. --- ChangeLog | 7 +++++++ include/stdc-predef.h | 25 ++++++++++++++++++++++--- 2 files changed, 29 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/ChangeLog b/ChangeLog index 4d43eb041e..1fd2463c2e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2013-11-04 Joseph Myers + + * include/stdc-predef.h [__GCC_IEC_559] (__STDC_IEC_559__): Define + depending on [__GCC_IEC_559 > 0]. + [__GCC_IEC_559_COMPLEX] (__STDC_IEC_559_COMPLEX__): Define + depending on [__GCC_IEC_559_COMPLEX > 0]. + 2013-11-03 Chris Leonard * locale/iso-639.def: Add Quechua, Southern (quz) and Silesian (szl) diff --git a/include/stdc-predef.h b/include/stdc-predef.h index b9c9967d9d..f8cb2cb97a 100644 --- a/include/stdc-predef.h +++ b/include/stdc-predef.h @@ -26,9 +26,28 @@ explicitly includes a system header. GCC knows the name of this header in order to preinclude it. */ -/* We do support the IEC 559 math functionality, real and complex. */ -#define __STDC_IEC_559__ 1 -#define __STDC_IEC_559_COMPLEX__ 1 +/* glibc's intent is to support the IEC 559 math functionality, real + and complex. If the GCC (4.9 and later) predefined macros + specifying compiler intent are available, use them to determine + whether the overall intent is to support these features; otherwise, + presume an older compiler has intent to support these features and + define these macros by default. */ + +#ifdef __GCC_IEC_559 +# if __GCC_IEC_559 > 0 +# define __STDC_IEC_559__ 1 +# endif +#else +# define __STDC_IEC_559__ 1 +#endif + +#ifdef __GCC_IEC_559_COMPLEX +# if __GCC_IEC_559_COMPLEX > 0 +# define __STDC_IEC_559_COMPLEX__ 1 +# endif +#else +# define __STDC_IEC_559_COMPLEX__ 1 +#endif /* wchar_t uses ISO/IEC 10646 (2nd ed., published 2011-03-15) / Unicode 6.0. */ -- cgit v1.2.3 From 699df45ba36249fc77bf1117de9048b0dfa2354e Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Mon, 18 Nov 2013 23:02:55 +0000 Subject: Define TLS version of libc_hidden_proto. --- ChangeLog | 16 ++++++++++++++++ include/libc-symbols.h | 36 +++++++++++++++++++++++++++++++++--- 2 files changed, 49 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/ChangeLog b/ChangeLog index 3822e0105e..a37896c23c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2013-11-18 Joseph Myers + + * include/libc-symbols.h (__hidden_proto): Add argument "thread". + (hidden_proto): Caller changed. + (hidden_tls_proto): New macro. + (libc_hidden_tls_proto): Likewise. + (rtld_hidden_tls_proto): Likewise. + (libm_hidden_tls_proto): Likewise. + (libresolv_hidden_tls_proto): Likewise. + (librt_hidden_tls_proto): Likewise. + (libdl_hidden_tls_proto): Likewise. + (libnss_files_hidden_tls_proto): Likewise. + (libnsl_hidden_tls_proto): Likewise. + (libnss_nisplus_hidden_tls_proto): Likewise. + (libutil_hidden_tls_proto): Likewise. + 2013-11-18 Ondřej Bílka [BZ #10253] diff --git a/include/libc-symbols.h b/include/libc-symbols.h index 5f603a2864..e7c778e394 100644 --- a/include/libc-symbols.h +++ b/include/libc-symbols.h @@ -471,9 +471,11 @@ for linking") # define __hidden_proto_hiddenattr(attrs...) \ __attribute__ ((visibility ("hidden"), ##attrs)) # define hidden_proto(name, attrs...) \ - __hidden_proto (name, __GI_##name, ##attrs) -# define __hidden_proto(name, internal, attrs...) \ - extern __typeof (name) name __asm__ (__hidden_asmname (#internal)) \ + __hidden_proto (name, , __GI_##name, ##attrs) +# define hidden_tls_proto(name, attrs...) \ + __hidden_proto (name, __thread, __GI_##name, ##attrs) +# define __hidden_proto(name, thread, internal, attrs...) \ + extern thread __typeof (name) name __asm__ (__hidden_asmname (#internal)) \ __hidden_proto_hiddenattr (attrs); # define __hidden_asmname(name) \ __hidden_asmname1 (__USER_LABEL_PREFIX__, name) @@ -524,6 +526,7 @@ for linking") #else # ifndef __ASSEMBLER__ # define hidden_proto(name, attrs...) +# define hidden_tls_proto(name, attrs...) # else # define HIDDEN_JUMPTARGET(name) JUMPTARGET(name) # endif /* Not __ASSEMBLER__ */ @@ -538,6 +541,7 @@ for linking") #if !defined NOT_IN_libc # define libc_hidden_proto(name, attrs...) hidden_proto (name, ##attrs) +# define libc_hidden_tls_proto(name, attrs...) hidden_tls_proto (name, ##attrs) # define libc_hidden_def(name) hidden_def (name) # define libc_hidden_weak(name) hidden_weak (name) # ifdef LINK_OBSOLETE_RPC @@ -552,6 +556,7 @@ for linking") # define libc_hidden_data_ver(local, name) hidden_data_ver (local, name) #else # define libc_hidden_proto(name, attrs...) +# define libc_hidden_tls_proto(name, attrs...) # define libc_hidden_def(name) # define libc_hidden_weak(name) # define libc_hidden_ver(local, name) @@ -562,6 +567,7 @@ for linking") #if defined NOT_IN_libc && defined IS_IN_rtld # define rtld_hidden_proto(name, attrs...) hidden_proto (name, ##attrs) +# define rtld_hidden_tls_proto(name, attrs...) hidden_tls_proto (name, ##attrs) # define rtld_hidden_def(name) hidden_def (name) # define rtld_hidden_weak(name) hidden_weak (name) # define rtld_hidden_ver(local, name) hidden_ver (local, name) @@ -570,6 +576,7 @@ for linking") # define rtld_hidden_data_ver(local, name) hidden_data_ver (local, name) #else # define rtld_hidden_proto(name, attrs...) +# define rtld_hidden_tls_proto(name, attrs...) # define rtld_hidden_def(name) # define rtld_hidden_weak(name) # define rtld_hidden_ver(local, name) @@ -580,6 +587,7 @@ for linking") #if defined NOT_IN_libc && defined IS_IN_libm # define libm_hidden_proto(name, attrs...) hidden_proto (name, ##attrs) +# define libm_hidden_tls_proto(name, attrs...) hidden_tls_proto (name, ##attrs) # define libm_hidden_def(name) hidden_def (name) # define libm_hidden_weak(name) hidden_weak (name) # define libm_hidden_ver(local, name) hidden_ver (local, name) @@ -588,6 +596,7 @@ for linking") # define libm_hidden_data_ver(local, name) hidden_data_ver (local, name) #else # define libm_hidden_proto(name, attrs...) +# define libm_hidden_tls_proto(name, attrs...) # define libm_hidden_def(name) # define libm_hidden_weak(name) # define libm_hidden_ver(local, name) @@ -598,6 +607,8 @@ for linking") #if defined NOT_IN_libc && defined IS_IN_libresolv # define libresolv_hidden_proto(name, attrs...) hidden_proto (name, ##attrs) +# define libresolv_hidden_tls_proto(name, attrs...) \ + hidden_tls_proto (name, ##attrs) # define libresolv_hidden_def(name) hidden_def (name) # define libresolv_hidden_weak(name) hidden_weak (name) # define libresolv_hidden_ver(local, name) hidden_ver (local, name) @@ -606,6 +617,7 @@ for linking") # define libresolv_hidden_data_ver(local, name) hidden_data_ver (local, name) #else # define libresolv_hidden_proto(name, attrs...) +# define libresolv_hidden_tls_proto(name, attrs...) # define libresolv_hidden_def(name) # define libresolv_hidden_weak(name) # define libresolv_hidden_ver(local, name) @@ -616,6 +628,8 @@ for linking") #if defined NOT_IN_libc && defined IS_IN_librt # define librt_hidden_proto(name, attrs...) hidden_proto (name, ##attrs) +# define librt_hidden_tls_proto(name, attrs...) \ + hidden_tls_proto (name, ##attrs) # define librt_hidden_def(name) hidden_def (name) # define librt_hidden_weak(name) hidden_weak (name) # define librt_hidden_ver(local, name) hidden_ver (local, name) @@ -624,6 +638,7 @@ for linking") # define librt_hidden_data_ver(local, name) hidden_data_ver (local, name) #else # define librt_hidden_proto(name, attrs...) +# define librt_hidden_tls_proto(name, attrs...) # define librt_hidden_def(name) # define librt_hidden_weak(name) # define librt_hidden_ver(local, name) @@ -634,6 +649,8 @@ for linking") #if defined NOT_IN_libc && defined IS_IN_libdl # define libdl_hidden_proto(name, attrs...) hidden_proto (name, ##attrs) +# define libdl_hidden_tls_proto(name, attrs...) \ + hidden_tls_proto (name, ##attrs) # define libdl_hidden_def(name) hidden_def (name) # define libdl_hidden_weak(name) hidden_weak (name) # define libdl_hidden_ver(local, name) hidden_ver (local, name) @@ -642,6 +659,7 @@ for linking") # define libdl_hidden_data_ver(local, name) hidden_data_ver (local, name) #else # define libdl_hidden_proto(name, attrs...) +# define libdl_hidden_tls_proto(name, attrs...) # define libdl_hidden_def(name) # define libdl_hidden_weak(name) # define libdl_hidden_ver(local, name) @@ -652,6 +670,8 @@ for linking") #if defined NOT_IN_libc && defined IS_IN_libnss_files # define libnss_files_hidden_proto(name, attrs...) hidden_proto (name, ##attrs) +# define libnss_files_hidden_tls_proto(name, attrs...) \ + hidden_tls_proto (name, ##attrs) # define libnss_files_hidden_def(name) hidden_def (name) # define libnss_files_hidden_weak(name) hidden_weak (name) # define libnss_files_hidden_ver(local, name) hidden_ver (local, name) @@ -660,6 +680,7 @@ for linking") # define libnss_files_hidden_data_ver(local, name) hidden_data_ver(local, name) #else # define libnss_files_hidden_proto(name, attrs...) +# define libnss_files_hidden_tls_proto(name, attrs...) # define libnss_files_hidden_def(name) # define libnss_files_hidden_weak(name) # define libnss_files_hidden_ver(local, name) @@ -670,6 +691,8 @@ for linking") #if defined NOT_IN_libc && defined IS_IN_libnsl # define libnsl_hidden_proto(name, attrs...) hidden_proto (name, ##attrs) +# define libnsl_hidden_tls_proto(name, attrs...) \ + hidden_tls_proto (name, ##attrs) # define libnsl_hidden_def(name) hidden_def (name) # define libnsl_hidden_weak(name) hidden_weak (name) # define libnsl_hidden_ver(local, name) hidden_ver (local, name) @@ -678,6 +701,7 @@ for linking") # define libnsl_hidden_data_ver(local, name) hidden_data_ver (local, name) #else # define libnsl_hidden_proto(name, attrs...) +# define libnsl_hidden_tls_proto(name, attrs...) # define libnsl_hidden_def(name) # define libnsl_hidden_weak(name) # define libnsl_hidden_ver(local, name) @@ -688,6 +712,8 @@ for linking") #if defined NOT_IN_libc && defined IS_IN_libnss_nisplus # define libnss_nisplus_hidden_proto(name, attrs...) hidden_proto (name, ##attrs) +# define libnss_nisplus_hidden_tls_proto(name, attrs...) \ + hidden_tls_proto (name, ##attrs) # define libnss_nisplus_hidden_def(name) hidden_def (name) # define libnss_nisplus_hidden_weak(name) hidden_weak (name) # define libnss_nisplus_hidden_ver(local, name) hidden_ver (local, name) @@ -696,6 +722,7 @@ for linking") # define libnss_nisplus_hidden_data_ver(local, name) hidden_data_ver (local, name) #else # define libnss_nisplus_hidden_proto(name, attrs...) +# define libnss_nisplus_hidden_tls_proto(name, attrs...) # define libnss_nisplus_hidden_def(name) # define libnss_nisplus_hidden_weak(name) # define libnss_nisplus_hidden_ver(local, name) @@ -714,6 +741,8 @@ for linking") #if defined NOT_IN_libc && defined IS_IN_libutil # define libutil_hidden_proto(name, attrs...) hidden_proto (name, ##attrs) +# define libutil_hidden_tls_proto(name, attrs...) \ + hidden_tls_proto (name, ##attrs) # define libutil_hidden_def(name) hidden_def (name) # define libutil_hidden_weak(name) hidden_weak (name) # define libutil_hidden_ver(local, name) hidden_ver (local, name) @@ -722,6 +751,7 @@ for linking") # define libutil_hidden_data_ver(local, name) hidden_data_ver (local, name) #else # define libutil_hidden_proto(name, attrs...) +# define libutil_hidden_tls_proto(name, attrs...) # define libutil_hidden_def(name) # define libutil_hidden_weak(name) # define libutil_hidden_ver(local, name) -- cgit v1.2.3 From 3c1c46a64ad1037d616ec39514c4e55133997c9f Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Thu, 28 Nov 2013 16:50:38 +0000 Subject: Fix dbl-64 e_sqrt.c for non-default rounding modes (bug 16271). --- ChangeLog | 17 ++++++++++ NEWS | 2 +- include/fenv.h | 1 + math/fegetround.c | 1 + ports/ChangeLog.aarch64 | 5 +++ ports/ChangeLog.alpha | 5 +++ ports/ChangeLog.am33 | 4 +++ ports/ChangeLog.arm | 4 +++ ports/ChangeLog.hppa | 4 +++ ports/ChangeLog.ia64 | 4 +++ ports/ChangeLog.m68k | 4 +++ ports/ChangeLog.microblaze | 5 +++ ports/ChangeLog.mips | 4 +++ ports/sysdeps/aarch64/fpu/fegetround.c | 1 + ports/sysdeps/alpha/fpu/fegetround.c | 1 + ports/sysdeps/am33/fpu/fegetround.c | 1 + ports/sysdeps/arm/fegetround.c | 1 + ports/sysdeps/hppa/fpu/fegetround.c | 1 + ports/sysdeps/ia64/fpu/fegetround.c | 1 + ports/sysdeps/m68k/fpu/fegetround.c | 1 + ports/sysdeps/microblaze/fegetround.c | 1 + ports/sysdeps/mips/fpu/fegetround.c | 1 + sysdeps/i386/fpu/fegetround.c | 1 + sysdeps/ieee754/dbl-64/e_sqrt.c | 38 ++++++++++++++++++++--- sysdeps/powerpc/fpu/fegetround.c | 1 + sysdeps/powerpc/nofpu/fegetround.c | 1 + sysdeps/powerpc/powerpc32/e500/nofpu/fegetround.c | 1 + sysdeps/s390/fpu/fegetround.c | 1 + sysdeps/sh/sh4/fpu/fegetround.c | 1 + sysdeps/sparc/fpu/fegetround.c | 1 + sysdeps/x86_64/fpu/fegetround.c | 1 + 31 files changed, 110 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/ChangeLog b/ChangeLog index 7e46a66919..16aa48aec3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2013-11-28 Joseph Myers + + [BZ #16271] + * sysdeps/ieee754/dbl-64/e_sqrt.c (__ieee754_sqrt): Set + round-to-nearest then adjust result for other rounding modes. + * include/fenv.h (fegetround): Use libm_hidden_proto. + * math/fegetround.c (fegetround): Use libm_hidden_def. + * sysdeps/i386/fpu/fegetround.c (fegetround): Likewise. + * sysdeps/powerpc/fpu/fegetround.c (fegetround): Likewise. + * sysdeps/powerpc/nofpu/fegetround.c (fegetround): Likewise. + * sysdeps/powerpc/powerpc32/e500/nofpu/fegetround.c (fegetround): + Likewise. + * sysdeps/s390/fpu/fegetround.c (fegetround): Likewise. + * sysdeps/sh/sh4/fpu/fegetround.c (fegetround): Likewise. + * sysdeps/sparc/fpu/fegetround.c (fegetround): Likewise. + * sysdeps/x86_64/fpu/fegetround.c (fegetround): Likewise. + 2013-11-28 Siddhesh Poyarekar [BZ #16077] diff --git a/NEWS b/NEWS index b45fa53165..4a8e3c0bd8 100644 --- a/NEWS +++ b/NEWS @@ -19,7 +19,7 @@ Version 2.19 15897, 15905, 15909, 15917, 15919, 15921, 15923, 15939, 15948, 15963, 15966, 15985, 15988, 15997, 16032, 16034, 16036, 16037, 16041, 16055, 16071, 16072, 16074, 16077, 16078, 16103, 16112, 16143, 16144, 16146, - 16150, 16151, 16153, 16167, 16172, 16245. + 16150, 16151, 16153, 16167, 16172, 16245, 16271. * The public headers no longer use __unused nor __block. This change is to support compiling programs that are derived from BSD sources and use diff --git a/include/fenv.h b/include/fenv.h index 925d4b50c3..bd2c99db96 100644 --- a/include/fenv.h +++ b/include/fenv.h @@ -16,6 +16,7 @@ extern int __feupdateenv (const fenv_t *__envp); libm_hidden_proto (feraiseexcept) libm_hidden_proto (fegetenv) +libm_hidden_proto (fegetround) libm_hidden_proto (fesetenv) libm_hidden_proto (fesetround) libm_hidden_proto (feholdexcept) diff --git a/math/fegetround.c b/math/fegetround.c index 24bbd16097..140e698480 100644 --- a/math/fegetround.c +++ b/math/fegetround.c @@ -28,4 +28,5 @@ fegetround (void) return 0; #endif } +libm_hidden_def (fegetround) stub_warning (fegetround) diff --git a/ports/ChangeLog.aarch64 b/ports/ChangeLog.aarch64 index c6331a4b91..4cbc11f84b 100644 --- a/ports/ChangeLog.aarch64 +++ b/ports/ChangeLog.aarch64 @@ -1,3 +1,8 @@ +2013-11-28 Joseph Myers + + * sysdeps/aarch64/fpu/fegetround.c (fegetround): Use + libm_hidden_def. + 2013-11-26 Will Newton * sysdeps/aarch64/dl-irel.h: Include ldsodefs.h. diff --git a/ports/ChangeLog.alpha b/ports/ChangeLog.alpha index 05c6ba4950..95b575edc0 100644 --- a/ports/ChangeLog.alpha +++ b/ports/ChangeLog.alpha @@ -1,3 +1,8 @@ +2013-11-28 Joseph Myers + + * sysdeps/alpha/fpu/fegetround.c (fegetround): Use + libm_hidden_def. + 2013-11-26 Ondřej Bílka * sysdeps/unix/sysv/linux/alpha/bits/ipc.h: Use __glibc_reserved instead __unused. * sysdeps/unix/sysv/linux/alpha/bits/msq.h: Likewise. diff --git a/ports/ChangeLog.am33 b/ports/ChangeLog.am33 index 15b7a1b300..317dd8efbe 100644 --- a/ports/ChangeLog.am33 +++ b/ports/ChangeLog.am33 @@ -1,3 +1,7 @@ +2013-11-28 Joseph Myers + + * sysdeps/am33/fpu/fegetround.c (fegetround): Use libm_hidden_def. + 2013-10-30 Mike Frysinger * sysdeps/unix/sysv/linux/am33/configure.in: Moved to ... diff --git a/ports/ChangeLog.arm b/ports/ChangeLog.arm index 4124e474b1..4a4d319a1b 100644 --- a/ports/ChangeLog.arm +++ b/ports/ChangeLog.arm @@ -1,3 +1,7 @@ +2013-11-28 Joseph Myers + + * sysdeps/arm/fegetround.c (fegetround): Use libm_hidden_def. + 2013-11-26 Ondřej Bílka * sysdeps/unix/sysv/linux/arm/bits/shm.h: Use __glibc_reserved instead __unused. diff --git a/ports/ChangeLog.hppa b/ports/ChangeLog.hppa index 6a28bfe221..98d36a3e14 100644 --- a/ports/ChangeLog.hppa +++ b/ports/ChangeLog.hppa @@ -1,3 +1,7 @@ +2013-11-28 Joseph Myers + + * sysdeps/hppa/fpu/fegetround.c (fegetround): Use libm_hidden_def. + 2013-11-26 Ondřej Bílka * sysdeps/unix/sysv/linux/hppa/bits/ipc.h: Use __glibc_reserved instead __unused. * sysdeps/unix/sysv/linux/hppa/bits/msq.h: Likewise. diff --git a/ports/ChangeLog.ia64 b/ports/ChangeLog.ia64 index d2825f1700..1aded589a5 100644 --- a/ports/ChangeLog.ia64 +++ b/ports/ChangeLog.ia64 @@ -1,3 +1,7 @@ +2013-11-28 Joseph Myers + + * sysdeps/ia64/fpu/fegetround.c (fegetround): Use libm_hidden_def. + 2013-11-26 Ondřej Bílka * sysdeps/unix/sysv/linux/ia64/bits/ipc.h: Use __glibc_reserved instead __unused. * sysdeps/unix/sysv/linux/ia64/bits/msq.h: Likewise. diff --git a/ports/ChangeLog.m68k b/ports/ChangeLog.m68k index f78f3848fa..92ff973243 100644 --- a/ports/ChangeLog.m68k +++ b/ports/ChangeLog.m68k @@ -1,3 +1,7 @@ +2013-11-28 Joseph Myers + + * sysdeps/m68k/fpu/fegetround.c (fegetround): Use libm_hidden_def. + 2013-11-26 Ondřej Bílka * sysdeps/unix/sysv/linux/m68k/bits/stat.h: Use __glibc_reserved instead __unused. diff --git a/ports/ChangeLog.microblaze b/ports/ChangeLog.microblaze index 0762dd3be2..7d47e0468a 100644 --- a/ports/ChangeLog.microblaze +++ b/ports/ChangeLog.microblaze @@ -1,3 +1,8 @@ +2013-11-28 Joseph Myers + + * sysdeps/microblaze/fegetround.c (fegetround): Use + libm_hidden_def. + 2013-11-26 Ondřej Bílka * sysdeps/unix/sysv/linux/microblaze/bits/stat.h: Use __glibc_reserved instead __unused. * sysdeps/unix/sysv/linux/microblaze/kernel_stat.h: Likewise. diff --git a/ports/ChangeLog.mips b/ports/ChangeLog.mips index 84567997b7..21308e7f1b 100644 --- a/ports/ChangeLog.mips +++ b/ports/ChangeLog.mips @@ -1,3 +1,7 @@ +2013-11-28 Joseph Myers + + * sysdeps/mips/fpu/fegetround.c (fegetround): Use libm_hidden_def. + 2013-11-27 Aurelien Jarno * sysdeps/unix/sysv/linux/mips/bits/resource.h (RLIM64_INFINITY): Fix diff --git a/ports/sysdeps/aarch64/fpu/fegetround.c b/ports/sysdeps/aarch64/fpu/fegetround.c index 3b5b3068b2..370caa16d3 100644 --- a/ports/sysdeps/aarch64/fpu/fegetround.c +++ b/ports/sysdeps/aarch64/fpu/fegetround.c @@ -26,3 +26,4 @@ fegetround (void) _FPU_GETCW (fpcr); return fpcr & FE_TOWARDZERO; } +libm_hidden_def (fegetround) diff --git a/ports/sysdeps/alpha/fpu/fegetround.c b/ports/sysdeps/alpha/fpu/fegetround.c index aba657aebd..03a55ee7a7 100644 --- a/ports/sysdeps/alpha/fpu/fegetround.c +++ b/ports/sysdeps/alpha/fpu/fegetround.c @@ -28,3 +28,4 @@ fegetround (void) return (fpcr >> FPCR_ROUND_SHIFT) & 3; } +libm_hidden_def (fegetround) diff --git a/ports/sysdeps/am33/fpu/fegetround.c b/ports/sysdeps/am33/fpu/fegetround.c index b309c92e08..49cae00fd0 100644 --- a/ports/sysdeps/am33/fpu/fegetround.c +++ b/ports/sysdeps/am33/fpu/fegetround.c @@ -32,3 +32,4 @@ fegetround (void) return (cw & ROUND_MASK); } +libm_hidden_def (fegetround) diff --git a/ports/sysdeps/arm/fegetround.c b/ports/sysdeps/arm/fegetround.c index 78a3795b23..149a989518 100644 --- a/ports/sysdeps/arm/fegetround.c +++ b/ports/sysdeps/arm/fegetround.c @@ -37,3 +37,4 @@ fegetround (void) /* The current soft-float implementation only handles TONEAREST. */ return FE_TONEAREST; } +libm_hidden_def (fegetround) diff --git a/ports/sysdeps/hppa/fpu/fegetround.c b/ports/sysdeps/hppa/fpu/fegetround.c index 67dd7c487a..3815fbd94c 100644 --- a/ports/sysdeps/hppa/fpu/fegetround.c +++ b/ports/sysdeps/hppa/fpu/fegetround.c @@ -24,3 +24,4 @@ fegetround (void) { return get_rounding_mode (); } +libm_hidden_def (fegetround) diff --git a/ports/sysdeps/ia64/fpu/fegetround.c b/ports/sysdeps/ia64/fpu/fegetround.c index 5c9b34338c..f6dfea7276 100644 --- a/ports/sysdeps/ia64/fpu/fegetround.c +++ b/ports/sysdeps/ia64/fpu/fegetround.c @@ -24,3 +24,4 @@ fegetround (void) { return get_rounding_mode (); } +libm_hidden_def (fegetround) diff --git a/ports/sysdeps/m68k/fpu/fegetround.c b/ports/sysdeps/m68k/fpu/fegetround.c index f1227fe593..54fa7df896 100644 --- a/ports/sysdeps/m68k/fpu/fegetround.c +++ b/ports/sysdeps/m68k/fpu/fegetround.c @@ -28,3 +28,4 @@ fegetround (void) return fpcr & FE_UPWARD; } +libm_hidden_def (fegetround) diff --git a/ports/sysdeps/microblaze/fegetround.c b/ports/sysdeps/microblaze/fegetround.c index 4f47dd1fef..b1039e8651 100644 --- a/ports/sysdeps/microblaze/fegetround.c +++ b/ports/sysdeps/microblaze/fegetround.c @@ -22,3 +22,4 @@ fegetround (void) { return FE_TONEAREST; } +libm_hidden_def (fegetround) diff --git a/ports/sysdeps/mips/fpu/fegetround.c b/ports/sysdeps/mips/fpu/fegetround.c index 17cd3e994a..011d27f295 100644 --- a/ports/sysdeps/mips/fpu/fegetround.c +++ b/ports/sysdeps/mips/fpu/fegetround.c @@ -30,3 +30,4 @@ fegetround (void) return cw & _FPU_RC_MASK; } +libm_hidden_def (fegetround) diff --git a/sysdeps/i386/fpu/fegetround.c b/sysdeps/i386/fpu/fegetround.c index d0170d3c86..cd96ae99d3 100644 --- a/sysdeps/i386/fpu/fegetround.c +++ b/sysdeps/i386/fpu/fegetround.c @@ -28,3 +28,4 @@ fegetround (void) return cw & 0xc00; } +libm_hidden_def (fegetround) diff --git a/sysdeps/ieee754/dbl-64/e_sqrt.c b/sysdeps/ieee754/dbl-64/e_sqrt.c index 854ae38c41..88809daa76 100644 --- a/sysdeps/ieee754/dbl-64/e_sqrt.c +++ b/sysdeps/ieee754/dbl-64/e_sqrt.c @@ -66,8 +66,9 @@ __ieee754_sqrt (double x) /*----------------- 2^-1022 <= | x |< 2^1024 -----------------*/ if (k > 0x000fffff && k < 0x7ff00000) { + int rm = fegetround (); fenv_t env; - libc_feholdexcept (&env); + libc_feholdexcept_setround (&env, FE_TONEAREST); double ret; y = 1.0 - t * (t * s); t = t * (rt0 + y * (rt1 + y * (rt2 + y * rt3))); @@ -82,15 +83,44 @@ __ieee754_sqrt (double x) { res1 = res + 1.5 * ((y - res) + del); EMULV (res, res1, z, zz, p, hx, tx, hy, ty); /* (z+zz)=res*res1 */ - ret = ((((z - s) + zz) < 0) ? max (res, res1) : - min (res, res1)) * c.x; + res = ((((z - s) + zz) < 0) ? max (res, res1) : + min (res, res1)); + ret = res * c.x; } math_force_eval (ret); libc_fesetenv (&env); - if (x / ret != ret) + double dret = x / ret; + if (dret != ret) { double force_inexact = 1.0 / 3.0; math_force_eval (force_inexact); + /* The square root is inexact, ret is the round-to-nearest + value which may need adjusting for other rounding + modes. */ + switch (rm) + { +#ifdef FE_UPWARD + case FE_UPWARD: + if (dret > ret) + ret = (res + 0x1p-1022) * c.x; + break; +#endif + +#ifdef FE_DOWNWARD + case FE_DOWNWARD: +#endif +#ifdef FE_TOWARDZERO + case FE_TOWARDZERO: +#endif +#if defined FE_DOWNWARD || defined FE_TOWARDZERO + if (dret < ret) + ret = (res - 0x1p-1022) * c.x; + break; +#endif + + default: + break; + } } /* Otherwise (x / ret == ret), either the square root was exact or the division was inexact. */ diff --git a/sysdeps/powerpc/fpu/fegetround.c b/sysdeps/powerpc/fpu/fegetround.c index bcb6caab9d..078911f4a3 100644 --- a/sysdeps/powerpc/fpu/fegetround.c +++ b/sysdeps/powerpc/fpu/fegetround.c @@ -24,3 +24,4 @@ fegetround (void) { return __fegetround(); } +libm_hidden_def (fegetround) diff --git a/sysdeps/powerpc/nofpu/fegetround.c b/sysdeps/powerpc/nofpu/fegetround.c index 016602fac6..2c7bdbe5f6 100644 --- a/sysdeps/powerpc/nofpu/fegetround.c +++ b/sysdeps/powerpc/nofpu/fegetround.c @@ -26,3 +26,4 @@ fegetround (void) { return __sim_round_mode_thread; } +libm_hidden_def (fegetround) diff --git a/sysdeps/powerpc/powerpc32/e500/nofpu/fegetround.c b/sysdeps/powerpc/powerpc32/e500/nofpu/fegetround.c index f69e9a5bdb..1e894e7523 100644 --- a/sysdeps/powerpc/powerpc32/e500/nofpu/fegetround.c +++ b/sysdeps/powerpc/powerpc32/e500/nofpu/fegetround.c @@ -27,3 +27,4 @@ fegetround (void) fpescr = fegetenv_register (); return fpescr & 3; } +libm_hidden_def (fegetround) diff --git a/sysdeps/s390/fpu/fegetround.c b/sysdeps/s390/fpu/fegetround.c index 4843a56d26..94482f6318 100644 --- a/sysdeps/s390/fpu/fegetround.c +++ b/sysdeps/s390/fpu/fegetround.c @@ -29,3 +29,4 @@ fegetround (void) return cw & FPC_RM_MASK; } +libm_hidden_def (fegetround) diff --git a/sysdeps/sh/sh4/fpu/fegetround.c b/sysdeps/sh/sh4/fpu/fegetround.c index be4833f017..0523321b2d 100644 --- a/sysdeps/sh/sh4/fpu/fegetround.c +++ b/sysdeps/sh/sh4/fpu/fegetround.c @@ -30,3 +30,4 @@ fegetround (void) return cw & 0x1; } +libm_hidden_def (fegetround) diff --git a/sysdeps/sparc/fpu/fegetround.c b/sysdeps/sparc/fpu/fegetround.c index c4987e8b3e..c2d5f5af03 100644 --- a/sysdeps/sparc/fpu/fegetround.c +++ b/sysdeps/sparc/fpu/fegetround.c @@ -27,3 +27,4 @@ fegetround (void) return tmp & __FE_ROUND_MASK; } +libm_hidden_def (fegetround) diff --git a/sysdeps/x86_64/fpu/fegetround.c b/sysdeps/x86_64/fpu/fegetround.c index 1a52b7ea67..c7cd046f39 100644 --- a/sysdeps/x86_64/fpu/fegetround.c +++ b/sysdeps/x86_64/fpu/fegetround.c @@ -30,3 +30,4 @@ fegetround (void) return cw & 0xc00; } +libm_hidden_def (fegetround) -- cgit v1.2.3 From 520d437b9455560d099fe6bd9664be1f9f76868b Mon Sep 17 00:00:00 2001 From: Siddhesh Poyarekar Date: Tue, 3 Dec 2013 12:26:12 +0530 Subject: [BZ #16195] Fix build warnings from systemtap probes in non-systemtap configurations Joseph pointed out in the bug report (and in an earlier thread) that systemtap probes cause build time warnings like the following: ../sysdeps/ieee754/dbl-64/e_atan2.c:602:4: warning: the address of 'p' will always evaluate as 'true' [-Waddress] due to the fact that we're now passing non-weak variables to LIBC_PROBE in the libm probes. This happens only on configurations that do not enable systemtap. The macro definition of LIBC_PROBE in this case only acts as a sanity checker to ensure that the number parameters passed to LIBC_PROBE is equal to the argument count parameter passed before it. This can be done in a much simpler manner by just adding a macro definition for each number of arguments. I am assuming here that we don't really want to bother with supporting LIBC_PROBE with an indeterminate number of arguments and if there is a need for a probe to have more data than what is currently supported (4 arguments), one could simply add an additional macro here. --- ChangeLog | 11 +++++++++++ NEWS | 4 ++-- include/stap-probe.h | 15 ++++++++------- 3 files changed, 21 insertions(+), 9 deletions(-) (limited to 'include') diff --git a/ChangeLog b/ChangeLog index de634b4d41..182051a727 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2013-12-03 Siddhesh Poyarekar + + [BZ #16195] + * include/stap-probe.h [!USE_STAP_PROBE && !__ASSEMBLER__] + (LIBC_PROBE): Change definition to call STAP_PROBE* macros. + (STAP_PROBE0): New macro. + (STAP_PROBE1): Likewise. + (STAP_PROBE2): Likewise. + (STAP_PROBE3): Likewise. + (STAP_PROBE4): Likewise. + 2013-12-02 Ondřej Bílka * manual/llio.texi (Memory-mapped I/O): Add shm_open and shm_close. diff --git a/NEWS b/NEWS index e85b4c6e30..c431d72539 100644 --- a/NEWS +++ b/NEWS @@ -19,8 +19,8 @@ Version 2.19 15892, 15893, 15895, 15897, 15905, 15909, 15917, 15919, 15921, 15923, 15939, 15948, 15963, 15966, 15985, 15988, 15997, 16032, 16034, 16036, 16037, 16041, 16055, 16071, 16072, 16074, 16077, 16078, 16103, 16112, - 16143, 16144, 16146, 16150, 16151, 16153, 16167, 16172, 16214, 16245, - 16271. + 16143, 16144, 16146, 16150, 16151, 16153, 16167, 16172, 16195, 16214, + 16245, 16271. * The public headers no longer use __unused nor __block. This change is to support compiling programs that are derived from BSD sources and use diff --git a/include/stap-probe.h b/include/stap-probe.h index 5f725562cb..e2963506aa 100644 --- a/include/stap-probe.h +++ b/include/stap-probe.h @@ -61,13 +61,14 @@ # ifndef __ASSEMBLER__ /* Evaluate all the arguments and verify that N matches their number. */ -# define LIBC_PROBE(name, n, ...) \ - do { \ - _Bool __libc_probe_args[] = { 0, ## __VA_ARGS__ }; \ - _Bool __libc_probe_verify_n[(sizeof __libc_probe_args / sizeof (_Bool)) \ - == n + 1 ? 1 : -1]; \ - (void) __libc_probe_verify_n; \ - } while (0) +#define LIBC_PROBE(name, n, ...) STAP_PROBE##n (__VA_ARGS__) + +#define STAP_PROBE0() +#define STAP_PROBE1(a1) +#define STAP_PROBE2(a1, a2) +#define STAP_PROBE3(a1, a2, a3) +#define STAP_PROBE4(a1, a2, a3, a4) + # else # define LIBC_PROBE(name, n, ...) /* Nothing. */ # endif -- cgit v1.2.3 From 7011c2622fe3e10a29dbe74f06aaebd07710127d Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Tue, 17 Dec 2013 18:05:42 +0000 Subject: Remove __FAVOR_BSD. --- ChangeLog | 17 +++++++ NEWS | 3 ++ include/features.h | 9 ---- manual/creature.texi | 41 ---------------- manual/job.texi | 35 +++----------- posix/unistd.h | 26 +--------- setjmp/setjmp.h | 9 +--- signal/signal.h | 22 +++------ sysdeps/gnu/netinet/tcp.h | 120 +++++++++++++++++++++++----------------------- sysdeps/gnu/netinet/udp.h | 33 ++++++------- 10 files changed, 115 insertions(+), 200 deletions(-) (limited to 'include') diff --git a/ChangeLog b/ChangeLog index 4291b1c323..a035dc9fe7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2013-12-17 Joseph Myers + + * include/features.h (__FAVOR_BSD): Do not define. + * manual/creature.texi (_BSD_SOURCE): Do not document as enabling + features conflicting with POSIX. + (_GNU_SOURCE): Do not mention interaction with _BSD_SOURCE. + (_BSD_SOURCE): Remove description of not being a subset of other + feature test macros. + * manual/job.texi (getpgrp): Do not document BSD version. + (getpgid): Do not document by reference to BSD getpgrp. + * posix/unistd.h [__FAVOR_BSD]: Remove conditional code. + * setjmp/setjmp.h [__FAVOR_BSD]: Likewise. + * signal/signal.h [__FAVOR_BSD]: Likewise. + * sysdeps/gnu/netinet/tcp.h (struct tcphdr): Use anonymous unions + instead of making contents conditional on [__FAVOR_BSD]. + * sysdeps/gnu/netinet/udp.h (struct udphdr): Likewise. + 2013-12-17 Adhemerval Zanella * sysdeps/powerpc/fpu/libm-test-ulps: Update. diff --git a/NEWS b/NEWS index 7bb8ebf1be..32c8f0885a 100644 --- a/NEWS +++ b/NEWS @@ -100,6 +100,9 @@ Version 2.19 * The soft-float powerpc port now supports e500 processors. * Support for STT_GNU_IFUNC symbols added for ppc32/power4+ and ppc64. + +* The _BSD_SOURCE feature test macro no longer enables BSD interfaces that + conflict with POSIX. Version 2.18 diff --git a/include/features.h b/include/features.h index c9be10a63e..cff8bfcf8e 100644 --- a/include/features.h +++ b/include/features.h @@ -80,7 +80,6 @@ __USE_GNU Define GNU extensions. __USE_REENTRANT Define reentrant/thread-safe *_r functions. __USE_FORTIFY_LEVEL Additional security measures used, according to level. - __FAVOR_BSD Favor 4.3BSD things in cases of conflict. The macros `__GNU_LIBRARY__', `__GLIBC__', and `__GLIBC_MINOR__' are defined by this file unconditionally. `__GNU_LIBRARY__' is provided @@ -120,7 +119,6 @@ #undef __USE_GNU #undef __USE_REENTRANT #undef __USE_FORTIFY_LEVEL -#undef __FAVOR_BSD #undef __KERNEL_STRICT_NAMES /* Suppress kernel-name space pollution unless user expressedly asks @@ -144,13 +142,6 @@ #endif -/* If _BSD_SOURCE was defined by the user, favor BSD over POSIX. */ -#if defined _BSD_SOURCE && \ - !(defined _POSIX_SOURCE || defined _POSIX_C_SOURCE || \ - defined _XOPEN_SOURCE || defined _GNU_SOURCE || defined _SVID_SOURCE) -# define __FAVOR_BSD 1 -#endif - /* If _GNU_SOURCE was defined by the user, turn on all the other features. */ #ifdef _GNU_SOURCE # undef _ISOC95_SOURCE diff --git a/manual/creature.texi b/manual/creature.texi index 1bf53147ee..3b7e77c78b 100644 --- a/manual/creature.texi +++ b/manual/creature.texi @@ -77,24 +77,6 @@ edition is made available. @defvr Macro _BSD_SOURCE If you define this macro, functionality derived from 4.3 BSD Unix is included as well as the @w{ISO C}, POSIX.1, and POSIX.2 material. - -Some of the features derived from 4.3 BSD Unix conflict with the -corresponding features specified by the POSIX.1 standard. If this -macro is defined, the 4.3 BSD definitions take precedence over the -POSIX definitions. - -Due to the nature of some of the conflicts between 4.3 BSD and POSIX.1, -you need to use a special @dfn{BSD compatibility library} when linking -programs compiled for BSD compatibility. This is because some functions -must be defined in two different ways, one of them in the normal C -library, and one of them in the compatibility library. If your program -defines @code{_BSD_SOURCE}, you must give the option @samp{-lbsd-compat} -to the compiler or linker when linking the program, to tell it to find -functions in this special compatibility library before looking for them in -the normal C library. -@pindex -lbsd-compat -@pindex bsd-compat -@cindex BSD compatibility library. @end defvr @comment (none) @@ -204,21 +186,6 @@ If you define this macro, everything is included: @w{ISO C89}, @w{ISO C99}, POSIX.1, POSIX.2, BSD, SVID, X/Open, LFS, and GNU extensions. In the cases where POSIX.1 conflicts with BSD, the POSIX definitions take precedence. - -If you want to get the full effect of @code{_GNU_SOURCE} but make the -BSD definitions take precedence over the POSIX definitions, use this -sequence of definitions: - -@smallexample -#define _GNU_SOURCE -#define _BSD_SOURCE -#define _SVID_SOURCE -@end smallexample - -Note that if you do this, you must link your program with the BSD -compatibility library by passing the @samp{-lbsd-compat} option to the -compiler or linker. @strong{NB:} If you forget to do this, you may -get very strange errors at run time. @end defvr @comment (none) @@ -248,11 +215,3 @@ those features. For example, if you define @code{_POSIX_C_SOURCE}, then defining @code{_POSIX_SOURCE} as well has no effect. Likewise, if you define @code{_GNU_SOURCE}, then defining either @code{_POSIX_SOURCE} or @code{_POSIX_C_SOURCE} or @code{_SVID_SOURCE} as well has no effect. - -Note, however, that the features of @code{_BSD_SOURCE} are not a subset of -any of the other feature test macros supported. This is because it defines -BSD features that take precedence over the POSIX features that are -requested by the other macros. For this reason, defining -@code{_BSD_SOURCE} in addition to the other feature test macros does have -an effect: it causes the BSD features to take priority over the conflicting -POSIX features. diff --git a/manual/job.texi b/manual/job.texi index 4efeed3451..d58dcd8c8f 100644 --- a/manual/job.texi +++ b/manual/job.texi @@ -1118,39 +1118,18 @@ from the calling process. @end table @end deftypefun -The @code{getpgrp} function has two definitions: one derived from BSD -Unix, and one from the POSIX.1 standard. The feature test macros you -have selected (@pxref{Feature Test Macros}) determine which definition -you get. Specifically, you get the BSD version if you define -@code{_BSD_SOURCE}; otherwise, you get the POSIX version if you define -@code{_POSIX_SOURCE} or @code{_GNU_SOURCE}. Programs written for old -BSD systems will not include @file{unistd.h}, which defines -@code{getpgrp} specially under @code{_BSD_SOURCE}. You must link such -programs with the @code{-lbsd-compat} option to get the BSD definition.@refill -@pindex -lbsd-compat -@pindex bsd-compat -@cindex BSD compatibility library - @comment unistd.h @comment POSIX.1 -@deftypefn {POSIX.1 Function} pid_t getpgrp (void) -The POSIX.1 definition of @code{getpgrp} returns the process group ID of +@deftypefun pid_t getpgrp (void) +The @code{getpgrp} function returns the process group ID of the calling process. -@end deftypefn - -@comment unistd.h -@comment BSD -@deftypefn {BSD Function} pid_t getpgrp (pid_t @var{pid}) -The BSD definition of @code{getpgrp} returns the process group ID of the -process @var{pid}. You can supply a value of @code{0} for the @var{pid} -argument to get information about the calling process. -@end deftypefn +@end deftypefun @comment unistd.h -@comment SVID -@deftypefn {System V Function} int getpgid (pid_t @var{pid}) +@comment POSIX.1 +@deftypefun int getpgid (pid_t @var{pid}) -@code{getpgid} is the same as the BSD function @code{getpgrp}. It +The @code{getpgid} function returns the process group ID of the process @var{pid}. You can supply a value of @code{0} for the @var{pid} argument to get information about the calling process. @@ -1166,7 +1145,7 @@ different sessions, and the implementation doesn't allow to access the process group ID of the process with ID @var{pid} from the calling process. @end table -@end deftypefn +@end deftypefun @comment unistd.h @comment POSIX.1 diff --git a/posix/unistd.h b/posix/unistd.h index d4eeaf1433..f37dce7b46 100644 --- a/posix/unistd.h +++ b/posix/unistd.h @@ -630,17 +630,8 @@ extern __pid_t getpid (void) __THROW; /* Get the process ID of the calling process's parent. */ extern __pid_t getppid (void) __THROW; -/* Get the process group ID of the calling process. - This function is different on old BSD. */ -#ifndef __FAVOR_BSD +/* Get the process group ID of the calling process. */ extern __pid_t getpgrp (void) __THROW; -#else -# ifdef __REDIRECT_NTH -extern __pid_t __REDIRECT_NTH (getpgrp, (__pid_t __pid), __getpgid); -# else -# define getpgrp __getpgid -# endif -#endif /* Get the process group ID of process PID. */ extern __pid_t __getpgid (__pid_t __pid) __THROW; @@ -662,25 +653,12 @@ extern int setpgid (__pid_t __pid, __pid_t __pgid) __THROW; New programs should always use `setpgid' instead. - The default in GNU is to provide the System V function. The BSD - function is available under -D_BSD_SOURCE. */ - -# ifndef __FAVOR_BSD + GNU provides the POSIX.1 function. */ /* Set the process group ID of the calling process to its own PID. This is exactly the same as `setpgid (0, 0)'. */ extern int setpgrp (void) __THROW; -# else - -/* Another name for `setpgid' (above). */ -# ifdef __REDIRECT_NTH -extern int __REDIRECT_NTH (setpgrp, (__pid_t __pid, __pid_t __pgrp), setpgid); -# else -# define setpgrp setpgid -# endif - -# endif /* Favor BSD. */ #endif /* Use SVID or BSD. */ /* Create a new session with the calling process as its leader. diff --git a/setjmp/setjmp.h b/setjmp/setjmp.h index 67de76c6b1..8e6b5b49d1 100644 --- a/setjmp/setjmp.h +++ b/setjmp/setjmp.h @@ -58,20 +58,13 @@ __END_NAMESPACE_STD This is the internal name for `sigsetjmp'. */ extern int __sigsetjmp (struct __jmp_buf_tag __env[1], int __savemask) __THROWNL; -#ifndef __FAVOR_BSD /* Store the calling environment in ENV, not saving the signal mask. Return 0. */ extern int _setjmp (struct __jmp_buf_tag __env[1]) __THROWNL; /* Do not save the signal mask. This is equivalent to the `_setjmp' BSD function. */ -# define setjmp(env) _setjmp (env) -#else -/* We are in 4.3 BSD-compatibility mode in which `setjmp' - saves the signal mask like `sigsetjmp (ENV, 1)'. We have to - define a macro since ISO C says `setjmp' is one. */ -# define setjmp(env) setjmp (env) -#endif /* Favor BSD. */ +#define setjmp(env) _setjmp (env) __BEGIN_NAMESPACE_STD diff --git a/signal/signal.h b/signal/signal.h index ec28b3101b..b698d14bb6 100644 --- a/signal/signal.h +++ b/signal/signal.h @@ -158,28 +158,20 @@ extern void psiginfo (const siginfo_t *__pinfo, const char *__s); -/* The `sigpause' function has two different interfaces. The original - BSD definition defines the argument as a mask of the signal, while - the more modern interface in X/Open defines it as the signal - number. We go with the BSD version unless the user explicitly - selects the X/Open version. +/* The `sigpause' function in X/Open defines the argument as the + signal number. This requires redirecting to another function + because the default version in glibc uses an old BSD interface. This function is a cancellation point and therefore not marked with __THROW. */ extern int __sigpause (int __sig_or_mask, int __is_sig); -#ifdef __FAVOR_BSD -/* Set the mask of blocked signals to MASK, - wait for a signal to arrive, and then restore the mask. */ -extern int sigpause (int __mask) __THROW __attribute_deprecated__; -#else -# ifdef __USE_XOPEN -# ifdef __GNUC__ +#ifdef __USE_XOPEN +# ifdef __GNUC__ extern int sigpause (int __sig) __asm__ ("__xpg_sigpause"); -# else +# else /* Remove a signal from the signal mask and suspend the process. */ -# define sigpause(sig) __sigpause ((sig), 1) -# endif +# define sigpause(sig) __sigpause ((sig), 1) # endif #endif diff --git a/sysdeps/gnu/netinet/tcp.h b/sysdeps/gnu/netinet/tcp.h index b7bf9b38d4..f6602ecfde 100644 --- a/sysdeps/gnu/netinet/tcp.h +++ b/sysdeps/gnu/netinet/tcp.h @@ -66,7 +66,6 @@ # include # include -# ifdef __FAVOR_BSD typedef u_int32_t tcp_seq; /* * TCP header. @@ -74,66 +73,69 @@ typedef u_int32_t tcp_seq; */ struct tcphdr { - u_int16_t th_sport; /* source port */ - u_int16_t th_dport; /* destination port */ - tcp_seq th_seq; /* sequence number */ - tcp_seq th_ack; /* acknowledgement number */ -# if __BYTE_ORDER == __LITTLE_ENDIAN - u_int8_t th_x2:4; /* (unused) */ - u_int8_t th_off:4; /* data offset */ -# endif -# if __BYTE_ORDER == __BIG_ENDIAN - u_int8_t th_off:4; /* data offset */ - u_int8_t th_x2:4; /* (unused) */ -# endif - u_int8_t th_flags; -# define TH_FIN 0x01 -# define TH_SYN 0x02 -# define TH_RST 0x04 -# define TH_PUSH 0x08 -# define TH_ACK 0x10 -# define TH_URG 0x20 - u_int16_t th_win; /* window */ - u_int16_t th_sum; /* checksum */ - u_int16_t th_urp; /* urgent pointer */ + __extension__ union + { + struct + { + u_int16_t th_sport; /* source port */ + u_int16_t th_dport; /* destination port */ + tcp_seq th_seq; /* sequence number */ + tcp_seq th_ack; /* acknowledgement number */ +# if __BYTE_ORDER == __LITTLE_ENDIAN + u_int8_t th_x2:4; /* (unused) */ + u_int8_t th_off:4; /* data offset */ +# endif +# if __BYTE_ORDER == __BIG_ENDIAN + u_int8_t th_off:4; /* data offset */ + u_int8_t th_x2:4; /* (unused) */ +# endif + u_int8_t th_flags; +# define TH_FIN 0x01 +# define TH_SYN 0x02 +# define TH_RST 0x04 +# define TH_PUSH 0x08 +# define TH_ACK 0x10 +# define TH_URG 0x20 + u_int16_t th_win; /* window */ + u_int16_t th_sum; /* checksum */ + u_int16_t th_urp; /* urgent pointer */ + }; + struct + { + u_int16_t source; + u_int16_t dest; + u_int32_t seq; + u_int32_t ack_seq; +# if __BYTE_ORDER == __LITTLE_ENDIAN + u_int16_t res1:4; + u_int16_t doff:4; + u_int16_t fin:1; + u_int16_t syn:1; + u_int16_t rst:1; + u_int16_t psh:1; + u_int16_t ack:1; + u_int16_t urg:1; + u_int16_t res2:2; +# elif __BYTE_ORDER == __BIG_ENDIAN + u_int16_t doff:4; + u_int16_t res1:4; + u_int16_t res2:2; + u_int16_t urg:1; + u_int16_t ack:1; + u_int16_t psh:1; + u_int16_t rst:1; + u_int16_t syn:1; + u_int16_t fin:1; +# else +# error "Adjust your defines" +# endif + u_int16_t window; + u_int16_t check; + u_int16_t urg_ptr; + }; + }; }; -# else /* !__FAVOR_BSD */ -struct tcphdr - { - u_int16_t source; - u_int16_t dest; - u_int32_t seq; - u_int32_t ack_seq; -# if __BYTE_ORDER == __LITTLE_ENDIAN - u_int16_t res1:4; - u_int16_t doff:4; - u_int16_t fin:1; - u_int16_t syn:1; - u_int16_t rst:1; - u_int16_t psh:1; - u_int16_t ack:1; - u_int16_t urg:1; - u_int16_t res2:2; -# elif __BYTE_ORDER == __BIG_ENDIAN - u_int16_t doff:4; - u_int16_t res1:4; - u_int16_t res2:2; - u_int16_t urg:1; - u_int16_t ack:1; - u_int16_t psh:1; - u_int16_t rst:1; - u_int16_t syn:1; - u_int16_t fin:1; -# else -# error "Adjust your defines" -# endif - u_int16_t window; - u_int16_t check; - u_int16_t urg_ptr; -}; -# endif /* __FAVOR_BSD */ - enum { TCP_ESTABLISHED = 1, diff --git a/sysdeps/gnu/netinet/udp.h b/sysdeps/gnu/netinet/udp.h index 3beb3715b8..0bf8696acf 100644 --- a/sysdeps/gnu/netinet/udp.h +++ b/sysdeps/gnu/netinet/udp.h @@ -52,27 +52,28 @@ /* UDP header as specified by RFC 768, August 1980. */ -#ifdef __FAVOR_BSD struct udphdr { - u_int16_t uh_sport; /* source port */ - u_int16_t uh_dport; /* destination port */ - u_int16_t uh_ulen; /* udp length */ - u_int16_t uh_sum; /* udp checksum */ + __extension__ union + { + struct + { + u_int16_t uh_sport; /* source port */ + u_int16_t uh_dport; /* destination port */ + u_int16_t uh_ulen; /* udp length */ + u_int16_t uh_sum; /* udp checksum */ + }; + struct + { + u_int16_t source; + u_int16_t dest; + u_int16_t len; + u_int16_t check; + }; + }; }; -#else - -struct udphdr -{ - u_int16_t source; - u_int16_t dest; - u_int16_t len; - u_int16_t check; -}; -#endif - /* UDP socket options */ #define UDP_CORK 1 /* Never send partially complete segments. */ #define UDP_ENCAP 100 /* Set the socket to accept -- cgit v1.2.3 From c688b4196014e0162a1ff11120f6c9516be0c6cb Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Thu, 19 Dec 2013 13:32:42 +0000 Subject: Add _DEFAULT_SOURCE feature test macro. This patch adds a feature test macro _DEFAULT_SOURCE to enable the default set of header declarations. The intention is: if _DEFAULT_SOURCE is not used there is no change to the set of __USE_* macros glibc defines; if it's used on its own, and without compiler options such as -std=c99 that define __STRICT_ANSI__, again, there is no change; if it's used together with the macros it approximately (i.e., apart from __USE_POSIX_IMPLICITLY) implies (-D_BSD_SOURCE -D_SVID_SOURCE -D_POSIX_C_SOURCE=200809L), again, there is no change. Otherwise, it causes the relevant features to be enabled, even if __STRICT_ANSI__, or another feature test macro, would cause them to be disabled. This macro deliberately bundles the POSIX.1-2008 (non-X/Open) functionality with the BSD/SVID/"misc" functionality, rather than defining a macro that gives just the latter, as many of the header cleanups resulting from removing _BSD_SOURCE and _SVID_SOURCE support are only possible when BSD/SVID/"misc" is always bundled with POSIX.1-2008. Tested x86_64. * include/features.h: Update comment documenting feature test macros. Mention _DEFAULT_SOURCE in comment. [_GNU_SOURCE] (_DEFAULT_SOURCE): Undefine and redefine. [_DEFAULT_SOURCE]: Undefine and redefine _DEFAULT_SOURCE, _BSD_SOURCE and _SVID_SOURCE. [!__STRICT_ANSI__ && !_ISOC99_SOURCE && !_POSIX_SOURCE && !_POSIX_C_SOURCE && !_XOPEN_SOURCE && !_BSD_SOURCE && !_SVID_SOURCE]: Likewise. [_DEFAULT_SOURCE && !_POSIX_SOURCE && !_POSIX_C_SOURCE] (__USE_POSIX_IMPLICITLY): Define. [_DEFAULT_SOURCE && !_POSIX_SOURCE && !_POSIX_C_SOURCE] (_POSIX_SOURCE): Undefine and redefine. [_DEFAULT_SOURCE && !_POSIX_SOURCE && !_POSIX_C_SOURCE] (_POSIX_C_SOURCE): Likewise. * manual/creature.texi (_DEFAULT_SOURCE): Document. (Feature Test Macros): Update documentation of default features. --- ChangeLog | 19 +++++++++++++++++++ NEWS | 5 +++++ include/features.h | 49 ++++++++++++++++++++++++++++++++++++------------- manual/creature.texi | 23 +++++++++++++++++++---- 4 files changed, 79 insertions(+), 17 deletions(-) (limited to 'include') diff --git a/ChangeLog b/ChangeLog index bee6f8be78..727688e124 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +2013-12-19 Joseph Myers + + * include/features.h: Update comment documenting feature test + macros. Mention _DEFAULT_SOURCE in comment. + [_GNU_SOURCE] (_DEFAULT_SOURCE): Undefine and redefine. + [_DEFAULT_SOURCE]: Undefine and redefine _DEFAULT_SOURCE, + _BSD_SOURCE and _SVID_SOURCE. + [!__STRICT_ANSI__ && !_ISOC99_SOURCE && !_POSIX_SOURCE && + !_POSIX_C_SOURCE && !_XOPEN_SOURCE && !_BSD_SOURCE && + !_SVID_SOURCE]: Likewise. + [_DEFAULT_SOURCE && !_POSIX_SOURCE && !_POSIX_C_SOURCE] + (__USE_POSIX_IMPLICITLY): Define. + [_DEFAULT_SOURCE && !_POSIX_SOURCE && !_POSIX_C_SOURCE] + (_POSIX_SOURCE): Undefine and redefine. + [_DEFAULT_SOURCE && !_POSIX_SOURCE && !_POSIX_C_SOURCE] + (_POSIX_C_SOURCE): Likewise. + * manual/creature.texi (_DEFAULT_SOURCE): Document. + (Feature Test Macros): Update documentation of default features. + 2013-12-19 Rajalakshmi Srinivasaraghavan * benchtests/Makefile: Add bench-strtok. diff --git a/NEWS b/NEWS index d5963491bf..d82cf9592b 100644 --- a/NEWS +++ b/NEWS @@ -101,6 +101,11 @@ Version 2.19 * Support for STT_GNU_IFUNC symbols added for ppc32/power4+ and ppc64. +* A new feature test macro _DEFAULT_SOURCE is available to enable the same + set of header declarations that are enabled by default, even when other + feature test macros or compiler options such as -std=c99 would otherwise + disable some of those declarations. + * The _BSD_SOURCE feature test macro no longer enables BSD interfaces that conflict with POSIX. The libbsd-compat library (which was a dummy library that did nothing) has also been removed. diff --git a/include/features.h b/include/features.h index cff8bfcf8e..6acd5c899d 100644 --- a/include/features.h +++ b/include/features.h @@ -41,17 +41,21 @@ _SVID_SOURCE ISO C, POSIX, and SVID things. _ATFILE_SOURCE Additional *at interfaces. _GNU_SOURCE All of the above, plus GNU extensions. + _DEFAULT_SOURCE The default set of features (taking precedence over + __STRICT_ANSI__). _REENTRANT Select additionally reentrant object. _THREAD_SAFE Same as _REENTRANT, often used by other systems. _FORTIFY_SOURCE If set to numeric value > 0 additional security measures are defined, according to level. - The `-ansi' switch to the GNU C compiler defines __STRICT_ANSI__. - If none of these are defined, the default is to have _SVID_SOURCE, - _BSD_SOURCE, and _POSIX_SOURCE set to one and _POSIX_C_SOURCE set to - 200112L. If more than one of these are defined, they accumulate. - For example __STRICT_ANSI__, _POSIX_SOURCE and _POSIX_C_SOURCE - together give you ISO C, 1003.1, and 1003.2, but nothing else. + The `-ansi' switch to the GNU C compiler, and standards conformance + options such as `-std=c99', define __STRICT_ANSI__. If none of + these are defined, or if _DEFAULT_SOURCE is defined, the default is + to have _SVID_SOURCE, _BSD_SOURCE, and _POSIX_SOURCE set to one and + _POSIX_C_SOURCE set to 200809L. If more than one of these are + defined, they accumulate. For example __STRICT_ANSI__, + _POSIX_SOURCE and _POSIX_C_SOURCE together give you ISO C, 1003.1, + and 1003.2, but nothing else. These are defined by this file and are used by the header files to decide what to declare or define: @@ -160,6 +164,8 @@ # define _XOPEN_SOURCE_EXTENDED 1 # undef _LARGEFILE64_SOURCE # define _LARGEFILE64_SOURCE 1 +# undef _DEFAULT_SOURCE +# define _DEFAULT_SOURCE 1 # undef _BSD_SOURCE # define _BSD_SOURCE 1 # undef _SVID_SOURCE @@ -168,12 +174,19 @@ # define _ATFILE_SOURCE 1 #endif -/* If nothing (other than _GNU_SOURCE) is defined, - define _BSD_SOURCE and _SVID_SOURCE. */ -#if (!defined __STRICT_ANSI__ && !defined _ISOC99_SOURCE && \ - !defined _POSIX_SOURCE && !defined _POSIX_C_SOURCE && \ - !defined _XOPEN_SOURCE && !defined _BSD_SOURCE && !defined _SVID_SOURCE) +/* If nothing (other than _GNU_SOURCE and _DEFAULT_SOURCE) is defined, + define _DEFAULT_SOURCE, _BSD_SOURCE and _SVID_SOURCE. */ +#if (defined _DEFAULT_SOURCE \ + || (!defined __STRICT_ANSI__ \ + && !defined _ISOC99_SOURCE \ + && !defined _POSIX_SOURCE && !defined _POSIX_C_SOURCE \ + && !defined _XOPEN_SOURCE \ + && !defined _BSD_SOURCE && !defined _SVID_SOURCE)) +# undef _DEFAULT_SOURCE +# define _DEFAULT_SOURCE 1 +# undef _BSD_SOURCE # define _BSD_SOURCE 1 +# undef _SVID_SOURCE # define _SVID_SOURCE 1 #endif @@ -204,8 +217,18 @@ # define __USE_ISOCXX11 1 #endif -/* If none of the ANSI/POSIX macros are defined, use POSIX.1 and POSIX.2 - (and IEEE Std 1003.1b-1993 unless _XOPEN_SOURCE is defined). */ +/* If none of the ANSI/POSIX macros are defined, or if _DEFAULT_SOURCE + is defined, use POSIX.1-2008 (or another version depending on + _XOPEN_SOURCE). */ +#ifdef _DEFAULT_SOURCE +# if !defined _POSIX_SOURCE && !defined _POSIX_C_SOURCE +# define __USE_POSIX_IMPLICITLY 1 +# endif +# undef _POSIX_SOURCE +# define _POSIX_SOURCE 1 +# undef _POSIX_C_SOURCE +# define _POSIX_C_SOURCE 200809L +#endif #if ((!defined __STRICT_ANSI__ || (_XOPEN_SOURCE - 0) >= 500) && \ !defined _POSIX_SOURCE && !defined _POSIX_C_SOURCE) # define _POSIX_SOURCE 1 diff --git a/manual/creature.texi b/manual/creature.texi index 3b7e77c78b..bbf16b7f27 100644 --- a/manual/creature.texi +++ b/manual/creature.texi @@ -188,6 +188,21 @@ the cases where POSIX.1 conflicts with BSD, the POSIX definitions take precedence. @end defvr +@comment (none) +@comment GNU +@defvr Macro _DEFAULT_SOURCE +If you define this macro, most features are included apart from +X/Open, LFS and GNU extensions; the effect is similar to defining +@code{_POSIX_C_SOURCE} to @code{200809L} and @code{_POSIX_SOURCE}, +@code{_SVID_SOURCE}, and @code{_BSD_SOURCE} to 1. Defining this +macro, on its own and without using compiler options such as +@option{-ansi} or @option{-std=c99}, has the same effect as not +defining any feature test macros; defining it together with other +feature test macros, or when options such as @option{-ansi} are used, +enables those features even when the other options would otherwise +cause them to be disabled. +@end defvr + @comment (none) @comment GNU @defvr Macro _REENTRANT @@ -204,10 +219,10 @@ it must have been specified to compile as thread safe. @end defvr We recommend you use @code{_GNU_SOURCE} in new programs. If you don't -specify the @samp{-ansi} option to GCC and don't define any of these -macros explicitly, the effect is the same as defining -@code{_POSIX_C_SOURCE} to 2 and @code{_POSIX_SOURCE}, -@code{_SVID_SOURCE}, and @code{_BSD_SOURCE} to 1. +specify the @samp{-ansi} option to GCC, or other conformance options +such as @option{-std=c99}, and don't define any of these macros +explicitly, the effect is the same as defining @code{_DEFAULT_SOURCE} +to 1. When you define a feature test macro to request a larger class of features, it is harmless to define in addition a feature test macro for a subset of -- cgit v1.2.3