* [PATCH 0/2] _ISOMAC testsuite round N @ 2017-03-22 12:55 Zack Weinberg 2017-03-22 12:55 ` [PATCH 1/2] Remove _IO_MTSAFE_IO from public headers Zack Weinberg ` (2 more replies) 0 siblings, 3 replies; 17+ messages in thread From: Zack Weinberg @ 2017-03-22 12:55 UTC (permalink / raw) To: libc-alpha The main change from the previous iteration of this patch, is that I have (hopefully) made there be no visible difference in libio.h for external users. It defines all the same _IO_ thingies that it always has, with the same definitions. Patch #1 still needs a very careful going-over by people who remember what the original goals of libio were and know what external users there might still be, though. Also, the Makefile adjustments in patch #2 have been updated for Thorsten's work on deprecating SunRPC. zw Zack Weinberg (2): Remove _IO_MTSAFE_IO from public headers. Suppress internal declarations for most of the testsuite. Makeconfig | 3 +- Makefile | 4 +- Makerules | 55 ++++++++++---- Rules | 18 ++--- benchtests/strcoll-inputs/filelist#en_US.UTF-8 | 1 - config.h.in | 11 --- elf/Makefile | 58 ++++++++------- elf/tst-env-setuid-tunables.c | 6 ++ extra-modules.mk | 9 --- include/errno.h | 2 +- include/libc-symbols.h | 62 +++++++++++----- include/libio.h | 25 ++++--- include/math.h | 5 ++ include/stdio.h | 7 +- include/stdlib.h | 4 -- include/string.h | 10 +-- include/time.h | 4 -- include/unistd.h | 3 - include/wchar.h | 2 - inet/Makefile | 7 +- inet/tst-checks-posix.c | 1 - intl/tst-gettext2.c | 2 + libio/libio.h | 31 ++++---- malloc/Makefile | 6 +- math/test-signgam-finite-c99.c | 1 - math/test-signgam-main.c | 1 - misc/Makefile | 5 +- misc/sys/cdefs.h | 3 + nptl/Makefile | 31 ++++---- nss/Makefile | 4 +- posix/Makefile | 11 +-- stdlib/Makefile | 17 +++-- stdlib/tst-strtod.c | 64 +---------------- stdlib/tst-strtod1i.c | 83 +++++++++++++++++++++ stdlib/tst-strtod5.c | 74 +++++++++---------- stdlib/tst-strtod5i.c | 99 ++++++++++++++++++++++++++ string/test-string.h | 12 ++++ string/test-strstr.c | 1 + sunrpc/Makefile | 3 +- sysdeps/generic/stdio-lock.h | 1 + sysdeps/ia64/fpu/libm-symbols.h | 2 +- sysdeps/m68k/m680x0/fpu/bits/mathinline.h | 15 ++-- sysdeps/nptl/stdio-lock.h | 1 + sysdeps/powerpc/Makefile | 2 +- sysdeps/unix/sysv/linux/Makefile | 3 +- sysdeps/x86_64/fpu/Makefile | 8 +++ sysdeps/x86_64/fpu/math-tests-arch.h | 8 +-- sysdeps/x86_64/multiarch/test-multiarch.c | 2 +- 48 files changed, 496 insertions(+), 291 deletions(-) delete mode 100644 extra-modules.mk create mode 100644 stdlib/tst-strtod1i.c create mode 100644 stdlib/tst-strtod5i.c -- 2.11.0 ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 1/2] Remove _IO_MTSAFE_IO from public headers. 2017-03-22 12:55 [PATCH 0/2] _ISOMAC testsuite round N Zack Weinberg @ 2017-03-22 12:55 ` Zack Weinberg 2017-04-06 20:29 ` Adhemerval Zanella 2017-03-22 12:55 ` [PATCH 2/2] Suppress internal declarations for most of the testsuite Zack Weinberg 2017-04-06 16:12 ` [PATCH 0/2] _ISOMAC testsuite round N Zack Weinberg 2 siblings, 1 reply; 17+ messages in thread From: Zack Weinberg @ 2017-03-22 12:55 UTC (permalink / raw) To: libc-alpha _IO_MTSAFE_IO controls whether stdio is *built* with support for multithreading. In the distant past it might also have worked as a feature selection macro, allowing library *users* to select thread-safe or lock-free stdio at application build time, I haven't done the archaeology. Nowadays, defining _IO_MTSAFE_IO while using the installed headers, or in _ISOMAC mode, will cause libio.h to throw syntax errors. This patch removes _IO_MTSAFE_IO from the public headers (specifically, from libio/libio.h). The most important thing it controlled in there was whether libio.h defines _IO_lock_t itself or expects stdio-lock.h to have done it, and we do still need a inter-header communication macro for that, because stdio-lock.h can only define _IO_lock_t as a typedef. I've invented _IO_lock_t_defined, which is defined by both versions of stdio-lock.h. _IO_MTSAFE_IO also controlled the definitions of a handful of macros that _might_ count as part of the public libio.h interface. They are now unconditionally given their non-_IO_MTSAFE_IO definition in libio/libio.h, and include/libio.h redefines them with the _IO_MTSAFE_IO definition. This should minimize the odds of breaking old software that actually uses those macros. I suspect that this entire mechanism is vestigial, and that glibc won't build anymore if you *don't* define _IO_MTSAFE_IO, but that's another patchset. The bulk of libio.h is internal-use-only stuff that no longer makes sense to expose (libstdc++ gave up on making a FILE the same object as a C++ filebuf *decades* ago) but that, too, is another patchset. * libio/libio.h: Condition dummy definition of _IO_lock_t on _IO_lock_t_defined, not _IO_MTSAFE_IO. Unconditionally use the non-_IO_MTSAFE_IO definitions for _IO_peekc, _IO_flockfile, _IO_funlockfile, and _IO_ftrylockfile. Only define _IO_cleanup_region_start and _IO_cleanup_region_end if not already defined. * include/libio.h: If _IO_MTSAFE_IO is defined, redefine _IO_peekc, _IO_flockfile, _IO_funlockfile, and _IO_ftrylockfile appropriately. * sysdeps/generic/stdio-lock.h, sysdeps/nptl/stdio-lock.h: Define _IO_lock_t_defined after defining _IO_lock_t. --- include/libio.h | 25 +++++++++++++++++-------- libio/libio.h | 31 +++++++++++++------------------ sysdeps/generic/stdio-lock.h | 1 + sysdeps/nptl/stdio-lock.h | 1 + 4 files changed, 32 insertions(+), 26 deletions(-) diff --git a/include/libio.h b/include/libio.h index 97fc5b548b..d2fa796758 100644 --- a/include/libio.h +++ b/include/libio.h @@ -21,16 +21,25 @@ libc_hidden_proto (_IO_sgetn) libc_hidden_proto (_IO_vfprintf) libc_hidden_proto (_IO_vfscanf) -#if defined _IO_MTSAFE_IO && _IO_lock_inexpensive +#ifdef _IO_MTSAFE_IO +# undef _IO_peekc # undef _IO_flockfile -# define _IO_flockfile(_fp) \ - if (((_fp)->_flags & _IO_USER_LOCK) == 0) \ - _IO_lock_lock (*(_fp)->_lock) # undef _IO_funlockfile -# define _IO_funlockfile(_fp) \ - if (((_fp)->_flags & _IO_USER_LOCK) == 0) \ - _IO_lock_unlock (*(_fp)->_lock) -#endif +# undef _IO_ftrylockfile + +# define _IO_peekc(_fp) _IO_peekc_locked (_fp) +# if _IO_lock_inexpensive +# define _IO_flockfile(_fp) \ + if (((_fp)->_flags & _IO_USER_LOCK) == 0) _IO_lock_lock (*(_fp)->_lock) +# define _IO_funlockfile(_fp) \ + if (((_fp)->_flags & _IO_USER_LOCK) == 0) _IO_lock_unlock (*(_fp)->_lock) +# else +# define _IO_flockfile(_fp) \ + if (((_fp)->_flags & _IO_USER_LOCK) == 0) _IO_flockfile (_fp) +# define _IO_funlockfile(_fp) \ + if (((_fp)->_flags & _IO_USER_LOCK) == 0) _IO_funlockfile (_fp) +# endif +#endif /* _IO_MTSAFE_IO */ #endif #endif diff --git a/libio/libio.h b/libio/libio.h index 2241c1471d..518ffd8e44 100644 --- a/libio/libio.h +++ b/libio/libio.h @@ -143,10 +143,9 @@ struct _IO_jump_t; struct _IO_FILE; -/* Handle lock. */ -#ifdef _IO_MTSAFE_IO -/* _IO_lock_t defined in internal headers during the glibc build. */ -#else +/* During the build of glibc itself, _IO_lock_t will already have been + defined by internal headers. */ +#ifndef _IO_lock_t_defined typedef void _IO_lock_t; #endif @@ -441,20 +440,16 @@ extern void _IO_flockfile (_IO_FILE *) __THROW; extern void _IO_funlockfile (_IO_FILE *) __THROW; extern int _IO_ftrylockfile (_IO_FILE *) __THROW; -#ifdef _IO_MTSAFE_IO -# define _IO_peekc(_fp) _IO_peekc_locked (_fp) -# define _IO_flockfile(_fp) \ - if (((_fp)->_flags & _IO_USER_LOCK) == 0) _IO_flockfile (_fp) -# define _IO_funlockfile(_fp) \ - if (((_fp)->_flags & _IO_USER_LOCK) == 0) _IO_funlockfile (_fp) -#else -# define _IO_peekc(_fp) _IO_peekc_unlocked (_fp) -# define _IO_flockfile(_fp) /**/ -# define _IO_funlockfile(_fp) /**/ -# define _IO_ftrylockfile(_fp) /**/ -# define _IO_cleanup_region_start(_fct, _fp) /**/ -# define _IO_cleanup_region_end(_Doit) /**/ -#endif /* !_IO_MTSAFE_IO */ +#define _IO_peekc(_fp) _IO_peekc_unlocked (_fp) +#define _IO_flockfile(_fp) /**/ +#define _IO_funlockfile(_fp) /**/ +#define _IO_ftrylockfile(_fp) /**/ +#ifndef _IO_cleanup_region_start +#define _IO_cleanup_region_start(_fct, _fp) /**/ +#endif +#ifndef _IO_cleanup_region_end +#define _IO_cleanup_region_end(_Doit) /**/ +#endif extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict, _IO_va_list, int *__restrict); diff --git a/sysdeps/generic/stdio-lock.h b/sysdeps/generic/stdio-lock.h index 532bb5f23f..763c7d465a 100644 --- a/sysdeps/generic/stdio-lock.h +++ b/sysdeps/generic/stdio-lock.h @@ -22,6 +22,7 @@ #include <libc-lock.h> __libc_lock_define_recursive (typedef, _IO_lock_t) +#define _IO_lock_t_defined 1 /* We need recursive (counting) mutexes. */ #ifdef _LIBC_LOCK_RECURSIVE_INITIALIZER diff --git a/sysdeps/nptl/stdio-lock.h b/sysdeps/nptl/stdio-lock.h index 35d6ce0a29..df749062ea 100644 --- a/sysdeps/nptl/stdio-lock.h +++ b/sysdeps/nptl/stdio-lock.h @@ -27,6 +27,7 @@ #define _IO_lock_inexpensive 1 typedef struct { int lock; int cnt; void *owner; } _IO_lock_t; +#define _IO_lock_t_defined 1 #define _IO_lock_initializer { LLL_LOCK_INITIALIZER, 0, NULL } -- 2.11.0 ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 1/2] Remove _IO_MTSAFE_IO from public headers. 2017-03-22 12:55 ` [PATCH 1/2] Remove _IO_MTSAFE_IO from public headers Zack Weinberg @ 2017-04-06 20:29 ` Adhemerval Zanella 2017-04-06 20:41 ` Zack Weinberg 0 siblings, 1 reply; 17+ messages in thread From: Adhemerval Zanella @ 2017-04-06 20:29 UTC (permalink / raw) To: libc-alpha On 22/03/2017 09:55, Zack Weinberg wrote: > _IO_MTSAFE_IO controls whether stdio is *built* with support for > multithreading. In the distant past it might also have worked as a > feature selection macro, allowing library *users* to select > thread-safe or lock-free stdio at application build time, I haven't > done the archaeology. Nowadays, defining _IO_MTSAFE_IO while using > the installed headers, or in _ISOMAC mode, will cause libio.h to throw > syntax errors. What prevent us to just get rid of _IO_MTSAFE_IO and just build/assume stdio with multithread support? Checking on debian code search [1], only newlib, glibc, uclibc, hurd, and libconvert-binary-c-perl seems to use/define it: * newlib have an explicit comment stating it expects multithread support. newlib_2.4.0.20160527-2/newlib/libc/sys/linux/bits/libc-lock.h #endif #define _IO_MTSAFE_IO /* add this as we always want this in newlib */ /* Mutex type. */ * uclibc is basically some old glibc code. * hurd also expected the same as newlib: hurd_1:0.9.git20170310-1/libthreads/lockfile.c Boston, MA 02111-1307, USA. */ #define _IO_MTSAFE_IO #define IS_IN(lib) 0 * libconvert-binary-c-perl just uses it on some internal testing where I am not sure if the correct way to use an internal glibc header. [1] https://codesearch.debian.net/search?q=_IO_MTSAFE_IO > > This patch removes _IO_MTSAFE_IO from the public headers > (specifically, from libio/libio.h). The most important thing it > controlled in there was whether libio.h defines _IO_lock_t itself or > expects stdio-lock.h to have done it, and we do still need a > inter-header communication macro for that, because stdio-lock.h can > only define _IO_lock_t as a typedef. I've invented > _IO_lock_t_defined, which is defined by both versions of stdio-lock.h. > > _IO_MTSAFE_IO also controlled the definitions of a handful of macros > that _might_ count as part of the public libio.h interface. They are > now unconditionally given their non-_IO_MTSAFE_IO definition in > libio/libio.h, and include/libio.h redefines them with the > _IO_MTSAFE_IO definition. This should minimize the odds of breaking > old software that actually uses those macros. > > I suspect that this entire mechanism is vestigial, and that glibc > won't build anymore if you *don't* define _IO_MTSAFE_IO, but that's > another patchset. The bulk of libio.h is internal-use-only stuff that > no longer makes sense to expose (libstdc++ gave up on making a FILE > the same object as a C++ filebuf *decades* ago) but that, too, is > another patchset. > > * libio/libio.h: Condition dummy definition of _IO_lock_t on > _IO_lock_t_defined, not _IO_MTSAFE_IO. Unconditionally use the > non-_IO_MTSAFE_IO definitions for _IO_peekc, _IO_flockfile, > _IO_funlockfile, and _IO_ftrylockfile. Only define > _IO_cleanup_region_start and _IO_cleanup_region_end if not > already defined. > * include/libio.h: If _IO_MTSAFE_IO is defined, redefine > _IO_peekc, _IO_flockfile, _IO_funlockfile, and _IO_ftrylockfile > appropriately. > * sysdeps/generic/stdio-lock.h, sysdeps/nptl/stdio-lock.h: > Define _IO_lock_t_defined after defining _IO_lock_t. > --- > include/libio.h | 25 +++++++++++++++++-------- > libio/libio.h | 31 +++++++++++++------------------ > sysdeps/generic/stdio-lock.h | 1 + > sysdeps/nptl/stdio-lock.h | 1 + > 4 files changed, 32 insertions(+), 26 deletions(-) > > diff --git a/include/libio.h b/include/libio.h > index 97fc5b548b..d2fa796758 100644 > --- a/include/libio.h > +++ b/include/libio.h > @@ -21,16 +21,25 @@ libc_hidden_proto (_IO_sgetn) > libc_hidden_proto (_IO_vfprintf) > libc_hidden_proto (_IO_vfscanf) > > -#if defined _IO_MTSAFE_IO && _IO_lock_inexpensive > +#ifdef _IO_MTSAFE_IO > +# undef _IO_peekc > # undef _IO_flockfile > -# define _IO_flockfile(_fp) \ > - if (((_fp)->_flags & _IO_USER_LOCK) == 0) \ > - _IO_lock_lock (*(_fp)->_lock) > # undef _IO_funlockfile > -# define _IO_funlockfile(_fp) \ > - if (((_fp)->_flags & _IO_USER_LOCK) == 0) \ > - _IO_lock_unlock (*(_fp)->_lock) > -#endif > +# undef _IO_ftrylockfile > + > +# define _IO_peekc(_fp) _IO_peekc_locked (_fp) > +# if _IO_lock_inexpensive > +# define _IO_flockfile(_fp) \ > + if (((_fp)->_flags & _IO_USER_LOCK) == 0) _IO_lock_lock (*(_fp)->_lock) > +# define _IO_funlockfile(_fp) \ > + if (((_fp)->_flags & _IO_USER_LOCK) == 0) _IO_lock_unlock (*(_fp)->_lock) > +# else > +# define _IO_flockfile(_fp) \ > + if (((_fp)->_flags & _IO_USER_LOCK) == 0) _IO_flockfile (_fp) > +# define _IO_funlockfile(_fp) \ > + if (((_fp)->_flags & _IO_USER_LOCK) == 0) _IO_funlockfile (_fp) > +# endif > +#endif /* _IO_MTSAFE_IO */ > > #endif > #endif > diff --git a/libio/libio.h b/libio/libio.h > index 2241c1471d..518ffd8e44 100644 > --- a/libio/libio.h > +++ b/libio/libio.h > @@ -143,10 +143,9 @@ > > struct _IO_jump_t; struct _IO_FILE; > > -/* Handle lock. */ > -#ifdef _IO_MTSAFE_IO > -/* _IO_lock_t defined in internal headers during the glibc build. */ > -#else > +/* During the build of glibc itself, _IO_lock_t will already have been > + defined by internal headers. */ > +#ifndef _IO_lock_t_defined > typedef void _IO_lock_t; > #endif > > @@ -441,20 +440,16 @@ extern void _IO_flockfile (_IO_FILE *) __THROW; > extern void _IO_funlockfile (_IO_FILE *) __THROW; > extern int _IO_ftrylockfile (_IO_FILE *) __THROW; > > -#ifdef _IO_MTSAFE_IO > -# define _IO_peekc(_fp) _IO_peekc_locked (_fp) > -# define _IO_flockfile(_fp) \ > - if (((_fp)->_flags & _IO_USER_LOCK) == 0) _IO_flockfile (_fp) > -# define _IO_funlockfile(_fp) \ > - if (((_fp)->_flags & _IO_USER_LOCK) == 0) _IO_funlockfile (_fp) > -#else > -# define _IO_peekc(_fp) _IO_peekc_unlocked (_fp) > -# define _IO_flockfile(_fp) /**/ > -# define _IO_funlockfile(_fp) /**/ > -# define _IO_ftrylockfile(_fp) /**/ > -# define _IO_cleanup_region_start(_fct, _fp) /**/ > -# define _IO_cleanup_region_end(_Doit) /**/ > -#endif /* !_IO_MTSAFE_IO */ > +#define _IO_peekc(_fp) _IO_peekc_unlocked (_fp) > +#define _IO_flockfile(_fp) /**/ > +#define _IO_funlockfile(_fp) /**/ > +#define _IO_ftrylockfile(_fp) /**/ > +#ifndef _IO_cleanup_region_start > +#define _IO_cleanup_region_start(_fct, _fp) /**/ > +#endif > +#ifndef _IO_cleanup_region_end > +#define _IO_cleanup_region_end(_Doit) /**/ > +#endif > > extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict, > _IO_va_list, int *__restrict); > diff --git a/sysdeps/generic/stdio-lock.h b/sysdeps/generic/stdio-lock.h > index 532bb5f23f..763c7d465a 100644 > --- a/sysdeps/generic/stdio-lock.h > +++ b/sysdeps/generic/stdio-lock.h > @@ -22,6 +22,7 @@ > #include <libc-lock.h> > > __libc_lock_define_recursive (typedef, _IO_lock_t) > +#define _IO_lock_t_defined 1 > > /* We need recursive (counting) mutexes. */ > #ifdef _LIBC_LOCK_RECURSIVE_INITIALIZER > diff --git a/sysdeps/nptl/stdio-lock.h b/sysdeps/nptl/stdio-lock.h > index 35d6ce0a29..df749062ea 100644 > --- a/sysdeps/nptl/stdio-lock.h > +++ b/sysdeps/nptl/stdio-lock.h > @@ -27,6 +27,7 @@ > #define _IO_lock_inexpensive 1 > > typedef struct { int lock; int cnt; void *owner; } _IO_lock_t; > +#define _IO_lock_t_defined 1 > > #define _IO_lock_initializer { LLL_LOCK_INITIALIZER, 0, NULL } > > ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 1/2] Remove _IO_MTSAFE_IO from public headers. 2017-04-06 20:29 ` Adhemerval Zanella @ 2017-04-06 20:41 ` Zack Weinberg 2017-04-06 21:30 ` Adhemerval Zanella 0 siblings, 1 reply; 17+ messages in thread From: Zack Weinberg @ 2017-04-06 20:41 UTC (permalink / raw) To: Adhemerval Zanella; +Cc: GNU C Library On Thu, Apr 6, 2017 at 4:29 PM, Adhemerval Zanella <adhemerval.zanella@linaro.org> wrote: > On 22/03/2017 09:55, Zack Weinberg wrote: >> _IO_MTSAFE_IO controls whether stdio is *built* with support for >> multithreading. In the distant past it might also have worked as a >> feature selection macro, allowing library *users* to select >> thread-safe or lock-free stdio at application build time, I haven't >> done the archaeology. Nowadays, defining _IO_MTSAFE_IO while using >> the installed headers, or in _ISOMAC mode, will cause libio.h to throw >> syntax errors. > > What prevent us to just get rid of _IO_MTSAFE_IO and just build/assume > stdio with multithread support? I think that's a desirable goal, but I don't want to do that in this patchset because I suspect it will be messy *inside* libc. And I'd start by getting it out of the public headers, anyway. (I'd like to stop installing libio.h at all, too, but that's probably going to be nastier: https://codesearch.debian.net/search?q=libio.h&perpkg=1) ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 1/2] Remove _IO_MTSAFE_IO from public headers. 2017-04-06 20:41 ` Zack Weinberg @ 2017-04-06 21:30 ` Adhemerval Zanella 2017-04-06 22:06 ` Florian Weimer 0 siblings, 1 reply; 17+ messages in thread From: Adhemerval Zanella @ 2017-04-06 21:30 UTC (permalink / raw) To: Zack Weinberg; +Cc: GNU C Library On 06/04/2017 17:41, Zack Weinberg wrote: > On Thu, Apr 6, 2017 at 4:29 PM, Adhemerval Zanella > <adhemerval.zanella@linaro.org> wrote: >> On 22/03/2017 09:55, Zack Weinberg wrote: >>> _IO_MTSAFE_IO controls whether stdio is *built* with support for >>> multithreading. In the distant past it might also have worked as a >>> feature selection macro, allowing library *users* to select >>> thread-safe or lock-free stdio at application build time, I haven't >>> done the archaeology. Nowadays, defining _IO_MTSAFE_IO while using >>> the installed headers, or in _ISOMAC mode, will cause libio.h to throw >>> syntax errors. >> >> What prevent us to just get rid of _IO_MTSAFE_IO and just build/assume >> stdio with multithread support? > > I think that's a desirable goal, but I don't want to do that in this > patchset because I suspect it will be messy *inside* libc. And I'd > start by getting it out of the public headers, anyway. Why do you think so? The make fragment sysdeps/pthread/Makeconfig already sets libc-reentrant regardless, so _IO_MTSAFE_IO is already being defined in all objects that might use it (and I suspect it has been this way for some time already). > > (I'd like to stop installing libio.h at all, too, but that's probably > going to be nastier: > https://codesearch.debian.net/search?q=libio.h&perpkg=1) > Agreed. ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 1/2] Remove _IO_MTSAFE_IO from public headers. 2017-04-06 21:30 ` Adhemerval Zanella @ 2017-04-06 22:06 ` Florian Weimer 2017-04-07 14:46 ` Adhemerval Zanella 0 siblings, 1 reply; 17+ messages in thread From: Florian Weimer @ 2017-04-06 22:06 UTC (permalink / raw) To: Adhemerval Zanella, Zack Weinberg; +Cc: GNU C Library On 04/06/2017 11:29 PM, Adhemerval Zanella wrote: > > > On 06/04/2017 17:41, Zack Weinberg wrote: >> On Thu, Apr 6, 2017 at 4:29 PM, Adhemerval Zanella >> <adhemerval.zanella@linaro.org> wrote: >>> On 22/03/2017 09:55, Zack Weinberg wrote: >>>> _IO_MTSAFE_IO controls whether stdio is *built* with support for >>>> multithreading. In the distant past it might also have worked as a >>>> feature selection macro, allowing library *users* to select >>>> thread-safe or lock-free stdio at application build time, I haven't >>>> done the archaeology. Nowadays, defining _IO_MTSAFE_IO while using >>>> the installed headers, or in _ISOMAC mode, will cause libio.h to throw >>>> syntax errors. >>> >>> What prevent us to just get rid of _IO_MTSAFE_IO and just build/assume >>> stdio with multithread support? >> >> I think that's a desirable goal, but I don't want to do that in this >> patchset because I suspect it will be messy *inside* libc. And I'd >> start by getting it out of the public headers, anyway. > > Why do you think so? The make fragment sysdeps/pthread/Makeconfig already > sets libc-reentrant regardless, so _IO_MTSAFE_IO is already being defined > in all objects that might use it (and I suspect it has been this way for > some time already). There is some oddity going on with regards to the libio locking macros. A previous discussion: <https://sourceware.org/ml/libc-alpha/2016-04/msg00748.html> (spans into next month) Obviously, we need to clean this up, but we need to be careful to preserve the locking behavior expected by applications. Thanks, Florian ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 1/2] Remove _IO_MTSAFE_IO from public headers. 2017-04-06 22:06 ` Florian Weimer @ 2017-04-07 14:46 ` Adhemerval Zanella 0 siblings, 0 replies; 17+ messages in thread From: Adhemerval Zanella @ 2017-04-07 14:46 UTC (permalink / raw) To: Florian Weimer, Zack Weinberg; +Cc: GNU C Library On 06/04/2017 19:06, Florian Weimer wrote: > On 04/06/2017 11:29 PM, Adhemerval Zanella wrote: >> >> >> On 06/04/2017 17:41, Zack Weinberg wrote: >>> On Thu, Apr 6, 2017 at 4:29 PM, Adhemerval Zanella >>> <adhemerval.zanella@linaro.org> wrote: >>>> On 22/03/2017 09:55, Zack Weinberg wrote: >>>>> _IO_MTSAFE_IO controls whether stdio is *built* with support for >>>>> multithreading. In the distant past it might also have worked as a >>>>> feature selection macro, allowing library *users* to select >>>>> thread-safe or lock-free stdio at application build time, I haven't >>>>> done the archaeology. Nowadays, defining _IO_MTSAFE_IO while using >>>>> the installed headers, or in _ISOMAC mode, will cause libio.h to throw >>>>> syntax errors. >>>> >>>> What prevent us to just get rid of _IO_MTSAFE_IO and just build/assume >>>> stdio with multithread support? >>> >>> I think that's a desirable goal, but I don't want to do that in this >>> patchset because I suspect it will be messy *inside* libc. And I'd >>> start by getting it out of the public headers, anyway. >> >> Why do you think so? The make fragment sysdeps/pthread/Makeconfig already >> sets libc-reentrant regardless, so _IO_MTSAFE_IO is already being defined >> in all objects that might use it (and I suspect it has been this way for >> some time already). > > There is some oddity going on with regards to the libio locking macros. A previous discussion: > > <https://sourceware.org/ml/libc-alpha/2016-04/msg00748.html> > (spans into next month) > > Obviously, we need to clean this up, but we need to be careful to preserve the locking behavior expected by applications. > > Thanks, > Florian Right, removing _IO_MTSAFE_IO seems no be not a trivial issue. I think we can push it in the future then. ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 2/2] Suppress internal declarations for most of the testsuite. 2017-03-22 12:55 [PATCH 0/2] _ISOMAC testsuite round N Zack Weinberg 2017-03-22 12:55 ` [PATCH 1/2] Remove _IO_MTSAFE_IO from public headers Zack Weinberg @ 2017-03-22 12:55 ` Zack Weinberg 2017-05-08 14:02 ` Andreas Schwab 2017-04-06 16:12 ` [PATCH 0/2] _ISOMAC testsuite round N Zack Weinberg 2 siblings, 1 reply; 17+ messages in thread From: Zack Weinberg @ 2017-03-22 12:55 UTC (permalink / raw) To: libc-alpha This patch adds a new build module called 'testsuite'. IS_IN (testsuite) implies _ISOMAC, as do IS_IN_build and __cplusplus (which means several ad-hoc tests for __cplusplus can go away). libc-symbols.h now suppresses almost all of *itself* when _ISOMAC is defined; in particular, _ISOMAC mode does not get config.h automatically anymore. There are still quite a few tests that need to see internal gunk of one variety or another. For them, we now have 'tests-internal' and 'test-internal-extras'; files in this category will still be compiled with MODULE_NAME=nonlib, and everything proceeds as it always has. The bulk of this patch is moving tests from 'tests' to 'tests-internal'. There is also 'tests-static-internal', which has the same effect on files in 'tests-static', and 'modules-names-tests', which has the *inverse* effect on files in 'modules-names' (it's inverted because most of the things in modules-names are *not* tests). For both of these, the file must appear in *both* the new variable and the old one. There is also now a special case for when libc-symbols.h is included without MODULE_NAME being defined at all. (This happens during the creation of libc-modules.h, and also when preprocessing Versions files.) When this happens, IS_IN is set to be always false and _ISOMAC is *not* defined, which was the status quo, but now it's explicit. The remaining changes to C source files in this patch seemed likely to cause problems in the absence of the main change. They should be relatively self-explanatory. In a few cases I duplicated a definition from an internal header rather than move the test to tests-internal; this was a judgement call each time and I'm happy to change those however reviewers feel is more appropriate. N.B. extra-modules.mk was almost identical to cppflags-iterator.mk; the only differences were that it used a different input variable and it didn't let the caller control the module. So I have removed it and changed the sole use to use cppflags-iterator.mk instead. * Makerules: New subdir configuration variables 'tests-internal' and 'test-internal-extras'. Test files in these categories will still be compiled with MODULE_NAME=nonlib. Test files in the existing categories (tests, xtests, test-srcs, test-extras) are now compiled with MODULE_NAME=testsuite. New subdir configuration variable 'modules-names-tests'. Files which are in both 'modules-names' and 'modules-names-tests' will be compiled with MODULE_NAME=testsuite instead of MODULE_NAME=extramodules. Use cppflags-iterator.mk instead of extra-modules.mk for the files in $(modules-names). (gen-as-const-headers): Move to tests-internal. (do-tests-clean, common-mostlyclean): Support tests-internal. * Makeconfig (built-modules): Add testsuite. * Makefile: Change libof-check-installed-headers-c and libof-check-installed-headers-cxx to 'testsuite'. * Rules: Likewise. Support tests-internal. * extra-modules.mk: Removed. * benchtests/strcoll-inputs/filelist#en_US.UTF-8: Remove extra-modules.mk. * config.h.in: Don't check for __OPTIMIZE__ or __FAST_MATH__ here. * include/libc-symbols.h: Move definitions of _GNU_SOURCE, PASTE_NAME, PASTE_NAME1, IN_MODULE, IS_IN, and IS_IN_LIB to the very top of the file and rationalize their order. If MODULE_NAME is not defined at all, define IS_IN to always be false, and don't define _ISOMAC. If any of IS_IN (testsuite), IS_IN_build, or __cplusplus are true, define _ISOMAC and suppress everything else in this file, starting with the inclusion of config.h. Do check for inappropriate definitions of __OPTIMIZE__ and __FAST_MATH__ here, but only if _ISOMAC is not defined. Correct some out-of-date commentary. * include/math.h: If _ISOMAC is defined, undefine NO_LONG_DOUBLE and _Mlong_double_ before including math.h. * include/string.h: If _ISOMAC is defined, don't expose _STRING_ARCH_unaligned. Move a comment to a more appropriate location. * include/errno.h, include/stdio.h, include/stdlib.h, include/string.h * include/time.h, include/unistd.h, include/wchar.h: No need to check __cplusplus nor use __BEGIN_DECLS/__END_DECLS. * misc/sys/cdefs.h (__NTHNL): New macro. * sysdeps/m68k/m680x0/fpu/bits/mathinline.h (__m81_defun): Use __NTHNL to avoid errors with GCC 6. * elf/tst-env-setuid-tunables.c: Include config.h with _LIBC defined, for HAVE_TUNABLES. * inet/tst-checks-posix.c: No need to define _ISOMAC. * intl/tst-gettext2.c: Provide own definition of N_. * math/test-signgam-finite-c99.c: No need to define _ISOMAC. * math/test-signgam-main.c: No need to define _ISOMAC. * stdlib/tst-strtod.c: Convert to test-driver. Split locale_test to... * stdlib/tst-strtod1i.c: ...this new file. * stdlib/tst-strtod5.c: Convert to test-driver and add copyright notice. Split tests of __strtod_internal to... * stdlib/tst-strtod5i.c: ...this new file. * string/test-string.h: Include stdint.h. Duplicate definition of inhibit_loop_to_libcall here (from libc-symbols.h). * string/test-strstr.c: Provide dummy definition of libc_hidden_builtin_def when including strstr.c. * sysdeps/ia64/fpu/libm-symbols.h: Suppress entire file in _ISOMAC mode; no need to test __STRICT_ANSI__ nor __cplusplus as well. * sysdeps/x86_64/fpu/math-tests-arch.h: Include cpu-features.h. Don't include init-arch.h. * sysdeps/x86_64/multiarch/test-multiarch.h: Include cpu-features.h. Don't include init-arch.h. * elf/Makefile: Move tst-ptrguard1-static, tst-stackguard1-static, tst-tls1-static, tst-tls2-static, tst-tls3-static, loadtest, unload, unload2, circleload1, neededtest, neededtest2, neededtest3, neededtest4, tst-tls1, tst-tls2, tst-tls3, tst-tls6, tst-tls7, tst-tls8, tst-dlmopen2, tst-ptrguard1, tst-stackguard1, tst-_dl_addr_inside_object, and all of the ifunc tests to tests-internal. Don't add $(modules-names) to test-extras. * inet/Makefile: Move tst-inet6_scopeid_pton to tests-internal. Add tst-deadline to tests-static-internal. * malloc/Makefile: Move tst-mallocstate and tst-scratch_buffer to tests-internal. * misc/Makefile: Move tst-atomic and tst-atomic-long to tests-internal. * nptl/Makefile: Move tst-typesizes, tst-rwlock19, tst-sem11, tst-sem12, tst-sem13, tst-barrier5, tst-signal7, tst-tls3, tst-tls3-malloc, tst-tls5, tst-stackguard1, tst-sem11-static, tst-sem12-static, and tst-stackguard1-static to tests-internal. Link tests-internal with libpthread also. Don't add $(modules-names) to test-extras. * nss/Makefile: Move tst-field to tests-internal. * posix/Makefile: Move bug-regex5, bug-regex20, bug-regex33, tst-rfc3484, tst-rfc3484-2, and tst-rfc3484-3 to tests-internal. * stdlib/Makefile: Move tst-strtod1i, tst-strtod3, tst-strtod4, tst-strtod5i, tst-tls-atexit, and tst-tls-atexit-nodelete to tests-internal. * sunrpc/Makefile: Move tst-svc_register to tests-internal. * sysdeps/powerpc/Makefile: Move test-get_hwcap and test-get_hwcap-static to tests-internal. * sysdeps/unix/sysv/linux/Makefile: Move tst-setgetname to tests-internal. * sysdeps/x86_64/fpu/Makefile: Add all libmvec test modules to modules-names-tests. --- Makeconfig | 3 +- Makefile | 4 +- Makerules | 55 ++++++++++---- Rules | 18 ++--- benchtests/strcoll-inputs/filelist#en_US.UTF-8 | 1 - config.h.in | 11 --- elf/Makefile | 58 ++++++++------- elf/tst-env-setuid-tunables.c | 6 ++ extra-modules.mk | 9 --- include/errno.h | 2 +- include/libc-symbols.h | 62 +++++++++++----- include/math.h | 5 ++ include/stdio.h | 7 +- include/stdlib.h | 4 -- include/string.h | 10 +-- include/time.h | 4 -- include/unistd.h | 3 - include/wchar.h | 2 - inet/Makefile | 7 +- inet/tst-checks-posix.c | 1 - intl/tst-gettext2.c | 2 + malloc/Makefile | 6 +- math/test-signgam-finite-c99.c | 1 - math/test-signgam-main.c | 1 - misc/Makefile | 5 +- misc/sys/cdefs.h | 3 + nptl/Makefile | 31 ++++---- nss/Makefile | 4 +- posix/Makefile | 11 +-- stdlib/Makefile | 17 +++-- stdlib/tst-strtod.c | 64 +---------------- stdlib/tst-strtod1i.c | 83 +++++++++++++++++++++ stdlib/tst-strtod5.c | 74 +++++++++---------- stdlib/tst-strtod5i.c | 99 ++++++++++++++++++++++++++ string/test-string.h | 12 ++++ string/test-strstr.c | 1 + sunrpc/Makefile | 3 +- sysdeps/ia64/fpu/libm-symbols.h | 2 +- sysdeps/m68k/m680x0/fpu/bits/mathinline.h | 15 ++-- sysdeps/powerpc/Makefile | 2 +- sysdeps/unix/sysv/linux/Makefile | 3 +- sysdeps/x86_64/fpu/Makefile | 8 +++ sysdeps/x86_64/fpu/math-tests-arch.h | 8 +-- sysdeps/x86_64/multiarch/test-multiarch.c | 2 +- 44 files changed, 464 insertions(+), 265 deletions(-) delete mode 100644 extra-modules.mk create mode 100644 stdlib/tst-strtod1i.c create mode 100644 stdlib/tst-strtod5i.c diff --git a/Makeconfig b/Makeconfig index 1c815113b9..b494b82b40 100644 --- a/Makeconfig +++ b/Makeconfig @@ -908,7 +908,8 @@ libio-include = -I$(..)libio # List of non-library modules that we build. built-modules = iconvprogs iconvdata ldconfig lddlibc4 libmemusage \ libSegFault libpcprofile librpcsvc locale-programs \ - memusagestat nonlib nscd extramodules libnldbl libsupport + memusagestat nonlib nscd extramodules libnldbl libsupport \ + testsuite in-module = $(subst -,_,$(firstword $(libof-$(basename $(@F))) \ $(libof-$(<F)) \ diff --git a/Makefile b/Makefile index 1b896b979c..3e0ae6f43b 100644 --- a/Makefile +++ b/Makefile @@ -270,7 +270,7 @@ $(objpfx)check-local-headers.out: scripts/check-local-headers.sh ifneq "$(headers)" "" # Special test of all the installed headers in this directory. tests-special += $(objpfx)check-installed-headers-c.out -libof-check-installed-headers-c := nonlib +libof-check-installed-headers-c := testsuite $(objpfx)check-installed-headers-c.out: \ scripts/check-installed-headers.sh $(headers) $(SHELL) $(..)scripts/check-installed-headers.sh c \ @@ -280,7 +280,7 @@ $(objpfx)check-installed-headers-c.out: \ ifneq "$(CXX)" "" tests-special += $(objpfx)check-installed-headers-cxx.out -libof-check-installed-headers-cxx := nonlib +libof-check-installed-headers-cxx := testsuite $(objpfx)check-installed-headers-cxx.out: \ scripts/check-installed-headers.sh $(headers) $(SHELL) $(..)scripts/check-installed-headers.sh c++ \ diff --git a/Makerules b/Makerules index 7f0eef8096..6fb7248983 100644 --- a/Makerules +++ b/Makerules @@ -277,7 +277,7 @@ $(common-objpfx)%.h $(common-objpfx)%.h.d: $(..)scripts/gen-as-const.awk \ vpath %.sym $(sysdirs) before-compile += $(gen-as-const-headers:%.sym=$(common-objpfx)%.h) -tests += $(gen-as-const-headers:%.sym=test-as-const-%) +tests-internal += $(gen-as-const-headers:%.sym=test-as-const-%) generated += $(gen-as-const-headers:%.sym=test-as-const-%.c) $(objpfx)test-as-const-%.c: $(..)scripts/gen-as-const.awk $(..)Makerules \ %.sym $(common-objpfx)%.h @@ -793,12 +793,21 @@ endif # The makefile may define $(modules-names) to build additional modules. # These are built with $(build-module), except any in $(modules-names-nobuild). +# MODULE_NAME=extramodules, except any in $(modules-names-tests). ifdef modules-names -# extra-lib.mk is included once for each extra lib to define rules -# to build it, and to add its objects to the various variables. -# During its evaluation, $(lib) is set to the name of the library. -extra-modules-left := $(modules-names) -include $(patsubst %,$(..)extra-modules.mk,$(modules-names)) +cpp-srcs-left := $(filter-out $(modules-names-tests),$(modules-names)) +ifneq (,$(cpp-srcs-left)) +lib := extramodules +include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left)) +endif + +ifdef modules-names-tests +cpp-srcs-left := $(filter $(modules-names-tests),$(modules-names)) +ifneq (,$(cpp-srcs-left)) +lib := testsuite +include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left)) +endif +endif extra-modules-build := $(filter-out $(modules-names-nobuild),$(modules-names)) $(extra-modules-build:%=$(objpfx)%.so): $(objpfx)%.so: \ @@ -810,7 +819,7 @@ endif $(patsubst %.o,%.d,$(filter %.o,$(extra-objs:.os=.o))) \ $(patsubst %.oS,%.d,$(filter %.oS,$(extra-objs))) \ $(patsubst %.o,%.d,$(filter %.o,$(extra-test-objs:.os=.o))) \ - $(addsuffix .d,$(tests) $(xtests) $(test-srcs)) + $(addsuffix .d,$(tests) $(tests-internal) $(xtests) $(test-srcs)) ifeq ($(build-programs),yes) +depfiles += $(addsuffix .d,$(others) $(sysdep-others)) endif @@ -1323,7 +1332,17 @@ check: tests .PHONY: xcheck xcheck: xtests -all-nonlib = $(strip $(tests) $(xtests) $(test-srcs) $(test-extras) $(others)) +# The only difference between MODULE_NAME=testsuite and MODULE_NAME=nonlib is +# that almost all internal declarations from config.h, libc-symbols.h, and +# include/*.h are not available to 'testsuite' code, but are to 'nonlib' code. +all-testsuite := $(strip $(tests) $(xtests) $(test-srcs) $(test-extras)) +ifneq (,$(all-testsuite)) +cpp-srcs-left = $(all-testsuite) +lib := testsuite +include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left)) +endif + +all-nonlib := $(strip $(tests-internal) $(test-internal-extras) $(others)) ifneq (,$(all-nonlib)) cpp-srcs-left = $(all-nonlib) lib := nonlib @@ -1537,22 +1556,32 @@ clean: common-clean mostlyclean: common-mostlyclean do-tests-clean: - -rm -f $(addprefix $(objpfx),$(addsuffix .out,$(tests) $(xtests) \ + -rm -f $(addprefix $(objpfx),$(addsuffix .out,$(tests) \ + $(tests-internal) \ + $(xtests) \ $(test-srcs)) \ $(addsuffix .test-result,$(tests) \ + $(tests-internal) \ $(xtests) \ $(test-srcs))) # Remove the object files. common-mostlyclean: - -rm -f $(addprefix $(objpfx),$(tests) $(xtests) $(test-srcs) \ + -rm -f $(addprefix $(objpfx),$(tests) $(tests-internal) $(xtests) \ + $(test-srcs) \ $(others) $(sysdep-others) stubs \ - $(addsuffix .o,$(tests) $(xtests) \ - $(test-srcs) $(others) \ + $(addsuffix .o,$(tests) \ + $(tests-internal) \ + $(xtests) \ + $(test-srcs) \ + $(others) \ $(sysdep-others)) \ - $(addsuffix .out,$(tests) $(xtests) \ + $(addsuffix .out,$(tests) \ + $(tests-internal) \ + $(xtests) \ $(test-srcs)) \ $(addsuffix .test-result,$(tests) \ + $(tests-internal) \ $(xtests) \ $(test-srcs))) -rm -f $(addprefix $(objpfx),$(extra-objs) $(extra-test-objs) \ diff --git a/Rules b/Rules index 917bc969b5..168cf508d7 100644 --- a/Rules +++ b/Rules @@ -84,7 +84,7 @@ common-generated += dummy.o dummy.c ifneq "$(headers)" "" # Special test of all the installed headers in this directory. tests-special += $(objpfx)check-installed-headers-c.out -libof-check-installed-headers-c := nonlib +libof-check-installed-headers-c := testsuite $(objpfx)check-installed-headers-c.out: \ $(..)scripts/check-installed-headers.sh $(headers) $(SHELL) $(..)scripts/check-installed-headers.sh c \ @@ -94,7 +94,7 @@ $(objpfx)check-installed-headers-c.out: \ ifneq "$(CXX)" "" tests-special += $(objpfx)check-installed-headers-cxx.out -libof-check-installed-headers-cxx := nonlib +libof-check-installed-headers-cxx := testsuite $(objpfx)check-installed-headers-cxx.out: \ $(..)scripts/check-installed-headers.sh $(headers) $(SHELL) $(..)scripts/check-installed-headers.sh c++ \ @@ -129,12 +129,14 @@ endif others: $(py-const) ifeq ($(run-built-tests),no) -tests: $(addprefix $(objpfx),$(filter-out $(tests-unsupported),$(tests)) \ +tests: $(addprefix $(objpfx),$(filter-out $(tests-unsupported), \ + $(tests) $(tests-internal)) \ $(test-srcs)) $(tests-special) \ $(tests-printers-programs) xtests: tests $(xtests-special) else -tests: $(tests:%=$(objpfx)%.out) $(tests-special) $(tests-printers-out) +tests: $(tests:%=$(objpfx)%.out) $(tests-internal:%=$(objpfx)%.out) \ + $(tests-special) $(tests-printers-out) xtests: tests $(xtests:%=$(objpfx)%.out) $(xtests-special) endif @@ -143,7 +145,7 @@ xtests-special-notdir = $(patsubst $(objpfx)%, %, $(xtests-special)) ifeq ($(run-built-tests),no) tests-expected = else -tests-expected = $(tests) $(tests-printers) +tests-expected = $(tests) $(tests-internal) $(tests-printers) endif tests: $(..)scripts/merge-test-results.sh -s $(objpfx) $(subdir) \ @@ -156,7 +158,7 @@ xtests: ifeq ($(build-programs),yes) binaries-all-notests = $(others) $(sysdep-others) -binaries-all-tests = $(tests) $(xtests) $(test-srcs) +binaries-all-tests = $(tests) $(tests-internal) $(xtests) $(test-srcs) binaries-all = $(binaries-all-notests) $(binaries-all-tests) binaries-static-notests = $(others-static) binaries-static-tests = $(tests-static) $(xtests-static) @@ -170,7 +172,7 @@ binaries-pie-notests = endif else binaries-all-notests = -binaries-all-tests = $(tests) $(xtests) $(test-srcs) +binaries-all-tests = $(tests) $(tests-internal) $(xtests) $(test-srcs) binaries-all = $(binaries-all-tests) binaries-static-notests = binaries-static-tests = @@ -230,7 +232,7 @@ $(addprefix $(objpfx),$(binaries-static-tests)): %: %.o \ $(+link-static-tests) endif -ifneq "$(strip $(tests) $(xtests) $(test-srcs))" "" +ifneq "$(strip $(tests) $(tests-internal) $(xtests) $(test-srcs))" "" # These are the implicit rules for making test outputs # from the test programs and whatever input files are present. diff --git a/benchtests/strcoll-inputs/filelist#en_US.UTF-8 b/benchtests/strcoll-inputs/filelist#en_US.UTF-8 index b7b38017d8..eb23b47484 100644 --- a/benchtests/strcoll-inputs/filelist#en_US.UTF-8 +++ b/benchtests/strcoll-inputs/filelist#en_US.UTF-8 @@ -9667,7 +9667,6 @@ hr.po libc.pot ko.po ru.po -extra-modules.mk intl tst-gettext4-fr.po tstcodeset.po diff --git a/config.h.in b/config.h.in index 4ce845de51..94f6c13b19 100644 --- a/config.h.in +++ b/config.h.in @@ -1,14 +1,3 @@ -#if !defined IS_IN_build && !defined __ASSEMBLER__ && !defined _ISOMAC \ - && !defined __OPTIMIZE__ -# error "glibc cannot be compiled without optimization" -#endif - -/* Another evil option when it comes to compiling the C library is - --ffast-math since it alters the ABI. */ -#if defined __FAST_MATH__ && !defined TEST_FAST_MATH -# error "glibc must not be compiled with -ffast-math" -#endif - /* Define if building with SELinux support. Set by --with-selinux. */ #undef HAVE_SELINUX diff --git a/elf/Makefile b/elf/Makefile index cc4aeb25b6..eae247a4fc 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -142,43 +142,49 @@ $(inst_auditdir)/sotruss-lib.so: $(objpfx)sotruss-lib.so $(+force) $(do-install-program) endif -tests = tst-tls1 tst-tls2 tst-tls9 tst-leaks1 \ - tst-array1 tst-array2 tst-array3 tst-array4 tst-array5 \ - tst-auxv -tests-static = tst-tls1-static tst-tls2-static tst-stackguard1-static \ - tst-leaks1-static tst-array1-static tst-array5-static \ - tst-ptrguard1-static tst-dl-iter-static \ +tests-static-normal := tst-leaks1-static tst-array1-static tst-array5-static \ + tst-dl-iter-static \ tst-tlsalign-static tst-tlsalign-extern-static \ tst-linkall-static tst-env-setuid tst-env-setuid-tunables +tests-static-internal := tst-tls1-static tst-tls2-static \ + tst-ptrguard1-static tst-stackguard1-static + +tests := tst-tls9 tst-leaks1 \ + tst-array1 tst-array2 tst-array3 tst-array4 tst-array5 \ + tst-auxv +tests-internal := tst-tls1 tst-tls2 $(tests-static-internal) +tests-static := $(tests-static-normal) $(tests-static-internal) + ifeq (yes,$(build-shared)) tests-static += tst-tls9-static tst-tls9-static-ENV = \ LD_LIBRARY_PATH=$(objpfx):$(common-objpfx):$(common-objpfx)dlfcn -endif -tests += $(tests-static) -ifeq (yes,$(build-shared)) -tests += loadtest restest1 preloadtest loadfail multiload origtest resolvfail \ - constload1 order noload filter unload \ + +tests += restest1 preloadtest loadfail multiload origtest resolvfail \ + constload1 order noload filter \ reldep reldep2 reldep3 reldep4 nodelete nodelete2 \ - nodlopen nodlopen2 neededtest neededtest2 \ - neededtest3 neededtest4 unload2 lateglobal initfirst global \ + nodlopen nodlopen2 lateglobal initfirst global \ restest2 next dblload dblunload reldep5 reldep6 reldep7 reldep8 \ - circleload1 tst-tls3 tst-tls4 tst-tls5 tst-tls6 tst-tls7 tst-tls8 \ + tst-tls4 tst-tls5 \ tst-tls10 tst-tls11 tst-tls12 tst-tls13 tst-tls14 tst-tls15 \ tst-tls16 tst-tls17 tst-tls18 tst-tls19 tst-tls-dlinfo \ tst-align tst-align2 $(tests-execstack-$(have-z-execstack)) \ tst-dlmodcount tst-dlopenrpath tst-deep1 \ - tst-dlmopen1 tst-dlmopen2 tst-dlmopen3 \ + tst-dlmopen1 tst-dlmopen3 \ unload3 unload4 unload5 unload6 unload7 unload8 tst-global1 order2 \ tst-audit1 tst-audit2 tst-audit8 tst-audit9 \ - tst-stackguard1 tst-addr1 tst-thrlock \ + tst-addr1 tst-thrlock \ tst-unique1 tst-unique2 $(if $(CXX),tst-unique3 tst-unique4 \ tst-nodelete) \ tst-initorder tst-initorder2 tst-relsort1 tst-null-argv \ - tst-ptrguard1 tst-tlsalign tst-tlsalign-extern tst-nodelete-opened \ + tst-tlsalign tst-tlsalign-extern tst-nodelete-opened \ tst-nodelete2 tst-audit11 tst-audit12 tst-dlsym-error tst-noload \ tst-latepthread tst-tls-manydynamic tst-nodelete-dlclose # reldep9 +tests-internal += loadtest unload unload2 circleload1 \ + neededtest neededtest2 neededtest3 neededtest4 \ + tst-tls3 tst-tls6 tst-tls7 tst-tls8 tst-dlmopen2 \ + tst-ptrguard1 tst-stackguard1 ifeq ($(build-hardcoded-path-in-tests),yes) tests += tst-dlopen-aout LDFLAGS-tst-dlopen-aout = $(no-pie-ldflag) @@ -289,21 +295,23 @@ CFLAGS-vismain.c = $(PIE-ccflag) endif modules-execstack-yes = tst-execstack-mod extra-test-objs += $(addsuffix .os,$(strip $(modules-names))) -# We need this variable to be sure the test modules get the right CPPFLAGS. -test-extras += $(modules-names) # filtmod1.so has a special rule modules-names-nobuild := filtmod1 +tests += $(tests-static) + ifneq (no,$(multi-arch)) -tests-static += ifuncmain1static ifuncmain1picstatic \ +tests-ifuncstatic := ifuncmain1static ifuncmain1picstatic \ ifuncmain2static ifuncmain2picstatic \ ifuncmain4static ifuncmain4picstatic \ ifuncmain5static ifuncmain5picstatic \ ifuncmain7static ifuncmain7picstatic - +tests-static += $(tests-ifuncstatic) +tests-internal += $(tests-ifuncstatic) ifeq (yes,$(build-shared)) -tests += ifuncmain1 ifuncmain1pic ifuncmain1vis ifuncmain1vispic \ +tests-internal += \ + ifuncmain1 ifuncmain1pic ifuncmain1vis ifuncmain1vispic \ ifuncmain1staticpic \ ifuncmain2 ifuncmain2pic ifuncmain3 ifuncmain4 \ ifuncmain5 ifuncmain5pic ifuncmain5staticpic \ @@ -311,11 +319,11 @@ tests += ifuncmain1 ifuncmain1pic ifuncmain1vis ifuncmain1vispic \ ifunc-test-modules = ifuncdep1 ifuncdep1pic ifuncdep2 ifuncdep2pic \ ifuncdep5 ifuncdep5pic extra-test-objs += $(ifunc-test-modules:=.o) -test-extras += $(ifunc-test-modules) +test-internal-extras += $(ifunc-test-modules) ifeq (yes,$(have-fpie)) ifunc-pie-tests = ifuncmain1pie ifuncmain1vispie ifuncmain1staticpie \ ifuncmain5pie ifuncmain6pie ifuncmain7pie -tests += $(ifunc-pie-tests) +tests-internal += $(ifunc-pie-tests) tests-pie += $(ifunc-pie-tests) endif modules-names += ifuncmod1 ifuncmod3 ifuncmod5 ifuncmod6 @@ -357,7 +365,7 @@ endif # unit test driver must be able to link with the shared object # that is going to eventually go into an installed DSO. ifeq (yesyes,$(have-fpie)$(build-shared)) -tests += tst-_dl_addr_inside_object +tests-internal += tst-_dl_addr_inside_object tests-pie += tst-_dl_addr_inside_object $(objpfx)tst-_dl_addr_inside_object: $(objpfx)dl-addr-obj.os CFLAGS-tst-_dl_addr_inside_object.c += $(PIE-ccflag) diff --git a/elf/tst-env-setuid-tunables.c b/elf/tst-env-setuid-tunables.c index a5f0a81ef3..afcb146e6d 100644 --- a/elf/tst-env-setuid-tunables.c +++ b/elf/tst-env-setuid-tunables.c @@ -19,6 +19,12 @@ glibc.malloc.check and glibc.malloc.mmap_threshold but also retain glibc.malloc.mmap_threshold in an unprivileged child. */ +/* This is compiled as part of the testsuite but needs to see + HAVE_TUNABLES. */ +#define _LIBC 1 +#include "config.h" +#undef _LIBC + #define test_parent test_parent_tunables #define test_child test_child_tunables diff --git a/extra-modules.mk b/extra-modules.mk deleted file mode 100644 index 5f8e693b15..0000000000 --- a/extra-modules.mk +++ /dev/null @@ -1,9 +0,0 @@ -# This file is included several times in a row, once -# for each element of $(modules-names). $(extra-modules-left) -# is initialized first to $(modules-names) so that with each -# inclusion, we advance $(module) to the next name. - -module := $(firstword $(extra-modules-left)) -extra-modules-left := $(filter-out $(module),$(extra-modules-left)) - -libof-$(notdir $(module)) := extramodules diff --git a/include/errno.h b/include/errno.h index 7df41dfc31..73fc32e5e0 100644 --- a/include/errno.h +++ b/include/errno.h @@ -2,7 +2,7 @@ #include <stdlib/errno.h> -#if defined _ERRNO_H && !defined _ISOMAC && !defined __cplusplus +#if defined _ERRNO_H && !defined _ISOMAC # if IS_IN (rtld) # include <dl-sysdep.h> diff --git a/include/libc-symbols.h b/include/libc-symbols.h index 0783ade0b3..f6c9a9db0c 100644 --- a/include/libc-symbols.h +++ b/include/libc-symbols.h @@ -20,26 +20,46 @@ #ifndef _LIBC_SYMBOLS_H #define _LIBC_SYMBOLS_H 1 -#define IN_MODULE PASTE_NAME (MODULE_, MODULE_NAME) -#define IS_IN(lib) (IN_MODULE == MODULE_##lib) +/* This file is included implicitly in the compilation of every source file, + using -include. It includes config.h. */ -/* Returns true if the current module is a versioned library. Versioned - library names culled from shlib-versions files are assigned a MODULE_* - value lower than MODULE_LIBS_BEGIN. */ -#define IS_IN_LIB (IN_MODULE > MODULE_LIBS_BEGIN) +/* Enable declarations of GNU extensions, since we are compiling them. */ +#define _GNU_SOURCE 1 -#define PASTE_NAME(a,b) PASTE_NAME1 (a,b) -#define PASTE_NAME1(a,b) a##b +#ifdef MODULE_NAME -/* This file's macros are included implicitly in the compilation of every - file in the C library by -imacros. +/* Use `#if IS_IN (module)` to detect what component is being compiled. */ +#define PASTE_NAME1(a,b) a##b +#define PASTE_NAME(a,b) PASTE_NAME1 (a,b) +#define IN_MODULE PASTE_NAME (MODULE_, MODULE_NAME) +#define IS_IN(lib) (IN_MODULE == MODULE_##lib) - We include config.h which is generated by configure. - It should define for us the following symbol: +/* True if the current module is a versioned library. Versioned + library names culled from shlib-versions files are assigned a + MODULE_* value greater than MODULE_LIBS_BEGIN. */ +#define IS_IN_LIB (IN_MODULE > MODULE_LIBS_BEGIN) - * HAVE_ASM_SET_DIRECTIVE if we have `.set B, A' instead of `A = B'. +/* The testsuite, and some other ancillary code, should be compiled against + as close an approximation to the installed headers as possible. + Defining this symbol disables most internal-use-only declarations + provided by this header, and all those provided by other internal + wrapper headers. */ +#if IS_IN (testsuite) || defined IS_IN_build || defined __cplusplus +# define _ISOMAC 1 +#endif - */ +#else +/* The generation process for a few files created very early in the + build (notably libc-modules.h itself) involves preprocessing this + header without defining MODULE_NAME. Under these conditions, + internal declarations (especially from config.h) must be visible, + but IS_IN should always evaluate as false. */ +# define IS_IN(lib) 0 +# define IS_IN_LIB 0 +# define IN_MODULE (-1) +#endif + +#ifndef _ISOMAC /* This is defined for the compilation of all C library code. features.h tests this to avoid inclusion of stubs.h while compiling the library, @@ -50,8 +70,17 @@ itself is being compiled, or just some generator program. */ #define _LIBC 1 -/* Enable declarations of GNU extensions, since we are compiling them. */ -#define _GNU_SOURCE 1 +/* Some files must be compiled with optimization on. */ +#if !defined __ASSEMBLER__ && !defined __OPTIMIZE__ +# error "glibc cannot be compiled without optimization" +#endif + +/* -ffast-math cannot be applied to the C library, as it alters the ABI. + Some test components that use -ffast-math are currently not part of + IS_IN (testsuite) for technical reasons, so we have a secondary override. */ +#if defined __FAST_MATH__ && !defined TEST_FAST_MATH +# error "glibc must not be compiled with -ffast-math" +#endif #include <config.h> @@ -893,4 +922,5 @@ for linking") # define inhibit_loop_to_libcall #endif +#endif /* !_ISOMAC */ #endif /* libc-symbols.h */ diff --git a/include/math.h b/include/math.h index a4f556263a..6ff67830f8 100644 --- a/include/math.h +++ b/include/math.h @@ -1,5 +1,10 @@ #ifndef _MATH_H +#ifdef _ISOMAC +# undef NO_LONG_DOUBLE +# undef _Mlong_double_ +#endif + #include <math/math.h> #ifndef _ISOMAC diff --git a/include/stdio.h b/include/stdio.h index 17b5a05076..ad0d0f0027 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -1,11 +1,10 @@ #ifndef _STDIO_H -# if defined __need_FILE || defined __need___FILE || defined _ISOMAC +# if defined _ISOMAC || defined __need_FILE || defined __need___FILE # include <libio/stdio.h> # else # include <libio/stdio.h> /* Now define the internal interfaces. */ -__BEGIN_DECLS extern int __fcloseall (void); extern int __snprintf (char *__restrict __s, size_t __maxlen, @@ -30,7 +29,6 @@ extern int __vsscanf (const char *__restrict __s, _G_va_list __arg) __attribute__ ((__format__ (__scanf__, 2, 0))); -# ifndef __cplusplus extern int __sprintf_chk (char *, int, size_t, const char *, ...) __THROW; extern int __snprintf_chk (char *, size_t, int, size_t, const char *, ...) __THROW; @@ -52,7 +50,6 @@ extern int __obstack_printf_chk (struct obstack *, int, const char *, ...) __THROW; extern int __obstack_vprintf_chk (struct obstack *, int, const char *, _G_va_list) __THROW; -# endif extern int __isoc99_fscanf (FILE *__restrict __stream, const char *__restrict __format, ...) __wur; @@ -184,7 +181,5 @@ libc_hidden_proto (__obstack_vprintf_chk) extern FILE * __fmemopen (void *buf, size_t len, const char *mode); libc_hidden_proto (__fmemopen) -__END_DECLS # endif - #endif diff --git a/include/stdlib.h b/include/stdlib.h index 929cead59a..c3ee680bd6 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -9,8 +9,6 @@ #if !defined _ISOMAC # include <sys/stat.h> -__BEGIN_DECLS - extern __typeof (strtol_l) __strtol_l; extern __typeof (strtoul_l) __strtoul_l; extern __typeof (strtoll_l) __strtoll_l; @@ -261,8 +259,6 @@ extern __typeof (unsetenv) unsetenv attribute_hidden; extern __typeof (__strtoul_internal) __strtoul_internal attribute_hidden; # endif -__END_DECLS - #endif #endif /* include/stdlib.h */ diff --git a/include/string.h b/include/string.h index f166de9c43..ce71674086 100644 --- a/include/string.h +++ b/include/string.h @@ -1,6 +1,8 @@ #ifndef _STRING_H -#if !defined _ISOMAC && !defined __cplusplus +#ifndef _ISOMAC +/* Some of these are defined as macros in the real string.h, so we must + prototype them before including it. */ #include <sys/types.h> extern void *__memccpy (void *__dest, const void *__src, @@ -46,16 +48,14 @@ extern void __bzero (void *__s, size_t __n) __THROW __nonnull ((1)); extern int __ffs (int __i) __attribute__ ((const)); extern char *__strerror_r (int __errnum, char *__buf, size_t __buflen); -#endif /* Get _STRING_ARCH_unaligned. */ #include <string_private.h> +#endif -/* Now the real definitions. We do this here since some of the functions - above are defined as macros in the headers. */ #include <string/string.h> -#if !defined _ISOMAC && !defined __cplusplus +#ifndef _ISOMAC extern __typeof (strcoll_l) __strcoll_l; extern __typeof (strxfrm_l) __strxfrm_l; extern __typeof (strcasecmp_l) __strcasecmp_l; diff --git a/include/time.h b/include/time.h index 6badf0e557..3a828e0420 100644 --- a/include/time.h +++ b/include/time.h @@ -4,8 +4,6 @@ #ifndef _ISOMAC # include <xlocale.h> -__BEGIN_DECLS - extern __typeof (strftime_l) __strftime_l; libc_hidden_proto (__strftime_l) extern __typeof (strptime_l) __strptime_l; @@ -104,7 +102,5 @@ extern double __difftime (time_t time1, time_t time0); actual clock ID. */ #define CLOCK_IDFIELD_SIZE 3 -__END_DECLS - #endif #endif diff --git a/include/unistd.h b/include/unistd.h index 16d68a1505..fbcea1b92d 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -2,7 +2,6 @@ # include <posix/unistd.h> # ifndef _ISOMAC -__BEGIN_DECLS libc_hidden_proto (_exit, __noreturn__) rtld_hidden_proto (_exit, __noreturn__) @@ -188,7 +187,5 @@ extern int __getlogin_r_loginuid (char *name, size_t namesize) extern __typeof (__access) __access_noerrno attribute_hidden; # endif -__END_DECLS # endif - #endif diff --git a/include/wchar.h b/include/wchar.h index 6272130e24..e2579a176a 100644 --- a/include/wchar.h +++ b/include/wchar.h @@ -172,7 +172,6 @@ extern int __vfwprintf (__FILE *__restrict __s, const wchar_t *__restrict __format, __gnuc_va_list __arg) /* __attribute__ ((__format__ (__wprintf__, 2, 0))) */; -#ifndef __cplusplus extern int __vfwprintf_chk (FILE *__restrict __s, int __flag, const wchar_t *__restrict __format, __gnuc_va_list __arg) @@ -184,7 +183,6 @@ extern int __vswprintf_chk (wchar_t *__restrict __s, size_t __n, /* __attribute__ ((__format__ (__wprintf__, 5, 0))) */; libc_hidden_proto (__vfwprintf_chk) libc_hidden_proto (__vswprintf_chk) -#endif extern int __isoc99_fwscanf (__FILE *__restrict __stream, const wchar_t *__restrict __format, ...); diff --git a/inet/Makefile b/inet/Makefile index 6a7d3e0664..38c61bdc61 100644 --- a/inet/Makefile +++ b/inet/Makefile @@ -52,11 +52,16 @@ aux := check_pf check_native ifreq tests := htontest test_ifindex tst-ntoa tst-ether_aton tst-network \ tst-gethnm test-ifaddrs bug-if1 test-inet6_opt tst-ether_line \ tst-getni1 tst-getni2 tst-inet6_rth tst-checks tst-checks-posix \ - tst-sockaddr tst-inet6_scopeid_pton test-hnto-types tst-deadline + tst-sockaddr test-hnto-types # tst-deadline must be linked statically so that we can access # internal functions. tests-static += tst-deadline +tests-static-internal := tst-deadline + +# tst-inet6_scopeid_pton also needs internal functions but does not +# need to be linked statically. +tests-internal := tst-inet6_scopeid_pton include ../Rules diff --git a/inet/tst-checks-posix.c b/inet/tst-checks-posix.c index e46b6a2a69..cdcb5cb3aa 100644 --- a/inet/tst-checks-posix.c +++ b/inet/tst-checks-posix.c @@ -19,6 +19,5 @@ /* Process tst-checks.c in POSIX mode. */ #undef _GNU_SOURCE #define _POSIX_C_SOURCE 200112L -#define _ISOMAC #include "tst-checks.c" diff --git a/intl/tst-gettext2.c b/intl/tst-gettext2.c index bdfe76de66..894e09e41e 100644 --- a/intl/tst-gettext2.c +++ b/intl/tst-gettext2.c @@ -24,6 +24,8 @@ #include <stdlib.h> #include <stdio.h> +#define N_(msgid) msgid + struct data_t { const char *selection; diff --git a/malloc/Makefile b/malloc/Makefile index e93b83b57d..ca83228b1c 100644 --- a/malloc/Makefile +++ b/malloc/Makefile @@ -25,9 +25,9 @@ include ../Makeconfig dist-headers := malloc.h headers := $(dist-headers) obstack.h mcheck.h tests := mallocbug tst-malloc tst-valloc tst-calloc tst-obstack \ - tst-mallocstate tst-mcheck tst-mallocfork tst-trim1 \ + tst-mcheck tst-mallocfork tst-trim1 \ tst-malloc-usable tst-realloc tst-posix_memalign \ - tst-pvalloc tst-memalign tst-mallopt tst-scratch_buffer \ + tst-pvalloc tst-memalign tst-mallopt \ tst-malloc-backtrace tst-malloc-thread-exit \ tst-malloc-thread-fail tst-malloc-fork-deadlock \ tst-mallocfork2 \ @@ -39,6 +39,8 @@ tests-static := \ tst-interpose-static-thread \ tst-malloc-usable-static \ +tests-internal := tst-mallocstate tst-scratch_buffer + ifneq (no,$(have-tunables)) tests += tst-malloc-usable-tunables tests-static += tst-malloc-usable-static-tunables diff --git a/math/test-signgam-finite-c99.c b/math/test-signgam-finite-c99.c index a67a803c99..3dacef5147 100644 --- a/math/test-signgam-finite-c99.c +++ b/math/test-signgam-finite-c99.c @@ -20,7 +20,6 @@ #undef __LIBC_INTERNAL_MATH_INLINES #undef _GNU_SOURCE #undef _Mlong_double_ -#define _ISOMAC #include <math.h> #include <stdio.h> diff --git a/math/test-signgam-main.c b/math/test-signgam-main.c index 11ebbe3628..e3cecf7fa1 100644 --- a/math/test-signgam-main.c +++ b/math/test-signgam-main.c @@ -19,7 +19,6 @@ #undef _LIBC #undef __LIBC_INTERNAL_MATH_INLINES #undef _GNU_SOURCE -#define _ISOMAC #include <math.h> #include <stdio.h> diff --git a/misc/Makefile b/misc/Makefile index ed988c3967..bd88253c26 100644 --- a/misc/Makefile +++ b/misc/Makefile @@ -79,8 +79,9 @@ gpl2lgpl := error.c error.h tests := tst-dirname tst-tsearch tst-fdset tst-efgcvt tst-mntent tst-hsearch \ tst-error1 tst-pselect tst-insremque tst-mntent2 bug-hsearch1 \ tst-mntent-blank-corrupt tst-mntent-blank-passno bug18240 \ - tst-preadvwritev tst-preadvwritev64 tst-makedev tst-empty \ - tst-atomic tst-atomic-long + tst-preadvwritev tst-preadvwritev64 tst-makedev tst-empty + +tests-internal := tst-atomic tst-atomic-long tests-static := tst-empty ifeq ($(run-built-tests),yes) diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h index b03ebda22f..74f9a49b05 100644 --- a/misc/sys/cdefs.h +++ b/misc/sys/cdefs.h @@ -55,15 +55,18 @@ # define __THROW __attribute__ ((__nothrow__ __LEAF)) # define __THROWNL __attribute__ ((__nothrow__)) # define __NTH(fct) __attribute__ ((__nothrow__ __LEAF)) fct +# define __NTHNL(fct) __attribute__ ((__nothrow__)) fct # else # if defined __cplusplus && __GNUC_PREREQ (2,8) # define __THROW throw () # define __THROWNL throw () # define __NTH(fct) __LEAF_ATTR fct throw () +# define __NTHNL(fct) fct throw () # else # define __THROW # define __THROWNL # define __NTH(fct) fct +# define __NTHNL(fct) fct # endif # endif diff --git a/nptl/Makefile b/nptl/Makefile index 6d48c0cfc8..edffb66272 100644 --- a/nptl/Makefile +++ b/nptl/Makefile @@ -220,8 +220,7 @@ LDLIBS-tst-once5 = -lstdc++ CFLAGS-tst-thread_local1.o = -std=gnu++11 LDLIBS-tst-thread_local1 = -lstdc++ -tests = tst-typesizes \ - tst-attr1 tst-attr2 tst-attr3 tst-default-attr \ +tests = tst-attr1 tst-attr2 tst-attr3 tst-default-attr \ tst-mutex1 tst-mutex2 tst-mutex3 tst-mutex4 tst-mutex5 tst-mutex6 \ tst-mutex7 tst-mutex8 tst-mutex9 tst-mutex5a tst-mutex7a \ tst-mutexpi1 tst-mutexpi2 tst-mutexpi3 tst-mutexpi4 tst-mutexpi5 \ @@ -241,13 +240,12 @@ tests = tst-typesizes \ tst-rwlock4 tst-rwlock5 tst-rwlock6 tst-rwlock7 tst-rwlock8 \ tst-rwlock9 tst-rwlock10 tst-rwlock11 tst-rwlock12 tst-rwlock13 \ tst-rwlock14 tst-rwlock15 tst-rwlock16 tst-rwlock17 tst-rwlock18 \ - tst-rwlock19 \ tst-once1 tst-once2 tst-once3 tst-once4 tst-once5 \ tst-key1 tst-key2 tst-key3 tst-key4 \ tst-sem1 tst-sem2 tst-sem3 tst-sem4 tst-sem5 tst-sem6 tst-sem7 \ - tst-sem8 tst-sem9 tst-sem10 tst-sem11 tst-sem12 tst-sem13 tst-sem14 \ + tst-sem8 tst-sem9 tst-sem10 tst-sem14 \ tst-sem15 tst-sem16 \ - tst-barrier1 tst-barrier2 tst-barrier3 tst-barrier4 tst-barrier5 \ + tst-barrier1 tst-barrier2 tst-barrier3 tst-barrier4 \ tst-align tst-align3 \ tst-basic1 tst-basic2 tst-basic3 tst-basic4 tst-basic5 tst-basic6 \ tst-basic7 \ @@ -272,7 +270,7 @@ tests = tst-typesizes \ tst-cleanup0 tst-cleanup1 tst-cleanup2 tst-cleanup3 tst-cleanup4 \ tst-flock1 tst-flock2 \ tst-signal1 tst-signal2 tst-signal3 tst-signal4 tst-signal5 \ - tst-signal6 tst-signal7 \ + tst-signal6 \ tst-exec1 tst-exec2 tst-exec3 tst-exec4 tst-exec5 \ tst-exit1 tst-exit2 tst-exit3 \ tst-stdio1 tst-stdio2 \ @@ -297,6 +295,10 @@ tests = tst-typesizes \ tst-bad-schedattr \ tst-thread_local1 tst-mutex-errorcheck tst-robust10 \ tst-robust-fork tst-create-detached + +tests-internal := tst-typesizes tst-rwlock19 tst-sem11 tst-sem12 tst-sem13 \ + tst-barrier5 tst-signal7 + xtests = tst-setuid1 tst-setuid1-static tst-setuid2 \ tst-mutexpp1 tst-mutexpp6 tst-mutexpp10 test-srcs = tst-oddstacklimit @@ -354,8 +356,8 @@ tests += tst-cancelx2 tst-cancelx3 tst-cancelx4 tst-cancelx5 \ tst-cleanupx0 tst-cleanupx1 tst-cleanupx2 tst-cleanupx3 tst-cleanupx4 \ tst-oncex3 tst-oncex4 ifeq ($(build-shared),yes) -tests += tst-atfork2 tst-tls3 tst-tls3-malloc tst-tls4 tst-tls5 tst-_res1 \ - tst-fini1 tst-stackguard1 +tests += tst-atfork2 tst-tls4 tst-_res1 tst-fini1 +tests-internal += tst-tls3 tst-tls3-malloc tst-tls5 tst-stackguard1 tests-nolibpthread += tst-fini1 ifeq ($(have-z-execstack),yes) tests += tst-execstack @@ -369,7 +371,7 @@ modules-names = tst-atfork2mod tst-tls3mod tst-tls4moda tst-tls4modb \ tst-join7mod extra-test-objs += $(addsuffix .os,$(strip $(modules-names))) \ tst-cleanup4aux.o tst-cleanupx4aux.o -test-extras += $(modules-names) tst-cleanup4aux tst-cleanupx4aux +test-extras += tst-cleanup4aux tst-cleanupx4aux test-modules = $(addprefix $(objpfx),$(addsuffix .so,$(modules-names))) tst-atfork2mod.so-no-z-defs = yes @@ -422,9 +424,9 @@ tests-static += tst-locale1 tst-locale2 tst-stackguard1-static \ tst-cancel21-static tst-cancel24-static tst-cond8-static \ tst-mutex8-static tst-mutexpi8-static tst-sem11-static \ tst-sem12-static -tests += tst-stackguard1-static tst-cancel21-static tst-cancel24-static \ - tst-cond8-static tst-mutex8-static tst-mutexpi8-static \ - tst-sem11-static tst-sem12-static +tests += tst-cancel21-static tst-cancel24-static \ + tst-cond8-static tst-mutex8-static tst-mutexpi8-static +tests-internal += tst-sem11-static tst-sem12-static tst-stackguard1-static xtests-static += tst-setuid1-static # These tests are linked with libc before libpthread @@ -619,8 +621,9 @@ ifeq ($(build-shared),yes) $(addprefix $(objpfx), \ $(filter-out $(tests-static) $(xtests-static) $(tests-reverse) \ $(tests-nolibpthread), \ - $(tests) $(xtests) $(test-srcs))): $(objpfx)libpthread.so \ - $(objpfx)libpthread_nonshared.a + $(tests) $(tests-internal) $(xtests) $(test-srcs))): \ + $(objpfx)libpthread.so \ + $(objpfx)libpthread_nonshared.a $(objpfx)tst-unload: $(libdl) # $(objpfx)../libc.so is used instead of $(common-objpfx)libc.so, # since otherwise libpthread.so comes before libc.so when linking. diff --git a/nss/Makefile b/nss/Makefile index de6c47a1db..691c0c1bb2 100644 --- a/nss/Makefile +++ b/nss/Makefile @@ -49,9 +49,9 @@ makedb-modules = xmalloc hash-string extra-objs += $(makedb-modules:=.o) tests-static = tst-field +tests-internal = tst-field tests = test-netdb tst-nss-test1 test-digits-dots \ - tst-nss-getpwent bug17079 \ - $(tests-static) + tst-nss-getpwent bug17079 xtests = bug-erange # If we have a thread library then we can test cancellation against diff --git a/posix/Makefile b/posix/Makefile index ae17646323..73df8af152 100644 --- a/posix/Makefile +++ b/posix/Makefile @@ -67,24 +67,23 @@ tests := test-errno tstgetopt testfnm runtests runptests \ tst-mmap tst-mmap-offset tst-getaddrinfo tst-truncate \ tst-truncate64 tst-fork tst-fnmatch tst-regexloc tst-dir \ tst-chmod bug-regex1 bug-regex2 bug-regex3 bug-regex4 \ - tst-gnuglob tst-regex bug-regex5 bug-regex6 bug-regex7 \ + tst-gnuglob tst-regex bug-regex6 bug-regex7 \ bug-regex8 bug-regex9 bug-regex10 bug-regex11 bug-regex12 \ bug-regex13 bug-regex14 bug-regex15 bug-regex16 \ - bug-regex17 bug-regex18 bug-regex19 bug-regex20 \ + bug-regex17 bug-regex18 bug-regex19 \ bug-regex21 bug-regex22 bug-regex23 bug-regex24 \ bug-regex25 bug-regex26 bug-regex27 bug-regex28 \ bug-regex29 bug-regex30 bug-regex31 bug-regex32 \ - bug-regex33 tst-nice tst-nanosleep tst-regex2 \ + tst-nice tst-nanosleep tst-regex2 \ transbug tst-rxspencer tst-pcre tst-boost \ bug-ga1 tst-vfork1 tst-vfork2 tst-vfork3 tst-waitid \ tst-getaddrinfo2 bug-glob1 bug-glob2 bug-glob3 tst-sysconf \ tst-execvp1 tst-execvp2 tst-execlp1 tst-execlp2 \ tst-execv1 tst-execv2 tst-execl1 tst-execl2 \ tst-execve1 tst-execve2 tst-execle1 tst-execle2 \ - tst-execvp3 tst-execvp4 tst-rfc3484 tst-rfc3484-2 \ + tst-execvp3 tst-execvp4 \ tst-execvpe1 tst-execvpe2 tst-execvpe3 tst-execvpe4 \ tst-execvpe5 tst-execvpe6 \ - tst-rfc3484-3 \ tst-getaddrinfo3 tst-fnmatch2 tst-cpucount tst-cpuset \ bug-getopt1 bug-getopt2 bug-getopt3 bug-getopt4 \ bug-getopt5 tst-getopt_long1 bug-regex34 bug-regex35 \ @@ -92,6 +91,8 @@ tests := test-errno tstgetopt testfnm runtests runptests \ tst-fnmatch3 bug-regex36 tst-getaddrinfo5 \ tst-posix_spawn-fd \ tst-posix_fadvise tst-posix_fadvise64 +tests-internal := bug-regex5 bug-regex20 bug-regex33 \ + tst-rfc3484 tst-rfc3484-2 tst-rfc3484-3 xtests := bug-ga2 ifeq (yes,$(build-shared)) test-srcs := globtest diff --git a/stdlib/Makefile b/stdlib/Makefile index 5751b5d600..d4edcf8eef 100644 --- a/stdlib/Makefile +++ b/stdlib/Makefile @@ -68,23 +68,26 @@ test-srcs := tst-fmtmsg tests := tst-strtol tst-strtod testmb testrand testsort testdiv \ test-canon test-canon2 tst-strtoll tst-environ \ tst-xpg-basename tst-random tst-random2 tst-bsearch \ - tst-limits tst-rand48 bug-strtod tst-setcontext \ + tst-limits tst-rand48 bug-strtod tst-setcontext \ tst-setcontext2 test-a64l tst-qsort tst-system testmb2 \ - bug-strtod2 tst-atof1 tst-atof2 tst-strtod2 tst-strtod3 \ - tst-rand48-2 tst-makecontext tst-strtod4 tst-strtod5 \ + bug-strtod2 tst-atof1 tst-atof2 tst-strtod2 \ + tst-rand48-2 tst-makecontext tst-strtod5 \ tst-qsort2 tst-makecontext2 tst-strtod6 tst-unsetenv1 \ tst-makecontext3 bug-getcontext bug-fmtmsg1 \ tst-secure-getenv tst-strtod-overflow tst-strtod-round \ - tst-tininess tst-strtod-underflow tst-tls-atexit \ - tst-setcontext3 tst-tls-atexit-nodelete \ + tst-tininess tst-strtod-underflow tst-setcontext3 \ tst-strtol-locale tst-strtod-nan-locale tst-strfmon_l \ tst-quick_exit tst-thread-quick_exit tst-width \ - tst-width-stdint tst-strfrom tst-strfrom-locale \ + tst-width-stdint tst-strfrom tst-strfrom-locale \ tst-getrandom +tests-internal := tst-strtod1i tst-strtod3 tst-strtod4 tst-strtod5i \ + tst-tls-atexit tst-tls-atexit-nodelete +tests-static := tst-secure-getenv + ifeq ($(build-hardcoded-path-in-tests),yes) tests += tst-empty-env endif -tests-static := tst-secure-getenv + ifeq ($(have-cxx-thread_local),yes) CFLAGS-tst-quick_exit.o = -std=c++11 LDLIBS-tst-quick_exit = -lstdc++ diff --git a/stdlib/tst-strtod.c b/stdlib/tst-strtod.c index ced6d8a351..aa7e3aed1b 100644 --- a/stdlib/tst-strtod.c +++ b/stdlib/tst-strtod.c @@ -79,7 +79,6 @@ static const struct ltest tests[] = static void expand (char *dst, int c); static int long_dbl (void); -static int locale_test (void); static int do_test (void) @@ -176,8 +175,6 @@ do_test (void) status |= long_dbl (); - status |= locale_test (); - return status ? EXIT_FAILURE : EXIT_SUCCESS; } @@ -217,63 +214,4 @@ long_dbl (void) return 0; } -/* Perform a few tests in a locale with thousands separators. */ -static int -locale_test (void) -{ - static const struct - { - const char *loc; - const char *str; - double exp; - ptrdiff_t nread; - } tests[] = - { - { "de_DE.UTF-8", "1,5", 1.5, 3 }, - { "de_DE.UTF-8", "1.5", 1.0, 1 }, - { "de_DE.UTF-8", "1.500", 1500.0, 5 }, - { "de_DE.UTF-8", "36.893.488.147.419.103.232", 0x1.0p65, 26 } - }; -#define ntests (sizeof (tests) / sizeof (tests[0])) - size_t n; - int result = 0; - - puts ("\nLocale tests"); - - for (n = 0; n < ntests; ++n) - { - double d; - char *endp; - - if (setlocale (LC_ALL, tests[n].loc) == NULL) - { - printf ("cannot set locale %s\n", tests[n].loc); - result = 1; - continue; - } - - /* We call __strtod_interal here instead of strtod to tests the - handling of grouping. */ - d = __strtod_internal (tests[n].str, &endp, 1); - if (d != tests[n].exp) - { - printf ("strtod(\"%s\") returns %g and not %g\n", - tests[n].str, d, tests[n].exp); - result = 1; - } - else if (endp - tests[n].str != tests[n].nread) - { - printf ("strtod(\"%s\") read %td bytes and not %td\n", - tests[n].str, endp - tests[n].str, tests[n].nread); - result = 1; - } - } - - if (result == 0) - puts ("all OK"); - - return result; -} - -#define TEST_FUNCTION do_test () -#include "../test-skeleton.c" +#include <support/test-driver.c> diff --git a/stdlib/tst-strtod1i.c b/stdlib/tst-strtod1i.c new file mode 100644 index 0000000000..d8a952f606 --- /dev/null +++ b/stdlib/tst-strtod1i.c @@ -0,0 +1,83 @@ +/* Copyright (C) 1991-2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <ctype.h> +#include <locale.h> +#include <stddef.h> +#include <stdio.h> +#include <stdlib.h> +#include <errno.h> +#include <string.h> +#include <math.h> + +/* Perform a few tests in a locale with thousands separators. */ +static int +do_test (void) +{ + static const struct + { + const char *loc; + const char *str; + double exp; + ptrdiff_t nread; + } tests[] = + { + { "de_DE.UTF-8", "1,5", 1.5, 3 }, + { "de_DE.UTF-8", "1.5", 1.0, 1 }, + { "de_DE.UTF-8", "1.500", 1500.0, 5 }, + { "de_DE.UTF-8", "36.893.488.147.419.103.232", 0x1.0p65, 26 } + }; +#define ntests (sizeof (tests) / sizeof (tests[0])) + size_t n; + int result = 0; + + puts ("\nLocale tests"); + + for (n = 0; n < ntests; ++n) + { + double d; + char *endp; + + if (setlocale (LC_ALL, tests[n].loc) == NULL) + { + printf ("cannot set locale %s\n", tests[n].loc); + result = 1; + continue; + } + + d = __strtod_internal (tests[n].str, &endp, 1); + if (d != tests[n].exp) + { + printf ("strtod(\"%s\") returns %g and not %g\n", + tests[n].str, d, tests[n].exp); + result = 1; + } + else if (endp - tests[n].str != tests[n].nread) + { + printf ("strtod(\"%s\") read %td bytes and not %td\n", + tests[n].str, endp - tests[n].str, tests[n].nread); + result = 1; + } + } + + if (result == 0) + puts ("all OK"); + + return result ? EXIT_FAILURE : EXIT_SUCCESS; +} + +#include <support/test-driver.c> diff --git a/stdlib/tst-strtod5.c b/stdlib/tst-strtod5.c index 337c746989..d53b17c51a 100644 --- a/stdlib/tst-strtod5.c +++ b/stdlib/tst-strtod5.c @@ -1,3 +1,20 @@ +/* Copyright (C) 2007-2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + #include <locale.h> #include <stdio.h> #include <stdlib.h> @@ -9,38 +26,27 @@ static const struct { const char *in; - int group; double expected; } tests[] = { - { "0", 0, 0.0 }, - { "000", 0, 0.0 }, - { "-0", 0, -0.0 }, - { "-000", 0, -0.0 }, - { "0,", 0, 0.0 }, - { "-0,", 0, -0.0 }, - { "0,0", 0, 0.0 }, - { "-0,0", 0, -0.0 }, - { "0e-10", 0, 0.0 }, - { "-0e-10", 0, -0.0 }, - { "0,e-10", 0, 0.0 }, - { "-0,e-10", 0, -0.0 }, - { "0,0e-10", 0, 0.0 }, - { "-0,0e-10", 0, -0.0 }, - { "0e-1000000", 0, 0.0 }, - { "-0e-1000000", 0, -0.0 }, - { "0,0e-1000000", 0, 0.0 }, - { "-0,0e-1000000", 0, -0.0 }, - { "0", 1, 0.0 }, - { "000", 1, 0.0 }, - { "-0", 1, -0.0 }, - { "-000", 1, -0.0 }, - { "0e-10", 1, 0.0 }, - { "-0e-10", 1, -0.0 }, - { "0e-1000000", 1, 0.0 }, - { "-0e-1000000", 1, -0.0 }, - { "000"NBSP"000"NBSP"000", 1, 0.0 }, - { "-000"NBSP"000"NBSP"000", 1, -0.0 } + { "0", 0.0 }, + { "000", 0.0 }, + { "-0", -0.0 }, + { "-000", -0.0 }, + { "0,", 0.0 }, + { "-0,", -0.0 }, + { "0,0", 0.0 }, + { "-0,0", -0.0 }, + { "0e-10", 0.0 }, + { "-0e-10", -0.0 }, + { "0,e-10", 0.0 }, + { "-0,e-10", -0.0 }, + { "0,0e-10", 0.0 }, + { "-0,0e-10", -0.0 }, + { "0e-1000000", 0.0 }, + { "-0e-1000000", -0.0 }, + { "0,0e-1000000", 0.0 }, + { "-0,0e-1000000", -0.0 }, }; #define NTESTS (sizeof (tests) / sizeof (tests[0])) @@ -59,12 +65,7 @@ do_test (void) for (int i = 0; i < NTESTS; ++i) { char *ep; - double r; - - if (tests[i].group) - r = __strtod_internal (tests[i].in, &ep, 1); - else - r = strtod (tests[i].in, &ep); + double r = strtod (tests[i].in, &ep); if (*ep != '\0') { @@ -84,5 +85,4 @@ do_test (void) return status; } -#define TEST_FUNCTION do_test () -#include "../test-skeleton.c" +#include <support/test-driver.c> diff --git a/stdlib/tst-strtod5i.c b/stdlib/tst-strtod5i.c new file mode 100644 index 0000000000..e9489c1747 --- /dev/null +++ b/stdlib/tst-strtod5i.c @@ -0,0 +1,99 @@ +/* Copyright (C) 2007-2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <locale.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <math.h> + +#define NBSP "\xc2\xa0" + +static const struct +{ + const char *in; + int group; + double expected; +} tests[] = + { + { "0", 0, 0.0 }, + { "000", 0, 0.0 }, + { "-0", 0, -0.0 }, + { "-000", 0, -0.0 }, + { "0,", 0, 0.0 }, + { "-0,", 0, -0.0 }, + { "0,0", 0, 0.0 }, + { "-0,0", 0, -0.0 }, + { "0e-10", 0, 0.0 }, + { "-0e-10", 0, -0.0 }, + { "0,e-10", 0, 0.0 }, + { "-0,e-10", 0, -0.0 }, + { "0,0e-10", 0, 0.0 }, + { "-0,0e-10", 0, -0.0 }, + { "0e-1000000", 0, 0.0 }, + { "-0e-1000000", 0, -0.0 }, + { "0,0e-1000000", 0, 0.0 }, + { "-0,0e-1000000", 0, -0.0 }, + { "0", 1, 0.0 }, + { "000", 1, 0.0 }, + { "-0", 1, -0.0 }, + { "-000", 1, -0.0 }, + { "0e-10", 1, 0.0 }, + { "-0e-10", 1, -0.0 }, + { "0e-1000000", 1, 0.0 }, + { "-0e-1000000", 1, -0.0 }, + { "000"NBSP"000"NBSP"000", 1, 0.0 }, + { "-000"NBSP"000"NBSP"000", 1, -0.0 } + }; +#define NTESTS (sizeof (tests) / sizeof (tests[0])) + + +static int +do_test (void) +{ + if (setlocale (LC_ALL, "cs_CZ.UTF-8") == NULL) + { + puts ("could not set locale"); + return 1; + } + + int status = 0; + + for (int i = 0; i < NTESTS; ++i) + { + char *ep; + double r = __strtod_internal (tests[i].in, &ep, tests[i].group); + + if (*ep != '\0') + { + printf ("%d: got rest string \"%s\", expected \"\"\n", i, ep); + status = 1; + } + + if (r != tests[i].expected + || copysign (10.0, r) != copysign (10.0, tests[i].expected)) + { + printf ("%d: got wrong results %g, expected %g\n", + i, r, tests[i].expected); + status = 1; + } + } + + return status; +} + +#include <support/test-driver.c> diff --git a/string/test-string.h b/string/test-string.h index 2c36b44c22..9f45898238 100644 --- a/string/test-string.h +++ b/string/test-string.h @@ -40,6 +40,18 @@ extern impl_t __start_impls[], __stop_impls[]; #undef __USE_STRING_INLINES +/* We are compiled under _ISOMAC, so libc-symbols.h does not do this + for us. */ +#include "config.h" +#ifdef HAVE_CC_INHIBIT_LOOP_TO_LIBCALL +# define inhibit_loop_to_libcall \ + __attribute__ ((__optimize__ ("-fno-tree-loop-distribute-patterns"))) +#else +# define inhibit_loop_to_libcall +#endif + + +#include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> diff --git a/string/test-strstr.c b/string/test-strstr.c index c29d37446c..404c374331 100644 --- a/string/test-strstr.c +++ b/string/test-strstr.c @@ -23,6 +23,7 @@ #define STRSTR simple_strstr +#define libc_hidden_builtin_def(arg) /* nothing */ #include "strstr.c" diff --git a/sunrpc/Makefile b/sunrpc/Makefile index a5177fffdc..c27b65b203 100644 --- a/sunrpc/Makefile +++ b/sunrpc/Makefile @@ -100,7 +100,8 @@ xtests := tst-getmyaddr ifeq ($(have-thread-library),yes) xtests += thrsvc -tests += tst-svc_register tst-udp-garbage +tests += tst-udp-garbage +tests-internal += tst-svc_register endif ifeq ($(run-built-tests),yes) diff --git a/sysdeps/ia64/fpu/libm-symbols.h b/sysdeps/ia64/fpu/libm-symbols.h index 31d6f36de9..505131b813 100644 --- a/sysdeps/ia64/fpu/libm-symbols.h +++ b/sysdeps/ia64/fpu/libm-symbols.h @@ -1,4 +1,4 @@ -#if !defined __STRICT_ANSI__ && !defined __cplusplus +#ifndef _ISOMAC # include <sysdep.h> # undef ret /* get rid of the stupid "ret" macro; it breaks br.ret */ diff --git a/sysdeps/m68k/m680x0/fpu/bits/mathinline.h b/sysdeps/m68k/m680x0/fpu/bits/mathinline.h index c2dca317f4..8e6bdc4e27 100644 --- a/sysdeps/m68k/m680x0/fpu/bits/mathinline.h +++ b/sysdeps/m68k/m680x0/fpu/bits/mathinline.h @@ -112,19 +112,22 @@ __NTH (__signbitl (long double __x)) #ifdef __LIBC_INTERNAL_MATH_INLINES /* This is used when defining the functions themselves. Define them with __ names, and with `static inline' instead of `extern inline' so the - bodies will always be used, never an external function call. */ + bodies will always be used, never an external function call. + Note: GCC 6 objects to __attribute__ ((__leaf__)) on static functions. */ # define __m81_u(x) __CONCAT(__,x) # define __m81_inline static __inline +# define __m81_nth(fn) __NTHNL (fn) #else # define __m81_u(x) x -# define __m81_inline __MATH_INLINE +# define __m81_inline __MATH_INLINE +# define __m81_nth(fn) __NTH (fn) # define __M81_MATH_INLINES 1 #endif /* Define a const math function. */ #define __m81_defun(rettype, func, args) \ __m81_inline rettype __attribute__((__const__)) \ - __NTH (__m81_u(func) args) + __m81_nth (__m81_u(func) args) /* Define the three variants of a math function that has a direct implementation in the m68k fpu. FUNC is the name for C (which will be @@ -335,8 +338,8 @@ __inline_functions (long double,l) # define __inline_functions(float_type, s) \ __m81_inline void \ -__NTH (__m81_u(__CONCAT(__sincos,s))(float_type __x, float_type *__sinx, \ - float_type *__cosx)) \ +__m81_nth (__m81_u(__CONCAT(__sincos,s)) \ + (float_type __x, float_type *__sinx, float_type *__cosx)) \ { \ __asm __volatile__ ("fsincos%.x %2,%1:%0" \ : "=f" (*__sinx), "=f" (*__cosx) : "f" (__x)); \ @@ -353,8 +356,6 @@ __inline_functions (long double,l) /* Define inline versions of the user visible functions. */ -/* Note that there must be no whitespace before the argument passed for - NAME, to make token pasting work correctly with -traditional. */ # define __inline_forward_c(rettype, name, args1, args2) \ __MATH_INLINE rettype __attribute__((__const__)) \ __NTH (name args1) \ diff --git a/sysdeps/powerpc/Makefile b/sysdeps/powerpc/Makefile index 933810fd22..e03a202c65 100644 --- a/sysdeps/powerpc/Makefile +++ b/sysdeps/powerpc/Makefile @@ -27,7 +27,7 @@ gen-as-const-headers += locale-defines.sym endif ifeq ($(subdir),nptl) -tests += test-get_hwcap test-get_hwcap-static +tests-internal += test-get_hwcap test-get_hwcap-static tests-static += test-get_hwcap-static endif diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile index 1872cdb179..b23b38944e 100644 --- a/sysdeps/unix/sysv/linux/Makefile +++ b/sysdeps/unix/sysv/linux/Makefile @@ -199,7 +199,8 @@ CFLAGS-gai.c += -DNEED_NETLINK endif ifeq ($(subdir),nptl) -tests += tst-setgetname tst-align-clone tst-getpid1 \ +tests += tst-align-clone tst-getpid1 \ tst-thread-affinity-pthread tst-thread-affinity-pthread2 \ tst-thread-affinity-sched +tests-internal += tst-setgetname endif diff --git a/sysdeps/x86_64/fpu/Makefile b/sysdeps/x86_64/fpu/Makefile index 36f090b826..2b7d69bb50 100644 --- a/sysdeps/x86_64/fpu/Makefile +++ b/sysdeps/x86_64/fpu/Makefile @@ -45,6 +45,12 @@ modules-names += test-double-libmvec-alias-mod \ test-float-libmvec-alias-mod \ test-float-libmvec-alias-avx-mod \ test-float-libmvec-alias-avx2-mod +modules-names-tests += test-double-libmvec-alias-mod \ + test-double-libmvec-alias-avx-mod \ + test-double-libmvec-alias-avx2-mod \ + test-float-libmvec-alias-mod \ + test-float-libmvec-alias-avx-mod \ + test-float-libmvec-alias-avx2-mod extra-test-objs += test-double-libmvec-sincos-avx-main.o \ test-double-libmvec-sincos-avx2-main.o \ test-double-libmvec-sincos-main.o \ @@ -146,6 +152,8 @@ tests += test-double-libmvec-alias-avx512 \ test-float-libmvec-sincosf-avx512 modules-names += test-double-libmvec-alias-avx512-mod \ test-float-libmvec-alias-avx512-mod +modules-names-tests += test-double-libmvec-alias-avx512-mod \ + test-float-libmvec-alias-avx512-mod extra-test-objs += test-double-libmvec-sincos-avx512-main.o \ test-float-libmvec-sincosf-avx512-main.o test-double-libmvec-alias-avx512-mod.so-no-z-defs = yes diff --git a/sysdeps/x86_64/fpu/math-tests-arch.h b/sysdeps/x86_64/fpu/math-tests-arch.h index 98f7cf6548..9278e3440b 100644 --- a/sysdeps/x86_64/fpu/math-tests-arch.h +++ b/sysdeps/x86_64/fpu/math-tests-arch.h @@ -16,11 +16,11 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ +#include <cpu-features.h> + #if defined REQUIRE_AVX -# include <init-arch.h> # define INIT_ARCH_EXT - # define CHECK_ARCH_EXT \ do \ { \ @@ -29,10 +29,8 @@ while (0) #elif defined REQUIRE_AVX2 -# include <init-arch.h> # define INIT_ARCH_EXT - # define CHECK_ARCH_EXT \ do \ { \ @@ -41,10 +39,8 @@ while (0) #elif defined REQUIRE_AVX512F -# include <init-arch.h> # define INIT_ARCH_EXT - # define CHECK_ARCH_EXT \ do \ { \ diff --git a/sysdeps/x86_64/multiarch/test-multiarch.c b/sysdeps/x86_64/multiarch/test-multiarch.c index 3974842c19..597d64e1e8 100644 --- a/sysdeps/x86_64/multiarch/test-multiarch.c +++ b/sysdeps/x86_64/multiarch/test-multiarch.c @@ -16,7 +16,7 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#include <init-arch.h> +#include <cpu-features.h> #include <stdio.h> #include <stdlib.h> #include <string.h> -- 2.11.0 ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 2/2] Suppress internal declarations for most of the testsuite. 2017-03-22 12:55 ` [PATCH 2/2] Suppress internal declarations for most of the testsuite Zack Weinberg @ 2017-05-08 14:02 ` Andreas Schwab 2017-05-08 20:02 ` Zack Weinberg 0 siblings, 1 reply; 17+ messages in thread From: Andreas Schwab @ 2017-05-08 14:02 UTC (permalink / raw) To: Zack Weinberg; +Cc: libc-alpha On Mär 22 2017, Zack Weinberg <zackw@panix.com> wrote: > N.B. extra-modules.mk was almost identical to cppflags-iterator.mk; the > only differences were that it used a different input variable and it > didn't let the caller control the module. So I have removed it and > changed the sole use to use cppflags-iterator.mk instead. In fact, cppflags-iterator.mk is misnamed since a long time, since it no longer sets CPPFLAGS-*. Would you care to rename it in a separate patch? Andreas. -- Andreas Schwab, SUSE Labs, schwab@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different." ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 2/2] Suppress internal declarations for most of the testsuite. 2017-05-08 14:02 ` Andreas Schwab @ 2017-05-08 20:02 ` Zack Weinberg 2017-05-09 7:57 ` Andreas Schwab 0 siblings, 1 reply; 17+ messages in thread From: Zack Weinberg @ 2017-05-08 20:02 UTC (permalink / raw) To: Andreas Schwab; +Cc: GNU C Library On Mon, May 8, 2017 at 10:01 AM, Andreas Schwab <schwab@suse.de> wrote: > On Mär 22 2017, Zack Weinberg <zackw@panix.com> wrote: > > In fact, cppflags-iterator.mk is misnamed since a long time, since it no > longer sets CPPFLAGS-*. Would you care to rename it in a separate > patch? How's this? --- Rename cppflags-iterator.mk to libof-iterator.mk, remove extra-modules.mk. cppflags-iterator.mk no longer has anything to do with CPPFLAGS; all it does is set libof-$(foo) for a list of files. extra-modules.mk does the same thing, but with a different input variable, and doesn't let the caller control the module. Therefore, this patch gives cppflags-iterator.mk a better name, removes extra-modules.mk, and updates all uses of both. Tested on x86-64-linux-gnu. Should have no effect whatsoever on installed files. * extra-modules.mk: Delete file. * cppflags-iterator.mk: Rename to ... * libof-iterator.mk: ...this. Adjust comments. * Makerules, extra-lib.mk, benchtests/Makefile, elf/Makefile * elf/rtld-Rules, iconv/Makefile, locale/Makefile, malloc/Makefile * nscd/Makefile, sunrpc/Makefile, sysdeps/s390/Makefile: Use libof-iterator.mk instead of cppflags-iterator.mk or extra-modules.mk. * benchtests/strcoll-inputs/filelist#en_US.UTF-8: Remove extra-modules.mk and cppflags-iterator.mk, add libof-iterator.mk. --- Makerules | 10 ++++------ benchtests/Makefile | 2 +- benchtests/strcoll-inputs/filelist#en_US.UTF-8 | 3 +-- elf/Makefile | 2 +- elf/rtld-Rules | 2 +- extra-lib.mk | 2 +- extra-modules.mk | 9 --------- iconv/Makefile | 2 +- iconvdata/Makefile | 2 +- cppflags-iterator.mk => libof-iterator.mk | 5 +++-- locale/Makefile | 2 +- malloc/Makefile | 2 +- nscd/Makefile | 2 +- sunrpc/Makefile | 2 +- sysdeps/s390/Makefile | 2 +- 15 files changed, 16 insertions(+), 30 deletions(-) delete mode 100644 extra-modules.mk rename cppflags-iterator.mk => libof-iterator.mk (47%) diff --git a/cppflags-iterator.mk b/libof-iterator.mk similarity index 47% rename from cppflags-iterator.mk rename to libof-iterator.mk index 89a472bd82..31560ce231 100644 --- a/cppflags-iterator.mk +++ b/libof-iterator.mk @@ -1,5 +1,6 @@ -# This file is included several times in a row, once -# for each element of $(lib)-routines and $(lib)-sysdeps_routines. +# This file is included several times in a row, once for each element +# $(cpp-src) of $(cpp-srcs-left). It sets libof-$(cpp-src) to $(lib) +# for each. cpp-src := $(firstword $(cpp-srcs-left)) cpp-srcs-left := $(filter-out $(cpp-src),$(cpp-srcs-left)) diff --git a/extra-modules.mk b/extra-modules.mk deleted file mode 100644 index 5f8e693b15..0000000000 --- a/extra-modules.mk +++ /dev/null @@ -1,9 +0,0 @@ -# This file is included several times in a row, once -# for each element of $(modules-names). $(extra-modules-left) -# is initialized first to $(modules-names) so that with each -# inclusion, we advance $(module) to the next name. - -module := $(firstword $(extra-modules-left)) -extra-modules-left := $(filter-out $(module),$(extra-modules-left)) - -libof-$(notdir $(module)) := extramodules diff --git a/extra-lib.mk b/extra-lib.mk index 2552049135..72f8d2e1df 100644 --- a/extra-lib.mk +++ b/extra-lib.mk @@ -108,5 +108,5 @@ endif # This will define `libof-ROUTINE := LIB' for each of the routines. cpp-srcs-left := $($(lib)-routines) $($(lib)-sysdep_routines) ifneq (,$(cpp-srcs-left)) -include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left)) +include $(patsubst %,$(..)libof-iterator.mk,$(cpp-srcs-left)) endif diff --git a/Makerules b/Makerules index 7f0eef8096..15f46e5f3a 100644 --- a/Makerules +++ b/Makerules @@ -794,11 +794,9 @@ endif # The makefile may define $(modules-names) to build additional modules. # These are built with $(build-module), except any in $(modules-names-nobuild). ifdef modules-names -# extra-lib.mk is included once for each extra lib to define rules -# to build it, and to add its objects to the various variables. -# During its evaluation, $(lib) is set to the name of the library. -extra-modules-left := $(modules-names) -include $(patsubst %,$(..)extra-modules.mk,$(modules-names)) +cpp-srcs-left := $(modules-names) +lib = extramodules +include $(patsubst %,$(..)libof-iterator.mk,$(modules-names)) extra-modules-build := $(filter-out $(modules-names-nobuild),$(modules-names)) $(extra-modules-build:%=$(objpfx)%.so): $(objpfx)%.so: \ @@ -1327,7 +1325,7 @@ all-nonlib = $(strip $(tests) $(xtests) $(test-srcs) $(test-extras) $(others)) ifneq (,$(all-nonlib)) cpp-srcs-left = $(all-nonlib) lib := nonlib -include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left)) +include $(patsubst %,$(..)libof-iterator.mk,$(cpp-srcs-left)) endif diff --git a/benchtests/Makefile b/benchtests/Makefile index a96e9533b3..7f5fda5ef4 100644 --- a/benchtests/Makefile +++ b/benchtests/Makefile @@ -123,7 +123,7 @@ endif cpp-srcs-left := $(binaries-benchset:=.c) $(binaries-bench:=.c) \ $(binaries-bench-malloc:=.c) lib := nonlib -include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left)) +include $(patsubst %,$(..)libof-iterator.mk,$(cpp-srcs-left)) bench-extra-objs = json-lib.o diff --git a/elf/Makefile b/elf/Makefile index cc4aeb25b6..baf967821c 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -547,7 +547,7 @@ CFLAGS-rtld.c = $(SYSCONF-FLAGS) cpp-srcs-left := $(all-rtld-routines:=.os) lib := rtld -include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left)) +include $(patsubst %,$(..)libof-iterator.mk,$(cpp-srcs-left)) test-modules = $(addprefix $(objpfx),$(addsuffix .so,$(strip $(modules-names)))) generated += $(addsuffix .so,$(strip $(modules-names))) diff --git a/elf/rtld-Rules b/elf/rtld-Rules index 99b5899f7d..2c7b99828c 100644 --- a/elf/rtld-Rules +++ b/elf/rtld-Rules @@ -142,7 +142,7 @@ endif # Set libof-* for each routine. cpp-srcs-left := $(rtld-modules:%.os=%) lib := rtld -include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left)) +include $(patsubst %,$(..)libof-iterator.mk,$(cpp-srcs-left)) rtld-CFLAGS += $(no-stack-protector) diff --git a/iconv/Makefile b/iconv/Makefile index 2b2bc8e303..b2fead0479 100644 --- a/iconv/Makefile +++ b/iconv/Makefile @@ -55,7 +55,7 @@ CFLAGS-iconvconfig.c = -DGCONV_PATH='"$(gconvdir)"' -DGCONV_DIR='"$(gconvdir)"' # Set libof-* for each routine. cpp-srcs-left := $(iconv_prog-modules) $(iconvconfig-modules) lib := iconvprogs -include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left)) +include $(patsubst %,$(..)libof-iterator.mk,$(cpp-srcs-left)) ifeq ($(run-built-tests),yes) xtests-special += $(objpfx)test-iconvconfig.out diff --git a/iconvdata/Makefile b/iconvdata/Makefile index e4845871f5..a0e297e4de 100644 --- a/iconvdata/Makefile +++ b/iconvdata/Makefile @@ -290,7 +290,7 @@ cpp-srcs-left := $(modules) $(generated-modules) $(libJIS-routines) \ $(libKSC-routines) $(libGB-routines) $(libCNS-routines) \ $(libISOIR165-routines) $(libJISX0213-routines) lib := iconvdata -include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left)) +include $(patsubst %,$(..)libof-iterator.mk,$(cpp-srcs-left)) tst-loading-ENV = MALLOC_TRACE=$(objpfx)tst-loading.mtrace $(objpfx)mtrace-tst-loading.out: $(objpfx)tst-loading.out diff --git a/locale/Makefile b/locale/Makefile index 29a34b1f26..d9ef48fe93 100644 --- a/locale/Makefile +++ b/locale/Makefile @@ -101,4 +101,4 @@ CFLAGS-charmap-dir.c = -Wno-write-strings cpp-srcs-left := $(localedef-modules) $(localedef-aux) $(locale-modules) \ $(lib-modules) lib := locale-programs -include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left)) +include $(patsubst %,$(..)libof-iterator.mk,$(cpp-srcs-left)) diff --git a/malloc/Makefile b/malloc/Makefile index e93b83b57d..e380e9629b 100644 --- a/malloc/Makefile +++ b/malloc/Makefile @@ -126,7 +126,7 @@ memusagestat-modules = memusagestat cpp-srcs-left := $(memusagestat-modules) lib := memusagestat -include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left)) +include $(patsubst %,$(..)libof-iterator.mk,$(cpp-srcs-left)) $(objpfx)memusagestat: $(memusagestat-modules:%=$(objpfx)%.o) $(LINK.o) -o $@ $^ $(libgd-LDFLAGS) -lgd -lpng -lz -lm diff --git a/nscd/Makefile b/nscd/Makefile index 0385a370f0..4126996887 100644 --- a/nscd/Makefile +++ b/nscd/Makefile @@ -92,7 +92,7 @@ endif # Set libof-nscd. cpp-srcs-left := $(nscd-modules) lib := nscd -include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left)) +include $(patsubst %,$(..)libof-iterator.mk,$(cpp-srcs-left)) $(objpfx)nscd: $(nscd-modules:%=$(objpfx)%.o) diff --git a/sunrpc/Makefile b/sunrpc/Makefile index a5177fffdc..08bb9c6822 100644 --- a/sunrpc/Makefile +++ b/sunrpc/Makefile @@ -183,7 +183,7 @@ $(objpfx)cross-rpcgen: $(cross-rpcgen-objs) # This makes sure -DIN_MODULE is passed for all these modules. cpp-srcs-left := $(rpcgen-objs:.o=.c) lib := nonlib -include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left)) +include $(patsubst %,$(..)libof-iterator.mk,$(cpp-srcs-left)) # How we run rpcgen to generate sources and headers in the rules below. # Setting CPP tells it how to run the C preprocessor correctly. Note diff --git a/sysdeps/s390/Makefile b/sysdeps/s390/Makefile index d50836579f..8a54f88cd7 100644 --- a/sysdeps/s390/Makefile +++ b/sysdeps/s390/Makefile @@ -18,7 +18,7 @@ include extra-module.mk cpp-srcs-left := $(foreach mod,$(s390x-iconv-modules),$($(mod)-routines)) lib := iconvdata -include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left)) +include $(patsubst %,$(..)libof-iterator.mk,$(cpp-srcs-left)) extra-objs += $(addsuffix .so, $(s390x-iconv-modules)) install-others += $(patsubst %, $(inst_gconvdir)/%.so, $(s390x-iconv-modules)) diff --git a/benchtests/strcoll-inputs/filelist#en_US.UTF-8 b/benchtests/strcoll-inputs/filelist#en_US.UTF-8 index b7b38017d8..6cee2374f4 100644 --- a/benchtests/strcoll-inputs/filelist#en_US.UTF-8 +++ b/benchtests/strcoll-inputs/filelist#en_US.UTF-8 @@ -9667,7 +9667,6 @@ hr.po libc.pot ko.po ru.po -extra-modules.mk intl tst-gettext4-fr.po tstcodeset.po @@ -13252,7 +13251,6 @@ sigset.h atomic.h utmp.h stdlib-bsearch.h -cppflags-iterator.mk iconvdata MISSING ibm1164.h @@ -15245,3 +15243,4 @@ w_exp2l.c bug-nexttoward.c w_dreml.c s_nanf.c +libof-iterator.mk -- 2.11.0 ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 2/2] Suppress internal declarations for most of the testsuite. 2017-05-08 20:02 ` Zack Weinberg @ 2017-05-09 7:57 ` Andreas Schwab 2017-05-09 11:25 ` Zack Weinberg 0 siblings, 1 reply; 17+ messages in thread From: Andreas Schwab @ 2017-05-09 7:57 UTC (permalink / raw) To: Zack Weinberg; +Cc: GNU C Library On Mai 08 2017, Zack Weinberg <zackw@panix.com> wrote: > * extra-modules.mk: Delete file. > * cppflags-iterator.mk: Rename to ... > * libof-iterator.mk: ...this. Adjust comments. > > * Makerules, extra-lib.mk, benchtests/Makefile, elf/Makefile > * elf/rtld-Rules, iconv/Makefile, locale/Makefile, malloc/Makefile > * nscd/Makefile, sunrpc/Makefile, sysdeps/s390/Makefile: > Use libof-iterator.mk instead of cppflags-iterator.mk or > extra-modules.mk. > > * benchtests/strcoll-inputs/filelist#en_US.UTF-8: Remove > extra-modules.mk and cppflags-iterator.mk, add libof-iterator.mk. Ok, thanks. Andreas. -- Andreas Schwab, SUSE Labs, schwab@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different." ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 2/2] Suppress internal declarations for most of the testsuite. 2017-05-09 7:57 ` Andreas Schwab @ 2017-05-09 11:25 ` Zack Weinberg 0 siblings, 0 replies; 17+ messages in thread From: Zack Weinberg @ 2017-05-09 11:25 UTC (permalink / raw) To: Andreas Schwab; +Cc: GNU C Library On Tue, May 9, 2017 at 3:49 AM, Andreas Schwab <schwab@suse.de> wrote: > On Mai 08 2017, Zack Weinberg <zackw@panix.com> wrote: > >> * extra-modules.mk: Delete file. >> * cppflags-iterator.mk: Rename to ... >> * libof-iterator.mk: ...this. Adjust comments. >> >> * Makerules, extra-lib.mk, benchtests/Makefile, elf/Makefile >> * elf/rtld-Rules, iconv/Makefile, locale/Makefile, malloc/Makefile >> * nscd/Makefile, sunrpc/Makefile, sysdeps/s390/Makefile: >> Use libof-iterator.mk instead of cppflags-iterator.mk or >> extra-modules.mk. >> >> * benchtests/strcoll-inputs/filelist#en_US.UTF-8: Remove >> extra-modules.mk and cppflags-iterator.mk, add libof-iterator.mk. > > Ok, thanks. Committed now, will send an updated testsuite-_ISOMAC patchset shortly. zw ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 0/2] _ISOMAC testsuite round N 2017-03-22 12:55 [PATCH 0/2] _ISOMAC testsuite round N Zack Weinberg 2017-03-22 12:55 ` [PATCH 1/2] Remove _IO_MTSAFE_IO from public headers Zack Weinberg 2017-03-22 12:55 ` [PATCH 2/2] Suppress internal declarations for most of the testsuite Zack Weinberg @ 2017-04-06 16:12 ` Zack Weinberg 2017-04-17 14:31 ` Zack Weinberg 2 siblings, 1 reply; 17+ messages in thread From: Zack Weinberg @ 2017-04-06 16:12 UTC (permalink / raw) To: GNU C Library Ping? On Wed, Mar 22, 2017 at 8:55 AM, Zack Weinberg <zackw@panix.com> wrote: > The main change from the previous iteration of this patch, is that I > have (hopefully) made there be no visible difference in libio.h for > external users. It defines all the same _IO_ thingies that it always > has, with the same definitions. Patch #1 still needs a very careful > going-over by people who remember what the original goals of libio > were and know what external users there might still be, though. > > Also, the Makefile adjustments in patch #2 have been updated for > Thorsten's work on deprecating SunRPC. > > zw > > Zack Weinberg (2): > Remove _IO_MTSAFE_IO from public headers. > Suppress internal declarations for most of the testsuite. > > Makeconfig | 3 +- > Makefile | 4 +- > Makerules | 55 ++++++++++---- > Rules | 18 ++--- > benchtests/strcoll-inputs/filelist#en_US.UTF-8 | 1 - > config.h.in | 11 --- > elf/Makefile | 58 ++++++++------- > elf/tst-env-setuid-tunables.c | 6 ++ > extra-modules.mk | 9 --- > include/errno.h | 2 +- > include/libc-symbols.h | 62 +++++++++++----- > include/libio.h | 25 ++++--- > include/math.h | 5 ++ > include/stdio.h | 7 +- > include/stdlib.h | 4 -- > include/string.h | 10 +-- > include/time.h | 4 -- > include/unistd.h | 3 - > include/wchar.h | 2 - > inet/Makefile | 7 +- > inet/tst-checks-posix.c | 1 - > intl/tst-gettext2.c | 2 + > libio/libio.h | 31 ++++---- > malloc/Makefile | 6 +- > math/test-signgam-finite-c99.c | 1 - > math/test-signgam-main.c | 1 - > misc/Makefile | 5 +- > misc/sys/cdefs.h | 3 + > nptl/Makefile | 31 ++++---- > nss/Makefile | 4 +- > posix/Makefile | 11 +-- > stdlib/Makefile | 17 +++-- > stdlib/tst-strtod.c | 64 +---------------- > stdlib/tst-strtod1i.c | 83 +++++++++++++++++++++ > stdlib/tst-strtod5.c | 74 +++++++++---------- > stdlib/tst-strtod5i.c | 99 ++++++++++++++++++++++++++ > string/test-string.h | 12 ++++ > string/test-strstr.c | 1 + > sunrpc/Makefile | 3 +- > sysdeps/generic/stdio-lock.h | 1 + > sysdeps/ia64/fpu/libm-symbols.h | 2 +- > sysdeps/m68k/m680x0/fpu/bits/mathinline.h | 15 ++-- > sysdeps/nptl/stdio-lock.h | 1 + > sysdeps/powerpc/Makefile | 2 +- > sysdeps/unix/sysv/linux/Makefile | 3 +- > sysdeps/x86_64/fpu/Makefile | 8 +++ > sysdeps/x86_64/fpu/math-tests-arch.h | 8 +-- > sysdeps/x86_64/multiarch/test-multiarch.c | 2 +- > 48 files changed, 496 insertions(+), 291 deletions(-) > delete mode 100644 extra-modules.mk > create mode 100644 stdlib/tst-strtod1i.c > create mode 100644 stdlib/tst-strtod5i.c > > -- > 2.11.0 > ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 0/2] _ISOMAC testsuite round N 2017-04-06 16:12 ` [PATCH 0/2] _ISOMAC testsuite round N Zack Weinberg @ 2017-04-17 14:31 ` Zack Weinberg 2017-05-01 11:24 ` Zack Weinberg 0 siblings, 1 reply; 17+ messages in thread From: Zack Weinberg @ 2017-04-17 14:31 UTC (permalink / raw) To: GNU C Library Ping^2 On Thu, Apr 6, 2017 at 12:12 PM, Zack Weinberg <zackw@panix.com> wrote: > Ping? > > On Wed, Mar 22, 2017 at 8:55 AM, Zack Weinberg <zackw@panix.com> wrote: >> The main change from the previous iteration of this patch, is that I >> have (hopefully) made there be no visible difference in libio.h for >> external users. It defines all the same _IO_ thingies that it always >> has, with the same definitions. Patch #1 still needs a very careful >> going-over by people who remember what the original goals of libio >> were and know what external users there might still be, though. >> >> Also, the Makefile adjustments in patch #2 have been updated for >> Thorsten's work on deprecating SunRPC. >> >> zw >> >> Zack Weinberg (2): >> Remove _IO_MTSAFE_IO from public headers. >> Suppress internal declarations for most of the testsuite. >> >> Makeconfig | 3 +- >> Makefile | 4 +- >> Makerules | 55 ++++++++++---- >> Rules | 18 ++--- >> benchtests/strcoll-inputs/filelist#en_US.UTF-8 | 1 - >> config.h.in | 11 --- >> elf/Makefile | 58 ++++++++------- >> elf/tst-env-setuid-tunables.c | 6 ++ >> extra-modules.mk | 9 --- >> include/errno.h | 2 +- >> include/libc-symbols.h | 62 +++++++++++----- >> include/libio.h | 25 ++++--- >> include/math.h | 5 ++ >> include/stdio.h | 7 +- >> include/stdlib.h | 4 -- >> include/string.h | 10 +-- >> include/time.h | 4 -- >> include/unistd.h | 3 - >> include/wchar.h | 2 - >> inet/Makefile | 7 +- >> inet/tst-checks-posix.c | 1 - >> intl/tst-gettext2.c | 2 + >> libio/libio.h | 31 ++++---- >> malloc/Makefile | 6 +- >> math/test-signgam-finite-c99.c | 1 - >> math/test-signgam-main.c | 1 - >> misc/Makefile | 5 +- >> misc/sys/cdefs.h | 3 + >> nptl/Makefile | 31 ++++---- >> nss/Makefile | 4 +- >> posix/Makefile | 11 +-- >> stdlib/Makefile | 17 +++-- >> stdlib/tst-strtod.c | 64 +---------------- >> stdlib/tst-strtod1i.c | 83 +++++++++++++++++++++ >> stdlib/tst-strtod5.c | 74 +++++++++---------- >> stdlib/tst-strtod5i.c | 99 ++++++++++++++++++++++++++ >> string/test-string.h | 12 ++++ >> string/test-strstr.c | 1 + >> sunrpc/Makefile | 3 +- >> sysdeps/generic/stdio-lock.h | 1 + >> sysdeps/ia64/fpu/libm-symbols.h | 2 +- >> sysdeps/m68k/m680x0/fpu/bits/mathinline.h | 15 ++-- >> sysdeps/nptl/stdio-lock.h | 1 + >> sysdeps/powerpc/Makefile | 2 +- >> sysdeps/unix/sysv/linux/Makefile | 3 +- >> sysdeps/x86_64/fpu/Makefile | 8 +++ >> sysdeps/x86_64/fpu/math-tests-arch.h | 8 +-- >> sysdeps/x86_64/multiarch/test-multiarch.c | 2 +- >> 48 files changed, 496 insertions(+), 291 deletions(-) >> delete mode 100644 extra-modules.mk >> create mode 100644 stdlib/tst-strtod1i.c >> create mode 100644 stdlib/tst-strtod5i.c >> >> -- >> 2.11.0 >> ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 0/2] _ISOMAC testsuite round N 2017-04-17 14:31 ` Zack Weinberg @ 2017-05-01 11:24 ` Zack Weinberg 2017-05-08 13:23 ` Zack Weinberg 0 siblings, 1 reply; 17+ messages in thread From: Zack Weinberg @ 2017-05-01 11:24 UTC (permalink / raw) To: GNU C Library Ping^3 On Mon, Apr 17, 2017 at 10:31 AM, Zack Weinberg <zackw@panix.com> wrote: > Ping^2 > > On Thu, Apr 6, 2017 at 12:12 PM, Zack Weinberg <zackw@panix.com> wrote: >> Ping? >> >> On Wed, Mar 22, 2017 at 8:55 AM, Zack Weinberg <zackw@panix.com> wrote: >>> The main change from the previous iteration of this patch, is that I >>> have (hopefully) made there be no visible difference in libio.h for >>> external users. It defines all the same _IO_ thingies that it always >>> has, with the same definitions. Patch #1 still needs a very careful >>> going-over by people who remember what the original goals of libio >>> were and know what external users there might still be, though. >>> >>> Also, the Makefile adjustments in patch #2 have been updated for >>> Thorsten's work on deprecating SunRPC. >>> >>> zw >>> >>> Zack Weinberg (2): >>> Remove _IO_MTSAFE_IO from public headers. >>> Suppress internal declarations for most of the testsuite. >>> >>> Makeconfig | 3 +- >>> Makefile | 4 +- >>> Makerules | 55 ++++++++++---- >>> Rules | 18 ++--- >>> benchtests/strcoll-inputs/filelist#en_US.UTF-8 | 1 - >>> config.h.in | 11 --- >>> elf/Makefile | 58 ++++++++------- >>> elf/tst-env-setuid-tunables.c | 6 ++ >>> extra-modules.mk | 9 --- >>> include/errno.h | 2 +- >>> include/libc-symbols.h | 62 +++++++++++----- >>> include/libio.h | 25 ++++--- >>> include/math.h | 5 ++ >>> include/stdio.h | 7 +- >>> include/stdlib.h | 4 -- >>> include/string.h | 10 +-- >>> include/time.h | 4 -- >>> include/unistd.h | 3 - >>> include/wchar.h | 2 - >>> inet/Makefile | 7 +- >>> inet/tst-checks-posix.c | 1 - >>> intl/tst-gettext2.c | 2 + >>> libio/libio.h | 31 ++++---- >>> malloc/Makefile | 6 +- >>> math/test-signgam-finite-c99.c | 1 - >>> math/test-signgam-main.c | 1 - >>> misc/Makefile | 5 +- >>> misc/sys/cdefs.h | 3 + >>> nptl/Makefile | 31 ++++---- >>> nss/Makefile | 4 +- >>> posix/Makefile | 11 +-- >>> stdlib/Makefile | 17 +++-- >>> stdlib/tst-strtod.c | 64 +---------------- >>> stdlib/tst-strtod1i.c | 83 +++++++++++++++++++++ >>> stdlib/tst-strtod5.c | 74 +++++++++---------- >>> stdlib/tst-strtod5i.c | 99 ++++++++++++++++++++++++++ >>> string/test-string.h | 12 ++++ >>> string/test-strstr.c | 1 + >>> sunrpc/Makefile | 3 +- >>> sysdeps/generic/stdio-lock.h | 1 + >>> sysdeps/ia64/fpu/libm-symbols.h | 2 +- >>> sysdeps/m68k/m680x0/fpu/bits/mathinline.h | 15 ++-- >>> sysdeps/nptl/stdio-lock.h | 1 + >>> sysdeps/powerpc/Makefile | 2 +- >>> sysdeps/unix/sysv/linux/Makefile | 3 +- >>> sysdeps/x86_64/fpu/Makefile | 8 +++ >>> sysdeps/x86_64/fpu/math-tests-arch.h | 8 +-- >>> sysdeps/x86_64/multiarch/test-multiarch.c | 2 +- >>> 48 files changed, 496 insertions(+), 291 deletions(-) >>> delete mode 100644 extra-modules.mk >>> create mode 100644 stdlib/tst-strtod1i.c >>> create mode 100644 stdlib/tst-strtod5i.c >>> >>> -- >>> 2.11.0 >>> ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 0/2] _ISOMAC testsuite round N 2017-05-01 11:24 ` Zack Weinberg @ 2017-05-08 13:23 ` Zack Weinberg 0 siblings, 0 replies; 17+ messages in thread From: Zack Weinberg @ 2017-05-08 13:23 UTC (permalink / raw) To: GNU C Library Ping^4 On Mon, May 1, 2017 at 7:24 AM, Zack Weinberg <zackw@panix.com> wrote: > Ping^3 > > On Mon, Apr 17, 2017 at 10:31 AM, Zack Weinberg <zackw@panix.com> wrote: >> Ping^2 >> >> On Thu, Apr 6, 2017 at 12:12 PM, Zack Weinberg <zackw@panix.com> wrote: >>> Ping? >>> >>> On Wed, Mar 22, 2017 at 8:55 AM, Zack Weinberg <zackw@panix.com> wrote: >>>> The main change from the previous iteration of this patch, is that I >>>> have (hopefully) made there be no visible difference in libio.h for >>>> external users. It defines all the same _IO_ thingies that it always >>>> has, with the same definitions. Patch #1 still needs a very careful >>>> going-over by people who remember what the original goals of libio >>>> were and know what external users there might still be, though. >>>> >>>> Also, the Makefile adjustments in patch #2 have been updated for >>>> Thorsten's work on deprecating SunRPC. >>>> >>>> zw >>>> >>>> Zack Weinberg (2): >>>> Remove _IO_MTSAFE_IO from public headers. >>>> Suppress internal declarations for most of the testsuite. >>>> >>>> Makeconfig | 3 +- >>>> Makefile | 4 +- >>>> Makerules | 55 ++++++++++---- >>>> Rules | 18 ++--- >>>> benchtests/strcoll-inputs/filelist#en_US.UTF-8 | 1 - >>>> config.h.in | 11 --- >>>> elf/Makefile | 58 ++++++++------- >>>> elf/tst-env-setuid-tunables.c | 6 ++ >>>> extra-modules.mk | 9 --- >>>> include/errno.h | 2 +- >>>> include/libc-symbols.h | 62 +++++++++++----- >>>> include/libio.h | 25 ++++--- >>>> include/math.h | 5 ++ >>>> include/stdio.h | 7 +- >>>> include/stdlib.h | 4 -- >>>> include/string.h | 10 +-- >>>> include/time.h | 4 -- >>>> include/unistd.h | 3 - >>>> include/wchar.h | 2 - >>>> inet/Makefile | 7 +- >>>> inet/tst-checks-posix.c | 1 - >>>> intl/tst-gettext2.c | 2 + >>>> libio/libio.h | 31 ++++---- >>>> malloc/Makefile | 6 +- >>>> math/test-signgam-finite-c99.c | 1 - >>>> math/test-signgam-main.c | 1 - >>>> misc/Makefile | 5 +- >>>> misc/sys/cdefs.h | 3 + >>>> nptl/Makefile | 31 ++++---- >>>> nss/Makefile | 4 +- >>>> posix/Makefile | 11 +-- >>>> stdlib/Makefile | 17 +++-- >>>> stdlib/tst-strtod.c | 64 +---------------- >>>> stdlib/tst-strtod1i.c | 83 +++++++++++++++++++++ >>>> stdlib/tst-strtod5.c | 74 +++++++++---------- >>>> stdlib/tst-strtod5i.c | 99 ++++++++++++++++++++++++++ >>>> string/test-string.h | 12 ++++ >>>> string/test-strstr.c | 1 + >>>> sunrpc/Makefile | 3 +- >>>> sysdeps/generic/stdio-lock.h | 1 + >>>> sysdeps/ia64/fpu/libm-symbols.h | 2 +- >>>> sysdeps/m68k/m680x0/fpu/bits/mathinline.h | 15 ++-- >>>> sysdeps/nptl/stdio-lock.h | 1 + >>>> sysdeps/powerpc/Makefile | 2 +- >>>> sysdeps/unix/sysv/linux/Makefile | 3 +- >>>> sysdeps/x86_64/fpu/Makefile | 8 +++ >>>> sysdeps/x86_64/fpu/math-tests-arch.h | 8 +-- >>>> sysdeps/x86_64/multiarch/test-multiarch.c | 2 +- >>>> 48 files changed, 496 insertions(+), 291 deletions(-) >>>> delete mode 100644 extra-modules.mk >>>> create mode 100644 stdlib/tst-strtod1i.c >>>> create mode 100644 stdlib/tst-strtod5i.c >>>> >>>> -- >>>> 2.11.0 >>>> ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 0/2] Revised _ISOMAC testsuite patches @ 2017-03-08 16:30 Zack Weinberg 2017-03-08 16:35 ` [PATCH 2/2] Suppress internal declarations for most of the testsuite Zack Weinberg 0 siblings, 1 reply; 17+ messages in thread From: Zack Weinberg @ 2017-03-08 16:30 UTC (permalink / raw) To: GNU C Library [-- Attachment #1: Type: text/plain, Size: 1138 bytes --] Here are a revised pair of patches to run most of the testsuite in _ISOMAC mode. The first one eliminates _IO_MTSAFE_IO from the public headers; this wants to be reviewed independently due to the potential consequences for very old code that actually uses <libio.h>, e.g. GCC 2.95 was mentioned in an earlier thread. The second patch is the meat of the change. I have done as much prep work as I think is safe in already-committed patches; I don't think it makes sense to try to break it up any further. I can't guarantee I have addressed all of the reviewers' comments on the previous iteration, please read carefully. What I *have* done is compare stripped installation trees before and after each patch. The attached tarball contains two files of `diffoscope --html` output. "install-01.html" compares before and after the _IO_MTSAFE_IO change, "install-12.html" compares before and after the _ISOMAC-testsuite change. I'm pleased to report that in both cases, there are no changes other than the expected change to the headers and a build timestamp change in nscd. (Note: diffoscope was patched to ignore mtime changes.) zw [-- Attachment #2: installed-stripped-libs-comparison.tar.gz --] [-- Type: application/gzip, Size: 16408 bytes --] ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 2/2] Suppress internal declarations for most of the testsuite. 2017-03-08 16:30 [PATCH 0/2] Revised _ISOMAC testsuite patches Zack Weinberg @ 2017-03-08 16:35 ` Zack Weinberg 0 siblings, 0 replies; 17+ messages in thread From: Zack Weinberg @ 2017-03-08 16:35 UTC (permalink / raw) To: libc-alpha This patch adds a new build module called 'testsuite'. IS_IN (testsuite) implies _ISOMAC, as do IS_IN_build and __cplusplus (which means several ad-hoc tests for __cplusplus can go away). libc-symbols.h now suppresses almost all of *itself* when _ISOMAC is defined; in particular, _ISOMAC mode does not get config.h automatically anymore. There are still quite a few tests that need to see internal gunk of one variety or another. For them, we now have 'tests-internal' and 'test-internal-extras'; files in this category will still be compiled with MODULE_NAME=nonlib, and everything proceeds as it always has. The bulk of this patch is moving tests from 'tests' to 'tests-internal'. There is also 'tests-static-internal', which has the same effect on files in 'tests-static', and 'modules-names-tests', which has the *inverse* effect on files in 'modules-names' (it's inverted because most of the things in modules-names are *not* tests). For both of these, the file must appear in *both* the new variable and the old one. There is also now a special case for when libc-symbols.h is included without MODULE_NAME being defined at all. (This happens during the creation of libc-modules.h, and also when preprocessing Versions files.) When this happens, IS_IN is set to be always false and _ISOMAC is *not* defined, which was the status quo, but now it's explicit. The remaining changes to C source files in this patch seemed likely to cause problems in the absence of the main change. They should be relatively self-explanatory. In a few cases I duplicated a definition from an internal header rather than move the test to tests-internal; this was a judgement call each time and I'm happy to change those however reviewers feel is more appropriate. N.B. extra-modules.mk was almost identical to cppflags-iterator.mk; the only differences were that it used a different input variable and it didn't let the caller control the module. So I have removed it and changed the sole use to use cppflags-iterator.mk instead. * Makerules: New subdir configuration variables 'tests-internal' and 'test-internal-extras'. Test files in these categories will still be compiled with MODULE_NAME=nonlib. Test files in the existing categories (tests, xtests, test-srcs, test-extras) are now compiled with MODULE_NAME=testsuite. New subdir configuration variable 'modules-names-tests'. Files which are in both 'modules-names' and 'modules-names-tests' will be compiled with MODULE_NAME=testsuite instead of MODULE_NAME=extramodules. Use cppflags-iterator.mk instead of extra-modules.mk for the files in $(modules-names). (gen-as-const-headers): Move to tests-internal. (do-tests-clean, common-mostlyclean): Support tests-internal. * Makeconfig (built-modules): Add testsuite. * Makefile: Change libof-check-installed-headers-c and libof-check-installed-headers-cxx to 'testsuite'. * Rules: Likewise. Support tests-internal. * extra-modules.mk: Removed. * benchtests/strcoll-inputs/filelist#en_US.UTF-8: Remove extra-modules.mk. * config.h.in: Don't check for __OPTIMIZE__ or __FAST_MATH__ here. * include/libc-symbols.h: Move definitions of _GNU_SOURCE, PASTE_NAME, PASTE_NAME1, IN_MODULE, IS_IN, and IS_IN_LIB to the very top of the file and rationalize their order. If MODULE_NAME is not defined at all, define IS_IN to always be false, and don't define _ISOMAC. If any of IS_IN (testsuite), IS_IN_build, or __cplusplus are true, define _ISOMAC and suppress everything else in this file, starting with the inclusion of config.h. Do check for inappropriate definitions of __OPTIMIZE__ and __FAST_MATH__ here, but only if _ISOMAC is not defined. Correct some out-of-date commentary. * include/math.h: If _ISOMAC is defined, undefine NO_LONG_DOUBLE and _Mlong_double_ before including math.h. * include/string.h: If _ISOMAC is defined, don't expose _STRING_ARCH_unaligned. Move a comment to a more appropriate location. * include/errno.h, include/stdio.h, include/stdlib.h, include/string.h * include/time.h, include/unistd.h, include/wchar.h: No need to check __cplusplus nor use __BEGIN_DECLS/__END_DECLS. * misc/sys/cdefs.h (__NTHNL): New macro. * sysdeps/m68k/m680x0/fpu/bits/mathinline.h (__m81_defun): Use __NTHNL to avoid errors with GCC 6. * elf/tst-env-setuid-tunables.c: Include config.h with _LIBC defined, for HAVE_TUNABLES. * inet/tst-checks-posix.c: No need to define _ISOMAC. * intl/tst-gettext2.c: Provide own definition of N_. * math/test-signgam-finite-c99.c: No need to define _ISOMAC. * math/test-signgam-main.c: No need to define _ISOMAC. * stdlib/tst-strtod.c: Convert to test-driver. Split locale_test to... * stdlib/tst-strtod1i.c: ...this new file. * stdlib/tst-strtod5.c: Convert to test-driver and add copyright notice. Split tests of __strtod_internal to... * stdlib/tst-strtod5i.c: ...this new file. * string/test-string.h: Include stdint.h. Duplicate definition of inhibit_loop_to_libcall here (from libc-symbols.h). * string/test-strstr.c: Provide dummy definition of libc_hidden_builtin_def when including strstr.c. * sysdeps/ia64/fpu/libm-symbols.h: Suppress entire file in _ISOMAC mode; no need to test __STRICT_ANSI__ nor __cplusplus as well. * sysdeps/x86_64/fpu/math-tests-arch.h: Include cpu-features.h. Don't include init-arch.h. * sysdeps/x86_64/multiarch/test-multiarch.h: Include cpu-features.h. Don't include init-arch.h. * elf/Makefile: Move tst-ptrguard1-static, tst-stackguard1-static, tst-tls1-static, tst-tls2-static, tst-tls3-static, loadtest, unload, unload2, circleload1, neededtest, neededtest2, neededtest3, neededtest4, tst-tls1, tst-tls2, tst-tls3, tst-tls6, tst-tls7, tst-tls8, tst-dlmopen2, tst-ptrguard1, tst-stackguard1, tst-_dl_addr_inside_object, and all of the ifunc tests to tests-internal. Don't add $(modules-names) to test-extras. * inet/Makefile: Move tst-inet6_scopeid_pton to tests-internal. Add tst-deadline to tests-static-internal. * malloc/Makefile: Move tst-mallocstate and tst-scratch_buffer to tests-internal. * misc/Makefile: Move tst-atomic and tst-atomic-long to tests-internal. * nptl/Makefile: Move tst-typesizes, tst-rwlock19, tst-sem11, tst-sem12, tst-sem13, tst-barrier5, tst-signal7, tst-tls3, tst-tls3-malloc, tst-tls5, tst-stackguard1, tst-sem11-static, tst-sem12-static, and tst-stackguard1-static to tests-internal. Link tests-internal with libpthread also. Don't add $(modules-names) to test-extras. * nss/Makefile: Move tst-field to tests-internal. * posix/Makefile: Move bug-regex5, bug-regex20, bug-regex33, tst-rfc3484, tst-rfc3484-2, and tst-rfc3484-3 to tests-internal. * stdlib/Makefile: Move tst-strtod1i, tst-strtod3, tst-strtod4, tst-strtod5i, tst-tls-atexit, and tst-tls-atexit-nodelete to tests-internal. * sysdeps/powerpc/Makefile: Move test-get_hwcap and test-get_hwcap-static to tests-internal. * sysdeps/unix/sysv/linux/Makefile: Move tst-setgetname to tests-internal. * sysdeps/x86_64/fpu/Makefile: Add all libmvec test modules to modules-names-tests. --- Makeconfig | 3 +- Makefile | 4 +- Makerules | 55 ++++++++++---- Rules | 18 ++--- benchtests/strcoll-inputs/filelist#en_US.UTF-8 | 1 - config.h.in | 11 --- elf/Makefile | 58 ++++++++------- elf/tst-env-setuid-tunables.c | 6 ++ extra-modules.mk | 9 --- include/errno.h | 2 +- include/libc-symbols.h | 62 +++++++++++----- include/math.h | 5 ++ include/stdio.h | 7 +- include/stdlib.h | 4 -- include/string.h | 10 +-- include/time.h | 4 -- include/unistd.h | 3 - include/wchar.h | 2 - inet/Makefile | 7 +- inet/tst-checks-posix.c | 1 - intl/tst-gettext2.c | 2 + malloc/Makefile | 6 +- math/test-signgam-finite-c99.c | 1 - math/test-signgam-main.c | 1 - misc/Makefile | 5 +- misc/sys/cdefs.h | 3 + nptl/Makefile | 31 ++++---- nss/Makefile | 4 +- posix/Makefile | 11 +-- stdlib/Makefile | 17 +++-- stdlib/tst-strtod.c | 64 +---------------- stdlib/tst-strtod1i.c | 83 +++++++++++++++++++++ stdlib/tst-strtod5.c | 74 +++++++++---------- stdlib/tst-strtod5i.c | 99 ++++++++++++++++++++++++++ string/test-string.h | 12 ++++ string/test-strstr.c | 1 + sysdeps/ia64/fpu/libm-symbols.h | 2 +- sysdeps/m68k/m680x0/fpu/bits/mathinline.h | 15 ++-- sysdeps/powerpc/Makefile | 2 +- sysdeps/unix/sysv/linux/Makefile | 3 +- sysdeps/x86_64/fpu/Makefile | 8 +++ sysdeps/x86_64/fpu/math-tests-arch.h | 8 +-- sysdeps/x86_64/multiarch/test-multiarch.c | 2 +- 43 files changed, 462 insertions(+), 264 deletions(-) delete mode 100644 extra-modules.mk create mode 100644 stdlib/tst-strtod1i.c create mode 100644 stdlib/tst-strtod5i.c diff --git a/Makeconfig b/Makeconfig index 1c815113b9..b494b82b40 100644 --- a/Makeconfig +++ b/Makeconfig @@ -908,7 +908,8 @@ libio-include = -I$(..)libio # List of non-library modules that we build. built-modules = iconvprogs iconvdata ldconfig lddlibc4 libmemusage \ libSegFault libpcprofile librpcsvc locale-programs \ - memusagestat nonlib nscd extramodules libnldbl libsupport + memusagestat nonlib nscd extramodules libnldbl libsupport \ + testsuite in-module = $(subst -,_,$(firstword $(libof-$(basename $(@F))) \ $(libof-$(<F)) \ diff --git a/Makefile b/Makefile index 425cb796db..0ce12e9377 100644 --- a/Makefile +++ b/Makefile @@ -321,7 +321,7 @@ endif ifneq "$(headers)" "" # Special test of all the installed headers in this directory. tests-special += $(objpfx)check-installed-headers-c.out -libof-check-installed-headers-c := nonlib +libof-check-installed-headers-c := testsuite $(objpfx)check-installed-headers-c.out: \ scripts/check-installed-headers.sh $(headers) $(SHELL) $(..)scripts/check-installed-headers.sh c \ @@ -331,7 +331,7 @@ $(objpfx)check-installed-headers-c.out: \ ifneq "$(CXX)" "" tests-special += $(objpfx)check-installed-headers-cxx.out -libof-check-installed-headers-cxx := nonlib +libof-check-installed-headers-cxx := testsuite $(objpfx)check-installed-headers-cxx.out: \ scripts/check-installed-headers.sh $(headers) $(SHELL) $(..)scripts/check-installed-headers.sh c++ \ diff --git a/Makerules b/Makerules index 7f0eef8096..6fb7248983 100644 --- a/Makerules +++ b/Makerules @@ -277,7 +277,7 @@ $(common-objpfx)%.h $(common-objpfx)%.h.d: $(..)scripts/gen-as-const.awk \ vpath %.sym $(sysdirs) before-compile += $(gen-as-const-headers:%.sym=$(common-objpfx)%.h) -tests += $(gen-as-const-headers:%.sym=test-as-const-%) +tests-internal += $(gen-as-const-headers:%.sym=test-as-const-%) generated += $(gen-as-const-headers:%.sym=test-as-const-%.c) $(objpfx)test-as-const-%.c: $(..)scripts/gen-as-const.awk $(..)Makerules \ %.sym $(common-objpfx)%.h @@ -793,12 +793,21 @@ endif # The makefile may define $(modules-names) to build additional modules. # These are built with $(build-module), except any in $(modules-names-nobuild). +# MODULE_NAME=extramodules, except any in $(modules-names-tests). ifdef modules-names -# extra-lib.mk is included once for each extra lib to define rules -# to build it, and to add its objects to the various variables. -# During its evaluation, $(lib) is set to the name of the library. -extra-modules-left := $(modules-names) -include $(patsubst %,$(..)extra-modules.mk,$(modules-names)) +cpp-srcs-left := $(filter-out $(modules-names-tests),$(modules-names)) +ifneq (,$(cpp-srcs-left)) +lib := extramodules +include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left)) +endif + +ifdef modules-names-tests +cpp-srcs-left := $(filter $(modules-names-tests),$(modules-names)) +ifneq (,$(cpp-srcs-left)) +lib := testsuite +include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left)) +endif +endif extra-modules-build := $(filter-out $(modules-names-nobuild),$(modules-names)) $(extra-modules-build:%=$(objpfx)%.so): $(objpfx)%.so: \ @@ -810,7 +819,7 @@ endif $(patsubst %.o,%.d,$(filter %.o,$(extra-objs:.os=.o))) \ $(patsubst %.oS,%.d,$(filter %.oS,$(extra-objs))) \ $(patsubst %.o,%.d,$(filter %.o,$(extra-test-objs:.os=.o))) \ - $(addsuffix .d,$(tests) $(xtests) $(test-srcs)) + $(addsuffix .d,$(tests) $(tests-internal) $(xtests) $(test-srcs)) ifeq ($(build-programs),yes) +depfiles += $(addsuffix .d,$(others) $(sysdep-others)) endif @@ -1323,7 +1332,17 @@ check: tests .PHONY: xcheck xcheck: xtests -all-nonlib = $(strip $(tests) $(xtests) $(test-srcs) $(test-extras) $(others)) +# The only difference between MODULE_NAME=testsuite and MODULE_NAME=nonlib is +# that almost all internal declarations from config.h, libc-symbols.h, and +# include/*.h are not available to 'testsuite' code, but are to 'nonlib' code. +all-testsuite := $(strip $(tests) $(xtests) $(test-srcs) $(test-extras)) +ifneq (,$(all-testsuite)) +cpp-srcs-left = $(all-testsuite) +lib := testsuite +include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left)) +endif + +all-nonlib := $(strip $(tests-internal) $(test-internal-extras) $(others)) ifneq (,$(all-nonlib)) cpp-srcs-left = $(all-nonlib) lib := nonlib @@ -1537,22 +1556,32 @@ clean: common-clean mostlyclean: common-mostlyclean do-tests-clean: - -rm -f $(addprefix $(objpfx),$(addsuffix .out,$(tests) $(xtests) \ + -rm -f $(addprefix $(objpfx),$(addsuffix .out,$(tests) \ + $(tests-internal) \ + $(xtests) \ $(test-srcs)) \ $(addsuffix .test-result,$(tests) \ + $(tests-internal) \ $(xtests) \ $(test-srcs))) # Remove the object files. common-mostlyclean: - -rm -f $(addprefix $(objpfx),$(tests) $(xtests) $(test-srcs) \ + -rm -f $(addprefix $(objpfx),$(tests) $(tests-internal) $(xtests) \ + $(test-srcs) \ $(others) $(sysdep-others) stubs \ - $(addsuffix .o,$(tests) $(xtests) \ - $(test-srcs) $(others) \ + $(addsuffix .o,$(tests) \ + $(tests-internal) \ + $(xtests) \ + $(test-srcs) \ + $(others) \ $(sysdep-others)) \ - $(addsuffix .out,$(tests) $(xtests) \ + $(addsuffix .out,$(tests) \ + $(tests-internal) \ + $(xtests) \ $(test-srcs)) \ $(addsuffix .test-result,$(tests) \ + $(tests-internal) \ $(xtests) \ $(test-srcs))) -rm -f $(addprefix $(objpfx),$(extra-objs) $(extra-test-objs) \ diff --git a/Rules b/Rules index 917bc969b5..168cf508d7 100644 --- a/Rules +++ b/Rules @@ -84,7 +84,7 @@ common-generated += dummy.o dummy.c ifneq "$(headers)" "" # Special test of all the installed headers in this directory. tests-special += $(objpfx)check-installed-headers-c.out -libof-check-installed-headers-c := nonlib +libof-check-installed-headers-c := testsuite $(objpfx)check-installed-headers-c.out: \ $(..)scripts/check-installed-headers.sh $(headers) $(SHELL) $(..)scripts/check-installed-headers.sh c \ @@ -94,7 +94,7 @@ $(objpfx)check-installed-headers-c.out: \ ifneq "$(CXX)" "" tests-special += $(objpfx)check-installed-headers-cxx.out -libof-check-installed-headers-cxx := nonlib +libof-check-installed-headers-cxx := testsuite $(objpfx)check-installed-headers-cxx.out: \ $(..)scripts/check-installed-headers.sh $(headers) $(SHELL) $(..)scripts/check-installed-headers.sh c++ \ @@ -129,12 +129,14 @@ endif others: $(py-const) ifeq ($(run-built-tests),no) -tests: $(addprefix $(objpfx),$(filter-out $(tests-unsupported),$(tests)) \ +tests: $(addprefix $(objpfx),$(filter-out $(tests-unsupported), \ + $(tests) $(tests-internal)) \ $(test-srcs)) $(tests-special) \ $(tests-printers-programs) xtests: tests $(xtests-special) else -tests: $(tests:%=$(objpfx)%.out) $(tests-special) $(tests-printers-out) +tests: $(tests:%=$(objpfx)%.out) $(tests-internal:%=$(objpfx)%.out) \ + $(tests-special) $(tests-printers-out) xtests: tests $(xtests:%=$(objpfx)%.out) $(xtests-special) endif @@ -143,7 +145,7 @@ xtests-special-notdir = $(patsubst $(objpfx)%, %, $(xtests-special)) ifeq ($(run-built-tests),no) tests-expected = else -tests-expected = $(tests) $(tests-printers) +tests-expected = $(tests) $(tests-internal) $(tests-printers) endif tests: $(..)scripts/merge-test-results.sh -s $(objpfx) $(subdir) \ @@ -156,7 +158,7 @@ xtests: ifeq ($(build-programs),yes) binaries-all-notests = $(others) $(sysdep-others) -binaries-all-tests = $(tests) $(xtests) $(test-srcs) +binaries-all-tests = $(tests) $(tests-internal) $(xtests) $(test-srcs) binaries-all = $(binaries-all-notests) $(binaries-all-tests) binaries-static-notests = $(others-static) binaries-static-tests = $(tests-static) $(xtests-static) @@ -170,7 +172,7 @@ binaries-pie-notests = endif else binaries-all-notests = -binaries-all-tests = $(tests) $(xtests) $(test-srcs) +binaries-all-tests = $(tests) $(tests-internal) $(xtests) $(test-srcs) binaries-all = $(binaries-all-tests) binaries-static-notests = binaries-static-tests = @@ -230,7 +232,7 @@ $(addprefix $(objpfx),$(binaries-static-tests)): %: %.o \ $(+link-static-tests) endif -ifneq "$(strip $(tests) $(xtests) $(test-srcs))" "" +ifneq "$(strip $(tests) $(tests-internal) $(xtests) $(test-srcs))" "" # These are the implicit rules for making test outputs # from the test programs and whatever input files are present. diff --git a/benchtests/strcoll-inputs/filelist#en_US.UTF-8 b/benchtests/strcoll-inputs/filelist#en_US.UTF-8 index b7b38017d8..eb23b47484 100644 --- a/benchtests/strcoll-inputs/filelist#en_US.UTF-8 +++ b/benchtests/strcoll-inputs/filelist#en_US.UTF-8 @@ -9667,7 +9667,6 @@ hr.po libc.pot ko.po ru.po -extra-modules.mk intl tst-gettext4-fr.po tstcodeset.po diff --git a/config.h.in b/config.h.in index fb2cc51c03..50f03c0cd8 100644 --- a/config.h.in +++ b/config.h.in @@ -1,14 +1,3 @@ -#if !defined IS_IN_build && !defined __ASSEMBLER__ && !defined _ISOMAC \ - && !defined __OPTIMIZE__ -# error "glibc cannot be compiled without optimization" -#endif - -/* Another evil option when it comes to compiling the C library is - --ffast-math since it alters the ABI. */ -#if defined __FAST_MATH__ && !defined TEST_FAST_MATH -# error "glibc must not be compiled with -ffast-math" -#endif - /* Define if building with SELinux support. Set by --with-selinux. */ #undef HAVE_SELINUX diff --git a/elf/Makefile b/elf/Makefile index cc4aeb25b6..eae247a4fc 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -142,43 +142,49 @@ $(inst_auditdir)/sotruss-lib.so: $(objpfx)sotruss-lib.so $(+force) $(do-install-program) endif -tests = tst-tls1 tst-tls2 tst-tls9 tst-leaks1 \ - tst-array1 tst-array2 tst-array3 tst-array4 tst-array5 \ - tst-auxv -tests-static = tst-tls1-static tst-tls2-static tst-stackguard1-static \ - tst-leaks1-static tst-array1-static tst-array5-static \ - tst-ptrguard1-static tst-dl-iter-static \ +tests-static-normal := tst-leaks1-static tst-array1-static tst-array5-static \ + tst-dl-iter-static \ tst-tlsalign-static tst-tlsalign-extern-static \ tst-linkall-static tst-env-setuid tst-env-setuid-tunables +tests-static-internal := tst-tls1-static tst-tls2-static \ + tst-ptrguard1-static tst-stackguard1-static + +tests := tst-tls9 tst-leaks1 \ + tst-array1 tst-array2 tst-array3 tst-array4 tst-array5 \ + tst-auxv +tests-internal := tst-tls1 tst-tls2 $(tests-static-internal) +tests-static := $(tests-static-normal) $(tests-static-internal) + ifeq (yes,$(build-shared)) tests-static += tst-tls9-static tst-tls9-static-ENV = \ LD_LIBRARY_PATH=$(objpfx):$(common-objpfx):$(common-objpfx)dlfcn -endif -tests += $(tests-static) -ifeq (yes,$(build-shared)) -tests += loadtest restest1 preloadtest loadfail multiload origtest resolvfail \ - constload1 order noload filter unload \ + +tests += restest1 preloadtest loadfail multiload origtest resolvfail \ + constload1 order noload filter \ reldep reldep2 reldep3 reldep4 nodelete nodelete2 \ - nodlopen nodlopen2 neededtest neededtest2 \ - neededtest3 neededtest4 unload2 lateglobal initfirst global \ + nodlopen nodlopen2 lateglobal initfirst global \ restest2 next dblload dblunload reldep5 reldep6 reldep7 reldep8 \ - circleload1 tst-tls3 tst-tls4 tst-tls5 tst-tls6 tst-tls7 tst-tls8 \ + tst-tls4 tst-tls5 \ tst-tls10 tst-tls11 tst-tls12 tst-tls13 tst-tls14 tst-tls15 \ tst-tls16 tst-tls17 tst-tls18 tst-tls19 tst-tls-dlinfo \ tst-align tst-align2 $(tests-execstack-$(have-z-execstack)) \ tst-dlmodcount tst-dlopenrpath tst-deep1 \ - tst-dlmopen1 tst-dlmopen2 tst-dlmopen3 \ + tst-dlmopen1 tst-dlmopen3 \ unload3 unload4 unload5 unload6 unload7 unload8 tst-global1 order2 \ tst-audit1 tst-audit2 tst-audit8 tst-audit9 \ - tst-stackguard1 tst-addr1 tst-thrlock \ + tst-addr1 tst-thrlock \ tst-unique1 tst-unique2 $(if $(CXX),tst-unique3 tst-unique4 \ tst-nodelete) \ tst-initorder tst-initorder2 tst-relsort1 tst-null-argv \ - tst-ptrguard1 tst-tlsalign tst-tlsalign-extern tst-nodelete-opened \ + tst-tlsalign tst-tlsalign-extern tst-nodelete-opened \ tst-nodelete2 tst-audit11 tst-audit12 tst-dlsym-error tst-noload \ tst-latepthread tst-tls-manydynamic tst-nodelete-dlclose # reldep9 +tests-internal += loadtest unload unload2 circleload1 \ + neededtest neededtest2 neededtest3 neededtest4 \ + tst-tls3 tst-tls6 tst-tls7 tst-tls8 tst-dlmopen2 \ + tst-ptrguard1 tst-stackguard1 ifeq ($(build-hardcoded-path-in-tests),yes) tests += tst-dlopen-aout LDFLAGS-tst-dlopen-aout = $(no-pie-ldflag) @@ -289,21 +295,23 @@ CFLAGS-vismain.c = $(PIE-ccflag) endif modules-execstack-yes = tst-execstack-mod extra-test-objs += $(addsuffix .os,$(strip $(modules-names))) -# We need this variable to be sure the test modules get the right CPPFLAGS. -test-extras += $(modules-names) # filtmod1.so has a special rule modules-names-nobuild := filtmod1 +tests += $(tests-static) + ifneq (no,$(multi-arch)) -tests-static += ifuncmain1static ifuncmain1picstatic \ +tests-ifuncstatic := ifuncmain1static ifuncmain1picstatic \ ifuncmain2static ifuncmain2picstatic \ ifuncmain4static ifuncmain4picstatic \ ifuncmain5static ifuncmain5picstatic \ ifuncmain7static ifuncmain7picstatic - +tests-static += $(tests-ifuncstatic) +tests-internal += $(tests-ifuncstatic) ifeq (yes,$(build-shared)) -tests += ifuncmain1 ifuncmain1pic ifuncmain1vis ifuncmain1vispic \ +tests-internal += \ + ifuncmain1 ifuncmain1pic ifuncmain1vis ifuncmain1vispic \ ifuncmain1staticpic \ ifuncmain2 ifuncmain2pic ifuncmain3 ifuncmain4 \ ifuncmain5 ifuncmain5pic ifuncmain5staticpic \ @@ -311,11 +319,11 @@ tests += ifuncmain1 ifuncmain1pic ifuncmain1vis ifuncmain1vispic \ ifunc-test-modules = ifuncdep1 ifuncdep1pic ifuncdep2 ifuncdep2pic \ ifuncdep5 ifuncdep5pic extra-test-objs += $(ifunc-test-modules:=.o) -test-extras += $(ifunc-test-modules) +test-internal-extras += $(ifunc-test-modules) ifeq (yes,$(have-fpie)) ifunc-pie-tests = ifuncmain1pie ifuncmain1vispie ifuncmain1staticpie \ ifuncmain5pie ifuncmain6pie ifuncmain7pie -tests += $(ifunc-pie-tests) +tests-internal += $(ifunc-pie-tests) tests-pie += $(ifunc-pie-tests) endif modules-names += ifuncmod1 ifuncmod3 ifuncmod5 ifuncmod6 @@ -357,7 +365,7 @@ endif # unit test driver must be able to link with the shared object # that is going to eventually go into an installed DSO. ifeq (yesyes,$(have-fpie)$(build-shared)) -tests += tst-_dl_addr_inside_object +tests-internal += tst-_dl_addr_inside_object tests-pie += tst-_dl_addr_inside_object $(objpfx)tst-_dl_addr_inside_object: $(objpfx)dl-addr-obj.os CFLAGS-tst-_dl_addr_inside_object.c += $(PIE-ccflag) diff --git a/elf/tst-env-setuid-tunables.c b/elf/tst-env-setuid-tunables.c index a5f0a81ef3..afcb146e6d 100644 --- a/elf/tst-env-setuid-tunables.c +++ b/elf/tst-env-setuid-tunables.c @@ -19,6 +19,12 @@ glibc.malloc.check and glibc.malloc.mmap_threshold but also retain glibc.malloc.mmap_threshold in an unprivileged child. */ +/* This is compiled as part of the testsuite but needs to see + HAVE_TUNABLES. */ +#define _LIBC 1 +#include "config.h" +#undef _LIBC + #define test_parent test_parent_tunables #define test_child test_child_tunables diff --git a/extra-modules.mk b/extra-modules.mk deleted file mode 100644 index 5f8e693b15..0000000000 --- a/extra-modules.mk +++ /dev/null @@ -1,9 +0,0 @@ -# This file is included several times in a row, once -# for each element of $(modules-names). $(extra-modules-left) -# is initialized first to $(modules-names) so that with each -# inclusion, we advance $(module) to the next name. - -module := $(firstword $(extra-modules-left)) -extra-modules-left := $(filter-out $(module),$(extra-modules-left)) - -libof-$(notdir $(module)) := extramodules diff --git a/include/errno.h b/include/errno.h index 7df41dfc31..73fc32e5e0 100644 --- a/include/errno.h +++ b/include/errno.h @@ -2,7 +2,7 @@ #include <stdlib/errno.h> -#if defined _ERRNO_H && !defined _ISOMAC && !defined __cplusplus +#if defined _ERRNO_H && !defined _ISOMAC # if IS_IN (rtld) # include <dl-sysdep.h> diff --git a/include/libc-symbols.h b/include/libc-symbols.h index 775d8af84e..922e4b638c 100644 --- a/include/libc-symbols.h +++ b/include/libc-symbols.h @@ -20,26 +20,46 @@ #ifndef _LIBC_SYMBOLS_H #define _LIBC_SYMBOLS_H 1 -#define IN_MODULE PASTE_NAME (MODULE_, MODULE_NAME) -#define IS_IN(lib) (IN_MODULE == MODULE_##lib) +/* This file is included implicitly in the compilation of every source file, + using -include. It includes config.h. */ -/* Returns true if the current module is a versioned library. Versioned - library names culled from shlib-versions files are assigned a MODULE_* - value lower than MODULE_LIBS_BEGIN. */ -#define IS_IN_LIB (IN_MODULE > MODULE_LIBS_BEGIN) +/* Enable declarations of GNU extensions, since we are compiling them. */ +#define _GNU_SOURCE 1 -#define PASTE_NAME(a,b) PASTE_NAME1 (a,b) -#define PASTE_NAME1(a,b) a##b +#ifdef MODULE_NAME -/* This file's macros are included implicitly in the compilation of every - file in the C library by -imacros. +/* Use `#if IS_IN (module)` to detect what component is being compiled. */ +#define PASTE_NAME1(a,b) a##b +#define PASTE_NAME(a,b) PASTE_NAME1 (a,b) +#define IN_MODULE PASTE_NAME (MODULE_, MODULE_NAME) +#define IS_IN(lib) (IN_MODULE == MODULE_##lib) - We include config.h which is generated by configure. - It should define for us the following symbol: +/* True if the current module is a versioned library. Versioned + library names culled from shlib-versions files are assigned a + MODULE_* value greater than MODULE_LIBS_BEGIN. */ +#define IS_IN_LIB (IN_MODULE > MODULE_LIBS_BEGIN) - * HAVE_ASM_SET_DIRECTIVE if we have `.set B, A' instead of `A = B'. +/* The testsuite, and some other ancillary code, should be compiled against + as close an approximation to the installed headers as possible. + Defining this symbol disables most internal-use-only declarations + provided by this header, and all those provided by other internal + wrapper headers. */ +#if IS_IN (testsuite) || defined IS_IN_build || defined __cplusplus +# define _ISOMAC 1 +#endif - */ +#else +/* The generation process for a few files created very early in the + build (notably libc-modules.h itself) involves preprocessing this + header without defining MODULE_NAME. Under these conditions, + internal declarations (especially from config.h) must be visible, + but IS_IN should always evaluate as false. */ +# define IS_IN(lib) 0 +# define IS_IN_LIB 0 +# define IN_MODULE (-1) +#endif + +#ifndef _ISOMAC /* This is defined for the compilation of all C library code. features.h tests this to avoid inclusion of stubs.h while compiling the library, @@ -50,8 +70,17 @@ itself is being compiled, or just some generator program. */ #define _LIBC 1 -/* Enable declarations of GNU extensions, since we are compiling them. */ -#define _GNU_SOURCE 1 +/* Some files must be compiled with optimization on. */ +#if !defined __ASSEMBLER__ && !defined __OPTIMIZE__ +# error "glibc cannot be compiled without optimization" +#endif + +/* -ffast-math cannot be applied to the C library, as it alters the ABI. + Some test components that use -ffast-math are currently not part of + IS_IN (testsuite) for technical reasons, so we have a secondary override. */ +#if defined __FAST_MATH__ && !defined TEST_FAST_MATH +# error "glibc must not be compiled with -ffast-math" +#endif #include <config.h> @@ -887,4 +916,5 @@ for linking") # define inhibit_loop_to_libcall #endif +#endif /* !_ISOMAC */ #endif /* libc-symbols.h */ diff --git a/include/math.h b/include/math.h index a4f556263a..6ff67830f8 100644 --- a/include/math.h +++ b/include/math.h @@ -1,5 +1,10 @@ #ifndef _MATH_H +#ifdef _ISOMAC +# undef NO_LONG_DOUBLE +# undef _Mlong_double_ +#endif + #include <math/math.h> #ifndef _ISOMAC diff --git a/include/stdio.h b/include/stdio.h index 17b5a05076..ad0d0f0027 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -1,11 +1,10 @@ #ifndef _STDIO_H -# if defined __need_FILE || defined __need___FILE || defined _ISOMAC +# if defined _ISOMAC || defined __need_FILE || defined __need___FILE # include <libio/stdio.h> # else # include <libio/stdio.h> /* Now define the internal interfaces. */ -__BEGIN_DECLS extern int __fcloseall (void); extern int __snprintf (char *__restrict __s, size_t __maxlen, @@ -30,7 +29,6 @@ extern int __vsscanf (const char *__restrict __s, _G_va_list __arg) __attribute__ ((__format__ (__scanf__, 2, 0))); -# ifndef __cplusplus extern int __sprintf_chk (char *, int, size_t, const char *, ...) __THROW; extern int __snprintf_chk (char *, size_t, int, size_t, const char *, ...) __THROW; @@ -52,7 +50,6 @@ extern int __obstack_printf_chk (struct obstack *, int, const char *, ...) __THROW; extern int __obstack_vprintf_chk (struct obstack *, int, const char *, _G_va_list) __THROW; -# endif extern int __isoc99_fscanf (FILE *__restrict __stream, const char *__restrict __format, ...) __wur; @@ -184,7 +181,5 @@ libc_hidden_proto (__obstack_vprintf_chk) extern FILE * __fmemopen (void *buf, size_t len, const char *mode); libc_hidden_proto (__fmemopen) -__END_DECLS # endif - #endif diff --git a/include/stdlib.h b/include/stdlib.h index 352339e859..8039876017 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -13,8 +13,6 @@ #if !defined __Need_M_And_C && !defined _ISOMAC # include <sys/stat.h> -__BEGIN_DECLS - extern __typeof (strtol_l) __strtol_l; extern __typeof (strtoul_l) __strtoul_l; extern __typeof (strtoll_l) __strtoll_l; @@ -265,8 +263,6 @@ extern __typeof (unsetenv) unsetenv attribute_hidden; extern __typeof (__strtoul_internal) __strtoul_internal attribute_hidden; # endif -__END_DECLS - #endif #undef __Need_M_And_C diff --git a/include/string.h b/include/string.h index f166de9c43..ce71674086 100644 --- a/include/string.h +++ b/include/string.h @@ -1,6 +1,8 @@ #ifndef _STRING_H -#if !defined _ISOMAC && !defined __cplusplus +#ifndef _ISOMAC +/* Some of these are defined as macros in the real string.h, so we must + prototype them before including it. */ #include <sys/types.h> extern void *__memccpy (void *__dest, const void *__src, @@ -46,16 +48,14 @@ extern void __bzero (void *__s, size_t __n) __THROW __nonnull ((1)); extern int __ffs (int __i) __attribute__ ((const)); extern char *__strerror_r (int __errnum, char *__buf, size_t __buflen); -#endif /* Get _STRING_ARCH_unaligned. */ #include <string_private.h> +#endif -/* Now the real definitions. We do this here since some of the functions - above are defined as macros in the headers. */ #include <string/string.h> -#if !defined _ISOMAC && !defined __cplusplus +#ifndef _ISOMAC extern __typeof (strcoll_l) __strcoll_l; extern __typeof (strxfrm_l) __strxfrm_l; extern __typeof (strcasecmp_l) __strcasecmp_l; diff --git a/include/time.h b/include/time.h index 6badf0e557..3a828e0420 100644 --- a/include/time.h +++ b/include/time.h @@ -4,8 +4,6 @@ #ifndef _ISOMAC # include <xlocale.h> -__BEGIN_DECLS - extern __typeof (strftime_l) __strftime_l; libc_hidden_proto (__strftime_l) extern __typeof (strptime_l) __strptime_l; @@ -104,7 +102,5 @@ extern double __difftime (time_t time1, time_t time0); actual clock ID. */ #define CLOCK_IDFIELD_SIZE 3 -__END_DECLS - #endif #endif diff --git a/include/unistd.h b/include/unistd.h index 16d68a1505..fbcea1b92d 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -2,7 +2,6 @@ # include <posix/unistd.h> # ifndef _ISOMAC -__BEGIN_DECLS libc_hidden_proto (_exit, __noreturn__) rtld_hidden_proto (_exit, __noreturn__) @@ -188,7 +187,5 @@ extern int __getlogin_r_loginuid (char *name, size_t namesize) extern __typeof (__access) __access_noerrno attribute_hidden; # endif -__END_DECLS # endif - #endif diff --git a/include/wchar.h b/include/wchar.h index 6272130e24..e2579a176a 100644 --- a/include/wchar.h +++ b/include/wchar.h @@ -172,7 +172,6 @@ extern int __vfwprintf (__FILE *__restrict __s, const wchar_t *__restrict __format, __gnuc_va_list __arg) /* __attribute__ ((__format__ (__wprintf__, 2, 0))) */; -#ifndef __cplusplus extern int __vfwprintf_chk (FILE *__restrict __s, int __flag, const wchar_t *__restrict __format, __gnuc_va_list __arg) @@ -184,7 +183,6 @@ extern int __vswprintf_chk (wchar_t *__restrict __s, size_t __n, /* __attribute__ ((__format__ (__wprintf__, 5, 0))) */; libc_hidden_proto (__vfwprintf_chk) libc_hidden_proto (__vswprintf_chk) -#endif extern int __isoc99_fwscanf (__FILE *__restrict __stream, const wchar_t *__restrict __format, ...); diff --git a/inet/Makefile b/inet/Makefile index 6a7d3e0664..38c61bdc61 100644 --- a/inet/Makefile +++ b/inet/Makefile @@ -52,11 +52,16 @@ aux := check_pf check_native ifreq tests := htontest test_ifindex tst-ntoa tst-ether_aton tst-network \ tst-gethnm test-ifaddrs bug-if1 test-inet6_opt tst-ether_line \ tst-getni1 tst-getni2 tst-inet6_rth tst-checks tst-checks-posix \ - tst-sockaddr tst-inet6_scopeid_pton test-hnto-types tst-deadline + tst-sockaddr test-hnto-types # tst-deadline must be linked statically so that we can access # internal functions. tests-static += tst-deadline +tests-static-internal := tst-deadline + +# tst-inet6_scopeid_pton also needs internal functions but does not +# need to be linked statically. +tests-internal := tst-inet6_scopeid_pton include ../Rules diff --git a/inet/tst-checks-posix.c b/inet/tst-checks-posix.c index e46b6a2a69..cdcb5cb3aa 100644 --- a/inet/tst-checks-posix.c +++ b/inet/tst-checks-posix.c @@ -19,6 +19,5 @@ /* Process tst-checks.c in POSIX mode. */ #undef _GNU_SOURCE #define _POSIX_C_SOURCE 200112L -#define _ISOMAC #include "tst-checks.c" diff --git a/intl/tst-gettext2.c b/intl/tst-gettext2.c index bdfe76de66..894e09e41e 100644 --- a/intl/tst-gettext2.c +++ b/intl/tst-gettext2.c @@ -24,6 +24,8 @@ #include <stdlib.h> #include <stdio.h> +#define N_(msgid) msgid + struct data_t { const char *selection; diff --git a/malloc/Makefile b/malloc/Makefile index e93b83b57d..ca83228b1c 100644 --- a/malloc/Makefile +++ b/malloc/Makefile @@ -25,9 +25,9 @@ include ../Makeconfig dist-headers := malloc.h headers := $(dist-headers) obstack.h mcheck.h tests := mallocbug tst-malloc tst-valloc tst-calloc tst-obstack \ - tst-mallocstate tst-mcheck tst-mallocfork tst-trim1 \ + tst-mcheck tst-mallocfork tst-trim1 \ tst-malloc-usable tst-realloc tst-posix_memalign \ - tst-pvalloc tst-memalign tst-mallopt tst-scratch_buffer \ + tst-pvalloc tst-memalign tst-mallopt \ tst-malloc-backtrace tst-malloc-thread-exit \ tst-malloc-thread-fail tst-malloc-fork-deadlock \ tst-mallocfork2 \ @@ -39,6 +39,8 @@ tests-static := \ tst-interpose-static-thread \ tst-malloc-usable-static \ +tests-internal := tst-mallocstate tst-scratch_buffer + ifneq (no,$(have-tunables)) tests += tst-malloc-usable-tunables tests-static += tst-malloc-usable-static-tunables diff --git a/math/test-signgam-finite-c99.c b/math/test-signgam-finite-c99.c index a67a803c99..3dacef5147 100644 --- a/math/test-signgam-finite-c99.c +++ b/math/test-signgam-finite-c99.c @@ -20,7 +20,6 @@ #undef __LIBC_INTERNAL_MATH_INLINES #undef _GNU_SOURCE #undef _Mlong_double_ -#define _ISOMAC #include <math.h> #include <stdio.h> diff --git a/math/test-signgam-main.c b/math/test-signgam-main.c index 11ebbe3628..e3cecf7fa1 100644 --- a/math/test-signgam-main.c +++ b/math/test-signgam-main.c @@ -19,7 +19,6 @@ #undef _LIBC #undef __LIBC_INTERNAL_MATH_INLINES #undef _GNU_SOURCE -#define _ISOMAC #include <math.h> #include <stdio.h> diff --git a/misc/Makefile b/misc/Makefile index ed988c3967..bd88253c26 100644 --- a/misc/Makefile +++ b/misc/Makefile @@ -79,8 +79,9 @@ gpl2lgpl := error.c error.h tests := tst-dirname tst-tsearch tst-fdset tst-efgcvt tst-mntent tst-hsearch \ tst-error1 tst-pselect tst-insremque tst-mntent2 bug-hsearch1 \ tst-mntent-blank-corrupt tst-mntent-blank-passno bug18240 \ - tst-preadvwritev tst-preadvwritev64 tst-makedev tst-empty \ - tst-atomic tst-atomic-long + tst-preadvwritev tst-preadvwritev64 tst-makedev tst-empty + +tests-internal := tst-atomic tst-atomic-long tests-static := tst-empty ifeq ($(run-built-tests),yes) diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h index e5fe4f89d9..39c91e1225 100644 --- a/misc/sys/cdefs.h +++ b/misc/sys/cdefs.h @@ -55,15 +55,18 @@ # define __THROW __attribute__ ((__nothrow__ __LEAF)) # define __THROWNL __attribute__ ((__nothrow__)) # define __NTH(fct) __attribute__ ((__nothrow__ __LEAF)) fct +# define __NTHNL(fct) __attribute__ ((__nothrow__)) fct # else # if defined __cplusplus && __GNUC_PREREQ (2,8) # define __THROW throw () # define __THROWNL throw () # define __NTH(fct) __LEAF_ATTR fct throw () +# define __NTHNL(fct) fct throw () # else # define __THROW # define __THROWNL # define __NTH(fct) fct +# define __NTHNL(fct) fct # endif # endif diff --git a/nptl/Makefile b/nptl/Makefile index 6d48c0cfc8..edffb66272 100644 --- a/nptl/Makefile +++ b/nptl/Makefile @@ -220,8 +220,7 @@ LDLIBS-tst-once5 = -lstdc++ CFLAGS-tst-thread_local1.o = -std=gnu++11 LDLIBS-tst-thread_local1 = -lstdc++ -tests = tst-typesizes \ - tst-attr1 tst-attr2 tst-attr3 tst-default-attr \ +tests = tst-attr1 tst-attr2 tst-attr3 tst-default-attr \ tst-mutex1 tst-mutex2 tst-mutex3 tst-mutex4 tst-mutex5 tst-mutex6 \ tst-mutex7 tst-mutex8 tst-mutex9 tst-mutex5a tst-mutex7a \ tst-mutexpi1 tst-mutexpi2 tst-mutexpi3 tst-mutexpi4 tst-mutexpi5 \ @@ -241,13 +240,12 @@ tests = tst-typesizes \ tst-rwlock4 tst-rwlock5 tst-rwlock6 tst-rwlock7 tst-rwlock8 \ tst-rwlock9 tst-rwlock10 tst-rwlock11 tst-rwlock12 tst-rwlock13 \ tst-rwlock14 tst-rwlock15 tst-rwlock16 tst-rwlock17 tst-rwlock18 \ - tst-rwlock19 \ tst-once1 tst-once2 tst-once3 tst-once4 tst-once5 \ tst-key1 tst-key2 tst-key3 tst-key4 \ tst-sem1 tst-sem2 tst-sem3 tst-sem4 tst-sem5 tst-sem6 tst-sem7 \ - tst-sem8 tst-sem9 tst-sem10 tst-sem11 tst-sem12 tst-sem13 tst-sem14 \ + tst-sem8 tst-sem9 tst-sem10 tst-sem14 \ tst-sem15 tst-sem16 \ - tst-barrier1 tst-barrier2 tst-barrier3 tst-barrier4 tst-barrier5 \ + tst-barrier1 tst-barrier2 tst-barrier3 tst-barrier4 \ tst-align tst-align3 \ tst-basic1 tst-basic2 tst-basic3 tst-basic4 tst-basic5 tst-basic6 \ tst-basic7 \ @@ -272,7 +270,7 @@ tests = tst-typesizes \ tst-cleanup0 tst-cleanup1 tst-cleanup2 tst-cleanup3 tst-cleanup4 \ tst-flock1 tst-flock2 \ tst-signal1 tst-signal2 tst-signal3 tst-signal4 tst-signal5 \ - tst-signal6 tst-signal7 \ + tst-signal6 \ tst-exec1 tst-exec2 tst-exec3 tst-exec4 tst-exec5 \ tst-exit1 tst-exit2 tst-exit3 \ tst-stdio1 tst-stdio2 \ @@ -297,6 +295,10 @@ tests = tst-typesizes \ tst-bad-schedattr \ tst-thread_local1 tst-mutex-errorcheck tst-robust10 \ tst-robust-fork tst-create-detached + +tests-internal := tst-typesizes tst-rwlock19 tst-sem11 tst-sem12 tst-sem13 \ + tst-barrier5 tst-signal7 + xtests = tst-setuid1 tst-setuid1-static tst-setuid2 \ tst-mutexpp1 tst-mutexpp6 tst-mutexpp10 test-srcs = tst-oddstacklimit @@ -354,8 +356,8 @@ tests += tst-cancelx2 tst-cancelx3 tst-cancelx4 tst-cancelx5 \ tst-cleanupx0 tst-cleanupx1 tst-cleanupx2 tst-cleanupx3 tst-cleanupx4 \ tst-oncex3 tst-oncex4 ifeq ($(build-shared),yes) -tests += tst-atfork2 tst-tls3 tst-tls3-malloc tst-tls4 tst-tls5 tst-_res1 \ - tst-fini1 tst-stackguard1 +tests += tst-atfork2 tst-tls4 tst-_res1 tst-fini1 +tests-internal += tst-tls3 tst-tls3-malloc tst-tls5 tst-stackguard1 tests-nolibpthread += tst-fini1 ifeq ($(have-z-execstack),yes) tests += tst-execstack @@ -369,7 +371,7 @@ modules-names = tst-atfork2mod tst-tls3mod tst-tls4moda tst-tls4modb \ tst-join7mod extra-test-objs += $(addsuffix .os,$(strip $(modules-names))) \ tst-cleanup4aux.o tst-cleanupx4aux.o -test-extras += $(modules-names) tst-cleanup4aux tst-cleanupx4aux +test-extras += tst-cleanup4aux tst-cleanupx4aux test-modules = $(addprefix $(objpfx),$(addsuffix .so,$(modules-names))) tst-atfork2mod.so-no-z-defs = yes @@ -422,9 +424,9 @@ tests-static += tst-locale1 tst-locale2 tst-stackguard1-static \ tst-cancel21-static tst-cancel24-static tst-cond8-static \ tst-mutex8-static tst-mutexpi8-static tst-sem11-static \ tst-sem12-static -tests += tst-stackguard1-static tst-cancel21-static tst-cancel24-static \ - tst-cond8-static tst-mutex8-static tst-mutexpi8-static \ - tst-sem11-static tst-sem12-static +tests += tst-cancel21-static tst-cancel24-static \ + tst-cond8-static tst-mutex8-static tst-mutexpi8-static +tests-internal += tst-sem11-static tst-sem12-static tst-stackguard1-static xtests-static += tst-setuid1-static # These tests are linked with libc before libpthread @@ -619,8 +621,9 @@ ifeq ($(build-shared),yes) $(addprefix $(objpfx), \ $(filter-out $(tests-static) $(xtests-static) $(tests-reverse) \ $(tests-nolibpthread), \ - $(tests) $(xtests) $(test-srcs))): $(objpfx)libpthread.so \ - $(objpfx)libpthread_nonshared.a + $(tests) $(tests-internal) $(xtests) $(test-srcs))): \ + $(objpfx)libpthread.so \ + $(objpfx)libpthread_nonshared.a $(objpfx)tst-unload: $(libdl) # $(objpfx)../libc.so is used instead of $(common-objpfx)libc.so, # since otherwise libpthread.so comes before libc.so when linking. diff --git a/nss/Makefile b/nss/Makefile index de6c47a1db..691c0c1bb2 100644 --- a/nss/Makefile +++ b/nss/Makefile @@ -49,9 +49,9 @@ makedb-modules = xmalloc hash-string extra-objs += $(makedb-modules:=.o) tests-static = tst-field +tests-internal = tst-field tests = test-netdb tst-nss-test1 test-digits-dots \ - tst-nss-getpwent bug17079 \ - $(tests-static) + tst-nss-getpwent bug17079 xtests = bug-erange # If we have a thread library then we can test cancellation against diff --git a/posix/Makefile b/posix/Makefile index ae17646323..73df8af152 100644 --- a/posix/Makefile +++ b/posix/Makefile @@ -67,24 +67,23 @@ tests := test-errno tstgetopt testfnm runtests runptests \ tst-mmap tst-mmap-offset tst-getaddrinfo tst-truncate \ tst-truncate64 tst-fork tst-fnmatch tst-regexloc tst-dir \ tst-chmod bug-regex1 bug-regex2 bug-regex3 bug-regex4 \ - tst-gnuglob tst-regex bug-regex5 bug-regex6 bug-regex7 \ + tst-gnuglob tst-regex bug-regex6 bug-regex7 \ bug-regex8 bug-regex9 bug-regex10 bug-regex11 bug-regex12 \ bug-regex13 bug-regex14 bug-regex15 bug-regex16 \ - bug-regex17 bug-regex18 bug-regex19 bug-regex20 \ + bug-regex17 bug-regex18 bug-regex19 \ bug-regex21 bug-regex22 bug-regex23 bug-regex24 \ bug-regex25 bug-regex26 bug-regex27 bug-regex28 \ bug-regex29 bug-regex30 bug-regex31 bug-regex32 \ - bug-regex33 tst-nice tst-nanosleep tst-regex2 \ + tst-nice tst-nanosleep tst-regex2 \ transbug tst-rxspencer tst-pcre tst-boost \ bug-ga1 tst-vfork1 tst-vfork2 tst-vfork3 tst-waitid \ tst-getaddrinfo2 bug-glob1 bug-glob2 bug-glob3 tst-sysconf \ tst-execvp1 tst-execvp2 tst-execlp1 tst-execlp2 \ tst-execv1 tst-execv2 tst-execl1 tst-execl2 \ tst-execve1 tst-execve2 tst-execle1 tst-execle2 \ - tst-execvp3 tst-execvp4 tst-rfc3484 tst-rfc3484-2 \ + tst-execvp3 tst-execvp4 \ tst-execvpe1 tst-execvpe2 tst-execvpe3 tst-execvpe4 \ tst-execvpe5 tst-execvpe6 \ - tst-rfc3484-3 \ tst-getaddrinfo3 tst-fnmatch2 tst-cpucount tst-cpuset \ bug-getopt1 bug-getopt2 bug-getopt3 bug-getopt4 \ bug-getopt5 tst-getopt_long1 bug-regex34 bug-regex35 \ @@ -92,6 +91,8 @@ tests := test-errno tstgetopt testfnm runtests runptests \ tst-fnmatch3 bug-regex36 tst-getaddrinfo5 \ tst-posix_spawn-fd \ tst-posix_fadvise tst-posix_fadvise64 +tests-internal := bug-regex5 bug-regex20 bug-regex33 \ + tst-rfc3484 tst-rfc3484-2 tst-rfc3484-3 xtests := bug-ga2 ifeq (yes,$(build-shared)) test-srcs := globtest diff --git a/stdlib/Makefile b/stdlib/Makefile index 5751b5d600..d4edcf8eef 100644 --- a/stdlib/Makefile +++ b/stdlib/Makefile @@ -68,23 +68,26 @@ test-srcs := tst-fmtmsg tests := tst-strtol tst-strtod testmb testrand testsort testdiv \ test-canon test-canon2 tst-strtoll tst-environ \ tst-xpg-basename tst-random tst-random2 tst-bsearch \ - tst-limits tst-rand48 bug-strtod tst-setcontext \ + tst-limits tst-rand48 bug-strtod tst-setcontext \ tst-setcontext2 test-a64l tst-qsort tst-system testmb2 \ - bug-strtod2 tst-atof1 tst-atof2 tst-strtod2 tst-strtod3 \ - tst-rand48-2 tst-makecontext tst-strtod4 tst-strtod5 \ + bug-strtod2 tst-atof1 tst-atof2 tst-strtod2 \ + tst-rand48-2 tst-makecontext tst-strtod5 \ tst-qsort2 tst-makecontext2 tst-strtod6 tst-unsetenv1 \ tst-makecontext3 bug-getcontext bug-fmtmsg1 \ tst-secure-getenv tst-strtod-overflow tst-strtod-round \ - tst-tininess tst-strtod-underflow tst-tls-atexit \ - tst-setcontext3 tst-tls-atexit-nodelete \ + tst-tininess tst-strtod-underflow tst-setcontext3 \ tst-strtol-locale tst-strtod-nan-locale tst-strfmon_l \ tst-quick_exit tst-thread-quick_exit tst-width \ - tst-width-stdint tst-strfrom tst-strfrom-locale \ + tst-width-stdint tst-strfrom tst-strfrom-locale \ tst-getrandom +tests-internal := tst-strtod1i tst-strtod3 tst-strtod4 tst-strtod5i \ + tst-tls-atexit tst-tls-atexit-nodelete +tests-static := tst-secure-getenv + ifeq ($(build-hardcoded-path-in-tests),yes) tests += tst-empty-env endif -tests-static := tst-secure-getenv + ifeq ($(have-cxx-thread_local),yes) CFLAGS-tst-quick_exit.o = -std=c++11 LDLIBS-tst-quick_exit = -lstdc++ diff --git a/stdlib/tst-strtod.c b/stdlib/tst-strtod.c index ced6d8a351..aa7e3aed1b 100644 --- a/stdlib/tst-strtod.c +++ b/stdlib/tst-strtod.c @@ -79,7 +79,6 @@ static const struct ltest tests[] = static void expand (char *dst, int c); static int long_dbl (void); -static int locale_test (void); static int do_test (void) @@ -176,8 +175,6 @@ do_test (void) status |= long_dbl (); - status |= locale_test (); - return status ? EXIT_FAILURE : EXIT_SUCCESS; } @@ -217,63 +214,4 @@ long_dbl (void) return 0; } -/* Perform a few tests in a locale with thousands separators. */ -static int -locale_test (void) -{ - static const struct - { - const char *loc; - const char *str; - double exp; - ptrdiff_t nread; - } tests[] = - { - { "de_DE.UTF-8", "1,5", 1.5, 3 }, - { "de_DE.UTF-8", "1.5", 1.0, 1 }, - { "de_DE.UTF-8", "1.500", 1500.0, 5 }, - { "de_DE.UTF-8", "36.893.488.147.419.103.232", 0x1.0p65, 26 } - }; -#define ntests (sizeof (tests) / sizeof (tests[0])) - size_t n; - int result = 0; - - puts ("\nLocale tests"); - - for (n = 0; n < ntests; ++n) - { - double d; - char *endp; - - if (setlocale (LC_ALL, tests[n].loc) == NULL) - { - printf ("cannot set locale %s\n", tests[n].loc); - result = 1; - continue; - } - - /* We call __strtod_interal here instead of strtod to tests the - handling of grouping. */ - d = __strtod_internal (tests[n].str, &endp, 1); - if (d != tests[n].exp) - { - printf ("strtod(\"%s\") returns %g and not %g\n", - tests[n].str, d, tests[n].exp); - result = 1; - } - else if (endp - tests[n].str != tests[n].nread) - { - printf ("strtod(\"%s\") read %td bytes and not %td\n", - tests[n].str, endp - tests[n].str, tests[n].nread); - result = 1; - } - } - - if (result == 0) - puts ("all OK"); - - return result; -} - -#define TEST_FUNCTION do_test () -#include "../test-skeleton.c" +#include <support/test-driver.c> diff --git a/stdlib/tst-strtod1i.c b/stdlib/tst-strtod1i.c new file mode 100644 index 0000000000..d8a952f606 --- /dev/null +++ b/stdlib/tst-strtod1i.c @@ -0,0 +1,83 @@ +/* Copyright (C) 1991-2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <ctype.h> +#include <locale.h> +#include <stddef.h> +#include <stdio.h> +#include <stdlib.h> +#include <errno.h> +#include <string.h> +#include <math.h> + +/* Perform a few tests in a locale with thousands separators. */ +static int +do_test (void) +{ + static const struct + { + const char *loc; + const char *str; + double exp; + ptrdiff_t nread; + } tests[] = + { + { "de_DE.UTF-8", "1,5", 1.5, 3 }, + { "de_DE.UTF-8", "1.5", 1.0, 1 }, + { "de_DE.UTF-8", "1.500", 1500.0, 5 }, + { "de_DE.UTF-8", "36.893.488.147.419.103.232", 0x1.0p65, 26 } + }; +#define ntests (sizeof (tests) / sizeof (tests[0])) + size_t n; + int result = 0; + + puts ("\nLocale tests"); + + for (n = 0; n < ntests; ++n) + { + double d; + char *endp; + + if (setlocale (LC_ALL, tests[n].loc) == NULL) + { + printf ("cannot set locale %s\n", tests[n].loc); + result = 1; + continue; + } + + d = __strtod_internal (tests[n].str, &endp, 1); + if (d != tests[n].exp) + { + printf ("strtod(\"%s\") returns %g and not %g\n", + tests[n].str, d, tests[n].exp); + result = 1; + } + else if (endp - tests[n].str != tests[n].nread) + { + printf ("strtod(\"%s\") read %td bytes and not %td\n", + tests[n].str, endp - tests[n].str, tests[n].nread); + result = 1; + } + } + + if (result == 0) + puts ("all OK"); + + return result ? EXIT_FAILURE : EXIT_SUCCESS; +} + +#include <support/test-driver.c> diff --git a/stdlib/tst-strtod5.c b/stdlib/tst-strtod5.c index 337c746989..d53b17c51a 100644 --- a/stdlib/tst-strtod5.c +++ b/stdlib/tst-strtod5.c @@ -1,3 +1,20 @@ +/* Copyright (C) 2007-2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + #include <locale.h> #include <stdio.h> #include <stdlib.h> @@ -9,38 +26,27 @@ static const struct { const char *in; - int group; double expected; } tests[] = { - { "0", 0, 0.0 }, - { "000", 0, 0.0 }, - { "-0", 0, -0.0 }, - { "-000", 0, -0.0 }, - { "0,", 0, 0.0 }, - { "-0,", 0, -0.0 }, - { "0,0", 0, 0.0 }, - { "-0,0", 0, -0.0 }, - { "0e-10", 0, 0.0 }, - { "-0e-10", 0, -0.0 }, - { "0,e-10", 0, 0.0 }, - { "-0,e-10", 0, -0.0 }, - { "0,0e-10", 0, 0.0 }, - { "-0,0e-10", 0, -0.0 }, - { "0e-1000000", 0, 0.0 }, - { "-0e-1000000", 0, -0.0 }, - { "0,0e-1000000", 0, 0.0 }, - { "-0,0e-1000000", 0, -0.0 }, - { "0", 1, 0.0 }, - { "000", 1, 0.0 }, - { "-0", 1, -0.0 }, - { "-000", 1, -0.0 }, - { "0e-10", 1, 0.0 }, - { "-0e-10", 1, -0.0 }, - { "0e-1000000", 1, 0.0 }, - { "-0e-1000000", 1, -0.0 }, - { "000"NBSP"000"NBSP"000", 1, 0.0 }, - { "-000"NBSP"000"NBSP"000", 1, -0.0 } + { "0", 0.0 }, + { "000", 0.0 }, + { "-0", -0.0 }, + { "-000", -0.0 }, + { "0,", 0.0 }, + { "-0,", -0.0 }, + { "0,0", 0.0 }, + { "-0,0", -0.0 }, + { "0e-10", 0.0 }, + { "-0e-10", -0.0 }, + { "0,e-10", 0.0 }, + { "-0,e-10", -0.0 }, + { "0,0e-10", 0.0 }, + { "-0,0e-10", -0.0 }, + { "0e-1000000", 0.0 }, + { "-0e-1000000", -0.0 }, + { "0,0e-1000000", 0.0 }, + { "-0,0e-1000000", -0.0 }, }; #define NTESTS (sizeof (tests) / sizeof (tests[0])) @@ -59,12 +65,7 @@ do_test (void) for (int i = 0; i < NTESTS; ++i) { char *ep; - double r; - - if (tests[i].group) - r = __strtod_internal (tests[i].in, &ep, 1); - else - r = strtod (tests[i].in, &ep); + double r = strtod (tests[i].in, &ep); if (*ep != '\0') { @@ -84,5 +85,4 @@ do_test (void) return status; } -#define TEST_FUNCTION do_test () -#include "../test-skeleton.c" +#include <support/test-driver.c> diff --git a/stdlib/tst-strtod5i.c b/stdlib/tst-strtod5i.c new file mode 100644 index 0000000000..e9489c1747 --- /dev/null +++ b/stdlib/tst-strtod5i.c @@ -0,0 +1,99 @@ +/* Copyright (C) 2007-2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <locale.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <math.h> + +#define NBSP "\xc2\xa0" + +static const struct +{ + const char *in; + int group; + double expected; +} tests[] = + { + { "0", 0, 0.0 }, + { "000", 0, 0.0 }, + { "-0", 0, -0.0 }, + { "-000", 0, -0.0 }, + { "0,", 0, 0.0 }, + { "-0,", 0, -0.0 }, + { "0,0", 0, 0.0 }, + { "-0,0", 0, -0.0 }, + { "0e-10", 0, 0.0 }, + { "-0e-10", 0, -0.0 }, + { "0,e-10", 0, 0.0 }, + { "-0,e-10", 0, -0.0 }, + { "0,0e-10", 0, 0.0 }, + { "-0,0e-10", 0, -0.0 }, + { "0e-1000000", 0, 0.0 }, + { "-0e-1000000", 0, -0.0 }, + { "0,0e-1000000", 0, 0.0 }, + { "-0,0e-1000000", 0, -0.0 }, + { "0", 1, 0.0 }, + { "000", 1, 0.0 }, + { "-0", 1, -0.0 }, + { "-000", 1, -0.0 }, + { "0e-10", 1, 0.0 }, + { "-0e-10", 1, -0.0 }, + { "0e-1000000", 1, 0.0 }, + { "-0e-1000000", 1, -0.0 }, + { "000"NBSP"000"NBSP"000", 1, 0.0 }, + { "-000"NBSP"000"NBSP"000", 1, -0.0 } + }; +#define NTESTS (sizeof (tests) / sizeof (tests[0])) + + +static int +do_test (void) +{ + if (setlocale (LC_ALL, "cs_CZ.UTF-8") == NULL) + { + puts ("could not set locale"); + return 1; + } + + int status = 0; + + for (int i = 0; i < NTESTS; ++i) + { + char *ep; + double r = __strtod_internal (tests[i].in, &ep, tests[i].group); + + if (*ep != '\0') + { + printf ("%d: got rest string \"%s\", expected \"\"\n", i, ep); + status = 1; + } + + if (r != tests[i].expected + || copysign (10.0, r) != copysign (10.0, tests[i].expected)) + { + printf ("%d: got wrong results %g, expected %g\n", + i, r, tests[i].expected); + status = 1; + } + } + + return status; +} + +#include <support/test-driver.c> diff --git a/string/test-string.h b/string/test-string.h index 2c36b44c22..9f45898238 100644 --- a/string/test-string.h +++ b/string/test-string.h @@ -40,6 +40,18 @@ extern impl_t __start_impls[], __stop_impls[]; #undef __USE_STRING_INLINES +/* We are compiled under _ISOMAC, so libc-symbols.h does not do this + for us. */ +#include "config.h" +#ifdef HAVE_CC_INHIBIT_LOOP_TO_LIBCALL +# define inhibit_loop_to_libcall \ + __attribute__ ((__optimize__ ("-fno-tree-loop-distribute-patterns"))) +#else +# define inhibit_loop_to_libcall +#endif + + +#include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> diff --git a/string/test-strstr.c b/string/test-strstr.c index c29d37446c..404c374331 100644 --- a/string/test-strstr.c +++ b/string/test-strstr.c @@ -23,6 +23,7 @@ #define STRSTR simple_strstr +#define libc_hidden_builtin_def(arg) /* nothing */ #include "strstr.c" diff --git a/sysdeps/ia64/fpu/libm-symbols.h b/sysdeps/ia64/fpu/libm-symbols.h index 31d6f36de9..505131b813 100644 --- a/sysdeps/ia64/fpu/libm-symbols.h +++ b/sysdeps/ia64/fpu/libm-symbols.h @@ -1,4 +1,4 @@ -#if !defined __STRICT_ANSI__ && !defined __cplusplus +#ifndef _ISOMAC # include <sysdep.h> # undef ret /* get rid of the stupid "ret" macro; it breaks br.ret */ diff --git a/sysdeps/m68k/m680x0/fpu/bits/mathinline.h b/sysdeps/m68k/m680x0/fpu/bits/mathinline.h index c2dca317f4..8e6bdc4e27 100644 --- a/sysdeps/m68k/m680x0/fpu/bits/mathinline.h +++ b/sysdeps/m68k/m680x0/fpu/bits/mathinline.h @@ -112,19 +112,22 @@ __NTH (__signbitl (long double __x)) #ifdef __LIBC_INTERNAL_MATH_INLINES /* This is used when defining the functions themselves. Define them with __ names, and with `static inline' instead of `extern inline' so the - bodies will always be used, never an external function call. */ + bodies will always be used, never an external function call. + Note: GCC 6 objects to __attribute__ ((__leaf__)) on static functions. */ # define __m81_u(x) __CONCAT(__,x) # define __m81_inline static __inline +# define __m81_nth(fn) __NTHNL (fn) #else # define __m81_u(x) x -# define __m81_inline __MATH_INLINE +# define __m81_inline __MATH_INLINE +# define __m81_nth(fn) __NTH (fn) # define __M81_MATH_INLINES 1 #endif /* Define a const math function. */ #define __m81_defun(rettype, func, args) \ __m81_inline rettype __attribute__((__const__)) \ - __NTH (__m81_u(func) args) + __m81_nth (__m81_u(func) args) /* Define the three variants of a math function that has a direct implementation in the m68k fpu. FUNC is the name for C (which will be @@ -335,8 +338,8 @@ __inline_functions (long double,l) # define __inline_functions(float_type, s) \ __m81_inline void \ -__NTH (__m81_u(__CONCAT(__sincos,s))(float_type __x, float_type *__sinx, \ - float_type *__cosx)) \ +__m81_nth (__m81_u(__CONCAT(__sincos,s)) \ + (float_type __x, float_type *__sinx, float_type *__cosx)) \ { \ __asm __volatile__ ("fsincos%.x %2,%1:%0" \ : "=f" (*__sinx), "=f" (*__cosx) : "f" (__x)); \ @@ -353,8 +356,6 @@ __inline_functions (long double,l) /* Define inline versions of the user visible functions. */ -/* Note that there must be no whitespace before the argument passed for - NAME, to make token pasting work correctly with -traditional. */ # define __inline_forward_c(rettype, name, args1, args2) \ __MATH_INLINE rettype __attribute__((__const__)) \ __NTH (name args1) \ diff --git a/sysdeps/powerpc/Makefile b/sysdeps/powerpc/Makefile index 933810fd22..e03a202c65 100644 --- a/sysdeps/powerpc/Makefile +++ b/sysdeps/powerpc/Makefile @@ -27,7 +27,7 @@ gen-as-const-headers += locale-defines.sym endif ifeq ($(subdir),nptl) -tests += test-get_hwcap test-get_hwcap-static +tests-internal += test-get_hwcap test-get_hwcap-static tests-static += test-get_hwcap-static endif diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile index 6b7aa3fdf8..725a4c4a93 100644 --- a/sysdeps/unix/sysv/linux/Makefile +++ b/sysdeps/unix/sysv/linux/Makefile @@ -199,7 +199,8 @@ CFLAGS-gai.c += -DNEED_NETLINK endif ifeq ($(subdir),nptl) -tests += tst-setgetname tst-align-clone tst-getpid1 \ +tests += tst-align-clone tst-getpid1 \ tst-thread-affinity-pthread tst-thread-affinity-pthread2 \ tst-thread-affinity-sched +tests-internal += tst-setgetname endif diff --git a/sysdeps/x86_64/fpu/Makefile b/sysdeps/x86_64/fpu/Makefile index 36f090b826..2b7d69bb50 100644 --- a/sysdeps/x86_64/fpu/Makefile +++ b/sysdeps/x86_64/fpu/Makefile @@ -45,6 +45,12 @@ modules-names += test-double-libmvec-alias-mod \ test-float-libmvec-alias-mod \ test-float-libmvec-alias-avx-mod \ test-float-libmvec-alias-avx2-mod +modules-names-tests += test-double-libmvec-alias-mod \ + test-double-libmvec-alias-avx-mod \ + test-double-libmvec-alias-avx2-mod \ + test-float-libmvec-alias-mod \ + test-float-libmvec-alias-avx-mod \ + test-float-libmvec-alias-avx2-mod extra-test-objs += test-double-libmvec-sincos-avx-main.o \ test-double-libmvec-sincos-avx2-main.o \ test-double-libmvec-sincos-main.o \ @@ -146,6 +152,8 @@ tests += test-double-libmvec-alias-avx512 \ test-float-libmvec-sincosf-avx512 modules-names += test-double-libmvec-alias-avx512-mod \ test-float-libmvec-alias-avx512-mod +modules-names-tests += test-double-libmvec-alias-avx512-mod \ + test-float-libmvec-alias-avx512-mod extra-test-objs += test-double-libmvec-sincos-avx512-main.o \ test-float-libmvec-sincosf-avx512-main.o test-double-libmvec-alias-avx512-mod.so-no-z-defs = yes diff --git a/sysdeps/x86_64/fpu/math-tests-arch.h b/sysdeps/x86_64/fpu/math-tests-arch.h index 98f7cf6548..9278e3440b 100644 --- a/sysdeps/x86_64/fpu/math-tests-arch.h +++ b/sysdeps/x86_64/fpu/math-tests-arch.h @@ -16,11 +16,11 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ +#include <cpu-features.h> + #if defined REQUIRE_AVX -# include <init-arch.h> # define INIT_ARCH_EXT - # define CHECK_ARCH_EXT \ do \ { \ @@ -29,10 +29,8 @@ while (0) #elif defined REQUIRE_AVX2 -# include <init-arch.h> # define INIT_ARCH_EXT - # define CHECK_ARCH_EXT \ do \ { \ @@ -41,10 +39,8 @@ while (0) #elif defined REQUIRE_AVX512F -# include <init-arch.h> # define INIT_ARCH_EXT - # define CHECK_ARCH_EXT \ do \ { \ diff --git a/sysdeps/x86_64/multiarch/test-multiarch.c b/sysdeps/x86_64/multiarch/test-multiarch.c index 3974842c19..597d64e1e8 100644 --- a/sysdeps/x86_64/multiarch/test-multiarch.c +++ b/sysdeps/x86_64/multiarch/test-multiarch.c @@ -16,7 +16,7 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#include <init-arch.h> +#include <cpu-features.h> #include <stdio.h> #include <stdlib.h> #include <string.h> -- 2.11.0 ^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2017-05-09 11:25 UTC | newest] Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2017-03-22 12:55 [PATCH 0/2] _ISOMAC testsuite round N Zack Weinberg 2017-03-22 12:55 ` [PATCH 1/2] Remove _IO_MTSAFE_IO from public headers Zack Weinberg 2017-04-06 20:29 ` Adhemerval Zanella 2017-04-06 20:41 ` Zack Weinberg 2017-04-06 21:30 ` Adhemerval Zanella 2017-04-06 22:06 ` Florian Weimer 2017-04-07 14:46 ` Adhemerval Zanella 2017-03-22 12:55 ` [PATCH 2/2] Suppress internal declarations for most of the testsuite Zack Weinberg 2017-05-08 14:02 ` Andreas Schwab 2017-05-08 20:02 ` Zack Weinberg 2017-05-09 7:57 ` Andreas Schwab 2017-05-09 11:25 ` Zack Weinberg 2017-04-06 16:12 ` [PATCH 0/2] _ISOMAC testsuite round N Zack Weinberg 2017-04-17 14:31 ` Zack Weinberg 2017-05-01 11:24 ` Zack Weinberg 2017-05-08 13:23 ` Zack Weinberg -- strict thread matches above, loose matches on Subject: below -- 2017-03-08 16:30 [PATCH 0/2] Revised _ISOMAC testsuite patches Zack Weinberg 2017-03-08 16:35 ` [PATCH 2/2] Suppress internal declarations for most of the testsuite Zack Weinberg
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).