2022-01-02 02:54:23 +08:00
|
|
|
# Copyright (C) 1991-2022 Free Software Foundation, Inc.
|
1995-02-18 09:27:10 +08:00
|
|
|
# This file is part of the GNU C Library.
|
|
|
|
|
|
|
|
# The GNU C Library is free software; you can redistribute it and/or
|
2001-07-06 12:58:11 +08:00
|
|
|
# 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.
|
1995-02-18 09:27:10 +08:00
|
|
|
|
|
|
|
# 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
|
2001-07-06 12:58:11 +08:00
|
|
|
# Lesser General Public License for more details.
|
1995-02-18 09:27:10 +08:00
|
|
|
|
2001-07-06 12:58:11 +08:00
|
|
|
# You should have received a copy of the GNU Lesser General Public
|
2012-02-10 07:18:22 +08:00
|
|
|
# License along with the GNU C Library; if not, see
|
Prefer https to http for gnu.org and fsf.org URLs
Also, change sources.redhat.com to sourceware.org.
This patch was automatically generated by running the following shell
script, which uses GNU sed, and which avoids modifying files imported
from upstream:
sed -ri '
s,(http|ftp)(://(.*\.)?(gnu|fsf|sourceware)\.org($|[^.]|\.[^a-z])),https\2,g
s,(http|ftp)(://(.*\.)?)sources\.redhat\.com($|[^.]|\.[^a-z]),https\2sourceware.org\4,g
' \
$(find $(git ls-files) -prune -type f \
! -name '*.po' \
! -name 'ChangeLog*' \
! -path COPYING ! -path COPYING.LIB \
! -path manual/fdl-1.3.texi ! -path manual/lgpl-2.1.texi \
! -path manual/texinfo.tex ! -path scripts/config.guess \
! -path scripts/config.sub ! -path scripts/install-sh \
! -path scripts/mkinstalldirs ! -path scripts/move-if-change \
! -path INSTALL ! -path locale/programs/charmap-kw.h \
! -path po/libc.pot ! -path sysdeps/gnu/errlist.c \
! '(' -name configure \
-execdir test -f configure.ac -o -f configure.in ';' ')' \
! '(' -name preconfigure \
-execdir test -f preconfigure.ac ';' ')' \
-print)
and then by running 'make dist-prepare' to regenerate files built
from the altered files, and then executing the following to cleanup:
chmod a+x sysdeps/unix/sysv/linux/riscv/configure
# Omit irrelevant whitespace and comment-only changes,
# perhaps from a slightly-different Autoconf version.
git checkout -f \
sysdeps/csky/configure \
sysdeps/hppa/configure \
sysdeps/riscv/configure \
sysdeps/unix/sysv/linux/csky/configure
# Omit changes that caused a pre-commit check to fail like this:
# remote: *** error: sysdeps/powerpc/powerpc64/ppc-mcount.S: trailing lines
git checkout -f \
sysdeps/powerpc/powerpc64/ppc-mcount.S \
sysdeps/unix/sysv/linux/s390/s390-64/syscall.S
# Omit change that caused a pre-commit check to fail like this:
# remote: *** error: sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S: last line does not end in newline
git checkout -f sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S
2019-09-07 13:40:42 +08:00
|
|
|
# <https://www.gnu.org/licenses/>.
|
1995-02-18 09:27:10 +08:00
|
|
|
|
|
|
|
#
|
|
|
|
# Sub-makefile for string portion of library.
|
|
|
|
#
|
|
|
|
subdir := string
|
|
|
|
|
2014-02-27 07:12:03 +08:00
|
|
|
include ../Makeconfig
|
|
|
|
|
2022-02-06 03:28:50 +08:00
|
|
|
headers := \
|
|
|
|
argz.h \
|
|
|
|
bits/byteswap.h \
|
|
|
|
bits/endian.h \
|
|
|
|
bits/endianness.h \
|
|
|
|
bits/string_fortified.h \
|
|
|
|
bits/strings_fortified.h \
|
|
|
|
bits/uintn-identity.h \
|
|
|
|
byteswap.h \
|
|
|
|
endian.h \
|
|
|
|
envz.h \
|
|
|
|
memory.h \
|
|
|
|
string.h \
|
|
|
|
strings.h \
|
|
|
|
# headers
|
1995-02-18 09:27:10 +08:00
|
|
|
|
2022-02-06 03:28:50 +08:00
|
|
|
routines := \
|
|
|
|
_strerror \
|
|
|
|
argz-addsep \
|
|
|
|
argz-append \
|
|
|
|
argz-count \
|
|
|
|
argz-create \
|
|
|
|
argz-ctsep \
|
|
|
|
argz-delete \
|
|
|
|
argz-extract \
|
|
|
|
argz-insert \
|
|
|
|
argz-next \
|
|
|
|
argz-replace \
|
|
|
|
argz-stringify \
|
|
|
|
basename \
|
|
|
|
bcopy \
|
|
|
|
bzero \
|
|
|
|
envz \
|
|
|
|
explicit_bzero \
|
|
|
|
ffs \
|
|
|
|
ffsll \
|
|
|
|
memccpy \
|
|
|
|
memchr \
|
|
|
|
memcmp \
|
|
|
|
memcmpeq \
|
|
|
|
memcpy \
|
|
|
|
memfrob \
|
|
|
|
memmem \
|
|
|
|
memmove \
|
|
|
|
mempcpy \
|
|
|
|
memrchr \
|
|
|
|
memset \
|
|
|
|
rawmemchr \
|
|
|
|
sigabbrev_np \
|
|
|
|
sigdescr_np \
|
|
|
|
stpcpy \
|
|
|
|
stpncpy \
|
|
|
|
strcasecmp \
|
|
|
|
strcasecmp_l \
|
|
|
|
strcasestr \
|
|
|
|
strcat \
|
|
|
|
strchr \
|
|
|
|
strchrnul \
|
|
|
|
strcmp \
|
|
|
|
strcoll \
|
|
|
|
strcoll_l \
|
|
|
|
strcpy \
|
|
|
|
strcspn \
|
|
|
|
strdup \
|
|
|
|
strerror \
|
|
|
|
strerror_l \
|
|
|
|
strerrordesc_np \
|
|
|
|
strerrorname_np \
|
|
|
|
strfry \
|
|
|
|
string-inlines \
|
|
|
|
strlen \
|
|
|
|
strncase \
|
|
|
|
strncase_l \
|
|
|
|
strncat \
|
|
|
|
strncmp \
|
|
|
|
strncpy \
|
|
|
|
strndup \
|
|
|
|
strnlen \
|
|
|
|
strpbrk \
|
|
|
|
strrchr \
|
|
|
|
strsep \
|
|
|
|
strsignal \
|
|
|
|
strspn \
|
|
|
|
strstr \
|
|
|
|
strtok \
|
|
|
|
strtok_r \
|
|
|
|
strverscmp \
|
|
|
|
strxfrm \
|
|
|
|
strxfrm_l \
|
|
|
|
swab \
|
|
|
|
wordcopy \
|
|
|
|
xpg-strerror \
|
|
|
|
# routines
|
1995-02-18 09:27:10 +08:00
|
|
|
|
2022-02-06 03:28:50 +08:00
|
|
|
tests := \
|
|
|
|
bug-envz1 \
|
|
|
|
bug-strcoll1 \
|
|
|
|
bug-strcoll2 \
|
|
|
|
bug-strncat1 \
|
|
|
|
bug-strpbrk1 \
|
|
|
|
bug-strspn1 \
|
|
|
|
bug-strtok1 \
|
|
|
|
inl-tester \
|
|
|
|
noinl-tester \
|
|
|
|
stratcliff \
|
|
|
|
test-bcopy \
|
|
|
|
test-bzero \
|
|
|
|
test-endian-file-scope \
|
|
|
|
test-endian-sign-conversion \
|
|
|
|
test-endian-types \
|
|
|
|
test-explicit_bzero \
|
|
|
|
test-ffs \
|
|
|
|
test-memccpy \
|
|
|
|
test-memchr \
|
|
|
|
test-memcmp \
|
|
|
|
test-memcmpeq \
|
|
|
|
test-memcpy \
|
|
|
|
test-memcpy-large \
|
|
|
|
test-memmem \
|
|
|
|
test-memmove \
|
|
|
|
test-mempcpy \
|
|
|
|
test-memrchr \
|
|
|
|
test-memset \
|
|
|
|
test-rawmemchr \
|
|
|
|
test-sig_np \
|
|
|
|
test-stpcpy \
|
|
|
|
test-stpncpy \
|
|
|
|
test-strcasecmp \
|
|
|
|
test-strcasestr \
|
|
|
|
test-strcat \
|
|
|
|
test-strchr \
|
|
|
|
test-strchrnul \
|
|
|
|
test-strcmp \
|
|
|
|
test-strcpy \
|
|
|
|
test-strcspn \
|
|
|
|
test-strlen \
|
|
|
|
test-strncasecmp \
|
|
|
|
test-strncat \
|
|
|
|
test-strncmp \
|
|
|
|
test-strncpy \
|
|
|
|
test-strnlen \
|
|
|
|
test-strpbrk \
|
|
|
|
test-strrchr \
|
|
|
|
test-strspn \
|
|
|
|
test-strstr \
|
|
|
|
testcopy \
|
|
|
|
tester \
|
|
|
|
tst-bswap \
|
|
|
|
tst-cmp \
|
|
|
|
tst-endian \
|
|
|
|
tst-inlcall \
|
|
|
|
tst-memmove-overflow \
|
|
|
|
tst-strfry \
|
|
|
|
tst-strlen \
|
|
|
|
tst-strtok \
|
|
|
|
tst-strtok_r \
|
|
|
|
tst-strxfrm \
|
|
|
|
tst-strxfrm2 \
|
|
|
|
tst-svc \
|
|
|
|
tst-svc2 \
|
|
|
|
tst-xbzero-opt \
|
|
|
|
# tests
|
2020-07-08 21:23:14 +08:00
|
|
|
|
2020-07-10 00:24:04 +08:00
|
|
|
# Both tests require the .mo translation files generated by msgfmt.
|
2022-02-06 03:28:50 +08:00
|
|
|
tests-translation := \
|
|
|
|
tst-strerror \
|
|
|
|
tst-strsignal \
|
|
|
|
# tests-translation
|
2020-07-10 00:24:04 +08:00
|
|
|
|
|
|
|
tests-container += $(tests-translation)
|
|
|
|
ifeq ($(MSGFMT),:)
|
|
|
|
tests-unsupported += $(tests-translation)
|
|
|
|
endif
|
1995-02-18 09:27:10 +08:00
|
|
|
|
2017-01-25 23:27:03 +08:00
|
|
|
# This test allocates a lot of memory and can run for a long time.
|
2013-09-23 13:54:30 +08:00
|
|
|
xtests = tst-strcoll-overflow
|
|
|
|
|
2019-01-03 22:51:37 +08:00
|
|
|
# This test needs libdl.
|
|
|
|
ifeq (yes,$(build-shared))
|
|
|
|
tests += test-strerror-errno
|
|
|
|
endif
|
|
|
|
|
Enumerate tests with special rules in tests-special variable.
This patch is a revised and updated version of
<https://sourceware.org/ml/libc-alpha/2014-01/msg00196.html>.
In order to generate overall summaries of the results of all tests in
the glibc testsuite, we need to identify and concatenate the files
with the results of individual tests.
Tomas Dohnalek's patch used $(common-objpfx)*/*.test-result for this.
However, the normal glibc approach is explicit enumeration of the
expected set of files with a given property, rather than all files
matching some pattern like that. Furthermore, we would like to be
able to mark tests as UNRESOLVED if the file with their results is for
some reason missing, and in future we would like to be able to mark
tests as UNSUPPORTED if they are disabled for a particular
configuration (rather than simply having them missing from the list of
tests as at present). Such handling of tests that were not run or did
not record results requires an explicit enumeration of tests.
For the tests following the default makefile rules, $(tests) (and
$(xtests)) provides such an enumeration. Others, however, are added
directly as dependencies of the "tests" and "xtests" makefile
targets. This patch changes the makefiles to put them in variables
tests-special and xtests-special, with appropriate dependencies on the
tests listed there then being added centrally.
Those variables are used in Rules and so need to be set before Rules
is included in a subdirectory makefile, which is often earlier in the
makefile than the dependencies were present before. We previously
discussed the question of where to include Rules; see the question at
<https://sourceware.org/ml/libc-alpha/2012-11/msg00798.html>, and a
discussion in
<https://sourceware.org/ml/libc-alpha/2013-01/msg00337.html> of why
Rules is included early rather than late in subdirectory makefiles.
It was necessary to avoid an indirection through the check-abi target
and get the check-abi-* targets for individual libraries into the
tests-special variable. The intl/ test $(objpfx)tst-gettext.out,
previously built only because of dependencies from other tests, was
also added to tests-special for the same reason.
The entries in tests-special are the full makefile targets, complete
with $(objpfx) and .out. If a future change causes tests to be named
consistently with a .out suffix, this can be changed to include just
the path relative to $(objpfx), without .out.
Tested x86_64, including that the same set of files is generated in
the build directory by a build and testsuite run both before and after
the patch (except for changes to the
elf/tst-null-argv.debug.out.<number> file name), and a build with
run-built-tests=no to verify there aren't any more obvious instances
of the issue Marcus Shawcroft reported with a previous version in
<https://sourceware.org/ml/libc-alpha/2014-01/msg00462.html>.
* Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
(tests): Depend on $(tests-special).
* Makerules (check-abi-list): New variable.
(check-abi): Depend on $(check-abi-list).
[$(subdir) = elf] (tests-special): Add
$(objpfx)check-abi-libc.out.
[$(build-shared) = yes && subdir] (tests-special): Add
$(check-abi-list).
[$(build-shared) = yes && subdir] (tests): Do not depend on
check-abi.
* Rules (tests): Depend on $(tests-special).
(xtests): Depend on $(xtests-special).
* catgets/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* conform/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* elf/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* grp/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* iconv/Makefile (xtests): Change dependencies to ....
(xtests-special): ... additions to this variable.
* iconvdata/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* intl/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable. Also add
$(objpfx)tst-gettext.out.
* io/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* libio/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* malloc/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* misc/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* nptl/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* nptl_db/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* posix/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
(xtests): Change dependencies to ....
(xtests-special): ... additions to this variable.
* resolv/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
(xtests): Change dependencies to ....
(xtests-special): ... additions to this variable.
* stdio-common/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
(do-tst-unbputc): Remove target.
(do-tst-printf): Likewise.
* stdlib/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* string/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* sysdeps/x86/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
localedata:
* Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
2014-03-07 06:35:33 +08:00
|
|
|
ifeq ($(run-built-tests),yes)
|
|
|
|
tests-special += $(objpfx)tst-svc-cmp.out
|
|
|
|
endif
|
|
|
|
|
1995-02-18 09:27:10 +08:00
|
|
|
include ../Rules
|
Sun May 26 15:15:08 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
* stdlib/ldiv.c: Deansideclized.
Sun May 26 19:39:53 1996 Ulrich Drepper <drepper@cygnus.com>
* intl/loadmsgcat.c (_nl_load_domain): Test correct variable
after malloc.
* string/Makefile (tester-ENV): New variable to suppress message
translation in test.
* string/tester.c: Add tests for strtok_r and strsep.
* sysdeps/i386/i486/strcat.S: Correct some more 8bit operation
<-> 32 bit operand conflicts.
* sysdeps/i386/strsep.S: Wrapper around <sysdeps/i386/strtok.S>
to produce strsep function.
* sysdeps/i386/strtok.S: Optimized implementation of strtok
function.
* sysdeps/i386/strtok_r.S: Wrapper around <sysdeps/i386/strtok.S>
to produce strtok_r function.
* sysdeps/generic/strtok.c: Moved here from string/strtok.c.
Corrected example in comment.
* string/Makefile (routines): Add strtok_r.
* sysdeps/generic/strtok_r.c: New file. Implement reentrant version
of strtok_r.
* string/string.h: Add prototype for strtok_r.
* wcsmbs/wcstok.c: Handle illegal SAVE_PTR argument the same
as in strtok_r.
Sun May 26 13:28:23 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
* time/tzset.c (__tzset): Ignore leading : in $TZ; always try tzfile
first and fall back to 1003.1 syntax only if it fails.
* time/Makefile (install-others): Also install posix/ZONE and
right/ZONE for each ZONE in $(zonenames).
(z.% rule): Generate rules for right/ZONE and posix/ZONE targets too,
the difference begin leapseconds vs /dev/null as 3rd dep. For
original ZONE targets use $(leapseconds), to be set in Makeconfig.
(target-zone-flavor): New variable.
(tzcompile): Use it to get the right -d for posix/ and right/ flavors.
* Makeconfig (leapseconds): New variable.
* mach/Machrules (%.udeps rule): Depend on Machrules.
Emit deps for .uh and .__h files.
(%.uh, %.__h rules): Don't depend on %.defs; use #include <$*.defs>
instead.
Sun May 26 01:06:47 1996 Ulrich Drepper <drepper@cygnus.com>
* stdlib/Makefile (routines): Add llabs, lldiv.
* stdlib/llabs.c: New file. Implementation of return
absolute value of long long argument.
* stdlib/lldiv.c: New file. Implementation of division with remainder
of long long argument.
* stdlib/stdlib.h [__USE_GNU] (lldiv_t): New type for lldiv
function.
Define prototypes for lldiv and llabs functions.
* locale/C-collate.c: Initialize _NL_COLLATE_NRULES element.
* stdlib/strtod.c: Replace wchar_t with wint_t. The later is
really the type for a single wide character.
* string/strxfrm.c (print_val): Define separate version for
use as wcsxfrm. Here we don't need UTF8 encoding.
* wcsmbs/wchar.h: gcc-2.7.2-960517 finally introduces wint_t
in <stddef.h>. Use this value and only for older gcc version
define in place.
(uwchar_t): Remove definition.
* wcsmbs/wcscmp.c, wcsmbs/wcscoll.c, wcsmbs/wcsncmp.c,
wcsmbs/wcsxfrm.c, wcsmbs/wmemcmp.c: : Don't use uwchar_t as unsigned
type. wint_t is intended for this.
Sat May 25 14:10:19 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
* sysdeps/unix/bsd/direntry.h: Use [1] instead of [0] for d_name to
quiet -ansi -pedantic.
* sysdeps/unix/common/direntry.h: Likewise.
* login/Makefile (headers): Add lastlog.h.
* login/lastlog.h: New file.
* login/Makefile (CFLAGS): Don't append -D_THREAD_SAFE.
* login/utmp.h [_REENTRANT || _THREAD_SAFE]: Replace this conditional
with #ifdef __USE_REENTRANT.
* features.h (__GNU_LIBRARY__): Set to 6.
[_GNU_SOURCE] (_POSIX_SOURCE, _POSIX_C_SOURCE, _BSD_SOURCE,
_SVID_SOURCE): Make sure they are all defined.
* sysdeps/unix/sysv/linux/gnu/types.h: Instead of including
<linux/posix_types.h>, define _LINUX_TYPES_DONT_EXPORT and then
include <linux/types.h>.
* resource/sys/resource.h: Remove trailing commas from enums.
* sysdeps/generic/netinet/in.h: Remove trailing commas from enums.
* sysdeps/unix/sysv/linux/netinet/in.h: Likewise.
1996-05-27 03:19:51 +08:00
|
|
|
|
2017-12-12 00:39:10 +08:00
|
|
|
CFLAGS-inl-tester.c += -fno-builtin
|
|
|
|
CFLAGS-noinl-tester.c += -fno-builtin
|
|
|
|
CFLAGS-tst-strlen.c += -fno-builtin
|
|
|
|
CFLAGS-stratcliff.c += -fno-builtin
|
|
|
|
CFLAGS-test-ffs.c += -fno-builtin
|
|
|
|
CFLAGS-tst-inlcall.c += -fno-builtin
|
|
|
|
CFLAGS-tst-xbzero-opt.c += -O3
|
Unify and simplify bits/byteswap.h, bits/byteswap-16.h headers (bug 14508, bug 15512, bug 17082, bug 20530).
We have a general principle of preferring optimizations for library
facilities to use compiler built-in functions rather than being
located in library headers, where the compiler can reasonably optimize
code without needing to know glibc implementation details.
This patch applies this principle to bits/byteswap.h, eliminating all
the architecture-specific variants and bits/byteswap-16.h. The
__bswap_16, __bswap_32 and __bswap_64 interfaces all become inline
functions, never macros, using the GCC built-in functions where
available and otherwise a single architecture-independent definition
using shifts and masking (which compilers may well be able to detect
and optimize; GCC has detection of various byte-swapping idioms).
The __bswap_constant_32 macro needs to stay around because of uses in
static initializers within glibc and its tests, and so for consistency
all __bswap_constant_* are kept rather than just being inlined into
the old-GCC-or-non-GCC parts of the __bswap_* inline function
definitions.
Various open bugs are addressed by this cleanup, with caveats about
exactly what is covered by those bugs and when the bugs applied at
all.
Bug 14508 reports -Wformat warnings building glibc because __bswap_*
sometimes returned the wrong types. Obviously we already don't have
such warnings any more or the build would be failing, given -Werror,
and I suspect that bug was originally for wrong types for x86_64, as
fixed by commit d394eb742a3565d7fe7a4b02710a60b5f219ee64 (glibc 2.17).
The only case I saw removed by this patch where the types would still
have been wrong was the non-__GNUC__ case of __bswap_64 in the s390
header (using unsigned long long int, but uint64_t would be unsigned
long int for 64-bit). In any case, the single header consistently
uses __uintN_t types after this patch, thereby eliminating all such
bugs. The existing string/test-endian-types.c test already suffices
to verify that the types are correct with the compiler used to build
glibc and its tests.
Bug 15512 reports an error from __bswap_constant_16 with -Werror
-Wsign-conversion. I am unable to reproduce this with any GCC version
supporting -Wsign-conversion - all seem to be able to avoid warning
for ((x) >> 8) & 0xffu, where x is uint16_t, which while it formally
does involve an implicit conversion from int to unsigned int, is also
a case where it should be easy for the compiler to see that the value
converted is never negative. But in this patch __bswap_constant_16 is
changed to use signed 0xff so that no such implicit conversion occurs
at all, and a test with -Werror -Wsign-conversion is added.
Bug 17082 objects to the use of ({}) statement expressions in these
macros preventing use at file scope (in C, that's in sizeof etc.; in
C++, more generally in static initializers). The particular case of
these interfaces is fixed by this patch as it changes them to inline
functions, eliminating all uses of ({}) in bits/byteswap.h, and a
corresponding testcase is added. The bug tries to raise a more
general policy question about use of ({}) in macros in installed
headers, referring to "many other libc functions" (unspecified which
functions are being considered).
Since such policy questions belong on libc-alpha, and since there
*are* macros in installed headers which can't really avoid using ({})
(where they are type-generic, so can't use an inline function, but
need a temporary variable, and a few where the interface involves
returning memory from alloca so can't use an inline function either),
I propose to consider that bug fixed with this change. That is
without prejudice to any other new bugs anyone wishes to file *for
precisely defined sets of macros* requesting moving away from ({})
*where it is clearly possible for those interfaces*. Where ({}) can
be avoided, typically by use of an inline function, I think that's a
good idea - that inline functions are typically to be preferred to
({}) for header interfaces where such optimizations are useful but the
interface is suited to being defined using an inline function.
Bug 20530 requests use of __builtin_bswap16 when available (GCC 4.8
and later), which this patch implements.
Tested for x86_64, and with build-many-glibcs.py. Also did an x86_64
test with the __GNUC_PREREQ conditionals changed to "#if 0" to verify
the old-GCC/non-GCC case in the headers. (There are already existing
tests for correctness of results of these interfaces.)
[BZ #14508]
[BZ #15512]
[BZ #17082]
[BZ #20530]
* bits/byteswap.h: Update file comment. Do not include
<bits/byteswap-16.h>.
(__bswap_constant_16): Cast result to __uint16_t. Use signed 0xff
constant.
(__bswap_16): Define as inline function.
(__bswap_constant_32): Reformat definition.
(__bswap_32): Always define as inline function, not macro, using
__uint32_t. Use __builtin_bswap32 if [__GNUC_PREREQ (4, 3)],
otherwise __bswap_constant_32.
(__bswap_constant_64): Reformat definition. Do not use
__extension__ here.
(__bswap_64): Always define as inline function, not macro. Use
__extension__ on function definition. Use __builtin_bswap64 if
[__GNUC_PREREQ (4, 3)], otherwise __bswap_constant_64.
* string/test-endian-file-scope.c: New file.
* string/test-endian-sign-conversion.c: Likewise.
* string/Makefile (headers): Remove bits/byteswap-16.h.
(tests): Add test-endian-file-scope and
test-endian-sign-conversion.
(CFLAGS-test-endian-sign-conversion.c): New variable.
* bits/byteswap-16.h: Remove file.
* sysdeps/ia64/bits/byteswap-16.h: Likewise.
* sysdeps/ia64/bits/byteswap.h: Likewise.
* sysdeps/m68k/bits/byteswap.h: Likewise.
* sysdeps/s390/bits/byteswap-16.h: Likewise.
* sysdeps/s390/bits/byteswap.h: Likewise.
* sysdeps/tile/bits/byteswap.h: Likewise.
* sysdeps/x86/bits/byteswap-16.h: Likewise.
* sysdeps/x86/bits/byteswap.h: Likewise.
2018-02-07 05:55:08 +08:00
|
|
|
CFLAGS-test-endian-sign-conversion.c += -Werror -Wsign-conversion
|
2017-01-17 15:54:58 +08:00
|
|
|
# BZ 21006: Resolve all functions but at least explicit_bzero at startup.
|
|
|
|
# Otherwise the test fails on s390x as the memcpy in prepare_test_buffer is
|
|
|
|
# done by loading r4 / r5 with the test_pattern and using store multiple
|
|
|
|
# instruction to store r4 / r5 to buf. If explicit_bzero would be resolved in
|
|
|
|
# setup_explicit_clear, r4 / r5 would be stored to stack by _dl_runtime_resolve
|
|
|
|
# and the call to memmem in count_test_patterns will find a hit of the
|
|
|
|
# test_pattern on the stack.
|
|
|
|
LDFLAGS-tst-xbzero-opt = -z now
|
1997-05-21 09:48:59 +08:00
|
|
|
|
2016-12-26 17:08:45 +08:00
|
|
|
# Called during TLS initialization.
|
2017-12-12 00:39:10 +08:00
|
|
|
CFLAGS-memcpy.c += $(no-stack-protector)
|
|
|
|
CFLAGS-wordcopy.c += $(no-stack-protector)
|
2016-12-26 17:08:45 +08:00
|
|
|
|
2022-03-11 21:40:44 +08:00
|
|
|
CFLAGS-argz-next.c += $(config-cflags-wno-ignored-attributes)
|
|
|
|
CFLAGS-basename.c += $(config-cflags-wno-ignored-attributes)
|
|
|
|
CFLAGS-ffs.c += $(config-cflags-wno-ignored-attributes)
|
|
|
|
CFLAGS-memmem.c += $(config-cflags-wno-ignored-attributes)
|
|
|
|
CFLAGS-memchr.c += $(config-cflags-wno-ignored-attributes)
|
|
|
|
CFLAGS-mempcpy.c += $(config-cflags-wno-ignored-attributes)
|
|
|
|
CFLAGS-stpcpy.c += $(config-cflags-wno-ignored-attributes)
|
|
|
|
CFLAGS-strnlen.c += $(config-cflags-wno-ignored-attributes)
|
|
|
|
|
2012-10-24 08:08:46 +08:00
|
|
|
ifeq ($(run-built-tests),yes)
|
Split up rules for tests that compare output with baselines.
This patch splits makefile rules that generate a file then run cmp to
check the contents of that file into separate rules to generate and
compare the file. This simplifies making those tests generate PASS /
FAIL results, by removing the need to insert && between commands in
the test so that a $(evaluate-test) call is reached. It also avoids
the oddity of the .out file being an intermediate file rather than the
final result generated, as noted for some of these tests in
<https://sourceware.org/ml/libc-alpha/2012-10/msg00894.html>.
In many cases, the rule to run the program was no longer needed
because the default rules for running test programs on the host to
generate a .out file sufficed. (I'm not asserting the commands run
after this patch are *exactly* the same as before, simply that the
rules did nothing special that appeared deliberate or relevant to
anything about what the tests were testing. In cases where the rules
redirected stderr as well as stdout, I left the existing rule's
redirection in place to avoid changing what gets compared with the
expected results.)
It's clear there is a lot in common between the various -cmp.out rules
and it might be possible in future to refactor them into more generic
support for the case of comparing test output against a baseline.
(Some baselines are *.exp, some *.expect, some directly embedded in
the makefiles, and nptl/tst-cleanupx0.expect appears unused.)
Tested x86_64.
* elf/Makefile ($(objpfx)order.out): Remove rule.
[$(run-built-tests) = yes] (tests): Depend on
$(objpfx)order-cmp.out.
($(objpfx)order-cmp.out): New rule.
[$(run-built-tests) = yes] (tests): Depend on
$(objpfx)tst-array1-cmp.out, $(objpfx)tst-array1-static-cmp.out,
$(objpfx)tst-array2-cmp.out, $(objpfx)tst-array3-cmp.out,
$(objpfx)tst-array4-cmp.out, $(objpfx)tst-array5-cmp.out and
$(objpfx)tst-array5-static-cmp.out.
($(objpfx)tst-array1.out): Remove rule.
($(objpfx)tst-array1-cmp.out): New rule.
($(objpfx)tst-array1-static.out): Remove rule.
($(objpfx)tst-array1-static-cmp.out): New rule.
($(objpfx)tst-array2.out): Remove rule.
($(objpfx)tst-array2-cmp.out): New rule.
($(objpfx)tst-array3.out): Remove rule.
($(objpfx)tst-array3-cmp.out): New rule.
($(objpfx)tst-array4.out): Remove rule.
($(objpfx)tst-array4-cmp.out): New rule.
($(objpfx)tst-array5.out): Remove rule.
($(objpfx)tst-array5-cmp.out): New rule.
($(objpfx)tst-array5-static.out): Remove rule.
($(objpfx)tst-array5-static-cmp.out): New rule.
[$(run-built-tests) = yes] (tests): Depend on
$(objpfx)order2-cmp.out.
($(objpfx)order2.out): Remove rule.
($(objpfx)order2-cmp.out): New rule.
($(objpfx)tst-initorder.out): Remove rule.
[$(run-built-tests) = yes] (tests): Depend on
$(objpfx)tst-initorder-cmp.out.
($(objpfx)tst-initorder-cmp.out): New rule.
($(objpfx)tst-initorder2.out): Remove rule.
[$(run-built-tests) = yes] (tests): Depend on
$(objpfx)tst-initorder2-cmp.out.
($(objpfx)tst-initorder2-cmp.out): New rule.
[$(run-built-tests) = yes] (tests): Depend on
$(objpfx)tst-unused-dep-cmp.out.
($(objpfx)tst-unused-dep-cmp.out): Do not run cmp.
($(objpfx)tst-unused-dep-cmp.out): New rule.
* stdio-common/Makefile [$(run-built-tests) = yes] (tests): Depend
on $(objpfx)tst-setvbuf1-cmp.out.
($(objpfx)tst-setvbuf1.out): Do not run cmp.
($(objpfx)tst-setvbuf1-cmp.out): New rule.
* string/Makefile [$(run-built-tests) = yes] (tests): Depend
$(objpfx)tst-svc-cmp.out instead of $(objpfx)tst-svc.out.
($(objpfx)tst-svc.out): Remove rule.
($(objpfx)tst-svc-cmp.out): New rule.
nptl:
* Makefile ($(objpfx)tst-cleanup0.out): Do not run cmp.
[$(run-built-tests) = yes] (tests): Depend on
$(objpfx)tst-cleanup0-cmp.out.
($(objpfx)tst-cleanup0-cmp.out): New rule.
2014-02-14 21:42:44 +08:00
|
|
|
$(objpfx)tst-svc-cmp.out: tst-svc.expect $(objpfx)tst-svc.out
|
2014-02-22 05:48:08 +08:00
|
|
|
cmp $^ > $@; \
|
|
|
|
$(evaluate-test)
|
2015-09-29 04:55:57 +08:00
|
|
|
|
|
|
|
LOCALES := de_DE.UTF-8 en_US.ISO-8859-1 en_US.UTF-8 \
|
2015-10-09 04:54:30 +08:00
|
|
|
tr_TR.ISO-8859-9 tr_TR.UTF-8 cs_CZ.UTF-8 \
|
2020-05-18 21:16:48 +08:00
|
|
|
da_DK.ISO-8859-1 en_GB.UTF-8 pt_BR.UTF-8
|
2015-09-29 04:55:57 +08:00
|
|
|
include ../gen-locales.mk
|
|
|
|
|
|
|
|
$(objpfx)test-strcasecmp.out: $(gen-locales)
|
|
|
|
$(objpfx)test-strncasecmp.out: $(gen-locales)
|
|
|
|
$(objpfx)tst-strxfrm.out: $(gen-locales)
|
|
|
|
$(objpfx)tst-strxfrm2.out: $(gen-locales)
|
2015-10-10 04:35:53 +08:00
|
|
|
# bug-strcoll2 needs cs_CZ.UTF-8 and da_DK.ISO-8859-1.
|
|
|
|
$(objpfx)bug-strcoll2.out: $(gen-locales)
|
2017-01-25 23:27:03 +08:00
|
|
|
$(objpfx)tst-strcoll-overflow.out: $(gen-locales)
|
2020-05-18 21:16:48 +08:00
|
|
|
$(objpfx)tst-strsignal.out: $(gen-locales)
|
2020-05-19 01:36:19 +08:00
|
|
|
$(objpfx)tst-strerror.out: $(gen-locales)
|
2015-09-29 04:55:57 +08:00
|
|
|
|
1998-05-29 18:25:23 +08:00
|
|
|
endif
|