2024-01-01 18:12:26 +00:00
|
|
|
# Copyright (C) 1991-2024 Free Software Foundation, Inc.
|
1995-10-17 00:41:39 +00: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 04:58:11 +00: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-10-17 00:41:39 +00: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 04:58:11 +00:00
|
|
|
# Lesser General Public License for more details.
|
1995-10-17 00:41:39 +00:00
|
|
|
|
2001-07-06 04:58:11 +00:00
|
|
|
# You should have received a copy of the GNU Lesser General Public
|
2012-02-09 23:18:22 +00: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 05:40:42 +00:00
|
|
|
# <https://www.gnu.org/licenses/>.
|
1995-10-17 00:41:39 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Specific makefile for stdio-common.
|
|
|
|
#
|
|
|
|
subdir := stdio-common
|
|
|
|
|
2014-02-26 23:12:03 +00:00
|
|
|
include ../Makeconfig
|
|
|
|
|
2023-05-11 18:00:41 +00:00
|
|
|
headers := \
|
|
|
|
bits/printf-ldbl.h \
|
|
|
|
bits/stdio_lim.h \
|
|
|
|
printf.h \
|
|
|
|
stdio_ext.h \
|
|
|
|
# headers
|
1995-10-17 00:41:39 +00:00
|
|
|
|
2022-03-17 09:49:07 +00:00
|
|
|
routines := \
|
|
|
|
_itoa \
|
|
|
|
_itowa \
|
|
|
|
asprintf \
|
|
|
|
ctermid \
|
|
|
|
cuserid \
|
|
|
|
dprintf \
|
|
|
|
flockfile \
|
|
|
|
fprintf \
|
|
|
|
fscanf \
|
|
|
|
ftrylockfile \
|
|
|
|
funlockfile \
|
|
|
|
gentempfd \
|
|
|
|
getline \
|
|
|
|
getw \
|
2022-12-19 17:56:54 +00:00
|
|
|
grouping_iterator \
|
2022-03-17 09:49:07 +00:00
|
|
|
iovfscanf \
|
2023-03-02 19:10:37 +00:00
|
|
|
isoc23_fscanf \
|
|
|
|
isoc23_scanf \
|
|
|
|
isoc23_sscanf \
|
|
|
|
isoc23_vfscanf \
|
|
|
|
isoc23_vscanf \
|
|
|
|
isoc23_vsscanf \
|
2023-05-11 18:00:41 +00:00
|
|
|
isoc99_fscanf \
|
|
|
|
isoc99_scanf \
|
|
|
|
isoc99_sscanf \
|
|
|
|
isoc99_vfscanf \
|
|
|
|
isoc99_vscanf \
|
|
|
|
isoc99_vsscanf \
|
2022-03-17 09:49:07 +00:00
|
|
|
itoa-digits \
|
|
|
|
itoa-udigits \
|
|
|
|
itowa-digits \
|
|
|
|
perror \
|
|
|
|
printf \
|
|
|
|
printf-prs \
|
2022-12-19 17:56:54 +00:00
|
|
|
printf_buffer_as_file \
|
|
|
|
printf_buffer_done \
|
|
|
|
printf_buffer_flush \
|
|
|
|
printf_buffer_pad_1 \
|
|
|
|
printf_buffer_putc_1 \
|
|
|
|
printf_buffer_puts_1 \
|
|
|
|
printf_buffer_to_file \
|
|
|
|
printf_buffer_write \
|
2022-03-17 09:49:07 +00:00
|
|
|
printf_fp \
|
|
|
|
printf_fphex \
|
2022-12-19 17:56:54 +00:00
|
|
|
printf_function_invoke \
|
2022-03-17 09:49:07 +00:00
|
|
|
printf_size \
|
|
|
|
psiginfo \
|
|
|
|
psignal \
|
|
|
|
putw \
|
|
|
|
reg-modifier \
|
|
|
|
reg-printf \
|
|
|
|
reg-type \
|
|
|
|
remove \
|
|
|
|
rename \
|
|
|
|
renameat \
|
|
|
|
renameat2 \
|
|
|
|
scanf \
|
|
|
|
snprintf \
|
|
|
|
sprintf \
|
|
|
|
sscanf \
|
|
|
|
tempnam \
|
|
|
|
tempname \
|
2023-10-10 19:22:39 +00:00
|
|
|
tmpdir \
|
2022-03-17 09:49:07 +00:00
|
|
|
tmpfile \
|
|
|
|
tmpfile64 \
|
|
|
|
tmpnam \
|
|
|
|
tmpnam_r \
|
2022-12-19 17:56:54 +00:00
|
|
|
translated_number_width \
|
2022-03-17 09:49:07 +00:00
|
|
|
vfprintf \
|
|
|
|
vfprintf-internal \
|
|
|
|
vfscanf \
|
|
|
|
vfscanf-internal \
|
|
|
|
vfwprintf \
|
|
|
|
vfwprintf-internal \
|
|
|
|
vfwscanf \
|
|
|
|
vfwscanf-internal \
|
|
|
|
vprintf \
|
2022-12-19 17:56:54 +00:00
|
|
|
wprintf_buffer_as_file \
|
|
|
|
wprintf_buffer_done \
|
|
|
|
wprintf_buffer_flush \
|
|
|
|
wprintf_buffer_pad_1 \
|
|
|
|
wprintf_buffer_putc_1 \
|
|
|
|
wprintf_buffer_puts_1 \
|
|
|
|
wprintf_buffer_to_file \
|
|
|
|
wprintf_buffer_write \
|
2022-12-19 17:56:54 +00:00
|
|
|
wprintf_function_invoke \
|
2022-03-17 09:49:07 +00:00
|
|
|
# routines
|
|
|
|
|
2023-03-17 09:17:28 +00:00
|
|
|
# Exclude fortified routines from being built with _FORTIFY_SOURCE
|
|
|
|
routines_no_fortify += \
|
|
|
|
asprintf \
|
|
|
|
dprintf \
|
|
|
|
fprintf \
|
|
|
|
printf \
|
|
|
|
snprintf \
|
|
|
|
sprintf \
|
|
|
|
vfprintf \
|
|
|
|
vfwprintf \
|
|
|
|
vprintf \
|
|
|
|
# routines_no_fortify
|
|
|
|
|
2022-03-17 09:49:07 +00:00
|
|
|
aux := \
|
|
|
|
errlist \
|
2022-04-06 15:09:42 +00:00
|
|
|
errlist-data \
|
2022-04-06 14:46:46 +00:00
|
|
|
errname \
|
2022-03-17 09:49:07 +00:00
|
|
|
fxprintf \
|
|
|
|
printf-parsemb \
|
|
|
|
printf-parsewc \
|
|
|
|
siglist \
|
|
|
|
# aux
|
|
|
|
|
|
|
|
tests := \
|
|
|
|
bug-vfprintf-nargs \
|
|
|
|
bug1 \
|
2023-05-17 13:33:05 +00:00
|
|
|
bug3 \
|
|
|
|
bug4 \
|
|
|
|
bug5 \
|
|
|
|
bug6 \
|
|
|
|
bug7 \
|
|
|
|
bug8 \
|
|
|
|
bug9 \
|
2022-03-17 09:49:07 +00:00
|
|
|
bug10 \
|
|
|
|
bug11 \
|
|
|
|
bug12 \
|
|
|
|
bug13 \
|
|
|
|
bug14 \
|
|
|
|
bug16 \
|
|
|
|
bug17 \
|
|
|
|
bug18 \
|
|
|
|
bug18a \
|
|
|
|
bug19 \
|
|
|
|
bug19a \
|
|
|
|
bug2 \
|
|
|
|
bug20 \
|
|
|
|
bug21 \
|
|
|
|
bug22 \
|
|
|
|
bug23 \
|
|
|
|
bug24 \
|
|
|
|
bug25 \
|
|
|
|
bug26 \
|
2023-05-17 13:33:05 +00:00
|
|
|
bug27 \
|
|
|
|
bug28 \
|
|
|
|
bug29 \
|
2022-03-17 09:49:07 +00:00
|
|
|
errnobug \
|
|
|
|
scanf1 \
|
2023-05-17 13:33:05 +00:00
|
|
|
scanf2 \
|
|
|
|
scanf3 \
|
|
|
|
scanf4 \
|
|
|
|
scanf5 \
|
|
|
|
scanf7 \
|
|
|
|
scanf8 \
|
|
|
|
scanf9 \
|
2022-03-17 09:49:07 +00:00
|
|
|
scanf10 \
|
|
|
|
scanf11 \
|
|
|
|
scanf12 \
|
|
|
|
scanf13 \
|
|
|
|
scanf14 \
|
|
|
|
scanf15 \
|
|
|
|
scanf16 \
|
|
|
|
scanf17 \
|
2023-05-17 13:33:05 +00:00
|
|
|
scanf18 \
|
|
|
|
scanf19 \
|
2022-03-17 09:49:07 +00:00
|
|
|
temptest \
|
|
|
|
test-fseek \
|
|
|
|
test-fwrite \
|
|
|
|
test-popen \
|
|
|
|
test-strerr \
|
|
|
|
test-vfprintf \
|
|
|
|
test_rdwr \
|
|
|
|
tfformat \
|
|
|
|
tiformat \
|
|
|
|
tllformat \
|
|
|
|
tst-bz11319 \
|
|
|
|
tst-bz11319-fortify2 \
|
|
|
|
tst-cookie \
|
2023-01-31 21:22:02 +00:00
|
|
|
tst-dprintf-length \
|
2022-03-17 09:49:07 +00:00
|
|
|
tst-fdopen \
|
2024-09-25 13:51:23 +00:00
|
|
|
tst-fdopen2 \
|
2022-03-17 09:49:07 +00:00
|
|
|
tst-ferror \
|
|
|
|
tst-fgets \
|
|
|
|
tst-fileno \
|
|
|
|
tst-fmemopen \
|
|
|
|
tst-fmemopen2 \
|
|
|
|
tst-fmemopen3 \
|
|
|
|
tst-fmemopen4 \
|
|
|
|
tst-fphex \
|
|
|
|
tst-fphex-wide \
|
2024-09-24 14:06:22 +00:00
|
|
|
tst-fread \
|
2022-03-17 09:49:07 +00:00
|
|
|
tst-fseek \
|
|
|
|
tst-fwrite \
|
|
|
|
tst-gets \
|
|
|
|
tst-grouping \
|
2022-08-29 13:05:40 +00:00
|
|
|
tst-grouping2 \
|
2023-01-19 11:50:20 +00:00
|
|
|
tst-grouping3 \
|
2022-03-17 09:49:07 +00:00
|
|
|
tst-long-dbl-fphex \
|
2022-05-23 08:08:18 +00:00
|
|
|
tst-memstream-string \
|
2022-03-17 09:49:07 +00:00
|
|
|
tst-obprintf \
|
|
|
|
tst-perror \
|
|
|
|
tst-popen \
|
|
|
|
tst-popen2 \
|
|
|
|
tst-printf-binary \
|
2023-06-19 18:52:12 +00:00
|
|
|
tst-printf-intn \
|
2023-01-27 22:25:59 +00:00
|
|
|
tst-printf-oct \
|
2022-03-17 09:49:07 +00:00
|
|
|
tst-printf-round \
|
|
|
|
tst-printfsz \
|
|
|
|
tst-put-error \
|
|
|
|
tst-renameat2 \
|
|
|
|
tst-rndseek \
|
2023-03-02 19:10:37 +00:00
|
|
|
tst-scanf-binary-c11 \
|
2024-02-01 17:55:57 +00:00
|
|
|
tst-scanf-binary-c23 \
|
2023-03-02 19:10:37 +00:00
|
|
|
tst-scanf-binary-gnu11 \
|
|
|
|
tst-scanf-binary-gnu89 \
|
2024-07-26 12:21:34 +00:00
|
|
|
tst-scanf-bz27650 \
|
2023-09-28 17:27:58 +00:00
|
|
|
tst-scanf-intn \
|
2022-03-17 09:49:07 +00:00
|
|
|
tst-scanf-round \
|
2023-06-27 18:05:56 +00:00
|
|
|
tst-scanf-to_inpunct \
|
2022-03-17 09:49:07 +00:00
|
|
|
tst-setvbuf1 \
|
|
|
|
tst-sprintf \
|
|
|
|
tst-sprintf-errno \
|
|
|
|
tst-sprintf2 \
|
|
|
|
tst-sprintf3 \
|
|
|
|
tst-sscanf \
|
|
|
|
tst-swprintf \
|
|
|
|
tst-swscanf \
|
|
|
|
tst-tmpnam \
|
|
|
|
tst-ungetc \
|
2024-08-14 01:08:49 +00:00
|
|
|
tst-ungetc-leak \
|
2022-03-17 09:49:07 +00:00
|
|
|
tst-unlockedio \
|
|
|
|
tst-vfprintf-mbs-prec \
|
|
|
|
tst-vfprintf-user-type \
|
2023-05-11 18:00:41 +00:00
|
|
|
tst-vfprintf-width-i18n \
|
2022-03-17 09:49:07 +00:00
|
|
|
tst-vfprintf-width-prec-alloc \
|
|
|
|
tst-wc-printf \
|
|
|
|
tstdiomisc \
|
|
|
|
tstgetln \
|
|
|
|
tstscanf \
|
|
|
|
xbug \
|
|
|
|
# tests
|
Use C99-compliant scanf under _GNU_SOURCE with modern compilers.
The only difference between noncompliant and C99-compliant scanf is
that the former accepts the archaic GNU extension '%as' (also %aS and
%a[...]) meaning to allocate space for the input string with malloc.
This extension conflicts with C99's use of %a as a format _type_
meaning to read a floating-point number; POSIX.1-2008 standardized
equivalent functionality using the modifier letter 'm' instead (%ms,
%mS, %m[...]).
The extension was already disabled in most conformance modes:
specifically, any mode that doesn't involve _GNU_SOURCE and _does_
involve either strict conformance to C99 or loose conformance to both
C99 and POSIX.1-2001 would get the C99-compliant scanf. With
compilers new enough to use -std=gnu11 instead of -std=gnu89, or
equivalent, that includes the default mode.
With this patch, we now provide C99-compliant scanf in all
configurations except when _GNU_SOURCE is defined *and*
__STDC_VERSION__ or __cplusplus (whichever is relevant) indicates
C89/C++98. This leaves the old scanf available under e.g. -std=c89
-D_GNU_SOURCE, but removes it from e.g. -std=gnu11 -D_GNU_SOURCE (it
was already not present under -std=gnu11 without -D_GNU_SOURCE) and
from -std=gnu89 without -D_GNU_SOURCE.
There needs to be an internal override so we can compile the
noncompliant scanf itself. This is the same problem we had when we
removed 'gets' from _GNU_SOURCE and it's dealt with the same way:
there's a new __GLIBC_USE symbol, DEPRECATED_SCANF, which defaults to
off under the appropriate conditions for external code, but can be
overridden by individual files within stdio.
We also run into problems with PLT bypass for internal uses of sscanf,
because libc_hidden_proto uses __REDIRECT and so does the logic in
stdio.h for choosing which implementation of scanf to use; __REDIRECT
isn't transitive, so include/stdio.h needs to bridge the gap with a
macro. As far as I can tell, sscanf is the only function in this
family that's internally called by unrelated code.
Finally, there are several tests in stdio-common that use the
extension. bug21.c is a regression test for a crash; it still
exercises the relevant code when changed to use %ms instead of %as.
scanf14.c through scanf17.c are more complicated since they are
actually testing the subtleties of the extension - under what
circumstances is 'a' treated as a modifier letter, etc. I changed all
of them to use %ms instead of %as as well, but duplicated scanf14.c
and scanf16.c as scanf14a.c and scanf16a.c. These still use %as and
are compiled with -std=gnu89 to access the old extension. A bunch of
diagnostic overrides and manual workarounds for the old stdio.h
behavior become unnecessary. Yay!
* include/features.h (__GLIBC_USE_DEPRECATED_SCANF): New __GLIBC_USE
parameter. Only use deprecated scanf when __USE_GNU is defined
and __STDC_VERSION__ is less than 199901L or __cplusplus is less
than 201103L, whichever is relevant for the language being compiled.
* libio/stdio.h, libio/bits/stdio-ldbl.h: Decide whether to redirect
scanf, fscanf, sscanf, vscanf, vfscanf, and vsscanf to their
__isoc99_ variants based only on __GLIBC_USE (DEPRECATED_SCANF).
* wcsmbs/wchar.h: wcsmbs/bits/wchar-ldbl.h: Likewise for
wscanf, fwscanf, swscanf, vwscanf, vfwscanf, and vswscanf.
* libio/iovsscanf.c
* libio/fwscanf.c
* libio/iovswscanf.c
* libio/swscanf.c
* libio/vscanf.c
* libio/vwscanf.c
* libio/wscanf.c
* stdio-common/fscanf.c
* stdio-common/scanf.c
* stdio-common/vfscanf.c
* stdio-common/vfwscanf.c
* sysdeps/ieee754/ldbl-opt/nldbl-compat.c
* sysdeps/ieee754/ldbl-opt/nldbl-fscanf.c
* sysdeps/ieee754/ldbl-opt/nldbl-fwscanf.c
* sysdeps/ieee754/ldbl-opt/nldbl-iovfscanf.c
* sysdeps/ieee754/ldbl-opt/nldbl-scanf.c
* sysdeps/ieee754/ldbl-opt/nldbl-sscanf.c
* sysdeps/ieee754/ldbl-opt/nldbl-swscanf.c
* sysdeps/ieee754/ldbl-opt/nldbl-vfscanf.c
* sysdeps/ieee754/ldbl-opt/nldbl-vfwscanf.c
* sysdeps/ieee754/ldbl-opt/nldbl-vscanf.c
* sysdeps/ieee754/ldbl-opt/nldbl-vsscanf.c
* sysdeps/ieee754/ldbl-opt/nldbl-vswscanf.c
* sysdeps/ieee754/ldbl-opt/nldbl-vwscanf.c
* sysdeps/ieee754/ldbl-opt/nldbl-wscanf.c:
Override __GLIBC_USE_DEPRECATED_SCANF to 1.
* stdio-common/sscanf.c: Likewise. Remove ldbl_hidden_def for __sscanf.
* stdio-common/isoc99_sscanf.c: Add libc_hidden_def for __isoc99_sscanf.
* include/stdio.h: Provide libc_hidden_proto for __isoc99_sscanf,
not sscanf.
[!__GLIBC_USE (DEPRECATED_SCANF)]: Define sscanf as __isoc99_scanf
with a preprocessor macro.
* stdio-common/bug21.c, stdio-common/scanf14.c:
Use %ms instead of %as, %mS instead of %aS, %m[] instead of %a[];
remove DIAG_IGNORE_NEEDS_COMMENT for -Wformat.
* stdio-common/scanf16.c: Likewise. Add __attribute__ ((format (scanf)))
to xscanf, xfscanf, xsscanf.
* stdio-common/scanf14a.c: New copy of scanf14.c which still uses
%as, %aS, %a[]. Remove DIAG_IGNORE_NEEDS_COMMENT for -Wformat.
* stdio-common/scanf16a.c: New copy of scanf16.c which still uses
%as, %aS, %a[]. Add __attribute__ ((format (scanf))) to xscanf,
xfscanf, xsscanf.
* stdio-common/scanf15.c, stdio-common/scanf17.c: No need to
override feature selection macros or provide definitions of u_char etc.
* stdio-common/Makefile (tests): Add scanf14a and scanf16a.
(CFLAGS-scanf15.c, CFLAGS-scanf17.c): Remove.
(CFLAGS-scanf14a.c, CFLAGS-scanf16a.c): New. Compile these files
with -std=gnu89.
2018-02-10 16:58:35 +00:00
|
|
|
|
2024-06-19 15:48:05 +00:00
|
|
|
ifeq ($(run-built-tests),yes)
|
|
|
|
ifeq (yes,$(build-shared))
|
|
|
|
ifneq ($(PERL),no)
|
|
|
|
tests += \
|
|
|
|
tst-printf-bz18872 \
|
|
|
|
tst-printf-bz25691 \
|
|
|
|
tst-printf-fp-free \
|
|
|
|
tst-printf-fp-leak \
|
|
|
|
tst-vfprintf-width-prec \
|
|
|
|
# tests
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2022-12-06 16:28:40 +00:00
|
|
|
tests-container += \
|
|
|
|
tst-popen3
|
2023-05-11 18:00:41 +00:00
|
|
|
# tests-container
|
2022-12-06 16:28:40 +00:00
|
|
|
|
2022-04-06 15:09:42 +00:00
|
|
|
generated += \
|
|
|
|
errlist-data-aux-shared.S \
|
|
|
|
errlist-data-aux.S \
|
2022-04-07 20:15:56 +00:00
|
|
|
siglist-aux-shared.S \
|
|
|
|
siglist-aux.S \
|
2022-04-06 15:09:42 +00:00
|
|
|
# generated
|
1995-10-17 00:41:39 +00:00
|
|
|
|
2022-12-19 17:56:54 +00:00
|
|
|
tests-internal = \
|
|
|
|
tst-grouping_iterator \
|
|
|
|
# tests-internal
|
|
|
|
|
2023-05-11 18:00:41 +00:00
|
|
|
test-srcs = \
|
|
|
|
tst-printf \
|
|
|
|
tst-printfsz-islongdouble \
|
|
|
|
tst-unbputc \
|
|
|
|
# test-srcs
|
2000-07-03 21:40:46 +00:00
|
|
|
|
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-06 22:35:33 +00:00
|
|
|
ifeq ($(run-built-tests),yes)
|
2022-03-17 09:49:07 +00:00
|
|
|
tests-special += \
|
|
|
|
$(objpfx)tst-printf.out \
|
|
|
|
$(objpfx)tst-printfsz-islongdouble.out \
|
|
|
|
$(objpfx)tst-setvbuf1-cmp.out \
|
|
|
|
$(objpfx)tst-unbputc.out \
|
2024-06-19 15:48:05 +00:00
|
|
|
# tests-special
|
|
|
|
|
|
|
|
ifeq (yes,$(build-shared))
|
|
|
|
ifneq ($(PERL),no)
|
|
|
|
tests-special += \
|
|
|
|
$(objpfx)tst-printf-bz18872-mem.out \
|
|
|
|
$(objpfx)tst-printf-bz25691-mem.out \
|
|
|
|
$(objpfx)tst-printf-fp-free-mem.out \
|
|
|
|
$(objpfx)tst-printf-fp-leak-mem.out \
|
2024-08-14 01:08:49 +00:00
|
|
|
$(objpfx)tst-ungetc-leak-mem.out \
|
2022-03-17 09:49:07 +00:00
|
|
|
$(objpfx)tst-vfprintf-width-prec-mem.out \
|
|
|
|
# tests-special
|
|
|
|
|
|
|
|
generated += \
|
|
|
|
tst-printf-bz18872-mem.out \
|
|
|
|
tst-printf-bz18872.c \
|
|
|
|
tst-printf-bz18872.mtrace \
|
|
|
|
tst-printf-bz25691-mem.out \
|
|
|
|
tst-printf-bz25691.mtrace \
|
|
|
|
tst-printf-fp-free-mem.out \
|
|
|
|
tst-printf-fp-free.mtrace \
|
|
|
|
tst-printf-fp-leak-mem.out \
|
|
|
|
tst-printf-fp-leak.mtrace \
|
2024-07-26 12:21:34 +00:00
|
|
|
tst-scanf-bz27650.mtrace \
|
2024-08-14 01:08:49 +00:00
|
|
|
tst-ungetc-leak-mem.out \
|
|
|
|
tst-ungetc-leak.mtrace \
|
2022-03-17 09:49:07 +00:00
|
|
|
tst-vfprintf-width-prec-mem.out \
|
|
|
|
tst-vfprintf-width-prec.mtrace \
|
|
|
|
# generated
|
2024-06-19 15:48:05 +00:00
|
|
|
endif
|
|
|
|
endif
|
2022-03-17 09:49:07 +00:00
|
|
|
endif # $(run-built-tests)
|
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-06 22:35:33 +00:00
|
|
|
|
2020-04-25 00:25:31 +00:00
|
|
|
tests-special += $(objpfx)tst-errno-manual.out
|
|
|
|
|
1995-10-17 00:41:39 +00:00
|
|
|
include ../Rules
|
Wed Jan 24 04:18:36 1996 Paul Eggert <eggert@twinsun.com>
* strftime.c (strftime):
When invoking self, check whether the subsidiary invocation failed.
Use "???" (not "") to denote unknown time zone information.
Make this source file portable to standalone contexts (e.g. GNU Emacs).
<config.h>: Include if HAVE_CONFIG_H is defined.
(HAVE_LIMITS_H, HAVE_MBLEN, HAVE_TM_ZONE, STDC_HEADERS): New symbols,
defined if _LIBC or if <config.h> defines them.
<ansidecl.h>, "../locale/localeinfo.h": Include only if _LIBC.
<sys/types.h>: New include; some hosts require it for `time_t'.
<ctype.h>: Include only if HAVE_MBLEN (since it's only needed then).
<limits.h>: Include only if HAVE_LIMITS_H.
<stddef.h, stdlib.h, string.h>: Include only if STDC_HEADERS.
(memcpy): Define in terms of bcopy if !STDC_HEADERS.
(__P, PTR): Define if not already defined.
(__tzname, __daylight, __timezone): Remove macros; no longer needed.
(add, strftime): Don't use NULL, for portability to some weird hosts.
(fmt): If !_LIBC, don't assume sprintf returns a count.
(week, strftime): Use old-style function declarations.
(weekday_name, month_name): New constants.
(strftime): Use traditional C values if locale support isn't available.
Use `const' instead of CONST. For time zones, use tm_zone if
possible, then fall back on tzname. Don't check for multibyte
characters unless mblen is supported. Use formats like %02d instead
of %.2d, for portability to older hosts.
Wed Jan 24 04:18:36 1996 Paul Eggert <eggert@twinsun.com>
* strftime.c (strftime):
When invoking self, check whether the subsidiary invocation failed.
Use "???" (not "") to denote unknown time zone information.
Make this source file portable to standalone contexts (e.g. GNU Emacs).
<config.h>: Include if HAVE_CONFIG_H is defined.
(HAVE_LIMITS_H, HAVE_MBLEN, HAVE_TM_ZONE, STDC_HEADERS): New symbols,
defined if _LIBC or if <config.h> defines them.
<ansidecl.h>, "../locale/localeinfo.h": Include only if _LIBC.
<sys/types.h>: New include; some hosts require it for `time_t'.
<ctype.h>: Include only if HAVE_MBLEN (since it's only needed then).
<limits.h>: Include only if HAVE_LIMITS_H.
<stddef.h, stdlib.h, string.h>: Include only if STDC_HEADERS.
(memcpy): Define in terms of bcopy if !STDC_HEADERS.
(__P, PTR): Define if not already defined.
(__tzname, __daylight, __timezone): Remove macros; no longer needed.
(add, strftime): Don't use NULL, for portability to some weird hosts.
(fmt): If !_LIBC, don't assume sprintf returns a count.
(week, strftime): Use old-style function declarations.
(weekday_name, month_name): New constants.
(strftime): Use traditional C values if locale support isn't available.
Use `const' instead of CONST. For time zones, use tm_zone if
possible, then fall back on tzname. Don't check for multibyte
characters unless mblen is supported. Use formats like %02d instead
of %.2d, for portability to older hosts.
Wed Jan 24 00:07:52 1996 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
* stdio-common/vfscanf.c (GROUP, MALLOC): New flag macros.
(__vfscanf): Eliminate flag vars that were redundant with FLAGS bits.
Fix bug in recognition of %ll flag for long long.
Fix overeager checks for conflicting type modifiers.
With ' flag, match thousands separators for decimal numbers.
Tue Jan 23 22:02:40 1996 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
* locale/Makefile (CFLAGS-locfile-lex.c): New variable.
* resolv/Makefile (CFLAGS): Disable some warnings.
* sysdeps/generic/Makefile (elided-routines): Removed hypot.
(+gccwarn): Set with override.
* stdio-common/Makefile (CFLAGS-tst-printf.c): New variable.
* posix/Makefile (CFLAGS-regex.c): New variable.
* malloc/Makefile (CFLAGS-obstack.c): New variable.
* io/Makefile (CFLAGS-fts.c): New variable.
* io/fts.c (fts_open): Use prototypes for COMPAR decl.
Tue Jan 23 21:35:32 1996 Miles Bader <miles@gnu.ai.mit.edu>
* sysdeps/mach/hurd/bind.c (bind): Ensure NAME for the AF_LOCAL
case is '\0'-terminated.
Tue Jan 23 19:49:54 1996 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
* elf/rtld.c (dl_main): Support additional args in --list mode for
debugging: look them up as symbol names and print values.
* misc/getttyent.c (skip, value): Declare with prototypes in file
scope.
* csu/initfini.c (_init): Explicitly set a variable that is
pointer to volatile with the address of __gmon_start__, to avoid
the test being optimized out.
1996-01-24 06:03:37 +00:00
|
|
|
|
2022-04-06 15:09:42 +00:00
|
|
|
# The errlist.c is built in two phases because compiler might reorder the
|
|
|
|
# compat_symbol directive prior the object itself and on binutils older
|
|
|
|
# than 2.29 it might generate object sizes different than the expected ones.
|
|
|
|
$(objpfx)errlist-data-aux-shared.S: errlist-data-gen.c
|
|
|
|
$(make-target-directory)
|
|
|
|
$(compile-command.c) $(pic-cppflags) $(pic-ccflag) $(no-stack-protector) -S
|
|
|
|
|
|
|
|
$(objpfx)errlist-data-aux.S: errlist-data-gen.c
|
|
|
|
$(make-target-directory)
|
|
|
|
$(compile-command.c) $(pie-default) $(no-stack-protector) -S
|
|
|
|
|
2022-09-08 08:25:21 +00:00
|
|
|
ifndef no_deps
|
|
|
|
-include $(objpfx)errlist-data-aux.S.d $(objpfx)errlist-data-aux-shared.S.d
|
|
|
|
endif
|
|
|
|
|
2022-04-06 15:09:42 +00:00
|
|
|
$(objpfx)errlist-data.os: $(objpfx)errlist-data-aux-shared.S
|
2022-11-21 12:08:17 +00:00
|
|
|
$(addprefix $(objpfx)errlist-data, $(object-suffixes-noshared)): \
|
|
|
|
$(objpfx)errlist-data-aux.S
|
2022-04-06 15:09:42 +00:00
|
|
|
|
2022-04-07 20:15:56 +00:00
|
|
|
$(objpfx)siglist-aux-shared.S: siglist-gen.c
|
|
|
|
$(make-target-directory)
|
|
|
|
$(compile-command.c) $(pic-cppflags) $(pic-ccflag) $(no-stack-protector) -S
|
|
|
|
|
|
|
|
$(objpfx)siglist-aux.S: siglist-gen.c
|
|
|
|
$(make-target-directory)
|
|
|
|
$(compile-command.c) $(pie-default) $(no-stack-protector) -S
|
|
|
|
|
2022-09-08 08:25:21 +00:00
|
|
|
ifndef no_deps
|
|
|
|
-include $(objpfx)siglist-aux.S.d $(objpfx)siglist-aux-shared.S.d
|
|
|
|
endif
|
|
|
|
|
2022-04-07 20:15:56 +00:00
|
|
|
$(objpfx)siglist.os: $(objpfx)siglist-aux-shared.S
|
2022-11-21 12:08:17 +00:00
|
|
|
$(addprefix $(objpfx)siglist, $(object-suffixes-noshared)): \
|
|
|
|
$(objpfx)siglist-aux.S
|
2022-04-07 20:15:56 +00:00
|
|
|
|
2015-10-12 10:24:41 +00:00
|
|
|
ifeq ($(run-built-tests),yes)
|
2022-03-17 09:49:07 +00:00
|
|
|
LOCALES := \
|
2024-01-18 15:52:03 +00:00
|
|
|
bn_BD.UTF-8 \
|
2022-03-17 09:49:07 +00:00
|
|
|
de_DE.ISO-8859-1 \
|
|
|
|
de_DE.UTF-8 \
|
|
|
|
en_US.ISO-8859-1 \
|
2023-06-27 18:05:56 +00:00
|
|
|
fa_IR.UTF-8 \
|
2022-05-23 08:08:18 +00:00
|
|
|
hi_IN.UTF-8 \
|
2022-03-17 09:49:07 +00:00
|
|
|
ja_JP.EUC-JP \
|
2022-03-17 09:49:07 +00:00
|
|
|
ps_AF.UTF-8 \
|
2024-01-18 15:52:03 +00:00
|
|
|
rw_RW.UTF-8 \
|
2022-12-19 17:56:54 +00:00
|
|
|
tg_TJ.UTF-8 \
|
2024-01-18 15:52:03 +00:00
|
|
|
unm_US.UTF-8 \
|
2023-05-11 18:00:41 +00:00
|
|
|
# LOCALES
|
2015-10-12 10:24:41 +00:00
|
|
|
include ../gen-locales.mk
|
|
|
|
|
|
|
|
$(objpfx)bug14.out: $(gen-locales)
|
|
|
|
$(objpfx)scanf13.out: $(gen-locales)
|
|
|
|
$(objpfx)test-vfprintf.out: $(gen-locales)
|
|
|
|
$(objpfx)tst-grouping.out: $(gen-locales)
|
2022-08-29 13:05:40 +00:00
|
|
|
$(objpfx)tst-grouping2.out: $(gen-locales)
|
2022-12-19 17:56:54 +00:00
|
|
|
$(objpfx)tst-grouping_iterator.out: $(gen-locales)
|
2015-10-12 10:24:41 +00:00
|
|
|
$(objpfx)tst-sprintf.out: $(gen-locales)
|
|
|
|
$(objpfx)tst-sscanf.out: $(gen-locales)
|
|
|
|
$(objpfx)tst-swprintf.out: $(gen-locales)
|
2017-06-29 11:32:39 +00:00
|
|
|
$(objpfx)tst-vfprintf-mbs-prec.out: $(gen-locales)
|
2022-05-23 08:08:18 +00:00
|
|
|
$(objpfx)tst-vfprintf-width-i18n.out: $(gen-locales)
|
2023-01-19 11:50:20 +00:00
|
|
|
$(objpfx)tst-grouping3.out: $(gen-locales)
|
2023-06-27 18:05:56 +00:00
|
|
|
$(objpfx)tst-scanf-to_inpunct.out: $(gen-locales)
|
2015-10-12 10:24:41 +00:00
|
|
|
endif
|
|
|
|
|
2021-07-22 13:07:59 +00:00
|
|
|
tst-printf-bz18872-ENV = MALLOC_TRACE=$(objpfx)tst-printf-bz18872.mtrace \
|
|
|
|
LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so
|
2016-04-25 12:10:26 +00:00
|
|
|
tst-vfprintf-width-prec-ENV = \
|
2021-07-22 13:07:59 +00:00
|
|
|
MALLOC_TRACE=$(objpfx)tst-vfprintf-width-prec.mtrace \
|
|
|
|
LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so
|
2020-03-19 21:35:46 +00:00
|
|
|
tst-printf-bz25691-ENV = \
|
2021-07-22 13:07:59 +00:00
|
|
|
MALLOC_TRACE=$(objpfx)tst-printf-bz25691.mtrace \
|
|
|
|
LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so
|
2020-07-09 21:51:49 +00:00
|
|
|
tst-printf-fp-free-ENV = \
|
2021-07-22 13:07:59 +00:00
|
|
|
MALLOC_TRACE=$(objpfx)tst-printf-fp-free.mtrace \
|
|
|
|
LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so
|
2020-07-09 21:52:24 +00:00
|
|
|
tst-printf-fp-leak-ENV = \
|
2021-07-22 13:07:59 +00:00
|
|
|
MALLOC_TRACE=$(objpfx)tst-printf-fp-leak.mtrace \
|
|
|
|
LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so
|
2024-07-26 12:21:34 +00:00
|
|
|
tst-scanf-bz27650-ENV = \
|
|
|
|
MALLOC_TRACE=$(objpfx)tst-scanf-bz27650.mtrace \
|
|
|
|
LD_PRELOAD=$(common-objpfx)malloc/libc_malloc_debug.so
|
2024-08-14 01:08:49 +00:00
|
|
|
tst-ungetc-leak-ENV = \
|
|
|
|
MALLOC_TRACE=$(objpfx)tst-ungetc-leak.mtrace \
|
|
|
|
LD_PRELOAD=$(common-objpfx)malloc/libc_malloc_debug.so
|
2015-09-16 16:16:11 +00:00
|
|
|
|
2012-09-24 20:52:13 +00:00
|
|
|
$(objpfx)tst-unbputc.out: tst-unbputc.sh $(objpfx)tst-unbputc
|
2020-10-01 13:42:38 +00:00
|
|
|
$(SHELL) $< $(common-objpfx) '$(test-program-prefix)'; \
|
2014-02-21 21:48:08 +00:00
|
|
|
$(evaluate-test)
|
2000-07-03 21:40:46 +00:00
|
|
|
|
2012-09-24 20:52:13 +00:00
|
|
|
$(objpfx)tst-printf.out: tst-printf.sh $(objpfx)tst-printf
|
2020-10-01 13:42:38 +00:00
|
|
|
$(SHELL) $< $(common-objpfx) '$(test-program-prefix)'; \
|
2014-02-21 21:48:08 +00:00
|
|
|
$(evaluate-test)
|
2015-09-16 16:16:11 +00:00
|
|
|
|
ldbl-128ibm-compat: Add printf_size
Since the addition of the _Float128 API, strfromf128 and printf_size use
__printf_fp to print _Float128 values. This is achieved by setting the
'is_binary128' member of the 'printf_info' structure to one. Now that
the format of long double on powerpc64le is getting a third option, this
mechanism is reused for long double values that have binary128 format
(i.e.: when -mabi=ieeelongdouble).
This patch adds __printf_sizeieee128 as an exported symbol, but doesn't
provide redirections from printf_size, yet. All redirections will be
installed in a future commit, once all other functions that print or
read long double values with binary128 format are ready. In
__printf_fp, when 'is_binary128' is one, the floating-point argument is
treated as if it was of _Float128 type, regardless of the value of
'is_long_double', thus __printf_sizeieee128 sets 'is_binary128' to the
same value of 'is_long_double'. Otherwise, double values would not be
printed correctly.
Tested for powerpc64le.
2018-06-29 01:38:55 +00:00
|
|
|
$(objpfx)tst-printfsz-islongdouble.out: \
|
|
|
|
tst-printfsz-islongdouble.sh $(objpfx)tst-printfsz-islongdouble
|
|
|
|
$(SHELL) $^ '$(test-program-prefix)' $@; \
|
|
|
|
$(evaluate-test)
|
|
|
|
|
2015-09-16 16:16:11 +00:00
|
|
|
# We generate this source because it requires a printf invocation with
|
|
|
|
# 10K arguments.
|
|
|
|
$(objpfx)tst-printf-bz18872.c: tst-printf-bz18872.sh
|
|
|
|
rm -f $@ && $(BASH) $^ > $@.new && mv $@.new $@
|
|
|
|
|
2016-04-25 12:10:26 +00:00
|
|
|
$(objpfx)tst-%-mem.out: $(objpfx)tst-%.out
|
|
|
|
$(common-objpfx)malloc/mtrace $(objpfx)tst-$*.mtrace > $@; \
|
2015-09-16 16:16:11 +00:00
|
|
|
$(evaluate-test)
|
2000-07-07 20:59:15 +00:00
|
|
|
|
2020-04-25 00:25:31 +00:00
|
|
|
errlist-h = $(firstword $(wildcard $(addsuffix /errlist.h,$(sysdirs) .)))
|
|
|
|
|
|
|
|
$(objpfx)tst-errno-manual.out: tst-errno-manual.py \
|
|
|
|
$(errlist-h) \
|
|
|
|
$(..)manual/errno.texi
|
|
|
|
$(PYTHON) tst-errno-manual.py -m $(..)manual/errno.texi \
|
|
|
|
-e $(errlist-h) > $@; \
|
|
|
|
$(evaluate-test)
|
|
|
|
|
2017-12-11 21:11:16 +00:00
|
|
|
CFLAGS-vfprintf.c += -Wno-uninitialized
|
|
|
|
CFLAGS-vfwprintf.c += -Wno-uninitialized
|
update from main archive 960919
Thu Sep 19 21:50:55 1996 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/posix/gettimeofday.c (__gettimeofday): Use localtime_r
instead of localtime.
Reported by Matthias Urlichs.
* shlib-versions: Remove version number for libcrypt.
* features.h: Define __USE_REENTRANT if _REENTRANT or _THREAD_SAFE.
* libc-symbols.h: Define _REENTRANT while compiling libc.
* sysdeps/unix/sysv/linux/i386/sysdep.S (__errno_location):
Define even if !_LIBC_REENTRANT.
* sysdeps/unix/sysv/linux/i386/sysdep.S (__errno_location):
Likewise.
* sysdeps/posix/cuserid.h: Remove prototype for geteuid().
De-ANSI-fy.
* MakeTAGS ($P/libc.pot): Generate correctly formed header.
* po/header.pot: Correct title line.
* po/nl.po: Update.
Thu Sep 19 18:59:55 1996 Ulrich Drepper <drepper@cygnus.com>
* Makeconfig (soversions.mk): Prefer shared lib version numbers
is add ons over version in libc itself.
* sysdeps/unix/sysv/linux/i386/sysdep.S: Include <sysdep.h>.
* sysdeps/unix/sysv/linux/i386/sysdep.h: Prevent multiple
inclusion.
* libio/iofgets.c: Use __flockfile and __funlockfile instead of
_IO_flockfile and _IO_funlockfile resp.
* locale/categories.def: Partly support for correct `era' handling
in LC_TIME category.
* locale/langinfo.h: Likewise.
* locale/programs/ld-time.c: Likewise.
* locale/localeinfo.h: Change comment a bit.
* malloc/memalign.c: Don't use goto, not necessary anymore.
1996-09-18 Paul Eggert <eggert@twinsun.com>
* time/mktime.c (ydhms_tm_diff): Work correctly even if year
is negative, or if time_t is unsigned.
* time/strftime.c (tm_diff): Work correctly even if tm_year
is near INT_MIN.
Tue Sep 17 16:14:34 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/m68k/fpu/__math.h (__inline_mathop): Changed to generate
all three versions of the math function.
(__inline_mathopf, __inline_mathopl): Removed.
(__inline_functions): New temporary definition containing all
non-trivial inline functions.
Wed Sep 18 00:25:41 1996 Ulrich Drepper <drepper@cygnus.com>
* time/strftime.c (strftime): The T_FMT_AMPM string may be empty.
Tue Sep 17 20:27:18 1996 Ulrich Drepper <drepper@cygnus.com>
* math/Makefile (extra-libs-others): Use $(extra-libs) instead
of $(extra-libc).
Tue Sep 17 17:09:44 1996 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/stub/fpu_control.h: Correct end of file comment.
Tue Sep 17 05:39:18 1996 Ulrich Drepper <drepper@cygnus.com>
* stdio-common/bug3.c, stdio-common/bug4.c, stdio-common/bug5.c,
stdio-common/test-popen.c: Remove temporary files after test.
* stdio-common/bug5.c: Use `system' instead of `execlp'.
Patches by Andreas Jaeger.
* stdio-common/bug5.c: Create string for `system' argument to
make sure the input and output file names are really correct.
Sun Sep 15 12:46:44 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* configure.in: If $os contains a hyphen add the part before the
hyphen to $ostry.
Sun Sep 15 18:14:02 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/m68k/fpu/__math.h (__ieee754_pow, __ieee754_powf,
__ieee754_powl): Rename local variable i to __i.
(__ieee754_atan2, __ieee754_atan2f, __ieee754_atan2l): New inline
functions.
* sysdeps/m68k/fpu/e_atan2.c, sysdeps/m68k/fpu/e_atan2f.c,
sysdeps/m68k/fpu/e_atan2l.c: New files.
1996-09-15 Paul Eggert <eggert@twinsun.com>
* manual/time.texi: Change `range X to Y' to `range X through
Y', to avoid ambiguity in English.
(strftime): Numbers that do not have a range indicated are not padded.
Describe E and O modifiers.
%g, %G, %u: New formats.
%C, %y, %Y: Describe behavior on negative years.
%e: Fix typo (was labeled %d).
%l, %V: Fix typo in range.
%M, %S, %U, %w, %W: Give ranges.
%p: Clarify how noon and midnight are handled for AM and PM.
%s: Clarify leap second handling.
%r: Now locale-defined.
%C, %D, %e, %h, %n, %r, %t, %T: Say that they are POSIX.2 extensions.
%z: Say that it is a GNU extension.
%Z: Wording fix.
* time/strftime.c: (strftime):
%V: Fix mishandling of week numbers near year boundaries.
%g, %G: New formats (suggested by Arthur David Olson).
%U, %W: Use inline expression instead of `week' function.
%C, %y: Handle negative years portably.
%C, %Y: Use width 1, since values can be arbitrarily wide.
%r: Use T_FMT_AMPM format if _NL_CURRENT is defined.
%u: New Posix.2 format.
%w: Width is 1, not 2.
(iso_week_days): New function, for %V, %G, %g.
(week): Remove; it didn't handle %V correctly.
(__isleap): New macro.
(mbsinit): Use arg, to pacify GCC -Wall.
1996-09-13 Paul Eggert <eggert@twinsun.com>
* time/strftime.c (strftime):
If using the GNU C library, do not bother to check for
multibyte encodings, since they're safe in formats. Otherwise:
- Check for multibyte encodings when encountering any character that
is not in the basic execution character set of the C Standard.
- Use mbrlen (if available) instead of mblen, to avoid modifying
mblen's internal state.
- Do not assume that '%' cannot appear as the first character of a
multibyte character sequence, since this is possible when not in the
initial shift state.
(HAVE_MBRLEN, MULTIBYTE_IS_FORMAT_SAFE): Define if _LIBC is defined.
(DO_MULTIBYTE): New macro.
(<ctype.h>): Do not include.
(<wchar.h>): Include if HAVE_MBRLEN.
(mbstate_t, mbrlen, mbsinit): Define if ! HAVE_MBRLEN.
(mbstate_zero): New constant.
1996-09-12 Paul Eggert <eggert@twinsun.com>
* time/strftime.c (strftime):
Use an empty zone if it can't be determined; POSIX.2 requires this.
Use plain `int' for pad and modifier (which now contain char value).
Use plain `int' for number_value, to print negative values correctly.
Use plain `int' for digits; there was no need to make it unsigned.
Initialize subfmt consistently.
Remove incorrect code for %EC and %Ey; they aren't implemented yet.
For %O, if there is no alternate digit, output Ascii instead of "".
Output the `%' of an unknown format; this is most likely the right
thing to do if a multibyte string has been misparsed.
Thu Sep 12 23:23:13 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* stdio-common/scanf7.c (main): Remove extra conversion from
printf format string.
Thu Sep 12 23:01:16 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* stdlib/test-canon.c (tests): Rename structure member from errno
to error, all uses changed.
Thu Sep 12 20:08:06 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/m68k/fpu/__math.h (__ldexp, __ldexpf, __ldexpl):
Removed.
* sysdeps/m68k/fpu/s_ldexp.c, sysdeps/m68k/fpu/s_ldexpf.c,
sysdeps/m68k/fpu/s_ldexpl.c: Removed, use generic implementation
instead.
* sysdeps/m68k/fpu/s_scalbn.c, sysdeps/m68k/fpu/s_scalbnf.c,
sysdeps/m68k/fpu/s_scalbnl.c: Replaced with old contents of
s_ldexp.c, s_ldexpf.c and s_ldexpl.c, resp., suitably adpted.
* sysdeps/m68k/fpu/__math.h (__frexp, __frexpf, __frexpl):
Return value must be in [0.5, 1), not [1, 2). Reported by Chris
Lawrence.
(__ilogb, __ilogbf, __ilogbl): Check for argument being zero.
(__scalbn, __scalbnf, __scalbnl): Use second argument directly.
Thu Sep 12 19:59:24 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/libm-ieee754/e_acoshl.c: Fix typos.
* sysdeps/libm-ieee754/s_cbrtl.c: Remove unused variable.
Thu Sep 12 19:59:24 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/libm-ieee754/e_acoshl.c: Fix typos.
* sysdeps/libm-ieee754/s_cbrtl.c: Remove unused variable.
Thu Sep 12 19:56:07 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* inet/herrno.c (__h_errno_location): Fix return type.
Tue Sep 17 10:51:58 1996 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu>
* malloc/memalign.c (memalign): Only acquire __libc_malloc_lock
for actual modifications to global state.
Fri Sep 13 01:21:36 1996 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu>
* sysdeps/mach/Makefile (includes): Add -I$(common-objpfx)mach/.
* sysdeps/mach/hurd/Makefile (includes): Add
-I$(common-objpfx)hurd/. Reported by Marcus Daniels.
* sysdeps/generic/schedbits.h (struct sched_param): Renamed from
struct sched_params.
* sysdeps/stub/sched_setp.c (__sched_setparam): struct
sched_params -> struct sched_param.
* sysdeps/stub/sched_getp.c (__sched_getparam): Likewise.
* sysdeps/stub/sched_sets.c (__sched_setscheduler): Likewise.
Thu Sep 12 23:58:25 1996 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu>
* sysdeps/mach/libc-lock.h (__libc_cleanup_region_start): Fix
syntax error.
* stdio-common/Makefile: Put lockfile in routines
unconditionally.
Define _MT_SAFE_IO if using for libio and compiling reentrant
libc.
* stdio-common/vfprintf.c (__flockfile, __funlockfile): Declare
this always, not just if _LIBC_REENTRANT.
(__funlockfile): Don't use weak_extern for this one;
__libc_cleanup_region_end might be defined and the use of
__funlockfile can't be protected the way the use of __flockfile
can be.
* sched.h: New file. Helper to access posix/sched.h.
Thu Sep 12 12:33:52 1996 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu>
* sysdeps/mach/hurd/dl-cache.c: Delete second copy of file
accidentally added on.
* sysdeps/stub/intr-msg.h: New file.
* stdio-common/vfprintf.c: Include <libc-lock.h>.
* stdio-common/vfscanf.c: Include <libc-lock.h>.
* sysdeps/mach/libc-lock.h (__libc_cleanup_region_start): New
macro.
(__libc_cleanup_region_end): New macro.
1996-09-20 01:58:09 +00:00
|
|
|
|
2017-12-11 21:11:16 +00:00
|
|
|
CFLAGS-tmpfile.c += -fexceptions
|
|
|
|
CFLAGS-tmpfile64.c += -fexceptions
|
|
|
|
CFLAGS-tempname.c += -fexceptions
|
|
|
|
CFLAGS-psignal.c += -fexceptions
|
|
|
|
CFLAGS-vprintf.c += -fexceptions
|
|
|
|
CFLAGS-cuserid.c += -fexceptions
|
* include/stdio.h (__isoc99_fscanf, __isoc99_scanf,
__isoc99_sscanf, __isoc99_vscanf): New prototypes.
(__isoc99_vsscanf, __isoc99_vfscanf): New prototypes, add
libc_hidden_proto.
* include/wchar.h (__isoc99_fwscanf, __isoc99_wscanf,
__isoc99_swscanf, __isoc99_vwscanf): New prototypes.
(__isoc99_vswscanf, __isoc99_vfwscanf): New prototypes,
add libc_hidden_proto.
* libio/stdio.h (fscanf, scanf, sscanf, vfscanf, vscanf,
vsscanf): Redirect to __isoc99_* if strict ISO C99 or POSIX
conformance requested.
* wcsmbs/wchar.h (fwscanf, wscanf, swscanf, vfwscanf, vwscanf,
vswscanf): Redirect to __isoc99_* if strict ISO C99 or POSIX
conformance requested.
* libio/bits/stdio-ldbl.h (fscanf, scanf, sscanf, vfscanf, vscanf,
vsscanf): Redirect to __nldbl___isoc99_* if strict ISO C99 or POSIX
conformance requested.
* wcsmbs/bits/wchar-ldbl.h (fwscanf, wscanf, swscanf, vfwscanf,
vwscanf, vswscanf): Redirect to __nldbl___isoc99_* if strict
ISO C99 or POSIX conformance requested.
* stdio-common/Versions (libc): Export __isoc99_scanf@@GLIBC_2.7,
__isoc99_vscanf@@GLIBC_2.7, __isoc99_fscanf@@GLIBC_2.7,
__isoc99_vfscanf@@GLIBC_2.7, __isoc99_sscanf@@GLIBC_2.7
and __isoc99_vsscanf@@GLIBC_2.7.
* stdio-common/Makefile (routines): Add isoc99_scanf, isoc99_vscanf,
isoc99_fscanf, isoc99_vfscanf, isoc99_sscanf and isoc99_vsscanf.
(tests): Add scanf14.
(CFLAGS-vfprintf.c, CFLAGS-fprintf.c, CFLAGS-printf.c,
CFLAGS-vfwprintf.c, CFLAGS-vfscanf.c, CFLAGS-vfwscanf.c,
CFLAGS-fscanf.c, CFLAGS-scanf.c, CFLAGS-isoc99_vfscanf.c,
CFLAGS-isoc99_vscanf.c, CFLAGS-isoc99_fscanf.c,
CFLAGS-isoc99_scanf.c): Add $(exceptions).
(CFLAGS-scanf15.c): Add various -I paths to prevent the compiler
from using internal headers.
* wcsmbs/Versions (libc): Export __isoc99_wscanf@@GLIBC_2.7,
__isoc99_vwscanf@@GLIBC_2.7, __isoc99_fwscanf@@GLIBC_2.7,
__isoc99_vfwscanf@@GLIBC_2.7, __isoc99_swscanf@@GLIBC_2.7
and __isoc99_vswscanf@@GLIBC_2.7.
* wcsmbs/Makefile (routines): Add isoc99_wscanf, isoc99_vwscanf,
isoc99_fwscanf, isoc99_vfwscanf, isoc99_swscanf and isoc99_vswscanf.
(CFLAGS-isoc99_wscanf.c, CFLAGS-isoc99_fwscanf.c,
CFLAGS-isoc99_vwscanf.c, CFLAGS-isoc99_vfwscanf.c): Add $(exceptions).
(CPPFLAGS): Add -D_IO_MTSAFE_IO if needed.
* stdio-common/isoc99_scanf.c: New file.
* stdio-common/isoc99_vsscanf.c: New file.
* stdio-common/isoc99_vscanf.c: New file.
* stdio-common/isoc99_vfscanf.c: New file.
* stdio-common/isoc99_fscanf.c: New file.
* stdio-common/isoc99_sscanf.c: New file.
* wcsmbs/isoc99_fwscanf.c: New file.
* wcsmbs/isoc99_vswscanf.c: New file.
* wcsmbs/isoc99_swscanf.c: New file.
* wcsmbs/isoc99_wscanf.c: New file.
* wcsmbs/isoc99_vwscanf.c: New file.
* wcsmbs/isoc99_vfwscanf.c: New file.
* libio/libio.h (_IO_FLAGS2_SCANF_STD): Define.
* libio/libioP.h (_IO_acquire_lock_clear_flags2_fct): Also
clear _IO_FLAGS2_SCANF_STD bit from _flags2.
* stdio-common/vfscanf.c (_IO_vfscanf_internal): Don't
handle %as, %aS and %a[ if _IO_FLAGS2_SCANF_STD is set in _flags2.
* stdio-common/scanf14.c: New test.
* stdio-common/scanf15.c: New test.
* sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Add
isoc99_scanf, isoc99_fscanf, isoc99_sscanf,
isoc99_vscanf, isoc99_vfscanf, isoc99_vsscanf,
isoc99_wscanf, isoc99_fwscanf, isoc99_swscanf,
isoc99_vwscanf, isoc99_vfwscanf and isoc99_vswscanf.
* sysdeps/ieee754/ldbl-opt/Versions (libc): Export
__nldbl___isoc99_scanf@@GLIBC_2.7,
__nldbl___isoc99_fscanf@@GLIBC_2.7,
__nldbl___isoc99_sscanf@@GLIBC_2.7,
__nldbl___isoc99_vscanf@@GLIBC_2.7,
__nldbl___isoc99_vfscanf@@GLIBC_2.7,
__nldbl___isoc99_vsscanf@@GLIBC_2.7,
__nldbl___isoc99_wscanf@@GLIBC_2.7,
__nldbl___isoc99_fwscanf@@GLIBC_2.7,
__nldbl___isoc99_swscanf@@GLIBC_2.7,
__nldbl___isoc99_vwscanf@@GLIBC_2.7,
__nldbl___isoc99_vfwscanf@@GLIBC_2.7
and __nldbl___isoc99_vswscanf@@GLIBC_2.7.
* sysdeps/ieee754/ldbl-opt/nldbl-compat.h (__isoc99_scanf,
__isoc99_fscanf, __isoc99_sscanf, __isoc99_vscanf,
__isoc99_vfscanf, __isoc99_vsscanf, __isoc99_wscanf,
__isoc99_fwscanf, __isoc99_swscanf, __isoc99_vwscanf,
__isoc99_vfwscanf, __isoc99_vswscanf): Add NLDBL_DECL.
* sysdeps/ieee754/ldbl-opt/nldbl-compat.c
(__nldbl___isoc99_scanf, __nldbl___isoc99_fscanf,
__nldbl___isoc99_sscanf, __nldbl___isoc99_vscanf,
__nldbl___isoc99_vfscanf, __nldbl___isoc99_vsscanf,
__nldbl___isoc99_wscanf, __nldbl___isoc99_fwscanf,
__nldbl___isoc99_swscanf, __nldbl___isoc99_vwscanf,
__nldbl___isoc99_vfwscanf, __nldbl___isoc99_vswscanf): New
functions.
* sysdeps/ieee754/ldbl-opt/nldbl-isoc99_vfscanf.c: New file.
* sysdeps/ieee754/ldbl-opt/nldbl-isoc99_swscanf.c: New file.
* sysdeps/ieee754/ldbl-opt/nldbl-isoc99_vwscanf.c: New file.
* sysdeps/ieee754/ldbl-opt/nldbl-isoc99_wscanf.c: New file.
* sysdeps/ieee754/ldbl-opt/nldbl-isoc99_scanf.c: New file.
* sysdeps/ieee754/ldbl-opt/nldbl-isoc99_sscanf.c: New file.
* sysdeps/ieee754/ldbl-opt/nldbl-isoc99_vsscanf.c: New file.
* sysdeps/ieee754/ldbl-opt/nldbl-isoc99_fwscanf.c: New file.
* sysdeps/ieee754/ldbl-opt/nldbl-isoc99_vfwscanf.c: New file.
* sysdeps/ieee754/ldbl-opt/nldbl-isoc99_vswscanf.c: New file.
* sysdeps/ieee754/ldbl-opt/nldbl-isoc99_vscanf.c: New file.
* sysdeps/ieee754/ldbl-opt/nldbl-isoc99_fscanf.c: New file.
* stdio-common/Makefile (tests): Add scanf13.
(scanf13-ENV): New.
* stdio-common/vfscanf.c (_IO_vfscanf_internal): Handle
m modifier followed by l.
(STRING_ARG): Add width argument.
(_IO_vfscanf_internal) <case L_('c')>: Handle %mc.
<case L_('C')>: Handle %mlc and %mC.
<case L_('s'), case L_('S'), case L_('[')>: Adjust STRING_ARG
arguments.
* stdio-common/scanf13.c: New test.
* libio/libioP.h (_IO_acquire_lock_clear_flags2_fct): Clear
the _IO_FLAGS2_FORTIFY bit from _flags2 rather than _flags.
type and __THROW marker of splice, vmsplice, and tee.
2007-09-18 19:04:01 +00:00
|
|
|
|
2015-10-15 22:35:13 +00:00
|
|
|
CFLAGS-vfprintf.c += -fexceptions
|
|
|
|
CFLAGS-fprintf.c += -fexceptions
|
|
|
|
CFLAGS-printf.c += -fexceptions
|
|
|
|
CFLAGS-vfwprintf.c += -fexceptions
|
|
|
|
CFLAGS-vfscanf.c += -fexceptions
|
|
|
|
CFLAGS-vfwscanf.c += -fexceptions
|
|
|
|
CFLAGS-fscanf.c += -fexceptions
|
|
|
|
CFLAGS-scanf.c += -fexceptions
|
|
|
|
CFLAGS-isoc99_vfscanf.c += -fexceptions
|
|
|
|
CFLAGS-isoc99_vscanf.c += -fexceptions
|
|
|
|
CFLAGS-isoc99_fscanf.c += -fexceptions
|
|
|
|
CFLAGS-isoc99_scanf.c += -fexceptions
|
2023-03-02 19:10:37 +00:00
|
|
|
CFLAGS-isoc23_vfscanf.c += -fexceptions
|
|
|
|
CFLAGS-isoc23_vscanf.c += -fexceptions
|
|
|
|
CFLAGS-isoc23_fscanf.c += -fexceptions
|
|
|
|
CFLAGS-isoc23_scanf.c += -fexceptions
|
2003-07-15 07:52:52 +00:00
|
|
|
|
2022-03-11 13:40:44 +00:00
|
|
|
CFLAGS-dprintf.c += $(config-cflags-wno-ignored-attributes)
|
|
|
|
|
2023-11-06 20:25:40 +00:00
|
|
|
# Called during static library initialization, so turn stack-protection
|
|
|
|
# off for non-shared builds.
|
|
|
|
CFLAGS-_itoa.o = $(no-stack-protector)
|
|
|
|
CFLAGS-_itoa.op = $(no-stack-protector)
|
|
|
|
|
2023-05-17 13:33:05 +00:00
|
|
|
# scanf18.c and scanf19.c test a deprecated extension which is no
|
Use C99-compliant scanf under _GNU_SOURCE with modern compilers.
The only difference between noncompliant and C99-compliant scanf is
that the former accepts the archaic GNU extension '%as' (also %aS and
%a[...]) meaning to allocate space for the input string with malloc.
This extension conflicts with C99's use of %a as a format _type_
meaning to read a floating-point number; POSIX.1-2008 standardized
equivalent functionality using the modifier letter 'm' instead (%ms,
%mS, %m[...]).
The extension was already disabled in most conformance modes:
specifically, any mode that doesn't involve _GNU_SOURCE and _does_
involve either strict conformance to C99 or loose conformance to both
C99 and POSIX.1-2001 would get the C99-compliant scanf. With
compilers new enough to use -std=gnu11 instead of -std=gnu89, or
equivalent, that includes the default mode.
With this patch, we now provide C99-compliant scanf in all
configurations except when _GNU_SOURCE is defined *and*
__STDC_VERSION__ or __cplusplus (whichever is relevant) indicates
C89/C++98. This leaves the old scanf available under e.g. -std=c89
-D_GNU_SOURCE, but removes it from e.g. -std=gnu11 -D_GNU_SOURCE (it
was already not present under -std=gnu11 without -D_GNU_SOURCE) and
from -std=gnu89 without -D_GNU_SOURCE.
There needs to be an internal override so we can compile the
noncompliant scanf itself. This is the same problem we had when we
removed 'gets' from _GNU_SOURCE and it's dealt with the same way:
there's a new __GLIBC_USE symbol, DEPRECATED_SCANF, which defaults to
off under the appropriate conditions for external code, but can be
overridden by individual files within stdio.
We also run into problems with PLT bypass for internal uses of sscanf,
because libc_hidden_proto uses __REDIRECT and so does the logic in
stdio.h for choosing which implementation of scanf to use; __REDIRECT
isn't transitive, so include/stdio.h needs to bridge the gap with a
macro. As far as I can tell, sscanf is the only function in this
family that's internally called by unrelated code.
Finally, there are several tests in stdio-common that use the
extension. bug21.c is a regression test for a crash; it still
exercises the relevant code when changed to use %ms instead of %as.
scanf14.c through scanf17.c are more complicated since they are
actually testing the subtleties of the extension - under what
circumstances is 'a' treated as a modifier letter, etc. I changed all
of them to use %ms instead of %as as well, but duplicated scanf14.c
and scanf16.c as scanf14a.c and scanf16a.c. These still use %as and
are compiled with -std=gnu89 to access the old extension. A bunch of
diagnostic overrides and manual workarounds for the old stdio.h
behavior become unnecessary. Yay!
* include/features.h (__GLIBC_USE_DEPRECATED_SCANF): New __GLIBC_USE
parameter. Only use deprecated scanf when __USE_GNU is defined
and __STDC_VERSION__ is less than 199901L or __cplusplus is less
than 201103L, whichever is relevant for the language being compiled.
* libio/stdio.h, libio/bits/stdio-ldbl.h: Decide whether to redirect
scanf, fscanf, sscanf, vscanf, vfscanf, and vsscanf to their
__isoc99_ variants based only on __GLIBC_USE (DEPRECATED_SCANF).
* wcsmbs/wchar.h: wcsmbs/bits/wchar-ldbl.h: Likewise for
wscanf, fwscanf, swscanf, vwscanf, vfwscanf, and vswscanf.
* libio/iovsscanf.c
* libio/fwscanf.c
* libio/iovswscanf.c
* libio/swscanf.c
* libio/vscanf.c
* libio/vwscanf.c
* libio/wscanf.c
* stdio-common/fscanf.c
* stdio-common/scanf.c
* stdio-common/vfscanf.c
* stdio-common/vfwscanf.c
* sysdeps/ieee754/ldbl-opt/nldbl-compat.c
* sysdeps/ieee754/ldbl-opt/nldbl-fscanf.c
* sysdeps/ieee754/ldbl-opt/nldbl-fwscanf.c
* sysdeps/ieee754/ldbl-opt/nldbl-iovfscanf.c
* sysdeps/ieee754/ldbl-opt/nldbl-scanf.c
* sysdeps/ieee754/ldbl-opt/nldbl-sscanf.c
* sysdeps/ieee754/ldbl-opt/nldbl-swscanf.c
* sysdeps/ieee754/ldbl-opt/nldbl-vfscanf.c
* sysdeps/ieee754/ldbl-opt/nldbl-vfwscanf.c
* sysdeps/ieee754/ldbl-opt/nldbl-vscanf.c
* sysdeps/ieee754/ldbl-opt/nldbl-vsscanf.c
* sysdeps/ieee754/ldbl-opt/nldbl-vswscanf.c
* sysdeps/ieee754/ldbl-opt/nldbl-vwscanf.c
* sysdeps/ieee754/ldbl-opt/nldbl-wscanf.c:
Override __GLIBC_USE_DEPRECATED_SCANF to 1.
* stdio-common/sscanf.c: Likewise. Remove ldbl_hidden_def for __sscanf.
* stdio-common/isoc99_sscanf.c: Add libc_hidden_def for __isoc99_sscanf.
* include/stdio.h: Provide libc_hidden_proto for __isoc99_sscanf,
not sscanf.
[!__GLIBC_USE (DEPRECATED_SCANF)]: Define sscanf as __isoc99_scanf
with a preprocessor macro.
* stdio-common/bug21.c, stdio-common/scanf14.c:
Use %ms instead of %as, %mS instead of %aS, %m[] instead of %a[];
remove DIAG_IGNORE_NEEDS_COMMENT for -Wformat.
* stdio-common/scanf16.c: Likewise. Add __attribute__ ((format (scanf)))
to xscanf, xfscanf, xsscanf.
* stdio-common/scanf14a.c: New copy of scanf14.c which still uses
%as, %aS, %a[]. Remove DIAG_IGNORE_NEEDS_COMMENT for -Wformat.
* stdio-common/scanf16a.c: New copy of scanf16.c which still uses
%as, %aS, %a[]. Add __attribute__ ((format (scanf))) to xscanf,
xfscanf, xsscanf.
* stdio-common/scanf15.c, stdio-common/scanf17.c: No need to
override feature selection macros or provide definitions of u_char etc.
* stdio-common/Makefile (tests): Add scanf14a and scanf16a.
(CFLAGS-scanf15.c, CFLAGS-scanf17.c): Remove.
(CFLAGS-scanf14a.c, CFLAGS-scanf16a.c): New. Compile these files
with -std=gnu89.
2018-02-10 16:58:35 +00:00
|
|
|
# longer visible under most conformance levels; see the source files
|
|
|
|
# for more detail.
|
2023-05-17 13:33:05 +00:00
|
|
|
CFLAGS-scanf18.c += -std=gnu89
|
|
|
|
CFLAGS-scanf19.c += -std=gnu89
|
* include/stdio.h (__isoc99_fscanf, __isoc99_scanf,
__isoc99_sscanf, __isoc99_vscanf): New prototypes.
(__isoc99_vsscanf, __isoc99_vfscanf): New prototypes, add
libc_hidden_proto.
* include/wchar.h (__isoc99_fwscanf, __isoc99_wscanf,
__isoc99_swscanf, __isoc99_vwscanf): New prototypes.
(__isoc99_vswscanf, __isoc99_vfwscanf): New prototypes,
add libc_hidden_proto.
* libio/stdio.h (fscanf, scanf, sscanf, vfscanf, vscanf,
vsscanf): Redirect to __isoc99_* if strict ISO C99 or POSIX
conformance requested.
* wcsmbs/wchar.h (fwscanf, wscanf, swscanf, vfwscanf, vwscanf,
vswscanf): Redirect to __isoc99_* if strict ISO C99 or POSIX
conformance requested.
* libio/bits/stdio-ldbl.h (fscanf, scanf, sscanf, vfscanf, vscanf,
vsscanf): Redirect to __nldbl___isoc99_* if strict ISO C99 or POSIX
conformance requested.
* wcsmbs/bits/wchar-ldbl.h (fwscanf, wscanf, swscanf, vfwscanf,
vwscanf, vswscanf): Redirect to __nldbl___isoc99_* if strict
ISO C99 or POSIX conformance requested.
* stdio-common/Versions (libc): Export __isoc99_scanf@@GLIBC_2.7,
__isoc99_vscanf@@GLIBC_2.7, __isoc99_fscanf@@GLIBC_2.7,
__isoc99_vfscanf@@GLIBC_2.7, __isoc99_sscanf@@GLIBC_2.7
and __isoc99_vsscanf@@GLIBC_2.7.
* stdio-common/Makefile (routines): Add isoc99_scanf, isoc99_vscanf,
isoc99_fscanf, isoc99_vfscanf, isoc99_sscanf and isoc99_vsscanf.
(tests): Add scanf14.
(CFLAGS-vfprintf.c, CFLAGS-fprintf.c, CFLAGS-printf.c,
CFLAGS-vfwprintf.c, CFLAGS-vfscanf.c, CFLAGS-vfwscanf.c,
CFLAGS-fscanf.c, CFLAGS-scanf.c, CFLAGS-isoc99_vfscanf.c,
CFLAGS-isoc99_vscanf.c, CFLAGS-isoc99_fscanf.c,
CFLAGS-isoc99_scanf.c): Add $(exceptions).
(CFLAGS-scanf15.c): Add various -I paths to prevent the compiler
from using internal headers.
* wcsmbs/Versions (libc): Export __isoc99_wscanf@@GLIBC_2.7,
__isoc99_vwscanf@@GLIBC_2.7, __isoc99_fwscanf@@GLIBC_2.7,
__isoc99_vfwscanf@@GLIBC_2.7, __isoc99_swscanf@@GLIBC_2.7
and __isoc99_vswscanf@@GLIBC_2.7.
* wcsmbs/Makefile (routines): Add isoc99_wscanf, isoc99_vwscanf,
isoc99_fwscanf, isoc99_vfwscanf, isoc99_swscanf and isoc99_vswscanf.
(CFLAGS-isoc99_wscanf.c, CFLAGS-isoc99_fwscanf.c,
CFLAGS-isoc99_vwscanf.c, CFLAGS-isoc99_vfwscanf.c): Add $(exceptions).
(CPPFLAGS): Add -D_IO_MTSAFE_IO if needed.
* stdio-common/isoc99_scanf.c: New file.
* stdio-common/isoc99_vsscanf.c: New file.
* stdio-common/isoc99_vscanf.c: New file.
* stdio-common/isoc99_vfscanf.c: New file.
* stdio-common/isoc99_fscanf.c: New file.
* stdio-common/isoc99_sscanf.c: New file.
* wcsmbs/isoc99_fwscanf.c: New file.
* wcsmbs/isoc99_vswscanf.c: New file.
* wcsmbs/isoc99_swscanf.c: New file.
* wcsmbs/isoc99_wscanf.c: New file.
* wcsmbs/isoc99_vwscanf.c: New file.
* wcsmbs/isoc99_vfwscanf.c: New file.
* libio/libio.h (_IO_FLAGS2_SCANF_STD): Define.
* libio/libioP.h (_IO_acquire_lock_clear_flags2_fct): Also
clear _IO_FLAGS2_SCANF_STD bit from _flags2.
* stdio-common/vfscanf.c (_IO_vfscanf_internal): Don't
handle %as, %aS and %a[ if _IO_FLAGS2_SCANF_STD is set in _flags2.
* stdio-common/scanf14.c: New test.
* stdio-common/scanf15.c: New test.
* sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Add
isoc99_scanf, isoc99_fscanf, isoc99_sscanf,
isoc99_vscanf, isoc99_vfscanf, isoc99_vsscanf,
isoc99_wscanf, isoc99_fwscanf, isoc99_swscanf,
isoc99_vwscanf, isoc99_vfwscanf and isoc99_vswscanf.
* sysdeps/ieee754/ldbl-opt/Versions (libc): Export
__nldbl___isoc99_scanf@@GLIBC_2.7,
__nldbl___isoc99_fscanf@@GLIBC_2.7,
__nldbl___isoc99_sscanf@@GLIBC_2.7,
__nldbl___isoc99_vscanf@@GLIBC_2.7,
__nldbl___isoc99_vfscanf@@GLIBC_2.7,
__nldbl___isoc99_vsscanf@@GLIBC_2.7,
__nldbl___isoc99_wscanf@@GLIBC_2.7,
__nldbl___isoc99_fwscanf@@GLIBC_2.7,
__nldbl___isoc99_swscanf@@GLIBC_2.7,
__nldbl___isoc99_vwscanf@@GLIBC_2.7,
__nldbl___isoc99_vfwscanf@@GLIBC_2.7
and __nldbl___isoc99_vswscanf@@GLIBC_2.7.
* sysdeps/ieee754/ldbl-opt/nldbl-compat.h (__isoc99_scanf,
__isoc99_fscanf, __isoc99_sscanf, __isoc99_vscanf,
__isoc99_vfscanf, __isoc99_vsscanf, __isoc99_wscanf,
__isoc99_fwscanf, __isoc99_swscanf, __isoc99_vwscanf,
__isoc99_vfwscanf, __isoc99_vswscanf): Add NLDBL_DECL.
* sysdeps/ieee754/ldbl-opt/nldbl-compat.c
(__nldbl___isoc99_scanf, __nldbl___isoc99_fscanf,
__nldbl___isoc99_sscanf, __nldbl___isoc99_vscanf,
__nldbl___isoc99_vfscanf, __nldbl___isoc99_vsscanf,
__nldbl___isoc99_wscanf, __nldbl___isoc99_fwscanf,
__nldbl___isoc99_swscanf, __nldbl___isoc99_vwscanf,
__nldbl___isoc99_vfwscanf, __nldbl___isoc99_vswscanf): New
functions.
* sysdeps/ieee754/ldbl-opt/nldbl-isoc99_vfscanf.c: New file.
* sysdeps/ieee754/ldbl-opt/nldbl-isoc99_swscanf.c: New file.
* sysdeps/ieee754/ldbl-opt/nldbl-isoc99_vwscanf.c: New file.
* sysdeps/ieee754/ldbl-opt/nldbl-isoc99_wscanf.c: New file.
* sysdeps/ieee754/ldbl-opt/nldbl-isoc99_scanf.c: New file.
* sysdeps/ieee754/ldbl-opt/nldbl-isoc99_sscanf.c: New file.
* sysdeps/ieee754/ldbl-opt/nldbl-isoc99_vsscanf.c: New file.
* sysdeps/ieee754/ldbl-opt/nldbl-isoc99_fwscanf.c: New file.
* sysdeps/ieee754/ldbl-opt/nldbl-isoc99_vfwscanf.c: New file.
* sysdeps/ieee754/ldbl-opt/nldbl-isoc99_vswscanf.c: New file.
* sysdeps/ieee754/ldbl-opt/nldbl-isoc99_vscanf.c: New file.
* sysdeps/ieee754/ldbl-opt/nldbl-isoc99_fscanf.c: New file.
* stdio-common/Makefile (tests): Add scanf13.
(scanf13-ENV): New.
* stdio-common/vfscanf.c (_IO_vfscanf_internal): Handle
m modifier followed by l.
(STRING_ARG): Add width argument.
(_IO_vfscanf_internal) <case L_('c')>: Handle %mc.
<case L_('C')>: Handle %mlc and %mC.
<case L_('s'), case L_('S'), case L_('[')>: Adjust STRING_ARG
arguments.
* stdio-common/scanf13.c: New test.
* libio/libioP.h (_IO_acquire_lock_clear_flags2_fct): Clear
the _IO_FLAGS2_FORTIFY bit from _flags2 rather than _flags.
type and __THROW marker of splice, vmsplice, and tee.
2007-09-18 19:04:01 +00:00
|
|
|
|
Fix hardcoded /tmp paths in testing (bug 13888).
As noted in bug 13888, and as I noted previously in
<https://sourceware.org/ml/libc-alpha/2000-10/msg00111.html>, various
tests used hardcoded paths in /tmp, so posing issues for simultaneous
test runs from different build directories.
This patch fixes such uses of hardcoded file names to put them in the
build directory instead (in the case of stdio-common/bug5 the file
names are changed as well, to avoid a conflict with the name bug5.out
also used for the automatic test output redirection). It also fixes
test-installation.pl likewise (that was using filenames with $$ in
them rather than strictly hardcoded names, but that's still not good
practice for temporary file naming).
Note that my list of files changed is not identical to that in bug
13888. I added tst-spawn3.c and test-installation.pl, and removed
some tests that seem to me (now) to create temporary files securely
(simply using /tmp is not itself a problem if the temporary files are
handled properly with mkstemp; I haven't checked whether those tests
used to do things insecurely). conformtest is not changed because the
makefiles always pass a --tmpdir option so the /tmp default is
irrelevant, and for the same reason there is no actual problem with
nptl/tst-umask1.c because again the makefiles always override the
default.
nptl/sockperf.c is ignored because there is no code to run it;
probably that file should actually be removed.
Some tests use the mktemp function, but I think they all use it in a
way that *is* secure (for generating names for directories / sockets /
fifos / symlinks, where the operation using the name will not follow
symlinks and so there is no potential for a symlink attack on the
account running the testsuite).
Some tests use the tmpnam function to generate temporary file names.
This is in principle insecure, but not addressed by this patch (I
consider it a separate issue from the fully hardcoded paths).
Tested for x86_64.
[BZ #13888]
* posix/Makefile (CFLAGS-tst-spawn3.c): New variable.
* posix/tst-spawn3.c (do_test): Put tst-spwan3.pid in OBJPFX, not
/tmp.
* scripts/test-installation.pl: Put temporary files in build
directory, not /tmp.
* stdio-common/Makefile (CFLAGS-bug3.c): New variable.
(CFLAGS-bug4.c): Likewise.
(CFLAGS-bug5.c): Likewise.
(CFLAGS-test-fseek.c): Likewise.
(CFLAGS-test-popen.c): Likewise.
(CFLAGS-test_rdwr.c): Likewise.
* stdio-common/bug3.c (main): Put temporary file in OBJPFX, not
/tmp.
* stdio-common/bug4.c (main): Likewise.
* stdio-common/bug5.c (main): Likewise.
* stdio-common/test-fseek.c (TESTFILE): Likewise.
* stdio-common/test-popen.c (do_test): Likewise.
* stdio-common/test_rdwr.c (main): Likewise.
2018-06-26 21:48:48 +00:00
|
|
|
CFLAGS-bug3.c += -DOBJPFX=\"$(objpfx)\"
|
|
|
|
CFLAGS-bug4.c += -DOBJPFX=\"$(objpfx)\"
|
|
|
|
CFLAGS-bug5.c += -DOBJPFX=\"$(objpfx)\"
|
|
|
|
CFLAGS-test-fseek.c += -DOBJPFX=\"$(objpfx)\"
|
|
|
|
CFLAGS-test-popen.c += -DOBJPFX=\"$(objpfx)\"
|
|
|
|
CFLAGS-test_rdwr.c += -DOBJPFX=\"$(objpfx)\"
|
|
|
|
|
Clean up conditionals for declaration of gets.
gets has the dubious honor of being the only C89 library feature that
has been completely removed from the current C and C++ standards.
glibc follows suit by not declaring it in _GNU_SOURCE mode either,
but it remains present in older compatibility modes. Internally,
two test cases need to see stdio.h make the declaration, but all our
internal code is of course compiled under _GNU_SOURCE. This is currently
kludged by duplicating the gets declaration, fortify wrapper and all,
in include/stdio.h. Also, the conditional in the public headers for
deciding when to declare gets is complicated and repeated in two places.
This patch adds a new macro to features.h that encapsulates the
complicated rule for when to declare gets. stdio.h and bits/stdio2.h
then simply test __GLIBC_USE (DEPRECATED_GETS), and instead of having
a duplicate gets declaration in include/stdio.h, debug/tst-chk1.c and
stdio-common/tst-gets.c can force gets to be declared.
* include/features.h (__GLIBC_USE_DEPRECATED_GETS): New macro.
* libio/stdio.h, libio/bits/stdio2.h: Condition gets on
__GLIBC_USE (DEPRECATED_GETS). Update comments to indicate
gets was removed from C++ in C++14.
* include/stdio.h: Remove redundant declaration of gets.
* debug/tst-chk1.c, stdio-common/tst-gets.c: Force gets to
be declared, since we are testing it.
* stdio-common/Makefile (tst-gets.c): Compile with
-Wno-deprecated-declarations.
* debug/Makefile (tst-chk1.c, tst-chk2.c, tst-chk3.c, tst-chk4.cc)
(tst-chk5.cc, tst-chk6.cc, tst-lfschk1.c, tst-lfschk2.c)
(tst-lfschk3.c, tst-lfschk4.cc, tst-lfschk5.cc, tst-lfschk6.cc):
Compile with -Wno-deprecated-declarations.
2016-11-21 13:16:27 +00:00
|
|
|
# tst-gets.c tests a deprecated function.
|
|
|
|
CFLAGS-tst-gets.c += -Wno-deprecated-declarations
|
|
|
|
|
2018-03-07 19:32:03 +00:00
|
|
|
# BZ #11319 was first fixed for regular vdprintf, then reopened because
|
|
|
|
# the fortified version had the same bug.
|
2023-03-17 09:17:28 +00:00
|
|
|
CFLAGS-tst-bz11319-fortify2.c += $(no-fortify-source),-D_FORTIFY_SOURCE=2
|
2018-03-07 19:32:03 +00:00
|
|
|
|
2022-05-23 08:08:18 +00:00
|
|
|
CFLAGS-tst-memstream-string.c += -fno-builtin-fprintf
|
|
|
|
|
2024-02-01 11:02:01 +00:00
|
|
|
# Some versions of GCC supported for building glibc do not support -std=c23
|
|
|
|
# (added in GCC 14), or the older name -std=c2x (added in GCC 9), so
|
|
|
|
# the test for that version uses -std=c11 and then _ISOC23_SOURCE is defined in
|
2023-03-02 19:10:37 +00:00
|
|
|
# the test as needed.
|
|
|
|
CFLAGS-tst-scanf-binary-c11.c += -std=c11 -DOBJPFX=\"$(objpfx)\"
|
2024-02-01 17:55:57 +00:00
|
|
|
CFLAGS-tst-scanf-binary-c23.c += -std=c11 -DOBJPFX=\"$(objpfx)\"
|
2023-03-02 19:10:37 +00:00
|
|
|
CFLAGS-tst-scanf-binary-gnu11.c += -std=gnu11 -DOBJPFX=\"$(objpfx)\"
|
|
|
|
CFLAGS-tst-scanf-binary-gnu89.c += -std=gnu89 -DOBJPFX=\"$(objpfx)\"
|
|
|
|
|
2012-08-17 16:35:15 +00:00
|
|
|
CPPFLAGS += $(libio-mtsafe)
|
2008-07-08 16:32:55 +00:00
|
|
|
|
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 13:42:44 +00:00
|
|
|
$(objpfx)tst-setvbuf1.out: /dev/null $(objpfx)tst-setvbuf1
|
2014-02-21 21:48:08 +00:00
|
|
|
$(test-program-cmd) > $@ 2>&1; \
|
|
|
|
$(evaluate-test)
|
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 13:42:44 +00:00
|
|
|
|
|
|
|
$(objpfx)tst-setvbuf1-cmp.out: tst-setvbuf1.expect $(objpfx)tst-setvbuf1.out
|
2014-02-21 21:48:08 +00:00
|
|
|
cmp $^ > $@; \
|
|
|
|
$(evaluate-test)
|
2012-09-14 20:18:49 +00:00
|
|
|
|
Use existing makefile variables for dependencies on glibc libraries.
glibc's Makeconfig defines some variables such as $(libm) and $(libdl)
for linking with libraries built by glibc, and nptl/Makeconfig
(included by the toplevel Makeconfig) defines others such as
$(shared-thread-library).
In some places glibc's Makefiles use those variables when linking
against the relevant libraries, but in other places they hardcode the
location of the libraries in the build tree. This patch cleans up
various places to use the variables that already exist (in the case of
libm, replacing several duplicate definitions of a $(link-libm)
variable in subdirectory Makefiles). (It's not necessarily exactly
equivalent to what the existing code does - in particular,
$(shared-thread-library) includes libpthread_nonshared, but is
replacing places that just referred to libpthread.so. But I think
that change is desirable on the general principle of linking things as
close as possible to the way in which they would be linked with an
installed library, unless there is a clear reason not to do so.)
To support running tests with an installed copy of glibc without
needing the full build tree from when that copy was built, I think it
will be useful to use such variables more generally and systematically
- every time the rules for building a test refer to some file from the
build tree that's also installed by glibc, use a makefile variable so
that the installed-testing case can point those variables to installed
copies of the files. This patch just deals with straightforward cases
where such variables already exist.
It's quite possible some uses of $(shared-thread-library) should
actually be a new $(thread-library) variable that's set appropriately
in the --disable-shared case, if those uses would in fact work without
shared libraries. I didn't change the status quo that those cases
hardcode use of a shared library whether or not it's actually needed
(but other uses such as $(libm) and $(libdl) would now get the static
library if the shared library isn't built, when some previously
hardcoded use of the shared library - if they actually need shared
libraries, the test itself needs an enable-shared conditional anyway).
Tested x86_64.
* benchtests/Makefile
($(addprefix $(objpfx)bench-,$(bench-math))): Depend on $(libm),
not $(common-objpfx)math/libm.so.
($(addprefix $(objpfx)bench-,$(bench-pthread))): Depend on
$(shared-thread-library), not $(common-objpfx)nptl/libpthread.so.
* elf/Makefile ($(objpfx)noload): Depend on $(libdl), not
$(common-objpfx)dlfcn/libdl.so.
($(objpfx)tst-audit8): Depend on $(libm), not
$(common-objpfx)math/libm.so.
* malloc/Makefile ($(objpfx)libmemusage.so): Depend on $(libdl),
not $(common-objpfx)dlfcn/libdl.so.
* math/Makefile
($(addprefix $(objpfx),$(filter-out $(tests-static),$(tests)))):
Depend on $(libm), not $(objpfx)libm.so. Do not condition on
[$(build-shared) = yes].
($(objpfx)test-fenv-tls): Depend on $(shared-thread-library), not
$(common-objpfx)nptl/libpthread.so.
* misc/Makefile ($(objpfx)tst-tsearch): Depend on $(libm), not
$(common-objpfx)math/libm.so$(libm.so-version) or
$(common-objpfx)math/libm.a depending on [$(build-shared) = yes].
* nptl/Makefile ($(objpfx)tst-unload): Depend on $(libdl), not
$(common-objpfx)dlfcn/libdl.so.
* setjmp/Makefile (link-libm): Remove variable.
($(objpfx)tst-setjmp-fp): Depend on $(libm), not $(link-libm).
* stdio-common/Makefile (link-libm): Remove variable.
($(objpfx)tst-printf-round): Depend on $(libm), not $(link-libm).
* stdlib/Makefile (link-libm): Remove variable.
($(objpfx)bug-getcontext): Depend on $(libm), not $(link-libm).
($(objpfx)tst-strtod-round): Likewise.
($(objpfx)tst-tininess): Likewise.
($(objpfx)tst-strtod-underflow): Likewise.
($(objpfx)tst-strtod6): Likewise.
($(objpfx)tst-tls-atexit): Depend on $(shared-thread-library) and
$(libdl), not $(common-objpfx)nptl/libpthread.so and
$(common-objpfx)dlfcn/libdl.so.
2014-05-16 21:38:08 +00:00
|
|
|
$(objpfx)tst-printf-round: $(libm)
|
2018-06-19 11:52:18 +00:00
|
|
|
$(objpfx)tst-scanf-round: $(libm)
|