diff options
Diffstat (limited to 'stdio-common')
575 files changed, 29408 insertions, 344 deletions
diff --git a/stdio-common/Makefile b/stdio-common/Makefile index e4f0146..64b3575 100644 --- a/stdio-common/Makefile +++ b/stdio-common/Makefile @@ -1,4 +1,5 @@ -# Copyright (C) 1991-2024 Free Software Foundation, Inc. +# Copyright (C) 1991-2025 Free Software Foundation, Inc. +# Copyright The GNU Toolchain Authors. # This file is part of the GNU C Library. # The GNU C Library is free software; you can redistribute it and/or @@ -22,6 +23,61 @@ subdir := stdio-common include ../Makeconfig +# List of markers for printf family function tests. +xprintf-funcs := p as d f s sn v vas vd vf vs vsn + +# List of data types and formats for individual per-conversion printf tests. +fmt-convs := double ldouble +fmts := E e F f G g + +# List of data types grouping all conversions in single printf tests. +nonfmt-convs := c char int llong long s short +nonfmt-convs += uchar uint ullong ulong ushort + +convs := $(sort $(fmt-convs) $(nonfmt-convs)) + +xprintf-srcs := \ + $(foreach p,$(xprintf-funcs), \ + $(foreach c,$(convs),tst-printf-format-$(p)-$(c))) + +fmt-xprintf-stems := \ + $(foreach f,$(fmts), \ + $(foreach p,$(xprintf-funcs), \ + $(foreach c,$(fmt-convs), \ + tst-printf-format-$(p)-$(c)-$(f)))) +nonfmt-xprintf-stems := \ + $(foreach p,$(xprintf-funcs), \ + $(foreach c,$(nonfmt-convs),tst-printf-format-$(p)-$(c))) + +xprintf-stems := $(sort $(fmt-xprintf-stems) $(nonfmt-xprintf-stems)) + +# List of markers for scanf family function tests. +xscanf-funcs := s f ss v vf vs + +# List of data types and formats for individual per-conversion scanf tests. +# Further conversions are provided by sysdeps. +xscanf-kinds := char int real uint +fmt-xscanf-char-convs := c +fmts-xscanf-char := b c s +fmt-xscanf-int-convs := char llong short +fmts-xscanf-int := d i +fmt-xscanf-real-convs := +fmts-xscanf-real := aa a ee e ff f gg g +fmt-xscanf-uint-convs := uchar ullong ushort +fmts-xscanf-uint := b o u xx x + +xscanf-convs = $(sort $(fmt-xscanf-char-convs) $(fmt-xscanf-int-convs) \ + $(fmt-xscanf-real-convs) $(fmt-xscanf-uint-convs)) + +xscanf-srcs = $(foreach p,$(xscanf-funcs), \ + $(foreach c,$(xscanf-convs),tst-scanf-format-$(p)-$(c))) + +xscanf-stems = $(sort $(foreach k,$(xscanf-kinds), \ + $(foreach f,$(fmts-xscanf-$(k)), \ + $(foreach p,$(xscanf-funcs), \ + $(foreach c,$(fmt-xscanf-$(k)-convs), \ + tst-scanf-format-$(p)-$(c)-$(f)))))) + headers := \ bits/printf-ldbl.h \ bits/stdio_lim.h \ @@ -30,6 +86,7 @@ headers := \ # headers routines := \ + _fitoa_word \ _itoa \ _itowa \ asprintf \ @@ -171,7 +228,6 @@ tests := \ bug25 \ bug26 \ bug27 \ - bug28 \ bug29 \ errnobug \ scanf1 \ @@ -206,18 +262,45 @@ tests := \ tst-bz11319-fortify2 \ tst-cookie \ tst-dprintf-length \ + tst-fclose-devzero \ + tst-fclose-offset \ tst-fdopen \ + tst-fdopen2 \ tst-ferror \ + tst-fflush-all-input \ + tst-fflush-mmap \ tst-fgets \ + tst-fgets2 \ tst-fileno \ tst-fmemopen \ tst-fmemopen2 \ tst-fmemopen3 \ tst-fmemopen4 \ + tst-fopen \ tst-fphex \ tst-fphex-wide \ + tst-fread \ + tst-freopen2 \ + tst-freopen3 \ + tst-freopen4 \ + tst-freopen5 \ + tst-freopen6 \ + tst-freopen64-2 \ + tst-freopen64-3 \ + tst-freopen64-4 \ + tst-freopen64-6 \ + tst-freopen64-7 \ + tst-freopen7 \ tst-fseek \ + tst-fseek-mmap \ tst-fwrite \ + tst-fwrite-memstrm \ + tst-fwrite-overflow \ + tst-fwrite-pipe \ + tst-fwrite-pos \ + tst-fwrite-ro \ + tst-getline \ + tst-getline-enomem \ tst-gets \ tst-grouping \ tst-grouping2 \ @@ -234,6 +317,7 @@ tests := \ tst-printf-round \ tst-printfsz \ tst-put-error \ + tst-read-offset \ tst-renameat2 \ tst-rndseek \ tst-scanf-binary-c11 \ @@ -242,6 +326,7 @@ tests := \ tst-scanf-binary-gnu89 \ tst-scanf-bz27650 \ tst-scanf-intn \ + tst-scanf-nan \ tst-scanf-round \ tst-scanf-to_inpunct \ tst-setvbuf1 \ @@ -254,6 +339,9 @@ tests := \ tst-swscanf \ tst-tmpnam \ tst-ungetc \ + tst-ungetc-fflush \ + tst-ungetc-leak \ + tst-ungetc-nomem \ tst-unlockedio \ tst-vfprintf-mbs-prec \ tst-vfprintf-user-type \ @@ -266,6 +354,16 @@ tests := \ xbug \ # tests +# Clang 19 takes a very long time, it ran more than 27 minutes on Intel +# Core i7-1195G7 before the process was killed, to compile bug28.c. +# The issue was fixed in upstream but check if clang has the version that has the fix: +# https://github.com/llvm/llvm-project/commit/99dddef340e566e9d303010f1219f7d7d6d37a11 +ifneq ($(have-test-clang-19-or-less),yes) +tests += \ + bug28 \ + # tests +endif + ifeq ($(run-built-tests),yes) ifeq (yes,$(build-shared)) ifneq ($(PERL),no) @@ -281,7 +379,9 @@ endif endif tests-container += \ - tst-popen3 + tst-popen3 \ + tst-setvbuf2 \ + tst-setvbuf2-ind # tests-container generated += \ @@ -293,9 +393,14 @@ generated += \ tests-internal = \ tst-grouping_iterator \ + tst-setvbuf2 \ + tst-setvbuf2-ind \ # tests-internal test-srcs = \ + $(xprintf-srcs) \ + $(xscanf-srcs) \ + tst-fwrite-bz29459 \ tst-printf \ tst-printfsz-islongdouble \ tst-unbputc \ @@ -303,6 +408,9 @@ test-srcs = \ ifeq ($(run-built-tests),yes) tests-special += \ + $(foreach f,$(xprintf-stems),$(objpfx)$(f).out) \ + $(foreach f,$(xscanf-stems),$(objpfx)$(f).out) \ + $(objpfx)tst-fwrite-bz29459.out \ $(objpfx)tst-printf.out \ $(objpfx)tst-printfsz-islongdouble.out \ $(objpfx)tst-setvbuf1-cmp.out \ @@ -312,14 +420,54 @@ tests-special += \ ifeq (yes,$(build-shared)) ifneq ($(PERL),no) tests-special += \ + $(foreach f,$(xprintf-stems),$(objpfx)$(f)-mem.out) \ + $(foreach f,$(xscanf-stems),$(objpfx)$(f)-mem.out) \ + $(objpfx)tst-freopen2-mem.out \ + $(objpfx)tst-freopen3-mem.out \ + $(objpfx)tst-freopen4-mem.out \ + $(objpfx)tst-freopen5-mem.out \ + $(objpfx)tst-freopen6-mem.out \ + $(objpfx)tst-freopen64-2-mem.out \ + $(objpfx)tst-freopen64-3-mem.out \ + $(objpfx)tst-freopen64-4-mem.out \ + $(objpfx)tst-freopen64-6-mem.out \ + $(objpfx)tst-getline-enomem-mem.out \ + $(objpfx)tst-getline-mem.out \ $(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 \ + $(objpfx)tst-ungetc-leak-mem.out \ $(objpfx)tst-vfprintf-width-prec-mem.out \ # tests-special generated += \ + $(foreach f,$(xprintf-stems),$(f)-mem.out) \ + $(foreach f,$(xprintf-stems),$(f).mtrace) \ + $(foreach f,$(xscanf-stems),$(f)-mem.out) \ + $(foreach f,$(xscanf-stems),$(f).mtrace) \ + tst-freopen2-mem.out \ + tst-freopen2.mtrace \ + tst-freopen3-mem.out \ + tst-freopen3.mtrace \ + tst-freopen4-mem.out \ + tst-freopen4.mtrace \ + tst-freopen5-mem.out \ + tst-freopen5.mtrace \ + tst-freopen6-mem.out \ + tst-freopen6.mtrace \ + tst-freopen64-2-mem.out \ + tst-freopen64-2.mtrace \ + tst-freopen64-3-mem.out \ + tst-freopen64-3.mtrace \ + tst-freopen64-4-mem.out \ + tst-freopen64-4.mtrace \ + tst-freopen64-6-mem.out \ + tst-freopen64-6.mtrace \ + tst-getline-enomem-mem.out \ + tst-getline-enomem.mtrace \ + tst-getline-mem.out \ + tst-getline.mtrace \ tst-printf-bz18872-mem.out \ tst-printf-bz18872.c \ tst-printf-bz18872.mtrace \ @@ -330,6 +478,8 @@ generated += \ tst-printf-fp-leak-mem.out \ tst-printf-fp-leak.mtrace \ tst-scanf-bz27650.mtrace \ + tst-ungetc-leak-mem.out \ + tst-ungetc-leak.mtrace \ tst-vfprintf-width-prec-mem.out \ tst-vfprintf-width-prec.mtrace \ # generated @@ -424,6 +574,46 @@ tst-printf-fp-leak-ENV = \ tst-scanf-bz27650-ENV = \ MALLOC_TRACE=$(objpfx)tst-scanf-bz27650.mtrace \ LD_PRELOAD=$(common-objpfx)malloc/libc_malloc_debug.so +tst-ungetc-leak-ENV = \ + MALLOC_TRACE=$(objpfx)tst-ungetc-leak.mtrace \ + LD_PRELOAD=$(common-objpfx)malloc/libc_malloc_debug.so +tst-getline-ENV = \ + MALLOC_TRACE=$(objpfx)tst-getline.mtrace \ + LD_PRELOAD=$(common-objpfx)malloc/libc_malloc_debug.so +tst-getline-enomem-ENV = \ + MALLOC_TRACE=$(objpfx)tst-getline-enomem.mtrace \ + LD_PRELOAD=$(common-objpfx)malloc/libc_malloc_debug.so +tst-freopen2-ENV = \ + MALLOC_TRACE=$(objpfx)tst-freopen2.mtrace \ + LD_PRELOAD=$(common-objpfx)malloc/libc_malloc_debug.so +tst-freopen64-2-ENV = \ + MALLOC_TRACE=$(objpfx)tst-freopen64-2.mtrace \ + LD_PRELOAD=$(common-objpfx)malloc/libc_malloc_debug.so +tst-freopen3-ENV = \ + MALLOC_TRACE=$(objpfx)tst-freopen3.mtrace \ + LD_PRELOAD=$(common-objpfx)malloc/libc_malloc_debug.so +tst-freopen64-3-ENV = \ + MALLOC_TRACE=$(objpfx)tst-freopen64-3.mtrace \ + LD_PRELOAD=$(common-objpfx)malloc/libc_malloc_debug.so +tst-freopen4-ENV = \ + MALLOC_TRACE=$(objpfx)tst-freopen4.mtrace \ + LD_PRELOAD=$(common-objpfx)malloc/libc_malloc_debug.so +tst-freopen64-4-ENV = \ + MALLOC_TRACE=$(objpfx)tst-freopen64-4.mtrace \ + LD_PRELOAD=$(common-objpfx)malloc/libc_malloc_debug.so +tst-freopen5-ENV = \ + MALLOC_TRACE=$(objpfx)tst-freopen5.mtrace \ + LD_PRELOAD=$(common-objpfx)malloc/libc_malloc_debug.so +tst-freopen6-ENV = \ + MALLOC_TRACE=$(objpfx)tst-freopen6.mtrace \ + LD_PRELOAD=$(common-objpfx)malloc/libc_malloc_debug.so +tst-freopen64-6-ENV = \ + MALLOC_TRACE=$(objpfx)tst-freopen64-6.mtrace \ + LD_PRELOAD=$(common-objpfx)malloc/libc_malloc_debug.so + +$(objpfx)tst-fwrite-bz29459.out: tst-fwrite-bz29459.sh $(objpfx)tst-fwrite-bz29459 + $(SHELL) $< $(common-objpfx) '$(test-program-prefix)'; \ + $(evaluate-test) $(objpfx)tst-unbputc.out: tst-unbputc.sh $(objpfx)tst-unbputc $(SHELL) $< $(common-objpfx) '$(test-program-prefix)'; \ @@ -433,6 +623,41 @@ $(objpfx)tst-printf.out: tst-printf.sh $(objpfx)tst-printf $(SHELL) $< $(common-objpfx) '$(test-program-prefix)'; \ $(evaluate-test) +# We can't split a quoted recipe line, so do it via an auxiliary variable. +make-tst-printf-format-out = \ + AWK='$(AWK)' BASH='$(BASH)' \ + $(BASH) $< $@ $(common-objpfx) \ + '$(run-program-prefix-before-env) \ + $(run-program-env) \ + MALLOC_TRACE=$(@:.out=.mtrace) \ + LD_PRELOAD=$(common-objpfx)malloc/libc_malloc_debug.so \ + $(run-program-prefix-after-env)' +$(objpfx)tst-printf-format-%.out: \ + tst-printf-format.sh $(foreach c,$(convs),tst-printf-format-$(c).sh) \ + $(foreach f,$(xprintf-srcs),$(objpfx)$(f)) tst-printf-format.awk + $(make-tst-printf-format-out) > $@; \ + $(evaluate-test) + +# With scanf format tests reuse the same executable for all the inputs +# of the same data type that use a different conversion specifier each. +define tst-scanf-format-rule +$$(objpfx)tst-scanf-format-$(1)-$(2)-$(3).out: \ + tst-scanf-format-$(2)-$(3).input $$(objpfx)tst-scanf-format-$(1)-$(2) + $$(make-tst-scanf-format-out) > $$@ < $$<; \ + $$(evaluate-test) +endef +make-tst-scanf-format-out = \ + $(test-wrapper-env) \ + $(run-program-env) \ + MALLOC_TRACE=$(@:.out=.mtrace) \ + LD_PRELOAD=$(common-objpfx)malloc/libc_malloc_debug.so \ + $(host-test-program-cmd) +$(foreach k,$(xscanf-kinds), \ + $(foreach f,$(fmts-xscanf-$(k)), \ + $(foreach p,$(xscanf-funcs), \ + $(foreach c,$(fmt-xscanf-$(k)-convs), \ + $(eval $(call tst-scanf-format-rule,$(p),$(c),$(f))))))) + $(objpfx)tst-printfsz-islongdouble.out: \ tst-printfsz-islongdouble.sh $(objpfx)tst-printfsz-islongdouble $(SHELL) $^ '$(test-program-prefix)' $@; \ @@ -446,6 +671,13 @@ $(objpfx)tst-printf-bz18872.c: tst-printf-bz18872.sh $(objpfx)tst-%-mem.out: $(objpfx)tst-%.out $(common-objpfx)malloc/mtrace $(objpfx)tst-$*.mtrace > $@; \ $(evaluate-test) +$(objpfx)tst-printf-format-%-mem.out: $(objpfx)tst-printf-format-%.out + { test -r $(objpfx)tst-printf-format-$*.mtrace \ + || ( echo "$(objpfx)tst-printf-format-$*.mtrace does not exist"; \ + exit 77; ) \ + && $(common-objpfx)malloc/mtrace \ + $(objpfx)tst-printf-format-$*.mtrace; } > $@; \ + $(evaluate-test) errlist-h = $(firstword $(wildcard $(addsuffix /errlist.h,$(sysdirs) .))) @@ -489,6 +721,10 @@ CFLAGS-dprintf.c += $(config-cflags-wno-ignored-attributes) # off for non-shared builds. CFLAGS-_itoa.o = $(no-stack-protector) CFLAGS-_itoa.op = $(no-stack-protector) +CFLAGS-_fitoa_word.o = $(no-stack-protector) +CFLAGS-_fitoa_word.op = $(no-stack-protector) + +CFLAGS-scanf13.c += $(test-config-cflags-wno-fortify-source) # scanf18.c and scanf19.c test a deprecated extension which is no # longer visible under most conformance levels; see the source files @@ -508,7 +744,7 @@ CFLAGS-tst-gets.c += -Wno-deprecated-declarations # BZ #11319 was first fixed for regular vdprintf, then reopened because # the fortified version had the same bug. -CFLAGS-tst-bz11319-fortify2.c += $(no-fortify-source),-D_FORTIFY_SOURCE=2 +CFLAGS-tst-bz11319-fortify2.c += $(no-fortify-source) -D_FORTIFY_SOURCE=2 CFLAGS-tst-memstream-string.c += -fno-builtin-fprintf @@ -531,5 +767,21 @@ $(objpfx)tst-setvbuf1-cmp.out: tst-setvbuf1.expect $(objpfx)tst-setvbuf1.out cmp $^ > $@; \ $(evaluate-test) +CFLAGS-tst-setvbuf2.c += -DIND_PROC=\"$(objpfx)tst-setvbuf2-ind\" +$(objpfx)tst-setvbuf2-ind : $(objpfx)tst-setvbuf2-ind.o $(shared-thread-library) +$(objpfx)tst-setvbuf2.out: $(objpfx)tst-setvbuf2-ind +$(objpfx)tst-setvbuf2 : $(shared-thread-library) + $(objpfx)tst-printf-round: $(libm) $(objpfx)tst-scanf-round: $(libm) + +# With scanf format tests real conversions depend on libm. +define tst-scanf-format-libm-dep +$$(objpfx)tst-scanf-format-$(1)-$(2): $$(libm) +endef +$(foreach p,$(xscanf-funcs), \ + $(foreach c,$(fmt-xscanf-real-convs), \ + $(eval $(call tst-scanf-format-libm-dep,$(p),$(c))))) + +$(objpfx)tst-freopen7: $(shared-thread-library) +$(objpfx)tst-freopen64-7: $(shared-thread-library) diff --git a/stdio-common/Xprintf_buffer_done.c b/stdio-common/Xprintf_buffer_done.c index 4ae25c6..2356543 100644 --- a/stdio-common/Xprintf_buffer_done.c +++ b/stdio-common/Xprintf_buffer_done.c @@ -1,5 +1,5 @@ /* Final status reporting for struct __*printf_buffer. Generic version. - Copyright (C) 2022-2024 Free Software Foundation, Inc. + Copyright (C) 2022-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/Xprintf_buffer_flush.c b/stdio-common/Xprintf_buffer_flush.c index d299855..05ce177 100644 --- a/stdio-common/Xprintf_buffer_flush.c +++ b/stdio-common/Xprintf_buffer_flush.c @@ -1,5 +1,5 @@ /* Flush wrapper for struct __*printf_buffer. Generic version. - Copyright (C) 2022-2024 Free Software Foundation, Inc. + Copyright (C) 2022-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/Xprintf_buffer_pad_1.c b/stdio-common/Xprintf_buffer_pad_1.c index b8e314b..da57629 100644 --- a/stdio-common/Xprintf_buffer_pad_1.c +++ b/stdio-common/Xprintf_buffer_pad_1.c @@ -1,5 +1,5 @@ /* Write repeated characters to struct __*printf_buffer. Generic version. - Copyright (C) 2022-2024 Free Software Foundation, Inc. + Copyright (C) 2022-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/Xprintf_buffer_putc_1.c b/stdio-common/Xprintf_buffer_putc_1.c index 66d85bf..18bf3e1 100644 --- a/stdio-common/Xprintf_buffer_putc_1.c +++ b/stdio-common/Xprintf_buffer_putc_1.c @@ -1,5 +1,5 @@ /* Overflow write function for struct __*printf_buffer. Generic version. - Copyright (C) 2022-2024 Free Software Foundation, Inc. + Copyright (C) 2022-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/Xprintf_buffer_puts_1.c b/stdio-common/Xprintf_buffer_puts_1.c index 6bb19c3..4c6670c 100644 --- a/stdio-common/Xprintf_buffer_puts_1.c +++ b/stdio-common/Xprintf_buffer_puts_1.c @@ -1,5 +1,5 @@ /* String write function for struct __*printf_buffer. Generic version. - Copyright (C) 2022-2024 Free Software Foundation, Inc. + Copyright (C) 2022-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/Xprintf_buffer_write.c b/stdio-common/Xprintf_buffer_write.c index 84f8b1b..ea1dcf8 100644 --- a/stdio-common/Xprintf_buffer_write.c +++ b/stdio-common/Xprintf_buffer_write.c @@ -1,5 +1,5 @@ /* Blob write function for struct __*printf_buffer. Generic version. - Copyright (C) 2022-2024 Free Software Foundation, Inc. + Copyright (C) 2022-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/Xprintf_function_invoke.c b/stdio-common/Xprintf_function_invoke.c index b9a240e..eccc5c6 100644 --- a/stdio-common/Xprintf_function_invoke.c +++ b/stdio-common/Xprintf_function_invoke.c @@ -1,5 +1,5 @@ /* Invoke a printf specifier handler. Generic version. - Copyright (C) 1991-2024 Free Software Foundation, Inc. + Copyright (C) 1991-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/_fitoa_word.c b/stdio-common/_fitoa_word.c new file mode 100644 index 0000000..8064b1e --- /dev/null +++ b/stdio-common/_fitoa_word.c @@ -0,0 +1,59 @@ +/* Internal function for converting integers to ASCII. + Copyright (C) 1994-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <_itoa.h> + +char * +_itoa_word (_ITOA_WORD_TYPE value, char *buflim, + unsigned int base, int upper_case) +{ + const char *digits = (upper_case + ? _itoa_upper_digits + : _itoa_lower_digits); + + switch (base) + { +#define SPECIAL(Base) \ + case Base: \ + do \ + *--buflim = digits[value % Base]; \ + while ((value /= Base) != 0); \ + break + + SPECIAL (10); + SPECIAL (16); + SPECIAL (8); + default: + do + *--buflim = digits[value % base]; + while ((value /= base) != 0); + } + return buflim; +} +#undef SPECIAL + +char * +_fitoa_word (_ITOA_WORD_TYPE value, char *buf, unsigned int base, + int upper_case) +{ + char tmpbuf[sizeof (value) * 4]; /* Worst case length: base 2. */ + char *cp = _itoa_word (value, tmpbuf + sizeof (value) * 4, base, upper_case); + while (cp < tmpbuf + sizeof (value) * 4) + *buf++ = *cp++; + return buf; +} diff --git a/stdio-common/_i18n_number.h b/stdio-common/_i18n_number.h index 3494074..90aa2f7 100644 --- a/stdio-common/_i18n_number.h +++ b/stdio-common/_i18n_number.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2024 Free Software Foundation, Inc. +/* Copyright (C) 2000-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/_itoa.c b/stdio-common/_itoa.c index 36f9c17..08859f0 100644 --- a/stdio-common/_itoa.c +++ b/stdio-common/_itoa.c @@ -1,5 +1,5 @@ /* Internal function for converting integers to ASCII. - Copyright (C) 1994-2024 Free Software Foundation, Inc. + Copyright (C) 1994-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -162,38 +162,6 @@ const struct base_table_t _itoa_base_table[] attribute_hidden = }; #endif -#if IS_IN (libc) -char * -_itoa_word (_ITOA_WORD_TYPE value, char *buflim, - unsigned int base, int upper_case) -{ - const char *digits = (upper_case - ? _itoa_upper_digits - : _itoa_lower_digits); - - switch (base) - { -#define SPECIAL(Base) \ - case Base: \ - do \ - *--buflim = digits[value % Base]; \ - while ((value /= Base) != 0); \ - break - - SPECIAL (10); - SPECIAL (16); - SPECIAL (8); - default: - do - *--buflim = digits[value % base]; - while ((value /= base) != 0); - } - return buflim; -} -#undef SPECIAL -#endif /* IS_IN (libc) */ - - #if _ITOA_NEEDED char * _itoa (unsigned long long int value, char *buflim, unsigned int base, @@ -460,17 +428,6 @@ _itoa (unsigned long long int value, char *buflim, unsigned int base, } #endif -char * -_fitoa_word (_ITOA_WORD_TYPE value, char *buf, unsigned int base, - int upper_case) -{ - char tmpbuf[sizeof (value) * 4]; /* Worst case length: base 2. */ - char *cp = _itoa_word (value, tmpbuf + sizeof (value) * 4, base, upper_case); - while (cp < tmpbuf + sizeof (value) * 4) - *buf++ = *cp++; - return buf; -} - #if _ITOA_NEEDED char * _fitoa (unsigned long long value, char *buf, unsigned int base, int upper_case) diff --git a/stdio-common/_itowa.c b/stdio-common/_itowa.c index 53a6cb6..6443b29 100644 --- a/stdio-common/_itowa.c +++ b/stdio-common/_itowa.c @@ -1,5 +1,5 @@ /* Internal function for converting integers to ASCII. - Copyright (C) 1994-2024 Free Software Foundation, Inc. + Copyright (C) 1994-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/_itowa.h b/stdio-common/_itowa.h index 05889a2..948bee0 100644 --- a/stdio-common/_itowa.h +++ b/stdio-common/_itowa.h @@ -1,5 +1,5 @@ /* Internal function for converting integers to ASCII. - Copyright (C) 1994-2024 Free Software Foundation, Inc. + Copyright (C) 1994-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/asprintf.c b/stdio-common/asprintf.c index 0886e8e..f8137ee 100644 --- a/stdio-common/asprintf.c +++ b/stdio-common/asprintf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2024 Free Software Foundation, Inc. +/* Copyright (C) 1991-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/bits/printf-ldbl.h b/stdio-common/bits/printf-ldbl.h index 73e7b3c..00b33d7 100644 --- a/stdio-common/bits/printf-ldbl.h +++ b/stdio-common/bits/printf-ldbl.h @@ -1,5 +1,5 @@ /* -mlong-double-64 compatibility mode for <printf.h> functions. - Copyright (C) 2006-2024 Free Software Foundation, Inc. + Copyright (C) 2006-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/bug-vfprintf-nargs.c b/stdio-common/bug-vfprintf-nargs.c index 9594fc4..353a62c 100644 --- a/stdio-common/bug-vfprintf-nargs.c +++ b/stdio-common/bug-vfprintf-nargs.c @@ -1,5 +1,5 @@ /* Test for vfprintf nargs allocation overflow (BZ #13656). - Copyright (C) 2012-2024 Free Software Foundation, Inc. + Copyright (C) 2012-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/bug1.c b/stdio-common/bug1.c index 18e7d4c..f23ee5b 100644 --- a/stdio-common/bug1.c +++ b/stdio-common/bug1.c @@ -1,6 +1,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <libc-diag.h> int main (void) @@ -13,12 +14,22 @@ main (void) stream = open_memstream (&bp, &size); fprintf (stream, "hello"); fflush (stream); + /* clang do not handle %Z format. */ + DIAG_PUSH_NEEDS_COMMENT_CLANG; + DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wformat-invalid-specifier"); + DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wformat-extra-args"); printf ("buf = %s, size = %Zu\n", bp, size); + DIAG_POP_NEEDS_COMMENT_CLANG; lose |= size != 5; lose |= strncmp (bp, "hello", size); fprintf (stream, ", world"); fclose (stream); + /* clang do not handle %Z format. */ + DIAG_PUSH_NEEDS_COMMENT_CLANG; + DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wformat-invalid-specifier"); + DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wformat-extra-args"); printf ("buf = %s, size = %Zu\n", bp, size); + DIAG_POP_NEEDS_COMMENT_CLANG; lose |= size != 12; lose |= strncmp (bp, "hello, world", 12); diff --git a/stdio-common/bug26.c b/stdio-common/bug26.c index 864efbe..74a00d0 100644 --- a/stdio-common/bug26.c +++ b/stdio-common/bug26.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2013-2024 Free Software Foundation, Inc. +/* Copyright (C) 2013-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/bug5.c b/stdio-common/bug5.c index dfa19ae..c46810f 100644 --- a/stdio-common/bug5.c +++ b/stdio-common/bug5.c @@ -6,6 +6,7 @@ #include <stdio.h> #include <stdlib.h> #include <unistd.h> +#include <libc-diag.h> #include <support/support.h> @@ -30,7 +31,12 @@ main (void) return 1; } for (i = 0; i < 1000; ++i) + /* clang do not handle %Z format. */ + DIAG_PUSH_NEEDS_COMMENT_CLANG; + DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wformat-invalid-specifier"); + DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wformat-extra-args"); fprintf (in, "%Zu\n", i); + DIAG_POP_NEEDS_COMMENT_CLANG; out = fopen (outname, "w"); if (out == NULL) diff --git a/stdio-common/ctermid.c b/stdio-common/ctermid.c index 891d92f..c4c8432 100644 --- a/stdio-common/ctermid.c +++ b/stdio-common/ctermid.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2024 Free Software Foundation, Inc. +/* Copyright (C) 1991-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/cuserid.c b/stdio-common/cuserid.c index aceac60..c006892 100644 --- a/stdio-common/cuserid.c +++ b/stdio-common/cuserid.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2024 Free Software Foundation, Inc. +/* Copyright (C) 1991-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/dprintf.c b/stdio-common/dprintf.c index 39a5466..5ecf9fd 100644 --- a/stdio-common/dprintf.c +++ b/stdio-common/dprintf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2024 Free Software Foundation, Inc. +/* Copyright (C) 1991-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/err_map.h b/stdio-common/err_map.h index 6d0aebb..8ef2683 100644 --- a/stdio-common/err_map.h +++ b/stdio-common/err_map.h @@ -1,5 +1,5 @@ /* Internal errno names mapping definition. - Copyright (C) 2022-2024 Free Software Foundation, Inc. + Copyright (C) 2022-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/errlist-data-gen.c b/stdio-common/errlist-data-gen.c index ee54f78..e1f294e 100644 --- a/stdio-common/errlist-data-gen.c +++ b/stdio-common/errlist-data-gen.c @@ -1,5 +1,5 @@ /* Internal errno names mapping definition. - Copyright (C) 2022-2024 Free Software Foundation, Inc. + Copyright (C) 2022-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/errlist.c b/stdio-common/errlist.c index 485d940..302973f 100644 --- a/stdio-common/errlist.c +++ b/stdio-common/errlist.c @@ -1,5 +1,5 @@ /* Internal errno names mapping definition. - Copyright (C) 1991-2024 Free Software Foundation, Inc. + Copyright (C) 1991-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/errname.c b/stdio-common/errname.c index 19ba688..574f824 100644 --- a/stdio-common/errname.c +++ b/stdio-common/errname.c @@ -1,5 +1,5 @@ /* Internal errno names mapping definition. - Copyright (C) 2022-2024 Free Software Foundation, Inc. + Copyright (C) 2022-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/errnobug.c b/stdio-common/errnobug.c index 5509235..923cd81 100644 --- a/stdio-common/errnobug.c +++ b/stdio-common/errnobug.c @@ -1,6 +1,6 @@ /* Regression test for reported old bug that errno is clobbered by the first successful output to a stream on an unseekable object. - Copyright (C) 1995-2024 Free Software Foundation, Inc. + Copyright (C) 1995-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/flockfile.c b/stdio-common/flockfile.c index 897575c..f563390 100644 --- a/stdio-common/flockfile.c +++ b/stdio-common/flockfile.c @@ -1,5 +1,5 @@ /* Lock I/O stream. Singlethreaded version. - Copyright (C) 1996-2024 Free Software Foundation, Inc. + Copyright (C) 1996-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/fprintf.c b/stdio-common/fprintf.c index 0669397..4fb3669 100644 --- a/stdio-common/fprintf.c +++ b/stdio-common/fprintf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2024 Free Software Foundation, Inc. +/* Copyright (C) 1991-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/fscanf.c b/stdio-common/fscanf.c index 6aa2ba9..845078e 100644 --- a/stdio-common/fscanf.c +++ b/stdio-common/fscanf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2024 Free Software Foundation, Inc. +/* Copyright (C) 1991-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/ftrylockfile.c b/stdio-common/ftrylockfile.c index 480f8f2..34c298d 100644 --- a/stdio-common/ftrylockfile.c +++ b/stdio-common/ftrylockfile.c @@ -1,5 +1,5 @@ /* Try locking I/O stream. Singlethreaded version. - Copyright (C) 1996-2024 Free Software Foundation, Inc. + Copyright (C) 1996-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/funlockfile.c b/stdio-common/funlockfile.c index 5ed5f24..443364e 100644 --- a/stdio-common/funlockfile.c +++ b/stdio-common/funlockfile.c @@ -1,5 +1,5 @@ /* Unlock I/O stream. Singlethreaded version. - Copyright (C) 1996-2024 Free Software Foundation, Inc. + Copyright (C) 1996-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/fxprintf.c b/stdio-common/fxprintf.c index 9b7281b..e87275c 100644 --- a/stdio-common/fxprintf.c +++ b/stdio-common/fxprintf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2005-2024 Free Software Foundation, Inc. +/* Copyright (C) 2005-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/gentempfd.c b/stdio-common/gentempfd.c index 24e8026..c5b1287 100644 --- a/stdio-common/gentempfd.c +++ b/stdio-common/gentempfd.c @@ -1,5 +1,5 @@ /* Generate a temporary file descriptor. Generic/POSIX version. - Copyright (C) 2017-2024 Free Software Foundation, Inc. + Copyright (C) 2017-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/getline.c b/stdio-common/getline.c index 829f26e..6f86d41 100644 --- a/stdio-common/getline.c +++ b/stdio-common/getline.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2024 Free Software Foundation, Inc. +/* Copyright (C) 1991-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/getw.c b/stdio-common/getw.c index 921e224..84d4e3f 100644 --- a/stdio-common/getw.c +++ b/stdio-common/getw.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2024 Free Software Foundation, Inc. +/* Copyright (C) 1991-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/grouping_iterator.c b/stdio-common/grouping_iterator.c index aa4d8ad..cd9de7f 100644 --- a/stdio-common/grouping_iterator.c +++ b/stdio-common/grouping_iterator.c @@ -1,5 +1,5 @@ /* Iterator for inserting thousands separators into numbers. - Copyright (C) 2022-2024 Free Software Foundation, Inc. + Copyright (C) 2022-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/grouping_iterator.h b/stdio-common/grouping_iterator.h index bb67335..2185b15 100644 --- a/stdio-common/grouping_iterator.h +++ b/stdio-common/grouping_iterator.h @@ -1,5 +1,5 @@ /* Iterator for grouping a number while scanning it forward. - Copyright (C) 2022-2024 Free Software Foundation, Inc. + Copyright (C) 2022-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/iovfscanf.c b/stdio-common/iovfscanf.c index 43b5c70..c962f95 100644 --- a/stdio-common/iovfscanf.c +++ b/stdio-common/iovfscanf.c @@ -1,5 +1,5 @@ /* Implementation and symbols for _IO_vfscanf. - Copyright (C) 2018-2024 Free Software Foundation, Inc. + Copyright (C) 2018-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -29,7 +29,7 @@ attribute_compat_text_section __IO_vfscanf (FILE *fp, const char *format, va_list ap, int *errp) { int rv = __vfscanf_internal (fp, format, ap, 0); - if (__glibc_unlikely (errp != 0)) + if (__glibc_unlikely (errp != NULL)) *errp = (rv == -1); return rv; } diff --git a/stdio-common/isoc23_fscanf.c b/stdio-common/isoc23_fscanf.c index 81a7e9a..fae6f0e 100644 --- a/stdio-common/isoc23_fscanf.c +++ b/stdio-common/isoc23_fscanf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2024 Free Software Foundation, Inc. +/* Copyright (C) 1991-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/isoc23_scanf.c b/stdio-common/isoc23_scanf.c index b355abd..fe9631d 100644 --- a/stdio-common/isoc23_scanf.c +++ b/stdio-common/isoc23_scanf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2024 Free Software Foundation, Inc. +/* Copyright (C) 1991-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/isoc23_sscanf.c b/stdio-common/isoc23_sscanf.c index 72551b2..942a637 100644 --- a/stdio-common/isoc23_sscanf.c +++ b/stdio-common/isoc23_sscanf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2024 Free Software Foundation, Inc. +/* Copyright (C) 1991-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/isoc23_vfscanf.c b/stdio-common/isoc23_vfscanf.c index 7b24b2a..2669299 100644 --- a/stdio-common/isoc23_vfscanf.c +++ b/stdio-common/isoc23_vfscanf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2024 Free Software Foundation, Inc. +/* Copyright (C) 1991-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/isoc23_vscanf.c b/stdio-common/isoc23_vscanf.c index 0860a49..74a2671 100644 --- a/stdio-common/isoc23_vscanf.c +++ b/stdio-common/isoc23_vscanf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2024 Free Software Foundation, Inc. +/* Copyright (C) 1991-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/isoc23_vsscanf.c b/stdio-common/isoc23_vsscanf.c index 4133d73..1f51240 100644 --- a/stdio-common/isoc23_vsscanf.c +++ b/stdio-common/isoc23_vsscanf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2024 Free Software Foundation, Inc. +/* Copyright (C) 1993-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/isoc99_fscanf.c b/stdio-common/isoc99_fscanf.c index 400d2c8..0815aa2 100644 --- a/stdio-common/isoc99_fscanf.c +++ b/stdio-common/isoc99_fscanf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2024 Free Software Foundation, Inc. +/* Copyright (C) 1991-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/isoc99_scanf.c b/stdio-common/isoc99_scanf.c index 3278383..bcc687a 100644 --- a/stdio-common/isoc99_scanf.c +++ b/stdio-common/isoc99_scanf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2024 Free Software Foundation, Inc. +/* Copyright (C) 1991-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/isoc99_sscanf.c b/stdio-common/isoc99_sscanf.c index 75e2bd2..af52ee5 100644 --- a/stdio-common/isoc99_sscanf.c +++ b/stdio-common/isoc99_sscanf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2024 Free Software Foundation, Inc. +/* Copyright (C) 1991-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/isoc99_vfscanf.c b/stdio-common/isoc99_vfscanf.c index ee7d5a7..7eb0350 100644 --- a/stdio-common/isoc99_vfscanf.c +++ b/stdio-common/isoc99_vfscanf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2024 Free Software Foundation, Inc. +/* Copyright (C) 1991-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/isoc99_vscanf.c b/stdio-common/isoc99_vscanf.c index b4aa3d5..9e59d2c 100644 --- a/stdio-common/isoc99_vscanf.c +++ b/stdio-common/isoc99_vscanf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2024 Free Software Foundation, Inc. +/* Copyright (C) 1991-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/isoc99_vsscanf.c b/stdio-common/isoc99_vsscanf.c index b38eed9..4854467 100644 --- a/stdio-common/isoc99_vsscanf.c +++ b/stdio-common/isoc99_vsscanf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2024 Free Software Foundation, Inc. +/* Copyright (C) 1993-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/itoa-digits.c b/stdio-common/itoa-digits.c index bffaa6a..5daa3ab 100644 --- a/stdio-common/itoa-digits.c +++ b/stdio-common/itoa-digits.c @@ -1,5 +1,5 @@ /* Digits. - Copyright (C) 1994-2024 Free Software Foundation, Inc. + Copyright (C) 1994-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/itoa-udigits.c b/stdio-common/itoa-udigits.c index 23f7cb3..a1e9e2b 100644 --- a/stdio-common/itoa-udigits.c +++ b/stdio-common/itoa-udigits.c @@ -1,5 +1,5 @@ /* Digits. - Copyright (C) 1994-2024 Free Software Foundation, Inc. + Copyright (C) 1994-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/itowa-digits.c b/stdio-common/itowa-digits.c index b62952c..6698dfe 100644 --- a/stdio-common/itowa-digits.c +++ b/stdio-common/itowa-digits.c @@ -1,5 +1,5 @@ /* Digits. - Copyright (C) 1994-2024 Free Software Foundation, Inc. + Copyright (C) 1994-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/perror.c b/stdio-common/perror.c index 6c16dc4..d384e7f 100644 --- a/stdio-common/perror.c +++ b/stdio-common/perror.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2024 Free Software Foundation, Inc. +/* Copyright (C) 1991-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/printf-parse.h b/stdio-common/printf-parse.h index 3835c02..d185cfe 100644 --- a/stdio-common/printf-parse.h +++ b/stdio-common/printf-parse.h @@ -1,5 +1,5 @@ /* Internal header for parsing printf format strings. - Copyright (C) 1995-2024 Free Software Foundation, Inc. + Copyright (C) 1995-2025 Free Software Foundation, Inc. This file is part of th GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/printf-parsemb.c b/stdio-common/printf-parsemb.c index ab9fafb..a7ba52a 100644 --- a/stdio-common/printf-parsemb.c +++ b/stdio-common/printf-parsemb.c @@ -1,5 +1,5 @@ /* Helper functions for parsing printf format strings. - Copyright (C) 1995-2024 Free Software Foundation, Inc. + Copyright (C) 1995-2025 Free Software Foundation, Inc. This file is part of th GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -17,6 +17,7 @@ <https://www.gnu.org/licenses/>. */ #include <ctype.h> +#include <errno.h> #include <limits.h> #include <stdlib.h> #include <string.h> diff --git a/stdio-common/printf-prs.c b/stdio-common/printf-prs.c index 8c9e3fa..7086af4 100644 --- a/stdio-common/printf-prs.c +++ b/stdio-common/printf-prs.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2024 Free Software Foundation, Inc. +/* Copyright (C) 1991-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/printf.c b/stdio-common/printf.c index f4e14c4..fa35244 100644 --- a/stdio-common/printf.c +++ b/stdio-common/printf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2024 Free Software Foundation, Inc. +/* Copyright (C) 1991-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/printf.h b/stdio-common/printf.h index caf8c85..970381b 100644 --- a/stdio-common/printf.h +++ b/stdio-common/printf.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2024 Free Software Foundation, Inc. +/* Copyright (C) 1991-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/printf_buffer-char.h b/stdio-common/printf_buffer-char.h index adc2f37..2aab74f 100644 --- a/stdio-common/printf_buffer-char.h +++ b/stdio-common/printf_buffer-char.h @@ -1,5 +1,5 @@ /* Macros for the multibyte (char) implementation of struct __printf_buffer. - Copyright (C) 2022-2024 Free Software Foundation, Inc. + Copyright (C) 2022-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/printf_buffer-wchar_t.h b/stdio-common/printf_buffer-wchar_t.h index a13b416..5959577 100644 --- a/stdio-common/printf_buffer-wchar_t.h +++ b/stdio-common/printf_buffer-wchar_t.h @@ -1,5 +1,5 @@ /* Macros for wide (wchar_t) implementation of struct __wprintf_buffer. - Copyright (C) 2022-2024 Free Software Foundation, Inc. + Copyright (C) 2022-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/printf_buffer_as_file.c b/stdio-common/printf_buffer_as_file.c index 917b57e..fbfff31 100644 --- a/stdio-common/printf_buffer_as_file.c +++ b/stdio-common/printf_buffer_as_file.c @@ -1,5 +1,5 @@ /* FILE * interface to a struct __printf_buffer. Multibyte version. - Copyright (C) 2022-2024 Free Software Foundation, Inc. + Copyright (C) 2022-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/printf_buffer_as_file.h b/stdio-common/printf_buffer_as_file.h index c0d65b9..241b43d 100644 --- a/stdio-common/printf_buffer_as_file.h +++ b/stdio-common/printf_buffer_as_file.h @@ -1,5 +1,5 @@ /* FILE * interface to a struct __*printf_buffer. - Copyright (C) 2022-2024 Free Software Foundation, Inc. + Copyright (C) 2022-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/printf_buffer_done.c b/stdio-common/printf_buffer_done.c index 495807e..fcc7388 100644 --- a/stdio-common/printf_buffer_done.c +++ b/stdio-common/printf_buffer_done.c @@ -1,5 +1,5 @@ /* Final status reporting for struct __printf_buffer. Multibyte version. - Copyright (C) 2022-2024 Free Software Foundation, Inc. + Copyright (C) 2022-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/printf_buffer_flush.c b/stdio-common/printf_buffer_flush.c index f8673ef..2573be5 100644 --- a/stdio-common/printf_buffer_flush.c +++ b/stdio-common/printf_buffer_flush.c @@ -1,5 +1,5 @@ /* Flush a struct __printf_buffer. Multibyte version. - Copyright (C) 2022-2024 Free Software Foundation, Inc. + Copyright (C) 2022-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/printf_buffer_pad_1.c b/stdio-common/printf_buffer_pad_1.c index d957f0b..59cbcd8 100644 --- a/stdio-common/printf_buffer_pad_1.c +++ b/stdio-common/printf_buffer_pad_1.c @@ -1,5 +1,5 @@ /* Write repeated characters to struct __printf_buffer. Multibyte version. - Copyright (C) 2022-2024 Free Software Foundation, Inc. + Copyright (C) 2022-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/printf_buffer_putc_1.c b/stdio-common/printf_buffer_putc_1.c index 5f17902..972b2a8 100644 --- a/stdio-common/printf_buffer_putc_1.c +++ b/stdio-common/printf_buffer_putc_1.c @@ -1,5 +1,5 @@ /* Overflow character write function for struct __printf_buffer. - Copyright (C) 2022-2024 Free Software Foundation, Inc. + Copyright (C) 2022-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/printf_buffer_puts_1.c b/stdio-common/printf_buffer_puts_1.c index fbaa155..c064be0 100644 --- a/stdio-common/printf_buffer_puts_1.c +++ b/stdio-common/printf_buffer_puts_1.c @@ -1,5 +1,5 @@ /* String write function for struct __printf_buffer. Multibyte version. - Copyright (C) 2022-2024 Free Software Foundation, Inc. + Copyright (C) 2022-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/printf_buffer_to_file.c b/stdio-common/printf_buffer_to_file.c index 1c5ce37..1ec7a76 100644 --- a/stdio-common/printf_buffer_to_file.c +++ b/stdio-common/printf_buffer_to_file.c @@ -1,5 +1,5 @@ /* Multibyte printf buffers writing data to a FILE * stream. - Copyright (C) 2022-2024 Free Software Foundation, Inc. + Copyright (C) 2022-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/printf_buffer_to_file.h b/stdio-common/printf_buffer_to_file.h index 89c6181..802e92f 100644 --- a/stdio-common/printf_buffer_to_file.h +++ b/stdio-common/printf_buffer_to_file.h @@ -1,5 +1,5 @@ /* Multibyte and wide printf buffers writing data to a FILE * stream. - Copyright (C) 2022-2024 Free Software Foundation, Inc. + Copyright (C) 2022-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/printf_buffer_write.c b/stdio-common/printf_buffer_write.c index 3437d86..170237c 100644 --- a/stdio-common/printf_buffer_write.c +++ b/stdio-common/printf_buffer_write.c @@ -1,5 +1,5 @@ /* Blob write function for struct __printf_buffer. Multibyte version. - Copyright (C) 2022-2024 Free Software Foundation, Inc. + Copyright (C) 2022-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/printf_fp.c b/stdio-common/printf_fp.c index e75706f..0039e1b 100644 --- a/stdio-common/printf_fp.c +++ b/stdio-common/printf_fp.c @@ -1,5 +1,5 @@ /* Floating point output for `printf'. - Copyright (C) 1995-2024 Free Software Foundation, Inc. + Copyright (C) 1995-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -29,7 +29,6 @@ #include <gmp.h> #include <ieee754.h> #include <stdlib/gmp-impl.h> -#include <stdlib/longlong.h> #include <stdlib/fpioconst.h> #include <locale/localeinfo.h> #include <limits.h> @@ -40,6 +39,7 @@ #include <stdlib.h> #include <wchar.h> #include <stdbool.h> +#include <stdbit.h> #include <rounding-mode.h> #include <printf_buffer.h> #include <printf_buffer_to_file.h> @@ -386,7 +386,7 @@ __printf_fp_buffer_1 (struct __printf_buffer *buf, locale_t loc, { int cnt; MPN_ASSIGN (p.scale, p.tmp); - count_leading_zeros (cnt, p.scale[p.scalesize - 1]); + cnt = stdc_leading_zeros (p.scale[p.scalesize - 1]); scaleexpo = (p.scalesize - 2) * BITS_PER_MP_LIMB - cnt - 1; exp10 |= 1 << explog; } @@ -408,7 +408,7 @@ __printf_fp_buffer_1 (struct __printf_buffer *buf, locale_t loc, ; /* Determine number of bits the scaling factor is misplaced. */ - count_leading_zeros (cnt_h, p.scale[p.scalesize - 1]); + cnt_h = stdc_leading_zeros (p.scale[p.scalesize - 1]); if (cnt_h == 0) { @@ -426,17 +426,17 @@ __printf_fp_buffer_1 (struct __printf_buffer *buf, locale_t loc, { if (p.scale[i] != 0) { - count_trailing_zeros (cnt_l, p.scale[i]); + cnt_l = stdc_trailing_zeros (p.scale[i]); if (p.frac[i] != 0) { int cnt_l2; - count_trailing_zeros (cnt_l2, p.frac[i]); + cnt_l2 = stdc_trailing_zeros (p.frac[i]); if (cnt_l2 < cnt_l) cnt_l = cnt_l2; } } else - count_trailing_zeros (cnt_l, p.frac[i]); + cnt_l = stdc_trailing_zeros (p.frac[i]); /* Now shift the numbers to their optimal position. */ if (i == 0 && BITS_PER_MP_LIMB - cnt_h > cnt_l) @@ -528,7 +528,7 @@ __printf_fp_buffer_1 (struct __printf_buffer *buf, locale_t loc, if (cy == 0) --p.tmpsize; - count_leading_zeros (cnt_h, p.tmp[p.tmpsize - 1]); + cnt_h = stdc_leading_zeros (p.tmp[p.tmpsize - 1]); incr = (p.tmpsize - p.fracsize) * BITS_PER_MP_LIMB + BITS_PER_MP_LIMB - 1 - cnt_h; @@ -584,7 +584,7 @@ __printf_fp_buffer_1 (struct __printf_buffer *buf, locale_t loc, } else { - count_trailing_zeros (cnt_l, p.tmp[i]); + cnt_l = stdc_trailing_zeros (p.tmp[i]); /* Now shift the numbers to their optimal position. */ if (i == 0 && BITS_PER_MP_LIMB - 1 - cnt_h > cnt_l) @@ -630,7 +630,7 @@ __printf_fp_buffer_1 (struct __printf_buffer *buf, locale_t loc, p.tmpsize = p.fracsize; assert (cy == 0 || p.tmp[p.tmpsize - 1] < 20); - count_trailing_zeros (cnt_l, p.tmp[0]); + cnt_l = stdc_trailing_zeros (p.tmp[0]); if (cnt_l < MIN (4, p.exponent)) { cy = __mpn_lshift (p.frac, p.tmp, p.tmpsize, diff --git a/stdio-common/printf_fphex.c b/stdio-common/printf_fphex.c index 279e16b..461aa04 100644 --- a/stdio-common/printf_fphex.c +++ b/stdio-common/printf_fphex.c @@ -1,5 +1,5 @@ /* Print floating point number in hexadecimal notation according to ISO C99. - Copyright (C) 1997-2024 Free Software Foundation, Inc. + Copyright (C) 1997-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/printf_function_invoke.c b/stdio-common/printf_function_invoke.c index 7b2c9fa..7b344fb 100644 --- a/stdio-common/printf_function_invoke.c +++ b/stdio-common/printf_function_invoke.c @@ -1,5 +1,5 @@ /* Invoke a printf specifier handler. Multibyte version. - Copyright (C) 2022-2024 Free Software Foundation, Inc. + Copyright (C) 2022-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/printf_size.c b/stdio-common/printf_size.c index 34a31ac..c22acd7 100644 --- a/stdio-common/printf_size.c +++ b/stdio-common/printf_size.c @@ -1,5 +1,5 @@ /* Print size value using units for orders of magnitude. - Copyright (C) 1997-2024 Free Software Foundation, Inc. + Copyright (C) 1997-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/psiginfo.c b/stdio-common/psiginfo.c index ee38d4e..c3a4f21 100644 --- a/stdio-common/psiginfo.c +++ b/stdio-common/psiginfo.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2009-2024 Free Software Foundation, Inc. +/* Copyright (C) 2009-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/psignal.c b/stdio-common/psignal.c index 12011ae..37486f8 100644 --- a/stdio-common/psignal.c +++ b/stdio-common/psignal.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2024 Free Software Foundation, Inc. +/* Copyright (C) 1991-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/putw.c b/stdio-common/putw.c index 639c9df..ece2626 100644 --- a/stdio-common/putw.c +++ b/stdio-common/putw.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2024 Free Software Foundation, Inc. +/* Copyright (C) 1991-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/reg-modifier.c b/stdio-common/reg-modifier.c index 320b99a..6a480f6 100644 --- a/stdio-common/reg-modifier.c +++ b/stdio-common/reg-modifier.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2009-2024 Free Software Foundation, Inc. +/* Copyright (C) 2009-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/reg-printf.c b/stdio-common/reg-printf.c index daf62f0..a87673f 100644 --- a/stdio-common/reg-printf.c +++ b/stdio-common/reg-printf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2024 Free Software Foundation, Inc. +/* Copyright (C) 1991-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/reg-type.c b/stdio-common/reg-type.c index 0f99391..1ca19df 100644 --- a/stdio-common/reg-type.c +++ b/stdio-common/reg-type.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2009-2024 Free Software Foundation, Inc. +/* Copyright (C) 2009-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/remove.c b/stdio-common/remove.c index 835ea0b..f8e9ce9 100644 --- a/stdio-common/remove.c +++ b/stdio-common/remove.c @@ -1,5 +1,5 @@ /* ANSI C `remove' function to delete a file or directory. Stub version. - Copyright (C) 1995-2024 Free Software Foundation, Inc. + Copyright (C) 1995-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/rename.c b/stdio-common/rename.c index eec60b1..cd5c330 100644 --- a/stdio-common/rename.c +++ b/stdio-common/rename.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2024 Free Software Foundation, Inc. +/* Copyright (C) 1991-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/renameat.c b/stdio-common/renameat.c index 66972b3..ba5d173 100644 --- a/stdio-common/renameat.c +++ b/stdio-common/renameat.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2005-2024 Free Software Foundation, Inc. +/* Copyright (C) 2005-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/renameat2.c b/stdio-common/renameat2.c index 4fb8913..7c60aee 100644 --- a/stdio-common/renameat2.c +++ b/stdio-common/renameat2.c @@ -1,5 +1,5 @@ /* Generic implementation of the renameat function. - Copyright (C) 2018-2024 Free Software Foundation, Inc. + Copyright (C) 2018-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/scanf.c b/stdio-common/scanf.c index 925aada..cce4186 100644 --- a/stdio-common/scanf.c +++ b/stdio-common/scanf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2024 Free Software Foundation, Inc. +/* Copyright (C) 1991-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/scanf11.c b/stdio-common/scanf11.c index a758d8f..9a616dd 100644 --- a/stdio-common/scanf11.c +++ b/stdio-common/scanf11.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2001-2024 Free Software Foundation, Inc. +/* Copyright (C) 2001-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/scanf13.c b/stdio-common/scanf13.c index 60aa62a..131abb3 100644 --- a/stdio-common/scanf13.c +++ b/stdio-common/scanf13.c @@ -3,6 +3,7 @@ #include <stdlib.h> #include <string.h> #include <wchar.h> +#include <libc-diag.h> int main (void) @@ -20,6 +21,10 @@ main (void) } while (0) setlocale (LC_ALL, "de_DE.UTF-8"); + DIAG_PUSH_NEEDS_COMMENT_CLANG; + DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wformat-invalid-specifier"); + DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wformat-extra-args"); + DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wfortify-source"); if (sscanf ("A \xc3\x84-\t\t\xc3\x84-abcdefbcd\t\xc3\x84-B", "A%ms%10ms%4m[bcd]%4mcB", &sp1, &sp2, &sp3, &sp4) != 4) FAIL (); @@ -57,6 +62,7 @@ main (void) FAIL (); free (lsp4); } + DIAG_POP_NEEDS_COMMENT_CLANG; memset (buf, '/', sizeof (buf)); buf[0] = '\t'; @@ -86,6 +92,8 @@ main (void) FAIL (); free (sp2); } + DIAG_PUSH_NEEDS_COMMENT_CLANG; + DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wfortify-source"); if (sscanf (buf, "%2048ms%mc", &sp3, &sp4) != 2) FAIL (); else @@ -126,6 +134,7 @@ main (void) FAIL (); free (sp4); } + DIAG_POP_NEEDS_COMMENT_CLANG; if (sscanf (buf, "%mS%mC", &lsp1, &lsp2) != 2) FAIL (); else @@ -142,6 +151,10 @@ main (void) FAIL (); free (lsp2); } + DIAG_PUSH_NEEDS_COMMENT_CLANG; + DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wformat-invalid-specifier"); + DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wformat-extra-args"); + DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wfortify-source"); if (sscanf (buf, "%2048mls%mlc", &lsp3, &lsp4) != 2) FAIL (); else @@ -182,6 +195,7 @@ main (void) FAIL (); free (lsp4); } + DIAG_POP_NEEDS_COMMENT_CLANG; return result; } diff --git a/stdio-common/scanf14.c b/stdio-common/scanf14.c index e58214e..d942e21 100644 --- a/stdio-common/scanf14.c +++ b/stdio-common/scanf14.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2007-2024 Free Software Foundation, Inc. +/* Copyright (C) 2007-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/scanf15.c b/stdio-common/scanf15.c index faef45b..b620e23 100644 --- a/stdio-common/scanf15.c +++ b/stdio-common/scanf15.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2007-2024 Free Software Foundation, Inc. +/* Copyright (C) 2007-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/scanf16.c b/stdio-common/scanf16.c index 0dbe214..17e7770 100644 --- a/stdio-common/scanf16.c +++ b/stdio-common/scanf16.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2024 Free Software Foundation, Inc. +/* Copyright (C) 2008-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/scanf17.c b/stdio-common/scanf17.c index d439243..2589de1 100644 --- a/stdio-common/scanf17.c +++ b/stdio-common/scanf17.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2024 Free Software Foundation, Inc. +/* Copyright (C) 2008-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/scanf18.c b/stdio-common/scanf18.c index e6e194c..faf2555 100644 --- a/stdio-common/scanf18.c +++ b/stdio-common/scanf18.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2007-2024 Free Software Foundation, Inc. +/* Copyright (C) 2007-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/scanf19.c b/stdio-common/scanf19.c index 76a2681..1905d32 100644 --- a/stdio-common/scanf19.c +++ b/stdio-common/scanf19.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2024 Free Software Foundation, Inc. +/* Copyright (C) 2008-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/siglist-gen.c b/stdio-common/siglist-gen.c index 514aa83..72867a7 100644 --- a/stdio-common/siglist-gen.c +++ b/stdio-common/siglist-gen.c @@ -1,5 +1,5 @@ /* Define list of all signal numbers and their names. - Copyright (C) 1997-2024 Free Software Foundation, Inc. + Copyright (C) 1997-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/snprintf.c b/stdio-common/snprintf.c index fe36096..51ea4e4 100644 --- a/stdio-common/snprintf.c +++ b/stdio-common/snprintf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2024 Free Software Foundation, Inc. +/* Copyright (C) 1991-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/sprintf.c b/stdio-common/sprintf.c index b750b62..453af44 100644 --- a/stdio-common/sprintf.c +++ b/stdio-common/sprintf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2024 Free Software Foundation, Inc. +/* Copyright (C) 1991-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/sscanf.c b/stdio-common/sscanf.c index 1f2cb48..611e343 100644 --- a/stdio-common/sscanf.c +++ b/stdio-common/sscanf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2024 Free Software Foundation, Inc. +/* Copyright (C) 1991-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/stdio_ext.h b/stdio-common/stdio_ext.h index 0ebe93a..397b37f 100644 --- a/stdio-common/stdio_ext.h +++ b/stdio-common/stdio_ext.h @@ -1,5 +1,5 @@ /* Functions to access FILE structure internals. - Copyright (C) 2000-2024 Free Software Foundation, Inc. + Copyright (C) 2000-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -43,43 +43,43 @@ __BEGIN_DECLS /* Return the size of the buffer of FP in bytes currently in use by the given stream. */ -extern size_t __fbufsize (FILE *__fp) __THROW; +extern size_t __fbufsize (FILE *__fp) __THROW __nonnull ((1)); /* Return non-zero value iff the stream FP is opened readonly, or if the last operation on the stream was a read operation. */ -extern int __freading (FILE *__fp) __THROW; +extern int __freading (FILE *__fp) __THROW __nonnull ((1)); /* Return non-zero value iff the stream FP is opened write-only or append-only, or if the last operation on the stream was a write operation. */ -extern int __fwriting (FILE *__fp) __THROW; +extern int __fwriting (FILE *__fp) __THROW __nonnull ((1)); /* Return non-zero value iff stream FP is not opened write-only or append-only. */ -extern int __freadable (FILE *__fp) __THROW; +extern int __freadable (FILE *__fp) __THROW __nonnull ((1)); /* Return non-zero value iff stream FP is not opened read-only. */ -extern int __fwritable (FILE *__fp) __THROW; +extern int __fwritable (FILE *__fp) __THROW __nonnull ((1)); /* Return non-zero value iff the stream FP is line-buffered. */ -extern int __flbf (FILE *__fp) __THROW; +extern int __flbf (FILE *__fp) __THROW __nonnull ((1)); /* Discard all pending buffered I/O on the stream FP. */ -extern void __fpurge (FILE *__fp) __THROW; +extern void __fpurge (FILE *__fp) __THROW __nonnull ((1)); /* Return amount of output in bytes pending on a stream FP. */ -extern size_t __fpending (FILE *__fp) __THROW; +extern size_t __fpending (FILE *__fp) __THROW __nonnull ((1)); /* Flush all line-buffered files. */ extern void _flushlbf (void); /* Set locking status of stream FP to TYPE. */ -extern int __fsetlocking (FILE *__fp, int __type) __THROW; +extern int __fsetlocking (FILE *__fp, int __type) __THROW __nonnull ((1)); __END_DECLS diff --git a/stdio-common/tempnam.c b/stdio-common/tempnam.c index 9e62442..d35aac8 100644 --- a/stdio-common/tempnam.c +++ b/stdio-common/tempnam.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2024 Free Software Foundation, Inc. +/* Copyright (C) 1991-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/tempname.c b/stdio-common/tempname.c index 77e695c..880fc05 100644 --- a/stdio-common/tempname.c +++ b/stdio-common/tempname.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2024 Free Software Foundation, Inc. +/* Copyright (C) 1991-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/test-fseek.c b/stdio-common/test-fseek.c index cdc2ef3..7100e30 100644 --- a/stdio-common/test-fseek.c +++ b/stdio-common/test-fseek.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2024 Free Software Foundation, Inc. +/* Copyright (C) 1991-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/test-popen.c b/stdio-common/test-popen.c index cdd5ae2..3df7dee 100644 --- a/stdio-common/test-popen.c +++ b/stdio-common/test-popen.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2024 Free Software Foundation, Inc. +/* Copyright (C) 1997-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/test-strerr.c b/stdio-common/test-strerr.c index 1a63b90..6a3cce3 100644 --- a/stdio-common/test-strerr.c +++ b/stdio-common/test-strerr.c @@ -1,5 +1,5 @@ /* Test strerrorname_np and strerrordesc_np. - Copyright (C) 2020-2024 Free Software Foundation, Inc. + Copyright (C) 2020-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/test-vfprintf.c b/stdio-common/test-vfprintf.c index be53917..f9e9af5 100644 --- a/stdio-common/test-vfprintf.c +++ b/stdio-common/test-vfprintf.c @@ -1,5 +1,5 @@ /* Tests of *printf for very large strings. - Copyright (C) 2000-2024 Free Software Foundation, Inc. + Copyright (C) 2000-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/test_rdwr.c b/stdio-common/test_rdwr.c index 67fbe4e..556b9cb 100644 --- a/stdio-common/test_rdwr.c +++ b/stdio-common/test_rdwr.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2024 Free Software Foundation, Inc. +/* Copyright (C) 1991-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -19,6 +19,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <libc-diag.h> #include <support/xstdio.h> @@ -54,6 +55,11 @@ main (int argc, char **argv) rewind (f); (void) fputs (buf, f); rewind (f); + + /* clang do not handle %Z format. */ + DIAG_PUSH_NEEDS_COMMENT_CLANG; + DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wformat-invalid-specifier"); + DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wformat-extra-args"); { size_t i; for (i = 0; i < replace_from; ++i) @@ -101,6 +107,7 @@ main (int argc, char **argv) lose = 1; } } + DIAG_POP_NEEDS_COMMENT_CLANG; if (!lose) { diff --git a/stdio-common/tmpdir.c b/stdio-common/tmpdir.c index f189e85..53debf0 100644 --- a/stdio-common/tmpdir.c +++ b/stdio-common/tmpdir.c @@ -1,5 +1,4 @@ -/* Copyright (C) 1999, 2001-2002, 2006, 2009-2024 Free Software Foundation, - Inc. +/* Copyright (C) 1999-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. This file is free software: you can redistribute it and/or modify diff --git a/stdio-common/tmpdir.h b/stdio-common/tmpdir.h index e187a31..4465798 100644 --- a/stdio-common/tmpdir.h +++ b/stdio-common/tmpdir.h @@ -1,5 +1,5 @@ /* Determine a temporary directory. - Copyright (C) 2001-2002, 2009-2024 Free Software Foundation, Inc. + Copyright (C) 2001-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff --git a/stdio-common/tmpfile.c b/stdio-common/tmpfile.c index 08cf928..6bbb356 100644 --- a/stdio-common/tmpfile.c +++ b/stdio-common/tmpfile.c @@ -1,5 +1,5 @@ /* Open a stdio stream on an anonymous temporary file. Generic/POSIX version. - Copyright (C) 1991-2024 Free Software Foundation, Inc. + Copyright (C) 1991-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/tmpfile64.c b/stdio-common/tmpfile64.c index a9b9bbc..2026a8a 100644 --- a/stdio-common/tmpfile64.c +++ b/stdio-common/tmpfile64.c @@ -1,5 +1,5 @@ /* Open a stdio stream on an anonymous, large temporary file. Generic version. - Copyright (C) 2012-2024 Free Software Foundation, Inc. + Copyright (C) 2012-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/tmpnam.c b/stdio-common/tmpnam.c index 1cff363..4b7c0db 100644 --- a/stdio-common/tmpnam.c +++ b/stdio-common/tmpnam.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2024 Free Software Foundation, Inc. +/* Copyright (C) 1991-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/tmpnam_r.c b/stdio-common/tmpnam_r.c index 38f9bac..a579c13 100644 --- a/stdio-common/tmpnam_r.c +++ b/stdio-common/tmpnam_r.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2024 Free Software Foundation, Inc. +/* Copyright (C) 1991-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/translated_number_width.c b/stdio-common/translated_number_width.c index e42cf72..6521701 100644 --- a/stdio-common/translated_number_width.c +++ b/stdio-common/translated_number_width.c @@ -1,5 +1,5 @@ /* Compute the printf width of a sequence of ASCII digits. - Copyright (C) 2022-2024 Free Software Foundation, Inc. + Copyright (C) 2022-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/tst-bz11319.c b/stdio-common/tst-bz11319.c index 6c6725a..2a42a72 100644 --- a/stdio-common/tst-bz11319.c +++ b/stdio-common/tst-bz11319.c @@ -1,5 +1,5 @@ /* Regression test for bug 11319. - Copyright (C) 2018-2024 Free Software Foundation, Inc. + Copyright (C) 2018-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/tst-dprintf-length.c b/stdio-common/tst-dprintf-length.c index 16cb672..cfe4a06 100644 --- a/stdio-common/tst-dprintf-length.c +++ b/stdio-common/tst-dprintf-length.c @@ -1,5 +1,5 @@ /* Test that dprintf returns the expected length. - Copyright (C) 2023-2024 Free Software Foundation, Inc. + Copyright (C) 2023-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/tst-errno-manual.py b/stdio-common/tst-errno-manual.py index a8b58d6..04a3091 100755 --- a/stdio-common/tst-errno-manual.py +++ b/stdio-common/tst-errno-manual.py @@ -1,6 +1,6 @@ #!/usr/bin/python3 # Check is all errno definitions at errlist.h documented in the manual. -# Copyright (C) 2020-2024 Free Software Foundation, Inc. +# Copyright (C) 2020-2025 Free Software Foundation, Inc. # This file is part of the GNU C Library. # # The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/tst-fclose-devzero.c b/stdio-common/tst-fclose-devzero.c new file mode 100644 index 0000000..1c7b39a --- /dev/null +++ b/stdio-common/tst-fclose-devzero.c @@ -0,0 +1,50 @@ +/* Test that always-zero lseek does not cause fclose failure after fread. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <stdio.h> +#include <string.h> + +#include <support/check.h> +#include <support/xstdio.h> + +int +do_test (void) +{ + for (int do_ftello = 0; do_ftello < 2; ++do_ftello) + { + FILE *fp = xfopen ("/dev/zero", "r"); + char buf[17]; + memset (buf, 0xcc, sizeof (buf)); + xfread (buf, 1, sizeof (buf), fp); + static const char zeros[sizeof (buf)] = { 0 }; + TEST_COMPARE_BLOB (buf, sizeof (buf), zeros, sizeof (zeros)); + if (do_ftello) + { + errno = 0; + TEST_COMPARE (ftello (fp), -1); + TEST_COMPARE (errno, ESPIPE); + } + /* Do not use xfclose because it flushes first. */ + TEST_COMPARE (fclose (fp), 0); + } + + return 0; +} + +#include <support/test-driver.c> diff --git a/stdio-common/tst-fclose-offset.c b/stdio-common/tst-fclose-offset.c new file mode 100644 index 0000000..a31de11 --- /dev/null +++ b/stdio-common/tst-fclose-offset.c @@ -0,0 +1,225 @@ +/* Test offset of input file descriptor after close (bug 12724). + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <stdio.h> +#include <wchar.h> + +#include <support/check.h> +#include <support/temp_file.h> +#include <support/xstdio.h> +#include <support/xunistd.h> + +int +do_test (void) +{ + char *filename = NULL; + int fd = create_temp_file ("tst-fclose-offset", &filename); + TEST_VERIFY_EXIT (fd != -1); + + /* Test offset of open file description for output and input streams + after fclose, case from bug 12724. */ + + const char buf[] = "hello world"; + xwrite (fd, buf, sizeof buf); + TEST_COMPARE (lseek (fd, 1, SEEK_SET), 1); + int fd2 = xdup (fd); + FILE *f = fdopen (fd2, "w"); + TEST_VERIFY_EXIT (f != NULL); + TEST_COMPARE (fputc (buf[1], f), buf[1]); + xfclose (f); + errno = 0; + TEST_COMPARE (lseek (fd2, 0, SEEK_CUR), -1); + TEST_COMPARE (errno, EBADF); + TEST_COMPARE (lseek (fd, 0, SEEK_CUR), 2); + + /* Likewise for an input stream. */ + fd2 = xdup (fd); + f = fdopen (fd2, "r"); + TEST_VERIFY_EXIT (f != NULL); + TEST_COMPARE (fgetc (f), buf[2]); + xfclose (f); + errno = 0; + TEST_COMPARE (lseek (fd2, 0, SEEK_CUR), -1); + TEST_COMPARE (errno, EBADF); + TEST_COMPARE (lseek (fd, 0, SEEK_CUR), 3); + + /* Test offset of open file description for output and input streams + after fclose, case from comment on bug 12724 (failed after first + attempt at fixing that bug). This verifies that the offset is + not reset when there has been no input or output on the FILE* (in + that case, the FILE* might not be the active handle). */ + + TEST_COMPARE (lseek (fd, 0, SEEK_SET), 0); + xwrite (fd, buf, sizeof buf); + TEST_COMPARE (lseek (fd, 1, SEEK_SET), 1); + fd2 = xdup (fd); + f = fdopen (fd2, "w"); + TEST_VERIFY_EXIT (f != NULL); + TEST_COMPARE (lseek (fd, 4, SEEK_SET), 4); + xfclose (f); + errno = 0; + TEST_COMPARE (lseek (fd2, 0, SEEK_CUR), -1); + TEST_COMPARE (errno, EBADF); + TEST_COMPARE (lseek (fd, 0, SEEK_CUR), 4); + + /* Likewise for an input stream. */ + fd2 = xdup (fd); + f = fdopen (fd2, "r"); + TEST_VERIFY_EXIT (f != NULL); + TEST_COMPARE (lseek (fd, 4, SEEK_SET), 4); + xfclose (f); + errno = 0; + TEST_COMPARE (lseek (fd2, 0, SEEK_CUR), -1); + TEST_COMPARE (errno, EBADF); + TEST_COMPARE (lseek (fd, 0, SEEK_CUR), 4); + + /* Further cases without specific tests in bug 12724, to verify + proper operation of the rules about the offset only being set + when the stream is the active handle. */ + + /* Test offset set by fclose after fseek and fgetc. */ + TEST_COMPARE (lseek (fd, 0, SEEK_SET), 0); + fd2 = xdup (fd); + f = fdopen (fd2, "r"); + TEST_VERIFY_EXIT (f != NULL); + TEST_COMPARE (fseek (f, 1, SEEK_SET), 0); + TEST_COMPARE (fgetc (f), buf[1]); + xfclose (f); + errno = 0; + TEST_COMPARE (lseek (fd2, 0, SEEK_CUR), -1); + TEST_COMPARE (errno, EBADF); + TEST_COMPARE (lseek (fd, 0, SEEK_CUR), 2); + + /* Test offset not set by fclose after fseek and fgetc, if that + fgetc is at EOF (in which case the active handle might have + changed). */ + TEST_COMPARE (lseek (fd, 0, SEEK_SET), 0); + fd2 = xdup (fd); + f = fdopen (fd2, "r"); + TEST_VERIFY_EXIT (f != NULL); + TEST_COMPARE (fseek (f, sizeof buf, SEEK_SET), 0); + TEST_COMPARE (fgetc (f), EOF); + TEST_COMPARE (lseek (fd, 4, SEEK_SET), 4); + xfclose (f); + errno = 0; + TEST_COMPARE (lseek (fd2, 0, SEEK_CUR), -1); + TEST_COMPARE (errno, EBADF); + TEST_COMPARE (lseek (fd, 0, SEEK_CUR), 4); + + /* Test offset not set by fclose after fseek and fgetc and fflush + (active handle might have changed after fflush). */ + TEST_COMPARE (lseek (fd, 0, SEEK_SET), 0); + fd2 = xdup (fd); + f = fdopen (fd2, "r"); + TEST_VERIFY_EXIT (f != NULL); + TEST_COMPARE (fseek (f, 1, SEEK_SET), 0); + TEST_COMPARE (fgetc (f), buf[1]); + TEST_COMPARE (fflush (f), 0); + TEST_COMPARE (lseek (fd, 4, SEEK_SET), 4); + xfclose (f); + errno = 0; + TEST_COMPARE (lseek (fd2, 0, SEEK_CUR), -1); + TEST_COMPARE (errno, EBADF); + TEST_COMPARE (lseek (fd, 0, SEEK_CUR), 4); + + /* Test offset not set by fclose after fseek and fgetc, if the + stream is unbuffered (active handle might change at any + time). */ + TEST_COMPARE (lseek (fd, 0, SEEK_SET), 0); + fd2 = xdup (fd); + f = fdopen (fd2, "r"); + TEST_VERIFY_EXIT (f != NULL); + setbuf (f, NULL); + TEST_COMPARE (fseek (f, 1, SEEK_SET), 0); + TEST_COMPARE (fgetc (f), buf[1]); + TEST_COMPARE (lseek (fd, 4, SEEK_SET), 4); + xfclose (f); + errno = 0; + TEST_COMPARE (lseek (fd2, 0, SEEK_CUR), -1); + TEST_COMPARE (errno, EBADF); + TEST_COMPARE (lseek (fd, 0, SEEK_CUR), 4); + + /* Also test such cases with the stream in wide mode. */ + + /* Test offset set by fclose after fseek and fgetwc. */ + TEST_COMPARE (lseek (fd, 0, SEEK_SET), 0); + fd2 = xdup (fd); + f = fdopen (fd2, "r"); + TEST_VERIFY_EXIT (f != NULL); + TEST_COMPARE (fseek (f, 1, SEEK_SET), 0); + TEST_COMPARE (fgetwc (f), (wint_t) buf[1]); + xfclose (f); + errno = 0; + TEST_COMPARE (lseek (fd2, 0, SEEK_CUR), -1); + TEST_COMPARE (errno, EBADF); + TEST_COMPARE (lseek (fd, 0, SEEK_CUR), 2); + + /* Test offset not set by fclose after fseek and fgetwc, if that + fgetwc is at EOF (in which case the active handle might have + changed). */ + TEST_COMPARE (lseek (fd, 0, SEEK_SET), 0); + fd2 = xdup (fd); + f = fdopen (fd2, "r"); + TEST_VERIFY_EXIT (f != NULL); + TEST_COMPARE (fseek (f, sizeof buf, SEEK_SET), 0); + TEST_COMPARE (fgetwc (f), WEOF); + TEST_COMPARE (lseek (fd, 4, SEEK_SET), 4); + xfclose (f); + errno = 0; + TEST_COMPARE (lseek (fd2, 0, SEEK_CUR), -1); + TEST_COMPARE (errno, EBADF); + TEST_COMPARE (lseek (fd, 0, SEEK_CUR), 4); + + /* Test offset not set by fclose after fseek and fgetwc and fflush + (active handle might have changed after fflush). */ + TEST_COMPARE (lseek (fd, 0, SEEK_SET), 0); + fd2 = xdup (fd); + f = fdopen (fd2, "r"); + TEST_VERIFY_EXIT (f != NULL); + TEST_COMPARE (fseek (f, 1, SEEK_SET), 0); + TEST_COMPARE (fgetwc (f), (wint_t) buf[1]); + TEST_COMPARE (fflush (f), 0); + TEST_COMPARE (lseek (fd, 4, SEEK_SET), 4); + xfclose (f); + errno = 0; + TEST_COMPARE (lseek (fd2, 0, SEEK_CUR), -1); + TEST_COMPARE (errno, EBADF); + TEST_COMPARE (lseek (fd, 0, SEEK_CUR), 4); + + /* Test offset not set by fclose after fseek and fgetwc, if the + stream is unbuffered (active handle might change at any + time). */ + TEST_COMPARE (lseek (fd, 0, SEEK_SET), 0); + fd2 = xdup (fd); + f = fdopen (fd2, "r"); + TEST_VERIFY_EXIT (f != NULL); + setbuf (f, NULL); + TEST_COMPARE (fseek (f, 1, SEEK_SET), 0); + TEST_COMPARE (fgetwc (f), (wint_t) buf[1]); + TEST_COMPARE (lseek (fd, 4, SEEK_SET), 4); + xfclose (f); + errno = 0; + TEST_COMPARE (lseek (fd2, 0, SEEK_CUR), -1); + TEST_COMPARE (errno, EBADF); + TEST_COMPARE (lseek (fd, 0, SEEK_CUR), 4); + + return 0; +} + +#include <support/test-driver.c> diff --git a/stdio-common/tst-fdopen2.c b/stdio-common/tst-fdopen2.c new file mode 100644 index 0000000..6264aab --- /dev/null +++ b/stdio-common/tst-fdopen2.c @@ -0,0 +1,246 @@ +/* Test the fdopen function. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <stdio.h> +#include <errno.h> +#include <fcntl.h> +#include <support/check.h> +#include <support/support.h> +#include <support/xunistd.h> +#include <support/temp_file.h> + +char *tmp_dir; +char *path_to_file; + +void +prepare_tmp_dir (void) +{ + tmp_dir = support_create_temp_directory ("tst-fdopen2"); + path_to_file = xasprintf ("%s/tst-fdopen2.txt", tmp_dir); +} + +/* open temp file descriptor with mode. */ +int +open_tmp_fd (int mode) +{ + int fd = xopen (path_to_file, mode, 0644); + return fd; +} + + +/* close and remove temp file with close. */ +void +close_tmp_fd (int fd) +{ + xclose (fd); + xunlink (path_to_file); +} + +/* close and remove temp file with fclose. */ +void +close_tmp_fp (FILE *fp) +{ + fclose (fp); + xunlink (path_to_file); +} + +/* test "w" fdopen mode. */ +void +do_test_fdopen_w (void) +{ + int fd, ret; + FILE *fp; + fd = open_tmp_fd (O_WRONLY | O_CREAT | O_TRUNC); + + /* test mode mismatch. */ + fp = fdopen (fd, "r"); + if (fp != NULL || errno != EINVAL) + { + close_tmp_fd (fd); + FAIL_EXIT1 ("fdopen (%d, r) should fail with EINVAL: %m", fd); + } + + fp = fdopen (fd, "w"); + if (fp == NULL) + { + close_tmp_fd (fd); + FAIL_EXIT1 ("fdopen (%d, w): %m", fd); + } + + const void *buf = "AAAA"; + ret = fwrite (buf, 1, 4, fp); + if (ret != 4) + { + close_tmp_fp (fp); + FAIL_EXIT1 ("fwrite (): %m"); + } + + unsigned char buf2[4]; + rewind (fp); + clearerr (fp); + /* fread should fail in "w" mode */ + ret = fread (buf2, 1, 4, fp); + if (ret != 0 || ferror (fp) == 0) + { + close_tmp_fp (fp); + FAIL_EXIT1 ("fread should fail in \"w\" mode"); + } + + fclose (fp); +} + +/* test "r" fdopen mode. */ +void +do_test_fdopen_r (void) +{ + int fd, ret; + FILE *fp; + fd = open_tmp_fd (O_RDONLY); + + /* test mode mismatch. */ + fp = fdopen (fd, "w"); + if (fp != NULL || errno != EINVAL) + { + close_tmp_fd (fd); + FAIL_EXIT1 ("fdopen (%d, w) should fail with EINVAL: %m", fd); + } + + fp = fdopen (fd, "r"); + if (fp == NULL) + { + close_tmp_fd (fd); + FAIL_EXIT1 ("fdopen (%d, w): %m", fd); + } + + const void *buf = "BBBB"; + /* fwrite should fail in "r" mode. */ + ret = fwrite (buf, 1, 4, fp); + if (ret != 0 || ferror (fp) == 0) + { + close_tmp_fp (fp); + FAIL_EXIT1 ("fwrite should fail in \"r\" mode"); + } + + unsigned char buf2[4]; + ret = fread (buf2, 1, 4, fp); + if (ret != 4) + { + close_tmp_fp (fp); + FAIL_EXIT1 ("fread (): %m"); + } + + fclose (fp); +} + +/* test "a" fdopen mode. */ +void +do_test_fdopen_a (void) +{ + int fd, ret; + FILE *fp; + fd = open_tmp_fd (O_WRONLY | O_CREAT | O_APPEND); + + /* test mode mismatch. */ + fp = fdopen (fd, "r+"); + if (fp != NULL || errno != EINVAL) + { + close_tmp_fd (fd); + FAIL_EXIT1 ("fdopen (%d, \"r+\") should fail with EINVAL: %m", fd); + } + + fp = fdopen (fd, "a"); + if (fp == NULL) + { + close_tmp_fd (fd); + FAIL_EXIT1 ("fdopen (%d, w): %m", fd); + } + + const void *buf = "CCCC"; + ret = fwrite (buf, 1, 4, fp); + if (ret != 4) + { + close_tmp_fp (fp); + FAIL_EXIT1 ("fwrite (): %m"); + } + + /* fread should fail in "a" mode. */ + unsigned char buf2[4]; + clearerr (fp); + ret = fread (buf2, 1, 4, fp); + if (ret != 0 || ferror (fp) == 0) + { + close_tmp_fp (fp); + FAIL_EXIT1 ("fread should fail \"a\" mode"); + } + + fclose (fp); +} + +void +do_test_fdopen_mode (int mode, const char *fmode) +{ + int fd, ret; + FILE *fp; + fd = open_tmp_fd (mode); + + fp = fdopen (fd, fmode); + if (fp == NULL) + { + close_tmp_fd (fd); + FAIL_EXIT1 ("fdopen (%d, %s): %m", fd, fmode); + } + + const void *buf = "EEEE"; + ret = fwrite (buf, 1, 4, fp); + if (ret != 4) + { + close_tmp_fp (fp); + FAIL_EXIT1 ("fwrite () in mode:%s returns %d: %m", fmode, ret); + } + + rewind (fp); + unsigned char buf2[4]; + ret = fread (buf2, 1, 4, fp); + if (ret != 4) + { + close_tmp_fp (fp); + FAIL_EXIT1 ("fread () in mode:%s returns %d: %m", fmode, ret); + } + + fclose (fp); +} + +static int +do_test (void) +{ + + prepare_tmp_dir (); + + do_test_fdopen_w (); + do_test_fdopen_r (); + do_test_fdopen_a (); + + /* test r+ w+ a+ fdopen modes. */ + do_test_fdopen_mode (O_RDWR, "r+"); + do_test_fdopen_mode (O_RDWR | O_CREAT | O_TRUNC, "w+"); + do_test_fdopen_mode (O_RDWR | O_CREAT | O_APPEND, "a+"); + xunlink (path_to_file); + return 0; +} + +#include <support/test-driver.c> diff --git a/stdio-common/tst-fflush-all-input.c b/stdio-common/tst-fflush-all-input.c new file mode 100644 index 0000000..8e3fca3 --- /dev/null +++ b/stdio-common/tst-fflush-all-input.c @@ -0,0 +1,94 @@ +/* Test fflush (NULL) flushes input files (bug 32369). + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <wchar.h> + +#include <support/check.h> +#include <support/xstdio.h> +#include <support/xunistd.h> + +int +do_test (void) +{ + FILE *temp = tmpfile (); + TEST_VERIFY_EXIT (temp != NULL); + fprintf (temp, "abc"); + TEST_COMPARE (fflush (temp), 0); + TEST_COMPARE (lseek (fileno (temp), 0, SEEK_SET), 0); + TEST_COMPARE (fgetc (temp), 'a'); + TEST_COMPARE (fflush (NULL), 0); + TEST_COMPARE (lseek (fileno (temp), 0, SEEK_CUR), 1); + xfclose (temp); + + /* Likewise, but in wide mode. */ + temp = tmpfile (); + TEST_VERIFY_EXIT (temp != NULL); + fwprintf (temp, L"abc"); + TEST_COMPARE (fflush (temp), 0); + TEST_COMPARE (lseek (fileno (temp), 0, SEEK_SET), 0); + TEST_COMPARE (fgetwc (temp), L'a'); + TEST_COMPARE (fflush (NULL), 0); + TEST_COMPARE (lseek (fileno (temp), 0, SEEK_CUR), 1); + xfclose (temp); + + /* Similar tests, but with the flush implicitly occurring on exit + (in a forked subprocess). */ + + temp = tmpfile (); + TEST_VERIFY_EXIT (temp != NULL); + pid_t pid = xfork (); + if (pid == 0) + { + fprintf (temp, "abc"); + TEST_COMPARE (fflush (temp), 0); + TEST_COMPARE (lseek (fileno (temp), 0, SEEK_SET), 0); + TEST_COMPARE (fgetc (temp), 'a'); + exit (EXIT_SUCCESS); + } + else + { + TEST_COMPARE (xwaitpid (pid, NULL, 0), pid); + TEST_COMPARE (lseek (fileno (temp), 0, SEEK_CUR), 1); + xfclose (temp); + } + + temp = tmpfile (); + TEST_VERIFY_EXIT (temp != NULL); + pid = xfork (); + if (pid == 0) + { + fwprintf (temp, L"abc"); + TEST_COMPARE (fflush (temp), 0); + TEST_COMPARE (lseek (fileno (temp), 0, SEEK_SET), 0); + TEST_COMPARE (fgetwc (temp), L'a'); + exit (EXIT_SUCCESS); + } + else + { + TEST_COMPARE (xwaitpid (pid, NULL, 0), pid); + TEST_COMPARE (lseek (fileno (temp), 0, SEEK_CUR), 1); + xfclose (temp); + } + + return 0; +} + +#include <support/test-driver.c> diff --git a/stdio-common/tst-fflush-mmap.c b/stdio-common/tst-fflush-mmap.c new file mode 100644 index 0000000..3bddb90 --- /dev/null +++ b/stdio-common/tst-fflush-mmap.c @@ -0,0 +1,50 @@ +/* Test fflush after ungetc on files using mmap (bug 32535). + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <stdio.h> + +#include <support/check.h> +#include <support/temp_file.h> +#include <support/xstdio.h> +#include <support/xunistd.h> + +int +do_test (void) +{ + char *filename = NULL; + int fd = create_temp_file ("tst-fflush-mmap", &filename); + TEST_VERIFY_EXIT (fd != -1); + xclose (fd); + + /* Test fflush after ungetc (bug 32535). */ + FILE *fp = xfopen (filename, "w"); + TEST_VERIFY (0 <= fputs ("test", fp)); + xfclose (fp); + + fp = xfopen (filename, "rm"); + TEST_COMPARE (fgetc (fp), 't'); + TEST_COMPARE (ungetc ('u', fp), 'u'); + TEST_COMPARE (fflush (fp), 0); + TEST_COMPARE (fgetc (fp), 't'); + TEST_COMPARE (fgetc (fp), 'e'); + xfclose (fp); + + return 0; +} + +#include <support/test-driver.c> diff --git a/stdio-common/tst-fgets2.c b/stdio-common/tst-fgets2.c new file mode 100644 index 0000000..278556d --- /dev/null +++ b/stdio-common/tst-fgets2.c @@ -0,0 +1,253 @@ +/* Test for additional fgets error handling. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <libc-diag.h> +#include <stdio.h> +#include <error.h> +#include <errno.h> +#include <limits.h> +#include <mcheck.h> +#include <stddef.h> +#include <stdlib.h> +#include <string.h> +#include <ctype.h> +#include <fcntl.h> +#include <unistd.h> +#include <sys/types.h> + +#include <support/support.h> +#include <support/check.h> + +/* This avoids compiler warnings about passing NULL where a valid + pointer is expected. */ +static void *volatile null = NULL; + +/* Implementation of our FILE stream backend. */ + +static int bytes_read; +static int cookie_valid = 0; +struct Cookie { + const char *buffer; + int bufptr; + int bufsz; +}; + +#define VALIDATE_COOKIE() if (! cookie_valid) { \ + FAIL ("call to %s after file closed", __FUNCTION__); \ + return -1; \ + } + +static ssize_t +io_read (void *vcookie, char *buf, size_t size) +{ + struct Cookie *cookie = (struct Cookie *) vcookie; + + VALIDATE_COOKIE (); + + if (size > cookie->bufsz - cookie->bufptr) + size = cookie->bufsz - cookie->bufptr; + + memcpy (buf, cookie->buffer + cookie->bufptr, size); + cookie->bufptr += size; + bytes_read += size; + return size; +} + +static ssize_t +io_write (void *vcookie, const char *buf, size_t size) +{ + VALIDATE_COOKIE (); + FAIL_EXIT1 ("io_write called"); +} + +static int +io_seek (void *vcookie, off64_t *position, int whence) +{ + VALIDATE_COOKIE (); + FAIL_EXIT1 ("io_seek called"); +} + +static int +io_clean (void *vcookie) +{ + struct Cookie *cookie = (struct Cookie *) vcookie; + + VALIDATE_COOKIE (); + + cookie->buffer = NULL; + cookie->bufsz = 0; + cookie->bufptr = 0; + + cookie_valid = 0; + free (cookie); + return 0; +} + +cookie_io_functions_t io_funcs = { + .read = io_read, + .write = io_write, + .seek = io_seek, + .close = io_clean +}; + +FILE * +io_open (const char *buffer, int buflen, const char *mode, void **vcookie) +{ + FILE *f; + struct Cookie *cookie; + + cookie = (struct Cookie *) xcalloc (1, sizeof (struct Cookie)); + *vcookie = cookie; + cookie_valid = 1; + + cookie->buffer = buffer; + cookie->bufsz = buflen; + bytes_read = 0; + + f = fopencookie (cookie, mode, io_funcs); + if (f == NULL) + FAIL_EXIT1 ("fopencookie failed"); + + clearerr (f); + return f; +} + +/* The test cases. */ + +#define my_open(s,l,m) io_open (s, l, m, (void *) &cookie) + +#define TEST_COMPARE_0x11(buf, len) \ + TEST_COMPARE_BLOB (buf + (len), sizeof (buf) - (len), \ + buf2, sizeof (buf) - (len)); + +#define check_flags(f, expected_eof, expected_err) \ + { \ + if (expected_eof) \ + TEST_VERIFY (feof (f) != 0); \ + else \ + TEST_VERIFY (feof (f) == 0); \ + if (expected_err) \ + TEST_VERIFY (ferror (f) != 0); \ + else \ + TEST_VERIFY (ferror (f) == 0); \ + } + +static int +do_test (void) +{ + FILE *f; + struct Cookie *cookie; + char buf [10]; + char buf2 [10]; + char *returned_string; + + memset (buf2, 0x11, sizeof (buf2)); + + printf ("testing base operation...\n"); + f = my_open ("hello\n", 6, "r"); + memset (buf, 0x11, sizeof (buf)); + returned_string = fgets (buf, sizeof (buf) - 1, f); + TEST_VERIFY (returned_string == buf); + TEST_COMPARE_BLOB (buf, bytes_read + 1, "hello\n\0", 7); + TEST_COMPARE_0x11 (buf, bytes_read + 1); + check_flags (f, 0, 0); + + fclose (f); + + printf ("testing zero size file...\n"); + f = my_open ("hello\n", 0, "r"); + memset (buf, 0x11, sizeof (buf)); + returned_string = fgets (buf, sizeof (buf) - 1, f); + TEST_VERIFY (returned_string == NULL); + TEST_VERIFY (bytes_read == 0); + check_flags (f, 1, 0); + fclose (f); + + printf ("testing zero size buffer...\n"); + f = my_open ("hello\n", 6, "r"); + memset (buf, 0x11, sizeof (buf)); + returned_string = fgets (buf, 0, f); + TEST_VERIFY (returned_string == NULL); + TEST_VERIFY (bytes_read == 0); + check_flags (f, 0, 0); + fclose (f); + + printf ("testing NULL buffer with empty stream...\n"); + f = my_open ("hello\n", 0, "r"); + memset (buf, 0x11, sizeof (buf)); + + returned_string = fgets (null, sizeof (buf), f); + + TEST_VERIFY (returned_string == NULL); + TEST_VERIFY (bytes_read == 0); + check_flags (f, 1, 0); + fclose (f); + + printf ("testing embedded NUL...\n"); + f = my_open ("hel\0lo\n", 7, "r"); + memset (buf, 0x11, sizeof (buf)); + returned_string = fgets (buf, sizeof (buf) - 1, f); + TEST_VERIFY (returned_string == buf); + TEST_COMPARE_BLOB (buf, bytes_read + 1, "hel\0lo\n\0", 8); + TEST_COMPARE_0x11 (buf, bytes_read + 1); + check_flags (f, 0, 0); + fclose (f); + + printf ("testing writable stream...\n"); + f = my_open ("hel\0lo\n", 7, "w"); + memset (buf, 0x11, sizeof (buf)); + returned_string = fgets (buf, sizeof (buf) - 1, f); + TEST_VERIFY (returned_string == NULL); + TEST_VERIFY (bytes_read == 0); + check_flags (f, 0, 1); + fclose (f); + + printf ("testing closed fd stream...\n"); + int fd = open ("/dev/null", O_RDONLY); + f = fdopen (fd, "r"); + close (fd); + memset (buf, 0x11, sizeof (buf)); + returned_string = fgets (buf, sizeof (buf) - 1, f); + TEST_VERIFY (returned_string == NULL); + TEST_VERIFY (bytes_read == 0); + check_flags (f, 0, 1); + fclose (f); + +#ifdef IO_DEBUG + /* These tests only pass if glibc is built with -DIO_DEBUG, but are + included for reference. */ + + printf ("testing NULL descriptor...\n"); + memset (buf, 0x11, sizeof (buf)); + returned_string = fgets (buf, sizeof (buf) - 1, null); + TEST_VERIFY (returned_string == NULL); + TEST_VERIFY (bytes_read == 0); + + printf ("testing closed descriptor...\n"); + f = my_open ("hello\n", 7, "r"); + fclose (f); + memset (buf, 0x11, sizeof (buf)); + returned_string = fgets (buf, sizeof (buf) - 1, f); + TEST_VERIFY (returned_string == NULL); + TEST_VERIFY (bytes_read == 0); +#endif + + return 0; +} + +#include <support/test-driver.c> diff --git a/stdio-common/tst-fileno.c b/stdio-common/tst-fileno.c index 89eab18..f78022f 100644 --- a/stdio-common/tst-fileno.c +++ b/stdio-common/tst-fileno.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1994-2024 Free Software Foundation, Inc. +/* Copyright (C) 1994-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/tst-fmemopen.c b/stdio-common/tst-fmemopen.c index 4b534f8..23125fc 100644 --- a/stdio-common/tst-fmemopen.c +++ b/stdio-common/tst-fmemopen.c @@ -1,5 +1,5 @@ /* basic fmemopen interface testing. - Copyright (C) 2014-2024 Free Software Foundation, Inc. + Copyright (C) 2014-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/tst-fmemopen2.c b/stdio-common/tst-fmemopen2.c index 50221e8..57597d3 100644 --- a/stdio-common/tst-fmemopen2.c +++ b/stdio-common/tst-fmemopen2.c @@ -1,5 +1,5 @@ /* fmemopen tests. - Copyright (C) 2015-2024 Free Software Foundation, Inc. + Copyright (C) 2015-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/tst-fmemopen3.c b/stdio-common/tst-fmemopen3.c index 0f7ba74..57f13bd 100644 --- a/stdio-common/tst-fmemopen3.c +++ b/stdio-common/tst-fmemopen3.c @@ -1,5 +1,5 @@ /* fmemopen tests for append and read mode. - Copyright (C) 2015-2024 Free Software Foundation, Inc. + Copyright (C) 2015-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/tst-fmemopen4.c b/stdio-common/tst-fmemopen4.c index f182daf..d8a61c2 100644 --- a/stdio-common/tst-fmemopen4.c +++ b/stdio-common/tst-fmemopen4.c @@ -1,5 +1,5 @@ /* fmemopen tests for BZ#1930 and BZ#20005. - Copyright (C) 2016-2024 Free Software Foundation, Inc. + Copyright (C) 2016-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/tst-fopen.c b/stdio-common/tst-fopen.c new file mode 100644 index 0000000..8c1fefd --- /dev/null +++ b/stdio-common/tst-fopen.c @@ -0,0 +1,279 @@ +/* Basic test for fopen. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <stdio.h> +#include <string.h> +#include <unistd.h> + +#include <support/check.h> +#include <support/temp_file.h> +#include <support/xstdio.h> + +#define APPENDED_TEXT "This is appended text. " +#define DEFAULT_TEXT "Lorem ipsum dolor sit amet, consectetur " \ + "adipiscing elit, sed do eiusmod tempor incididunt ut labore et " \ + "dolore magna aliqua." +#define MAX_BUFFER_SIZE 300 + + +static int +do_test (void) +{ + char *temp_file; + FILE *fd_file = NULL; + char read_buffer[MAX_BUFFER_SIZE] = ""; + size_t ret; + + /* Prepare files. */ + int fd = create_temp_file ("tst-fopen.", &temp_file); + TEST_VERIFY_EXIT (fd != -1); + fd_file = fdopen (fd, "w"); + ret = fwrite (DEFAULT_TEXT, sizeof (char), strlen (DEFAULT_TEXT), fd_file); + TEST_COMPARE (ret, strlen (DEFAULT_TEXT)); + xfclose (fd_file); + + /* Test 1: This checks for fopen with mode "r". Open text file for + reading. The stream is positioned at the beginning of the file. */ + printf ("Test 1: This checks for fopen with mode \"r\".\n"); + fd_file = fopen (temp_file, "r"); + TEST_COMPARE (ferror (fd_file), 0); + TEST_VERIFY (fd_file != NULL); + TEST_COMPARE (ftell (fd_file), 0); + /* Read should succeed. */ + ret = fread (read_buffer, sizeof (char), MAX_BUFFER_SIZE, fd_file); + TEST_COMPARE (ferror (fd_file), 0); + TEST_COMPARE (ret, strlen (DEFAULT_TEXT)); + TEST_VERIFY (strcmp (read_buffer, DEFAULT_TEXT) == 0); + /* Write should fail. */ + errno = 0; + ret = fwrite (DEFAULT_TEXT, sizeof (char), strlen (DEFAULT_TEXT), fd_file); + TEST_VERIFY (ferror (fd_file) != 0); + TEST_COMPARE (errno, EBADF); + TEST_COMPARE (ret, 0); + clearerr (fd_file); + /* Opening non-existent file should fail. */ + xfclose (fd_file); + errno = 0; + fd_file = fopen ("file-that-does-not-exist", "r"); + TEST_VERIFY (fd_file == NULL); + TEST_COMPARE (errno, ENOENT); + TEST_VERIFY (fd_file == NULL); + + memset (read_buffer, 0, MAX_BUFFER_SIZE); + + /* Test 2: This checks for fopen with mode "r+". Open for reading and + writing. The stream is positioned at the beginning of the file. */ + printf ("Test 2: This checks for fopen with mode \"r+\".\n"); + fd_file = fopen (temp_file, "r+"); + TEST_COMPARE (ferror (fd_file), 0); + TEST_VERIFY (fd_file != NULL); + TEST_COMPARE (ftell (fd_file), 0); + /* Read should succeed. */ + ret = fread (read_buffer, sizeof (char), MAX_BUFFER_SIZE, fd_file); + TEST_COMPARE (ferror (fd_file), 0); + TEST_COMPARE (ret, strlen (DEFAULT_TEXT)); + TEST_VERIFY (strcmp (read_buffer, DEFAULT_TEXT) == 0); + fflush (fd_file); + /* File position indicator expected at 0 + read bytes. */ + TEST_COMPARE (ftell (fd_file), ret); + /* Write should succeed. */ + ret = fwrite (DEFAULT_TEXT, sizeof (char), strlen (DEFAULT_TEXT), fd_file); + TEST_COMPARE (ferror (fd_file), 0); + TEST_COMPARE (ret, strlen (DEFAULT_TEXT)); + /* Opening non-existent file should fail. */ + xfclose (fd_file); + errno = 0; + fd_file = fopen ("file-that-does-not-exist", "r+"); + TEST_VERIFY (fd_file == NULL); + TEST_COMPARE (errno, ENOENT); + TEST_VERIFY (fd_file == NULL); + + memset (read_buffer, 0, MAX_BUFFER_SIZE); + + /* Test 3: This checks for fopen with mode "w". Truncate file to zero + length or create text file for writing. The stream is positioned + at the beginning of the file. */ + printf ("Test 3: This checks for fopen with mode \"w\".\n"); + fd_file = fopen (temp_file, "w"); + TEST_COMPARE (ferror (fd_file), 0); + TEST_VERIFY (fd_file != NULL); + TEST_COMPARE (ftell (fd_file), 0); + /* Read should fail. */ + errno = 0; + ret = fread (read_buffer, sizeof (char), MAX_BUFFER_SIZE, fd_file); + TEST_VERIFY (ferror (fd_file) != 0); + TEST_COMPARE (errno, EBADF); + TEST_COMPARE (ret, 0); + clearerr (fd_file); + /* Write should succeed. */ + ret = fwrite (DEFAULT_TEXT, sizeof (char), strlen (DEFAULT_TEXT), fd_file); + TEST_COMPARE (ferror (fd_file), 0); + TEST_COMPARE (ret, strlen (DEFAULT_TEXT)); + /* Opening non-existent file should succeed. */ + xfclose (fd_file); + fd_file = fopen ("/tmp/file-that-does-not-exist", "w"); + TEST_COMPARE (ferror (fd_file), 0); + TEST_VERIFY (fd_file != NULL); + TEST_COMPARE (ftell (fd_file), 0); + + xfclose (fd_file); + remove ("/tmp/file-that-does-not-exist"); + memset (read_buffer, 0, MAX_BUFFER_SIZE); + + /* Test 4: This checks for fopen with mode "w+". Open for reading and + writing. The file is created if it does not exist, otherwise it is + truncated. The stream is positioned at the beginning of the file. + */ + printf ("Test 4: This checks for fopen with mode \"w+\".\n"); + fd_file = fopen (temp_file, "w+"); + TEST_COMPARE (ferror (fd_file), 0); + TEST_VERIFY (fd_file != NULL); + TEST_COMPARE (ftell (fd_file), 0); + /* Read should succeed. */ + ret = fread (read_buffer, sizeof (char), MAX_BUFFER_SIZE, fd_file); + TEST_COMPARE (ferror (fd_file), 0); + TEST_COMPARE (ret, 0); + TEST_VERIFY (read_buffer[0] == '\0'); + /* Write should succeed. */ + ret = fwrite (DEFAULT_TEXT, sizeof (char), strlen (DEFAULT_TEXT), fd_file); + TEST_COMPARE (ferror (fd_file), 0); + TEST_COMPARE (ret, strlen (DEFAULT_TEXT)); + /* Opening non-existent file should succeed. */ + xfclose (fd_file); + fd_file = fopen ("/tmp/file-that-does-not-exist", "w+"); + TEST_COMPARE (ferror (fd_file), 0); + TEST_VERIFY (fd_file != NULL); + TEST_COMPARE (ftell (fd_file), 0); + + xfclose (fd_file); + remove ("/tmp/file-that-does-not-exist"); + memset (read_buffer, 0, MAX_BUFFER_SIZE); + + /* Test 5: This checks for fopen with mode "a". Open for appending + (writing at end of file). The file is created if it does not + exist. The stream is positioned at the end of the file. */ + printf ("Test 5: This checks for fopen with mode \"a\".\n"); + fd_file = fopen (temp_file, "a"); + TEST_COMPARE (ferror (fd_file), 0); + TEST_VERIFY (fd_file != NULL); + TEST_COMPARE (ftell (fd_file), strlen (DEFAULT_TEXT)); + /* Read should fail. */ + errno = 0; + ret = fread (read_buffer, sizeof (char), MAX_BUFFER_SIZE, fd_file); + TEST_VERIFY (ferror (fd_file) != 0); + TEST_COMPARE (errno, EBADF); + TEST_COMPARE (ret, 0); + clearerr (fd_file); + /* Write should succeed. */ + ret = fwrite (APPENDED_TEXT, sizeof (char), strlen (APPENDED_TEXT), fd_file); + TEST_COMPARE (ferror (fd_file), 0); + TEST_COMPARE (ret, strlen (APPENDED_TEXT)); + /* The file position indicator for the stream is advanced by the + * number of bytes successfully read or written. */ + TEST_COMPARE (ftell (fd_file), strlen (DEFAULT_TEXT) + ret); + /* Opening non-existent file should succeed. */ + xfclose (fd_file); + fd_file = fopen ("/tmp/file-that-does-not-exist", "a"); + TEST_COMPARE (ferror (fd_file), 0); + TEST_VERIFY (fd_file != NULL); + TEST_COMPARE (ftell (fd_file), 0); + + xfclose (fd_file); + remove ("/tmp/file-that-does-not-exist"); + memset (read_buffer, 0, MAX_BUFFER_SIZE); + + /* Test 6: This checks for fopen with mode "a+". Open for reading and + appending (writing at end of file). The file is created if it does + not exist. Output is always appended to the end of the file. The + initial file position for reading is at the beginning of the file, + but it is advanced to the end prior to each write. */ + printf ("Test 6: This checks for fopen with mode \"a+\".\n"); + errno = 0; + fd_file = fopen (temp_file, "a+"); + TEST_COMPARE (errno, 0); + TEST_VERIFY (fd_file != NULL); + TEST_COMPARE (ftell (fd_file), 0); + /* Read should succeed. */ + ret = fread (read_buffer, sizeof (char), MAX_BUFFER_SIZE, fd_file); + TEST_COMPARE (ferror (fd_file), 0); + TEST_COMPARE (ret, strlen (DEFAULT_TEXT) + strlen (APPENDED_TEXT)); + TEST_VERIFY (strcmp (read_buffer, DEFAULT_TEXT APPENDED_TEXT) == 0); + /* Write should succeed. */ + const char* SECOND_APPEND = "This is second append."; + ret = fwrite (SECOND_APPEND, sizeof (char), strlen (SECOND_APPEND), fd_file); + TEST_COMPARE (ferror (fd_file), 0); + TEST_COMPARE (ret, strlen (SECOND_APPEND)); + /* The file position indicator for the stream is advanced by the + number of bytes successfully read or written. */ + TEST_COMPARE (ftell (fd_file), + strlen (DEFAULT_TEXT) + strlen (APPENDED_TEXT) + ret); + /* Opening non-existent file should succeed. */ + xfclose (fd_file); + fd_file = fopen ("/tmp/file-that-does-not-exist", "a+"); + TEST_COMPARE (ferror (fd_file), 0); + TEST_VERIFY (fd_file != NULL); + TEST_COMPARE (ftell (fd_file), 0); + + xfclose (fd_file); + remove ("/tmp/file-that-does-not-exist"); + memset (read_buffer, 0, MAX_BUFFER_SIZE); + + /* Test 7: This checks for fopen with other valid modes set, such as + "rc", "we" or "am". The test calls fopen with these modes and + checks that no errors appear. */ + printf ("Test 7: This checks for fopen with other valid modes set, " + "such as \"rc\", \"we\" or \"am\".\n"); + /* These modes all operate correctly with the file already present. */ + static const char *valid_modes[] = + { "rc", "we", "am", "r+x", "wb+", "ab", 0 }; + const char **p = valid_modes; + while (*p != 0) + { + fd_file = fopen (temp_file, *p); + TEST_COMPARE (ferror (fd_file), 0); + TEST_VERIFY (fd_file != NULL); + xfclose (fd_file); + ++p; + } + + /* Test 8: This checks for fopen with invalid modes. The test calls + fopen with these modes and checks that opening existing files with + invalid mode fails and that opening non-existing files with invalid + mode doesn't create a new file. */ + printf ("Test 8: This checks for fopen with invalid modes.\n"); + static const char *invalid_modes[] = { "0", "tr", "z", "x", " ", 0 }; + p = invalid_modes; + while (*p != 0) + { + errno = 0; + fd_file = fopen (temp_file, *p); + TEST_VERIFY (fd_file == NULL); + TEST_COMPARE (errno, EINVAL); + errno = 0; + fd_file = fopen ("/tmp/file-that-does-not-exist", *p); + TEST_VERIFY (fd_file == NULL); + TEST_COMPARE (errno, EINVAL); + ++p; + TEST_VERIFY (access ("/tmp/file-that-does-not-exist", F_OK) == -1); + } + + return 0; +} + +#include <support/test-driver.c> diff --git a/stdio-common/tst-fphex-wide.c b/stdio-common/tst-fphex-wide.c index ed24d8e..b25d70e 100644 --- a/stdio-common/tst-fphex-wide.c +++ b/stdio-common/tst-fphex-wide.c @@ -1,6 +1,6 @@ /* Test program for %a wprintf formats. This file is part of the GNU C Library. - Copyright (C) 2012-2024 Free Software Foundation, Inc. + Copyright (C) 2012-2025 Free Software Foundation, Inc. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public diff --git a/stdio-common/tst-fphex.c b/stdio-common/tst-fphex.c index efba482..7c0e4bd 100644 --- a/stdio-common/tst-fphex.c +++ b/stdio-common/tst-fphex.c @@ -3,6 +3,7 @@ #include <array_length.h> #include <stdio.h> #include <string.h> +#include <libc-diag.h> #ifndef WIDE # define STR_LEN strlen @@ -56,10 +57,14 @@ do_test (void) int n = SPRINT (buf, array_length (buf), t->fmt, t->value); if (n != STR_LEN (t->expect) || STR_CMP (buf, t->expect) != 0) { + /* clang do not handle %Z format. */ + DIAG_PUSH_NEEDS_COMMENT_CLANG; + DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wformat"); PRINT (L_("" S "\tExpected \"" S "\" (%Zu)\n\tGot \"" S "\" (%d, %Zu)\n"), t->fmt, t->expect, STR_LEN (t->expect), buf, n, STR_LEN (buf)); + DIAG_POP_NEEDS_COMMENT_CLANG; result = 1; } } diff --git a/stdio-common/tst-fread.c b/stdio-common/tst-fread.c new file mode 100644 index 0000000..662265e --- /dev/null +++ b/stdio-common/tst-fread.c @@ -0,0 +1,134 @@ +/* Test fread. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include <support/check.h> +#include <support/support.h> +#include <support/temp_file.h> +#include <support/test-driver.h> +#include <support/xstdio.h> +#include <support/xunistd.h> + +int +do_test (void) +{ + char *temp_dir = support_create_temp_directory ("tst-fread"); + char *file1 = xasprintf ("%s/file1", temp_dir); + support_write_file_string (file1, "file1"); + add_temp_file (file1); + FILE *fp; + size_t ret; + char buf[1024]; + + verbose_printf ("test single-byte reads\n"); + fp = xfopen (file1, "r"); + memset (buf, 0, sizeof buf); + ret = fread (buf, 1, 2, fp); + TEST_COMPARE (ret, 2); + TEST_COMPARE (buf[0], 'f'); + TEST_COMPARE (buf[1], 'i'); + TEST_COMPARE (feof (fp), 0); + TEST_COMPARE (ftell (fp), 2); + memset (buf, 0, sizeof buf); + ret = fread (buf, 1, 3, fp); + TEST_COMPARE (ret, 3); + TEST_COMPARE (buf[0], 'l'); + TEST_COMPARE (buf[1], 'e'); + TEST_COMPARE (buf[2], '1'); + TEST_COMPARE (ftell (fp), 5); + TEST_COMPARE (feof (fp), 0); + memset (buf, 0, sizeof buf); + ret = fread (buf, 1, 1, fp); + TEST_COMPARE (ret, 0); + TEST_COMPARE (!!feof (fp), 1); + TEST_COMPARE (ferror (fp), 0); + TEST_COMPARE (ftell (fp), 5); + xfclose (fp); + + verbose_printf ("test single-byte reads, EOF part way through\n"); + fp = xfopen (file1, "r"); + memset (buf, 0, sizeof buf); + ret = fread (buf, 1, sizeof buf, fp); + TEST_COMPARE (ret, 5); + TEST_COMPARE (buf[0], 'f'); + TEST_COMPARE (buf[1], 'i'); + TEST_COMPARE (buf[2], 'l'); + TEST_COMPARE (buf[3], 'e'); + TEST_COMPARE (buf[4], '1'); + TEST_COMPARE (!!feof (fp), 1); + TEST_COMPARE (ferror (fp), 0); + TEST_COMPARE (ftell (fp), 5); + xfclose (fp); + + verbose_printf ("test multi-byte reads\n"); + fp = xfopen (file1, "r"); + memset (buf, 0, sizeof buf); + ret = fread (buf, 2, 2, fp); + TEST_COMPARE (ret, 2); + TEST_COMPARE (buf[0], 'f'); + TEST_COMPARE (buf[1], 'i'); + TEST_COMPARE (buf[2], 'l'); + TEST_COMPARE (buf[3], 'e'); + TEST_COMPARE (feof (fp), 0); + TEST_COMPARE (ftell (fp), 4); + memset (buf, 0, sizeof buf); + ret = fread (buf, 3, 3, fp); + TEST_COMPARE (ret, 0); + /* The bytes written for a partial element read are unspecified. */ + TEST_COMPARE (!!feof (fp), 1); + TEST_COMPARE (ferror (fp), 0); + TEST_COMPARE (ftell (fp), 5); + xfclose (fp); + + verbose_printf ("test read error\n"); + fp = xfopen (file1, "r"); + xclose (fileno (fp)); + memset (buf, 0, sizeof buf); + ret = fread (buf, 1, sizeof buf, fp); + TEST_COMPARE (ret, 0); + TEST_COMPARE (feof (fp), 0); + TEST_COMPARE (!!ferror (fp), 1); + fclose (fp); + + verbose_printf ("test zero size\n"); + fp = xfopen (file1, "r"); + ret = fread (buf, 0, SIZE_MAX, fp); + TEST_COMPARE (ret, 0); + TEST_COMPARE (feof (fp), 0); + TEST_COMPARE (ferror (fp), 0); + TEST_COMPARE (ftell (fp), 0); + xfclose (fp); + + verbose_printf ("test zero items\n"); + fp = xfopen (file1, "r"); + ret = fread (buf, SIZE_MAX, 0, fp); + TEST_COMPARE (ret, 0); + TEST_COMPARE (feof (fp), 0); + TEST_COMPARE (ferror (fp), 0); + TEST_COMPARE (ftell (fp), 0); + xfclose (fp); + + free (temp_dir); + free (file1); + return 0; +} + +#include <support/test-driver.c> diff --git a/stdio-common/tst-freopen2-main.c b/stdio-common/tst-freopen2-main.c new file mode 100644 index 0000000..2dc438c --- /dev/null +++ b/stdio-common/tst-freopen2-main.c @@ -0,0 +1,519 @@ +/* Test freopen. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <fcntl.h> +#include <mcheck.h> +#include <stdio.h> +#include <stdlib.h> +#include <wchar.h> + +#include <support/check.h> +#include <support/descriptors.h> +#include <support/file_contents.h> +#include <support/support.h> +#include <support/temp_file.h> +#include <support/test-driver.h> +#include <support/xstdio.h> + +#define START_TEST(DESC) \ + do \ + { \ + fds = support_descriptors_list (); \ + verbose_printf (DESC); \ + } \ + while (0) + +#define END_TEST \ + do \ + { \ + support_descriptors_check (fds); \ + support_descriptors_free (fds); \ + } \ + while (0) + +int +do_test (void) +{ + mtrace (); + struct support_descriptors *fds; + char *temp_dir = support_create_temp_directory ("tst-freopen2"); + char *file1 = xasprintf ("%s/file1", temp_dir); + support_write_file_string (file1, "file1"); + add_temp_file (file1); + char *file2 = xasprintf ("%s/file2", temp_dir); + support_write_file_string (file2, "file2"); + add_temp_file (file2); + char *file3 = xasprintf ("%s/file3", temp_dir); + char *file4 = xasprintf ("%s/file4", temp_dir); + char *file1a = xasprintf ("%s/file1a", temp_dir); + FILE *fp; + int ret; + wint_t wc; + + /* Test each pair of old and new modes from r w a. */ + + START_TEST ("Testing r -> r\n"); + fp = xfopen (file1, "r"); + fp = FREOPEN (file2, "r", fp); + TEST_VERIFY_EXIT (fp != NULL); + TEST_COMPARE_FILE_STRING (fp, "file2"); + xfclose (fp); + END_TEST; + + START_TEST ("Testing r -> w\n"); + fp = xfopen (file1, "r"); + fp = FREOPEN (file2, "w", fp); + TEST_VERIFY_EXIT (fp != NULL); + ret = fputs ("File2new", fp); + TEST_VERIFY (ret >= 0); + xfclose (fp); + TEST_OPEN_AND_COMPARE_FILE_STRING (file1, "file1"); + TEST_OPEN_AND_COMPARE_FILE_STRING (file2, "File2new"); + END_TEST; + + START_TEST ("Testing r -> a\n"); + fp = xfopen (file1, "r"); + fp = FREOPEN (file2, "a", fp); + TEST_VERIFY_EXIT (fp != NULL); + ret = fputs ("3", fp); + TEST_VERIFY (ret >= 0); + xfclose (fp); + TEST_OPEN_AND_COMPARE_FILE_STRING (file2, "File2new3"); + END_TEST; + + START_TEST ("Testing w -> r\n"); + fp = xfopen (file1, "w"); + fp = FREOPEN (file2, "r", fp); + TEST_VERIFY_EXIT (fp != NULL); + TEST_COMPARE_FILE_STRING (fp, "File2new3"); + xfclose (fp); + END_TEST; + + START_TEST ("Testing w -> w\n"); + fp = xfopen (file1, "w"); + fp = FREOPEN (file2, "w", fp); + TEST_VERIFY_EXIT (fp != NULL); + ret = fputs ("next", fp); + TEST_VERIFY (ret >= 0); + xfclose (fp); + TEST_OPEN_AND_COMPARE_FILE_STRING (file1, ""); + TEST_OPEN_AND_COMPARE_FILE_STRING (file2, "next"); + END_TEST; + + START_TEST ("Testing w -> a\n"); + fp = xfopen (file1, "w"); + fp = FREOPEN (file2, "a", fp); + TEST_VERIFY_EXIT (fp != NULL); + ret = fputs ("4", fp); + TEST_VERIFY (ret >= 0); + xfclose (fp); + TEST_OPEN_AND_COMPARE_FILE_STRING (file2, "next4"); + END_TEST; + + START_TEST ("Testing a -> r\n"); + fp = xfopen (file1, "a"); + fp = FREOPEN (file2, "r", fp); + TEST_VERIFY_EXIT (fp != NULL); + TEST_COMPARE_FILE_STRING (fp, "next4"); + xfclose (fp); + END_TEST; + + START_TEST ("Testing a -> w\n"); + fp = xfopen (file1, "a"); + fp = FREOPEN (file2, "w", fp); + TEST_VERIFY_EXIT (fp != NULL); + ret = fputs ("another", fp); + TEST_VERIFY (ret >= 0); + xfclose (fp); + TEST_OPEN_AND_COMPARE_FILE_STRING (file2, "another"); + END_TEST; + + START_TEST ("Testing a -> a\n"); + fp = xfopen (file1, "a"); + fp = FREOPEN (file2, "a", fp); + TEST_VERIFY_EXIT (fp != NULL); + ret = fputs ("5", fp); + TEST_VERIFY (ret >= 0); + xfclose (fp); + TEST_OPEN_AND_COMPARE_FILE_STRING (file2, "another5"); + END_TEST; + + /* Test for file originally opened with fopen64. */ + START_TEST ("Testing fopen64 a -> a\n"); + fp = fopen64 (file1, "a"); + TEST_VERIFY_EXIT (fp != NULL); + fp = FREOPEN (file2, "a", fp); + TEST_VERIFY_EXIT (fp != NULL); + ret = fputs ("64", fp); + TEST_VERIFY (ret >= 0); + xfclose (fp); + TEST_OPEN_AND_COMPARE_FILE_STRING (file2, "another564"); + END_TEST; + + /* Test calling freopen more than once on the same FILE *. */ + + START_TEST ("Testing r -> w -> r\n"); + fp = xfopen (file1, "r"); + fp = FREOPEN (file2, "w", fp); + TEST_VERIFY_EXIT (fp != NULL); + ret = fputs ("freopen-twice", fp); + TEST_VERIFY (ret >= 0); + fp = FREOPEN (file2, "r", fp); + TEST_VERIFY_EXIT (fp != NULL); + TEST_COMPARE_FILE_STRING (fp, "freopen-twice"); + xfclose (fp); + TEST_OPEN_AND_COMPARE_FILE_STRING (file2, "freopen-twice"); + END_TEST; + + START_TEST ("Testing r -> w -> r (exactly one freopen64)\n"); + fp = xfopen (file1, "r"); + fp = OTHER_FREOPEN (file2, "w", fp); + TEST_VERIFY_EXIT (fp != NULL); + ret = fputs ("freopen-twice64", fp); + TEST_VERIFY (ret >= 0); + fp = FREOPEN (file2, "r", fp); + TEST_VERIFY_EXIT (fp != NULL); + TEST_COMPARE_FILE_STRING (fp, "freopen-twice64"); + xfclose (fp); + TEST_OPEN_AND_COMPARE_FILE_STRING (file2, "freopen-twice64"); + END_TEST; + + /* Test changing to/from b (binary, no-op). */ + + START_TEST ("Testing rb -> r\n"); + fp = xfopen (file1, "rb"); + fp = FREOPEN (file2, "r", fp); + TEST_VERIFY_EXIT (fp != NULL); + TEST_COMPARE_FILE_STRING (fp, "freopen-twice64"); + xfclose (fp); + END_TEST; + + START_TEST ("Testing r -> rb\n"); + fp = xfopen (file1, "r"); + fp = FREOPEN (file2, "rb", fp); + TEST_VERIFY_EXIT (fp != NULL); + TEST_COMPARE_FILE_STRING (fp, "freopen-twice64"); + xfclose (fp); + END_TEST; + + /* Test changing to/from + (read-and-write). */ + + START_TEST ("Testing r -> w+\n"); + fp = xfopen (file1, "r"); + fp = FREOPEN (file2, "w+", fp); + TEST_VERIFY_EXIT (fp != NULL); + ret = fputs ("latest", fp); + TEST_VERIFY (ret >= 0); + ret = fseek (fp, 0, SEEK_SET); + TEST_COMPARE (ret, 0); + TEST_COMPARE_FILE_STRING (fp, "latest"); + xfclose (fp); + TEST_OPEN_AND_COMPARE_FILE_STRING (file2, "latest"); + END_TEST; + + START_TEST ("Testing w -> a+\n"); + fp = xfopen (file1, "w"); + fp = FREOPEN (file2, "a+", fp); + TEST_VERIFY_EXIT (fp != NULL); + ret = fputs ("suffix", fp); + TEST_VERIFY (ret >= 0); + ret = fseek (fp, 0, SEEK_SET); + TEST_COMPARE (ret, 0); + TEST_COMPARE_FILE_STRING (fp, "latestsuffix"); + xfclose (fp); + TEST_OPEN_AND_COMPARE_FILE_STRING (file2, "latestsuffix"); + END_TEST; + + START_TEST ("Testing a -> r+\n"); + fp = xfopen (file1, "a"); + fp = FREOPEN (file2, "r+", fp); + TEST_VERIFY_EXIT (fp != NULL); + TEST_COMPARE_FILE_STRING (fp, "latestsuffix"); + ret = fseek (fp, 0, SEEK_SET); + TEST_COMPARE (ret, 0); + ret = fputs ("new", fp); + TEST_VERIFY (ret >= 0); + xfclose (fp); + TEST_OPEN_AND_COMPARE_FILE_STRING (file2, "newestsuffix"); + END_TEST; + + START_TEST ("Testing r+ -> w\n"); + fp = xfopen (file1, "r+"); + fp = FREOPEN (file2, "w", fp); + TEST_VERIFY_EXIT (fp != NULL); + ret = fputs ("plusto", fp); + TEST_VERIFY (ret >= 0); + ret = fseek (fp, 0, SEEK_SET); + TEST_COMPARE (ret, 0); + errno = 0; + TEST_COMPARE (fgetc (fp), EOF); + TEST_COMPARE (errno, EBADF); + clearerr (fp); + xfclose (fp); + TEST_OPEN_AND_COMPARE_FILE_STRING (file2, "plusto"); + END_TEST; + + START_TEST ("Testing w+ -> a\n"); + fp = xfopen (file1, "w+"); + fp = FREOPEN (file2, "a", fp); + TEST_VERIFY_EXIT (fp != NULL); + ret = fputs ("more", fp); + TEST_VERIFY (ret >= 0); + ret = fseek (fp, 0, SEEK_SET); + TEST_COMPARE (ret, 0); + errno = 0; + TEST_COMPARE (fgetc (fp), EOF); + TEST_COMPARE (errno, EBADF); + clearerr (fp); + xfclose (fp); + TEST_OPEN_AND_COMPARE_FILE_STRING (file2, "plustomore"); + END_TEST; + + START_TEST ("Testing a+ -> r\n"); + fp = xfopen (file1, "a+"); + fp = FREOPEN (file2, "rr", fp); + TEST_VERIFY_EXIT (fp != NULL); + TEST_COMPARE_FILE_STRING (fp, "plustomore"); + ret = fputs ("2", fp); + TEST_COMPARE (ret, EOF); + clearerr (fp); + xfclose (fp); + TEST_OPEN_AND_COMPARE_FILE_STRING (file2, "plustomore"); + END_TEST; + + /* Test changing to/from e (FD_CLOEXEC). */ + + START_TEST ("Testing re -> r\n"); + fp = xfopen (file1, "re"); + ret = fcntl (fileno (fp), F_GETFD); + TEST_VERIFY (ret != -1); + TEST_COMPARE (ret & FD_CLOEXEC, FD_CLOEXEC); + fp = FREOPEN (file2, "r", fp); + TEST_VERIFY_EXIT (fp != NULL); + ret = fcntl (fileno (fp), F_GETFD); + TEST_VERIFY (ret != -1); + TEST_COMPARE (ret & FD_CLOEXEC, 0); + TEST_COMPARE_FILE_STRING (fp, "plustomore"); + xfclose (fp); + END_TEST; + + START_TEST ("Testing r -> re\n"); + fp = xfopen (file1, "r"); + ret = fcntl (fileno (fp), F_GETFD); + TEST_VERIFY (ret != -1); + TEST_COMPARE (ret & FD_CLOEXEC, 0); + fp = FREOPEN (file2, "re", fp); + TEST_VERIFY_EXIT (fp != NULL); + ret = fcntl (fileno (fp), F_GETFD); + TEST_VERIFY (ret != -1); + TEST_COMPARE (ret & FD_CLOEXEC, FD_CLOEXEC); + TEST_COMPARE_FILE_STRING (fp, "plustomore"); + xfclose (fp); + END_TEST; + + /* Test changing to/from m (mmap) (a no-op as far as testing + semantics is concerned). */ + + START_TEST ("Testing rm -> r\n"); + fp = xfopen (file1, "rm"); + fp = FREOPEN (file2, "r", fp); + TEST_VERIFY_EXIT (fp != NULL); + TEST_COMPARE_FILE_STRING (fp, "plustomore"); + xfclose (fp); + END_TEST; + + START_TEST ("Testing r -> rm\n"); + fp = xfopen (file1, "r"); + fp = FREOPEN (file2, "rm", fp); + TEST_VERIFY_EXIT (fp != NULL); + TEST_COMPARE_FILE_STRING (fp, "plustomore"); + xfclose (fp); + END_TEST; + + /* Test changing to/from x (O_EXCL). */ + + START_TEST ("Testing wx -> w\n"); + fp = xfopen (file3, "wx"); + add_temp_file (file3); + fp = FREOPEN (file2, "w", fp); + TEST_VERIFY_EXIT (fp != NULL); + ret = fputs ("wxtow", fp); + TEST_VERIFY (ret >= 0); + xfclose (fp); + TEST_OPEN_AND_COMPARE_FILE_STRING (file2, "wxtow"); + END_TEST; + + START_TEST ("Testing w -> wx (file does not exist)\n"); + fp = xfopen (file1, "w"); + fp = FREOPEN (file4, "wx", fp); + TEST_VERIFY_EXIT (fp != NULL); + add_temp_file (file4); + ret = fputs ("wtowx", fp); + TEST_VERIFY (ret >= 0); + xfclose (fp); + TEST_OPEN_AND_COMPARE_FILE_STRING (file4, "wtowx"); + END_TEST; + + /* Test with ,ccs=CHARSET. */ + + START_TEST ("testing w,ccs=utf-8 -> r\n"); + fp = xfopen (file1, "w,ccs=utf-8"); + ret = fputws (L"\xc0\xc1", fp); + TEST_VERIFY (ret >= 0); + fp = FREOPEN (file2, "r", fp); + TEST_VERIFY_EXIT (fp != NULL); + TEST_COMPARE_FILE_STRING (fp, "wxtow"); + xfclose (fp); + END_TEST; + + START_TEST ("testing w,ccs=iso-8859-1 -> r,ccs=utf-8\n"); + fp = xfopen (file2, "w,ccs=iso-8859-1"); + ret = fputws (L"\xc0\xc1", fp); + TEST_VERIFY (ret >= 0); + fp = FREOPEN (file1, "r,ccs=utf-8", fp); + TEST_VERIFY_EXIT (fp != NULL); + wc = fgetwc (fp); + TEST_COMPARE (wc, (wint_t) 0xc0); + wc = fgetwc (fp); + TEST_COMPARE (wc, (wint_t) 0xc1); + wc = fgetwc (fp); + TEST_COMPARE (wc, WEOF); + xfclose (fp); + END_TEST; + + START_TEST ("testing r,ccs=utf-8 -> r\n"); + fp = xfopen (file1, "r,ccs=utf-8"); + fp = FREOPEN (file1, "r", fp); + TEST_VERIFY_EXIT (fp != NULL); + TEST_COMPARE_FILE_STRING (fp, "\u00c0\u00c1"); + xfclose (fp); + END_TEST; + + /* Test that errors closing the old file are ignored. */ + + START_TEST ("testing errors closing old file ignored\n"); + fp = xfopen ("/dev/full", "w"); + fputc ('x', fp); + fp = FREOPEN (file1, "r", fp); + TEST_VERIFY_EXIT (fp != NULL); + TEST_COMPARE_FILE_STRING (fp, "\u00c0\u00c1"); + xfclose (fp); + END_TEST; + + /* Test that error / EOF state from the old file are cleared. */ + + START_TEST ("testing error state from old file cleared\n"); + fp = xfopen ("/dev/full", "w"); + fputc ('x', fp); + fflush (fp); + TEST_VERIFY (ferror (fp)); + TEST_VERIFY (!feof (fp)); + fp = FREOPEN (file2, "w", fp); + TEST_VERIFY_EXIT (fp != NULL); + TEST_VERIFY (!ferror (fp)); + TEST_VERIFY (!feof (fp)); + xfclose (fp); + END_TEST; + + START_TEST ("testing EOF state from old file cleared\n"); + fp = xfopen ("/dev/null", "r"); + fgetc (fp); + TEST_VERIFY (!ferror (fp)); + TEST_VERIFY (feof (fp)); + fp = FREOPEN (file2, "r", fp); + TEST_VERIFY_EXIT (fp != NULL); + TEST_VERIFY (!ferror (fp)); + TEST_VERIFY (!feof (fp)); + xfclose (fp); + END_TEST; + + /* Test freopen with NULL, same mode (should flush content and reset + file offset). */ + + START_TEST ("testing freopen with NULL, same mode\n"); + fp = xfopen (file1, "r+"); + ret = fputs ("same mode", fp); + TEST_VERIFY (ret >= 0); + fp = FREOPEN (NULL, "r+", fp); + TEST_VERIFY_EXIT (fp != NULL); + TEST_COMPARE_FILE_STRING (fp, "same mode"); + xfclose (fp); + END_TEST; + + /* Test freopen with NULL, different mode. */ + + START_TEST ("testing freopen with NULL, different mode\n"); + fp = xfopen (file1, "w"); + ret = fputs ("different mode", fp); + TEST_VERIFY (ret >= 0); + fp = FREOPEN (NULL, "r", fp); + TEST_VERIFY_EXIT (fp != NULL); + TEST_COMPARE_FILE_STRING (fp, "different mode"); + xfclose (fp); + END_TEST; + + /* Test freopen with NULL, renamed file. This verifies that + reopening succeeds (and resets the file position indicator to + start of file) even when the original path could no longer be + opened. */ + + START_TEST ("testing freopen with NULL, renamed file\n"); + fp = xfopen (file1, "r+"); + ret = fputs ("file has been renamed", fp); + TEST_VERIFY (ret >= 0); + ret = rename (file1, file1a); + TEST_COMPARE (ret, 0); + fp = FREOPEN (NULL, "r+", fp); + TEST_VERIFY_EXIT (fp != NULL); + TEST_COMPARE_FILE_STRING (fp, "file has been renamed"); + xfclose (fp); + ret = rename (file1a, file1); + TEST_COMPARE (ret, 0); + END_TEST; + + /* Test freopen with NULL, deleted file. This verifies that + reopening succeeds (and resets the file position indicator to + start of file) even when the original path could no longer be + opened. */ + + START_TEST ("testing freopen with NULL, deleted file\n"); + fp = xfopen (file1, "r+"); + ret = fputs ("file has now been deleted", fp); + TEST_VERIFY (ret >= 0); + ret = remove (file1); + TEST_COMPARE (ret, 0); + fp = FREOPEN (NULL, "r+", fp); + TEST_VERIFY_EXIT (fp != NULL); + TEST_COMPARE_FILE_STRING (fp, "file has now been deleted"); + xfclose (fp); + /* Recreate the file so it is present when expected for temporary + file deletion. */ + support_write_file_string (file1, "file1"); + END_TEST; + + free (temp_dir); + free (file1); + free (file2); + free (file3); + free (file4); + free (file1a); + return 0; +} + +#include <support/test-driver.c> diff --git a/stdio-common/tst-freopen2.c b/stdio-common/tst-freopen2.c new file mode 100644 index 0000000..11ec7a9 --- /dev/null +++ b/stdio-common/tst-freopen2.c @@ -0,0 +1,3 @@ +#define FREOPEN freopen +#define OTHER_FREOPEN freopen64 +#include <tst-freopen2-main.c> diff --git a/stdio-common/tst-freopen3-main.c b/stdio-common/tst-freopen3-main.c new file mode 100644 index 0000000..24a34df --- /dev/null +++ b/stdio-common/tst-freopen3-main.c @@ -0,0 +1,92 @@ +/* Test freopen failure. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <fcntl.h> +#include <mcheck.h> +#include <stdio.h> +#include <stdlib.h> + +#include <support/check.h> +#include <support/descriptors.h> +#include <support/file_contents.h> +#include <support/support.h> +#include <support/temp_file.h> +#include <support/test-driver.h> +#include <support/xstdio.h> + +#define START_TEST(DESC) \ + do \ + { \ + fds = support_descriptors_list (); \ + verbose_printf (DESC); \ + } \ + while (0) + +#define END_TEST \ + do \ + { \ + support_descriptors_check (fds); \ + support_descriptors_free (fds); \ + } \ + while (0) + +int +do_test (void) +{ + mtrace (); + struct support_descriptors *fds; + char *temp_dir = support_create_temp_directory ("tst-freopen3"); + char *file1 = xasprintf ("%s/file1", temp_dir); + support_write_file_string (file1, "file1"); + add_temp_file (file1); + char *file2 = xasprintf ("%s/file2", temp_dir); + support_write_file_string (file2, "file2"); + add_temp_file (file2); + char *file_nodir = xasprintf ("%s/nodir/file", temp_dir); + FILE *fp; + int ret; + int fd; + + START_TEST ("Testing w -> wx (file exists)\n"); + fp = xfopen (file1, "w"); + fp = FREOPEN (file2, "wx", fp); + TEST_VERIFY (fp == NULL); + END_TEST; + + /* Test old file is closed even when opening the new file fails. */ + + START_TEST ("testing r -> r (opening new file fails)\n"); + fp = xfopen (file1, "r"); + fd = fileno (fp); + fp = FREOPEN (file_nodir, "r", fp); + TEST_VERIFY (fp == NULL); + errno = 0; + ret = fcntl (fd, F_GETFL); + TEST_COMPARE (ret, -1); + TEST_COMPARE (errno, EBADF); + END_TEST; + + free (temp_dir); + free (file1); + free (file2); + free (file_nodir); + return 0; +} + +#include <support/test-driver.c> diff --git a/stdio-common/tst-freopen3.c b/stdio-common/tst-freopen3.c new file mode 100644 index 0000000..5041b6b --- /dev/null +++ b/stdio-common/tst-freopen3.c @@ -0,0 +1,2 @@ +#define FREOPEN freopen +#include <tst-freopen3-main.c> diff --git a/stdio-common/tst-freopen4-main.c b/stdio-common/tst-freopen4-main.c new file mode 100644 index 0000000..3336f53 --- /dev/null +++ b/stdio-common/tst-freopen4-main.c @@ -0,0 +1,102 @@ +/* Test freopen in chroot. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <mcheck.h> +#include <stdio.h> +#include <stdlib.h> + +#include <support/check.h> +#include <support/file_contents.h> +#include <support/namespace.h> +#include <support/support.h> +#include <support/temp_file.h> +#include <support/test-driver.h> +#include <support/xstdio.h> +#include <support/xunistd.h> + +int +do_test (void) +{ + mtrace (); + char *temp_dir; + FILE *fp; + int ret; + + /* These chroot tests verify that either reopening a renamed or + deleted file works even in the absence of /proc, or that it fails + (without memory leaks); thus, for example, such reopening does + not crash in the absence of /proc. */ + + support_become_root (); + if (!support_can_chroot ()) + return EXIT_UNSUPPORTED; + + temp_dir = support_create_temp_directory ("tst-freopen4"); + xchroot (temp_dir); + + /* Test freopen with NULL, renamed file. This verifies that + reopening succeeds (and resets the file position indicator to + start of file) even when the original path could no longer be + opened, or fails without a memory leak. (It is not possible to + use <support/descriptors.h> to test for file descriptor leaks + here, because that also depends on /proc.) */ + + verbose_printf ("testing freopen with NULL, renamed file\n"); + fp = xfopen ("/file1", "w+"); + ret = fputs ("file has been renamed", fp); + TEST_VERIFY (ret >= 0); + ret = rename ("/file1", "/file1a"); + TEST_COMPARE (ret, 0); + fp = FREOPEN (NULL, "r+", fp); + if (fp != NULL) + { + puts ("freopen of renamed file succeeded"); + TEST_COMPARE_FILE_STRING (fp, "file has been renamed"); + xfclose (fp); + } + else + puts ("freopen of renamed file failed (OK)"); + ret = rename ("/file1a", "/file1"); + TEST_COMPARE (ret, 0); + + /* Test freopen with NULL, deleted file. This verifies that + reopening succeeds (and resets the file position indicator to + start of file) even when the original path could no longer be + opened, or fails without a memory leak. */ + + verbose_printf ("testing freopen with NULL, deleted file\n"); + fp = xfopen ("/file1", "r+"); + ret = fputs ("file has now been deleted", fp); + TEST_VERIFY (ret >= 0); + ret = remove ("/file1"); + TEST_COMPARE (ret, 0); + fp = FREOPEN (NULL, "r+", fp); + if (fp != NULL) + { + puts ("freopen of deleted file succeeded"); + TEST_COMPARE_FILE_STRING (fp, "file has now been deleted"); + xfclose (fp); + } + else + puts ("freopen of deleted file failed (OK)"); + + free (temp_dir); + return 0; +} + +#include <support/test-driver.c> diff --git a/stdio-common/tst-freopen4.c b/stdio-common/tst-freopen4.c new file mode 100644 index 0000000..f39ec0d --- /dev/null +++ b/stdio-common/tst-freopen4.c @@ -0,0 +1,2 @@ +#define FREOPEN freopen +#include <tst-freopen4-main.c> diff --git a/stdio-common/tst-freopen5.c b/stdio-common/tst-freopen5.c new file mode 100644 index 0000000..3b2a98a --- /dev/null +++ b/stdio-common/tst-freopen5.c @@ -0,0 +1,144 @@ +/* Test freopen and freopen64 with large offsets. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <mcheck.h> +#include <stdio.h> +#include <stdlib.h> + +#include <support/check.h> +#include <support/descriptors.h> +#include <support/support.h> +#include <support/temp_file.h> +#include <support/test-driver.h> +#include <support/xstdio.h> + +#define START_TEST(DESC) \ + do \ + { \ + fds = support_descriptors_list (); \ + verbose_printf (DESC); \ + } \ + while (0) + +#define END_TEST \ + do \ + { \ + support_descriptors_check (fds); \ + support_descriptors_free (fds); \ + } \ + while (0) + +int +do_test (void) +{ + mtrace (); + struct support_descriptors *fds; + FILE *fp; + int ret; + + char *temp_dir = support_create_temp_directory ("tst-freopen5"); + /* This file is removed at the end of each test rather than left + around between tests to avoid problems with subsequent tests + reopening it as a large (2GB + 1 byte) file. */ + char *file1 = xasprintf ("%s/file1", temp_dir); + + /* fopen with freopen64: large offsets OK. */ + START_TEST ("testing fopen with freopen64\n"); + fp = fopen ("/dev/null", "r"); + TEST_VERIFY_EXIT (fp != NULL); + fp = freopen64 (file1, "w", fp); + TEST_VERIFY_EXIT (fp != NULL); + setbuf (fp, NULL); + ret = fseeko64 (fp, 1LL << 32, SEEK_SET); + TEST_COMPARE (ret, 0); + ret = fputc ('x', fp); + TEST_COMPARE (ret, 'x'); + xfclose (fp); + ret = remove (file1); + TEST_COMPARE (ret, 0); + END_TEST; + + /* fopen64 with freopen64: large offsets OK. */ + START_TEST ("testing fopen64 with freopen64\n"); + fp = fopen64 ("/dev/null", "r"); + TEST_VERIFY_EXIT (fp != NULL); + fp = freopen64 (file1, "w", fp); + TEST_VERIFY_EXIT (fp != NULL); + setbuf (fp, NULL); + ret = fseeko64 (fp, 1LL << 32, SEEK_SET); + TEST_COMPARE (ret, 0); + ret = fputc ('x', fp); + TEST_COMPARE (ret, 'x'); + xfclose (fp); + ret = remove (file1); + TEST_COMPARE (ret, 0); + END_TEST; + + /* fopen with freopen: large offsets not OK on 32-bit systems. */ + START_TEST ("testing fopen with freopen\n"); + fp = fopen ("/dev/null", "r"); + TEST_VERIFY_EXIT (fp != NULL); + fp = freopen (file1, "w", fp); + TEST_VERIFY_EXIT (fp != NULL); + setbuf (fp, NULL); + ret = fseeko64 (fp, 1LL << 32, SEEK_SET); + TEST_COMPARE (ret, 0); + errno = 0; + ret = fputc ('x', fp); + if (sizeof (off_t) == 4) + { + TEST_COMPARE (ret, EOF); + TEST_COMPARE (errno, EFBIG); + } + else + TEST_COMPARE (ret, 'x'); + fclose (fp); + ret = remove (file1); + TEST_COMPARE (ret, 0); + END_TEST; + + /* fopen64 with freopen: large offsets not OK on 32-bit systems. */ + START_TEST ("testing fopen64 with freopen\n"); + fp = fopen64 ("/dev/null", "r"); + TEST_VERIFY_EXIT (fp != NULL); + fp = freopen (file1, "w", fp); + TEST_VERIFY_EXIT (fp != NULL); + setbuf (fp, NULL); + ret = fseeko64 (fp, 1LL << 32, SEEK_SET); + TEST_COMPARE (ret, 0); + errno = 0; + ret = fputc ('x', fp); + if (sizeof (off_t) == 4) + { + TEST_COMPARE (ret, EOF); + TEST_COMPARE (errno, EFBIG); + } + else + TEST_COMPARE (ret, 'x'); + fclose (fp); + ret = remove (file1); + TEST_COMPARE (ret, 0); + END_TEST; + + free (temp_dir); + free (file1); + return 0; +} + +#include <support/test-driver.c> diff --git a/stdio-common/tst-freopen6-main.c b/stdio-common/tst-freopen6-main.c new file mode 100644 index 0000000..0161f4e --- /dev/null +++ b/stdio-common/tst-freopen6-main.c @@ -0,0 +1,98 @@ +/* Test freopen of stdin / stdout / stderr. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <mcheck.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + +#include <support/check.h> +#include <support/file_contents.h> +#include <support/support.h> +#include <support/temp_file.h> +#include <support/test-driver.h> +#include <support/xstdio.h> + +int +do_test (void) +{ + mtrace (); + char *temp_dir = support_create_temp_directory ("tst-freopen6"); + char *file1 = xasprintf ("%s/file1", temp_dir); + support_write_file_string (file1, "file1"); + add_temp_file (file1); + FILE *fp; + int ret; + + verbose_printf ("Testing reopening stdin\n"); + fp = FREOPEN (file1, "r", stdin); + TEST_VERIFY_EXIT (fp == stdin); + ret = getchar (); + TEST_COMPARE (ret, 'f'); + ret = getchar (); + TEST_COMPARE (ret, 'i'); + ret = getchar (); + TEST_COMPARE (ret, 'l'); + ret = getchar (); + TEST_COMPARE (ret, 'e'); + ret = getchar (); + TEST_COMPARE (ret, '1'); + ret = getchar (); + TEST_COMPARE (ret, EOF); + xfclose (fp); + + verbose_printf ("Testing reopening stderr\n"); + fp = FREOPEN (file1, "w+", stderr); + TEST_VERIFY_EXIT (fp == stderr); + errno = EINVAL; + perror ("test"); + ret = fseek (fp, 0, SEEK_SET); + TEST_COMPARE (ret, 0); + TEST_COMPARE_FILE_STRING (fp, "test: Invalid argument\n"); + xfclose (fp); + + verbose_printf ("Testing reopening stdout\n"); + /* Defer checks until the old stdout has been restored to make it + more likely any errors are written to the old stdout (rather than + the temporary file used for the redirected stdout). */ + int old_stdout = dup (STDOUT_FILENO); + TEST_VERIFY_EXIT (old_stdout != -1); + int ret_fseek = 0; + int ret_compare = 0; + fp = FREOPEN (file1, "w+", stdout); + int fp_eq_stdout = fp == stdout; + if (fp != NULL) + { + printf ("reopened\n"); + ret_fseek = fseek (fp, 0, SEEK_SET); + ret_compare = support_compare_file_string (fp, "reopened\n"); + } + xfclose (fp); + stdout = fdopen (old_stdout, "w"); + TEST_VERIFY (fp_eq_stdout); + TEST_COMPARE (ret_fseek, 0); + TEST_COMPARE (ret_compare, 0); + xfclose (stdout); + + free (temp_dir); + free (file1); + return 0; +} + +#include <support/test-driver.c> diff --git a/stdio-common/tst-freopen6.c b/stdio-common/tst-freopen6.c new file mode 100644 index 0000000..8fd6957 --- /dev/null +++ b/stdio-common/tst-freopen6.c @@ -0,0 +1,2 @@ +#define FREOPEN freopen +#include <tst-freopen6-main.c> diff --git a/stdio-common/tst-freopen64-2.c b/stdio-common/tst-freopen64-2.c new file mode 100644 index 0000000..88fdc64 --- /dev/null +++ b/stdio-common/tst-freopen64-2.c @@ -0,0 +1,3 @@ +#define FREOPEN freopen64 +#define OTHER_FREOPEN freopen +#include <tst-freopen2-main.c> diff --git a/stdio-common/tst-freopen64-3.c b/stdio-common/tst-freopen64-3.c new file mode 100644 index 0000000..b91b6d2 --- /dev/null +++ b/stdio-common/tst-freopen64-3.c @@ -0,0 +1,2 @@ +#define FREOPEN freopen64 +#include <tst-freopen3-main.c> diff --git a/stdio-common/tst-freopen64-4.c b/stdio-common/tst-freopen64-4.c new file mode 100644 index 0000000..1411be2 --- /dev/null +++ b/stdio-common/tst-freopen64-4.c @@ -0,0 +1,2 @@ +#define FREOPEN freopen64 +#include <tst-freopen4-main.c> diff --git a/stdio-common/tst-freopen64-6.c b/stdio-common/tst-freopen64-6.c new file mode 100644 index 0000000..3ec509a --- /dev/null +++ b/stdio-common/tst-freopen64-6.c @@ -0,0 +1,2 @@ +#define FREOPEN freopen64 +#include <tst-freopen6-main.c> diff --git a/stdio-common/tst-freopen64-7.c b/stdio-common/tst-freopen64-7.c new file mode 100644 index 0000000..f34c280 --- /dev/null +++ b/stdio-common/tst-freopen64-7.c @@ -0,0 +1,2 @@ +#define FREOPEN freopen64 +#include <tst-freopen7-main.c> diff --git a/stdio-common/tst-freopen7-main.c b/stdio-common/tst-freopen7-main.c new file mode 100644 index 0000000..e82e0f6 --- /dev/null +++ b/stdio-common/tst-freopen7-main.c @@ -0,0 +1,155 @@ +/* Test freopen cancellation handling. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <fcntl.h> +#include <mcheck.h> +#include <pthread.h> +#include <semaphore.h> +#include <stdio.h> +#include <stdlib.h> +#include <wchar.h> + +#include <support/check.h> +#include <support/file_contents.h> +#include <support/support.h> +#include <support/temp_file.h> +#include <support/test-driver.h> +#include <support/xstdio.h> +#include <support/xthread.h> +#include <support/xunistd.h> + +char *file1, *file2, *file3, *fifo; + +sem_t sem; + +void * +test_rc_to_r (void *p) +{ + int ret; + FILE *fp, *fp2; + ret = sem_post (&sem); + TEST_VERIFY_EXIT (ret == 0); + fp = xfopen (file1, "rc"); + for (int i = 0; i < 1000000; i++) + { + fgetc (fp); + fseek (fp, 0, SEEK_SET); + } + fp2 = xfopen (file3, "wc"); + fputs ("rc_to_r got to freopen", fp2); + xfclose (fp2); + /* Cancellation should occur at some point from here onwards + (possibly leaking memory and file descriptors associated with the + FILE). */ + fp = FREOPEN (file2, "r", fp); + TEST_VERIFY_EXIT (fp != NULL); + for (;;) + { + fgetc (fp); + fseek (fp, 0, SEEK_SET); + } +} + +void * +test_r_to_rc (void *p) +{ + int ret; + FILE *fp; + fp = xfopen (file1, "r"); + fp = FREOPEN (fifo, "rc", fp); + TEST_VERIFY_EXIT (fp != NULL); + ret = sem_post (&sem); + TEST_VERIFY_EXIT (ret == 0); + /* No cancellation should occur for I/O on fifo. */ + ret = fgetc (fp); + /* At this point, the other thread has called pthread_cancel and + then written a byte to the fifo, so this thread is cancelled at + the next cancellation point. */ + TEST_VERIFY (ret == 'x'); + xfclose (fp); + fp = xfopen (file3, "wc"); + fputs ("r_to_rc got to fclose", fp); + xfclose (fp); + pthread_testcancel (); + FAIL_EXIT1 ("test_r_to_rc not cancelled\n"); +} + +int +do_test (void) +{ + char *temp_dir = support_create_temp_directory ("tst-freopen-cancel"); + file1 = xasprintf ("%s/file1", temp_dir); + support_write_file_string (file1, "file1"); + add_temp_file (file1); + file2 = xasprintf ("%s/file2", temp_dir); + support_write_file_string (file2, "file2"); + add_temp_file (file2); + file3 = xasprintf ("%s/file3", temp_dir); + support_write_file_string (file3, "file3"); + add_temp_file (file3); + fifo = xasprintf ("%s/fifo", temp_dir); + xmkfifo (fifo, 0666); + add_temp_file (fifo); + int ret; + pthread_t thr; + void *retval; + + /* Test changing to/from c (cancellation disabled). */ + + verbose_printf ("Testing rc -> r\n"); + ret = sem_init (&sem, 0, 0); + TEST_VERIFY_EXIT (ret == 0); + thr = xpthread_create (NULL, test_rc_to_r, NULL); + ret = sem_wait (&sem); + TEST_VERIFY_EXIT (ret == 0); + xpthread_cancel (thr); + ret = pthread_join (thr, &retval); + TEST_COMPARE (ret, 0); + TEST_VERIFY (retval == PTHREAD_CANCELED); + TEST_OPEN_AND_COMPARE_FILE_STRING (file3, "rc_to_r got to freopen"); + + verbose_printf ("Testing r -> rc\n"); + ret = sem_init (&sem, 0, 0); + TEST_VERIFY_EXIT (ret == 0); + thr = xpthread_create (NULL, test_r_to_rc, NULL); + FILE *fp = xfopen (fifo, "w"); + ret = sem_wait (&sem); + TEST_VERIFY_EXIT (ret == 0); + /* This call happens while, or before, the other thread is waiting + to read a character from the fifo. It thus verifies that + cancellation does not occur from the fgetc call in that thread + (it should instead occur only in pthread_testcancel call), + because the expected string is only written to file3 after that + thread closes the fifo. */ + xpthread_cancel (thr); + fputc ('x', fp); + xfclose (fp); + ret = pthread_join (thr, &retval); + TEST_COMPARE (ret, 0); + TEST_VERIFY (retval == PTHREAD_CANCELED); + TEST_OPEN_AND_COMPARE_FILE_STRING (file3, "r_to_rc got to fclose"); + + free (temp_dir); + free (file1); + free (file2); + free (file3); + return 0; +} + +#include <support/test-driver.c> diff --git a/stdio-common/tst-freopen7.c b/stdio-common/tst-freopen7.c new file mode 100644 index 0000000..03d0de7 --- /dev/null +++ b/stdio-common/tst-freopen7.c @@ -0,0 +1,2 @@ +#define FREOPEN freopen +#include <tst-freopen7-main.c> diff --git a/stdio-common/tst-fseek-mmap.c b/stdio-common/tst-fseek-mmap.c new file mode 100644 index 0000000..86fa99a --- /dev/null +++ b/stdio-common/tst-fseek-mmap.c @@ -0,0 +1,59 @@ +/* Test fseek on files using mmap (bug 32529). + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <stdio.h> + +#include <support/check.h> +#include <support/temp_file.h> +#include <support/xstdio.h> +#include <support/xunistd.h> + +int +do_test (void) +{ + char *filename = NULL; + int fd = create_temp_file ("tst-fseek-mmap", &filename); + TEST_VERIFY_EXIT (fd != -1); + xclose (fd); + + /* Test fseek after ungetc (bug 32529). */ + FILE *fp = xfopen (filename, "w"); + TEST_VERIFY (0 <= fputs ("test", fp)); + xfclose (fp); + + fp = xfopen (filename, "rm"); + TEST_COMPARE (fgetc (fp), 't'); + TEST_COMPARE (ungetc ('u', fp), 'u'); + TEST_COMPARE (fseek (fp, 0, SEEK_CUR), 0); + xfclose (fp); + + /* Test fseek positioning after fflush (another issue covered by the + same fix). */ + fp = xfopen (filename, "rm"); + TEST_COMPARE (fgetc (fp), 't'); + TEST_COMPARE (fflush (fp), 0); + TEST_COMPARE (ftell (fp), 1); + TEST_COMPARE (fseek (fp, 0, SEEK_CUR), 0); + TEST_COMPARE (ftell (fp), 1); + TEST_COMPARE (fgetc (fp), 'e'); + xfclose (fp); + + return 0; +} + +#include <support/test-driver.c> diff --git a/stdio-common/tst-fseek.c b/stdio-common/tst-fseek.c index a37ca2f..a0d50be 100644 --- a/stdio-common/tst-fseek.c +++ b/stdio-common/tst-fseek.c @@ -1,5 +1,5 @@ /* Tests of fseek and fseeko. - Copyright (C) 2000-2024 Free Software Foundation, Inc. + Copyright (C) 2000-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/tst-fwrite-bz29459.c b/stdio-common/tst-fwrite-bz29459.c new file mode 100644 index 0000000..4fcc4c8 --- /dev/null +++ b/stdio-common/tst-fwrite-bz29459.c @@ -0,0 +1,89 @@ +/* Test fwrite against bug 29459. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +/* This test is based on the code attached to bug 29459. + It depends on stdout being redirected to a specific process via a script + with the same name. Because of this, we cannot use the features from + test_driver.c. */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <errno.h> +#include <unistd.h> +#include <support/check.h> +#include <support/xsignal.h> + +/* Usually this test reproduces in a few iterations. However, keep a high + number of iterations in order to avoid return false-positives due to an + overwhelmed/slow system. */ +#define ITERATIONS 500000 + +/* The goal of this test is to use fwrite () on a redirected and closed + stdout. A script will guarantee that stdout is redirected to another + process that closes it during the execution. The process reading from + the pipe must read at least the first line in order to guarantee that + flag _IO_CURRENTLY_PUTTING is set in the write end of the pipe, triggering + important parts of the code that flushes lines from fwrite's internal + buffer. The underlying write () returns EPIPE, which fwrite () must + propagate. */ + +int +main (void) +{ + int i; + size_t rc; + /* Ensure the string we send has a new line because we're dealing + with a lined-buffered stream. */ + const char *s = "hello world\n"; + const size_t len = strlen(s); + + /* Ensure that fwrite buffers the output before writing to stdout. */ + setlinebuf(stdout); + /* Ignore SIGPIPE in order to catch the EPIPE returned by the + underlying call to write(). */ + xsignal(SIGPIPE, SIG_IGN); + + for (i = 1; i <= ITERATIONS; i++) + { + /* Keep writing to stdout. The test succeeds if fwrite () returns an + error. */ + if ((rc = fwrite(s, 1, len, stdout)) < len) + { + /* An error happened. Check if ferror () does return an error + and that it is indeed EPIPE. */ + TEST_COMPARE (ferror (stdout), 1); + TEST_COMPARE (errno, EPIPE); + fprintf(stderr, "Success: i=%d. fwrite returned %zu < %zu " + "and errno=EPIPE\n", + i, rc, len); + /* The test succeeded! */ + return 0; + } + else + { + /* fwrite () was able to write all the contents. Check if no errors + have been reported and try again. */ + TEST_COMPARE (ferror (stdout), 0); + TEST_COMPARE (errno, 0); + } + } + + fprintf(stderr, "Error: fwrite did not return an error\n"); + return 1; +} diff --git a/stdio-common/tst-fwrite-bz29459.sh b/stdio-common/tst-fwrite-bz29459.sh new file mode 100755 index 0000000..1643135 --- /dev/null +++ b/stdio-common/tst-fwrite-bz29459.sh @@ -0,0 +1,34 @@ +#!/bin/sh +# Test fwrite for bug 29459. +# Copyright (C) 2025 Free Software Foundation, Inc. +# This file is part of the GNU C Library. + +# The GNU C Library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. + +# The GNU C Library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public +# License along with the GNU C Library; if not, see +# <https://www.gnu.org/licenses/>. + +set -e + +common_objpfx=$1; shift +test_program_prefix=$1; shift + +status=0 + +${test_program_prefix} \ + ${common_objpfx}stdio-common/tst-fwrite-bz29459 \ + 2> ${common_objpfx}stdio-common/tst-fwrite-bz29459.out \ + | head -n1 > /dev/null + +grep -q Success ${common_objpfx}stdio-common/tst-fwrite-bz29459.out || status=1 + +exit $status diff --git a/stdio-common/tst-fwrite-memstrm.c b/stdio-common/tst-fwrite-memstrm.c new file mode 100644 index 0000000..08c83f3 --- /dev/null +++ b/stdio-common/tst-fwrite-memstrm.c @@ -0,0 +1,177 @@ +/* Test fwrite on a memory stream. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <support/check.h> +#include <support/temp_file.h> +#include <support/xstdio.h> +#include <support/xunistd.h> + +void +test_ro (void) +{ + FILE *f; + char *out; + + /* Try to allocate a small buffer for this test. */ + out = malloc (2); + TEST_VERIFY_EXIT (out != NULL); + + /* Try to open the allocated buffer as a read-only stream. */ + f = fmemopen (out, 2, "r"); + TEST_VERIFY_EXIT (f != NULL); + + /* Try to write to the temporary file with nmemb = 0, then check that + fwrite returns 0. No errors are expected from this. */ + TEST_COMPARE (fwrite ("a", 1, 0, f), 0); + TEST_COMPARE (ferror (f), 0); + + /* Try to write to the temporary file with size = 0, then check that + fwrite returns 0. No errors are expected from this. */ + TEST_COMPARE (fwrite ("a", 0, 1, f), 0); + TEST_COMPARE (ferror (f), 0); + + /* Try to write a single byte to the temporary file, then check that + fwrite returns 0. Check if an error was reported. */ + TEST_COMPARE (fwrite ("a", 1, 1, f), 0); + TEST_COMPARE (ferror (f), 1); + + clearerr (f); + xfclose (f); + free (out); +} + +/* Length of the output buffer in bytes. */ +#define RWBUF_SIZE 16 * 1024 +/* Maximum number of bytes to be written in output buffer. The rest will be + used to check against overflow. */ +#define RWBUF_SIZE_WRITABLE RWBUF_SIZE-2048 + +/* Use the following byte to identify areas that should have not been + modified. */ +#define KNOWN_BYTE 0xaa + +void +test_one_rw (const char *in, size_t size, size_t nmemb, + size_t expected_ret) +{ + FILE *f; + char *out, *expected_out; + /* Total number of bytes expected to be written. */ + size_t expected_bytes = size * nmemb; + + printf ("Testing with size = %zd, nmemb = %zd\n", size, nmemb); + + TEST_VERIFY_EXIT (expected_ret <= RWBUF_SIZE_WRITABLE); + TEST_VERIFY_EXIT (expected_bytes <= RWBUF_SIZE_WRITABLE); + + /* Try to allocate a buffer for this test and initialize it with + known contents. */ + out = malloc (RWBUF_SIZE); + TEST_VERIFY_EXIT (out != NULL); + memset (out, KNOWN_BYTE, RWBUF_SIZE); + + /* Try to allocate a buffer and fill it with the contents that are expected + to be in memory after flushing/closing the memory stream. */ + expected_out = malloc (RWBUF_SIZE); + TEST_VERIFY_EXIT (expected_out != NULL); + if (expected_bytes > 0) + { + memcpy (expected_out, in, expected_bytes); + expected_out[expected_bytes] = 0; + memset (expected_out + expected_bytes + 1, KNOWN_BYTE, + RWBUF_SIZE - expected_bytes - 1); + } + else + { + /* No changes to the output are expected. */ + memset (expected_out, KNOWN_BYTE, RWBUF_SIZE); + } + + /* Try to open the allocated buffer as a read-write stream. */ + f = fmemopen (out, RWBUF_SIZE, "w"); + TEST_VERIFY_EXIT (f != NULL); + + /* Try to write to the memory stream. Check if fwrite() returns the + expected value. No errors are expected. */ + TEST_COMPARE (fwrite (in, size, nmemb, f), expected_ret); + TEST_COMPARE (ferror (f), 0); + + xfclose (f); + + /* Ensure the output has the expected contents. */ + TEST_COMPARE (memcmp (out, expected_out, expected_bytes), 0); + + free (expected_out); + free (out); +} + +void +test_rw (void) +{ + char * in; + int i, j; + size_t size[] = {1, 8, 11, 16, 17, 0}; + size_t nmemb[] = {32, 83, 278, 709, 4097, RWBUF_SIZE / 2, + RWBUF_SIZE_WRITABLE, 0}; + size_t n; + + /* Try to write to the temporary file with nmemb = 0, then check that + fwrite returns 0; */ + test_one_rw ("a", 1, 0, 0); + + /* Try to write to the temporary file with size = 0, then check that + fwrite returns 0; */ + test_one_rw ("a", 0, 1, 0); + + /* Try to write a single byte to the temporary file, then check that + fwrite returns 1; */ + test_one_rw ("a", 1, 2, 2); + + in = malloc (RWBUF_SIZE); + TEST_VERIFY_EXIT (in != NULL); + for (i = 0; i < RWBUF_SIZE / 2; i++) + in[i] = i % 0xff; + + /* Test with all posibilities of size[] x nmemb[]. */ + for (i = 0; nmemb[i] != 0; i++) + { + for (j = 0; size[j] != 0; j++) + { + n = nmemb[i] / size[j]; + test_one_rw (in, size[j], n, n); + } + /* Run the test with a single item of maximum size. */ + test_one_rw (in, nmemb[i], 1, 1); + } + + free (in); +} + +static int +do_test (void) +{ + test_ro (); + test_rw (); + + return 0; +} + +#include <support/test-driver.c> diff --git a/stdio-common/tst-fwrite-overflow.c b/stdio-common/tst-fwrite-overflow.c new file mode 100644 index 0000000..0655dea --- /dev/null +++ b/stdio-common/tst-fwrite-overflow.c @@ -0,0 +1,130 @@ +/* Test the overflow of fwrite's internal buffer. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +/* stdio.h provides BUFSIZ, which is the size of fwrite's internal buffer. */ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <support/check.h> +#include <support/temp_file.h> +#include <support/support.h> +#include <support/xstdio.h> +#include <support/xunistd.h> + +/* Length of the buffers in bytes. */ +#define RWBUF_SIZE (2 * BUFSIZ) + +void +test_one_rw (const char *in, size_t size, size_t nmemb, size_t blocks) +{ + int fd; + FILE *f; + char *out; + size_t written, to_write; + const size_t requested = size * nmemb; + + printf ("Testing with size = %zd, nmemb = %zd, blocks = %zd\n", + size, nmemb, blocks); + + TEST_VERIFY_EXIT (requested <= RWBUF_SIZE); + /* Ensure fwrite's internal buffer will overflow. */ + TEST_VERIFY_EXIT (requested > BUFSIZ); + + /* Create a temporary file and open it for reading and writing. */ + fd = create_temp_file ("tst-fwrite-overflow", NULL); + TEST_VERIFY_EXIT (fd != -1); + f = fdopen (fd, "w+"); + TEST_VERIFY_EXIT (f != NULL); + + /* Call fwrite() as many times as needed, until all data is written, + limiting the amount of data written per call to block items. */ + for (written = 0; written < nmemb; written += to_write) + { + if (written + blocks <= nmemb) + to_write = blocks; + else + to_write = nmemb - written; + /* Check if fwrite() returns the expected value. No errors are + expected. */ + TEST_COMPARE (fwrite (in + size * written, size, to_write, f), + to_write); + TEST_COMPARE (ferror (f), 0); + } + TEST_VERIFY_EXIT (written == nmemb); + + /* Ensure all the data is flushed to file. */ + TEST_COMPARE (fflush (f), 0); + + /* We have to check if the contents in the file are correct. Go back to + the beginning of the file. */ + rewind (f); + /* Try to allocate a buffer and save the contents of the generated file to + it. */ + out = xmalloc (RWBUF_SIZE); + TEST_COMPARE (fread (out, size, nmemb, f), nmemb); + + /* Ensure the output has the expected contents. */ + TEST_COMPARE (memcmp (out, in, requested), 0); + + xfclose (f); + free (out); +} + +static int +do_test (void) +{ + char * in; + int i, j; + size_t nmemb[] = {BUFSIZ + 1, RWBUF_SIZE, 0}; + /* Maximum number of items written for each fwrite call. */ + size_t block[] = {100, 1024, 2047, 0}; + /* The largest block must fit entirely in fwrite's buffer. */ + _Static_assert (2047 < BUFSIZ, + "a block must fit in fwrite's internal buffer"); + + in = xmalloc (RWBUF_SIZE); + for (i = 0; i < RWBUF_SIZE; i++) + in[i] = i % 0xff; + + for (i = 0; nmemb[i] != 0; i++) + for (j = 0; block[j] != 0; j++) + { + /* Run a test with an array of nmemb bytes. Write at most block + items per fwrite call. */ + test_one_rw (in, 1, nmemb[i], block[j]); + /* Run a test that overflows fwrite's internal buffer in a single call + by writting a single item of nmemb bytes. + This call should not use the buffer and should be written directly + to the file. */ + test_one_rw (in, nmemb[i], 1, nmemb[i]); + } + + for (j = 0; block[j] != 0; j++) + { + /* Run a test with size=2 and the minimum nmemb value that still + overflows the buffer. Write at most block items per fwrite call. */ + test_one_rw (in, 2, BUFSIZ / 2 + 1, block[j]); + /* Likewise, but size=3. */ + test_one_rw (in, 3, BUFSIZ / 3 + 1, block[j]); + } + + free (in); + return 0; +} + +#include <support/test-driver.c> diff --git a/stdio-common/tst-fwrite-pipe.c b/stdio-common/tst-fwrite-pipe.c new file mode 100644 index 0000000..ce1a92b --- /dev/null +++ b/stdio-common/tst-fwrite-pipe.c @@ -0,0 +1,130 @@ +/* Test if fwrite returns EPIPE. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <stdlib.h> +#include <string.h> +#include <errno.h> +#include <support/check.h> +#include <support/xstdio.h> +#include <support/xsignal.h> +#include <support/xunistd.h> + +/* Usually this test reproduces in a few iterations. However, keep a high + number of iterations in order to avoid return false-positives due to an + overwhelmed/slow system. */ +#define ITERATIONS 500000 + +#define BUFFERSIZE 20 + +/* When the underlying write () fails with EPIPE, fwrite () is expected to + return an error by returning < nmemb and keeping errno=EPIPE. */ + +static int +do_test (void) +{ + int fd[2]; + pid_t p; + FILE *f; + size_t written; + int ret = 1; /* Return failure by default. */ + + /* Try to create a pipe. */ + xpipe (fd); + + p = xfork (); + if (p == 0) + { + char b[BUFFERSIZE]; + size_t bytes; + + /* Read at least the first line from the pipe before closing it. + This is important because it guarantees the file stream will have + flag _IO_CURRENTLY_PUTTING set, which triggers important parts of + the code that flushes lines from fwrite's internal buffer. */ + do { + bytes = read (fd[0], b, BUFFERSIZE); + } while(bytes > 0 && memrchr (b, '\n', bytes) == NULL); + + /* Child closes both ends of the pipe in order to trigger an EPIPE + error on the parent. */ + xclose (fd[0]); + xclose (fd[1]); + + return 0; + } + else + { + /* Ensure the string we send has a new line because we're dealing + with a lined-buffered stream. */ + const char *s = "hello world\n"; + size_t len = strlen (s); + int i; + + /* Parent only writes to pipe. + Close the unused read end of the pipe. */ + xclose (fd[0]); + + /* Ignore SIGPIPE in order to catch the EPIPE returned by the + underlying call to write(). */ + xsignal(SIGPIPE, SIG_IGN); + + /* Create a file stream associated with the write end of the pipe. */ + f = fdopen (fd[1], "w"); + TEST_VERIFY_EXIT (f != NULL); + /* Ensure that fwrite buffers the output before writing to the pipe. */ + setlinebuf (f); + + /* Ensure errno is not set before starting. */ + errno = 0; + for (i = 1; i <= ITERATIONS; i++) + { + /* Try to write to the pipe. The first calls are expected to + suceeded until the child process closes the read end. + After that, fwrite () is expected to fail and errno should be + set to EPIPE. */ + written = fwrite (s, 1, len, f); + + if (written == len) + { + TEST_VERIFY_EXIT (ferror (f) == 0); + TEST_VERIFY_EXIT (errno == 0); + } + else + { + /* An error happened. Check if ferror () does return an error + and that it is indeed EPIPE. */ + TEST_COMPARE (ferror (f), 1); + TEST_COMPARE (errno, EPIPE); + /* The test succeeded! Clear the error from the file stream and + return success. */ + clearerr (f); + ret = 0; + break; + } + } + + xfclose (f); + } + + if (ret) + FAIL_RET ("fwrite should have returned an error, but it didn't.\n"); + + return ret; +} + +#include <support/test-driver.c> diff --git a/stdio-common/tst-fwrite-pos.c b/stdio-common/tst-fwrite-pos.c new file mode 100644 index 0000000..3923490 --- /dev/null +++ b/stdio-common/tst-fwrite-pos.c @@ -0,0 +1,233 @@ +/* Test if fwrite returns consistent values on partial writes. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <errno.h> +/* stdio.h provides BUFSIZ, which is the size of fwrite's internal buffer. */ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <support/check.h> +#include <support/fuse.h> +#include <support/support.h> +#include <support/xstdio.h> +#include <support/temp_file.h> + +/* Length of the buffer in bytes. */ +#define INBUF_SIZE (BUFSIZ) + +/* Amount of bytes written to fwrite's internal cache that trigger a + flush. */ +#define CACHE_THRESHOLD (BUFSIZ / 2) + +#define ITERATIONS 1000 + +/* Maximum number of bytes written during a partial write. */ +#define PARTIAL_BYTES 4 + +#define EXPECT_EVENT(opcode, state, expected_state) \ + { \ + if (state != expected_state) \ + { \ + char *s = support_fuse_opcode (opcode); \ + FAIL ("unexpected event %s at state %d", s, state); \ + free (s); \ + } \ + } + +/* The goal of this test is to check that file position of a file stream is + correctly updated when write () returns a partial write. + The file system simulates pseudorandom partial writes while the test is + running. + Meanwhile the main thread calls fwrite () with a large object first and + small objects later. The usage of a large enough object ensures that + fwrite's internal cache is full enough, without triggering a write to file. + Subsequent calls to fwrite are guaranteed to trigger a write to file. */ + +static void +fuse_thread (struct support_fuse *f, void *closure) +{ + struct fuse_in_header *inh; + int state = 0; + while ((inh = support_fuse_next (f)) != NULL) + { + { + char *opcode = support_fuse_opcode (inh->opcode); + printf ("info: (T) event %s(%llu) len=%u nodeid=%llu\n", + opcode, (unsigned long long int) inh->unique, inh->len, + (unsigned long long int) inh->nodeid); + free (opcode); + } + + /* Handle mountpoint and basic directory operation for the root (1). */ + if (support_fuse_handle_mountpoint (f) + || (inh->nodeid == 1 && support_fuse_handle_directory (f))) + continue; + + switch (inh->opcode) + { + case FUSE_LOOKUP: + EXPECT_EVENT (inh->nodeid, state, 0); + state++; + support_fuse_reply_error (f, ENOENT); + break; + case FUSE_CREATE: + EXPECT_EVENT (inh->nodeid, state, 1); + state++; + struct fuse_entry_out *entry; + struct fuse_open_out *open; + support_fuse_prepare_create (f, 2, &entry, &open); + entry->attr.mode = S_IFREG | 0600; + support_fuse_reply_prepared (f); + break; + case FUSE_GETXATTR: + /* We don't need to support extended attributes in this test. */ + support_fuse_reply_error (f, ENOSYS); + break; + case FUSE_GETATTR: + /* Happens after open. */ + if (inh->nodeid == 2) + { + struct fuse_attr_out *out = support_fuse_prepare_attr (f); + out->attr.mode = S_IFREG | 0600; + out->attr.size = 0; + support_fuse_reply_prepared (f); + } + else + support_fuse_reply_error (f, ENOENT); + break; + case FUSE_WRITE: + if (inh->nodeid == 2) + { + struct fuse_write_out out; + if (state > 1 && state < ITERATIONS + 2) + { + /* The 2nd and subsequent calls to fwrite () trigger a + flush of fwrite's internal cache. Simulate a partial + write of up to PARTIAL_BYTES bytes. */ + out.padding = 0; + out.size = 1 + rand () % PARTIAL_BYTES, + state++; + support_fuse_reply (f, &out, sizeof (out)); + } + else if (state >= ITERATIONS + 2) + { + /* This request is expected to come from fflush (). Copy + all the data successfully. This may be executed more + than once. */ + struct fuse_write_in *p = support_fuse_cast (WRITE, inh); + out.padding = 0; + out.size = p->size, + state++; + support_fuse_reply (f, &out, sizeof (out)); + } + else + support_fuse_reply_error (f, EIO); + } + else + support_fuse_reply_error (f, EIO); + break; + case FUSE_FLUSH: + case FUSE_RELEASE: + TEST_COMPARE (inh->nodeid, 2); + support_fuse_reply_empty (f); + break; + default: + FAIL ("unexpected event %s", support_fuse_opcode (inh->opcode)); + support_fuse_reply_error (f, EIO); + } + } +} + +static int +do_test (void) +{ + char *in; + int i; + size_t written; + + _Static_assert (CACHE_THRESHOLD <= INBUF_SIZE, + "the input buffer must be larger than the cache threshold"); + /* Avoid filling up fwrite's cache. */ + _Static_assert (CACHE_THRESHOLD - 1 + PARTIAL_BYTES * ITERATIONS <= BUFSIZ, + "fwrite's cache must fit all data written"); + + support_fuse_init (); + struct support_fuse *fs = support_fuse_mount (fuse_thread, NULL); + + /* Create and open a temporary file in the fuse mount point. */ + char *fname = xasprintf ("%s/%sXXXXXX", support_fuse_mountpoint (fs), + "tst-fwrite-fuse"); + int fd = mkstemp (fname); + TEST_VERIFY_EXIT (fd != -1); + FILE *f = fdopen (fd, "w"); + TEST_VERIFY_EXIT (f != NULL); + + /* Allocate an input array that will be written to the temporary file. */ + in = xmalloc (INBUF_SIZE); + for (i = 0; i < INBUF_SIZE; i++) + in[i] = i % 0xff; + + /* Ensure the file position indicator is at the beginning of the stream. */ + TEST_COMPARE (ftell (f), 0); + + /* Try to fill as most data to the cache of the file stream as possible + with a single large object. + All data is expected to be written to the cache. + No errors are expected from this. */ + TEST_COMPARE (fwrite (in, CACHE_THRESHOLD - 1, 1, f), 1); + TEST_COMPARE (ferror (f), 0); + written = CACHE_THRESHOLD - 1; + + /* Ensure the file position indicator advanced correctly. */ + TEST_COMPARE (ftell (f), written); + + for (i = 0; i < ITERATIONS; i++) + { + /* Write an extra object of size PARTIAL_BYTES that triggers a write to + disk. Our FS will write at most PARTIAL_BYTES bytes to the file + instead of all the data. By writting PARTIAL_BYTES, we guarantee + the amount of data in the cache will never decrease below + CACHE_THRESHOLD. + No errors are expected. */ + TEST_COMPARE (fwrite (in, PARTIAL_BYTES, 1, f), 1); + TEST_COMPARE (ferror (f), 0); + written += PARTIAL_BYTES; + + /* Ensure the file position indicator advanced correctly. */ + TEST_COMPARE (ftell (f), written); + } + + /* Flush the rest of the data. */ + TEST_COMPARE (fflush (f), 0); + TEST_COMPARE (ferror (f), 0); + + /* Ensure the file position indicator was not modified. */ + TEST_COMPARE (ftell (f), written); + + /* In case an unexpected error happened, clear it before exiting. */ + if (ferror (f)) + clearerr (f); + + xfclose (f); + free (fname); + free (in); + support_fuse_unmount (fs); + return 0; +} + +#include <support/test-driver.c> diff --git a/stdio-common/tst-fwrite-ro.c b/stdio-common/tst-fwrite-ro.c new file mode 100644 index 0000000..96a0e34 --- /dev/null +++ b/stdio-common/tst-fwrite-ro.c @@ -0,0 +1,65 @@ +/* Test fwrite on a read-only stream. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <stdio.h> +#include <support/check.h> +#include <support/temp_file.h> +#include <support/xstdio.h> +#include <support/xunistd.h> + +/* A small buffer size is enough to run this test. */ +#define BUFSIZE 4 + +static int +do_test (void) +{ + int fd; + FILE *f; + struct stat64 st; + + /* Create a temporary file and open it in read-only mode. */ + fd = create_temp_file ("tst-fwrite-ro", NULL); + TEST_VERIFY_EXIT (fd != -1); + f = fdopen (fd, "r"); + TEST_VERIFY_EXIT (f != NULL); + + /* Try to write to the temporary file with nmemb = 0, then check that + fwrite returns 0. No errors are expected from this. */ + TEST_COMPARE (fwrite ("a", 1, 0, f), 0); + TEST_COMPARE (ferror (f), 0); + + /* Try to write to the temporary file with size = 0, then check that + fwrite returns 0. No errors are expected from this. */ + TEST_COMPARE (fwrite ("a", 0, 1, f), 0); + TEST_COMPARE (ferror (f), 0); + + /* Try to write a single byte to the temporary file, then check that + fwrite returns 0. Check if an error was reported. */ + TEST_COMPARE (fwrite ("a", 1, 1, f), 0); + TEST_COMPARE (ferror (f), 1); + clearerr (f); + + xfstat64 (fd, &st); + TEST_COMPARE (st.st_size, 0); + + xfclose (f); + + return 0; +} + +#include <support/test-driver.c> diff --git a/stdio-common/tst-getline-enomem.c b/stdio-common/tst-getline-enomem.c new file mode 100644 index 0000000..f997deb --- /dev/null +++ b/stdio-common/tst-getline-enomem.c @@ -0,0 +1,78 @@ +/* Test getline: ENOMEM on allocation failure. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <mcheck.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/resource.h> + +#include <support/check.h> +#include <support/test-driver.h> + +/* Produce a stream of test data based on data in COOKIE (ignored), + storing up to SIZE bytes in BUF. */ + +static ssize_t +io_read (void *cookie, char *buf, size_t size) +{ + memset (buf, 'x', size); + return size; +} + +/* Set up a test stream with fopencookie. */ + +static FILE * +open_test_stream (void) +{ + static cookie_io_functions_t io_funcs = { .read = io_read }; + static int cookie; + FILE *fp = fopencookie (&cookie, "r", io_funcs); + TEST_VERIFY_EXIT (fp != NULL); + return fp; +} + +int +do_test (void) +{ + FILE *fp; + char *lineptr = NULL; + size_t size = 0; + ssize_t ret; + mtrace (); + /* Test ENOMEM (and error indicator for stream set) for memory + allocation failure. */ + verbose_printf ("Testing memory allocation failure\n"); + fp = open_test_stream (); + struct rlimit limit; + TEST_VERIFY_EXIT (getrlimit (RLIMIT_AS, &limit) == 0); + limit.rlim_cur = 32 * 1024 * 1024; + TEST_VERIFY_EXIT (setrlimit (RLIMIT_AS, &limit) == 0); + errno = 0; + ret = getline (&lineptr, &size, fp); + TEST_COMPARE (ret, -1); + TEST_COMPARE (errno, ENOMEM); + TEST_COMPARE (!!ferror (fp), 1); + TEST_COMPARE (feof (fp), 0); + free (lineptr); + fclose (fp); + return 0; +} + +#include <support/test-driver.c> diff --git a/stdio-common/tst-getline.c b/stdio-common/tst-getline.c new file mode 100644 index 0000000..3fe70e4 --- /dev/null +++ b/stdio-common/tst-getline.c @@ -0,0 +1,451 @@ +/* Test getline. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <fcntl.h> +#include <malloc.h> +#include <mcheck.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include <support/check.h> +#include <support/test-driver.h> +#include <support/support.h> +#include <support/xstdio.h> +#include <support/xunistd.h> + +static struct test_data +{ + /* Input test data for fopencookie stream. */ + const char *in_data; + + /* The amount of test data left. */ + size_t in_data_left; + + /* Error number for forcing an error on next read. */ + int in_error; + + /* Error number for forcing an error (rather than EOF) after all + bytes read. */ + int in_error_after; +} the_cookie; + +/* Produce a stream of test data based on data in COOKIE, storing up + to SIZE bytes in BUF. */ + +static ssize_t +io_read (void *cookie, char *buf, size_t size) +{ + struct test_data *p = cookie; + if (p->in_error) + { + errno = p->in_error; + return -1; + } + if (size > p->in_data_left) + size = p->in_data_left; + memcpy (buf, p->in_data, size); + p->in_data += size; + p->in_data_left -= size; + if (p->in_data_left == 0) + p->in_error = p->in_error_after; + return size; +} + +/* Set up a test stream with fopencookie. */ + +static FILE * +open_test_stream (const char *in_data, size_t size) +{ + static cookie_io_functions_t io_funcs = { .read = io_read }; + the_cookie.in_data = in_data; + the_cookie.in_data_left = size; + the_cookie.in_error = 0; + the_cookie.in_error_after = 0; + FILE *fp = fopencookie (&the_cookie, "r", io_funcs); + TEST_VERIFY_EXIT (fp != NULL); + return fp; +} + +/* Set up a test stream with fopencookie, using data from a string + literal. */ +#define OPEN_TEST_STREAM(IN_DATA) open_test_stream (IN_DATA, sizeof (IN_DATA)) + +/* Wrap getline to verify that (as per the glibc manual), *LINEPTR is + returned as non-null and with at least *N bytes (even on error or + EOF). Also clear errno for the benefit of tests that check the + value of errno after the call. */ + +ssize_t +wrap_getline (char **lineptr, size_t *n, FILE *stream) +{ + errno = 0; + ssize_t ret = getline (lineptr, n, stream); + if (lineptr != NULL && n != NULL) + { + TEST_VERIFY (*lineptr != NULL); + TEST_VERIFY (malloc_usable_size (*lineptr) >= *n); + } + return ret; +} + +int +do_test (void) +{ + FILE *fp; + char *lineptr = NULL; + size_t size = 0; + ssize_t ret; + mtrace (); + /* Test failure with EINVAL (and error indicator for stream set) if + lineptr is a null pointer. */ + verbose_printf ("Testing lineptr == NULL\n"); + fp = OPEN_TEST_STREAM ("test"); + ret = wrap_getline (NULL, &size, fp); + TEST_COMPARE (ret, -1); + TEST_COMPARE (errno, EINVAL); + TEST_COMPARE (!!ferror (fp), 1); + TEST_COMPARE (feof (fp), 0); + fclose (fp); + /* Test failure with EINVAL (and error indicator for stream set) if + n is a null pointer. */ + verbose_printf ("Testing n == NULL\n"); + fp = OPEN_TEST_STREAM ("test"); + ret = wrap_getline (&lineptr, NULL, fp); + TEST_COMPARE (ret, -1); + TEST_COMPARE (errno, EINVAL); + TEST_COMPARE (!!ferror (fp), 1); + TEST_COMPARE (feof (fp), 0); + fclose (fp); + /* Test failure with EINVAL (and error indicator for stream set) if + both lineptr and n are null pointers. */ + verbose_printf ("Testing lineptr == NULL and n == NULL\n"); + fp = OPEN_TEST_STREAM ("test"); + ret = wrap_getline (NULL, NULL, fp); + TEST_COMPARE (ret, -1); + TEST_COMPARE (errno, EINVAL); + TEST_COMPARE (!!ferror (fp), 1); + TEST_COMPARE (feof (fp), 0); + fclose (fp); + /* Test normal line, fitting in available space (including case with + null bytes). */ + verbose_printf ("Testing normal nonempty input\n"); + lineptr = xmalloc (10); + size = 10; + fp = OPEN_TEST_STREAM ("foo\nbar\0\n\0baz\nte\0st\n"); + ret = wrap_getline (&lineptr, &size, fp); + TEST_COMPARE (ret, 4); + TEST_COMPARE_BLOB (lineptr, 5, "foo\n", 5); + ret = wrap_getline (&lineptr, &size, fp); + TEST_COMPARE (ret, 5); + TEST_COMPARE_BLOB (lineptr, 6, "bar\0\n", 6); + ret = wrap_getline (&lineptr, &size, fp); + TEST_COMPARE (ret, 5); + TEST_COMPARE_BLOB (lineptr, 6, "\0baz\n", 6); + ret = wrap_getline (&lineptr, &size, fp); + TEST_COMPARE (ret, 6); + TEST_COMPARE_BLOB (lineptr, 7, "te\0st\n", 7); + ret = wrap_getline (&lineptr, &size, fp); + TEST_COMPARE (ret, 1); + TEST_COMPARE_BLOB (lineptr, 1, "", 1); + ret = wrap_getline (&lineptr, &size, fp); + TEST_COMPARE (ret, -1); + TEST_COMPARE (ferror (fp), 0); + TEST_COMPARE (!!feof (fp), 1); + fclose (fp); + /* Test normal line, with reallocation (including case with null bytes). */ + verbose_printf ("Testing normal nonempty input with reallocation\n"); + free (lineptr); + lineptr = NULL; + size = 0; + fp = OPEN_TEST_STREAM ("foo\nbar\0\n\0baz\nte\0st\n" + "foo\nbar\0\n\0baz\nte\0st\n"); + ret = wrap_getline (&lineptr, &size, fp); + TEST_COMPARE (ret, 4); + TEST_COMPARE_BLOB (lineptr, 5, "foo\n", 5); + free (lineptr); + lineptr = NULL; + size = 0; + ret = wrap_getline (&lineptr, &size, fp); + TEST_COMPARE (ret, 5); + TEST_COMPARE_BLOB (lineptr, 6, "bar\0\n", 6); + free (lineptr); + lineptr = NULL; + size = 0; + ret = wrap_getline (&lineptr, &size, fp); + TEST_COMPARE (ret, 5); + TEST_COMPARE_BLOB (lineptr, 6, "\0baz\n", 6); + free (lineptr); + lineptr = NULL; + size = 0; + ret = wrap_getline (&lineptr, &size, fp); + TEST_COMPARE (ret, 6); + TEST_COMPARE_BLOB (lineptr, 7, "te\0st\n", 7); + free (lineptr); + lineptr = xmalloc (1); + size = 1; + ret = wrap_getline (&lineptr, &size, fp); + TEST_COMPARE (ret, 4); + TEST_COMPARE_BLOB (lineptr, 5, "foo\n", 5); + free (lineptr); + lineptr = xmalloc (1); + size = 1; + ret = wrap_getline (&lineptr, &size, fp); + TEST_COMPARE (ret, 5); + TEST_COMPARE_BLOB (lineptr, 6, "bar\0\n", 6); + free (lineptr); + lineptr = xmalloc (1); + size = 1; + ret = wrap_getline (&lineptr, &size, fp); + TEST_COMPARE (ret, 5); + TEST_COMPARE_BLOB (lineptr, 6, "\0baz\n", 6); + free (lineptr); + lineptr = xmalloc (1); + size = 1; + ret = wrap_getline (&lineptr, &size, fp); + TEST_COMPARE (ret, 6); + TEST_COMPARE_BLOB (lineptr, 7, "te\0st\n", 7); + ret = wrap_getline (&lineptr, &size, fp); + TEST_COMPARE (ret, 1); + TEST_COMPARE_BLOB (lineptr, 1, "", 1); + ret = wrap_getline (&lineptr, &size, fp); + TEST_COMPARE (ret, -1); + TEST_COMPARE (ferror (fp), 0); + TEST_COMPARE (!!feof (fp), 1); + fclose (fp); + /* Test EOF before delimiter but after some bytes read, fitting in + available space (including case with null bytes). */ + verbose_printf ("Testing EOF before delimiter\n"); + free (lineptr); + lineptr = xmalloc (10); + size = 10; + fp = open_test_stream ("foo", 3); + ret = wrap_getline (&lineptr, &size, fp); + TEST_COMPARE (ret, 3); + TEST_COMPARE_BLOB (lineptr, 4, "foo", 4); + fclose (fp); + free (lineptr); + lineptr = xmalloc (10); + size = 10; + fp = open_test_stream ("bar\0", 4); + ret = wrap_getline (&lineptr, &size, fp); + TEST_COMPARE (ret, 4); + TEST_COMPARE_BLOB (lineptr, 5, "bar\0", 5); + fclose (fp); + free (lineptr); + lineptr = xmalloc (10); + size = 10; + fp = open_test_stream ("\0baz", 4); + ret = wrap_getline (&lineptr, &size, fp); + TEST_COMPARE (ret, 4); + TEST_COMPARE_BLOB (lineptr, 5, "\0baz", 5); + fclose (fp); + free (lineptr); + lineptr = xmalloc (10); + size = 10; + fp = open_test_stream ("te\0st", 5); + ret = wrap_getline (&lineptr, &size, fp); + TEST_COMPARE (ret, 5); + TEST_COMPARE_BLOB (lineptr, 6, "te\0st", 6); + fclose (fp); + /* Test EOF before delimiter but after some bytes read, with + reallocation (including case with null bytes). */ + verbose_printf ("Testing EOF before delimiter with reallocation\n"); + free (lineptr); + lineptr = NULL; + size = 0; + fp = open_test_stream ("foo", 3); + ret = wrap_getline (&lineptr, &size, fp); + TEST_COMPARE (ret, 3); + TEST_COMPARE_BLOB (lineptr, 4, "foo", 4); + fclose (fp); + free (lineptr); + lineptr = NULL; + size = 0; + fp = open_test_stream ("bar\0", 4); + ret = wrap_getline (&lineptr, &size, fp); + TEST_COMPARE (ret, 4); + TEST_COMPARE_BLOB (lineptr, 5, "bar\0", 5); + fclose (fp); + free (lineptr); + lineptr = NULL; + size = 0; + fp = open_test_stream ("\0baz", 4); + ret = wrap_getline (&lineptr, &size, fp); + TEST_COMPARE (ret, 4); + TEST_COMPARE_BLOB (lineptr, 5, "\0baz", 5); + fclose (fp); + free (lineptr); + lineptr = NULL; + size = 0; + fp = open_test_stream ("te\0st", 5); + ret = wrap_getline (&lineptr, &size, fp); + TEST_COMPARE (ret, 5); + TEST_COMPARE_BLOB (lineptr, 6, "te\0st", 6); + fclose (fp); + free (lineptr); + lineptr = xmalloc (1); + size = 1; + fp = open_test_stream ("foo", 3); + ret = wrap_getline (&lineptr, &size, fp); + TEST_COMPARE (ret, 3); + TEST_COMPARE_BLOB (lineptr, 4, "foo", 4); + fclose (fp); + free (lineptr); + lineptr = xmalloc (1); + size = 1; + fp = open_test_stream ("bar\0", 4); + ret = wrap_getline (&lineptr, &size, fp); + TEST_COMPARE (ret, 4); + TEST_COMPARE_BLOB (lineptr, 5, "bar\0", 5); + fclose (fp); + free (lineptr); + lineptr = xmalloc (1); + size = 1; + fp = open_test_stream ("\0baz", 4); + ret = wrap_getline (&lineptr, &size, fp); + TEST_COMPARE (ret, 4); + TEST_COMPARE_BLOB (lineptr, 5, "\0baz", 5); + fclose (fp); + free (lineptr); + lineptr = xmalloc (1); + size = 1; + fp = open_test_stream ("te\0st", 5); + ret = wrap_getline (&lineptr, &size, fp); + TEST_COMPARE (ret, 5); + TEST_COMPARE_BLOB (lineptr, 6, "te\0st", 6); + fclose (fp); + /* Test EOF with no bytes read (nothing is specified about anything + written to the buffer), including EOF again when already at end + of file. */ + verbose_printf ("Testing EOF with no bytes read\n"); + free (lineptr); + lineptr = NULL; + size = 0; + fp = open_test_stream ("", 0); + ret = wrap_getline (&lineptr, &size, fp); + TEST_COMPARE (ret, -1); + TEST_COMPARE (ferror (fp), 0); + TEST_COMPARE (!!feof (fp), 1); + ret = wrap_getline (&lineptr, &size, fp); + TEST_COMPARE (ret, -1); + TEST_COMPARE (ferror (fp), 0); + TEST_COMPARE (!!feof (fp), 1); + fclose (fp); + free (lineptr); + lineptr = xmalloc (1); + size = 1; + fp = open_test_stream ("", 0); + ret = wrap_getline (&lineptr, &size, fp); + TEST_COMPARE (ret, -1); + TEST_COMPARE (ferror (fp), 0); + TEST_COMPARE (!!feof (fp), 1); + ret = wrap_getline (&lineptr, &size, fp); + TEST_COMPARE (ret, -1); + TEST_COMPARE (ferror (fp), 0); + TEST_COMPARE (!!feof (fp), 1); + fclose (fp); + /* Test error occurring with no bytes read, including calling + wrap_getline again while the file is in error state. */ + verbose_printf ("Testing error with no bytes read\n"); + free (lineptr); + lineptr = NULL; + size = 0; + fp = open_test_stream ("", 0); + the_cookie.in_error = EINVAL; + ret = wrap_getline (&lineptr, &size, fp); + TEST_COMPARE (ret, -1); + TEST_COMPARE (errno, EINVAL); + TEST_COMPARE (!!ferror (fp), 1); + TEST_COMPARE (feof (fp), 0); + /* Make sure error state is sticky. */ + the_cookie.in_error = 0; + ret = wrap_getline (&lineptr, &size, fp); + TEST_COMPARE (ret, -1); + TEST_COMPARE (!!ferror (fp), 1); + TEST_COMPARE (feof (fp), 0); + fclose (fp); + /* Test error occurring after some bytes read. Specifications are + ambiguous here; at least in the fopencookie case used for + testing, glibc returns the partial line (but with the error + indicator on the stream set). */ + verbose_printf ("Testing error after some bytes read\n"); + free (lineptr); + lineptr = NULL; + size = 0; + fp = open_test_stream ("foo", 3); + the_cookie.in_error_after = EINVAL; + ret = wrap_getline (&lineptr, &size, fp); + TEST_COMPARE (ret, 3); + TEST_COMPARE_BLOB (lineptr, 4, "foo", 4); + TEST_COMPARE (errno, EINVAL); + TEST_COMPARE (!!ferror (fp), 1); + TEST_COMPARE (feof (fp), 0); + /* Make sure error state is sticky. */ + the_cookie.in_error = 0; + ret = wrap_getline (&lineptr, &size, fp); + TEST_COMPARE (ret, -1); + TEST_COMPARE (!!ferror (fp), 1); + TEST_COMPARE (feof (fp), 0); + fclose (fp); + /* Test EBADF error as a representative example of an fgetc error + resulting in an error from wrap_getline. We don't try to cover all + error cases for fgetc here. */ + verbose_printf ("Testing EBADF error\n"); + free (lineptr); + lineptr = NULL; + size = 0; + fp = xfopen ("/dev/null", "r"); + xclose (fileno (fp)); + ret = wrap_getline (&lineptr, &size, fp); + TEST_COMPARE (ret, -1); + TEST_COMPARE (errno, EBADF); + TEST_COMPARE (!!ferror (fp), 1); + TEST_COMPARE (feof (fp), 0); + fclose (fp); + /* Test EAGAIN error as an example of an fgetc error on a valid file + descriptor. */ + verbose_printf ("Testing EAGAIN error\n"); + free (lineptr); + lineptr = NULL; + size = 0; + int pipefd[2]; + xpipe (pipefd); + ret = fcntl (pipefd[0], F_SETFL, O_NONBLOCK); + TEST_VERIFY_EXIT (ret == 0); + fp = fdopen (pipefd[0], "r"); + TEST_VERIFY_EXIT (fp != NULL); + ret = wrap_getline (&lineptr, &size, fp); + TEST_COMPARE (ret, -1); + TEST_COMPARE (errno, EAGAIN); + TEST_COMPARE (!!ferror (fp), 1); + TEST_COMPARE (feof (fp), 0); + /* Make sure error state is sticky (even after more data is + available to read). */ + xwrite (pipefd[1], "x\n", 2); + ret = wrap_getline (&lineptr, &size, fp); + TEST_COMPARE (ret, -1); + TEST_COMPARE (!!ferror (fp), 1); + TEST_COMPARE (feof (fp), 0); + fclose (fp); + free (lineptr); + return 0; +} + +#include <support/test-driver.c> diff --git a/stdio-common/tst-gets.c b/stdio-common/tst-gets.c index 7feb4bd..6021009 100644 --- a/stdio-common/tst-gets.c +++ b/stdio-common/tst-gets.c @@ -1,5 +1,5 @@ /* Tests for gets. - Copyright (C) 2001-2024 Free Software Foundation, Inc. + Copyright (C) 2001-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/tst-grouping2.c b/stdio-common/tst-grouping2.c index 49b7217..d3d2e8c 100644 --- a/stdio-common/tst-grouping2.c +++ b/stdio-common/tst-grouping2.c @@ -1,5 +1,5 @@ /* Test printf with grouping and large width (bug 29530) - Copyright (C) 2022-2024 Free Software Foundation, Inc. + Copyright (C) 2022-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/tst-grouping3.c b/stdio-common/tst-grouping3.c index 28eb230..761fd2b 100644 --- a/stdio-common/tst-grouping3.c +++ b/stdio-common/tst-grouping3.c @@ -1,5 +1,5 @@ /* Test printf with grouping and padding (bug 30068) - Copyright (C) 2023-2024 Free Software Foundation, Inc. + Copyright (C) 2023-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/tst-grouping_iterator.c b/stdio-common/tst-grouping_iterator.c index 7aaf428..4063ca6 100644 --- a/stdio-common/tst-grouping_iterator.c +++ b/stdio-common/tst-grouping_iterator.c @@ -1,5 +1,5 @@ /* Test for struct grouping_iterator. - Copyright (C) 2022-2024 Free Software Foundation, Inc. + Copyright (C) 2022-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/tst-long-dbl-fphex.c b/stdio-common/tst-long-dbl-fphex.c index 97a0506..7c1ff28 100644 --- a/stdio-common/tst-long-dbl-fphex.c +++ b/stdio-common/tst-long-dbl-fphex.c @@ -1,5 +1,5 @@ /* This file is part of the GNU C Library. - Copyright (C) 2012-2024 Free Software Foundation, Inc. + Copyright (C) 2012-2025 Free Software Foundation, Inc. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public diff --git a/stdio-common/tst-memstream-string.c b/stdio-common/tst-memstream-string.c index afee994..795fe4b 100644 --- a/stdio-common/tst-memstream-string.c +++ b/stdio-common/tst-memstream-string.c @@ -1,5 +1,5 @@ /* Test writing differently sized strings to a memstream. - Copyright (C) 2022-2024 Free Software Foundation, Inc. + Copyright (C) 2022-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/tst-popen.c b/stdio-common/tst-popen.c index 2753e6b..b16f40d 100644 --- a/stdio-common/tst-popen.c +++ b/stdio-common/tst-popen.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2004-2024 Free Software Foundation, Inc. +/* Copyright (C) 2004-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/tst-popen3.c b/stdio-common/tst-popen3.c index 57a42f0..43611fb 100644 --- a/stdio-common/tst-popen3.c +++ b/stdio-common/tst-popen3.c @@ -1,7 +1,7 @@ /* Check if popen return a correct error code if the default shell does not exists (BZ#29016). - Copyright (C) 2022-2024 Free Software Foundation, Inc. + Copyright (C) 2022-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/tst-printf-binary-main.c b/stdio-common/tst-printf-binary-main.c index d228654..f2cf5a2 100644 --- a/stdio-common/tst-printf-binary-main.c +++ b/stdio-common/tst-printf-binary-main.c @@ -1,5 +1,5 @@ /* Test binary printf formats. - Copyright (C) 2021-2024 Free Software Foundation, Inc. + Copyright (C) 2021-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/tst-printf-binary.c b/stdio-common/tst-printf-binary.c index 92287c8..ec0166d 100644 --- a/stdio-common/tst-printf-binary.c +++ b/stdio-common/tst-printf-binary.c @@ -1,5 +1,5 @@ /* Test binary printf formats. Narrow string version. - Copyright (C) 2021-2024 Free Software Foundation, Inc. + Copyright (C) 2021-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/tst-printf-bz18872.sh b/stdio-common/tst-printf-bz18872.sh index 3b283f4..1114af7 100644 --- a/stdio-common/tst-printf-bz18872.sh +++ b/stdio-common/tst-printf-bz18872.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright (C) 2015-2024 Free Software Foundation, Inc. +# Copyright (C) 2015-2025 Free Software Foundation, Inc. # This file is part of the GNU C Library. # The GNU C Library is free software; you can redistribute it and/or @@ -31,7 +31,11 @@ cat <<'EOF' Compile do_test without optimization: GCC 4.9/5.0/6.0 takes a long time to build this source. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67396 */ +#ifdef __clang__ +__attribute__ ((optnone)) +#else __attribute__ ((optimize ("-O0"))) +#endif int do_test (void) { mtrace (); diff --git a/stdio-common/tst-printf-bz25691.c b/stdio-common/tst-printf-bz25691.c index 320d879..754b404 100644 --- a/stdio-common/tst-printf-bz25691.c +++ b/stdio-common/tst-printf-bz25691.c @@ -1,5 +1,5 @@ /* Test for memory leak with large width (BZ#25691). - Copyright (C) 2020-2024 Free Software Foundation, Inc. + Copyright (C) 2020-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/tst-printf-format-as-c.c b/stdio-common/tst-printf-format-as-c.c new file mode 100644 index 0000000..1b53506 --- /dev/null +++ b/stdio-common/tst-printf-format-as-c.c @@ -0,0 +1,20 @@ +/* Test for formatted 'asprintf' output for the 'c' conversion. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-as.h" +#include "tst-printf-format-skeleton-c.c" diff --git a/stdio-common/tst-printf-format-as-char.c b/stdio-common/tst-printf-format-as-char.c new file mode 100644 index 0000000..2dce36d --- /dev/null +++ b/stdio-common/tst-printf-format-as-char.c @@ -0,0 +1,20 @@ +/* Test for formatted 'asprintf' output for signed char conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-as.h" +#include "tst-printf-format-skeleton-char.c" diff --git a/stdio-common/tst-printf-format-as-double.c b/stdio-common/tst-printf-format-as-double.c new file mode 100644 index 0000000..f9fbf03 --- /dev/null +++ b/stdio-common/tst-printf-format-as-double.c @@ -0,0 +1,22 @@ +/* Test for formatted 'asprintf' output for double conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#define TIMEOUT (DEFAULT_TIMEOUT * 32) + +#include "tst-printf-format-as.h" +#include "tst-printf-format-skeleton-double.c" diff --git a/stdio-common/tst-printf-format-as-int.c b/stdio-common/tst-printf-format-as-int.c new file mode 100644 index 0000000..a3af375 --- /dev/null +++ b/stdio-common/tst-printf-format-as-int.c @@ -0,0 +1,20 @@ +/* Test for formatted 'asprintf' output for int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-as.h" +#include "tst-printf-format-skeleton-int.c" diff --git a/stdio-common/tst-printf-format-as-ldouble.c b/stdio-common/tst-printf-format-as-ldouble.c new file mode 100644 index 0000000..15bdcf8 --- /dev/null +++ b/stdio-common/tst-printf-format-as-ldouble.c @@ -0,0 +1,22 @@ +/* Test for formatted 'asprintf' output for long double conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#define TIMEOUT (DEFAULT_TIMEOUT * 128) + +#include "tst-printf-format-as.h" +#include "tst-printf-format-skeleton-ldouble.c" diff --git a/stdio-common/tst-printf-format-as-llong.c b/stdio-common/tst-printf-format-as-llong.c new file mode 100644 index 0000000..4c771fb --- /dev/null +++ b/stdio-common/tst-printf-format-as-llong.c @@ -0,0 +1,20 @@ +/* Test for formatted 'asprintf' output for long long int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-as.h" +#include "tst-printf-format-skeleton-llong.c" diff --git a/stdio-common/tst-printf-format-as-long.c b/stdio-common/tst-printf-format-as-long.c new file mode 100644 index 0000000..0a4dee3 --- /dev/null +++ b/stdio-common/tst-printf-format-as-long.c @@ -0,0 +1,20 @@ +/* Test for formatted 'asprintf' output for long int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-as.h" +#include "tst-printf-format-skeleton-long.c" diff --git a/stdio-common/tst-printf-format-as-s.c b/stdio-common/tst-printf-format-as-s.c new file mode 100644 index 0000000..b2240f0 --- /dev/null +++ b/stdio-common/tst-printf-format-as-s.c @@ -0,0 +1,20 @@ +/* Test for formatted 'asprintf' output for the 's' conversion. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-as.h" +#include "tst-printf-format-skeleton-s.c" diff --git a/stdio-common/tst-printf-format-as-short.c b/stdio-common/tst-printf-format-as-short.c new file mode 100644 index 0000000..766ed7b --- /dev/null +++ b/stdio-common/tst-printf-format-as-short.c @@ -0,0 +1,20 @@ +/* Test for formatted 'asprintf' output for short int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-as.h" +#include "tst-printf-format-skeleton-short.c" diff --git a/stdio-common/tst-printf-format-as-uchar.c b/stdio-common/tst-printf-format-as-uchar.c new file mode 100644 index 0000000..ded11dd --- /dev/null +++ b/stdio-common/tst-printf-format-as-uchar.c @@ -0,0 +1,20 @@ +/* Test for formatted 'asprintf' output for unsigned char conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-as.h" +#include "tst-printf-format-skeleton-uchar.c" diff --git a/stdio-common/tst-printf-format-as-uint.c b/stdio-common/tst-printf-format-as-uint.c new file mode 100644 index 0000000..fac144f --- /dev/null +++ b/stdio-common/tst-printf-format-as-uint.c @@ -0,0 +1,20 @@ +/* Test for formatted 'asprintf' output for unsigned int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-as.h" +#include "tst-printf-format-skeleton-uint.c" diff --git a/stdio-common/tst-printf-format-as-ullong.c b/stdio-common/tst-printf-format-as-ullong.c new file mode 100644 index 0000000..bdb8b41 --- /dev/null +++ b/stdio-common/tst-printf-format-as-ullong.c @@ -0,0 +1,20 @@ +/* Test for formatted 'asprintf' output for unsigned long long int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-as.h" +#include "tst-printf-format-skeleton-ullong.c" diff --git a/stdio-common/tst-printf-format-as-ulong.c b/stdio-common/tst-printf-format-as-ulong.c new file mode 100644 index 0000000..ae744e2 --- /dev/null +++ b/stdio-common/tst-printf-format-as-ulong.c @@ -0,0 +1,20 @@ +/* Test for formatted 'asprintf' output for unsigned long int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-as.h" +#include "tst-printf-format-skeleton-ulong.c" diff --git a/stdio-common/tst-printf-format-as-ushort.c b/stdio-common/tst-printf-format-as-ushort.c new file mode 100644 index 0000000..7b4ac43 --- /dev/null +++ b/stdio-common/tst-printf-format-as-ushort.c @@ -0,0 +1,20 @@ +/* Test for formatted 'asprintf' output for unsigned short int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-as.h" +#include "tst-printf-format-skeleton-ushort.c" diff --git a/stdio-common/tst-printf-format-as.h b/stdio-common/tst-printf-format-as.h new file mode 100644 index 0000000..bf39836 --- /dev/null +++ b/stdio-common/tst-printf-format-as.h @@ -0,0 +1,46 @@ +/* Test feature wrapper for formatted 'asprintf' output. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <stdio.h> +#include <stdlib.h> + +#define printf_under_test(...) \ +({ \ + __label__ out; \ + int result; \ + char *str; \ + \ + result = asprintf (&str, __VA_ARGS__); \ + if (result < 0) \ + { \ + perror ("asprintf"); \ + goto out; \ + } \ + if (fwrite (str, sizeof (*str), result, stdout) != result) \ + { \ + perror ("fwrite"); \ + result = -1; \ + } \ + free (str); \ +out: \ + result; \ +}) + +#ifndef TIMEOUT +# define TIMEOUT (DEFAULT_TIMEOUT * 12) +#endif diff --git a/stdio-common/tst-printf-format-c.sh b/stdio-common/tst-printf-format-c.sh new file mode 100644 index 0000000..14a3a6e --- /dev/null +++ b/stdio-common/tst-printf-format-c.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Testing of the 'c' printf conversion. +# Copyright (C) 2024-2025 Free Software Foundation, Inc. +# This file is part of the GNU C Library. + +# The GNU C Library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. + +# The GNU C Library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public +# License along with the GNU C Library; if not, see +# <https://www.gnu.org/licenses/>. + +set -e + +xprintf=$1; shift +common_objpfx=$1; shift +test_program_prefix=$1; shift + +AWK=${AWK:-awk} + +echo Verifying c +(set -o pipefail + ${test_program_prefix} \ + ${common_objpfx}stdio-common/tst-printf-format-${xprintf}-c c | + $AWK -f tst-printf-format.awk 2>&1 | + head -n 1 | sed "s/^/Conversion c output error, first line:\n/") 2>&1 || + exit 1 diff --git a/stdio-common/tst-printf-format-char.sh b/stdio-common/tst-printf-format-char.sh new file mode 100644 index 0000000..5772204 --- /dev/null +++ b/stdio-common/tst-printf-format-char.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# Testing of signed char printf conversions. +# Copyright (C) 2024-2025 Free Software Foundation, Inc. +# This file is part of the GNU C Library. + +# The GNU C Library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. + +# The GNU C Library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public +# License along with the GNU C Library; if not, see +# <https://www.gnu.org/licenses/>. + +set -e + +xprintf=$1; shift +common_objpfx=$1; shift +test_program_prefix=$1; shift + +AWK=${AWK:-awk} + +status=0 + +for f in d i; do + echo Verifying $f + (set -o pipefail + ${test_program_prefix} \ + ${common_objpfx}stdio-common/tst-printf-format-${xprintf}-char $f | + $AWK -f tst-printf-format.awk 2>&1 | + head -n 1 | sed "s/^/Conversion $f output error, first line:\n/") 2>&1 || + status=1 +done + +exit $status diff --git a/stdio-common/tst-printf-format-d-c.c b/stdio-common/tst-printf-format-d-c.c new file mode 100644 index 0000000..fdf4e48 --- /dev/null +++ b/stdio-common/tst-printf-format-d-c.c @@ -0,0 +1,20 @@ +/* Test for formatted 'dprintf' output for the 'c' conversion. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-d.h" +#include "tst-printf-format-skeleton-c.c" diff --git a/stdio-common/tst-printf-format-d-char.c b/stdio-common/tst-printf-format-d-char.c new file mode 100644 index 0000000..86ca225 --- /dev/null +++ b/stdio-common/tst-printf-format-d-char.c @@ -0,0 +1,20 @@ +/* Test for formatted 'dprintf' output for signed char conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-d.h" +#include "tst-printf-format-skeleton-char.c" diff --git a/stdio-common/tst-printf-format-d-double.c b/stdio-common/tst-printf-format-d-double.c new file mode 100644 index 0000000..bfb7ba3 --- /dev/null +++ b/stdio-common/tst-printf-format-d-double.c @@ -0,0 +1,20 @@ +/* Test for formatted 'dprintf' output for double conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-d.h" +#include "tst-printf-format-skeleton-double.c" diff --git a/stdio-common/tst-printf-format-d-int.c b/stdio-common/tst-printf-format-d-int.c new file mode 100644 index 0000000..c977425 --- /dev/null +++ b/stdio-common/tst-printf-format-d-int.c @@ -0,0 +1,20 @@ +/* Test for formatted 'dprintf' output for int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-d.h" +#include "tst-printf-format-skeleton-int.c" diff --git a/stdio-common/tst-printf-format-d-ldouble.c b/stdio-common/tst-printf-format-d-ldouble.c new file mode 100644 index 0000000..c49aee9 --- /dev/null +++ b/stdio-common/tst-printf-format-d-ldouble.c @@ -0,0 +1,20 @@ +/* Test for formatted 'dprintf' output for long double conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-d.h" +#include "tst-printf-format-skeleton-ldouble.c" diff --git a/stdio-common/tst-printf-format-d-llong.c b/stdio-common/tst-printf-format-d-llong.c new file mode 100644 index 0000000..b5c37f3 --- /dev/null +++ b/stdio-common/tst-printf-format-d-llong.c @@ -0,0 +1,20 @@ +/* Test for formatted 'dprintf' output for long long int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-d.h" +#include "tst-printf-format-skeleton-llong.c" diff --git a/stdio-common/tst-printf-format-d-long.c b/stdio-common/tst-printf-format-d-long.c new file mode 100644 index 0000000..a6eaaee --- /dev/null +++ b/stdio-common/tst-printf-format-d-long.c @@ -0,0 +1,20 @@ +/* Test for formatted 'dprintf' output for long int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-d.h" +#include "tst-printf-format-skeleton-long.c" diff --git a/stdio-common/tst-printf-format-d-s.c b/stdio-common/tst-printf-format-d-s.c new file mode 100644 index 0000000..b85d4f8 --- /dev/null +++ b/stdio-common/tst-printf-format-d-s.c @@ -0,0 +1,20 @@ +/* Test for formatted 'dprintf' output for the 's' conversion. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-d.h" +#include "tst-printf-format-skeleton-s.c" diff --git a/stdio-common/tst-printf-format-d-short.c b/stdio-common/tst-printf-format-d-short.c new file mode 100644 index 0000000..436ceb2 --- /dev/null +++ b/stdio-common/tst-printf-format-d-short.c @@ -0,0 +1,20 @@ +/* Test for formatted 'dprintf' output for short int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-d.h" +#include "tst-printf-format-skeleton-short.c" diff --git a/stdio-common/tst-printf-format-d-uchar.c b/stdio-common/tst-printf-format-d-uchar.c new file mode 100644 index 0000000..29f2755 --- /dev/null +++ b/stdio-common/tst-printf-format-d-uchar.c @@ -0,0 +1,20 @@ +/* Test for formatted 'dprintf' output for unsigned char conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-d.h" +#include "tst-printf-format-skeleton-uchar.c" diff --git a/stdio-common/tst-printf-format-d-uint.c b/stdio-common/tst-printf-format-d-uint.c new file mode 100644 index 0000000..f0a90a5 --- /dev/null +++ b/stdio-common/tst-printf-format-d-uint.c @@ -0,0 +1,20 @@ +/* Test for formatted 'dprintf' output for unsigned int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-d.h" +#include "tst-printf-format-skeleton-uint.c" diff --git a/stdio-common/tst-printf-format-d-ullong.c b/stdio-common/tst-printf-format-d-ullong.c new file mode 100644 index 0000000..539e527 --- /dev/null +++ b/stdio-common/tst-printf-format-d-ullong.c @@ -0,0 +1,20 @@ +/* Test for formatted 'dprintf' output for unsigned long long int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-d.h" +#include "tst-printf-format-skeleton-ullong.c" diff --git a/stdio-common/tst-printf-format-d-ulong.c b/stdio-common/tst-printf-format-d-ulong.c new file mode 100644 index 0000000..e656fcb --- /dev/null +++ b/stdio-common/tst-printf-format-d-ulong.c @@ -0,0 +1,20 @@ +/* Test for formatted 'dprintf' output for unsigned long int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-d.h" +#include "tst-printf-format-skeleton-ulong.c" diff --git a/stdio-common/tst-printf-format-d-ushort.c b/stdio-common/tst-printf-format-d-ushort.c new file mode 100644 index 0000000..4d63e15 --- /dev/null +++ b/stdio-common/tst-printf-format-d-ushort.c @@ -0,0 +1,20 @@ +/* Test for formatted 'dprintf' output for unsigned short int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-d.h" +#include "tst-printf-format-skeleton-ushort.c" diff --git a/stdio-common/tst-printf-format-d.h b/stdio-common/tst-printf-format-d.h new file mode 100644 index 0000000..acaf7cc --- /dev/null +++ b/stdio-common/tst-printf-format-d.h @@ -0,0 +1,58 @@ +/* Test feature wrapper for formatted 'dprintf' output. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <stdio.h> +#include <unistd.h> + +/* We need to go through the POSIX-mandated dance to switch between + handles on an open file description. */ + +#define printf_under_test(...) \ +({ \ + __label__ out; \ + int result; \ + \ + result = fflush (stdout); \ + if (result == EOF) \ + { \ + perror ("fflush"); \ + goto out; \ + } \ + result = lseek (STDOUT_FILENO, 0, SEEK_END); \ + if (result < 0 && errno == ESPIPE) \ + result = 0; \ + if (result < 0) \ + { \ + perror ("lseek"); \ + goto out; \ + } \ + result = dprintf (STDOUT_FILENO, __VA_ARGS__); \ + if (result < 0) \ + { \ + perror ("dprintf"); \ + goto out; \ + } \ + result = fseek (stdout, 0, SEEK_END); \ + if (result < 0 && errno == ESPIPE) \ + result = 0; \ + if (result < 0) \ + perror ("fseek"); \ +out: \ + result; \ +}) diff --git a/stdio-common/tst-printf-format-double.sh b/stdio-common/tst-printf-format-double.sh new file mode 100644 index 0000000..c6a0eb3 --- /dev/null +++ b/stdio-common/tst-printf-format-double.sh @@ -0,0 +1,74 @@ +#!/bin/bash +# Testing of double printf conversions. +# Copyright (C) 2024-2025 Free Software Foundation, Inc. +# This file is part of the GNU C Library. + +# The GNU C Library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. + +# The GNU C Library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public +# License along with the GNU C Library; if not, see +# <https://www.gnu.org/licenses/>. + +set -e + +xprintf=$1; shift +format=$1; shift +common_objpfx=$1; shift +test_program_prefix=$1; shift + +# For floating-point formats we need to use the bignum mode even if the +# regular mode would do, because GAWK in the latter mode uses sprintf(3) +# internally to process the conversion requested, so any bug in our code +# would then be verified against itself, defeating the objective of doing +# the verification against an independent implementation. +AWK="${AWK:-awk} -M" + +status=77 + +# Verify that AWK can handle the range required. It also catches: +# "gawk: warning: -M ignored: MPFR/GMP support not compiled in" +# message produced where bignum support is not there, which is the +# only indication as the use of '-M' does not affect the exit status +# in this case. +ref="-1.79769313486231570814527423731704357e+308" +val=$(echo "$ref" | $AWK '{ printf "%.35e\n", $1 }' 2>&1) && + test "$val" = "$ref" && status=0 + +test $status -eq 0 || { echo "No working AWK found" && exit $status; } + +# Check for any additional conversions that AWK handles conditionally +# according to its version and/or the environment it has been built in. +# The 'A' and 'a' conversions are not suitable to use at this point, as +# output produced by AWK is different apparently due to a subtlety in +# rounding, so do not try them. +declare -A conversion_disabled +ref="-inf" +for f in f F; do + conversion_disabled[$f]=true + val=$(echo "$ref" | $AWK '{ printf "%'$f'\n", $1 }' 2>&1) && + test "${val^^}" = "${ref^^}" && unset conversion_disabled[$f] +done + +if test "${conversion_disabled[$format]+set}" = set; then + echo Unsupported $format + status=77 +else + echo Verifying $format + (set -o pipefail + ${test_program_prefix} \ + ${common_objpfx}stdio-common/tst-printf-format-${xprintf}-double $format | + $AWK -f tst-printf-format.awk 2>&1 | + head -n 1 | + sed "s/^/Conversion $format output error, first line:\n/") 2>&1 || + status=1 +fi + +exit $status diff --git a/stdio-common/tst-printf-format-f-c.c b/stdio-common/tst-printf-format-f-c.c new file mode 100644 index 0000000..ca4156b --- /dev/null +++ b/stdio-common/tst-printf-format-f-c.c @@ -0,0 +1,20 @@ +/* Test for formatted 'fprintf' output for the 'c' conversion. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-f.h" +#include "tst-printf-format-skeleton-c.c" diff --git a/stdio-common/tst-printf-format-f-char.c b/stdio-common/tst-printf-format-f-char.c new file mode 100644 index 0000000..7b2374a --- /dev/null +++ b/stdio-common/tst-printf-format-f-char.c @@ -0,0 +1,20 @@ +/* Test for formatted 'fprintf' output for signed char conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-f.h" +#include "tst-printf-format-skeleton-char.c" diff --git a/stdio-common/tst-printf-format-f-double.c b/stdio-common/tst-printf-format-f-double.c new file mode 100644 index 0000000..85640c2 --- /dev/null +++ b/stdio-common/tst-printf-format-f-double.c @@ -0,0 +1,20 @@ +/* Test for formatted 'fprintf' output for double conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-f.h" +#include "tst-printf-format-skeleton-double.c" diff --git a/stdio-common/tst-printf-format-f-int.c b/stdio-common/tst-printf-format-f-int.c new file mode 100644 index 0000000..2c5d84a --- /dev/null +++ b/stdio-common/tst-printf-format-f-int.c @@ -0,0 +1,20 @@ +/* Test for formatted 'fprintf' output for int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-f.h" +#include "tst-printf-format-skeleton-int.c" diff --git a/stdio-common/tst-printf-format-f-ldouble.c b/stdio-common/tst-printf-format-f-ldouble.c new file mode 100644 index 0000000..7a0227a --- /dev/null +++ b/stdio-common/tst-printf-format-f-ldouble.c @@ -0,0 +1,20 @@ +/* Test for formatted 'fprintf' output for long double conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-f.h" +#include "tst-printf-format-skeleton-ldouble.c" diff --git a/stdio-common/tst-printf-format-f-llong.c b/stdio-common/tst-printf-format-f-llong.c new file mode 100644 index 0000000..4fe8789 --- /dev/null +++ b/stdio-common/tst-printf-format-f-llong.c @@ -0,0 +1,20 @@ +/* Test for formatted 'fprintf' output for long long int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-f.h" +#include "tst-printf-format-skeleton-llong.c" diff --git a/stdio-common/tst-printf-format-f-long.c b/stdio-common/tst-printf-format-f-long.c new file mode 100644 index 0000000..7c06418 --- /dev/null +++ b/stdio-common/tst-printf-format-f-long.c @@ -0,0 +1,20 @@ +/* Test for formatted 'fprintf' output for long int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-f.h" +#include "tst-printf-format-skeleton-long.c" diff --git a/stdio-common/tst-printf-format-f-s.c b/stdio-common/tst-printf-format-f-s.c new file mode 100644 index 0000000..c622844 --- /dev/null +++ b/stdio-common/tst-printf-format-f-s.c @@ -0,0 +1,20 @@ +/* Test for formatted 'fprintf' output for the 's' conversion. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-f.h" +#include "tst-printf-format-skeleton-s.c" diff --git a/stdio-common/tst-printf-format-f-short.c b/stdio-common/tst-printf-format-f-short.c new file mode 100644 index 0000000..5e8b969 --- /dev/null +++ b/stdio-common/tst-printf-format-f-short.c @@ -0,0 +1,20 @@ +/* Test for formatted 'fprintf' output for short int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-f.h" +#include "tst-printf-format-skeleton-short.c" diff --git a/stdio-common/tst-printf-format-f-uchar.c b/stdio-common/tst-printf-format-f-uchar.c new file mode 100644 index 0000000..f5e32b7 --- /dev/null +++ b/stdio-common/tst-printf-format-f-uchar.c @@ -0,0 +1,20 @@ +/* Test for formatted 'fprintf' output for unsigned char conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-f.h" +#include "tst-printf-format-skeleton-uchar.c" diff --git a/stdio-common/tst-printf-format-f-uint.c b/stdio-common/tst-printf-format-f-uint.c new file mode 100644 index 0000000..77e254b --- /dev/null +++ b/stdio-common/tst-printf-format-f-uint.c @@ -0,0 +1,20 @@ +/* Test for formatted 'fprintf' output for unsigned int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-f.h" +#include "tst-printf-format-skeleton-uint.c" diff --git a/stdio-common/tst-printf-format-f-ullong.c b/stdio-common/tst-printf-format-f-ullong.c new file mode 100644 index 0000000..15c7098 --- /dev/null +++ b/stdio-common/tst-printf-format-f-ullong.c @@ -0,0 +1,20 @@ +/* Test for formatted 'fprintf' output for unsigned long long int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-f.h" +#include "tst-printf-format-skeleton-ullong.c" diff --git a/stdio-common/tst-printf-format-f-ulong.c b/stdio-common/tst-printf-format-f-ulong.c new file mode 100644 index 0000000..2df1c67 --- /dev/null +++ b/stdio-common/tst-printf-format-f-ulong.c @@ -0,0 +1,20 @@ +/* Test for formatted 'fprintf' output for unsigned long int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-f.h" +#include "tst-printf-format-skeleton-ulong.c" diff --git a/stdio-common/tst-printf-format-f-ushort.c b/stdio-common/tst-printf-format-f-ushort.c new file mode 100644 index 0000000..1d71afc --- /dev/null +++ b/stdio-common/tst-printf-format-f-ushort.c @@ -0,0 +1,20 @@ +/* Test for formatted 'fprintf' output for unsigned short int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-f.h" +#include "tst-printf-format-skeleton-ushort.c" diff --git a/stdio-common/tst-printf-format-f.h b/stdio-common/tst-printf-format-f.h new file mode 100644 index 0000000..d3d3cd6 --- /dev/null +++ b/stdio-common/tst-printf-format-f.h @@ -0,0 +1,29 @@ +/* Test feature wrapper for formatted 'fprintf' output. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <stdio.h> + +#define printf_under_test(...) \ +({ \ + int result; \ + \ + result = fprintf (stdout, __VA_ARGS__); \ + if (result < 0) \ + perror ("fprintf"); \ + result; \ +}) diff --git a/stdio-common/tst-printf-format-int.sh b/stdio-common/tst-printf-format-int.sh new file mode 100644 index 0000000..a391510 --- /dev/null +++ b/stdio-common/tst-printf-format-int.sh @@ -0,0 +1,53 @@ +#!/bin/bash +# Testing of int printf conversions. +# Copyright (C) 2024-2025 Free Software Foundation, Inc. +# This file is part of the GNU C Library. + +# The GNU C Library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. + +# The GNU C Library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public +# License along with the GNU C Library; if not, see +# <https://www.gnu.org/licenses/>. + +set -e + +xprintf=$1; shift +common_objpfx=$1; shift +test_program_prefix=$1; shift + +AWK=${AWK:-awk} + +status=77 + +# Verify that AWK can handle the range required. It also catches: +# "gawk: warning: -M ignored: MPFR/GMP support not compiled in" +# message produced where bignum support is not there, which is the +# only indication as the use of '-M' does not affect the exit status +# in this case. +ref="-2147483648" +for AWK in "$AWK -M" "$AWK"; do + val=$(echo "$ref" | $AWK '{ printf "%d\n", $1 }' 2>&1) || continue + test "$val" = "$ref" && status=0 && break +done + +test $status -eq 0 || { echo "No working AWK found" && exit $status; } + +for f in d i; do + echo Verifying $f + (set -o pipefail + ${test_program_prefix} \ + ${common_objpfx}stdio-common/tst-printf-format-${xprintf}-int $f | + $AWK -f tst-printf-format.awk 2>&1 | + head -n 1 | sed "s/^/Conversion $f output error, first line:\n/") 2>&1 || + status=1 +done + +exit $status diff --git a/stdio-common/tst-printf-format-ldouble.sh b/stdio-common/tst-printf-format-ldouble.sh new file mode 100644 index 0000000..15eba11 --- /dev/null +++ b/stdio-common/tst-printf-format-ldouble.sh @@ -0,0 +1,74 @@ +#!/bin/bash +# Testing of long double printf conversions. +# Copyright (C) 2024-2025 Free Software Foundation, Inc. +# This file is part of the GNU C Library. + +# The GNU C Library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. + +# The GNU C Library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public +# License along with the GNU C Library; if not, see +# <https://www.gnu.org/licenses/>. + +set -e + +xprintf=$1; shift +format=$1; shift +common_objpfx=$1; shift +test_program_prefix=$1; shift + +# For floating-point formats we need to use the bignum mode even if the +# regular mode would do, because GAWK in the latter mode uses sprintf(3) +# internally to process the conversion requested, so any bug in our code +# would then be verified against itself, defeating the objective of doing +# the verification against an independent implementation. +AWK="${AWK:-awk} -M" + +status=77 + +# Verify that AWK can handle the range required. It also catches: +# "gawk: warning: -M ignored: MPFR/GMP support not compiled in" +# message produced where bignum support is not there, which is the +# only indication as the use of '-M' does not affect the exit status +# in this case. +ref="-1.18973149535723176508575932662800702e+4932" +val=$(echo "$ref" | $AWK '{ PREC=113; printf "%.35e\n", $1 }' 2>&1) && + test "$val" = "$ref" && status=0 + +test $status -eq 0 || { echo "No working AWK found" && exit $status; } + +# Check for any additional conversions that AWK handles conditionally +# according to its version and/or the environment it has been built in. +# The 'A' and 'a' conversions are not suitable to use at this point, as +# output produced by AWK is different apparently due to a subtlety in +# rounding, so do not try them. +declare -A conversion_disabled +ref="-inf" +for f in f F; do + conversion_disabled[$f]=true + val=$(echo "$ref" | $AWK '{ printf "%'$f'\n", $1 }' 2>&1) && + test "${val^^}" = "${ref^^}" && unset conversion_disabled[$f] +done + +if test "${conversion_disabled[$format]+set}" = set; then + echo Unsupported $format + status=77 +else + echo Verifying $format + (set -o pipefail + ${test_program_prefix} \ + ${common_objpfx}stdio-common/tst-printf-format-${xprintf}-ldouble $format | + $AWK -f tst-printf-format.awk 2>&1 | + head -n 1 | + sed "s/^/Conversion $format output error, first line:\n/") 2>&1 || + status=1 +fi + +exit $status diff --git a/stdio-common/tst-printf-format-llong.sh b/stdio-common/tst-printf-format-llong.sh new file mode 100644 index 0000000..7b0e702 --- /dev/null +++ b/stdio-common/tst-printf-format-llong.sh @@ -0,0 +1,53 @@ +#!/bin/bash +# Testing of long long int printf conversions. +# Copyright (C) 2024-2025 Free Software Foundation, Inc. +# This file is part of the GNU C Library. + +# The GNU C Library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. + +# The GNU C Library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public +# License along with the GNU C Library; if not, see +# <https://www.gnu.org/licenses/>. + +set -e + +xprintf=$1; shift +common_objpfx=$1; shift +test_program_prefix=$1; shift + +AWK=${AWK:-awk} + +status=77 + +# Verify that AWK can handle the range required. It also catches: +# "gawk: warning: -M ignored: MPFR/GMP support not compiled in" +# message produced where bignum support is not there, which is the +# only indication as the use of '-M' does not affect the exit status +# in this case. +ref="9223372036854775807" +for AWK in "$AWK -M" "$AWK"; do + val=$(echo "$ref" | $AWK '{ printf "%d\n", $1 }' 2>&1) || continue + test "$val" = "$ref" && status=0 && break +done + +test $status -eq 0 || { echo "No working AWK found" && exit $status; } + +for f in d i; do + echo Verifying $f + (set -o pipefail + ${test_program_prefix} \ + ${common_objpfx}stdio-common/tst-printf-format-${xprintf}-llong $f | + $AWK -f tst-printf-format.awk 2>&1 | + head -n 1 | sed "s/^/Conversion $f output error, first line:\n/") 2>&1 || + status=1 +done + +exit $status diff --git a/stdio-common/tst-printf-format-long.sh b/stdio-common/tst-printf-format-long.sh new file mode 100644 index 0000000..2869ef3 --- /dev/null +++ b/stdio-common/tst-printf-format-long.sh @@ -0,0 +1,53 @@ +#!/bin/bash +# Testing of long int printf conversions. +# Copyright (C) 2024-2025 Free Software Foundation, Inc. +# This file is part of the GNU C Library. + +# The GNU C Library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. + +# The GNU C Library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public +# License along with the GNU C Library; if not, see +# <https://www.gnu.org/licenses/>. + +set -e + +xprintf=$1; shift +common_objpfx=$1; shift +test_program_prefix=$1; shift + +AWK=${AWK:-awk} + +status=77 + +# Verify that AWK can handle the range required. It also catches: +# "gawk: warning: -M ignored: MPFR/GMP support not compiled in" +# message produced where bignum support is not there, which is the +# only indication as the use of '-M' does not affect the exit status +# in this case. +ref="9223372036854775807" +for AWK in "$AWK -M" "$AWK"; do + val=$(echo "$ref" | $AWK '{ printf "%d\n", $1 }' 2>&1) || continue + test "$val" = "$ref" && status=0 && break +done + +test $status -eq 0 || { echo "No working AWK found" && exit $status; } + +for f in d i; do + echo Verifying $f + (set -o pipefail + ${test_program_prefix} \ + ${common_objpfx}stdio-common/tst-printf-format-${xprintf}-long $f | + $AWK -f tst-printf-format.awk 2>&1 | + head -n 1 | sed "s/^/Conversion $f output error, first line:\n/") 2>&1 || + status=1 +done + +exit $status diff --git a/stdio-common/tst-printf-format-p-c.c b/stdio-common/tst-printf-format-p-c.c new file mode 100644 index 0000000..5ed37f3 --- /dev/null +++ b/stdio-common/tst-printf-format-p-c.c @@ -0,0 +1,20 @@ +/* Test for formatted 'printf' output for the 'c' conversion. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-p.h" +#include "tst-printf-format-skeleton-c.c" diff --git a/stdio-common/tst-printf-format-p-char.c b/stdio-common/tst-printf-format-p-char.c new file mode 100644 index 0000000..df5e0a3 --- /dev/null +++ b/stdio-common/tst-printf-format-p-char.c @@ -0,0 +1,20 @@ +/* Test for formatted 'printf' output for signed char conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-p.h" +#include "tst-printf-format-skeleton-char.c" diff --git a/stdio-common/tst-printf-format-p-double.c b/stdio-common/tst-printf-format-p-double.c new file mode 100644 index 0000000..c00f54c --- /dev/null +++ b/stdio-common/tst-printf-format-p-double.c @@ -0,0 +1,20 @@ +/* Test for formatted 'printf' output for double conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-p.h" +#include "tst-printf-format-skeleton-double.c" diff --git a/stdio-common/tst-printf-format-p-int.c b/stdio-common/tst-printf-format-p-int.c new file mode 100644 index 0000000..d6f2020 --- /dev/null +++ b/stdio-common/tst-printf-format-p-int.c @@ -0,0 +1,20 @@ +/* Test for formatted 'printf' output for int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-p.h" +#include "tst-printf-format-skeleton-int.c" diff --git a/stdio-common/tst-printf-format-p-ldouble.c b/stdio-common/tst-printf-format-p-ldouble.c new file mode 100644 index 0000000..85dddd1 --- /dev/null +++ b/stdio-common/tst-printf-format-p-ldouble.c @@ -0,0 +1,20 @@ +/* Test for formatted 'printf' output for long double conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-p.h" +#include "tst-printf-format-skeleton-ldouble.c" diff --git a/stdio-common/tst-printf-format-p-llong.c b/stdio-common/tst-printf-format-p-llong.c new file mode 100644 index 0000000..926afc7 --- /dev/null +++ b/stdio-common/tst-printf-format-p-llong.c @@ -0,0 +1,20 @@ +/* Test for formatted 'printf' output for long long int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-p.h" +#include "tst-printf-format-skeleton-llong.c" diff --git a/stdio-common/tst-printf-format-p-long.c b/stdio-common/tst-printf-format-p-long.c new file mode 100644 index 0000000..68caed0 --- /dev/null +++ b/stdio-common/tst-printf-format-p-long.c @@ -0,0 +1,20 @@ +/* Test for formatted 'printf' output for long int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-p.h" +#include "tst-printf-format-skeleton-long.c" diff --git a/stdio-common/tst-printf-format-p-s.c b/stdio-common/tst-printf-format-p-s.c new file mode 100644 index 0000000..8c2a04b --- /dev/null +++ b/stdio-common/tst-printf-format-p-s.c @@ -0,0 +1,20 @@ +/* Test for formatted 'printf' output for the 's' conversion. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-p.h" +#include "tst-printf-format-skeleton-s.c" diff --git a/stdio-common/tst-printf-format-p-short.c b/stdio-common/tst-printf-format-p-short.c new file mode 100644 index 0000000..b1c5778 --- /dev/null +++ b/stdio-common/tst-printf-format-p-short.c @@ -0,0 +1,20 @@ +/* Test for formatted 'printf' output for short int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-p.h" +#include "tst-printf-format-skeleton-short.c" diff --git a/stdio-common/tst-printf-format-p-uchar.c b/stdio-common/tst-printf-format-p-uchar.c new file mode 100644 index 0000000..0903e54 --- /dev/null +++ b/stdio-common/tst-printf-format-p-uchar.c @@ -0,0 +1,20 @@ +/* Test for formatted 'printf' output for unsigned char conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-p.h" +#include "tst-printf-format-skeleton-uchar.c" diff --git a/stdio-common/tst-printf-format-p-uint.c b/stdio-common/tst-printf-format-p-uint.c new file mode 100644 index 0000000..1873df7 --- /dev/null +++ b/stdio-common/tst-printf-format-p-uint.c @@ -0,0 +1,20 @@ +/* Test for formatted 'printf' output for unsigned int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-p.h" +#include "tst-printf-format-skeleton-uint.c" diff --git a/stdio-common/tst-printf-format-p-ullong.c b/stdio-common/tst-printf-format-p-ullong.c new file mode 100644 index 0000000..83fac1e --- /dev/null +++ b/stdio-common/tst-printf-format-p-ullong.c @@ -0,0 +1,20 @@ +/* Test for formatted 'printf' output for unsigned long long int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-p.h" +#include "tst-printf-format-skeleton-ullong.c" diff --git a/stdio-common/tst-printf-format-p-ulong.c b/stdio-common/tst-printf-format-p-ulong.c new file mode 100644 index 0000000..9c0ad2b --- /dev/null +++ b/stdio-common/tst-printf-format-p-ulong.c @@ -0,0 +1,20 @@ +/* Test for formatted 'printf' output for unsigned long int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-p.h" +#include "tst-printf-format-skeleton-ulong.c" diff --git a/stdio-common/tst-printf-format-p-ushort.c b/stdio-common/tst-printf-format-p-ushort.c new file mode 100644 index 0000000..14f8bb5 --- /dev/null +++ b/stdio-common/tst-printf-format-p-ushort.c @@ -0,0 +1,20 @@ +/* Test for formatted 'printf' output for unsigned short int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-p.h" +#include "tst-printf-format-skeleton-ushort.c" diff --git a/stdio-common/tst-printf-format-p.h b/stdio-common/tst-printf-format-p.h new file mode 100644 index 0000000..47ce6ff --- /dev/null +++ b/stdio-common/tst-printf-format-p.h @@ -0,0 +1,29 @@ +/* Test feature wrapper for formatted 'printf' output. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <stdio.h> + +#define printf_under_test(...) \ +({ \ + int result; \ + \ + result = printf (__VA_ARGS__); \ + if (result < 0) \ + perror ("printf"); \ + result; \ +}) diff --git a/stdio-common/tst-printf-format-s-c.c b/stdio-common/tst-printf-format-s-c.c new file mode 100644 index 0000000..350a43a --- /dev/null +++ b/stdio-common/tst-printf-format-s-c.c @@ -0,0 +1,20 @@ +/* Test for formatted 'sprintf' output for the 'c' conversion. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-s.h" +#include "tst-printf-format-skeleton-c.c" diff --git a/stdio-common/tst-printf-format-s-char.c b/stdio-common/tst-printf-format-s-char.c new file mode 100644 index 0000000..47331a3 --- /dev/null +++ b/stdio-common/tst-printf-format-s-char.c @@ -0,0 +1,20 @@ +/* Test for formatted 'sprintf' output for signed char conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-s.h" +#include "tst-printf-format-skeleton-char.c" diff --git a/stdio-common/tst-printf-format-s-double.c b/stdio-common/tst-printf-format-s-double.c new file mode 100644 index 0000000..1d2886a --- /dev/null +++ b/stdio-common/tst-printf-format-s-double.c @@ -0,0 +1,20 @@ +/* Test for formatted 'sprintf' output for double conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-s.h" +#include "tst-printf-format-skeleton-double.c" diff --git a/stdio-common/tst-printf-format-s-int.c b/stdio-common/tst-printf-format-s-int.c new file mode 100644 index 0000000..19fde88 --- /dev/null +++ b/stdio-common/tst-printf-format-s-int.c @@ -0,0 +1,20 @@ +/* Test for formatted 'sprintf' output for int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-s.h" +#include "tst-printf-format-skeleton-int.c" diff --git a/stdio-common/tst-printf-format-s-ldouble.c b/stdio-common/tst-printf-format-s-ldouble.c new file mode 100644 index 0000000..80f1a47 --- /dev/null +++ b/stdio-common/tst-printf-format-s-ldouble.c @@ -0,0 +1,20 @@ +/* Test for formatted 'sprintf' output for long double conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-s.h" +#include "tst-printf-format-skeleton-ldouble.c" diff --git a/stdio-common/tst-printf-format-s-llong.c b/stdio-common/tst-printf-format-s-llong.c new file mode 100644 index 0000000..de462fb --- /dev/null +++ b/stdio-common/tst-printf-format-s-llong.c @@ -0,0 +1,20 @@ +/* Test for formatted 'sprintf' output for long long int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-s.h" +#include "tst-printf-format-skeleton-llong.c" diff --git a/stdio-common/tst-printf-format-s-long.c b/stdio-common/tst-printf-format-s-long.c new file mode 100644 index 0000000..ade8869 --- /dev/null +++ b/stdio-common/tst-printf-format-s-long.c @@ -0,0 +1,20 @@ +/* Test for formatted 'sprintf' output for long int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-s.h" +#include "tst-printf-format-skeleton-long.c" diff --git a/stdio-common/tst-printf-format-s-s.c b/stdio-common/tst-printf-format-s-s.c new file mode 100644 index 0000000..1142a24 --- /dev/null +++ b/stdio-common/tst-printf-format-s-s.c @@ -0,0 +1,20 @@ +/* Test for formatted 'sprintf' output for the 's' conversion. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-s.h" +#include "tst-printf-format-skeleton-s.c" diff --git a/stdio-common/tst-printf-format-s-short.c b/stdio-common/tst-printf-format-s-short.c new file mode 100644 index 0000000..265a628 --- /dev/null +++ b/stdio-common/tst-printf-format-s-short.c @@ -0,0 +1,20 @@ +/* Test for formatted 'sprintf' output for short int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-s.h" +#include "tst-printf-format-skeleton-short.c" diff --git a/stdio-common/tst-printf-format-s-uchar.c b/stdio-common/tst-printf-format-s-uchar.c new file mode 100644 index 0000000..9998974 --- /dev/null +++ b/stdio-common/tst-printf-format-s-uchar.c @@ -0,0 +1,20 @@ +/* Test for formatted 'sprintf' output for unsigned char conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-s.h" +#include "tst-printf-format-skeleton-uchar.c" diff --git a/stdio-common/tst-printf-format-s-uint.c b/stdio-common/tst-printf-format-s-uint.c new file mode 100644 index 0000000..f28e731 --- /dev/null +++ b/stdio-common/tst-printf-format-s-uint.c @@ -0,0 +1,20 @@ +/* Test for formatted 'sprintf' output for unsigned int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-s.h" +#include "tst-printf-format-skeleton-uint.c" diff --git a/stdio-common/tst-printf-format-s-ullong.c b/stdio-common/tst-printf-format-s-ullong.c new file mode 100644 index 0000000..a84fdba --- /dev/null +++ b/stdio-common/tst-printf-format-s-ullong.c @@ -0,0 +1,20 @@ +/* Test for formatted 'sprintf' output for unsigned long long int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-s.h" +#include "tst-printf-format-skeleton-ullong.c" diff --git a/stdio-common/tst-printf-format-s-ulong.c b/stdio-common/tst-printf-format-s-ulong.c new file mode 100644 index 0000000..eebf7f5 --- /dev/null +++ b/stdio-common/tst-printf-format-s-ulong.c @@ -0,0 +1,20 @@ +/* Test for formatted 'sprintf' output for unsigned long int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-s.h" +#include "tst-printf-format-skeleton-ulong.c" diff --git a/stdio-common/tst-printf-format-s-ushort.c b/stdio-common/tst-printf-format-s-ushort.c new file mode 100644 index 0000000..c3683aa --- /dev/null +++ b/stdio-common/tst-printf-format-s-ushort.c @@ -0,0 +1,20 @@ +/* Test for formatted 'sprintf' output for unsigned short int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-s.h" +#include "tst-printf-format-skeleton-ushort.c" diff --git a/stdio-common/tst-printf-format-s.h b/stdio-common/tst-printf-format-s.h new file mode 100644 index 0000000..20369b8 --- /dev/null +++ b/stdio-common/tst-printf-format-s.h @@ -0,0 +1,60 @@ +/* Test feature wrapper for formatted 'sprintf' output. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <stdio.h> +#include <stdlib.h> + +#include <support/next_to_fault.h> + +#define SPRINTF_BUFFER_SIZE 65536 + +static struct support_next_to_fault ntf; + +#define PREPARE printf_under_test_init +static void +printf_under_test_init (int argc, char **argv) +{ + ntf = support_next_to_fault_allocate (SPRINTF_BUFFER_SIZE); +} + +static void __attribute__ ((destructor)) +printf_under_test_fini (void) +{ + support_next_to_fault_free (&ntf); +} + +#define printf_under_test(...) \ +({ \ + __label__ out; \ + char *str = ntf.buffer; \ + int result; \ + \ + result = sprintf (str, __VA_ARGS__); \ + if (result < 0) \ + { \ + perror ("sprintf"); \ + goto out; \ + } \ + if (fwrite (str, sizeof (*str), result, stdout) != result) \ + { \ + perror ("fwrite"); \ + result = -1; \ + } \ +out: \ + result; \ +}) diff --git a/stdio-common/tst-printf-format-s.sh b/stdio-common/tst-printf-format-s.sh new file mode 100644 index 0000000..5b3219c --- /dev/null +++ b/stdio-common/tst-printf-format-s.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Testing of the 's' printf conversion. +# Copyright (C) 2024-2025 Free Software Foundation, Inc. +# This file is part of the GNU C Library. + +# The GNU C Library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. + +# The GNU C Library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public +# License along with the GNU C Library; if not, see +# <https://www.gnu.org/licenses/>. + +set -e + +xprintf=$1; shift +common_objpfx=$1; shift +test_program_prefix=$1; shift + +AWK=${AWK:-awk} + +echo Verifying s +(set -o pipefail + ${test_program_prefix} \ + ${common_objpfx}stdio-common/tst-printf-format-${xprintf}-s s | + $AWK -f tst-printf-format.awk 2>&1 | + head -n 1 | sed "s/^/Conversion s output error, first line:\n/") 2>&1 || + exit 1 diff --git a/stdio-common/tst-printf-format-short.sh b/stdio-common/tst-printf-format-short.sh new file mode 100644 index 0000000..c91eb2d --- /dev/null +++ b/stdio-common/tst-printf-format-short.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# Testing of short int printf conversions. +# Copyright (C) 2024-2025 Free Software Foundation, Inc. +# This file is part of the GNU C Library. + +# The GNU C Library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. + +# The GNU C Library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public +# License along with the GNU C Library; if not, see +# <https://www.gnu.org/licenses/>. + +set -e + +xprintf=$1; shift +common_objpfx=$1; shift +test_program_prefix=$1; shift + +AWK=${AWK:-awk} + +status=0 + +for f in d i; do + echo Verifying $f + (set -o pipefail + ${test_program_prefix} \ + ${common_objpfx}stdio-common/tst-printf-format-${xprintf}-short $f | + $AWK -f tst-printf-format.awk 2>&1 | + head -n 1 | sed "s/^/Conversion $f output error, first line:\n/") 2>&1 || + status=1 +done + +exit $status diff --git a/stdio-common/tst-printf-format-skeleton-c.c b/stdio-common/tst-printf-format-skeleton-c.c new file mode 100644 index 0000000..cbe136f --- /dev/null +++ b/stdio-common/tst-printf-format-skeleton-c.c @@ -0,0 +1,29 @@ +/* Test skeleton for formatted printf output for the 'c' conversion. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <limits.h> + +#define MID_WIDTH 3 +#define HUGE_WIDTH 4 +#define REF_FMT "c" +#define REF_VAL(v) (v) +typedef unsigned char type_t; +static const type_t vals[] = { 0, 42, UCHAR_MAX }; +static const char length[] = ""; + +#include "tst-printf-format-skeleton.c" diff --git a/stdio-common/tst-printf-format-skeleton-char.c b/stdio-common/tst-printf-format-skeleton-char.c new file mode 100644 index 0000000..421664a --- /dev/null +++ b/stdio-common/tst-printf-format-skeleton-char.c @@ -0,0 +1,31 @@ +/* Test skeleton for formatted printf output for signed char conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <limits.h> + +#define MID_WIDTH 3 +#define HUGE_WIDTH 5 +#define REF_FMT "i" +#define REF_VAL(v) ((((v) & 0xff) ^ 0x80) - 0x80) +typedef int type_t; +static const type_t vals[] = + { SCHAR_MIN - 123, SCHAR_MIN - 1, SCHAR_MIN, -123, -1, 0, 1, 42, SCHAR_MAX, + SCHAR_MAX + 1, SCHAR_MAX + 42 }; +static const char length[] = "hh"; + +#include "tst-printf-format-skeleton.c" diff --git a/stdio-common/tst-printf-format-skeleton-double.c b/stdio-common/tst-printf-format-skeleton-double.c new file mode 100644 index 0000000..aa49277 --- /dev/null +++ b/stdio-common/tst-printf-format-skeleton-double.c @@ -0,0 +1,33 @@ +/* Test skeleton for formatted printf output for double conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <float.h> +#include <math.h> + +#define MID_WIDTH 20 +#define HUGE_WIDTH 320 +#define REF_FMT ".35e" +#define REF_VAL(v) (v) +#define PREC DBL_MANT_DIG +typedef double type_t; +static const type_t vals[] = + { -HUGE_VAL, -DBL_MAX, -DBL_MIN, -0.0, -NAN, NAN, 0, DBL_MIN, + DBL_MAX, HUGE_VAL }; +static const char length[] = ""; + +#include "tst-printf-format-skeleton.c" diff --git a/stdio-common/tst-printf-format-skeleton-int.c b/stdio-common/tst-printf-format-skeleton-int.c new file mode 100644 index 0000000..bc3e407 --- /dev/null +++ b/stdio-common/tst-printf-format-skeleton-int.c @@ -0,0 +1,29 @@ +/* Test skeleton for formatted printf output for int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <limits.h> + +#define MID_WIDTH 8 +#define HUGE_WIDTH 15 +#define REF_FMT "i" +#define REF_VAL(v) (v) +typedef int type_t; +static const type_t vals[] = { INT_MIN, -123, -1, 0, 1, 42, INT_MAX }; +static const char length[] = ""; + +#include "tst-printf-format-skeleton.c" diff --git a/stdio-common/tst-printf-format-skeleton-ldouble.c b/stdio-common/tst-printf-format-skeleton-ldouble.c new file mode 100644 index 0000000..1b4c481 --- /dev/null +++ b/stdio-common/tst-printf-format-skeleton-ldouble.c @@ -0,0 +1,38 @@ +/* Test skeleton for formatted printf output for long double conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <float.h> +#include <math.h> +#include <support/test-driver.h> + +#define MID_WIDTH 20 +#define HUGE_WIDTH 4950 +#define REF_FMT ".35Le" +#define REF_VAL(v) (v) +#define PREC LDBL_MANT_DIG +typedef long double type_t; +static const type_t vals[] = + { -HUGE_VAL, -LDBL_MAX, -LDBL_MIN, -0.0, -NAN, NAN, 0, LDBL_MIN, + LDBL_MAX, HUGE_VAL }; +static const char length[] = "L"; + +#ifndef TIMEOUT +# define TIMEOUT (DEFAULT_TIMEOUT * 64) +#endif + +#include "tst-printf-format-skeleton.c" diff --git a/stdio-common/tst-printf-format-skeleton-llong.c b/stdio-common/tst-printf-format-skeleton-llong.c new file mode 100644 index 0000000..9f5bfbc --- /dev/null +++ b/stdio-common/tst-printf-format-skeleton-llong.c @@ -0,0 +1,29 @@ +/* Test skeleton for formatted printf output for long long int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <limits.h> + +#define MID_WIDTH 15 +#define HUGE_WIDTH 25 +#define REF_FMT "lli" +#define REF_VAL(v) (v) +typedef long long int type_t; +static const type_t vals[] = { LLONG_MIN, -123, -1, 0, 1, 42, LLONG_MAX }; +static const char length[] = "ll"; + +#include "tst-printf-format-skeleton.c" diff --git a/stdio-common/tst-printf-format-skeleton-long.c b/stdio-common/tst-printf-format-skeleton-long.c new file mode 100644 index 0000000..f4ed1a9 --- /dev/null +++ b/stdio-common/tst-printf-format-skeleton-long.c @@ -0,0 +1,29 @@ +/* Test skeleton for formatted printf output for long int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <limits.h> + +#define MID_WIDTH 15 +#define HUGE_WIDTH 25 +#define REF_FMT "li" +#define REF_VAL(v) (v) +typedef long int type_t; +static const type_t vals[] = { LONG_MIN, -123, -1, 0, 1, 42, LONG_MAX }; +static const char length[] = "l"; + +#include "tst-printf-format-skeleton.c" diff --git a/stdio-common/tst-printf-format-skeleton-s.c b/stdio-common/tst-printf-format-skeleton-s.c new file mode 100644 index 0000000..7749b5b --- /dev/null +++ b/stdio-common/tst-printf-format-skeleton-s.c @@ -0,0 +1,30 @@ +/* Test skeleton for formatted printf output for the 's' conversion. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <limits.h> + +#define MID_WIDTH 5 +#define HUGE_WIDTH 10 +#define REF_FMT "s" +#define REF_VAL(v) (v) +typedef const char *type_t; +static const type_t vals[] = + { "", "The", "quick", "brown fox", "jumps over the lazy dog" }; +static const char length[] = ""; + +#include "tst-printf-format-skeleton.c" diff --git a/stdio-common/tst-printf-format-skeleton-short.c b/stdio-common/tst-printf-format-skeleton-short.c new file mode 100644 index 0000000..ef2f787 --- /dev/null +++ b/stdio-common/tst-printf-format-skeleton-short.c @@ -0,0 +1,31 @@ +/* Test skeleton for formatted printf output for short int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <limits.h> + +#define MID_WIDTH 4 +#define HUGE_WIDTH 7 +#define REF_FMT "i" +#define REF_VAL(v) ((((v) & 0xffff) ^ 0x8000) - 0x8000) +typedef int type_t; +static const type_t vals[] = + { SHRT_MIN - 123, SHRT_MIN - 1, SHRT_MIN, -123, -1, 0, 1, 42, SHRT_MAX, + SHRT_MAX + 1, SHRT_MAX + 42 }; +static const char length[] = "h"; + +#include "tst-printf-format-skeleton.c" diff --git a/stdio-common/tst-printf-format-skeleton-uchar.c b/stdio-common/tst-printf-format-skeleton-uchar.c new file mode 100644 index 0000000..3a4c427 --- /dev/null +++ b/stdio-common/tst-printf-format-skeleton-uchar.c @@ -0,0 +1,30 @@ +/* Test skeleton for formatted printf output for unsigned char conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <limits.h> + +#define MID_WIDTH 3 +#define HUGE_WIDTH 4 +#define REF_FMT "u" +#define REF_VAL(v) ((v) & 0xff) +typedef unsigned int type_t; +static const type_t vals[] = + { 0, 1, 42, UCHAR_MAX, UCHAR_MAX + 1, UCHAR_MAX + 42 }; +static const char length[] = "hh"; + +#include "tst-printf-format-skeleton.c" diff --git a/stdio-common/tst-printf-format-skeleton-uint.c b/stdio-common/tst-printf-format-skeleton-uint.c new file mode 100644 index 0000000..68222f1 --- /dev/null +++ b/stdio-common/tst-printf-format-skeleton-uint.c @@ -0,0 +1,29 @@ +/* Test skeleton for formatted printf output for unsigned int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <limits.h> + +#define MID_WIDTH 7 +#define HUGE_WIDTH 14 +#define REF_FMT "u" +#define REF_VAL(v) (v) +typedef unsigned int type_t; +static const type_t vals[] = { 0, 1, 42, UINT_MAX }; +static const char length[] = ""; + +#include "tst-printf-format-skeleton.c" diff --git a/stdio-common/tst-printf-format-skeleton-ullong.c b/stdio-common/tst-printf-format-skeleton-ullong.c new file mode 100644 index 0000000..9d2f03b --- /dev/null +++ b/stdio-common/tst-printf-format-skeleton-ullong.c @@ -0,0 +1,29 @@ +/* Test skeleton for formatted printf output for unsigned long long int convs. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <limits.h> + +#define MID_WIDTH 14 +#define HUGE_WIDTH 24 +#define REF_FMT "llu" +#define REF_VAL(v) (v) +typedef unsigned long long int type_t; +static const type_t vals[] = { 0, 1, 42, UINT_MAX, ULLONG_MAX }; +static const char length[] = "ll"; + +#include "tst-printf-format-skeleton.c" diff --git a/stdio-common/tst-printf-format-skeleton-ulong.c b/stdio-common/tst-printf-format-skeleton-ulong.c new file mode 100644 index 0000000..553ca1d --- /dev/null +++ b/stdio-common/tst-printf-format-skeleton-ulong.c @@ -0,0 +1,29 @@ +/* Test skeleton for formatted printf output for unsigned long int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <limits.h> + +#define MID_WIDTH 14 +#define HUGE_WIDTH 24 +#define REF_FMT "lu" +#define REF_VAL(v) (v) +typedef unsigned long int type_t; +static const type_t vals[] = { 0, 1, 42, ULONG_MAX }; +static const char length[] = "l"; + +#include "tst-printf-format-skeleton.c" diff --git a/stdio-common/tst-printf-format-skeleton-ushort.c b/stdio-common/tst-printf-format-skeleton-ushort.c new file mode 100644 index 0000000..6474e97 --- /dev/null +++ b/stdio-common/tst-printf-format-skeleton-ushort.c @@ -0,0 +1,30 @@ +/* Test skeleton for formatted printf output for unsigned short int convs. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <limits.h> + +#define MID_WIDTH 3 +#define HUGE_WIDTH 6 +#define REF_FMT "u" +#define REF_VAL(v) ((v) & 0xffff) +typedef unsigned int type_t; +static const type_t vals[] = + { 0, 1, 42, USHRT_MAX, USHRT_MAX + 1, USHRT_MAX + 42 }; +static const char length[] = "h"; + +#include "tst-printf-format-skeleton.c" diff --git a/stdio-common/tst-printf-format-skeleton.c b/stdio-common/tst-printf-format-skeleton.c new file mode 100644 index 0000000..4f0a5a2 --- /dev/null +++ b/stdio-common/tst-printf-format-skeleton.c @@ -0,0 +1,380 @@ +/* Test skeleton for formatted printf output. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +/* The following definitions have to be supplied by the source including + this skeleton: + + Macros: + MID_WIDTH Medium width/precision positive integer constant. Choose + such as to cause some, but not all the strings produced + to be truncated for the conversions handled. + HUGE_WIDTH Large width/precision positive integer constant. Choose + such as to cause none of the strings produced to be + truncated for the conversions handled. + REF_FMT Reference output format string. Use no flags and such + a precision and length modifier, where applicable, and + a conversion as to make sure the output produced allows + the original value to be reproduced. + REF_VAL(v) Reference value V transformation. For conversions with + a truncating length modifier define such as to reproduce + the truncation operation, otherwise let V pass through. + PREC [optional] Working precision positive integer constant. + Set to the number of binary digits in the significand for + the argument type handled; usually for floating-point + conversions only, but it may be required for 128-bit or + wider integer data types as well. + + Typedefs: + type_t Variadic function argument type. Define to the promoted + type corresponding to the conversion argument type + handled. + + Variables: + vals Array of TYPE_T values. Choose such as to cover boundary + and any special cases. + length Length modifier string. Define according to the + conversion argument type handled. + + The feature to be tested is wrapped into 'printf_under_test'. It is up + to the source including this skeleton if this is going to be a macro + or an actual function. + + See tst-*printf-format-*.c for usage examples. */ + +#include <array_length.h> +#include <dlfcn.h> +#include <mcheck.h> +#include <stdbool.h> +#include <stddef.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +/* Set to nonzero to select all possible tuples with repetitions of 1..n + elements from the set of flags as defined in FLAGS array below; n is + the length of FLAGS array. Otherwise select all possible tuples with + repetitions of 1..2 elements, followed by tuples of 3..n elements where + the index of each element k; k = 2..n in FLAGS is lower than the index + of element k-1 in FLAGS. */ +#ifndef TST_PRINTF_DUPS +# define TST_PRINTF_DUPS 0 +#endif +/* Set to nonzero to report the precision (number of significand digits) + required for floating-point calculations. */ +#ifndef PREC +# define PREC 0 +#endif + +/* The list of conversions permitted for the '#' flag, the '0' flag, + and precision respectively. */ +#define HASH_FORMATS "boxXaAeEfFgG" +#define ZERO_FORMATS "bdiouxXaAeEfFgG" +#define PREC_FORMATS "bdiouxXaAeEfFgGs" + +/* Output format conversion flags. */ +static struct +{ + /* Flag character. */ + char f; + /* List of conversion specifiers the flag is valid for; NULL if all. */ + const char *s; +} const flags[] = + { {'-'}, {'+'}, {' '}, {'#', HASH_FORMATS}, {'0', ZERO_FORMATS} }; + +/* Helper to initialize elements of the PW array for the width and + precision to be specified as a positive integer directly in the + format, and then as both a negative and a positive argument to '*'. */ +#define STR(v) #v +#define WPINIT(v) {0, STR (v)}, {v, NULL}, {-v, NULL} + +/* Width and precision settings to iterate over; zero is initialized + directly as it has no corresponding negated value and other values + use the helper above. */ +static struct wp +{ + /* Integer argument to '*', used if S is NULL. */ + int i; + /* String denoting an integer to use in the format, or NULL to use '*'. */ + const char *s; +} const wp[] = + { {0, "0"}, {0, NULL}, WPINIT (1), WPINIT (2), + WPINIT (MID_WIDTH), WPINIT (HUGE_WIDTH) }; + +/* Produce a record according to '%' and zero or more output format flags + already provided in FMT at indices 0..IDX-1, width W if non-NULL, '.' + precision specifier if POINT set to true, precision P if non-NULL, + any length modifiers L, conversion C, and value VAL. + + Record formats produced: + + %<FLAGS><L><C>:<VAL>: + %<FLAGS>.<L><C>:<VAL>: + %<FLAGS><W><L><C>:<VAL>: + %<FLAGS><W>.<L><C>:<VAL>: + %<FLAGS>.<P><L><C>:<VAL>: + %<FLAGS><W>.<P><L><C>:<VAL>: + %<FLAGS>*<L><C>:<W>:<VAL>: + %<FLAGS>*.<L><C>:<W>:<VAL>: + %<FLAGS>.*<L><C>:<P>:<VAL>: + %<FLAGS>*.*<L><C>:<W>:<P>:<VAL>: + + Return 0 on success, -1 on failure. */ + +static int +do_printf (char *fmt, size_t idx, + const struct wp *w, bool point, const struct wp *p, + const char *l, char c, type_t val) +{ + int wpval[2] = { 0 }; + size_t nint = 0; + int result; + size_t i; + + if (w != NULL) + { + if (w->s == NULL) + { + fmt[idx++] = '*'; + wpval[nint++] = w->i; + } + else + for (i = 0; w->s[i] != '\0'; i++) + fmt[idx++] = w->s[i]; + } + if (point) + fmt[idx++] = '.'; + if (p != NULL) + { + if (p->s == NULL) + { + fmt[idx++] = '*'; + wpval[nint++] = p->i; + } + else + for (i = 0; p->s[i] != '\0'; i++) + fmt[idx++] = p->s[i]; + } + for (i = 0; length[i] != '\0'; i++) + fmt[idx++] = length[i]; + fmt[idx++] = c; + fmt[idx] = ':'; + fmt[idx + 1] = '\0'; + if (fputs (fmt, stdout) == EOF) + { + perror ("fputs"); + return -1; + } + fmt[idx++] = '\0'; + if (nint > 0) + { + result = printf ("%i:", wpval[0]); + if (result < 0) + { + perror ("printf"); + return -1; + } + if (nint > 1) + { + result = printf ("%i:", wpval[1]); + if (result < 0) + { + perror ("printf"); + return -1; + } + } + } + switch (nint) + { + case 0: + result = printf_under_test (fmt, val); + break; + case 1: + result = printf_under_test (fmt, wpval[0], val); + break; + case 2: + result = printf_under_test (fmt, wpval[0], wpval[1], val); + break; + default: + fputs ("Broken test, nint > 2\n", stderr); + return -1; + } + if (result < 0) + return -1; + if (fputs (":\n", stdout) == EOF) + { + perror ("fputs"); + return -1; + } + return 0; +} + +/* Produce a list of records according to '%' and zero or more output + format flags already provided in FMT at indices 0..IDX-1, iterating + over widths and precisions defined in global WP array, any length + modifiers L, conversion C, and value VAL. Inline '0' is omitted for + the width, as it is a flag already handled among the flags supplied. + Precision is omitted where the conversion does not allow it. + + Return 0 on success, -1 on failure. */ + +static int +do_printf_flags (char *fmt, size_t idx, const char *l, char c, type_t val) +{ + bool do_prec = strchr (PREC_FORMATS, c) != NULL; + size_t i; + + if (do_printf (fmt, idx, NULL, false, NULL, l, c, val) < 0) + return -1; + if (do_prec && do_printf (fmt, idx, NULL, true, NULL, l, c, val) < 0) + return -1; + for (i = 0; i < array_length (wp); i++) + { + size_t j; + + if (do_prec && do_printf (fmt, idx, NULL, true, wp + i, l, c, val) < 0) + return -1; + /* Inline '0' is a flag rather than width and is handled elsewhere. */ + if (wp[i].s != NULL && wp[i].s[0] == '0' && wp[i].s[1] == '\0') + continue; + if (do_printf (fmt, idx, wp + i, false, NULL, l, c, val) < 0) + return -1; + if (do_prec) + { + if (do_printf (fmt, idx, wp + i, true, NULL, l, c, val) < 0) + return -1; + for (j = 0; j < array_length (wp); j++) + if (do_printf (fmt, idx, wp + i, true, wp + j, l, c, val) < 0) + return -1; + } + } + return 0; +} + +/* Produce a list of records using the formatted output specifier + supplied in ARGV[1] preceded by any length modifier supplied in + the global LENGTH variable, iterating over format flags defined + in the global FLAGS array, and values supplied in the global VALS + array. Note that the output specifier supplied is not verified + against TYPE_T, so undefined behavior will result if this is used + incorrectly. + + If PREC is nonzero, then this record: + + prec:<PREC> + + is produced at the beginning. Then for each VAL from VALS a block + of records is produced starting with: + + val:<VAL> + + where VAL is formatted according to REF_FMT output format. The + block continues with records as shown with DO_PRINTF above using + flags iterated over according to TST_PRINTF_DUPS. + + See the top of this file for the definitions that have to be + provided by the source including this skeleton. */ + +static int +do_test (int argc, char *argv[]) +{ + char fmt[100] = {'%'}; + size_t j; + size_t v; + char c; + + if (argc < 2 || *argv[1] == '\0') + { + fprintf (stderr, "Usage: %s <specifier>\n", basename (argv[0])); + return EXIT_FAILURE; + } + + mtrace (); + + if (PREC && printf ("prec:%i\n", PREC) < 0) + { + perror ("printf"); + return EXIT_FAILURE; + } + + c = *argv[1]; + for (v = 0; v < array_length (vals); v++) + { + if (printf ("val:%" REF_FMT "\n", REF_VAL (vals[v])) < 0) + { + perror ("printf"); + return EXIT_FAILURE; + } + + if (do_printf_flags (fmt, 1, length, c, vals[v]) < 0) + return EXIT_FAILURE; + for (j = 0; j < array_length (flags); j++) + { + bool done = false; + size_t i[j + 1]; + size_t k; + + memset (i, 0, sizeof (i)); + while (!done) + { + bool skip = false; + size_t idx = 1; + char f; + + for (k = 0; k <= j; k++) + { + const char *s = flags[i[k]].s; + + if (s && strchr (s, c) == NULL) + skip = true; + if (!TST_PRINTF_DUPS && j > 1 && k > 0 && i[k] >= i[k - 1]) + skip = true; + if (skip) + break; + + f = flags[i[k]].f; + fmt[idx++] = f; + } + if (!skip && do_printf_flags (fmt, idx, length, c, vals[v]) < 0) + return EXIT_FAILURE; + for (k = 0; k <= j; k++) + { + i[k]++; + if (i[k] < array_length (flags)) + break; + else if (k == j) + done = true; + else + i[k] = 0; + } + } + } + } + + return EXIT_SUCCESS; +} + +/* Interpose 'dladdr' with a stub to speed up malloc tracing. */ + +int +dladdr (const void *addr, Dl_info *info) +{ + return 0; +} + +#define TEST_FUNCTION_ARGV do_test +#include <support/test-driver.c> diff --git a/stdio-common/tst-printf-format-sn-c.c b/stdio-common/tst-printf-format-sn-c.c new file mode 100644 index 0000000..40e5114 --- /dev/null +++ b/stdio-common/tst-printf-format-sn-c.c @@ -0,0 +1,20 @@ +/* Test for formatted 'snprintf' output for the 'c' conversion. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-sn.h" +#include "tst-printf-format-skeleton-c.c" diff --git a/stdio-common/tst-printf-format-sn-char.c b/stdio-common/tst-printf-format-sn-char.c new file mode 100644 index 0000000..1d88b4b --- /dev/null +++ b/stdio-common/tst-printf-format-sn-char.c @@ -0,0 +1,20 @@ +/* Test for formatted 'snprintf' output for signed char conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-sn.h" +#include "tst-printf-format-skeleton-char.c" diff --git a/stdio-common/tst-printf-format-sn-double.c b/stdio-common/tst-printf-format-sn-double.c new file mode 100644 index 0000000..df259c3 --- /dev/null +++ b/stdio-common/tst-printf-format-sn-double.c @@ -0,0 +1,20 @@ +/* Test for formatted 'snprintf' output for double conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-sn.h" +#include "tst-printf-format-skeleton-double.c" diff --git a/stdio-common/tst-printf-format-sn-int.c b/stdio-common/tst-printf-format-sn-int.c new file mode 100644 index 0000000..8787c0c --- /dev/null +++ b/stdio-common/tst-printf-format-sn-int.c @@ -0,0 +1,20 @@ +/* Test for formatted 'snprintf' output for int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-sn.h" +#include "tst-printf-format-skeleton-int.c" diff --git a/stdio-common/tst-printf-format-sn-ldouble.c b/stdio-common/tst-printf-format-sn-ldouble.c new file mode 100644 index 0000000..e04433b --- /dev/null +++ b/stdio-common/tst-printf-format-sn-ldouble.c @@ -0,0 +1,20 @@ +/* Test for formatted 'snprintf' output for long double conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-sn.h" +#include "tst-printf-format-skeleton-ldouble.c" diff --git a/stdio-common/tst-printf-format-sn-llong.c b/stdio-common/tst-printf-format-sn-llong.c new file mode 100644 index 0000000..eac715b --- /dev/null +++ b/stdio-common/tst-printf-format-sn-llong.c @@ -0,0 +1,20 @@ +/* Test for formatted 'snprintf' output for long long int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-sn.h" +#include "tst-printf-format-skeleton-llong.c" diff --git a/stdio-common/tst-printf-format-sn-long.c b/stdio-common/tst-printf-format-sn-long.c new file mode 100644 index 0000000..fa906ca --- /dev/null +++ b/stdio-common/tst-printf-format-sn-long.c @@ -0,0 +1,20 @@ +/* Test for formatted 'snprintf' output for long int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-sn.h" +#include "tst-printf-format-skeleton-long.c" diff --git a/stdio-common/tst-printf-format-sn-s.c b/stdio-common/tst-printf-format-sn-s.c new file mode 100644 index 0000000..805a2b6 --- /dev/null +++ b/stdio-common/tst-printf-format-sn-s.c @@ -0,0 +1,20 @@ +/* Test for formatted 'snprintf' output for the 's' conversion. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-sn.h" +#include "tst-printf-format-skeleton-s.c" diff --git a/stdio-common/tst-printf-format-sn-short.c b/stdio-common/tst-printf-format-sn-short.c new file mode 100644 index 0000000..eab6e3e --- /dev/null +++ b/stdio-common/tst-printf-format-sn-short.c @@ -0,0 +1,20 @@ +/* Test for formatted 'snprintf' output for short int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-sn.h" +#include "tst-printf-format-skeleton-short.c" diff --git a/stdio-common/tst-printf-format-sn-uchar.c b/stdio-common/tst-printf-format-sn-uchar.c new file mode 100644 index 0000000..390c97a --- /dev/null +++ b/stdio-common/tst-printf-format-sn-uchar.c @@ -0,0 +1,20 @@ +/* Test for formatted 'snprintf' output for unsigned char conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-sn.h" +#include "tst-printf-format-skeleton-uchar.c" diff --git a/stdio-common/tst-printf-format-sn-uint.c b/stdio-common/tst-printf-format-sn-uint.c new file mode 100644 index 0000000..f150a36 --- /dev/null +++ b/stdio-common/tst-printf-format-sn-uint.c @@ -0,0 +1,20 @@ +/* Test for formatted 'snprintf' output for unsigned int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-sn.h" +#include "tst-printf-format-skeleton-uint.c" diff --git a/stdio-common/tst-printf-format-sn-ullong.c b/stdio-common/tst-printf-format-sn-ullong.c new file mode 100644 index 0000000..82d1a0c --- /dev/null +++ b/stdio-common/tst-printf-format-sn-ullong.c @@ -0,0 +1,20 @@ +/* Test for formatted 'snprintf' output for unsigned long long int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-sn.h" +#include "tst-printf-format-skeleton-ullong.c" diff --git a/stdio-common/tst-printf-format-sn-ulong.c b/stdio-common/tst-printf-format-sn-ulong.c new file mode 100644 index 0000000..0ed33bc --- /dev/null +++ b/stdio-common/tst-printf-format-sn-ulong.c @@ -0,0 +1,20 @@ +/* Test for formatted 'snprintf' output for unsigned long int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-sn.h" +#include "tst-printf-format-skeleton-ulong.c" diff --git a/stdio-common/tst-printf-format-sn-ushort.c b/stdio-common/tst-printf-format-sn-ushort.c new file mode 100644 index 0000000..0fd292f --- /dev/null +++ b/stdio-common/tst-printf-format-sn-ushort.c @@ -0,0 +1,20 @@ +/* Test for formatted 'snprintf' output for unsigned short int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-sn.h" +#include "tst-printf-format-skeleton-ushort.c" diff --git a/stdio-common/tst-printf-format-sn.h b/stdio-common/tst-printf-format-sn.h new file mode 100644 index 0000000..0488338 --- /dev/null +++ b/stdio-common/tst-printf-format-sn.h @@ -0,0 +1,60 @@ +/* Test feature wrapper for formatted 'snprintf' output. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <stdio.h> +#include <stdlib.h> + +#include <support/next_to_fault.h> + +#define SPRINTF_BUFFER_SIZE 65536 + +static struct support_next_to_fault ntf; + +#define PREPARE printf_under_test_init +static void +printf_under_test_init (int argc, char **argv) +{ + ntf = support_next_to_fault_allocate (SPRINTF_BUFFER_SIZE); +} + +static void __attribute__ ((destructor)) +printf_under_test_fini (void) +{ + support_next_to_fault_free (&ntf); +} + +#define printf_under_test(...) \ +({ \ + __label__ out; \ + char *str = ntf.buffer; \ + int result; \ + \ + result = snprintf (str, ntf.length, __VA_ARGS__); \ + if (result < 0) \ + { \ + perror ("snprintf"); \ + goto out; \ + } \ + if (fwrite (str, sizeof (*str), result, stdout) != result) \ + { \ + perror ("fwrite"); \ + result = -1; \ + } \ +out: \ + result; \ +}) diff --git a/stdio-common/tst-printf-format-uchar.sh b/stdio-common/tst-printf-format-uchar.sh new file mode 100644 index 0000000..478dcab --- /dev/null +++ b/stdio-common/tst-printf-format-uchar.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# Testing of unsigned char printf conversions. +# Copyright (C) 2024-2025 Free Software Foundation, Inc. +# This file is part of the GNU C Library. + +# The GNU C Library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. + +# The GNU C Library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public +# License along with the GNU C Library; if not, see +# <https://www.gnu.org/licenses/>. + +set -e + +xprintf=$1; shift +common_objpfx=$1; shift +test_program_prefix=$1; shift + +AWK=${AWK:-awk} + +status=0 + +for f in o u x X; do + echo Verifying $f + (set -o pipefail + ${test_program_prefix} \ + ${common_objpfx}stdio-common/tst-printf-format-${xprintf}-uchar $f | + $AWK -f tst-printf-format.awk 2>&1 | + head -n 1 | sed "s/^/Conversion $f output error, first line:\n/") 2>&1 || + status=1 +done + +exit $status diff --git a/stdio-common/tst-printf-format-uint.sh b/stdio-common/tst-printf-format-uint.sh new file mode 100644 index 0000000..26bcfe8 --- /dev/null +++ b/stdio-common/tst-printf-format-uint.sh @@ -0,0 +1,53 @@ +#!/bin/bash +# Testing of unsigned int printf conversions. +# Copyright (C) 2024-2025 Free Software Foundation, Inc. +# This file is part of the GNU C Library. + +# The GNU C Library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. + +# The GNU C Library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public +# License along with the GNU C Library; if not, see +# <https://www.gnu.org/licenses/>. + +set -e + +xprintf=$1; shift +common_objpfx=$1; shift +test_program_prefix=$1; shift + +AWK=${AWK:-awk} + +status=77 + +# Verify that AWK can handle the range required. It also catches: +# "gawk: warning: -M ignored: MPFR/GMP support not compiled in" +# message produced where bignum support is not there, which is the +# only indication as the use of '-M' does not affect the exit status +# in this case. +ref="4294967295" +for AWK in "$AWK -M" "$AWK"; do + val=$(echo "$ref" | $AWK '{ printf "%d\n", $1 }' 2>&1) || continue + test "$val" = "$ref" && status=0 && break +done + +test $status -eq 0 || { echo "No working AWK found" && exit $status; } + +for f in o u x X; do + echo Verifying $f + (set -o pipefail + ${test_program_prefix} \ + ${common_objpfx}stdio-common/tst-printf-format-${xprintf}-uint $f | + $AWK -f tst-printf-format.awk 2>&1 | + head -n 1 | sed "s/^/Conversion $f output error, first line:\n/") 2>&1 || + status=1 +done + +exit $status diff --git a/stdio-common/tst-printf-format-ullong.sh b/stdio-common/tst-printf-format-ullong.sh new file mode 100644 index 0000000..9475401 --- /dev/null +++ b/stdio-common/tst-printf-format-ullong.sh @@ -0,0 +1,53 @@ +#!/bin/bash +# Testing of unsigned long long int printf conversions. +# Copyright (C) 2024-2025 Free Software Foundation, Inc. +# This file is part of the GNU C Library. + +# The GNU C Library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. + +# The GNU C Library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public +# License along with the GNU C Library; if not, see +# <https://www.gnu.org/licenses/>. + +set -e + +xprintf=$1; shift +common_objpfx=$1; shift +test_program_prefix=$1; shift + +AWK=${AWK:-awk} + +status=77 + +# Verify that AWK can handle the range required. It also catches: +# "gawk: warning: -M ignored: MPFR/GMP support not compiled in" +# message produced where bignum support is not there, which is the +# only indication as the use of '-M' does not affect the exit status +# in this case. +ref="18446744073709551615" +for AWK in "$AWK -M" "$AWK"; do + val=$(echo "$ref" | $AWK '{ printf "%d\n", $1 }' 2>&1) || continue + test "$val" = "$ref" && status=0 && break +done + +test $status -eq 0 || { echo "No working AWK found" && exit $status; } + +for f in o u x X; do + echo Verifying $f + (set -o pipefail + ${test_program_prefix} \ + ${common_objpfx}stdio-common/tst-printf-format-${xprintf}-ullong $f | + $AWK -f tst-printf-format.awk 2>&1 | + head -n 1 | sed "s/^/Conversion $f output error, first line:\n/") 2>&1 || + status=1 +done + +exit $status diff --git a/stdio-common/tst-printf-format-ulong.sh b/stdio-common/tst-printf-format-ulong.sh new file mode 100644 index 0000000..5c2d2e4 --- /dev/null +++ b/stdio-common/tst-printf-format-ulong.sh @@ -0,0 +1,53 @@ +#!/bin/bash +# Testing of unsigned long int printf conversions. +# Copyright (C) 2024-2025 Free Software Foundation, Inc. +# This file is part of the GNU C Library. + +# The GNU C Library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. + +# The GNU C Library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public +# License along with the GNU C Library; if not, see +# <https://www.gnu.org/licenses/>. + +set -e + +xprintf=$1; shift +common_objpfx=$1; shift +test_program_prefix=$1; shift + +AWK=${AWK:-awk} + +status=77 + +# Verify that AWK can handle the range required. It also catches: +# "gawk: warning: -M ignored: MPFR/GMP support not compiled in" +# message produced where bignum support is not there, which is the +# only indication as the use of '-M' does not affect the exit status +# in this case. +ref="18446744073709551615" +for AWK in "$AWK -M" "$AWK"; do + val=$(echo "$ref" | $AWK '{ printf "%d\n", $1 }' 2>&1) || continue + test "$val" = "$ref" && status=0 && break +done + +test $status -eq 0 || { echo "No working AWK found" && exit $status; } + +for f in o u x X; do + echo Verifying $f + (set -o pipefail + ${test_program_prefix} \ + ${common_objpfx}stdio-common/tst-printf-format-${xprintf}-ulong $f | + $AWK -f tst-printf-format.awk 2>&1 | + head -n 1 | sed "s/^/Conversion $f output error, first line:\n/") 2>&1 || + status=1 +done + +exit $status diff --git a/stdio-common/tst-printf-format-ushort.sh b/stdio-common/tst-printf-format-ushort.sh new file mode 100644 index 0000000..2b3745f --- /dev/null +++ b/stdio-common/tst-printf-format-ushort.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# Testing of unsigned short int printf conversions. +# Copyright (C) 2024-2025 Free Software Foundation, Inc. +# This file is part of the GNU C Library. + +# The GNU C Library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. + +# The GNU C Library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public +# License along with the GNU C Library; if not, see +# <https://www.gnu.org/licenses/>. + +set -e + +xprintf=$1; shift +common_objpfx=$1; shift +test_program_prefix=$1; shift + +AWK=${AWK:-awk} + +status=0 + +for f in o u x X; do + echo Verifying $f + (set -o pipefail + ${test_program_prefix} \ + ${common_objpfx}stdio-common/tst-printf-format-${xprintf}-ushort $f | + $AWK -f tst-printf-format.awk 2>&1 | + head -n 1 | sed "s/^/Conversion $f output error, first line:\n/") 2>&1 || + status=1 +done + +exit $status diff --git a/stdio-common/tst-printf-format-v-c.c b/stdio-common/tst-printf-format-v-c.c new file mode 100644 index 0000000..9a327ef --- /dev/null +++ b/stdio-common/tst-printf-format-v-c.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vprintf' output for the 'c' conversion. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-v.h" +#include "tst-printf-format-skeleton-c.c" diff --git a/stdio-common/tst-printf-format-v-char.c b/stdio-common/tst-printf-format-v-char.c new file mode 100644 index 0000000..1efb2b9 --- /dev/null +++ b/stdio-common/tst-printf-format-v-char.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vprintf' output for signed char conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-v.h" +#include "tst-printf-format-skeleton-char.c" diff --git a/stdio-common/tst-printf-format-v-double.c b/stdio-common/tst-printf-format-v-double.c new file mode 100644 index 0000000..99e0913 --- /dev/null +++ b/stdio-common/tst-printf-format-v-double.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vprintf' output for double conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-v.h" +#include "tst-printf-format-skeleton-double.c" diff --git a/stdio-common/tst-printf-format-v-int.c b/stdio-common/tst-printf-format-v-int.c new file mode 100644 index 0000000..897496f --- /dev/null +++ b/stdio-common/tst-printf-format-v-int.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vprintf' output for int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-v.h" +#include "tst-printf-format-skeleton-int.c" diff --git a/stdio-common/tst-printf-format-v-ldouble.c b/stdio-common/tst-printf-format-v-ldouble.c new file mode 100644 index 0000000..32f0677 --- /dev/null +++ b/stdio-common/tst-printf-format-v-ldouble.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vprintf' output for long double conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-v.h" +#include "tst-printf-format-skeleton-ldouble.c" diff --git a/stdio-common/tst-printf-format-v-llong.c b/stdio-common/tst-printf-format-v-llong.c new file mode 100644 index 0000000..0295cee --- /dev/null +++ b/stdio-common/tst-printf-format-v-llong.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vprintf' output for long long int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-v.h" +#include "tst-printf-format-skeleton-llong.c" diff --git a/stdio-common/tst-printf-format-v-long.c b/stdio-common/tst-printf-format-v-long.c new file mode 100644 index 0000000..2eb373c --- /dev/null +++ b/stdio-common/tst-printf-format-v-long.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vprintf' output for long int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-v.h" +#include "tst-printf-format-skeleton-long.c" diff --git a/stdio-common/tst-printf-format-v-s.c b/stdio-common/tst-printf-format-v-s.c new file mode 100644 index 0000000..62f4c34 --- /dev/null +++ b/stdio-common/tst-printf-format-v-s.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vprintf' output for the 's' conversion. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-v.h" +#include "tst-printf-format-skeleton-s.c" diff --git a/stdio-common/tst-printf-format-v-short.c b/stdio-common/tst-printf-format-v-short.c new file mode 100644 index 0000000..906e30c --- /dev/null +++ b/stdio-common/tst-printf-format-v-short.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vprintf' output for short int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-v.h" +#include "tst-printf-format-skeleton-short.c" diff --git a/stdio-common/tst-printf-format-v-uchar.c b/stdio-common/tst-printf-format-v-uchar.c new file mode 100644 index 0000000..44c4aea --- /dev/null +++ b/stdio-common/tst-printf-format-v-uchar.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vprintf' output for unsigned char conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-v.h" +#include "tst-printf-format-skeleton-uchar.c" diff --git a/stdio-common/tst-printf-format-v-uint.c b/stdio-common/tst-printf-format-v-uint.c new file mode 100644 index 0000000..6807094 --- /dev/null +++ b/stdio-common/tst-printf-format-v-uint.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vprintf' output for unsigned int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-v.h" +#include "tst-printf-format-skeleton-uint.c" diff --git a/stdio-common/tst-printf-format-v-ullong.c b/stdio-common/tst-printf-format-v-ullong.c new file mode 100644 index 0000000..46a8e1e --- /dev/null +++ b/stdio-common/tst-printf-format-v-ullong.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vprintf' output for unsigned long long int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-v.h" +#include "tst-printf-format-skeleton-ullong.c" diff --git a/stdio-common/tst-printf-format-v-ulong.c b/stdio-common/tst-printf-format-v-ulong.c new file mode 100644 index 0000000..747f4e6 --- /dev/null +++ b/stdio-common/tst-printf-format-v-ulong.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vprintf' output for unsigned long int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-v.h" +#include "tst-printf-format-skeleton-ulong.c" diff --git a/stdio-common/tst-printf-format-v-ushort.c b/stdio-common/tst-printf-format-v-ushort.c new file mode 100644 index 0000000..1eb2f7b --- /dev/null +++ b/stdio-common/tst-printf-format-v-ushort.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vprintf' output for unsigned short int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-v.h" +#include "tst-printf-format-skeleton-ushort.c" diff --git a/stdio-common/tst-printf-format-v.h b/stdio-common/tst-printf-format-v.h new file mode 100644 index 0000000..68109db --- /dev/null +++ b/stdio-common/tst-printf-format-v.h @@ -0,0 +1,34 @@ +/* Test feature wrapper for formatted 'vprintf' output. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <stdarg.h> +#include <stdio.h> + +static int +printf_under_test (const char *restrict fmt, ...) +{ + va_list ap; + int result; + + va_start (ap, fmt); + result = vprintf (fmt, ap); + va_end (ap); + if (result < 0) + perror ("vprintf"); + return result; +} diff --git a/stdio-common/tst-printf-format-vas-c.c b/stdio-common/tst-printf-format-vas-c.c new file mode 100644 index 0000000..5a7a850 --- /dev/null +++ b/stdio-common/tst-printf-format-vas-c.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vasprintf' output for the 'c' conversion. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vas.h" +#include "tst-printf-format-skeleton-c.c" diff --git a/stdio-common/tst-printf-format-vas-char.c b/stdio-common/tst-printf-format-vas-char.c new file mode 100644 index 0000000..457ffe3 --- /dev/null +++ b/stdio-common/tst-printf-format-vas-char.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vasprintf' output for signed char conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vas.h" +#include "tst-printf-format-skeleton-char.c" diff --git a/stdio-common/tst-printf-format-vas-double.c b/stdio-common/tst-printf-format-vas-double.c new file mode 100644 index 0000000..9e61883 --- /dev/null +++ b/stdio-common/tst-printf-format-vas-double.c @@ -0,0 +1,22 @@ +/* Test for formatted 'vasprintf' output for double conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#define TIMEOUT (DEFAULT_TIMEOUT * 32) + +#include "tst-printf-format-vas.h" +#include "tst-printf-format-skeleton-double.c" diff --git a/stdio-common/tst-printf-format-vas-int.c b/stdio-common/tst-printf-format-vas-int.c new file mode 100644 index 0000000..a39e2d8 --- /dev/null +++ b/stdio-common/tst-printf-format-vas-int.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vasprintf' output for int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vas.h" +#include "tst-printf-format-skeleton-int.c" diff --git a/stdio-common/tst-printf-format-vas-ldouble.c b/stdio-common/tst-printf-format-vas-ldouble.c new file mode 100644 index 0000000..bbb8399 --- /dev/null +++ b/stdio-common/tst-printf-format-vas-ldouble.c @@ -0,0 +1,22 @@ +/* Test for formatted 'vasprintf' output for long double conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#define TIMEOUT (DEFAULT_TIMEOUT * 128) + +#include "tst-printf-format-vas.h" +#include "tst-printf-format-skeleton-ldouble.c" diff --git a/stdio-common/tst-printf-format-vas-llong.c b/stdio-common/tst-printf-format-vas-llong.c new file mode 100644 index 0000000..ec1dab5 --- /dev/null +++ b/stdio-common/tst-printf-format-vas-llong.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vasprintf' output for long long int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vas.h" +#include "tst-printf-format-skeleton-llong.c" diff --git a/stdio-common/tst-printf-format-vas-long.c b/stdio-common/tst-printf-format-vas-long.c new file mode 100644 index 0000000..05b893f --- /dev/null +++ b/stdio-common/tst-printf-format-vas-long.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vasprintf' output for long int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vas.h" +#include "tst-printf-format-skeleton-long.c" diff --git a/stdio-common/tst-printf-format-vas-s.c b/stdio-common/tst-printf-format-vas-s.c new file mode 100644 index 0000000..ec4d176 --- /dev/null +++ b/stdio-common/tst-printf-format-vas-s.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vasprintf' output for the 's' conversion. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vas.h" +#include "tst-printf-format-skeleton-s.c" diff --git a/stdio-common/tst-printf-format-vas-short.c b/stdio-common/tst-printf-format-vas-short.c new file mode 100644 index 0000000..c044e5e --- /dev/null +++ b/stdio-common/tst-printf-format-vas-short.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vasprintf' output for short int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vas.h" +#include "tst-printf-format-skeleton-short.c" diff --git a/stdio-common/tst-printf-format-vas-uchar.c b/stdio-common/tst-printf-format-vas-uchar.c new file mode 100644 index 0000000..b4b1be9 --- /dev/null +++ b/stdio-common/tst-printf-format-vas-uchar.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vasprintf' output for unsigned char conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vas.h" +#include "tst-printf-format-skeleton-uchar.c" diff --git a/stdio-common/tst-printf-format-vas-uint.c b/stdio-common/tst-printf-format-vas-uint.c new file mode 100644 index 0000000..8d90103 --- /dev/null +++ b/stdio-common/tst-printf-format-vas-uint.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vasprintf' output for unsigned int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vas.h" +#include "tst-printf-format-skeleton-uint.c" diff --git a/stdio-common/tst-printf-format-vas-ullong.c b/stdio-common/tst-printf-format-vas-ullong.c new file mode 100644 index 0000000..79b3404 --- /dev/null +++ b/stdio-common/tst-printf-format-vas-ullong.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vasprintf' output for unsigned long long int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vas.h" +#include "tst-printf-format-skeleton-ullong.c" diff --git a/stdio-common/tst-printf-format-vas-ulong.c b/stdio-common/tst-printf-format-vas-ulong.c new file mode 100644 index 0000000..5cb97bb --- /dev/null +++ b/stdio-common/tst-printf-format-vas-ulong.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vasprintf' output for unsigned long int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vas.h" +#include "tst-printf-format-skeleton-ulong.c" diff --git a/stdio-common/tst-printf-format-vas-ushort.c b/stdio-common/tst-printf-format-vas-ushort.c new file mode 100644 index 0000000..99b4c66 --- /dev/null +++ b/stdio-common/tst-printf-format-vas-ushort.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vasprintf' output for unsigned short int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vas.h" +#include "tst-printf-format-skeleton-ushort.c" diff --git a/stdio-common/tst-printf-format-vas.h b/stdio-common/tst-printf-format-vas.h new file mode 100644 index 0000000..8ed29f7 --- /dev/null +++ b/stdio-common/tst-printf-format-vas.h @@ -0,0 +1,50 @@ +/* Test feature wrapper for formatted 'vasprintf' output. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <stdarg.h> +#include <stdio.h> +#include <stdlib.h> + +static int +printf_under_test (const char *restrict fmt, ...) +{ + va_list ap; + int result; + char *str; + + va_start (ap, fmt); + result = vasprintf (&str, fmt, ap); + va_end (ap); + if (result < 0) + { + perror ("vasprintf"); + goto out; + } + if (fwrite (str, sizeof (*str), result, stdout) != result) + { + perror ("fwrite"); + result = -1; + } + free (str); +out: + return result; +} + +#ifndef TIMEOUT +# define TIMEOUT (DEFAULT_TIMEOUT * 12) +#endif diff --git a/stdio-common/tst-printf-format-vd-c.c b/stdio-common/tst-printf-format-vd-c.c new file mode 100644 index 0000000..a00320d --- /dev/null +++ b/stdio-common/tst-printf-format-vd-c.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vdprintf' output for the 'c' conversion. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vd.h" +#include "tst-printf-format-skeleton-c.c" diff --git a/stdio-common/tst-printf-format-vd-char.c b/stdio-common/tst-printf-format-vd-char.c new file mode 100644 index 0000000..cb5565c --- /dev/null +++ b/stdio-common/tst-printf-format-vd-char.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vdprintf' output for signed char conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vd.h" +#include "tst-printf-format-skeleton-char.c" diff --git a/stdio-common/tst-printf-format-vd-double.c b/stdio-common/tst-printf-format-vd-double.c new file mode 100644 index 0000000..93bbdc1 --- /dev/null +++ b/stdio-common/tst-printf-format-vd-double.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vdprintf' output for double conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vd.h" +#include "tst-printf-format-skeleton-double.c" diff --git a/stdio-common/tst-printf-format-vd-int.c b/stdio-common/tst-printf-format-vd-int.c new file mode 100644 index 0000000..667c8e0 --- /dev/null +++ b/stdio-common/tst-printf-format-vd-int.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vdprintf' output for int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vd.h" +#include "tst-printf-format-skeleton-int.c" diff --git a/stdio-common/tst-printf-format-vd-ldouble.c b/stdio-common/tst-printf-format-vd-ldouble.c new file mode 100644 index 0000000..bfb611b --- /dev/null +++ b/stdio-common/tst-printf-format-vd-ldouble.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vdprintf' output for long double conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vd.h" +#include "tst-printf-format-skeleton-ldouble.c" diff --git a/stdio-common/tst-printf-format-vd-llong.c b/stdio-common/tst-printf-format-vd-llong.c new file mode 100644 index 0000000..b013db3 --- /dev/null +++ b/stdio-common/tst-printf-format-vd-llong.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vdprintf' output for long long int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vd.h" +#include "tst-printf-format-skeleton-llong.c" diff --git a/stdio-common/tst-printf-format-vd-long.c b/stdio-common/tst-printf-format-vd-long.c new file mode 100644 index 0000000..0f9ee13 --- /dev/null +++ b/stdio-common/tst-printf-format-vd-long.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vdprintf' output for long int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vd.h" +#include "tst-printf-format-skeleton-long.c" diff --git a/stdio-common/tst-printf-format-vd-s.c b/stdio-common/tst-printf-format-vd-s.c new file mode 100644 index 0000000..0dcedbb --- /dev/null +++ b/stdio-common/tst-printf-format-vd-s.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vdprintf' output for the 's' conversion. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vd.h" +#include "tst-printf-format-skeleton-s.c" diff --git a/stdio-common/tst-printf-format-vd-short.c b/stdio-common/tst-printf-format-vd-short.c new file mode 100644 index 0000000..a5e91b2 --- /dev/null +++ b/stdio-common/tst-printf-format-vd-short.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vdprintf' output for short int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vd.h" +#include "tst-printf-format-skeleton-short.c" diff --git a/stdio-common/tst-printf-format-vd-uchar.c b/stdio-common/tst-printf-format-vd-uchar.c new file mode 100644 index 0000000..a29e74c --- /dev/null +++ b/stdio-common/tst-printf-format-vd-uchar.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vdprintf' output for unsigned char conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vd.h" +#include "tst-printf-format-skeleton-uchar.c" diff --git a/stdio-common/tst-printf-format-vd-uint.c b/stdio-common/tst-printf-format-vd-uint.c new file mode 100644 index 0000000..ebb94c1 --- /dev/null +++ b/stdio-common/tst-printf-format-vd-uint.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vdprintf' output for unsigned int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vd.h" +#include "tst-printf-format-skeleton-uint.c" diff --git a/stdio-common/tst-printf-format-vd-ullong.c b/stdio-common/tst-printf-format-vd-ullong.c new file mode 100644 index 0000000..dbe3950 --- /dev/null +++ b/stdio-common/tst-printf-format-vd-ullong.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vdprintf' output for unsigned long long int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vd.h" +#include "tst-printf-format-skeleton-ullong.c" diff --git a/stdio-common/tst-printf-format-vd-ulong.c b/stdio-common/tst-printf-format-vd-ulong.c new file mode 100644 index 0000000..ce55477 --- /dev/null +++ b/stdio-common/tst-printf-format-vd-ulong.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vdprintf' output for unsigned long int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vd.h" +#include "tst-printf-format-skeleton-ulong.c" diff --git a/stdio-common/tst-printf-format-vd-ushort.c b/stdio-common/tst-printf-format-vd-ushort.c new file mode 100644 index 0000000..ab08c8e --- /dev/null +++ b/stdio-common/tst-printf-format-vd-ushort.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vdprintf' output for unsigned short int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vd.h" +#include "tst-printf-format-skeleton-ushort.c" diff --git a/stdio-common/tst-printf-format-vd.h b/stdio-common/tst-printf-format-vd.h new file mode 100644 index 0000000..eb2f057 --- /dev/null +++ b/stdio-common/tst-printf-format-vd.h @@ -0,0 +1,62 @@ +/* Test feature wrapper for formatted 'vdprintf' output. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <stdarg.h> +#include <stdio.h> +#include <unistd.h> + +/* We need to go through the POSIX-mandated dance to switch between + handles on an open file description. */ + +static int +printf_under_test (const char *restrict fmt, ...) +{ + va_list ap; + int result; + + result = fflush (stdout); + if (result == EOF) + { + perror ("fflush"); + goto out; + } + result = lseek (STDOUT_FILENO, 0, SEEK_END); + if (result < 0 && errno == ESPIPE) + result = 0; + if (result < 0) + { + perror ("lseek"); + goto out; + } + va_start (ap, fmt); + result = vdprintf (STDOUT_FILENO, fmt, ap); + va_end (ap); + if (result < 0) + { + perror ("vdprintf"); + goto out; + } + result = fseek (stdout, 0, SEEK_END); + if (result < 0 && errno == ESPIPE) + result = 0; + if (result < 0) + perror ("fseek"); +out: + return result; +} diff --git a/stdio-common/tst-printf-format-vf-c.c b/stdio-common/tst-printf-format-vf-c.c new file mode 100644 index 0000000..56fc751 --- /dev/null +++ b/stdio-common/tst-printf-format-vf-c.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vfprintf' output for the 'c' conversion. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vf.h" +#include "tst-printf-format-skeleton-c.c" diff --git a/stdio-common/tst-printf-format-vf-char.c b/stdio-common/tst-printf-format-vf-char.c new file mode 100644 index 0000000..48e5dc6 --- /dev/null +++ b/stdio-common/tst-printf-format-vf-char.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vfprintf' output for signed char conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vf.h" +#include "tst-printf-format-skeleton-char.c" diff --git a/stdio-common/tst-printf-format-vf-double.c b/stdio-common/tst-printf-format-vf-double.c new file mode 100644 index 0000000..6b6b467 --- /dev/null +++ b/stdio-common/tst-printf-format-vf-double.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vfprintf' output for double conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vf.h" +#include "tst-printf-format-skeleton-double.c" diff --git a/stdio-common/tst-printf-format-vf-int.c b/stdio-common/tst-printf-format-vf-int.c new file mode 100644 index 0000000..df8e769b --- /dev/null +++ b/stdio-common/tst-printf-format-vf-int.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vfprintf' output for int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vf.h" +#include "tst-printf-format-skeleton-int.c" diff --git a/stdio-common/tst-printf-format-vf-ldouble.c b/stdio-common/tst-printf-format-vf-ldouble.c new file mode 100644 index 0000000..93acdae --- /dev/null +++ b/stdio-common/tst-printf-format-vf-ldouble.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vfprintf' output for long double conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vf.h" +#include "tst-printf-format-skeleton-ldouble.c" diff --git a/stdio-common/tst-printf-format-vf-llong.c b/stdio-common/tst-printf-format-vf-llong.c new file mode 100644 index 0000000..85d5a88 --- /dev/null +++ b/stdio-common/tst-printf-format-vf-llong.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vfprintf' output for long long int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vf.h" +#include "tst-printf-format-skeleton-llong.c" diff --git a/stdio-common/tst-printf-format-vf-long.c b/stdio-common/tst-printf-format-vf-long.c new file mode 100644 index 0000000..89fa0fe --- /dev/null +++ b/stdio-common/tst-printf-format-vf-long.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vfprintf' output for long int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vf.h" +#include "tst-printf-format-skeleton-long.c" diff --git a/stdio-common/tst-printf-format-vf-s.c b/stdio-common/tst-printf-format-vf-s.c new file mode 100644 index 0000000..d717ff1 --- /dev/null +++ b/stdio-common/tst-printf-format-vf-s.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vfprintf' output for the 's' conversion. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vf.h" +#include "tst-printf-format-skeleton-s.c" diff --git a/stdio-common/tst-printf-format-vf-short.c b/stdio-common/tst-printf-format-vf-short.c new file mode 100644 index 0000000..76e83b4 --- /dev/null +++ b/stdio-common/tst-printf-format-vf-short.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vfprintf' output for short int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vf.h" +#include "tst-printf-format-skeleton-short.c" diff --git a/stdio-common/tst-printf-format-vf-uchar.c b/stdio-common/tst-printf-format-vf-uchar.c new file mode 100644 index 0000000..b7d2788 --- /dev/null +++ b/stdio-common/tst-printf-format-vf-uchar.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vfprintf' output for unsigned char conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vf.h" +#include "tst-printf-format-skeleton-uchar.c" diff --git a/stdio-common/tst-printf-format-vf-uint.c b/stdio-common/tst-printf-format-vf-uint.c new file mode 100644 index 0000000..a744558 --- /dev/null +++ b/stdio-common/tst-printf-format-vf-uint.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vfprintf' output for unsigned int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vf.h" +#include "tst-printf-format-skeleton-uint.c" diff --git a/stdio-common/tst-printf-format-vf-ullong.c b/stdio-common/tst-printf-format-vf-ullong.c new file mode 100644 index 0000000..04bfb4e --- /dev/null +++ b/stdio-common/tst-printf-format-vf-ullong.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vfprintf' output for unsigned long long int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vf.h" +#include "tst-printf-format-skeleton-ullong.c" diff --git a/stdio-common/tst-printf-format-vf-ulong.c b/stdio-common/tst-printf-format-vf-ulong.c new file mode 100644 index 0000000..d435f42 --- /dev/null +++ b/stdio-common/tst-printf-format-vf-ulong.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vfprintf' output for unsigned long int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vf.h" +#include "tst-printf-format-skeleton-ulong.c" diff --git a/stdio-common/tst-printf-format-vf-ushort.c b/stdio-common/tst-printf-format-vf-ushort.c new file mode 100644 index 0000000..1920421 --- /dev/null +++ b/stdio-common/tst-printf-format-vf-ushort.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vfprintf' output for unsigned short int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vf.h" +#include "tst-printf-format-skeleton-ushort.c" diff --git a/stdio-common/tst-printf-format-vf.h b/stdio-common/tst-printf-format-vf.h new file mode 100644 index 0000000..4589b22 --- /dev/null +++ b/stdio-common/tst-printf-format-vf.h @@ -0,0 +1,34 @@ +/* Test feature wrapper for formatted 'vfprintf' output. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <stdarg.h> +#include <stdio.h> + +static int +printf_under_test (const char *restrict fmt, ...) +{ + va_list ap; + int result; + + va_start (ap, fmt); + result = vfprintf (stdout, fmt, ap); + va_end (ap); + if (result < 0) + perror ("vfprintf"); + return result; +} diff --git a/stdio-common/tst-printf-format-vs-c.c b/stdio-common/tst-printf-format-vs-c.c new file mode 100644 index 0000000..5d6ffbe --- /dev/null +++ b/stdio-common/tst-printf-format-vs-c.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vsprintf' output for the 'c' conversion. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vs.h" +#include "tst-printf-format-skeleton-c.c" diff --git a/stdio-common/tst-printf-format-vs-char.c b/stdio-common/tst-printf-format-vs-char.c new file mode 100644 index 0000000..bf53b32 --- /dev/null +++ b/stdio-common/tst-printf-format-vs-char.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vsprintf' output for signed char conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vs.h" +#include "tst-printf-format-skeleton-char.c" diff --git a/stdio-common/tst-printf-format-vs-double.c b/stdio-common/tst-printf-format-vs-double.c new file mode 100644 index 0000000..9b8c4bb --- /dev/null +++ b/stdio-common/tst-printf-format-vs-double.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vsprintf' output for double conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vs.h" +#include "tst-printf-format-skeleton-double.c" diff --git a/stdio-common/tst-printf-format-vs-int.c b/stdio-common/tst-printf-format-vs-int.c new file mode 100644 index 0000000..27ff5df --- /dev/null +++ b/stdio-common/tst-printf-format-vs-int.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vsprintf' output for int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vs.h" +#include "tst-printf-format-skeleton-int.c" diff --git a/stdio-common/tst-printf-format-vs-ldouble.c b/stdio-common/tst-printf-format-vs-ldouble.c new file mode 100644 index 0000000..8cc921f --- /dev/null +++ b/stdio-common/tst-printf-format-vs-ldouble.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vsprintf' output for long double conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vs.h" +#include "tst-printf-format-skeleton-ldouble.c" diff --git a/stdio-common/tst-printf-format-vs-llong.c b/stdio-common/tst-printf-format-vs-llong.c new file mode 100644 index 0000000..244d546 --- /dev/null +++ b/stdio-common/tst-printf-format-vs-llong.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vsprintf' output for long long int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vs.h" +#include "tst-printf-format-skeleton-llong.c" diff --git a/stdio-common/tst-printf-format-vs-long.c b/stdio-common/tst-printf-format-vs-long.c new file mode 100644 index 0000000..fc9daa8 --- /dev/null +++ b/stdio-common/tst-printf-format-vs-long.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vsprintf' output for long int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vs.h" +#include "tst-printf-format-skeleton-long.c" diff --git a/stdio-common/tst-printf-format-vs-s.c b/stdio-common/tst-printf-format-vs-s.c new file mode 100644 index 0000000..7c350fa --- /dev/null +++ b/stdio-common/tst-printf-format-vs-s.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vsprintf' output for the 's' conversion. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vs.h" +#include "tst-printf-format-skeleton-s.c" diff --git a/stdio-common/tst-printf-format-vs-short.c b/stdio-common/tst-printf-format-vs-short.c new file mode 100644 index 0000000..60c8367 --- /dev/null +++ b/stdio-common/tst-printf-format-vs-short.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vsprintf' output for short int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vs.h" +#include "tst-printf-format-skeleton-short.c" diff --git a/stdio-common/tst-printf-format-vs-uchar.c b/stdio-common/tst-printf-format-vs-uchar.c new file mode 100644 index 0000000..56be1ba --- /dev/null +++ b/stdio-common/tst-printf-format-vs-uchar.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vsprintf' output for unsigned char conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vs.h" +#include "tst-printf-format-skeleton-uchar.c" diff --git a/stdio-common/tst-printf-format-vs-uint.c b/stdio-common/tst-printf-format-vs-uint.c new file mode 100644 index 0000000..ea1d7ee --- /dev/null +++ b/stdio-common/tst-printf-format-vs-uint.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vsprintf' output for unsigned int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vs.h" +#include "tst-printf-format-skeleton-uint.c" diff --git a/stdio-common/tst-printf-format-vs-ullong.c b/stdio-common/tst-printf-format-vs-ullong.c new file mode 100644 index 0000000..69dca14 --- /dev/null +++ b/stdio-common/tst-printf-format-vs-ullong.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vsprintf' output for unsigned long long int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vs.h" +#include "tst-printf-format-skeleton-ullong.c" diff --git a/stdio-common/tst-printf-format-vs-ulong.c b/stdio-common/tst-printf-format-vs-ulong.c new file mode 100644 index 0000000..5110b5b --- /dev/null +++ b/stdio-common/tst-printf-format-vs-ulong.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vsprintf' output for unsigned long int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vs.h" +#include "tst-printf-format-skeleton-ulong.c" diff --git a/stdio-common/tst-printf-format-vs-ushort.c b/stdio-common/tst-printf-format-vs-ushort.c new file mode 100644 index 0000000..d642159 --- /dev/null +++ b/stdio-common/tst-printf-format-vs-ushort.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vsprintf' output for unsigned short int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vs.h" +#include "tst-printf-format-skeleton-ushort.c" diff --git a/stdio-common/tst-printf-format-vs.h b/stdio-common/tst-printf-format-vs.h new file mode 100644 index 0000000..f99747a --- /dev/null +++ b/stdio-common/tst-printf-format-vs.h @@ -0,0 +1,64 @@ +/* Test feature wrapper for formatted 'vsprintf' output. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <stdarg.h> +#include <stdio.h> +#include <stdlib.h> + +#include <support/next_to_fault.h> + +#define SPRINTF_BUFFER_SIZE 65536 + +static struct support_next_to_fault ntf; + +#define PREPARE printf_under_test_init +static void +printf_under_test_init (int argc, char **argv) +{ + ntf = support_next_to_fault_allocate (SPRINTF_BUFFER_SIZE); +} + +static void __attribute__ ((destructor)) +printf_under_test_fini (void) +{ + support_next_to_fault_free (&ntf); +} + +static int +printf_under_test (const char *restrict fmt, ...) +{ + char *str = ntf.buffer; + va_list ap; + int result; + + va_start (ap, fmt); + result = vsprintf (str, fmt, ap); + va_end (ap); + if (result < 0) + { + perror ("vsprintf"); + goto out; + } + if (fwrite (str, sizeof (*str), result, stdout) != result) + { + perror ("fwrite"); + result = -1; + } +out: + return result; +} diff --git a/stdio-common/tst-printf-format-vsn-c.c b/stdio-common/tst-printf-format-vsn-c.c new file mode 100644 index 0000000..916ae32 --- /dev/null +++ b/stdio-common/tst-printf-format-vsn-c.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vsnprintf' output for the 'c' conversion. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vsn.h" +#include "tst-printf-format-skeleton-c.c" diff --git a/stdio-common/tst-printf-format-vsn-char.c b/stdio-common/tst-printf-format-vsn-char.c new file mode 100644 index 0000000..233ed66 --- /dev/null +++ b/stdio-common/tst-printf-format-vsn-char.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vsnprintf' output for signed char conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vsn.h" +#include "tst-printf-format-skeleton-char.c" diff --git a/stdio-common/tst-printf-format-vsn-double.c b/stdio-common/tst-printf-format-vsn-double.c new file mode 100644 index 0000000..9255f5e --- /dev/null +++ b/stdio-common/tst-printf-format-vsn-double.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vsnprintf' output for double conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vsn.h" +#include "tst-printf-format-skeleton-double.c" diff --git a/stdio-common/tst-printf-format-vsn-int.c b/stdio-common/tst-printf-format-vsn-int.c new file mode 100644 index 0000000..e1d2549 --- /dev/null +++ b/stdio-common/tst-printf-format-vsn-int.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vsnprintf' output for int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vsn.h" +#include "tst-printf-format-skeleton-int.c" diff --git a/stdio-common/tst-printf-format-vsn-ldouble.c b/stdio-common/tst-printf-format-vsn-ldouble.c new file mode 100644 index 0000000..3f17ee4 --- /dev/null +++ b/stdio-common/tst-printf-format-vsn-ldouble.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vsnprintf' output for long double conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vsn.h" +#include "tst-printf-format-skeleton-ldouble.c" diff --git a/stdio-common/tst-printf-format-vsn-llong.c b/stdio-common/tst-printf-format-vsn-llong.c new file mode 100644 index 0000000..4e69306 --- /dev/null +++ b/stdio-common/tst-printf-format-vsn-llong.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vsnprintf' output for long long int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vsn.h" +#include "tst-printf-format-skeleton-llong.c" diff --git a/stdio-common/tst-printf-format-vsn-long.c b/stdio-common/tst-printf-format-vsn-long.c new file mode 100644 index 0000000..8029bf0 --- /dev/null +++ b/stdio-common/tst-printf-format-vsn-long.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vsnprintf' output for long int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vsn.h" +#include "tst-printf-format-skeleton-long.c" diff --git a/stdio-common/tst-printf-format-vsn-s.c b/stdio-common/tst-printf-format-vsn-s.c new file mode 100644 index 0000000..d52788d --- /dev/null +++ b/stdio-common/tst-printf-format-vsn-s.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vsnprintf' output for the 's' conversion. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vsn.h" +#include "tst-printf-format-skeleton-s.c" diff --git a/stdio-common/tst-printf-format-vsn-short.c b/stdio-common/tst-printf-format-vsn-short.c new file mode 100644 index 0000000..ded7609 --- /dev/null +++ b/stdio-common/tst-printf-format-vsn-short.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vsnprintf' output for short int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vsn.h" +#include "tst-printf-format-skeleton-short.c" diff --git a/stdio-common/tst-printf-format-vsn-uchar.c b/stdio-common/tst-printf-format-vsn-uchar.c new file mode 100644 index 0000000..a7a3854 --- /dev/null +++ b/stdio-common/tst-printf-format-vsn-uchar.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vsnprintf' output for unsigned char conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vsn.h" +#include "tst-printf-format-skeleton-uchar.c" diff --git a/stdio-common/tst-printf-format-vsn-uint.c b/stdio-common/tst-printf-format-vsn-uint.c new file mode 100644 index 0000000..d6c5a19 --- /dev/null +++ b/stdio-common/tst-printf-format-vsn-uint.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vsnprintf' output for unsigned int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vsn.h" +#include "tst-printf-format-skeleton-uint.c" diff --git a/stdio-common/tst-printf-format-vsn-ullong.c b/stdio-common/tst-printf-format-vsn-ullong.c new file mode 100644 index 0000000..3a3c9f2 --- /dev/null +++ b/stdio-common/tst-printf-format-vsn-ullong.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vsnprintf' output for unsigned long long int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vsn.h" +#include "tst-printf-format-skeleton-ullong.c" diff --git a/stdio-common/tst-printf-format-vsn-ulong.c b/stdio-common/tst-printf-format-vsn-ulong.c new file mode 100644 index 0000000..2c94086 --- /dev/null +++ b/stdio-common/tst-printf-format-vsn-ulong.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vsnprintf' output for unsigned long int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vsn.h" +#include "tst-printf-format-skeleton-ulong.c" diff --git a/stdio-common/tst-printf-format-vsn-ushort.c b/stdio-common/tst-printf-format-vsn-ushort.c new file mode 100644 index 0000000..0185c2b --- /dev/null +++ b/stdio-common/tst-printf-format-vsn-ushort.c @@ -0,0 +1,20 @@ +/* Test for formatted 'vsnprintf' output for unsigned short int conversions. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-printf-format-vsn.h" +#include "tst-printf-format-skeleton-ushort.c" diff --git a/stdio-common/tst-printf-format-vsn.h b/stdio-common/tst-printf-format-vsn.h new file mode 100644 index 0000000..c2e3132 --- /dev/null +++ b/stdio-common/tst-printf-format-vsn.h @@ -0,0 +1,64 @@ +/* Test feature wrapper for formatted 'vsnprintf' output. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <stdarg.h> +#include <stdio.h> +#include <stdlib.h> + +#include <support/next_to_fault.h> + +#define SPRINTF_BUFFER_SIZE 65536 + +static struct support_next_to_fault ntf; + +#define PREPARE printf_under_test_init +static void +printf_under_test_init (int argc, char **argv) +{ + ntf = support_next_to_fault_allocate (SPRINTF_BUFFER_SIZE); +} + +static void __attribute__ ((destructor)) +printf_under_test_fini (void) +{ + support_next_to_fault_free (&ntf); +} + +static int +printf_under_test (const char *restrict fmt, ...) +{ + char *str = ntf.buffer; + va_list ap; + int result; + + va_start (ap, fmt); + result = vsnprintf (str, ntf.length, fmt, ap); + va_end (ap); + if (result < 0) + { + perror ("vsnprintf"); + goto out; + } + if (fwrite (str, sizeof (*str), result, stdout) != result) + { + perror ("fwrite"); + result = -1; + } +out: + return result; +} diff --git a/stdio-common/tst-printf-format.awk b/stdio-common/tst-printf-format.awk new file mode 100644 index 0000000..1b02abc --- /dev/null +++ b/stdio-common/tst-printf-format.awk @@ -0,0 +1,127 @@ +# Testing of printf conversions. +# Copyright (C) 2024-2025 Free Software Foundation, Inc. +# This file is part of the GNU C Library. + +# The GNU C Library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. + +# The GNU C Library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public +# License along with the GNU C Library; if not, see +# <https://www.gnu.org/licenses/>. + +BEGIN { + FS = ":" +} + +/^prec:/ { + PREC = $2 + next +} + +/^val:/ { + val = $2 + # Prepend "+" for +Inf or +NaN value lacking a sign, because gawk + # interpretes them as strings rather than numeric values in the + # non-bignum mode unless a sign has been explicitly given. Keep + # original 'val' for reporting. + value = gensub(/^(INF|NAN|inf|nan)/, "+\\1", 1, val) + next +} + +/^%/ { + # Discard the trailing empty field, used to improve legibility of data. + input = $--NF + format = $1 + width = $2 + precision = "." $(NF - 1) + # Discard any negative precision, which is to be taken as if omitted. + sub(/\.-.*/, "", precision) + # Simplify handling and paste the precision and width specified as + # arguments to '*' directly into the format. + sub(/\.\*/, precision, format) + sub(/\*/, width, format) + # Discard length modifiers. They are only relevant to C data types. + sub(/([DHLjhltz]|wf?[1-9][0-9]*)/, "", format) + # Discard the '#' flag with the octal conversion if output starts with + # 0 in the absence of this flag. In that case no extra 0 is supposed + # to be produced, but gawk prepends it anyway. + if (format ~ /#.*o/) + { + tmpfmt = gensub(/#/, "", "g", format) + tmpout = sprintf(tmpfmt, value) + if (tmpout ~ /^ *0/) + format = tmpfmt + } + # Likewise with the hexadecimal conversion where zero value with the + # precision of zero is supposed to produce no characters, but gawk + # outputs 0 instead. + else if (format ~ /#.*[Xx]/) + { + tmpfmt = gensub(/#/, "", "g", format) + tmpout = sprintf(tmpfmt, value) + if (tmpout ~ /^ *$/) + format = tmpfmt + } + # AWK interpretes input opportunistically as a number, which interferes + # with how the 'c' conversion works: "a" input will result in "a" output + # however "0" input will result in "^@" output rather than "0". Force + # the value to be interpreted as a string then, by appending "". + output = sprintf(format, value "") + # Make up for various anomalies with the handling of +/-Inf and +/-NaN + # values and reprint the output produced using the string conversion, + # with the field width carried over and the relevant flags handled by + # hand. + if (format ~ /[EFGefg]/ && value ~ /(INF|NAN|inf|nan)/) + { + minus = format ~ /-/ ? "-" : "" + sign = value ~ /-/ ? "-" : format ~ /\+/ ? "+" : format ~ / / ? " " : "" + if (format ~ /^%[^\.1-9]*[1-9][0-9]*/) + width = gensub(/^%[^\.1-9]*([1-9][0-9]*).*$/, "\\1", 1, format) + else + width = "" + output = gensub(/[-+ ]/, "", "g", output) + output = sprintf("%" minus width "s", sign output) + } + # Produce "+" where the '+' flag has been used with a signed integer + # conversion for zero value, observing any field width in effect. + # In that case "+" is always supposed to be produced, but with the + # precision of zero gawk in the non-bignum mode produces any padding + # requested only. + else if (format ~ /\+.*[di]/ && value == 0) + { + output = gensub(/^( *) $/, format ~ /-/ ? "+\\1" : "\\1+", 1, output) + output = gensub(/^$/, "+", 1, output) + } + # Produce " " where the space flag has been used with a signed integer + # conversion for zero value. In that case at least one " " is + # supposed to be produced, but with the precision of zero gawk in the + # non-bignum mode produces nothing. + else if (format ~ / .*[di]/ && value == 0) + { + output = gensub(/^$/, " ", 1, output) + } + if (output != input) + { + printf "(\"%s\"%s%s, %s) => \"%s\", expected \"%s\"\n", \ + $1, (NF > 2 ? ", " $2 : ""), (NF > 3 ? ", " $3 : ""), val, \ + input, output > "/dev/stderr" + status = 1 + } + next +} + +{ + printf "unrecognized input: \"%s\"\n", $0 > "/dev/stderr" + status = 1 +} + +END { + exit status +} diff --git a/stdio-common/tst-printf-format.sh b/stdio-common/tst-printf-format.sh new file mode 100644 index 0000000..098a235 --- /dev/null +++ b/stdio-common/tst-printf-format.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Formatted printf output test script dispatcher. +# Copyright (C) 2024-2025 Free Software Foundation, Inc. +# This file is part of the GNU C Library. + +# The GNU C Library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. + +# The GNU C Library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public +# License along with the GNU C Library; if not, see +# <https://www.gnu.org/licenses/>. + +set -e + +output=${1##*/}; shift + +tmp=${output#tst-printf-format-} +tmp=${tmp%.out} + +# We are given the name of the make target in $1. With the common prefix +# and suffix both removed we are left with the inner part, which encodes +# the function under test, the conversion type, and optionally the format +# specifier, all separated with hyphens, i.e. F-T-S or F-T. Extract them +# and call the script corresponding to the conversion type, passing the +# function under test and any format specifier as arguments. + +xprintf=${tmp%%-*}; tmp=${tmp#*-} +conv=${tmp%%-*}; tmp=${tmp#${conv}} +fmt=${tmp#*-} +script=tst-printf-format-$conv.sh + +exec ${BASH:-bash} $script $xprintf $fmt "$@" diff --git a/stdio-common/tst-printf-fp-free.c b/stdio-common/tst-printf-fp-free.c index 031a1f5..f2d8d6c 100644 --- a/stdio-common/tst-printf-fp-free.c +++ b/stdio-common/tst-printf-fp-free.c @@ -1,5 +1,5 @@ /* Test double free bug in __printf_fp_l (bug 26214). - Copyright (C) 2020-2024 Free Software Foundation, Inc. + Copyright (C) 2020-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/tst-printf-fp-leak.c b/stdio-common/tst-printf-fp-leak.c index 9c03420..fa50db0 100644 --- a/stdio-common/tst-printf-fp-leak.c +++ b/stdio-common/tst-printf-fp-leak.c @@ -1,5 +1,5 @@ /* Test memory leak in __printf_fp_l (bug 26215). - Copyright (C) 2020-2024 Free Software Foundation, Inc. + Copyright (C) 2020-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/tst-printf-intn-main.c b/stdio-common/tst-printf-intn-main.c index 7db258d..aa8fcc9 100644 --- a/stdio-common/tst-printf-intn-main.c +++ b/stdio-common/tst-printf-intn-main.c @@ -1,5 +1,5 @@ /* Test printf formats for intN_t, int_leastN_t and int_fastN_t types. - Copyright (C) 2023-2024 Free Software Foundation, Inc. + Copyright (C) 2023-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/tst-printf-intn.c b/stdio-common/tst-printf-intn.c index 8d73391..f14bc45 100644 --- a/stdio-common/tst-printf-intn.c +++ b/stdio-common/tst-printf-intn.c @@ -1,6 +1,6 @@ /* Test printf formats for intN_t, int_leastN_t and int_fastN_t types. Narrow string version. - Copyright (C) 2023-2024 Free Software Foundation, Inc. + Copyright (C) 2023-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/tst-printf-oct.c b/stdio-common/tst-printf-oct.c index d525b60..6d0ed4a 100644 --- a/stdio-common/tst-printf-oct.c +++ b/stdio-common/tst-printf-oct.c @@ -1,5 +1,5 @@ /* Test printf width padding with octal format - Copyright (C) 2023-2024 Free Software Foundation, Inc. + Copyright (C) 2023-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/tst-printf-round.c b/stdio-common/tst-printf-round.c index 7581a4a..2441dbf 100644 --- a/stdio-common/tst-printf-round.c +++ b/stdio-common/tst-printf-round.c @@ -1,5 +1,5 @@ /* Test for correct rounding of printf floating-point output. - Copyright (C) 2012-2024 Free Software Foundation, Inc. + Copyright (C) 2012-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/tst-printf.c b/stdio-common/tst-printf.c index 0012270..8ed54e1 100644 --- a/stdio-common/tst-printf.c +++ b/stdio-common/tst-printf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2024 Free Software Foundation, Inc. +/* Copyright (C) 1991-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/tst-printf.sh b/stdio-common/tst-printf.sh index cfcc4e3..e30d986 100644 --- a/stdio-common/tst-printf.sh +++ b/stdio-common/tst-printf.sh @@ -1,6 +1,6 @@ #!/bin/sh # Testing of printf. -# Copyright (C) 2000-2024 Free Software Foundation, Inc. +# Copyright (C) 2000-2025 Free Software Foundation, Inc. # This file is part of the GNU C Library. # The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/tst-printfsz-islongdouble.c b/stdio-common/tst-printfsz-islongdouble.c index 3777dd8..6c34d46 100644 --- a/stdio-common/tst-printfsz-islongdouble.c +++ b/stdio-common/tst-printfsz-islongdouble.c @@ -1,5 +1,5 @@ /* Test for the behaviour of 'is_long_double' in printf_size. - Copyright (C) 2018-2024 Free Software Foundation, Inc. + Copyright (C) 2018-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/tst-printfsz-islongdouble.sh b/stdio-common/tst-printfsz-islongdouble.sh index 6e0fb06..d2456bd 100644 --- a/stdio-common/tst-printfsz-islongdouble.sh +++ b/stdio-common/tst-printfsz-islongdouble.sh @@ -1,6 +1,6 @@ #!/bin/sh # Test for the behaviour of 'is_binary128' in printf_size. -# Copyright (C) 2018-2024 Free Software Foundation, Inc. +# Copyright (C) 2018-2025 Free Software Foundation, Inc. # This file is part of the GNU C Library. # The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/tst-put-error.c b/stdio-common/tst-put-error.c index 1b17732..d23efbf 100644 --- a/stdio-common/tst-put-error.c +++ b/stdio-common/tst-put-error.c @@ -1,6 +1,6 @@ /* Verify that print functions return error when there is an I/O error. - Copyright (C) 2005-2024 Free Software Foundation, Inc. + Copyright (C) 2005-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/tst-read-offset.c b/stdio-common/tst-read-offset.c new file mode 100644 index 0000000..b870660 --- /dev/null +++ b/stdio-common/tst-read-offset.c @@ -0,0 +1,560 @@ +/* Test offsets in files being read, in particular with ungetc. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <dlfcn.h> +#include <stdbool.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + +#include <support/check.h> +#include <support/temp_file.h> +#include <support/xstdio.h> +#include <support/xunistd.h> + +static volatile bool fail = false; + +/* Induce a malloc failure whenever FAIL is set. */ +void * +malloc (size_t sz) +{ + if (fail) + return NULL; + + static void *(*real_malloc) (size_t); + + if (real_malloc == NULL) + real_malloc = dlsym (RTLD_NEXT, "malloc"); + + return real_malloc (sz); +} + +/* The name of the temporary file used by all the tests. */ +static char *filename; + +/* st_blksize value for that file, or BUFSIZ if out of range. */ +static int blksize = BUFSIZ; + +/* Test data, both written to that file and used as an in-memory + stream. */ +char test_data[2 * BUFSIZ]; + +/* Ways to open a test stream for reading (that may use different code + paths in libio). */ +enum test_open_case + { + test_open_fopen, + test_open_fopen_m, + test_open_fopen64, + test_open_fopen64_m, + test_open_fmemopen, + test_open_max + }; + +static const char *const test_open_case_name[test_open_max] = + { + "fopen", "fopen(mmap)", "fopen64", "fopen64(mmap)", "fmemopen" + }; + +static FILE * +open_test_stream (enum test_open_case c) +{ + FILE *fp; + switch (c) + { + case test_open_fopen: + fp = fopen (filename, "r"); + break; + + case test_open_fopen_m: + fp = fopen (filename, "rm"); + break; + + case test_open_fopen64: + fp = fopen64 (filename, "r"); + break; + + case test_open_fopen64_m: + fp = fopen64 (filename, "rm"); + break; + + case test_open_fmemopen: + fp = fmemopen (test_data, 2 * BUFSIZ, "r"); + break; + + default: + abort (); + } + TEST_VERIFY_EXIT (fp != NULL); + return fp; +} + +/* Base locations at which the main test (ungetc calls then doing + something that clears ungetc characters, then checking offset) + starts. */ +enum test_base_loc + { + base_loc_start, + base_loc_blksize, + base_loc_half, + base_loc_bufsiz, + base_loc_eof, + base_loc_max + }; + +static int +base_loc_to_bytes (enum test_base_loc loc, int offset) +{ + switch (loc) + { + case base_loc_start: + return offset; + + case base_loc_blksize: + return blksize + offset; + + case base_loc_half: + return BUFSIZ / 2 + offset; + + case base_loc_bufsiz: + return BUFSIZ + offset; + + case base_loc_eof: + return 2 * BUFSIZ + offset; + + default: + abort (); + } +} + +/* Ways to clear data from ungetc. */ +enum clear_ungetc_case + { + clear_fseek, + clear_fseekm1, + clear_fseekp1, + clear_fseeko, + clear_fseekom1, + clear_fseekop1, + clear_fseeko64, + clear_fseeko64m1, + clear_fseeko64p1, + clear_fsetpos, + clear_fsetposu, + clear_fsetpos64, + clear_fsetpos64u, + clear_fflush, + clear_fflush_null, + clear_fclose, + clear_max + }; + +static const char *const clear_ungetc_case_name[clear_max] = + { + "fseek", "fseek(-1)", "fseek(1)", "fseeko", "fseeko(-1)", "fseeko(1)", + "fseeko64", "fseeko64(-1)", "fseeko64(1)", "fsetpos", "fsetpos(before)", + "fsetpos64", "fsetpos64(before)", "fflush", "fflush(NULL)", "fclose" + }; + +static int +clear_offset (enum clear_ungetc_case c, int num_ungetc) +{ + switch (c) + { + case clear_fseekm1: + case clear_fseekom1: + case clear_fseeko64m1: + return -1; + + case clear_fseekp1: + case clear_fseekop1: + case clear_fseeko64p1: + return 1; + + case clear_fsetposu: + case clear_fsetpos64u: + return num_ungetc; + + default: + return 0; + } +} + +/* The offsets used with fsetpos / fsetpos64. */ +static fpos_t pos; +static fpos64_t pos64; + +static int +do_clear_ungetc (FILE *fp, enum clear_ungetc_case c, int num_ungetc) +{ + int ret; + int offset = clear_offset (c, num_ungetc); + switch (c) + { + case clear_fseek: + case clear_fseekm1: + case clear_fseekp1: + ret = fseek (fp, offset, SEEK_CUR); + break; + + case clear_fseeko: + case clear_fseekom1: + case clear_fseekop1: + ret = fseeko (fp, offset, SEEK_CUR); + break; + + case clear_fseeko64: + case clear_fseeko64m1: + case clear_fseeko64p1: + ret = fseeko64 (fp, offset, SEEK_CUR); + break; + + case clear_fsetpos: + case clear_fsetposu: + ret = fsetpos (fp, &pos); + break; + + case clear_fsetpos64: + case clear_fsetpos64u: + ret = fsetpos64 (fp, &pos64); + break; + + case clear_fflush: + ret = fflush (fp); + break; + + case clear_fflush_null: + ret = fflush (NULL); + break; + + case clear_fclose: + ret = fclose (fp); + break; + + default: + abort(); + } + TEST_COMPARE (ret, 0); + return offset; +} + +static bool +clear_valid (enum test_open_case c, enum clear_ungetc_case cl) +{ + switch (c) + { + case test_open_fmemopen: + /* fflush is not valid for input memory streams, and fclose is + useless for this test for such streams because there is no + underlying open file description for which an offset could be + checked after fclose. */ + switch (cl) + { + case clear_fflush: + case clear_fflush_null: + case clear_fclose: + return false; + + default: + return true; + } + + default: + /* All ways of clearing ungetc state are valid for streams with + an underlying file. */ + return true; + } +} + +static bool +clear_closes_file (enum clear_ungetc_case cl) +{ + switch (cl) + { + case clear_fclose: + return true; + + default: + return false; + } +} + +static void +clear_getpos_before (FILE *fp, enum clear_ungetc_case c) +{ + switch (c) + { + case clear_fsetposu: + TEST_COMPARE (fgetpos (fp, &pos), 0); + break; + + case clear_fsetpos64u: + TEST_COMPARE (fgetpos64 (fp, &pos64), 0); + break; + + default: + break; + } +} + +static void +clear_getpos_after (FILE *fp, enum clear_ungetc_case c) +{ + switch (c) + { + case clear_fsetpos: + TEST_COMPARE (fgetpos (fp, &pos), 0); + break; + + case clear_fsetpos64: + TEST_COMPARE (fgetpos64 (fp, &pos64), 0); + break; + + default: + break; + } +} + +/* Ways to verify results of clearing ungetc data. */ +enum verify_case + { + verify_read, + verify_ftell, + verify_ftello, + verify_ftello64, + verify_fd, + verify_max + }; + +static const char *const verify_case_name[verify_max] = + { + "read", "ftell", "ftello", "ftello64", "fd" + }; + +static bool +valid_fd_offset (enum test_open_case c, enum clear_ungetc_case cl) +{ + switch (c) + { + case test_open_fmemopen: + /* No open file description. */ + return false; + + default: + /* fseek does not necessarily set the offset for the underlying + open file description ("If the most recent operation, other + than ftell(), on a given stream is fflush(), the file offset + in the underlying open file description shall be adjusted to + reflect the location specified by fseek()." in POSIX does not + include the case here where getc was the last operation). + Similarly, fsetpos does not necessarily set that offset + either. */ + switch (cl) + { + case clear_fflush: + case clear_fflush_null: + case clear_fclose: + return true; + + default: + return false; + } + } +} + +static bool +verify_valid (enum test_open_case c, enum clear_ungetc_case cl, + enum verify_case v) +{ + switch (v) + { + case verify_fd: + return valid_fd_offset (c, cl); + + default: + switch (cl) + { + case clear_fclose: + return false; + + default: + return true; + } + } +} + +static bool +verify_uses_fd (enum verify_case v) +{ + switch (v) + { + case verify_fd: + return true; + + default: + return false; + } +} + +static int +read_to_test_loc (FILE *fp, enum test_base_loc loc, int offset) +{ + int to_read = base_loc_to_bytes (loc, offset); + for (int i = 0; i < to_read; i++) + TEST_COMPARE (getc (fp), (unsigned char) i); + return to_read; +} + +static void +setup (void) +{ + int fd = create_temp_file ("tst-read-offset", &filename); + TEST_VERIFY_EXIT (fd != -1); + struct stat64 st; + xfstat64 (fd, &st); + if (st.st_blksize > 0 && st.st_blksize < BUFSIZ) + blksize = st.st_blksize; + printf ("BUFSIZ = %d, blksize = %d\n", BUFSIZ, blksize); + xclose (fd); + FILE *fp = xfopen (filename, "w"); + for (size_t i = 0; i < 2 * BUFSIZ; i++) + { + unsigned char c = i; + TEST_VERIFY_EXIT (fputc (c, fp) == c); + test_data[i] = c; + } + xfclose (fp); +} + +static void +test_one_case (enum test_open_case c, enum test_base_loc loc, int offset, + int num_ungetc, int num_ungetc_diff, bool ungetc_fallback, + enum clear_ungetc_case cl, enum verify_case v) +{ + int full_offset = base_loc_to_bytes (loc, offset); + printf ("Testing %s offset %d ungetc %d different %d %s%s %s\n", + test_open_case_name[c], full_offset, num_ungetc, num_ungetc_diff, + ungetc_fallback ? "fallback " : "", clear_ungetc_case_name[cl], + verify_case_name[v]); + FILE *fp = open_test_stream (c); + int cur_offset = read_to_test_loc (fp, loc, offset); + clear_getpos_before (fp, cl); + for (int i = 0; i < num_ungetc; i++) + { + unsigned char c = (i >= num_ungetc - num_ungetc_diff + ? cur_offset + : cur_offset - 1); + if (ungetc_fallback) + fail = true; + TEST_COMPARE (ungetc (c, fp), c); + fail = false; + cur_offset--; + } + clear_getpos_after (fp, cl); + int fd = -1; + bool done_dup = false; + if (verify_uses_fd (v)) + { + fd = fileno (fp); + TEST_VERIFY (fd != -1); + if (clear_closes_file (cl)) + { + fd = xdup (fd); + done_dup = true; + } + } + cur_offset += do_clear_ungetc (fp, cl, num_ungetc); + switch (v) + { + case verify_read: + for (; + cur_offset <= full_offset + 1 && cur_offset < 2 * BUFSIZ; + cur_offset++) + TEST_COMPARE (getc (fp), (unsigned char) cur_offset); + break; + + case verify_ftell: + TEST_COMPARE (ftell (fp), cur_offset); + break; + + case verify_ftello: + TEST_COMPARE (ftello (fp), cur_offset); + break; + + case verify_ftello64: + TEST_COMPARE (ftello64 (fp), cur_offset); + break; + + case verify_fd: + TEST_COMPARE (lseek (fd, 0, SEEK_CUR), cur_offset); + break; + + default: + abort (); + } + if (! clear_closes_file (cl)) + { + int ret = fclose (fp); + TEST_COMPARE (ret, 0); + } + if (done_dup) + xclose (fd); +} + +int +do_test (void) +{ + setup (); + for (enum test_open_case c = 0; c < test_open_max; c++) + for (enum test_base_loc loc = 0; loc < base_loc_max; loc++) + for (int offset = -2; offset <= 3; offset++) + for (int num_ungetc = 0; + num_ungetc <= 2 && num_ungetc <= base_loc_to_bytes (loc, offset); + num_ungetc++) + for (int num_ungetc_diff = 0; + num_ungetc_diff <= num_ungetc; + num_ungetc_diff++) + for (int ungetc_fallback = 0; + ungetc_fallback <= (num_ungetc == 1 ? 1 : 0); + ungetc_fallback++) + for (enum clear_ungetc_case cl = 0; cl < clear_max; cl++) + { + if (!clear_valid (c, cl)) + continue; + if (base_loc_to_bytes (loc, offset) > 2 * BUFSIZ) + continue; + if ((base_loc_to_bytes (loc, offset) + - num_ungetc + + clear_offset (cl, num_ungetc)) < 0) + continue; + if ((base_loc_to_bytes (loc, offset) + - num_ungetc + + clear_offset (cl, num_ungetc)) > 2 * BUFSIZ) + continue; + for (enum verify_case v = 0; v < verify_max; v++) + { + if (!verify_valid (c, cl, v)) + continue; + test_one_case (c, loc, offset, num_ungetc, + num_ungetc_diff, ungetc_fallback, cl, v); + } + } + return 0; +} + +#include <support/test-driver.c> diff --git a/stdio-common/tst-renameat2.c b/stdio-common/tst-renameat2.c index b65afed..12aa0f8 100644 --- a/stdio-common/tst-renameat2.c +++ b/stdio-common/tst-renameat2.c @@ -1,5 +1,5 @@ /* Linux implementation for renameat2 function. - Copyright (C) 2018-2024 Free Software Foundation, Inc. + Copyright (C) 2018-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -82,7 +82,7 @@ static void check_size (const char *path, off64_t expected_size) { struct stat64 st; - xstat (path, &st); + xstat64 (path, &st); if (st.st_size != expected_size) FAIL_EXIT1 ("file \"%s\": expected size %lld, actual size %lld", path, (unsigned long long int) expected_size, diff --git a/stdio-common/tst-scanf-binary-c11.c b/stdio-common/tst-scanf-binary-c11.c index 1d24f2e..51872e5 100644 --- a/stdio-common/tst-scanf-binary-c11.c +++ b/stdio-common/tst-scanf-binary-c11.c @@ -1,6 +1,6 @@ /* Test scanf functions with C23 binary integers (narrow strings, no extensions to C11). - Copyright (C) 2022-2024 Free Software Foundation, Inc. + Copyright (C) 2022-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/tst-scanf-binary-c23.c b/stdio-common/tst-scanf-binary-c23.c index ebb9f04..6f4583a 100644 --- a/stdio-common/tst-scanf-binary-c23.c +++ b/stdio-common/tst-scanf-binary-c23.c @@ -1,6 +1,6 @@ /* Test scanf functions with C23 binary integers (narrow strings, no extensions). - Copyright (C) 2022-2024 Free Software Foundation, Inc. + Copyright (C) 2022-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/tst-scanf-binary-gnu11.c b/stdio-common/tst-scanf-binary-gnu11.c index 4524b7c..31f25d7 100644 --- a/stdio-common/tst-scanf-binary-gnu11.c +++ b/stdio-common/tst-scanf-binary-gnu11.c @@ -1,6 +1,6 @@ /* Test scanf functions with C23 binary integers (narrow strings, GNU extensions to C11). - Copyright (C) 2022-2024 Free Software Foundation, Inc. + Copyright (C) 2022-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/tst-scanf-binary-gnu89.c b/stdio-common/tst-scanf-binary-gnu89.c index 0a209b3..eec9e8c 100644 --- a/stdio-common/tst-scanf-binary-gnu89.c +++ b/stdio-common/tst-scanf-binary-gnu89.c @@ -1,6 +1,6 @@ /* Test scanf functions with C23 binary integers (narrow strings, GNU extensions to C89). - Copyright (C) 2022-2024 Free Software Foundation, Inc. + Copyright (C) 2022-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/tst-scanf-binary-main.c b/stdio-common/tst-scanf-binary-main.c index b103889..903e2d3 100644 --- a/stdio-common/tst-scanf-binary-main.c +++ b/stdio-common/tst-scanf-binary-main.c @@ -1,5 +1,5 @@ /* Test scanf functions with C23 binary integers. - Copyright (C) 2022-2024 Free Software Foundation, Inc. + Copyright (C) 2022-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/tst-scanf-bz27650.c b/stdio-common/tst-scanf-bz27650.c index 3a742bc..b019a8f 100644 --- a/stdio-common/tst-scanf-bz27650.c +++ b/stdio-common/tst-scanf-bz27650.c @@ -1,5 +1,5 @@ /* Test for BZ #27650, formatted input matching beyond INT_MAX. - Copyright (C) 2024 Free Software Foundation, Inc. + Copyright (C) 2024-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/tst-scanf-format-c-b.input b/stdio-common/tst-scanf-format-c-b.input new file mode 100644 index 0000000..52b2dc1 --- /dev/null +++ b/stdio-common/tst-scanf-format-c-b.input @@ -0,0 +1,90 @@ +%[bcdefghijklmnopqrstuvw]::0:-1: +%*[bcdefghijklmnopqrstuvw]::0:-1: +%[bcdefghijklmnopqrstuvw]:The:0:-1: +%*[bcdefghijklmnopqrstuvw]:The:0:-1: +%[bcdefghijklmnopqrstuvw]:quick:1:5:quick: +%*[bcdefghijklmnopqrstuvw]:quick:0:5: +%[bcdefghijklmnopqrstuvw]:brown fox:1:5:brown: +%*[bcdefghijklmnopqrstuvw]:brown fox:0:5: +%[bcdefghijklmnopqrstuvw]:jumps over the lazy dog:1:5:jumps: +%*[bcdefghijklmnopqrstuvw]:jumps over the lazy dog:0:5: +%[ Tabcdefghijklmnopqrstuvwxyz]::0:-1: +%*[ Tabcdefghijklmnopqrstuvwxyz]::0:-1: +%[ Tabcdefghijklmnopqrstuvwxyz]:The:1:3:The: +%*[ Tabcdefghijklmnopqrstuvwxyz]:The:0:3: +%[ Tabcdefghijklmnopqrstuvwxyz]:quick:1:5:quick: +%*[ Tabcdefghijklmnopqrstuvwxyz]:quick:0:5: +%[ Tabcdefghijklmnopqrstuvwxyz]:brown fox:1:9:brown fox: +%*[ Tabcdefghijklmnopqrstuvwxyz]:brown fox:0:9: +%[ Tabcdefghijklmnopqrstuvwxyz]:jumps over the lazy dog:1:23:jumps over the lazy dog: +%*[ Tabcdefghijklmnopqrstuvwxyz]:jumps over the lazy dog:0:23: +%1[ Tabcdefghijklmnopqrstuvwxyz]::0:-1: +%*1[ Tabcdefghijklmnopqrstuvwxyz]::0:-1: +%1[ Tabcdefghijklmnopqrstuvwxyz]:The:1:1:T: +%*1[ Tabcdefghijklmnopqrstuvwxyz]:The:0:1: +%1[ Tabcdefghijklmnopqrstuvwxyz]:quick:1:1:q: +%*1[ Tabcdefghijklmnopqrstuvwxyz]:quick:0:1: +%1[ Tabcdefghijklmnopqrstuvwxyz]:brown fox:1:1:b: +%*1[ Tabcdefghijklmnopqrstuvwxyz]:brown fox:0:1: +%1[ Tabcdefghijklmnopqrstuvwxyz]:jumps over the lazy dog:1:1:j: +%*1[ Tabcdefghijklmnopqrstuvwxyz]:jumps over the lazy dog:0:1: +%2[ Tabcdefghijklmnopqrstuvwxyz]::0:-1: +%*2[ Tabcdefghijklmnopqrstuvwxyz]::0:-1: +%2[ Tabcdefghijklmnopqrstuvwxyz]:The:1:2:Th: +%*2[ Tabcdefghijklmnopqrstuvwxyz]:The:0:2: +%2[ Tabcdefghijklmnopqrstuvwxyz]:quick:1:2:qu: +%*2[ Tabcdefghijklmnopqrstuvwxyz]:quick:0:2: +%2[ Tabcdefghijklmnopqrstuvwxyz]:brown fox:1:2:br: +%*2[ Tabcdefghijklmnopqrstuvwxyz]:brown fox:0:2: +%2[ Tabcdefghijklmnopqrstuvwxyz]:jumps over the lazy dog:1:2:ju: +%*2[ Tabcdefghijklmnopqrstuvwxyz]:jumps over the lazy dog:0:2: +%5[ Tabcdefghijklmnopqrstuvwxyz]::0:-1: +%*5[ Tabcdefghijklmnopqrstuvwxyz]::0:-1: +%5[ Tabcdefghijklmnopqrstuvwxyz]:The:1:3:The: +%*5[ Tabcdefghijklmnopqrstuvwxyz]:The:0:3: +%5[ Tabcdefghijklmnopqrstuvwxyz]:quick:1:5:quick: +%*5[ Tabcdefghijklmnopqrstuvwxyz]:quick:0:5: +%5[ Tabcdefghijklmnopqrstuvwxyz]:brown fox:1:5:brown: +%*5[ Tabcdefghijklmnopqrstuvwxyz]:brown fox:0:5: +%5[ Tabcdefghijklmnopqrstuvwxyz]:jumps over the lazy dog:1:5:jumps: +%*5[ Tabcdefghijklmnopqrstuvwxyz]:jumps over the lazy dog:0:5: +%10[ Tabcdefghijklmnopqrstuvwxyz]::0:-1: +%*10[ Tabcdefghijklmnopqrstuvwxyz]::0:-1: +%10[ Tabcdefghijklmnopqrstuvwxyz]:The:1:3:The: +%*10[ Tabcdefghijklmnopqrstuvwxyz]:The:0:3: +%10[ Tabcdefghijklmnopqrstuvwxyz]:quick:1:5:quick: +%*10[ Tabcdefghijklmnopqrstuvwxyz]:quick:0:5: +%10[ Tabcdefghijklmnopqrstuvwxyz]:brown fox:1:9:brown fox: +%*10[ Tabcdefghijklmnopqrstuvwxyz]:brown fox:0:9: +%10[ Tabcdefghijklmnopqrstuvwxyz]:jumps over the lazy dog:1:10:jumps over: +%*10[ Tabcdefghijklmnopqrstuvwxyz]:jumps over the lazy dog:0:10: +%25[ Tabcdefghijklmnopqrstuvwxyz]::0:-1: +%*25[ Tabcdefghijklmnopqrstuvwxyz]::0:-1: +%25[ Tabcdefghijklmnopqrstuvwxyz]:The:1:3:The: +%*25[ Tabcdefghijklmnopqrstuvwxyz]:The:0:3: +%25[ Tabcdefghijklmnopqrstuvwxyz]:quick:1:5:quick: +%*25[ Tabcdefghijklmnopqrstuvwxyz]:quick:0:5: +%25[ Tabcdefghijklmnopqrstuvwxyz]:brown fox:1:9:brown fox: +%*25[ Tabcdefghijklmnopqrstuvwxyz]:brown fox:0:9: +%25[ Tabcdefghijklmnopqrstuvwxyz]:jumps over the lazy dog:1:23:jumps over the lazy dog: +%*25[ Tabcdefghijklmnopqrstuvwxyz]:jumps over the lazy dog:0:23: +%5[ Tabcdefghijklmnopqrstuvwxyz]: :1:1: : +%*5[ Tabcdefghijklmnopqrstuvwxyz]: :0:1: +%5[ Tabcdefghijklmnopqrstuvwxyz]: The :1:5: The : +%*5[ Tabcdefghijklmnopqrstuvwxyz]: The :0:5: +%5[ Tabcdefghijklmnopqrstuvwxyz]: quick :1:5: quic: +%*5[ Tabcdefghijklmnopqrstuvwxyz]: quick :0:5: +%5[ Tabcdefghijklmnopqrstuvwxyz]: brown fox :1:5: brow: +%*5[ Tabcdefghijklmnopqrstuvwxyz]: brown fox :0:5: +%5[ Tabcdefghijklmnopqrstuvwxyz]: jumps over the lazy dog :1:5: jump: +%*5[ Tabcdefghijklmnopqrstuvwxyz]: jumps over the lazy dog :0:5: +%25[ Tabcdefghijklmnopqrstuvwxyz]: :1:1: : +%*25[ Tabcdefghijklmnopqrstuvwxyz]: :0:1: +%25[ Tabcdefghijklmnopqrstuvwxyz]: The :1:5: The : +%*25[ Tabcdefghijklmnopqrstuvwxyz]: The :0:5: +%25[ Tabcdefghijklmnopqrstuvwxyz]: quick :1:7: quick : +%*25[ Tabcdefghijklmnopqrstuvwxyz]: quick :0:7: +%25[ Tabcdefghijklmnopqrstuvwxyz]: brown fox :1:11: brown fox : +%*25[ Tabcdefghijklmnopqrstuvwxyz]: brown fox :0:11: +%25[ Tabcdefghijklmnopqrstuvwxyz]: jumps over the lazy dog :1:25: jumps over the lazy dog : +%*25[ Tabcdefghijklmnopqrstuvwxyz]: jumps over the lazy dog :0:25: diff --git a/stdio-common/tst-scanf-format-c-c.input b/stdio-common/tst-scanf-format-c-c.input new file mode 100644 index 0000000..a3a6ee2 --- /dev/null +++ b/stdio-common/tst-scanf-format-c-c.input @@ -0,0 +1,64 @@ +%c:The:1:1:T: +%*c:The:0:1: +%c:quick:1:1:q: +%*c:quick:0:1: +%c:brown fox:1:1:b: +%*c:brown fox:0:1: +%c:jumps over the lazy dog:1:1:j: +%*c:jumps over the lazy dog:0:1: +%1c:The:1:1:T: +%*1c:The:0:1: +%1c:quick:1:1:q: +%*1c:quick:0:1: +%1c:brown fox:1:1:b: +%*1c:brown fox:0:1: +%1c:jumps over the lazy dog:1:1:j: +%*1c:jumps over the lazy dog:0:1: +%2c:The:1:2:Th: +%*2c:The:0:2: +%2c:quick:1:2:qu: +%*2c:quick:0:2: +%2c:brown fox:1:2:br: +%*2c:brown fox:0:2: +%2c:jumps over the lazy dog:1:2:ju: +%*2c:jumps over the lazy dog:0:2: +# BZ12701 %5c:The:0:-1: +# BZ12701 %*5c:The:0:-1: +%5c:quick:1:5:quick: +%*5c:quick:0:5: +%5c:brown fox:1:5:brown: +%*5c:brown fox:0:5: +%5c:jumps over the lazy dog:1:5:jumps: +%*5c:jumps over the lazy dog:0:5: +# BZ12701 %10c:The:0:-1: +# BZ12701 %*10c:The:0:-1: +# BZ12701 %10c:quick:0:-1: +# BZ12701 %*10c:quick:0:-1: +# BZ12701 %10c:brown fox:0:-1: +# BZ12701 %*10c:brown fox:0:-1: +%10c:jumps over the lazy dog:1:10:jumps over: +%*10c:jumps over the lazy dog:0:10: +# BZ12701 %25c:The:0:-1: +# BZ12701 %*25c:The:0:-1: +# BZ12701 %25c:quick:0:-1: +# BZ12701 %*25c:quick:0:-1: +# BZ12701 %25c:brown fox:0:-1: +# BZ12701 %*25c:brown fox:0:-1: +# BZ12701 %25c:jumps over the lazy dog:0:-1: +# BZ12701 %*25c:jumps over the lazy dog:0:-1: +%5c: The :1:5: The : +%*5c: The :0:5: +%5c: quick :1:5: quic: +%*5c: quick :0:5: +%5c: brown fox :1:5: brow: +%*5c: brown fox :0:5: +%5c: jumps over the lazy dog :1:5: jump: +%*5c: jumps over the lazy dog :0:5: +# BZ12701 %25c: The :0:-1: +# BZ12701 %*25c: The :0:-1: +# BZ12701 %25c: quick :0:-1: +# BZ12701 %*25c: quick :0:-1: +# BZ12701 %25c: brown fox :0:-1: +# BZ12701 %*25c: brown fox :0:-1: +%25c: jumps over the lazy dog :1:25: jumps over the lazy dog : +%*25c: jumps over the lazy dog :0:25: diff --git a/stdio-common/tst-scanf-format-c-s.input b/stdio-common/tst-scanf-format-c-s.input new file mode 100644 index 0000000..52c992f --- /dev/null +++ b/stdio-common/tst-scanf-format-c-s.input @@ -0,0 +1,64 @@ +%s:The :1:3:The: +%*s:The :0:3: +%s:quick :1:5:quick: +%*s:quick :0:5: +%s:brown fox :1:5:brown: +%*s:brown fox :0:5: +%s:jumps over the lazy dog :1:5:jumps: +%*s:jumps over the lazy dog :0:5: +%1s:The :1:1:T: +%*1s:The :0:1: +%1s:quick :1:1:q: +%*1s:quick :0:1: +%1s:brown fox :1:1:b: +%*1s:brown fox :0:1: +%1s:jumps over the lazy dog :1:1:j: +%*1s:jumps over the lazy dog :0:1: +%2s:The :1:2:Th: +%*2s:The :0:2: +%2s:quick :1:2:qu: +%*2s:quick :0:2: +%2s:brown fox :1:2:br: +%*2s:brown fox :0:2: +%2s:jumps over the lazy dog :1:2:ju: +%*2s:jumps over the lazy dog :0:2: +%5s:The :1:3:The: +%*5s:The :0:3: +%5s:quick :1:5:quick: +%*5s:quick :0:5: +%5s:brown fox :1:5:brown: +%*5s:brown fox :0:5: +%5s:jumps over the lazy dog :1:5:jumps: +%*5s:jumps over the lazy dog :0:5: +%10s:The :1:3:The: +%*10s:The :0:3: +%10s:quick :1:5:quick: +%*10s:quick :0:5: +%10s:brown fox :1:5:brown: +%*10s:brown fox :0:5: +%10s:jumps over the lazy dog :1:5:jumps: +%*10s:jumps over the lazy dog :0:5: +%25s:The :1:3:The: +%*25s:The :0:3: +%25s:quick :1:5:quick: +%*25s:quick :0:5: +%25s:brown fox :1:5:brown: +%*25s:brown fox :0:5: +%25s:jumps over the lazy dog :1:5:jumps: +%*25s:jumps over the lazy dog :0:5: +%5s: The :1:4:The: +%*5s: The :0:4: +%5s: quick :1:6:quick: +%*5s: quick :0:6: +%5s: brown fox :1:6:brown: +%*5s: brown fox :0:6: +%5s: jumps over the lazy dog :1:6:jumps: +%*5s: jumps over the lazy dog :0:6: +%25s: The :1:4:The: +%*25s: The :0:4: +%25s: quick :1:6:quick: +%*25s: quick :0:6: +%25s: brown fox :1:6:brown: +%*25s: brown fox :0:6: +%25s: jumps over the lazy dog :1:6:jumps: +%*25s: jumps over the lazy dog :0:6: diff --git a/stdio-common/tst-scanf-format-char-d.input b/stdio-common/tst-scanf-format-char-d.input new file mode 100644 index 0000000..eeb6920 --- /dev/null +++ b/stdio-common/tst-scanf-format-char-d.input @@ -0,0 +1,266 @@ +%hhd::0:-1: +%*hhd::0:-1: +%hhd:-251:1:4:5: +%*hhd:-251:0:4: +%hhd:-129:1:4:127: +%*hhd:-129:0:4: +%hhd:-128:1:4:-128: +%*hhd:-128:0:4: +%hhd:-123:1:4:-123: +%*hhd:-123:0:4: +%hhd:-1:1:2:-1: +%*hhd:-1:0:2: +%hhd:-0:1:2:0: +%*hhd:-0:0:2: +%hhd:0:1:1:0: +%*hhd:0:0:1: +%hhd:1:1:1:1: +%*hhd:1:0:1: +%hhd:42:1:2:42: +%*hhd:42:0:2: +%hhd:127:1:3:127: +%*hhd:127:0:3: +%hhd:128:1:3:-128: +%*hhd:128:0:3: +%hhd:169:1:3:-87: +%*hhd:169:0:3: +%hhd:+0:1:2:0: +%*hhd:+0:0:2: +%hhd:+1:1:2:1: +%*hhd:+1:0:2: +%hhd:+42:1:3:42: +%*hhd:+42:0:3: +%hhd:+127:1:4:127: +%*hhd:+127:0:4: +%hhd:+128:1:4:-128: +%*hhd:+128:0:4: +%hhd:+169:1:4:-87: +%*hhd:+169:0:4: +%1hhd::0:-1: +%*1hhd::0:-1: +%1hhd:-251:0:-1: +%*1hhd:-251:0:-1: +%1hhd:-129:0:-1: +%*1hhd:-129:0:-1: +%1hhd:-128:0:-1: +%*1hhd:-128:0:-1: +%1hhd:-123:0:-1: +%*1hhd:-123:0:-1: +%1hhd:-1:0:-1: +%*1hhd:-1:0:-1: +%1hhd:-0:0:-1: +%*1hhd:-0:0:-1: +%1hhd:0:1:1:0: +%*1hhd:0:0:1: +%1hhd:1:1:1:1: +%*1hhd:1:0:1: +%1hhd:42:1:1:4: +%*1hhd:42:0:1: +%1hhd:127:1:1:1: +%*1hhd:127:0:1: +%1hhd:128:1:1:1: +%*1hhd:128:0:1: +%1hhd:169:1:1:1: +%*1hhd:169:0:1: +%1hhd:+0:0:-1: +%*1hhd:+0:0:-1: +%1hhd:+1:0:-1: +%*1hhd:+1:0:-1: +%1hhd:+42:0:-1: +%*1hhd:+42:0:-1: +%1hhd:+127:0:-1: +%*1hhd:+127:0:-1: +%1hhd:+128:0:-1: +%*1hhd:+128:0:-1: +%1hhd:+169:0:-1: +%*1hhd:+169:0:-1: +%2hhd::0:-1: +%*2hhd::0:-1: +%2hhd:-251:1:2:-2: +%*2hhd:-251:0:2: +%2hhd:-129:1:2:-1: +%*2hhd:-129:0:2: +%2hhd:-128:1:2:-1: +%*2hhd:-128:0:2: +%2hhd:-123:1:2:-1: +%*2hhd:-123:0:2: +%2hhd:-1:1:2:-1: +%*2hhd:-1:0:2: +%2hhd:-0:1:2:0: +%*2hhd:-0:0:2: +%2hhd:0:1:1:0: +%*2hhd:0:0:1: +%2hhd:1:1:1:1: +%*2hhd:1:0:1: +%2hhd:42:1:2:42: +%*2hhd:42:0:2: +%2hhd:127:1:2:12: +%*2hhd:127:0:2: +%2hhd:128:1:2:12: +%*2hhd:128:0:2: +%2hhd:169:1:2:16: +%*2hhd:169:0:2: +%2hhd:+0:1:2:0: +%*2hhd:+0:0:2: +%2hhd:+1:1:2:1: +%*2hhd:+1:0:2: +%2hhd:+42:1:2:4: +%*2hhd:+42:0:2: +%2hhd:+127:1:2:1: +%*2hhd:+127:0:2: +%2hhd:+128:1:2:1: +%*2hhd:+128:0:2: +%2hhd:+169:1:2:1: +%*2hhd:+169:0:2: +%3hhd::0:-1: +%*3hhd::0:-1: +%3hhd:-251:1:3:-25: +%*3hhd:-251:0:3: +%3hhd:-129:1:3:-12: +%*3hhd:-129:0:3: +%3hhd:-128:1:3:-12: +%*3hhd:-128:0:3: +%3hhd:-123:1:3:-12: +%*3hhd:-123:0:3: +%3hhd:-1:1:2:-1: +%*3hhd:-1:0:2: +%3hhd:-0:1:2:0: +%*3hhd:-0:0:2: +%3hhd:0:1:1:0: +%*3hhd:0:0:1: +%3hhd:1:1:1:1: +%*3hhd:1:0:1: +%3hhd:42:1:2:42: +%*3hhd:42:0:2: +%3hhd:127:1:3:127: +%*3hhd:127:0:3: +%3hhd:128:1:3:-128: +%*3hhd:128:0:3: +%3hhd:169:1:3:-87: +%*3hhd:169:0:3: +%3hhd:+0:1:2:0: +%*3hhd:+0:0:2: +%3hhd:+1:1:2:1: +%*3hhd:+1:0:2: +%3hhd:+42:1:3:42: +%*3hhd:+42:0:3: +%3hhd:+127:1:3:12: +%*3hhd:+127:0:3: +%3hhd:+128:1:3:12: +%*3hhd:+128:0:3: +%3hhd:+169:1:3:16: +%*3hhd:+169:0:3: +%5hhd::0:-1: +%*5hhd::0:-1: +%5hhd:-251:1:4:5: +%*5hhd:-251:0:4: +%5hhd:-129:1:4:127: +%*5hhd:-129:0:4: +%5hhd:-128:1:4:-128: +%*5hhd:-128:0:4: +%5hhd:-123:1:4:-123: +%*5hhd:-123:0:4: +%5hhd:-1:1:2:-1: +%*5hhd:-1:0:2: +%5hhd:-0:1:2:0: +%*5hhd:-0:0:2: +%5hhd:0:1:1:0: +%*5hhd:0:0:1: +%5hhd:1:1:1:1: +%*5hhd:1:0:1: +%5hhd:42:1:2:42: +%*5hhd:42:0:2: +%5hhd:127:1:3:127: +%*5hhd:127:0:3: +%5hhd:128:1:3:-128: +%*5hhd:128:0:3: +%5hhd:169:1:3:-87: +%*5hhd:169:0:3: +%5hhd:+0:1:2:0: +%*5hhd:+0:0:2: +%5hhd:+1:1:2:1: +%*5hhd:+1:0:2: +%5hhd:+42:1:3:42: +%*5hhd:+42:0:3: +%5hhd:+127:1:4:127: +%*5hhd:+127:0:4: +%5hhd:+128:1:4:-128: +%*5hhd:+128:0:4: +%5hhd:+169:1:4:-87: +%*5hhd:+169:0:4: +%2hhd: :0:-1: +%*2hhd: :0:-1: +%2hhd: -251:1:3:-2: +%*2hhd: -251:0:3: +%2hhd: -129:1:3:-1: +%*2hhd: -129:0:3: +%2hhd: -128:1:3:-1: +%*2hhd: -128:0:3: +%2hhd: -123:1:3:-1: +%*2hhd: -123:0:3: +%2hhd: -1:1:3:-1: +%*2hhd: -1:0:3: +%2hhd: -0:1:3:0: +%*2hhd: -0:0:3: +%2hhd: 0:1:2:0: +%*2hhd: 0:0:2: +%2hhd: 1:1:2:1: +%*2hhd: 1:0:2: +%2hhd: 42:1:3:42: +%*2hhd: 42:0:3: +%2hhd: 127:1:3:12: +%*2hhd: 127:0:3: +%2hhd: 128:1:3:12: +%*2hhd: 128:0:3: +%2hhd: 169:1:3:16: +%*2hhd: 169:0:3: +%2hhd: +0:1:3:0: +%*2hhd: +0:0:3: +%2hhd: +1:1:3:1: +%*2hhd: +1:0:3: +%2hhd: +42:1:3:4: +%*2hhd: +42:0:3: +%2hhd: +127:1:3:1: +%*2hhd: +127:0:3: +%2hhd: +128:1:3:1: +%*2hhd: +128:0:3: +%2hhd: +169:1:3:1: +%*2hhd: +169:0:3: +%5hhd: :0:-1: +%*5hhd: :0:-1: +%5hhd: -251:1:5:5: +%*5hhd: -251:0:5: +%5hhd: -129:1:5:127: +%*5hhd: -129:0:5: +%5hhd: -128:1:5:-128: +%*5hhd: -128:0:5: +%5hhd: -123:1:5:-123: +%*5hhd: -123:0:5: +%5hhd: -1:1:3:-1: +%*5hhd: -1:0:3: +%5hhd: -0:1:3:0: +%*5hhd: -0:0:3: +%5hhd: 0:1:2:0: +%*5hhd: 0:0:2: +%5hhd: 1:1:2:1: +%*5hhd: 1:0:2: +%5hhd: 42:1:3:42: +%*5hhd: 42:0:3: +%5hhd: 127:1:4:127: +%*5hhd: 127:0:4: +%5hhd: 128:1:4:-128: +%*5hhd: 128:0:4: +%5hhd: 169:1:4:-87: +%*5hhd: 169:0:4: +%5hhd: +0:1:3:0: +%*5hhd: +0:0:3: +%5hhd: +1:1:3:1: +%*5hhd: +1:0:3: +%5hhd: +42:1:4:42: +%*5hhd: +42:0:4: +%5hhd: +127:1:5:127: +%*5hhd: +127:0:5: +%5hhd: +128:1:5:-128: +%*5hhd: +128:0:5: +%5hhd: +169:1:5:-87: +%*5hhd: +169:0:5: diff --git a/stdio-common/tst-scanf-format-char-i.input b/stdio-common/tst-scanf-format-char-i.input new file mode 100644 index 0000000..0855f50 --- /dev/null +++ b/stdio-common/tst-scanf-format-char-i.input @@ -0,0 +1,1526 @@ +%hhi::0:-1: +%*hhi::0:-1: +%hhi:-251:1:4:5: +%*hhi:-251:0:4: +%hhi:-0Xfb:1:5:5: +%*hhi:-0Xfb:0:5: +%hhi:-0xFB:1:5:5: +%*hhi:-0xFB:0:5: +%hhi:-0373:1:5:5: +%*hhi:-0373:0:5: +%hhi:-0B11111011:1:11:5: +%*hhi:-0B11111011:0:11: +%hhi:-0b11111011:1:11:5: +%*hhi:-0b11111011:0:11: +%hhi:-129:1:4:127: +%*hhi:-129:0:4: +%hhi:-0X81:1:5:127: +%*hhi:-0X81:0:5: +%hhi:-0x81:1:5:127: +%*hhi:-0x81:0:5: +%hhi:-0201:1:5:127: +%*hhi:-0201:0:5: +%hhi:-0B10000001:1:11:127: +%*hhi:-0B10000001:0:11: +%hhi:-0b10000001:1:11:127: +%*hhi:-0b10000001:0:11: +%hhi:-128:1:4:-128: +%*hhi:-128:0:4: +%hhi:-0X80:1:5:-128: +%*hhi:-0X80:0:5: +%hhi:-0x80:1:5:-128: +%*hhi:-0x80:0:5: +%hhi:-0200:1:5:-128: +%*hhi:-0200:0:5: +%hhi:-0B10000000:1:11:-128: +%*hhi:-0B10000000:0:11: +%hhi:-0b10000000:1:11:-128: +%*hhi:-0b10000000:0:11: +%hhi:-123:1:4:-123: +%*hhi:-123:0:4: +%hhi:-0X7b:1:5:-123: +%*hhi:-0X7b:0:5: +%hhi:-0x7B:1:5:-123: +%*hhi:-0x7B:0:5: +%hhi:-0173:1:5:-123: +%*hhi:-0173:0:5: +%hhi:-0B1111011:1:10:-123: +%*hhi:-0B1111011:0:10: +%hhi:-0b1111011:1:10:-123: +%*hhi:-0b1111011:0:10: +%hhi:-1:1:2:-1: +%*hhi:-1:0:2: +%hhi:-0X1:1:4:-1: +%*hhi:-0X1:0:4: +%hhi:-0x1:1:4:-1: +%*hhi:-0x1:0:4: +%hhi:-01:1:3:-1: +%*hhi:-01:0:3: +%hhi:-0B1:1:4:-1: +%*hhi:-0B1:0:4: +%hhi:-0b1:1:4:-1: +%*hhi:-0b1:0:4: +%hhi:-0:1:2:0: +%*hhi:-0:0:2: +%hhi:-0X0:1:4:0: +%*hhi:-0X0:0:4: +%hhi:-0x0:1:4:0: +%*hhi:-0x0:0:4: +%hhi:-00:1:3:0: +%*hhi:-00:0:3: +%hhi:-0B0:1:4:0: +%*hhi:-0B0:0:4: +%hhi:-0b0:1:4:0: +%*hhi:-0b0:0:4: +%hhi:0:1:1:0: +%*hhi:0:0:1: +%hhi:0X0:1:3:0: +%*hhi:0X0:0:3: +%hhi:0x0:1:3:0: +%*hhi:0x0:0:3: +%hhi:00:1:2:0: +%*hhi:00:0:2: +%hhi:0B0:1:3:0: +%*hhi:0B0:0:3: +%hhi:0b0:1:3:0: +%*hhi:0b0:0:3: +%hhi:1:1:1:1: +%*hhi:1:0:1: +%hhi:0X1:1:3:1: +%*hhi:0X1:0:3: +%hhi:0x1:1:3:1: +%*hhi:0x1:0:3: +%hhi:01:1:2:1: +%*hhi:01:0:2: +%hhi:0B1:1:3:1: +%*hhi:0B1:0:3: +%hhi:0b1:1:3:1: +%*hhi:0b1:0:3: +%hhi:42:1:2:42: +%*hhi:42:0:2: +%hhi:0X2a:1:4:42: +%*hhi:0X2a:0:4: +%hhi:0x2A:1:4:42: +%*hhi:0x2A:0:4: +%hhi:052:1:3:42: +%*hhi:052:0:3: +%hhi:0B101010:1:8:42: +%*hhi:0B101010:0:8: +%hhi:0b101010:1:8:42: +%*hhi:0b101010:0:8: +%hhi:127:1:3:127: +%*hhi:127:0:3: +%hhi:0X7f:1:4:127: +%*hhi:0X7f:0:4: +%hhi:0x7F:1:4:127: +%*hhi:0x7F:0:4: +%hhi:0177:1:4:127: +%*hhi:0177:0:4: +%hhi:0B1111111:1:9:127: +%*hhi:0B1111111:0:9: +%hhi:0b1111111:1:9:127: +%*hhi:0b1111111:0:9: +%hhi:128:1:3:-128: +%*hhi:128:0:3: +%hhi:0X80:1:4:-128: +%*hhi:0X80:0:4: +%hhi:0x80:1:4:-128: +%*hhi:0x80:0:4: +%hhi:0200:1:4:-128: +%*hhi:0200:0:4: +%hhi:0B10000000:1:10:-128: +%*hhi:0B10000000:0:10: +%hhi:0b10000000:1:10:-128: +%*hhi:0b10000000:0:10: +%hhi:169:1:3:-87: +%*hhi:169:0:3: +%hhi:0Xa9:1:4:-87: +%*hhi:0Xa9:0:4: +%hhi:0xA9:1:4:-87: +%*hhi:0xA9:0:4: +%hhi:0251:1:4:-87: +%*hhi:0251:0:4: +%hhi:0B10101001:1:10:-87: +%*hhi:0B10101001:0:10: +%hhi:0b10101001:1:10:-87: +%*hhi:0b10101001:0:10: +%hhi:+0:1:2:0: +%*hhi:+0:0:2: +%hhi:+0X0:1:4:0: +%*hhi:+0X0:0:4: +%hhi:+0x0:1:4:0: +%*hhi:+0x0:0:4: +%hhi:+00:1:3:0: +%*hhi:+00:0:3: +%hhi:+0B0:1:4:0: +%*hhi:+0B0:0:4: +%hhi:+0b0:1:4:0: +%*hhi:+0b0:0:4: +%hhi:+1:1:2:1: +%*hhi:+1:0:2: +%hhi:+0X1:1:4:1: +%*hhi:+0X1:0:4: +%hhi:+0x1:1:4:1: +%*hhi:+0x1:0:4: +%hhi:+01:1:3:1: +%*hhi:+01:0:3: +%hhi:+0B1:1:4:1: +%*hhi:+0B1:0:4: +%hhi:+0b1:1:4:1: +%*hhi:+0b1:0:4: +%hhi:+42:1:3:42: +%*hhi:+42:0:3: +%hhi:+0X2a:1:5:42: +%*hhi:+0X2a:0:5: +%hhi:+0x2A:1:5:42: +%*hhi:+0x2A:0:5: +%hhi:+052:1:4:42: +%*hhi:+052:0:4: +%hhi:+0B101010:1:9:42: +%*hhi:+0B101010:0:9: +%hhi:+0b101010:1:9:42: +%*hhi:+0b101010:0:9: +%hhi:+127:1:4:127: +%*hhi:+127:0:4: +%hhi:+0X7f:1:5:127: +%*hhi:+0X7f:0:5: +%hhi:+0x7F:1:5:127: +%*hhi:+0x7F:0:5: +%hhi:+0177:1:5:127: +%*hhi:+0177:0:5: +%hhi:+0B1111111:1:10:127: +%*hhi:+0B1111111:0:10: +%hhi:+0b1111111:1:10:127: +%*hhi:+0b1111111:0:10: +%hhi:+128:1:4:-128: +%*hhi:+128:0:4: +%hhi:+0X80:1:5:-128: +%*hhi:+0X80:0:5: +%hhi:+0x80:1:5:-128: +%*hhi:+0x80:0:5: +%hhi:+0200:1:5:-128: +%*hhi:+0200:0:5: +%hhi:+0B10000000:1:11:-128: +%*hhi:+0B10000000:0:11: +%hhi:+0b10000000:1:11:-128: +%*hhi:+0b10000000:0:11: +%hhi:+169:1:4:-87: +%*hhi:+169:0:4: +%hhi:+0Xa9:1:5:-87: +%*hhi:+0Xa9:0:5: +%hhi:+0xA9:1:5:-87: +%*hhi:+0xA9:0:5: +%hhi:+0251:1:5:-87: +%*hhi:+0251:0:5: +%hhi:+0B10101001:1:11:-87: +%*hhi:+0B10101001:0:11: +%hhi:+0b10101001:1:11:-87: +%*hhi:+0b10101001:0:11: +%1hhi::0:-1: +%*1hhi::0:-1: +%1hhi:-251:0:-1: +%*1hhi:-251:0:-1: +%1hhi:-0Xfb:0:-1: +%*1hhi:-0Xfb:0:-1: +%1hhi:-0xFB:0:-1: +%*1hhi:-0xFB:0:-1: +%1hhi:-0373:0:-1: +%*1hhi:-0373:0:-1: +%1hhi:-0B11111011:0:-1: +%*1hhi:-0B11111011:0:-1: +%1hhi:-0b11111011:0:-1: +%*1hhi:-0b11111011:0:-1: +%1hhi:-129:0:-1: +%*1hhi:-129:0:-1: +%1hhi:-0X81:0:-1: +%*1hhi:-0X81:0:-1: +%1hhi:-0x81:0:-1: +%*1hhi:-0x81:0:-1: +%1hhi:-0201:0:-1: +%*1hhi:-0201:0:-1: +%1hhi:-0B10000001:0:-1: +%*1hhi:-0B10000001:0:-1: +%1hhi:-0b10000001:0:-1: +%*1hhi:-0b10000001:0:-1: +%1hhi:-128:0:-1: +%*1hhi:-128:0:-1: +%1hhi:-0X80:0:-1: +%*1hhi:-0X80:0:-1: +%1hhi:-0x80:0:-1: +%*1hhi:-0x80:0:-1: +%1hhi:-0200:0:-1: +%*1hhi:-0200:0:-1: +%1hhi:-0B10000000:0:-1: +%*1hhi:-0B10000000:0:-1: +%1hhi:-0b10000000:0:-1: +%*1hhi:-0b10000000:0:-1: +%1hhi:-123:0:-1: +%*1hhi:-123:0:-1: +%1hhi:-0X7b:0:-1: +%*1hhi:-0X7b:0:-1: +%1hhi:-0x7B:0:-1: +%*1hhi:-0x7B:0:-1: +%1hhi:-0173:0:-1: +%*1hhi:-0173:0:-1: +%1hhi:-0B1111011:0:-1: +%*1hhi:-0B1111011:0:-1: +%1hhi:-0b1111011:0:-1: +%*1hhi:-0b1111011:0:-1: +%1hhi:-1:0:-1: +%*1hhi:-1:0:-1: +%1hhi:-0X1:0:-1: +%*1hhi:-0X1:0:-1: +%1hhi:-0x1:0:-1: +%*1hhi:-0x1:0:-1: +%1hhi:-01:0:-1: +%*1hhi:-01:0:-1: +%1hhi:-0B1:0:-1: +%*1hhi:-0B1:0:-1: +%1hhi:-0b1:0:-1: +%*1hhi:-0b1:0:-1: +%1hhi:-0:0:-1: +%*1hhi:-0:0:-1: +%1hhi:-0X0:0:-1: +%*1hhi:-0X0:0:-1: +%1hhi:-0x0:0:-1: +%*1hhi:-0x0:0:-1: +%1hhi:-00:0:-1: +%*1hhi:-00:0:-1: +%1hhi:-0B0:0:-1: +%*1hhi:-0B0:0:-1: +%1hhi:-0b0:0:-1: +%*1hhi:-0b0:0:-1: +%1hhi:0:1:1:0: +%*1hhi:0:0:1: +%1hhi:0X0:1:1:0: +%*1hhi:0X0:0:1: +%1hhi:0x0:1:1:0: +%*1hhi:0x0:0:1: +%1hhi:00:1:1:0: +%*1hhi:00:0:1: +%1hhi:0B0:1:1:0: +%*1hhi:0B0:0:1: +%1hhi:0b0:1:1:0: +%*1hhi:0b0:0:1: +%1hhi:1:1:1:1: +%*1hhi:1:0:1: +%1hhi:0X1:1:1:0: +%*1hhi:0X1:0:1: +%1hhi:0x1:1:1:0: +%*1hhi:0x1:0:1: +%1hhi:01:1:1:0: +%*1hhi:01:0:1: +%1hhi:0B1:1:1:0: +%*1hhi:0B1:0:1: +%1hhi:0b1:1:1:0: +%*1hhi:0b1:0:1: +%1hhi:42:1:1:4: +%*1hhi:42:0:1: +%1hhi:0X2a:1:1:0: +%*1hhi:0X2a:0:1: +%1hhi:0x2A:1:1:0: +%*1hhi:0x2A:0:1: +%1hhi:052:1:1:0: +%*1hhi:052:0:1: +%1hhi:0B101010:1:1:0: +%*1hhi:0B101010:0:1: +%1hhi:0b101010:1:1:0: +%*1hhi:0b101010:0:1: +%1hhi:127:1:1:1: +%*1hhi:127:0:1: +%1hhi:0X7f:1:1:0: +%*1hhi:0X7f:0:1: +%1hhi:0x7F:1:1:0: +%*1hhi:0x7F:0:1: +%1hhi:0177:1:1:0: +%*1hhi:0177:0:1: +%1hhi:0B1111111:1:1:0: +%*1hhi:0B1111111:0:1: +%1hhi:0b1111111:1:1:0: +%*1hhi:0b1111111:0:1: +%1hhi:128:1:1:1: +%*1hhi:128:0:1: +%1hhi:0X80:1:1:0: +%*1hhi:0X80:0:1: +%1hhi:0x80:1:1:0: +%*1hhi:0x80:0:1: +%1hhi:0200:1:1:0: +%*1hhi:0200:0:1: +%1hhi:0B10000000:1:1:0: +%*1hhi:0B10000000:0:1: +%1hhi:0b10000000:1:1:0: +%*1hhi:0b10000000:0:1: +%1hhi:169:1:1:1: +%*1hhi:169:0:1: +%1hhi:0Xa9:1:1:0: +%*1hhi:0Xa9:0:1: +%1hhi:0xA9:1:1:0: +%*1hhi:0xA9:0:1: +%1hhi:0251:1:1:0: +%*1hhi:0251:0:1: +%1hhi:0B10101001:1:1:0: +%*1hhi:0B10101001:0:1: +%1hhi:0b10101001:1:1:0: +%*1hhi:0b10101001:0:1: +%1hhi:+0:0:-1: +%*1hhi:+0:0:-1: +%1hhi:+0X0:0:-1: +%*1hhi:+0X0:0:-1: +%1hhi:+0x0:0:-1: +%*1hhi:+0x0:0:-1: +%1hhi:+00:0:-1: +%*1hhi:+00:0:-1: +%1hhi:+0B0:0:-1: +%*1hhi:+0B0:0:-1: +%1hhi:+0b0:0:-1: +%*1hhi:+0b0:0:-1: +%1hhi:+1:0:-1: +%*1hhi:+1:0:-1: +%1hhi:+0X1:0:-1: +%*1hhi:+0X1:0:-1: +%1hhi:+0x1:0:-1: +%*1hhi:+0x1:0:-1: +%1hhi:+01:0:-1: +%*1hhi:+01:0:-1: +%1hhi:+0B1:0:-1: +%*1hhi:+0B1:0:-1: +%1hhi:+0b1:0:-1: +%*1hhi:+0b1:0:-1: +%1hhi:+42:0:-1: +%*1hhi:+42:0:-1: +%1hhi:+0X2a:0:-1: +%*1hhi:+0X2a:0:-1: +%1hhi:+0x2A:0:-1: +%*1hhi:+0x2A:0:-1: +%1hhi:+052:0:-1: +%*1hhi:+052:0:-1: +%1hhi:+0B101010:0:-1: +%*1hhi:+0B101010:0:-1: +%1hhi:+0b101010:0:-1: +%*1hhi:+0b101010:0:-1: +%1hhi:+127:0:-1: +%*1hhi:+127:0:-1: +%1hhi:+0X7f:0:-1: +%*1hhi:+0X7f:0:-1: +%1hhi:+0x7F:0:-1: +%*1hhi:+0x7F:0:-1: +%1hhi:+0177:0:-1: +%*1hhi:+0177:0:-1: +%1hhi:+0B1111111:0:-1: +%*1hhi:+0B1111111:0:-1: +%1hhi:+0b1111111:0:-1: +%*1hhi:+0b1111111:0:-1: +%1hhi:+128:0:-1: +%*1hhi:+128:0:-1: +%1hhi:+0X80:0:-1: +%*1hhi:+0X80:0:-1: +%1hhi:+0x80:0:-1: +%*1hhi:+0x80:0:-1: +%1hhi:+0200:0:-1: +%*1hhi:+0200:0:-1: +%1hhi:+0B10000000:0:-1: +%*1hhi:+0B10000000:0:-1: +%1hhi:+0b10000000:0:-1: +%*1hhi:+0b10000000:0:-1: +%1hhi:+169:0:-1: +%*1hhi:+169:0:-1: +%1hhi:+0Xa9:0:-1: +%*1hhi:+0Xa9:0:-1: +%1hhi:+0xA9:0:-1: +%*1hhi:+0xA9:0:-1: +%1hhi:+0251:0:-1: +%*1hhi:+0251:0:-1: +%1hhi:+0B10101001:0:-1: +%*1hhi:+0B10101001:0:-1: +%1hhi:+0b10101001:0:-1: +%*1hhi:+0b10101001:0:-1: +%2hhi::0:-1: +%*2hhi::0:-1: +%2hhi:-251:1:2:-2: +%*2hhi:-251:0:2: +%2hhi:-0Xfb:1:2:0: +%*2hhi:-0Xfb:0:2: +%2hhi:-0xFB:1:2:0: +%*2hhi:-0xFB:0:2: +%2hhi:-0373:1:2:0: +%*2hhi:-0373:0:2: +%2hhi:-0B11111011:1:2:0: +%*2hhi:-0B11111011:0:2: +%2hhi:-0b11111011:1:2:0: +%*2hhi:-0b11111011:0:2: +%2hhi:-129:1:2:-1: +%*2hhi:-129:0:2: +%2hhi:-0X81:1:2:0: +%*2hhi:-0X81:0:2: +%2hhi:-0x81:1:2:0: +%*2hhi:-0x81:0:2: +%2hhi:-0201:1:2:0: +%*2hhi:-0201:0:2: +%2hhi:-0B10000001:1:2:0: +%*2hhi:-0B10000001:0:2: +%2hhi:-0b10000001:1:2:0: +%*2hhi:-0b10000001:0:2: +%2hhi:-128:1:2:-1: +%*2hhi:-128:0:2: +%2hhi:-0X80:1:2:0: +%*2hhi:-0X80:0:2: +%2hhi:-0x80:1:2:0: +%*2hhi:-0x80:0:2: +%2hhi:-0200:1:2:0: +%*2hhi:-0200:0:2: +%2hhi:-0B10000000:1:2:0: +%*2hhi:-0B10000000:0:2: +%2hhi:-0b10000000:1:2:0: +%*2hhi:-0b10000000:0:2: +%2hhi:-123:1:2:-1: +%*2hhi:-123:0:2: +%2hhi:-0X7b:1:2:0: +%*2hhi:-0X7b:0:2: +%2hhi:-0x7B:1:2:0: +%*2hhi:-0x7B:0:2: +%2hhi:-0173:1:2:0: +%*2hhi:-0173:0:2: +%2hhi:-0B1111011:1:2:0: +%*2hhi:-0B1111011:0:2: +%2hhi:-0b1111011:1:2:0: +%*2hhi:-0b1111011:0:2: +%2hhi:-1:1:2:-1: +%*2hhi:-1:0:2: +%2hhi:-0X1:1:2:0: +%*2hhi:-0X1:0:2: +%2hhi:-0x1:1:2:0: +%*2hhi:-0x1:0:2: +%2hhi:-01:1:2:0: +%*2hhi:-01:0:2: +%2hhi:-0B1:1:2:0: +%*2hhi:-0B1:0:2: +%2hhi:-0b1:1:2:0: +%*2hhi:-0b1:0:2: +%2hhi:-0:1:2:0: +%*2hhi:-0:0:2: +%2hhi:-0X0:1:2:0: +%*2hhi:-0X0:0:2: +%2hhi:-0x0:1:2:0: +%*2hhi:-0x0:0:2: +%2hhi:-00:1:2:0: +%*2hhi:-00:0:2: +%2hhi:-0B0:1:2:0: +%*2hhi:-0B0:0:2: +%2hhi:-0b0:1:2:0: +%*2hhi:-0b0:0:2: +%2hhi:0:1:1:0: +%*2hhi:0:0:1: +%2hhi:0X0:0:-1: +%*2hhi:0X0:0:-1: +%2hhi:0x0:0:-1: +%*2hhi:0x0:0:-1: +%2hhi:00:1:2:0: +%*2hhi:00:0:2: +%2hhi:0B0:0:-1: +%*2hhi:0B0:0:-1: +%2hhi:0b0:0:-1: +%*2hhi:0b0:0:-1: +%2hhi:1:1:1:1: +%*2hhi:1:0:1: +%2hhi:0X1:0:-1: +%*2hhi:0X1:0:-1: +%2hhi:0x1:0:-1: +%*2hhi:0x1:0:-1: +%2hhi:01:1:2:1: +%*2hhi:01:0:2: +%2hhi:0B1:0:-1: +%*2hhi:0B1:0:-1: +%2hhi:0b1:0:-1: +%*2hhi:0b1:0:-1: +%2hhi:42:1:2:42: +%*2hhi:42:0:2: +%2hhi:0X2a:0:-1: +%*2hhi:0X2a:0:-1: +%2hhi:0x2A:0:-1: +%*2hhi:0x2A:0:-1: +%2hhi:052:1:2:5: +%*2hhi:052:0:2: +%2hhi:0B101010:0:-1: +%*2hhi:0B101010:0:-1: +%2hhi:0b101010:0:-1: +%*2hhi:0b101010:0:-1: +%2hhi:127:1:2:12: +%*2hhi:127:0:2: +%2hhi:0X7f:0:-1: +%*2hhi:0X7f:0:-1: +%2hhi:0x7F:0:-1: +%*2hhi:0x7F:0:-1: +%2hhi:0177:1:2:1: +%*2hhi:0177:0:2: +%2hhi:0B1111111:0:-1: +%*2hhi:0B1111111:0:-1: +%2hhi:0b1111111:0:-1: +%*2hhi:0b1111111:0:-1: +%2hhi:128:1:2:12: +%*2hhi:128:0:2: +%2hhi:0X80:0:-1: +%*2hhi:0X80:0:-1: +%2hhi:0x80:0:-1: +%*2hhi:0x80:0:-1: +%2hhi:0200:1:2:2: +%*2hhi:0200:0:2: +%2hhi:0B10000000:0:-1: +%*2hhi:0B10000000:0:-1: +%2hhi:0b10000000:0:-1: +%*2hhi:0b10000000:0:-1: +%2hhi:169:1:2:16: +%*2hhi:169:0:2: +%2hhi:0Xa9:0:-1: +%*2hhi:0Xa9:0:-1: +%2hhi:0xA9:0:-1: +%*2hhi:0xA9:0:-1: +%2hhi:0251:1:2:2: +%*2hhi:0251:0:2: +%2hhi:0B10101001:0:-1: +%*2hhi:0B10101001:0:-1: +%2hhi:0b10101001:0:-1: +%*2hhi:0b10101001:0:-1: +%2hhi:+0:1:2:0: +%*2hhi:+0:0:2: +%2hhi:+0X0:1:2:0: +%*2hhi:+0X0:0:2: +%2hhi:+0x0:1:2:0: +%*2hhi:+0x0:0:2: +%2hhi:+00:1:2:0: +%*2hhi:+00:0:2: +%2hhi:+0B0:1:2:0: +%*2hhi:+0B0:0:2: +%2hhi:+0b0:1:2:0: +%*2hhi:+0b0:0:2: +%2hhi:+1:1:2:1: +%*2hhi:+1:0:2: +%2hhi:+0X1:1:2:0: +%*2hhi:+0X1:0:2: +%2hhi:+0x1:1:2:0: +%*2hhi:+0x1:0:2: +%2hhi:+01:1:2:0: +%*2hhi:+01:0:2: +%2hhi:+0B1:1:2:0: +%*2hhi:+0B1:0:2: +%2hhi:+0b1:1:2:0: +%*2hhi:+0b1:0:2: +%2hhi:+42:1:2:4: +%*2hhi:+42:0:2: +%2hhi:+0X2a:1:2:0: +%*2hhi:+0X2a:0:2: +%2hhi:+0x2A:1:2:0: +%*2hhi:+0x2A:0:2: +%2hhi:+052:1:2:0: +%*2hhi:+052:0:2: +%2hhi:+0B101010:1:2:0: +%*2hhi:+0B101010:0:2: +%2hhi:+0b101010:1:2:0: +%*2hhi:+0b101010:0:2: +%2hhi:+127:1:2:1: +%*2hhi:+127:0:2: +%2hhi:+0X7f:1:2:0: +%*2hhi:+0X7f:0:2: +%2hhi:+0x7F:1:2:0: +%*2hhi:+0x7F:0:2: +%2hhi:+0177:1:2:0: +%*2hhi:+0177:0:2: +%2hhi:+0B1111111:1:2:0: +%*2hhi:+0B1111111:0:2: +%2hhi:+0b1111111:1:2:0: +%*2hhi:+0b1111111:0:2: +%2hhi:+128:1:2:1: +%*2hhi:+128:0:2: +%2hhi:+0X80:1:2:0: +%*2hhi:+0X80:0:2: +%2hhi:+0x80:1:2:0: +%*2hhi:+0x80:0:2: +%2hhi:+0200:1:2:0: +%*2hhi:+0200:0:2: +%2hhi:+0B10000000:1:2:0: +%*2hhi:+0B10000000:0:2: +%2hhi:+0b10000000:1:2:0: +%*2hhi:+0b10000000:0:2: +%2hhi:+169:1:2:1: +%*2hhi:+169:0:2: +%2hhi:+0Xa9:1:2:0: +%*2hhi:+0Xa9:0:2: +%2hhi:+0xA9:1:2:0: +%*2hhi:+0xA9:0:2: +%2hhi:+0251:1:2:0: +%*2hhi:+0251:0:2: +%2hhi:+0B10101001:1:2:0: +%*2hhi:+0B10101001:0:2: +%2hhi:+0b10101001:1:2:0: +%*2hhi:+0b10101001:0:2: +%3hhi::0:-1: +%*3hhi::0:-1: +%3hhi:-251:1:3:-25: +%*3hhi:-251:0:3: +%3hhi:-0Xfb:0:-1: +%*3hhi:-0Xfb:0:-1: +%3hhi:-0xFB:0:-1: +%*3hhi:-0xFB:0:-1: +%3hhi:-0373:1:3:-3: +%*3hhi:-0373:0:3: +%3hhi:-0B11111011:0:-1: +%*3hhi:-0B11111011:0:-1: +%3hhi:-0b11111011:0:-1: +%*3hhi:-0b11111011:0:-1: +%3hhi:-129:1:3:-12: +%*3hhi:-129:0:3: +%3hhi:-0X81:0:-1: +%*3hhi:-0X81:0:-1: +%3hhi:-0x81:0:-1: +%*3hhi:-0x81:0:-1: +%3hhi:-0201:1:3:-2: +%*3hhi:-0201:0:3: +%3hhi:-0B10000001:0:-1: +%*3hhi:-0B10000001:0:-1: +%3hhi:-0b10000001:0:-1: +%*3hhi:-0b10000001:0:-1: +%3hhi:-128:1:3:-12: +%*3hhi:-128:0:3: +%3hhi:-0X80:0:-1: +%*3hhi:-0X80:0:-1: +%3hhi:-0x80:0:-1: +%*3hhi:-0x80:0:-1: +%3hhi:-0200:1:3:-2: +%*3hhi:-0200:0:3: +%3hhi:-0B10000000:0:-1: +%*3hhi:-0B10000000:0:-1: +%3hhi:-0b10000000:0:-1: +%*3hhi:-0b10000000:0:-1: +%3hhi:-123:1:3:-12: +%*3hhi:-123:0:3: +%3hhi:-0X7b:0:-1: +%*3hhi:-0X7b:0:-1: +%3hhi:-0x7B:0:-1: +%*3hhi:-0x7B:0:-1: +%3hhi:-0173:1:3:-1: +%*3hhi:-0173:0:3: +%3hhi:-0B1111011:0:-1: +%*3hhi:-0B1111011:0:-1: +%3hhi:-0b1111011:0:-1: +%*3hhi:-0b1111011:0:-1: +%3hhi:-1:1:2:-1: +%*3hhi:-1:0:2: +%3hhi:-0X1:0:-1: +%*3hhi:-0X1:0:-1: +%3hhi:-0x1:0:-1: +%*3hhi:-0x1:0:-1: +%3hhi:-01:1:3:-1: +%*3hhi:-01:0:3: +%3hhi:-0B1:0:-1: +%*3hhi:-0B1:0:-1: +%3hhi:-0b1:0:-1: +%*3hhi:-0b1:0:-1: +%3hhi:-0:1:2:0: +%*3hhi:-0:0:2: +%3hhi:-0X0:0:-1: +%*3hhi:-0X0:0:-1: +%3hhi:-0x0:0:-1: +%*3hhi:-0x0:0:-1: +%3hhi:-00:1:3:0: +%*3hhi:-00:0:3: +%3hhi:-0B0:0:-1: +%*3hhi:-0B0:0:-1: +%3hhi:-0b0:0:-1: +%*3hhi:-0b0:0:-1: +%3hhi:0:1:1:0: +%*3hhi:0:0:1: +%3hhi:0X0:1:3:0: +%*3hhi:0X0:0:3: +%3hhi:0x0:1:3:0: +%*3hhi:0x0:0:3: +%3hhi:00:1:2:0: +%*3hhi:00:0:2: +%3hhi:0B0:1:3:0: +%*3hhi:0B0:0:3: +%3hhi:0b0:1:3:0: +%*3hhi:0b0:0:3: +%3hhi:1:1:1:1: +%*3hhi:1:0:1: +%3hhi:0X1:1:3:1: +%*3hhi:0X1:0:3: +%3hhi:0x1:1:3:1: +%*3hhi:0x1:0:3: +%3hhi:01:1:2:1: +%*3hhi:01:0:2: +%3hhi:0B1:1:3:1: +%*3hhi:0B1:0:3: +%3hhi:0b1:1:3:1: +%*3hhi:0b1:0:3: +%3hhi:42:1:2:42: +%*3hhi:42:0:2: +%3hhi:0X2a:1:3:2: +%*3hhi:0X2a:0:3: +%3hhi:0x2A:1:3:2: +%*3hhi:0x2A:0:3: +%3hhi:052:1:3:42: +%*3hhi:052:0:3: +%3hhi:0B101010:1:3:1: +%*3hhi:0B101010:0:3: +%3hhi:0b101010:1:3:1: +%*3hhi:0b101010:0:3: +%3hhi:127:1:3:127: +%*3hhi:127:0:3: +%3hhi:0X7f:1:3:7: +%*3hhi:0X7f:0:3: +%3hhi:0x7F:1:3:7: +%*3hhi:0x7F:0:3: +%3hhi:0177:1:3:15: +%*3hhi:0177:0:3: +%3hhi:0B1111111:1:3:1: +%*3hhi:0B1111111:0:3: +%3hhi:0b1111111:1:3:1: +%*3hhi:0b1111111:0:3: +%3hhi:128:1:3:-128: +%*3hhi:128:0:3: +%3hhi:0X80:1:3:8: +%*3hhi:0X80:0:3: +%3hhi:0x80:1:3:8: +%*3hhi:0x80:0:3: +%3hhi:0200:1:3:16: +%*3hhi:0200:0:3: +%3hhi:0B10000000:1:3:1: +%*3hhi:0B10000000:0:3: +%3hhi:0b10000000:1:3:1: +%*3hhi:0b10000000:0:3: +%3hhi:169:1:3:-87: +%*3hhi:169:0:3: +%3hhi:0Xa9:1:3:10: +%*3hhi:0Xa9:0:3: +%3hhi:0xA9:1:3:10: +%*3hhi:0xA9:0:3: +%3hhi:0251:1:3:21: +%*3hhi:0251:0:3: +%3hhi:0B10101001:1:3:1: +%*3hhi:0B10101001:0:3: +%3hhi:0b10101001:1:3:1: +%*3hhi:0b10101001:0:3: +%3hhi:+0:1:2:0: +%*3hhi:+0:0:2: +%3hhi:+0X0:0:-1: +%*3hhi:+0X0:0:-1: +%3hhi:+0x0:0:-1: +%*3hhi:+0x0:0:-1: +%3hhi:+00:1:3:0: +%*3hhi:+00:0:3: +%3hhi:+0B0:0:-1: +%*3hhi:+0B0:0:-1: +%3hhi:+0b0:0:-1: +%*3hhi:+0b0:0:-1: +%3hhi:+1:1:2:1: +%*3hhi:+1:0:2: +%3hhi:+0X1:0:-1: +%*3hhi:+0X1:0:-1: +%3hhi:+0x1:0:-1: +%*3hhi:+0x1:0:-1: +%3hhi:+01:1:3:1: +%*3hhi:+01:0:3: +%3hhi:+0B1:0:-1: +%*3hhi:+0B1:0:-1: +%3hhi:+0b1:0:-1: +%*3hhi:+0b1:0:-1: +%3hhi:+42:1:3:42: +%*3hhi:+42:0:3: +%3hhi:+0X2a:0:-1: +%*3hhi:+0X2a:0:-1: +%3hhi:+0x2A:0:-1: +%*3hhi:+0x2A:0:-1: +%3hhi:+052:1:3:5: +%*3hhi:+052:0:3: +%3hhi:+0B101010:0:-1: +%*3hhi:+0B101010:0:-1: +%3hhi:+0b101010:0:-1: +%*3hhi:+0b101010:0:-1: +%3hhi:+127:1:3:12: +%*3hhi:+127:0:3: +%3hhi:+0X7f:0:-1: +%*3hhi:+0X7f:0:-1: +%3hhi:+0x7F:0:-1: +%*3hhi:+0x7F:0:-1: +%3hhi:+0177:1:3:1: +%*3hhi:+0177:0:3: +%3hhi:+0B1111111:0:-1: +%*3hhi:+0B1111111:0:-1: +%3hhi:+0b1111111:0:-1: +%*3hhi:+0b1111111:0:-1: +%3hhi:+128:1:3:12: +%*3hhi:+128:0:3: +%3hhi:+0X80:0:-1: +%*3hhi:+0X80:0:-1: +%3hhi:+0x80:0:-1: +%*3hhi:+0x80:0:-1: +%3hhi:+0200:1:3:2: +%*3hhi:+0200:0:3: +%3hhi:+0B10000000:0:-1: +%*3hhi:+0B10000000:0:-1: +%3hhi:+0b10000000:0:-1: +%*3hhi:+0b10000000:0:-1: +%3hhi:+169:1:3:16: +%*3hhi:+169:0:3: +%3hhi:+0Xa9:0:-1: +%*3hhi:+0Xa9:0:-1: +%3hhi:+0xA9:0:-1: +%*3hhi:+0xA9:0:-1: +%3hhi:+0251:1:3:2: +%*3hhi:+0251:0:3: +%3hhi:+0B10101001:0:-1: +%*3hhi:+0B10101001:0:-1: +%3hhi:+0b10101001:0:-1: +%*3hhi:+0b10101001:0:-1: +%5hhi::0:-1: +%*5hhi::0:-1: +%5hhi:-251:1:4:5: +%*5hhi:-251:0:4: +%5hhi:-0Xfb:1:5:5: +%*5hhi:-0Xfb:0:5: +%5hhi:-0xFB:1:5:5: +%*5hhi:-0xFB:0:5: +%5hhi:-0373:1:5:5: +%*5hhi:-0373:0:5: +%5hhi:-0B11111011:1:5:-3: +%*5hhi:-0B11111011:0:5: +%5hhi:-0b11111011:1:5:-3: +%*5hhi:-0b11111011:0:5: +%5hhi:-129:1:4:127: +%*5hhi:-129:0:4: +%5hhi:-0X81:1:5:127: +%*5hhi:-0X81:0:5: +%5hhi:-0x81:1:5:127: +%*5hhi:-0x81:0:5: +%5hhi:-0201:1:5:127: +%*5hhi:-0201:0:5: +%5hhi:-0B10000001:1:5:-2: +%*5hhi:-0B10000001:0:5: +%5hhi:-0b10000001:1:5:-2: +%*5hhi:-0b10000001:0:5: +%5hhi:-128:1:4:-128: +%*5hhi:-128:0:4: +%5hhi:-0X80:1:5:-128: +%*5hhi:-0X80:0:5: +%5hhi:-0x80:1:5:-128: +%*5hhi:-0x80:0:5: +%5hhi:-0200:1:5:-128: +%*5hhi:-0200:0:5: +%5hhi:-0B10000000:1:5:-2: +%*5hhi:-0B10000000:0:5: +%5hhi:-0b10000000:1:5:-2: +%*5hhi:-0b10000000:0:5: +%5hhi:-123:1:4:-123: +%*5hhi:-123:0:4: +%5hhi:-0X7b:1:5:-123: +%*5hhi:-0X7b:0:5: +%5hhi:-0x7B:1:5:-123: +%*5hhi:-0x7B:0:5: +%5hhi:-0173:1:5:-123: +%*5hhi:-0173:0:5: +%5hhi:-0B1111011:1:5:-3: +%*5hhi:-0B1111011:0:5: +%5hhi:-0b1111011:1:5:-3: +%*5hhi:-0b1111011:0:5: +%5hhi:-1:1:2:-1: +%*5hhi:-1:0:2: +%5hhi:-0X1:1:4:-1: +%*5hhi:-0X1:0:4: +%5hhi:-0x1:1:4:-1: +%*5hhi:-0x1:0:4: +%5hhi:-01:1:3:-1: +%*5hhi:-01:0:3: +%5hhi:-0B1:1:4:-1: +%*5hhi:-0B1:0:4: +%5hhi:-0b1:1:4:-1: +%*5hhi:-0b1:0:4: +%5hhi:-0:1:2:0: +%*5hhi:-0:0:2: +%5hhi:-0X0:1:4:0: +%*5hhi:-0X0:0:4: +%5hhi:-0x0:1:4:0: +%*5hhi:-0x0:0:4: +%5hhi:-00:1:3:0: +%*5hhi:-00:0:3: +%5hhi:-0B0:1:4:0: +%*5hhi:-0B0:0:4: +%5hhi:-0b0:1:4:0: +%*5hhi:-0b0:0:4: +%5hhi:0:1:1:0: +%*5hhi:0:0:1: +%5hhi:0X0:1:3:0: +%*5hhi:0X0:0:3: +%5hhi:0x0:1:3:0: +%*5hhi:0x0:0:3: +%5hhi:00:1:2:0: +%*5hhi:00:0:2: +%5hhi:0B0:1:3:0: +%*5hhi:0B0:0:3: +%5hhi:0b0:1:3:0: +%*5hhi:0b0:0:3: +%5hhi:1:1:1:1: +%*5hhi:1:0:1: +%5hhi:0X1:1:3:1: +%*5hhi:0X1:0:3: +%5hhi:0x1:1:3:1: +%*5hhi:0x1:0:3: +%5hhi:01:1:2:1: +%*5hhi:01:0:2: +%5hhi:0B1:1:3:1: +%*5hhi:0B1:0:3: +%5hhi:0b1:1:3:1: +%*5hhi:0b1:0:3: +%5hhi:42:1:2:42: +%*5hhi:42:0:2: +%5hhi:0X2a:1:4:42: +%*5hhi:0X2a:0:4: +%5hhi:0x2A:1:4:42: +%*5hhi:0x2A:0:4: +%5hhi:052:1:3:42: +%*5hhi:052:0:3: +%5hhi:0B101010:1:5:5: +%*5hhi:0B101010:0:5: +%5hhi:0b101010:1:5:5: +%*5hhi:0b101010:0:5: +%5hhi:127:1:3:127: +%*5hhi:127:0:3: +%5hhi:0X7f:1:4:127: +%*5hhi:0X7f:0:4: +%5hhi:0x7F:1:4:127: +%*5hhi:0x7F:0:4: +%5hhi:0177:1:4:127: +%*5hhi:0177:0:4: +%5hhi:0B1111111:1:5:7: +%*5hhi:0B1111111:0:5: +%5hhi:0b1111111:1:5:7: +%*5hhi:0b1111111:0:5: +%5hhi:128:1:3:-128: +%*5hhi:128:0:3: +%5hhi:0X80:1:4:-128: +%*5hhi:0X80:0:4: +%5hhi:0x80:1:4:-128: +%*5hhi:0x80:0:4: +%5hhi:0200:1:4:-128: +%*5hhi:0200:0:4: +%5hhi:0B10000000:1:5:4: +%*5hhi:0B10000000:0:5: +%5hhi:0b10000000:1:5:4: +%*5hhi:0b10000000:0:5: +%5hhi:169:1:3:-87: +%*5hhi:169:0:3: +%5hhi:0Xa9:1:4:-87: +%*5hhi:0Xa9:0:4: +%5hhi:0xA9:1:4:-87: +%*5hhi:0xA9:0:4: +%5hhi:0251:1:4:-87: +%*5hhi:0251:0:4: +%5hhi:0B10101001:1:5:5: +%*5hhi:0B10101001:0:5: +%5hhi:0b10101001:1:5:5: +%*5hhi:0b10101001:0:5: +%5hhi:+0:1:2:0: +%*5hhi:+0:0:2: +%5hhi:+0X0:1:4:0: +%*5hhi:+0X0:0:4: +%5hhi:+0x0:1:4:0: +%*5hhi:+0x0:0:4: +%5hhi:+00:1:3:0: +%*5hhi:+00:0:3: +%5hhi:+0B0:1:4:0: +%*5hhi:+0B0:0:4: +%5hhi:+0b0:1:4:0: +%*5hhi:+0b0:0:4: +%5hhi:+1:1:2:1: +%*5hhi:+1:0:2: +%5hhi:+0X1:1:4:1: +%*5hhi:+0X1:0:4: +%5hhi:+0x1:1:4:1: +%*5hhi:+0x1:0:4: +%5hhi:+01:1:3:1: +%*5hhi:+01:0:3: +%5hhi:+0B1:1:4:1: +%*5hhi:+0B1:0:4: +%5hhi:+0b1:1:4:1: +%*5hhi:+0b1:0:4: +%5hhi:+42:1:3:42: +%*5hhi:+42:0:3: +%5hhi:+0X2a:1:5:42: +%*5hhi:+0X2a:0:5: +%5hhi:+0x2A:1:5:42: +%*5hhi:+0x2A:0:5: +%5hhi:+052:1:4:42: +%*5hhi:+052:0:4: +%5hhi:+0B101010:1:5:2: +%*5hhi:+0B101010:0:5: +%5hhi:+0b101010:1:5:2: +%*5hhi:+0b101010:0:5: +%5hhi:+127:1:4:127: +%*5hhi:+127:0:4: +%5hhi:+0X7f:1:5:127: +%*5hhi:+0X7f:0:5: +%5hhi:+0x7F:1:5:127: +%*5hhi:+0x7F:0:5: +%5hhi:+0177:1:5:127: +%*5hhi:+0177:0:5: +%5hhi:+0B1111111:1:5:3: +%*5hhi:+0B1111111:0:5: +%5hhi:+0b1111111:1:5:3: +%*5hhi:+0b1111111:0:5: +%5hhi:+128:1:4:-128: +%*5hhi:+128:0:4: +%5hhi:+0X80:1:5:-128: +%*5hhi:+0X80:0:5: +%5hhi:+0x80:1:5:-128: +%*5hhi:+0x80:0:5: +%5hhi:+0200:1:5:-128: +%*5hhi:+0200:0:5: +%5hhi:+0B10000000:1:5:2: +%*5hhi:+0B10000000:0:5: +%5hhi:+0b10000000:1:5:2: +%*5hhi:+0b10000000:0:5: +%5hhi:+169:1:4:-87: +%*5hhi:+169:0:4: +%5hhi:+0Xa9:1:5:-87: +%*5hhi:+0Xa9:0:5: +%5hhi:+0xA9:1:5:-87: +%*5hhi:+0xA9:0:5: +%5hhi:+0251:1:5:-87: +%*5hhi:+0251:0:5: +%5hhi:+0B10101001:1:5:2: +%*5hhi:+0B10101001:0:5: +%5hhi:+0b10101001:1:5:2: +%*5hhi:+0b10101001:0:5: +%2hhi: :0:-1: +%*2hhi: :0:-1: +%2hhi: -251:1:3:-2: +%*2hhi: -251:0:3: +%2hhi: -0Xfb:1:3:0: +%*2hhi: -0Xfb:0:3: +%2hhi: -0xFB:1:3:0: +%*2hhi: -0xFB:0:3: +%2hhi: -0373:1:3:0: +%*2hhi: -0373:0:3: +%2hhi: -0B11111011:1:3:0: +%*2hhi: -0B11111011:0:3: +%2hhi: -0b11111011:1:3:0: +%*2hhi: -0b11111011:0:3: +%2hhi: -129:1:3:-1: +%*2hhi: -129:0:3: +%2hhi: -0X81:1:3:0: +%*2hhi: -0X81:0:3: +%2hhi: -0x81:1:3:0: +%*2hhi: -0x81:0:3: +%2hhi: -0201:1:3:0: +%*2hhi: -0201:0:3: +%2hhi: -0B10000001:1:3:0: +%*2hhi: -0B10000001:0:3: +%2hhi: -0b10000001:1:3:0: +%*2hhi: -0b10000001:0:3: +%2hhi: -128:1:3:-1: +%*2hhi: -128:0:3: +%2hhi: -0X80:1:3:0: +%*2hhi: -0X80:0:3: +%2hhi: -0x80:1:3:0: +%*2hhi: -0x80:0:3: +%2hhi: -0200:1:3:0: +%*2hhi: -0200:0:3: +%2hhi: -0B10000000:1:3:0: +%*2hhi: -0B10000000:0:3: +%2hhi: -0b10000000:1:3:0: +%*2hhi: -0b10000000:0:3: +%2hhi: -123:1:3:-1: +%*2hhi: -123:0:3: +%2hhi: -0X7b:1:3:0: +%*2hhi: -0X7b:0:3: +%2hhi: -0x7B:1:3:0: +%*2hhi: -0x7B:0:3: +%2hhi: -0173:1:3:0: +%*2hhi: -0173:0:3: +%2hhi: -0B1111011:1:3:0: +%*2hhi: -0B1111011:0:3: +%2hhi: -0b1111011:1:3:0: +%*2hhi: -0b1111011:0:3: +%2hhi: -1:1:3:-1: +%*2hhi: -1:0:3: +%2hhi: -0X1:1:3:0: +%*2hhi: -0X1:0:3: +%2hhi: -0x1:1:3:0: +%*2hhi: -0x1:0:3: +%2hhi: -01:1:3:0: +%*2hhi: -01:0:3: +%2hhi: -0B1:1:3:0: +%*2hhi: -0B1:0:3: +%2hhi: -0b1:1:3:0: +%*2hhi: -0b1:0:3: +%2hhi: -0:1:3:0: +%*2hhi: -0:0:3: +%2hhi: -0X0:1:3:0: +%*2hhi: -0X0:0:3: +%2hhi: -0x0:1:3:0: +%*2hhi: -0x0:0:3: +%2hhi: -00:1:3:0: +%*2hhi: -00:0:3: +%2hhi: -0B0:1:3:0: +%*2hhi: -0B0:0:3: +%2hhi: -0b0:1:3:0: +%*2hhi: -0b0:0:3: +%2hhi: 0:1:2:0: +%*2hhi: 0:0:2: +%2hhi: 0X0:0:-1: +%*2hhi: 0X0:0:-1: +%2hhi: 0x0:0:-1: +%*2hhi: 0x0:0:-1: +%2hhi: 00:1:3:0: +%*2hhi: 00:0:3: +%2hhi: 0B0:0:-1: +%*2hhi: 0B0:0:-1: +%2hhi: 0b0:0:-1: +%*2hhi: 0b0:0:-1: +%2hhi: 1:1:2:1: +%*2hhi: 1:0:2: +%2hhi: 0X1:0:-1: +%*2hhi: 0X1:0:-1: +%2hhi: 0x1:0:-1: +%*2hhi: 0x1:0:-1: +%2hhi: 01:1:3:1: +%*2hhi: 01:0:3: +%2hhi: 0B1:0:-1: +%*2hhi: 0B1:0:-1: +%2hhi: 0b1:0:-1: +%*2hhi: 0b1:0:-1: +%2hhi: 42:1:3:42: +%*2hhi: 42:0:3: +%2hhi: 0X2a:0:-1: +%*2hhi: 0X2a:0:-1: +%2hhi: 0x2A:0:-1: +%*2hhi: 0x2A:0:-1: +%2hhi: 052:1:3:5: +%*2hhi: 052:0:3: +%2hhi: 0B101010:0:-1: +%*2hhi: 0B101010:0:-1: +%2hhi: 0b101010:0:-1: +%*2hhi: 0b101010:0:-1: +%2hhi: 127:1:3:12: +%*2hhi: 127:0:3: +%2hhi: 0X7f:0:-1: +%*2hhi: 0X7f:0:-1: +%2hhi: 0x7F:0:-1: +%*2hhi: 0x7F:0:-1: +%2hhi: 0177:1:3:1: +%*2hhi: 0177:0:3: +%2hhi: 0B1111111:0:-1: +%*2hhi: 0B1111111:0:-1: +%2hhi: 0b1111111:0:-1: +%*2hhi: 0b1111111:0:-1: +%2hhi: 128:1:3:12: +%*2hhi: 128:0:3: +%2hhi: 0X80:0:-1: +%*2hhi: 0X80:0:-1: +%2hhi: 0x80:0:-1: +%*2hhi: 0x80:0:-1: +%2hhi: 0200:1:3:2: +%*2hhi: 0200:0:3: +%2hhi: 0B10000000:0:-1: +%*2hhi: 0B10000000:0:-1: +%2hhi: 0b10000000:0:-1: +%*2hhi: 0b10000000:0:-1: +%2hhi: 169:1:3:16: +%*2hhi: 169:0:3: +%2hhi: 0Xa9:0:-1: +%*2hhi: 0Xa9:0:-1: +%2hhi: 0xA9:0:-1: +%*2hhi: 0xA9:0:-1: +%2hhi: 0251:1:3:2: +%*2hhi: 0251:0:3: +%2hhi: 0B10101001:0:-1: +%*2hhi: 0B10101001:0:-1: +%2hhi: 0b10101001:0:-1: +%*2hhi: 0b10101001:0:-1: +%2hhi: +0:1:3:0: +%*2hhi: +0:0:3: +%2hhi: +0X0:1:3:0: +%*2hhi: +0X0:0:3: +%2hhi: +0x0:1:3:0: +%*2hhi: +0x0:0:3: +%2hhi: +00:1:3:0: +%*2hhi: +00:0:3: +%2hhi: +0B0:1:3:0: +%*2hhi: +0B0:0:3: +%2hhi: +0b0:1:3:0: +%*2hhi: +0b0:0:3: +%2hhi: +1:1:3:1: +%*2hhi: +1:0:3: +%2hhi: +0X1:1:3:0: +%*2hhi: +0X1:0:3: +%2hhi: +0x1:1:3:0: +%*2hhi: +0x1:0:3: +%2hhi: +01:1:3:0: +%*2hhi: +01:0:3: +%2hhi: +0B1:1:3:0: +%*2hhi: +0B1:0:3: +%2hhi: +0b1:1:3:0: +%*2hhi: +0b1:0:3: +%2hhi: +42:1:3:4: +%*2hhi: +42:0:3: +%2hhi: +0X2a:1:3:0: +%*2hhi: +0X2a:0:3: +%2hhi: +0x2A:1:3:0: +%*2hhi: +0x2A:0:3: +%2hhi: +052:1:3:0: +%*2hhi: +052:0:3: +%2hhi: +0B101010:1:3:0: +%*2hhi: +0B101010:0:3: +%2hhi: +0b101010:1:3:0: +%*2hhi: +0b101010:0:3: +%2hhi: +127:1:3:1: +%*2hhi: +127:0:3: +%2hhi: +0X7f:1:3:0: +%*2hhi: +0X7f:0:3: +%2hhi: +0x7F:1:3:0: +%*2hhi: +0x7F:0:3: +%2hhi: +0177:1:3:0: +%*2hhi: +0177:0:3: +%2hhi: +0B1111111:1:3:0: +%*2hhi: +0B1111111:0:3: +%2hhi: +0b1111111:1:3:0: +%*2hhi: +0b1111111:0:3: +%2hhi: +128:1:3:1: +%*2hhi: +128:0:3: +%2hhi: +0X80:1:3:0: +%*2hhi: +0X80:0:3: +%2hhi: +0x80:1:3:0: +%*2hhi: +0x80:0:3: +%2hhi: +0200:1:3:0: +%*2hhi: +0200:0:3: +%2hhi: +0B10000000:1:3:0: +%*2hhi: +0B10000000:0:3: +%2hhi: +0b10000000:1:3:0: +%*2hhi: +0b10000000:0:3: +%2hhi: +169:1:3:1: +%*2hhi: +169:0:3: +%2hhi: +0Xa9:1:3:0: +%*2hhi: +0Xa9:0:3: +%2hhi: +0xA9:1:3:0: +%*2hhi: +0xA9:0:3: +%2hhi: +0251:1:3:0: +%*2hhi: +0251:0:3: +%2hhi: +0B10101001:1:3:0: +%*2hhi: +0B10101001:0:3: +%2hhi: +0b10101001:1:3:0: +%*2hhi: +0b10101001:0:3: +%5hhi: :0:-1: +%*5hhi: :0:-1: +%5hhi: -251:1:5:5: +%*5hhi: -251:0:5: +%5hhi: -0Xfb:1:6:5: +%*5hhi: -0Xfb:0:6: +%5hhi: -0xFB:1:6:5: +%*5hhi: -0xFB:0:6: +%5hhi: -0373:1:6:5: +%*5hhi: -0373:0:6: +%5hhi: -0B11111011:1:6:-3: +%*5hhi: -0B11111011:0:6: +%5hhi: -0b11111011:1:6:-3: +%*5hhi: -0b11111011:0:6: +%5hhi: -129:1:5:127: +%*5hhi: -129:0:5: +%5hhi: -0X81:1:6:127: +%*5hhi: -0X81:0:6: +%5hhi: -0x81:1:6:127: +%*5hhi: -0x81:0:6: +%5hhi: -0201:1:6:127: +%*5hhi: -0201:0:6: +%5hhi: -0B10000001:1:6:-2: +%*5hhi: -0B10000001:0:6: +%5hhi: -0b10000001:1:6:-2: +%*5hhi: -0b10000001:0:6: +%5hhi: -128:1:5:-128: +%*5hhi: -128:0:5: +%5hhi: -0X80:1:6:-128: +%*5hhi: -0X80:0:6: +%5hhi: -0x80:1:6:-128: +%*5hhi: -0x80:0:6: +%5hhi: -0200:1:6:-128: +%*5hhi: -0200:0:6: +%5hhi: -0B10000000:1:6:-2: +%*5hhi: -0B10000000:0:6: +%5hhi: -0b10000000:1:6:-2: +%*5hhi: -0b10000000:0:6: +%5hhi: -123:1:5:-123: +%*5hhi: -123:0:5: +%5hhi: -0X7b:1:6:-123: +%*5hhi: -0X7b:0:6: +%5hhi: -0x7B:1:6:-123: +%*5hhi: -0x7B:0:6: +%5hhi: -0173:1:6:-123: +%*5hhi: -0173:0:6: +%5hhi: -0B1111011:1:6:-3: +%*5hhi: -0B1111011:0:6: +%5hhi: -0b1111011:1:6:-3: +%*5hhi: -0b1111011:0:6: +%5hhi: -1:1:3:-1: +%*5hhi: -1:0:3: +%5hhi: -0X1:1:5:-1: +%*5hhi: -0X1:0:5: +%5hhi: -0x1:1:5:-1: +%*5hhi: -0x1:0:5: +%5hhi: -01:1:4:-1: +%*5hhi: -01:0:4: +%5hhi: -0B1:1:5:-1: +%*5hhi: -0B1:0:5: +%5hhi: -0b1:1:5:-1: +%*5hhi: -0b1:0:5: +%5hhi: -0:1:3:0: +%*5hhi: -0:0:3: +%5hhi: -0X0:1:5:0: +%*5hhi: -0X0:0:5: +%5hhi: -0x0:1:5:0: +%*5hhi: -0x0:0:5: +%5hhi: -00:1:4:0: +%*5hhi: -00:0:4: +%5hhi: -0B0:1:5:0: +%*5hhi: -0B0:0:5: +%5hhi: -0b0:1:5:0: +%*5hhi: -0b0:0:5: +%5hhi: 0:1:2:0: +%*5hhi: 0:0:2: +%5hhi: 0X0:1:4:0: +%*5hhi: 0X0:0:4: +%5hhi: 0x0:1:4:0: +%*5hhi: 0x0:0:4: +%5hhi: 00:1:3:0: +%*5hhi: 00:0:3: +%5hhi: 0B0:1:4:0: +%*5hhi: 0B0:0:4: +%5hhi: 0b0:1:4:0: +%*5hhi: 0b0:0:4: +%5hhi: 1:1:2:1: +%*5hhi: 1:0:2: +%5hhi: 0X1:1:4:1: +%*5hhi: 0X1:0:4: +%5hhi: 0x1:1:4:1: +%*5hhi: 0x1:0:4: +%5hhi: 01:1:3:1: +%*5hhi: 01:0:3: +%5hhi: 0B1:1:4:1: +%*5hhi: 0B1:0:4: +%5hhi: 0b1:1:4:1: +%*5hhi: 0b1:0:4: +%5hhi: 42:1:3:42: +%*5hhi: 42:0:3: +%5hhi: 0X2a:1:5:42: +%*5hhi: 0X2a:0:5: +%5hhi: 0x2A:1:5:42: +%*5hhi: 0x2A:0:5: +%5hhi: 052:1:4:42: +%*5hhi: 052:0:4: +%5hhi: 0B101010:1:6:5: +%*5hhi: 0B101010:0:6: +%5hhi: 0b101010:1:6:5: +%*5hhi: 0b101010:0:6: +%5hhi: 127:1:4:127: +%*5hhi: 127:0:4: +%5hhi: 0X7f:1:5:127: +%*5hhi: 0X7f:0:5: +%5hhi: 0x7F:1:5:127: +%*5hhi: 0x7F:0:5: +%5hhi: 0177:1:5:127: +%*5hhi: 0177:0:5: +%5hhi: 0B1111111:1:6:7: +%*5hhi: 0B1111111:0:6: +%5hhi: 0b1111111:1:6:7: +%*5hhi: 0b1111111:0:6: +%5hhi: 128:1:4:-128: +%*5hhi: 128:0:4: +%5hhi: 0X80:1:5:-128: +%*5hhi: 0X80:0:5: +%5hhi: 0x80:1:5:-128: +%*5hhi: 0x80:0:5: +%5hhi: 0200:1:5:-128: +%*5hhi: 0200:0:5: +%5hhi: 0B10000000:1:6:4: +%*5hhi: 0B10000000:0:6: +%5hhi: 0b10000000:1:6:4: +%*5hhi: 0b10000000:0:6: +%5hhi: 169:1:4:-87: +%*5hhi: 169:0:4: +%5hhi: 0Xa9:1:5:-87: +%*5hhi: 0Xa9:0:5: +%5hhi: 0xA9:1:5:-87: +%*5hhi: 0xA9:0:5: +%5hhi: 0251:1:5:-87: +%*5hhi: 0251:0:5: +%5hhi: 0B10101001:1:6:5: +%*5hhi: 0B10101001:0:6: +%5hhi: 0b10101001:1:6:5: +%*5hhi: 0b10101001:0:6: +%5hhi: +0:1:3:0: +%*5hhi: +0:0:3: +%5hhi: +0X0:1:5:0: +%*5hhi: +0X0:0:5: +%5hhi: +0x0:1:5:0: +%*5hhi: +0x0:0:5: +%5hhi: +00:1:4:0: +%*5hhi: +00:0:4: +%5hhi: +0B0:1:5:0: +%*5hhi: +0B0:0:5: +%5hhi: +0b0:1:5:0: +%*5hhi: +0b0:0:5: +%5hhi: +1:1:3:1: +%*5hhi: +1:0:3: +%5hhi: +0X1:1:5:1: +%*5hhi: +0X1:0:5: +%5hhi: +0x1:1:5:1: +%*5hhi: +0x1:0:5: +%5hhi: +01:1:4:1: +%*5hhi: +01:0:4: +%5hhi: +0B1:1:5:1: +%*5hhi: +0B1:0:5: +%5hhi: +0b1:1:5:1: +%*5hhi: +0b1:0:5: +%5hhi: +42:1:4:42: +%*5hhi: +42:0:4: +%5hhi: +0X2a:1:6:42: +%*5hhi: +0X2a:0:6: +%5hhi: +0x2A:1:6:42: +%*5hhi: +0x2A:0:6: +%5hhi: +052:1:5:42: +%*5hhi: +052:0:5: +%5hhi: +0B101010:1:6:2: +%*5hhi: +0B101010:0:6: +%5hhi: +0b101010:1:6:2: +%*5hhi: +0b101010:0:6: +%5hhi: +127:1:5:127: +%*5hhi: +127:0:5: +%5hhi: +0X7f:1:6:127: +%*5hhi: +0X7f:0:6: +%5hhi: +0x7F:1:6:127: +%*5hhi: +0x7F:0:6: +%5hhi: +0177:1:6:127: +%*5hhi: +0177:0:6: +%5hhi: +0B1111111:1:6:3: +%*5hhi: +0B1111111:0:6: +%5hhi: +0b1111111:1:6:3: +%*5hhi: +0b1111111:0:6: +%5hhi: +128:1:5:-128: +%*5hhi: +128:0:5: +%5hhi: +0X80:1:6:-128: +%*5hhi: +0X80:0:6: +%5hhi: +0x80:1:6:-128: +%*5hhi: +0x80:0:6: +%5hhi: +0200:1:6:-128: +%*5hhi: +0200:0:6: +%5hhi: +0B10000000:1:6:2: +%*5hhi: +0B10000000:0:6: +%5hhi: +0b10000000:1:6:2: +%*5hhi: +0b10000000:0:6: +%5hhi: +169:1:5:-87: +%*5hhi: +169:0:5: +%5hhi: +0Xa9:1:6:-87: +%*5hhi: +0Xa9:0:6: +%5hhi: +0xA9:1:6:-87: +%*5hhi: +0xA9:0:6: +%5hhi: +0251:1:6:-87: +%*5hhi: +0251:0:6: +%5hhi: +0B10101001:1:6:2: +%*5hhi: +0B10101001:0:6: +%5hhi: +0b10101001:1:6:2: +%*5hhi: +0b10101001:0:6: diff --git a/stdio-common/tst-scanf-format-character.h b/stdio-common/tst-scanf-format-character.h new file mode 100644 index 0000000..b68a5e1 --- /dev/null +++ b/stdio-common/tst-scanf-format-character.h @@ -0,0 +1,130 @@ +/* Test feature wrapper for formatted character input. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <string.h> + +#include <support/next_to_fault.h> + +/* Reference data is a sequence of characters to match against + byte-wise. + + For the 's' conversion specifier the number of characters read + from input includes any leading white-space characters consumed + as well, so we also consider it a successful match when the ':' + character following the reference data matches a terminating null + character in the output produced by the 'scanf' family function + under test while the character count hasn't been exhausted yet. + + The buffer is preinitialized to contain repeating '\xa5' character + so as to catch missing data output. Also no data is expected to be + written beyond the character sequence received, which is verified + by checking the following character in the buffer to remain '\xa5'. */ + +#define SCANF_BUFFER_SIZE 65536 + +static struct support_next_to_fault ntf; + +#define PREPARE initialize_value_init +static void +initialize_value_init (int argc, char **argv) +{ + ntf = support_next_to_fault_allocate (SCANF_BUFFER_SIZE); +} + +static void __attribute__ ((destructor)) +initialize_value_fini (void) +{ + support_next_to_fault_free (&ntf); +} + +#define pointer_to_value(val) (val) + +#define initialize_value(val) \ +do \ + { \ + val = ntf.buffer; \ + memset (val, 0xa5, SCANF_BUFFER_SIZE); \ + } \ +while (0) + +#define verify_input(f, val, count, errp) \ +({ \ + __label__ out, skip; \ + bool match = true; \ + int err = 0; \ + size_t i; \ + int ch; \ + \ + for (i = 0; i < count; i++) \ + { \ + ch = read_input (); \ + if (ch < 0) \ + { \ + err = ch; \ + goto out; \ + } \ + if (ch == ':' && val[i] == '\0' && f == 's') \ + goto skip; \ + if (ch != val[i]) \ + { \ + match = false; \ + goto out; \ + } \ + } \ + ch = read_input (); \ + if (ch < 0) \ + { \ + err = ch; \ + goto out; \ + } \ + \ +skip: \ + if (f != 'c' && val[i++] != '\0') \ + { \ + err = OUTPUT_TERM; \ + goto out; \ + } \ + if (val[i] != '\xa5') \ + { \ + err = OUTPUT_OVERRUN; \ + goto out; \ + } \ + \ + while (ch != ':') \ + { \ + ch = read_input (); \ + if (ch < 0) \ + { \ + err = ch; \ + goto out; \ + } \ + match = false; \ + } \ + \ +out: \ + if (err || !match) \ + { \ + printf ("error: %s:%d: input buffer: `", __FILE__, __LINE__); \ + for (size_t j = 0; j <= i; j++) \ + printf ("%c", val[j]); \ + printf ("'\n"); \ + } \ + \ + *errp = err; \ + match; \ +}) diff --git a/stdio-common/tst-scanf-format-f-c.c b/stdio-common/tst-scanf-format-f-c.c new file mode 100644 index 0000000..75ce3cd --- /dev/null +++ b/stdio-common/tst-scanf-format-f-c.c @@ -0,0 +1,22 @@ +/* Test for formatted 'fscanf' input for the character conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-f.h" +#include "tst-scanf-format-character.h" +#include "tst-scanf-format-skeleton-c.c" diff --git a/stdio-common/tst-scanf-format-f-char.c b/stdio-common/tst-scanf-format-f-char.c new file mode 100644 index 0000000..ee5fbe9 --- /dev/null +++ b/stdio-common/tst-scanf-format-f-char.c @@ -0,0 +1,22 @@ +/* Test for formatted 'fscanf' input for signed char conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-f.h" +#include "tst-scanf-format-integer.h" +#include "tst-scanf-format-skeleton-char.c" diff --git a/stdio-common/tst-scanf-format-f-double.c b/stdio-common/tst-scanf-format-f-double.c new file mode 100644 index 0000000..1fb25b5 --- /dev/null +++ b/stdio-common/tst-scanf-format-f-double.c @@ -0,0 +1,22 @@ +/* Test for formatted 'fscanf' input for double conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-f.h" +#include "tst-scanf-format-real.h" +#include "tst-scanf-format-skeleton-double.c" diff --git a/stdio-common/tst-scanf-format-f-float.c b/stdio-common/tst-scanf-format-f-float.c new file mode 100644 index 0000000..b5a6ae4 --- /dev/null +++ b/stdio-common/tst-scanf-format-f-float.c @@ -0,0 +1,22 @@ +/* Test for formatted 'fscanf' input for float conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-f.h" +#include "tst-scanf-format-real.h" +#include "tst-scanf-format-skeleton-float.c" diff --git a/stdio-common/tst-scanf-format-f-int.c b/stdio-common/tst-scanf-format-f-int.c new file mode 100644 index 0000000..961d66b --- /dev/null +++ b/stdio-common/tst-scanf-format-f-int.c @@ -0,0 +1,22 @@ +/* Test for formatted 'fscanf' input for int conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-f.h" +#include "tst-scanf-format-integer.h" +#include "tst-scanf-format-skeleton-int.c" diff --git a/stdio-common/tst-scanf-format-f-ldouble.c b/stdio-common/tst-scanf-format-f-ldouble.c new file mode 100644 index 0000000..6198d35 --- /dev/null +++ b/stdio-common/tst-scanf-format-f-ldouble.c @@ -0,0 +1,22 @@ +/* Test for formatted 'fscanf' input for long double conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-f.h" +#include "tst-scanf-format-real.h" +#include "tst-scanf-format-skeleton-ldouble.c" diff --git a/stdio-common/tst-scanf-format-f-llong.c b/stdio-common/tst-scanf-format-f-llong.c new file mode 100644 index 0000000..1af672f --- /dev/null +++ b/stdio-common/tst-scanf-format-f-llong.c @@ -0,0 +1,22 @@ +/* Test for formatted 'fscanf' input for long long conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-f.h" +#include "tst-scanf-format-integer.h" +#include "tst-scanf-format-skeleton-llong.c" diff --git a/stdio-common/tst-scanf-format-f-long.c b/stdio-common/tst-scanf-format-f-long.c new file mode 100644 index 0000000..fc90811 --- /dev/null +++ b/stdio-common/tst-scanf-format-f-long.c @@ -0,0 +1,22 @@ +/* Test for formatted 'fscanf' input for long conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-f.h" +#include "tst-scanf-format-integer.h" +#include "tst-scanf-format-skeleton-long.c" diff --git a/stdio-common/tst-scanf-format-f-short.c b/stdio-common/tst-scanf-format-f-short.c new file mode 100644 index 0000000..61697e2 --- /dev/null +++ b/stdio-common/tst-scanf-format-f-short.c @@ -0,0 +1,22 @@ +/* Test for formatted 'fscanf' input for short int conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-f.h" +#include "tst-scanf-format-integer.h" +#include "tst-scanf-format-skeleton-short.c" diff --git a/stdio-common/tst-scanf-format-f-uchar.c b/stdio-common/tst-scanf-format-f-uchar.c new file mode 100644 index 0000000..b4b8af3 --- /dev/null +++ b/stdio-common/tst-scanf-format-f-uchar.c @@ -0,0 +1,22 @@ +/* Test for formatted 'fscanf' input for unsigned char conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-f.h" +#include "tst-scanf-format-integer.h" +#include "tst-scanf-format-skeleton-uchar.c" diff --git a/stdio-common/tst-scanf-format-f-uint.c b/stdio-common/tst-scanf-format-f-uint.c new file mode 100644 index 0000000..af226b0 --- /dev/null +++ b/stdio-common/tst-scanf-format-f-uint.c @@ -0,0 +1,22 @@ +/* Test for formatted 'fscanf' input for unsigned int conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-f.h" +#include "tst-scanf-format-integer.h" +#include "tst-scanf-format-skeleton-uint.c" diff --git a/stdio-common/tst-scanf-format-f-ullong.c b/stdio-common/tst-scanf-format-f-ullong.c new file mode 100644 index 0000000..50ea812 --- /dev/null +++ b/stdio-common/tst-scanf-format-f-ullong.c @@ -0,0 +1,22 @@ +/* Test for formatted 'fscanf' input for unsigned long long int conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-f.h" +#include "tst-scanf-format-integer.h" +#include "tst-scanf-format-skeleton-ullong.c" diff --git a/stdio-common/tst-scanf-format-f-ulong.c b/stdio-common/tst-scanf-format-f-ulong.c new file mode 100644 index 0000000..673e770 --- /dev/null +++ b/stdio-common/tst-scanf-format-f-ulong.c @@ -0,0 +1,22 @@ +/* Test for formatted 'fscanf' input for unsigned long int conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-f.h" +#include "tst-scanf-format-integer.h" +#include "tst-scanf-format-skeleton-ulong.c" diff --git a/stdio-common/tst-scanf-format-f-ushort.c b/stdio-common/tst-scanf-format-f-ushort.c new file mode 100644 index 0000000..413ba67 --- /dev/null +++ b/stdio-common/tst-scanf-format-f-ushort.c @@ -0,0 +1,22 @@ +/* Test for formatted 'fscanf' input for unsigned short int conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-f.h" +#include "tst-scanf-format-integer.h" +#include "tst-scanf-format-skeleton-ushort.c" diff --git a/stdio-common/tst-scanf-format-f.h b/stdio-common/tst-scanf-format-f.h new file mode 100644 index 0000000..9a4caee --- /dev/null +++ b/stdio-common/tst-scanf-format-f.h @@ -0,0 +1,29 @@ +/* Test feature wrapper for formatted 'fscanf' input. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <stdio.h> + +#define scanf_under_test(...) \ +({ \ + int result = fscanf (stdin, __VA_ARGS__); \ + if (ferror (stdin)) \ + result = INPUT_ERROR; \ + else if (result == EOF) \ + result = INPUT_EOF; \ + result; \ +}) diff --git a/stdio-common/tst-scanf-format-integer.h b/stdio-common/tst-scanf-format-integer.h new file mode 100644 index 0000000..28f91a4 --- /dev/null +++ b/stdio-common/tst-scanf-format-integer.h @@ -0,0 +1,51 @@ +/* Test feature wrapper for formatted integer input. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <string.h> + +/* Reference data is a signed decimal integer constant to compare against + arithmetically. */ + +#define pointer_to_value(val) (&(val)) + +#define initialize_value(val) \ + memset (&val, 0xa5, sizeof (val)) + +#define verify_input(f, val, count, errp) \ +({ \ + __label__ out; \ + bool match = true; \ + int err; \ + \ + UNSIGNED long long v = read_integer (&err); \ + if (err < 0) \ + goto out; \ + match = val == v; \ + \ +out: \ + if (err || !match) \ + { \ + printf ("error: %s:%d: input: %016llx\n", \ + __FILE__, __LINE__, (long long) val); \ + printf ("error: %s:%d: value: %016llx\n", \ + __FILE__, __LINE__, v); \ + } \ + \ + *errp = err; \ + match; \ +}) diff --git a/stdio-common/tst-scanf-format-llong-d.input b/stdio-common/tst-scanf-format-llong-d.input new file mode 100644 index 0000000..f027d12 --- /dev/null +++ b/stdio-common/tst-scanf-format-llong-d.input @@ -0,0 +1,266 @@ +%lld::0:-1: +%*lld::0:-1: +%lld:-9223372036867121486:1:20:-9223372036854775808: +%*lld:-9223372036867121486:0:20: +%lld:-9223372036854775809:1:20:-9223372036854775808: +%*lld:-9223372036854775809:0:20: +%lld:-9223372036854775808:1:20:-9223372036854775808: +%*lld:-9223372036854775808:0:20: +%lld:-123:1:4:-123: +%*lld:-123:0:4: +%lld:-1:1:2:-1: +%*lld:-1:0:2: +%lld:-0:1:2:0: +%*lld:-0:0:2: +%lld:0:1:1:0: +%*lld:0:0:1: +%lld:1:1:1:1: +%*lld:1:0:1: +%lld:42:1:2:42: +%*lld:42:0:2: +%lld:9223372036854775807:1:19:9223372036854775807: +%*lld:9223372036854775807:0:19: +%lld:9223372036854775808:1:19:9223372036854775807: +%*lld:9223372036854775808:0:19: +%lld:9223372036897200049:1:19:9223372036854775807: +%*lld:9223372036897200049:0:19: +%lld:+0:1:2:0: +%*lld:+0:0:2: +%lld:+1:1:2:1: +%*lld:+1:0:2: +%lld:+42:1:3:42: +%*lld:+42:0:3: +%lld:+9223372036854775807:1:20:9223372036854775807: +%*lld:+9223372036854775807:0:20: +%lld:+9223372036854775808:1:20:9223372036854775807: +%*lld:+9223372036854775808:0:20: +%lld:+9223372036897200049:1:20:9223372036854775807: +%*lld:+9223372036897200049:0:20: +%1lld::0:-1: +%*1lld::0:-1: +%1lld:-9223372036867121486:0:-1: +%*1lld:-9223372036867121486:0:-1: +%1lld:-9223372036854775809:0:-1: +%*1lld:-9223372036854775809:0:-1: +%1lld:-9223372036854775808:0:-1: +%*1lld:-9223372036854775808:0:-1: +%1lld:-123:0:-1: +%*1lld:-123:0:-1: +%1lld:-1:0:-1: +%*1lld:-1:0:-1: +%1lld:-0:0:-1: +%*1lld:-0:0:-1: +%1lld:0:1:1:0: +%*1lld:0:0:1: +%1lld:1:1:1:1: +%*1lld:1:0:1: +%1lld:42:1:1:4: +%*1lld:42:0:1: +%1lld:9223372036854775807:1:1:9: +%*1lld:9223372036854775807:0:1: +%1lld:9223372036854775808:1:1:9: +%*1lld:9223372036854775808:0:1: +%1lld:9223372036897200049:1:1:9: +%*1lld:9223372036897200049:0:1: +%1lld:+0:0:-1: +%*1lld:+0:0:-1: +%1lld:+1:0:-1: +%*1lld:+1:0:-1: +%1lld:+42:0:-1: +%*1lld:+42:0:-1: +%1lld:+9223372036854775807:0:-1: +%*1lld:+9223372036854775807:0:-1: +%1lld:+9223372036854775808:0:-1: +%*1lld:+9223372036854775808:0:-1: +%1lld:+9223372036897200049:0:-1: +%*1lld:+9223372036897200049:0:-1: +%2lld::0:-1: +%*2lld::0:-1: +%2lld:-9223372036867121486:1:2:-9: +%*2lld:-9223372036867121486:0:2: +%2lld:-9223372036854775809:1:2:-9: +%*2lld:-9223372036854775809:0:2: +%2lld:-9223372036854775808:1:2:-9: +%*2lld:-9223372036854775808:0:2: +%2lld:-123:1:2:-1: +%*2lld:-123:0:2: +%2lld:-1:1:2:-1: +%*2lld:-1:0:2: +%2lld:-0:1:2:0: +%*2lld:-0:0:2: +%2lld:0:1:1:0: +%*2lld:0:0:1: +%2lld:1:1:1:1: +%*2lld:1:0:1: +%2lld:42:1:2:42: +%*2lld:42:0:2: +%2lld:9223372036854775807:1:2:92: +%*2lld:9223372036854775807:0:2: +%2lld:9223372036854775808:1:2:92: +%*2lld:9223372036854775808:0:2: +%2lld:9223372036897200049:1:2:92: +%*2lld:9223372036897200049:0:2: +%2lld:+0:1:2:0: +%*2lld:+0:0:2: +%2lld:+1:1:2:1: +%*2lld:+1:0:2: +%2lld:+42:1:2:4: +%*2lld:+42:0:2: +%2lld:+9223372036854775807:1:2:9: +%*2lld:+9223372036854775807:0:2: +%2lld:+9223372036854775808:1:2:9: +%*2lld:+9223372036854775808:0:2: +%2lld:+9223372036897200049:1:2:9: +%*2lld:+9223372036897200049:0:2: +%15lld::0:-1: +%*15lld::0:-1: +%15lld:-9223372036867121486:1:15:-92233720368671: +%*15lld:-9223372036867121486:0:15: +%15lld:-9223372036854775809:1:15:-92233720368547: +%*15lld:-9223372036854775809:0:15: +%15lld:-9223372036854775808:1:15:-92233720368547: +%*15lld:-9223372036854775808:0:15: +%15lld:-123:1:4:-123: +%*15lld:-123:0:4: +%15lld:-1:1:2:-1: +%*15lld:-1:0:2: +%15lld:-0:1:2:0: +%*15lld:-0:0:2: +%15lld:0:1:1:0: +%*15lld:0:0:1: +%15lld:1:1:1:1: +%*15lld:1:0:1: +%15lld:42:1:2:42: +%*15lld:42:0:2: +%15lld:9223372036854775807:1:15:922337203685477: +%*15lld:9223372036854775807:0:15: +%15lld:9223372036854775808:1:15:922337203685477: +%*15lld:9223372036854775808:0:15: +%15lld:9223372036897200049:1:15:922337203689720: +%*15lld:9223372036897200049:0:15: +%15lld:+0:1:2:0: +%*15lld:+0:0:2: +%15lld:+1:1:2:1: +%*15lld:+1:0:2: +%15lld:+42:1:3:42: +%*15lld:+42:0:3: +%15lld:+9223372036854775807:1:15:92233720368547: +%*15lld:+9223372036854775807:0:15: +%15lld:+9223372036854775808:1:15:92233720368547: +%*15lld:+9223372036854775808:0:15: +%15lld:+9223372036897200049:1:15:92233720368972: +%*15lld:+9223372036897200049:0:15: +%25lld::0:-1: +%*25lld::0:-1: +%25lld:-9223372036867121486:1:20:-9223372036854775808: +%*25lld:-9223372036867121486:0:20: +%25lld:-9223372036854775809:1:20:-9223372036854775808: +%*25lld:-9223372036854775809:0:20: +%25lld:-9223372036854775808:1:20:-9223372036854775808: +%*25lld:-9223372036854775808:0:20: +%25lld:-123:1:4:-123: +%*25lld:-123:0:4: +%25lld:-1:1:2:-1: +%*25lld:-1:0:2: +%25lld:-0:1:2:0: +%*25lld:-0:0:2: +%25lld:0:1:1:0: +%*25lld:0:0:1: +%25lld:1:1:1:1: +%*25lld:1:0:1: +%25lld:42:1:2:42: +%*25lld:42:0:2: +%25lld:9223372036854775807:1:19:9223372036854775807: +%*25lld:9223372036854775807:0:19: +%25lld:9223372036854775808:1:19:9223372036854775807: +%*25lld:9223372036854775808:0:19: +%25lld:9223372036897200049:1:19:9223372036854775807: +%*25lld:9223372036897200049:0:19: +%25lld:+0:1:2:0: +%*25lld:+0:0:2: +%25lld:+1:1:2:1: +%*25lld:+1:0:2: +%25lld:+42:1:3:42: +%*25lld:+42:0:3: +%25lld:+9223372036854775807:1:20:9223372036854775807: +%*25lld:+9223372036854775807:0:20: +%25lld:+9223372036854775808:1:20:9223372036854775807: +%*25lld:+9223372036854775808:0:20: +%25lld:+9223372036897200049:1:20:9223372036854775807: +%*25lld:+9223372036897200049:0:20: +%2lld: :0:-1: +%*2lld: :0:-1: +%2lld: -9223372036867121486:1:3:-9: +%*2lld: -9223372036867121486:0:3: +%2lld: -9223372036854775809:1:3:-9: +%*2lld: -9223372036854775809:0:3: +%2lld: -9223372036854775808:1:3:-9: +%*2lld: -9223372036854775808:0:3: +%2lld: -123:1:3:-1: +%*2lld: -123:0:3: +%2lld: -1:1:3:-1: +%*2lld: -1:0:3: +%2lld: -0:1:3:0: +%*2lld: -0:0:3: +%2lld: 0:1:2:0: +%*2lld: 0:0:2: +%2lld: 1:1:2:1: +%*2lld: 1:0:2: +%2lld: 42:1:3:42: +%*2lld: 42:0:3: +%2lld: 9223372036854775807:1:3:92: +%*2lld: 9223372036854775807:0:3: +%2lld: 9223372036854775808:1:3:92: +%*2lld: 9223372036854775808:0:3: +%2lld: 9223372036897200049:1:3:92: +%*2lld: 9223372036897200049:0:3: +%2lld: +0:1:3:0: +%*2lld: +0:0:3: +%2lld: +1:1:3:1: +%*2lld: +1:0:3: +%2lld: +42:1:3:4: +%*2lld: +42:0:3: +%2lld: +9223372036854775807:1:3:9: +%*2lld: +9223372036854775807:0:3: +%2lld: +9223372036854775808:1:3:9: +%*2lld: +9223372036854775808:0:3: +%2lld: +9223372036897200049:1:3:9: +%*2lld: +9223372036897200049:0:3: +%25lld: :0:-1: +%*25lld: :0:-1: +%25lld: -9223372036867121486:1:21:-9223372036854775808: +%*25lld: -9223372036867121486:0:21: +%25lld: -9223372036854775809:1:21:-9223372036854775808: +%*25lld: -9223372036854775809:0:21: +%25lld: -9223372036854775808:1:21:-9223372036854775808: +%*25lld: -9223372036854775808:0:21: +%25lld: -123:1:5:-123: +%*25lld: -123:0:5: +%25lld: -1:1:3:-1: +%*25lld: -1:0:3: +%25lld: -0:1:3:0: +%*25lld: -0:0:3: +%25lld: 0:1:2:0: +%*25lld: 0:0:2: +%25lld: 1:1:2:1: +%*25lld: 1:0:2: +%25lld: 42:1:3:42: +%*25lld: 42:0:3: +%25lld: 9223372036854775807:1:20:9223372036854775807: +%*25lld: 9223372036854775807:0:20: +%25lld: 9223372036854775808:1:20:9223372036854775807: +%*25lld: 9223372036854775808:0:20: +%25lld: 9223372036897200049:1:20:9223372036854775807: +%*25lld: 9223372036897200049:0:20: +%25lld: +0:1:3:0: +%*25lld: +0:0:3: +%25lld: +1:1:3:1: +%*25lld: +1:0:3: +%25lld: +42:1:4:42: +%*25lld: +42:0:4: +%25lld: +9223372036854775807:1:21:9223372036854775807: +%*25lld: +9223372036854775807:0:21: +%25lld: +9223372036854775808:1:21:9223372036854775807: +%*25lld: +9223372036854775808:0:21: +%25lld: +9223372036897200049:1:21:9223372036854775807: +%*25lld: +9223372036897200049:0:21: diff --git a/stdio-common/tst-scanf-format-llong-i.input b/stdio-common/tst-scanf-format-llong-i.input new file mode 100644 index 0000000..b8b3774 --- /dev/null +++ b/stdio-common/tst-scanf-format-llong-i.input @@ -0,0 +1,1526 @@ +%lli::0:-1: +%*lli::0:-1: +%lli:-9223372036867121486:1:20:-9223372036854775808: +%*lli:-9223372036867121486:0:20: +%lli:-0X8000000000bc614e:1:19:-9223372036854775808: +%*lli:-0X8000000000bc614e:0:19: +%lli:-0x8000000000BC614E:1:19:-9223372036854775808: +%*lli:-0x8000000000BC614E:0:19: +%lli:-01000000000000057060516:1:24:-9223372036854775808: +%*lli:-01000000000000057060516:0:24: +%lli:-0B1000000000000000000000000000000000000000101111000110000101001110:1:67:-9223372036854775808: +%*lli:-0B1000000000000000000000000000000000000000101111000110000101001110:0:67: +%lli:-0b1000000000000000000000000000000000000000101111000110000101001110:1:67:-9223372036854775808: +%*lli:-0b1000000000000000000000000000000000000000101111000110000101001110:0:67: +%lli:-9223372036854775809:1:20:-9223372036854775808: +%*lli:-9223372036854775809:0:20: +%lli:-0X8000000000000001:1:19:-9223372036854775808: +%*lli:-0X8000000000000001:0:19: +%lli:-0x8000000000000001:1:19:-9223372036854775808: +%*lli:-0x8000000000000001:0:19: +%lli:-01000000000000000000001:1:24:-9223372036854775808: +%*lli:-01000000000000000000001:0:24: +%lli:-0B1000000000000000000000000000000000000000000000000000000000000001:1:67:-9223372036854775808: +%*lli:-0B1000000000000000000000000000000000000000000000000000000000000001:0:67: +%lli:-0b1000000000000000000000000000000000000000000000000000000000000001:1:67:-9223372036854775808: +%*lli:-0b1000000000000000000000000000000000000000000000000000000000000001:0:67: +%lli:-9223372036854775808:1:20:-9223372036854775808: +%*lli:-9223372036854775808:0:20: +%lli:-0X8000000000000000:1:19:-9223372036854775808: +%*lli:-0X8000000000000000:0:19: +%lli:-0x8000000000000000:1:19:-9223372036854775808: +%*lli:-0x8000000000000000:0:19: +%lli:-01000000000000000000000:1:24:-9223372036854775808: +%*lli:-01000000000000000000000:0:24: +%lli:-0B1000000000000000000000000000000000000000000000000000000000000000:1:67:-9223372036854775808: +%*lli:-0B1000000000000000000000000000000000000000000000000000000000000000:0:67: +%lli:-0b1000000000000000000000000000000000000000000000000000000000000000:1:67:-9223372036854775808: +%*lli:-0b1000000000000000000000000000000000000000000000000000000000000000:0:67: +%lli:-123:1:4:-123: +%*lli:-123:0:4: +%lli:-0X7b:1:5:-123: +%*lli:-0X7b:0:5: +%lli:-0x7B:1:5:-123: +%*lli:-0x7B:0:5: +%lli:-0173:1:5:-123: +%*lli:-0173:0:5: +%lli:-0B1111011:1:10:-123: +%*lli:-0B1111011:0:10: +%lli:-0b1111011:1:10:-123: +%*lli:-0b1111011:0:10: +%lli:-1:1:2:-1: +%*lli:-1:0:2: +%lli:-0X1:1:4:-1: +%*lli:-0X1:0:4: +%lli:-0x1:1:4:-1: +%*lli:-0x1:0:4: +%lli:-01:1:3:-1: +%*lli:-01:0:3: +%lli:-0B1:1:4:-1: +%*lli:-0B1:0:4: +%lli:-0b1:1:4:-1: +%*lli:-0b1:0:4: +%lli:-0:1:2:0: +%*lli:-0:0:2: +%lli:-0X0:1:4:0: +%*lli:-0X0:0:4: +%lli:-0x0:1:4:0: +%*lli:-0x0:0:4: +%lli:-00:1:3:0: +%*lli:-00:0:3: +%lli:-0B0:1:4:0: +%*lli:-0B0:0:4: +%lli:-0b0:1:4:0: +%*lli:-0b0:0:4: +%lli:0:1:1:0: +%*lli:0:0:1: +%lli:0X0:1:3:0: +%*lli:0X0:0:3: +%lli:0x0:1:3:0: +%*lli:0x0:0:3: +%lli:00:1:2:0: +%*lli:00:0:2: +%lli:0B0:1:3:0: +%*lli:0B0:0:3: +%lli:0b0:1:3:0: +%*lli:0b0:0:3: +%lli:1:1:1:1: +%*lli:1:0:1: +%lli:0X1:1:3:1: +%*lli:0X1:0:3: +%lli:0x1:1:3:1: +%*lli:0x1:0:3: +%lli:01:1:2:1: +%*lli:01:0:2: +%lli:0B1:1:3:1: +%*lli:0B1:0:3: +%lli:0b1:1:3:1: +%*lli:0b1:0:3: +%lli:42:1:2:42: +%*lli:42:0:2: +%lli:0X2a:1:4:42: +%*lli:0X2a:0:4: +%lli:0x2A:1:4:42: +%*lli:0x2A:0:4: +%lli:052:1:3:42: +%*lli:052:0:3: +%lli:0B101010:1:8:42: +%*lli:0B101010:0:8: +%lli:0b101010:1:8:42: +%*lli:0b101010:0:8: +%lli:9223372036854775807:1:19:9223372036854775807: +%*lli:9223372036854775807:0:19: +%lli:0X7fffffffffffffff:1:18:9223372036854775807: +%*lli:0X7fffffffffffffff:0:18: +%lli:0x7FFFFFFFFFFFFFFF:1:18:9223372036854775807: +%*lli:0x7FFFFFFFFFFFFFFF:0:18: +%lli:0777777777777777777777:1:22:9223372036854775807: +%*lli:0777777777777777777777:0:22: +%lli:0B111111111111111111111111111111111111111111111111111111111111111:1:65:9223372036854775807: +%*lli:0B111111111111111111111111111111111111111111111111111111111111111:0:65: +%lli:0b111111111111111111111111111111111111111111111111111111111111111:1:65:9223372036854775807: +%*lli:0b111111111111111111111111111111111111111111111111111111111111111:0:65: +%lli:9223372036854775808:1:19:9223372036854775807: +%*lli:9223372036854775808:0:19: +%lli:0X8000000000000000:1:18:9223372036854775807: +%*lli:0X8000000000000000:0:18: +%lli:0x8000000000000000:1:18:9223372036854775807: +%*lli:0x8000000000000000:0:18: +%lli:01000000000000000000000:1:23:9223372036854775807: +%*lli:01000000000000000000000:0:23: +%lli:0B1000000000000000000000000000000000000000000000000000000000000000:1:66:9223372036854775807: +%*lli:0B1000000000000000000000000000000000000000000000000000000000000000:0:66: +%lli:0b1000000000000000000000000000000000000000000000000000000000000000:1:66:9223372036854775807: +%*lli:0b1000000000000000000000000000000000000000000000000000000000000000:0:66: +%lli:9223372036897200049:1:19:9223372036854775807: +%*lli:9223372036897200049:0:19: +%lli:0X80000000028757b1:1:18:9223372036854775807: +%*lli:0X80000000028757b1:0:18: +%lli:0x80000000028757B1:1:18:9223372036854775807: +%*lli:0x80000000028757B1:0:18: +%lli:01000000000000241653661:1:23:9223372036854775807: +%*lli:01000000000000241653661:0:23: +%lli:0B1000000000000000000000000000000000000010100001110101011110110001:1:66:9223372036854775807: +%*lli:0B1000000000000000000000000000000000000010100001110101011110110001:0:66: +%lli:0b1000000000000000000000000000000000000010100001110101011110110001:1:66:9223372036854775807: +%*lli:0b1000000000000000000000000000000000000010100001110101011110110001:0:66: +%lli:+0:1:2:0: +%*lli:+0:0:2: +%lli:+0X0:1:4:0: +%*lli:+0X0:0:4: +%lli:+0x0:1:4:0: +%*lli:+0x0:0:4: +%lli:+00:1:3:0: +%*lli:+00:0:3: +%lli:+0B0:1:4:0: +%*lli:+0B0:0:4: +%lli:+0b0:1:4:0: +%*lli:+0b0:0:4: +%lli:+1:1:2:1: +%*lli:+1:0:2: +%lli:+0X1:1:4:1: +%*lli:+0X1:0:4: +%lli:+0x1:1:4:1: +%*lli:+0x1:0:4: +%lli:+01:1:3:1: +%*lli:+01:0:3: +%lli:+0B1:1:4:1: +%*lli:+0B1:0:4: +%lli:+0b1:1:4:1: +%*lli:+0b1:0:4: +%lli:+42:1:3:42: +%*lli:+42:0:3: +%lli:+0X2a:1:5:42: +%*lli:+0X2a:0:5: +%lli:+0x2A:1:5:42: +%*lli:+0x2A:0:5: +%lli:+052:1:4:42: +%*lli:+052:0:4: +%lli:+0B101010:1:9:42: +%*lli:+0B101010:0:9: +%lli:+0b101010:1:9:42: +%*lli:+0b101010:0:9: +%lli:+9223372036854775807:1:20:9223372036854775807: +%*lli:+9223372036854775807:0:20: +%lli:+0X7fffffffffffffff:1:19:9223372036854775807: +%*lli:+0X7fffffffffffffff:0:19: +%lli:+0x7FFFFFFFFFFFFFFF:1:19:9223372036854775807: +%*lli:+0x7FFFFFFFFFFFFFFF:0:19: +%lli:+0777777777777777777777:1:23:9223372036854775807: +%*lli:+0777777777777777777777:0:23: +%lli:+0B111111111111111111111111111111111111111111111111111111111111111:1:66:9223372036854775807: +%*lli:+0B111111111111111111111111111111111111111111111111111111111111111:0:66: +%lli:+0b111111111111111111111111111111111111111111111111111111111111111:1:66:9223372036854775807: +%*lli:+0b111111111111111111111111111111111111111111111111111111111111111:0:66: +%lli:+9223372036854775808:1:20:9223372036854775807: +%*lli:+9223372036854775808:0:20: +%lli:+0X8000000000000000:1:19:9223372036854775807: +%*lli:+0X8000000000000000:0:19: +%lli:+0x8000000000000000:1:19:9223372036854775807: +%*lli:+0x8000000000000000:0:19: +%lli:+01000000000000000000000:1:24:9223372036854775807: +%*lli:+01000000000000000000000:0:24: +%lli:+0B1000000000000000000000000000000000000000000000000000000000000000:1:67:9223372036854775807: +%*lli:+0B1000000000000000000000000000000000000000000000000000000000000000:0:67: +%lli:+0b1000000000000000000000000000000000000000000000000000000000000000:1:67:9223372036854775807: +%*lli:+0b1000000000000000000000000000000000000000000000000000000000000000:0:67: +%lli:+9223372036897200049:1:20:9223372036854775807: +%*lli:+9223372036897200049:0:20: +%lli:+0X80000000028757b1:1:19:9223372036854775807: +%*lli:+0X80000000028757b1:0:19: +%lli:+0x80000000028757B1:1:19:9223372036854775807: +%*lli:+0x80000000028757B1:0:19: +%lli:+01000000000000241653661:1:24:9223372036854775807: +%*lli:+01000000000000241653661:0:24: +%lli:+0B1000000000000000000000000000000000000010100001110101011110110001:1:67:9223372036854775807: +%*lli:+0B1000000000000000000000000000000000000010100001110101011110110001:0:67: +%lli:+0b1000000000000000000000000000000000000010100001110101011110110001:1:67:9223372036854775807: +%*lli:+0b1000000000000000000000000000000000000010100001110101011110110001:0:67: +%1lli::0:-1: +%*1lli::0:-1: +%1lli:-9223372036867121486:0:-1: +%*1lli:-9223372036867121486:0:-1: +%1lli:-0X8000000000bc614e:0:-1: +%*1lli:-0X8000000000bc614e:0:-1: +%1lli:-0x8000000000BC614E:0:-1: +%*1lli:-0x8000000000BC614E:0:-1: +%1lli:-01000000000000057060516:0:-1: +%*1lli:-01000000000000057060516:0:-1: +%1lli:-0B1000000000000000000000000000000000000000101111000110000101001110:0:-1: +%*1lli:-0B1000000000000000000000000000000000000000101111000110000101001110:0:-1: +%1lli:-0b1000000000000000000000000000000000000000101111000110000101001110:0:-1: +%*1lli:-0b1000000000000000000000000000000000000000101111000110000101001110:0:-1: +%1lli:-9223372036854775809:0:-1: +%*1lli:-9223372036854775809:0:-1: +%1lli:-0X8000000000000001:0:-1: +%*1lli:-0X8000000000000001:0:-1: +%1lli:-0x8000000000000001:0:-1: +%*1lli:-0x8000000000000001:0:-1: +%1lli:-01000000000000000000001:0:-1: +%*1lli:-01000000000000000000001:0:-1: +%1lli:-0B1000000000000000000000000000000000000000000000000000000000000001:0:-1: +%*1lli:-0B1000000000000000000000000000000000000000000000000000000000000001:0:-1: +%1lli:-0b1000000000000000000000000000000000000000000000000000000000000001:0:-1: +%*1lli:-0b1000000000000000000000000000000000000000000000000000000000000001:0:-1: +%1lli:-9223372036854775808:0:-1: +%*1lli:-9223372036854775808:0:-1: +%1lli:-0X8000000000000000:0:-1: +%*1lli:-0X8000000000000000:0:-1: +%1lli:-0x8000000000000000:0:-1: +%*1lli:-0x8000000000000000:0:-1: +%1lli:-01000000000000000000000:0:-1: +%*1lli:-01000000000000000000000:0:-1: +%1lli:-0B1000000000000000000000000000000000000000000000000000000000000000:0:-1: +%*1lli:-0B1000000000000000000000000000000000000000000000000000000000000000:0:-1: +%1lli:-0b1000000000000000000000000000000000000000000000000000000000000000:0:-1: +%*1lli:-0b1000000000000000000000000000000000000000000000000000000000000000:0:-1: +%1lli:-123:0:-1: +%*1lli:-123:0:-1: +%1lli:-0X7b:0:-1: +%*1lli:-0X7b:0:-1: +%1lli:-0x7B:0:-1: +%*1lli:-0x7B:0:-1: +%1lli:-0173:0:-1: +%*1lli:-0173:0:-1: +%1lli:-0B1111011:0:-1: +%*1lli:-0B1111011:0:-1: +%1lli:-0b1111011:0:-1: +%*1lli:-0b1111011:0:-1: +%1lli:-1:0:-1: +%*1lli:-1:0:-1: +%1lli:-0X1:0:-1: +%*1lli:-0X1:0:-1: +%1lli:-0x1:0:-1: +%*1lli:-0x1:0:-1: +%1lli:-01:0:-1: +%*1lli:-01:0:-1: +%1lli:-0B1:0:-1: +%*1lli:-0B1:0:-1: +%1lli:-0b1:0:-1: +%*1lli:-0b1:0:-1: +%1lli:-0:0:-1: +%*1lli:-0:0:-1: +%1lli:-0X0:0:-1: +%*1lli:-0X0:0:-1: +%1lli:-0x0:0:-1: +%*1lli:-0x0:0:-1: +%1lli:-00:0:-1: +%*1lli:-00:0:-1: +%1lli:-0B0:0:-1: +%*1lli:-0B0:0:-1: +%1lli:-0b0:0:-1: +%*1lli:-0b0:0:-1: +%1lli:0:1:1:0: +%*1lli:0:0:1: +%1lli:0X0:1:1:0: +%*1lli:0X0:0:1: +%1lli:0x0:1:1:0: +%*1lli:0x0:0:1: +%1lli:00:1:1:0: +%*1lli:00:0:1: +%1lli:0B0:1:1:0: +%*1lli:0B0:0:1: +%1lli:0b0:1:1:0: +%*1lli:0b0:0:1: +%1lli:1:1:1:1: +%*1lli:1:0:1: +%1lli:0X1:1:1:0: +%*1lli:0X1:0:1: +%1lli:0x1:1:1:0: +%*1lli:0x1:0:1: +%1lli:01:1:1:0: +%*1lli:01:0:1: +%1lli:0B1:1:1:0: +%*1lli:0B1:0:1: +%1lli:0b1:1:1:0: +%*1lli:0b1:0:1: +%1lli:42:1:1:4: +%*1lli:42:0:1: +%1lli:0X2a:1:1:0: +%*1lli:0X2a:0:1: +%1lli:0x2A:1:1:0: +%*1lli:0x2A:0:1: +%1lli:052:1:1:0: +%*1lli:052:0:1: +%1lli:0B101010:1:1:0: +%*1lli:0B101010:0:1: +%1lli:0b101010:1:1:0: +%*1lli:0b101010:0:1: +%1lli:9223372036854775807:1:1:9: +%*1lli:9223372036854775807:0:1: +%1lli:0X7fffffffffffffff:1:1:0: +%*1lli:0X7fffffffffffffff:0:1: +%1lli:0x7FFFFFFFFFFFFFFF:1:1:0: +%*1lli:0x7FFFFFFFFFFFFFFF:0:1: +%1lli:0777777777777777777777:1:1:0: +%*1lli:0777777777777777777777:0:1: +%1lli:0B111111111111111111111111111111111111111111111111111111111111111:1:1:0: +%*1lli:0B111111111111111111111111111111111111111111111111111111111111111:0:1: +%1lli:0b111111111111111111111111111111111111111111111111111111111111111:1:1:0: +%*1lli:0b111111111111111111111111111111111111111111111111111111111111111:0:1: +%1lli:9223372036854775808:1:1:9: +%*1lli:9223372036854775808:0:1: +%1lli:0X8000000000000000:1:1:0: +%*1lli:0X8000000000000000:0:1: +%1lli:0x8000000000000000:1:1:0: +%*1lli:0x8000000000000000:0:1: +%1lli:01000000000000000000000:1:1:0: +%*1lli:01000000000000000000000:0:1: +%1lli:0B1000000000000000000000000000000000000000000000000000000000000000:1:1:0: +%*1lli:0B1000000000000000000000000000000000000000000000000000000000000000:0:1: +%1lli:0b1000000000000000000000000000000000000000000000000000000000000000:1:1:0: +%*1lli:0b1000000000000000000000000000000000000000000000000000000000000000:0:1: +%1lli:9223372036897200049:1:1:9: +%*1lli:9223372036897200049:0:1: +%1lli:0X80000000028757b1:1:1:0: +%*1lli:0X80000000028757b1:0:1: +%1lli:0x80000000028757B1:1:1:0: +%*1lli:0x80000000028757B1:0:1: +%1lli:01000000000000241653661:1:1:0: +%*1lli:01000000000000241653661:0:1: +%1lli:0B1000000000000000000000000000000000000010100001110101011110110001:1:1:0: +%*1lli:0B1000000000000000000000000000000000000010100001110101011110110001:0:1: +%1lli:0b1000000000000000000000000000000000000010100001110101011110110001:1:1:0: +%*1lli:0b1000000000000000000000000000000000000010100001110101011110110001:0:1: +%1lli:+0:0:-1: +%*1lli:+0:0:-1: +%1lli:+0X0:0:-1: +%*1lli:+0X0:0:-1: +%1lli:+0x0:0:-1: +%*1lli:+0x0:0:-1: +%1lli:+00:0:-1: +%*1lli:+00:0:-1: +%1lli:+0B0:0:-1: +%*1lli:+0B0:0:-1: +%1lli:+0b0:0:-1: +%*1lli:+0b0:0:-1: +%1lli:+1:0:-1: +%*1lli:+1:0:-1: +%1lli:+0X1:0:-1: +%*1lli:+0X1:0:-1: +%1lli:+0x1:0:-1: +%*1lli:+0x1:0:-1: +%1lli:+01:0:-1: +%*1lli:+01:0:-1: +%1lli:+0B1:0:-1: +%*1lli:+0B1:0:-1: +%1lli:+0b1:0:-1: +%*1lli:+0b1:0:-1: +%1lli:+42:0:-1: +%*1lli:+42:0:-1: +%1lli:+0X2a:0:-1: +%*1lli:+0X2a:0:-1: +%1lli:+0x2A:0:-1: +%*1lli:+0x2A:0:-1: +%1lli:+052:0:-1: +%*1lli:+052:0:-1: +%1lli:+0B101010:0:-1: +%*1lli:+0B101010:0:-1: +%1lli:+0b101010:0:-1: +%*1lli:+0b101010:0:-1: +%1lli:+9223372036854775807:0:-1: +%*1lli:+9223372036854775807:0:-1: +%1lli:+0X7fffffffffffffff:0:-1: +%*1lli:+0X7fffffffffffffff:0:-1: +%1lli:+0x7FFFFFFFFFFFFFFF:0:-1: +%*1lli:+0x7FFFFFFFFFFFFFFF:0:-1: +%1lli:+0777777777777777777777:0:-1: +%*1lli:+0777777777777777777777:0:-1: +%1lli:+0B111111111111111111111111111111111111111111111111111111111111111:0:-1: +%*1lli:+0B111111111111111111111111111111111111111111111111111111111111111:0:-1: +%1lli:+0b111111111111111111111111111111111111111111111111111111111111111:0:-1: +%*1lli:+0b111111111111111111111111111111111111111111111111111111111111111:0:-1: +%1lli:+9223372036854775808:0:-1: +%*1lli:+9223372036854775808:0:-1: +%1lli:+0X8000000000000000:0:-1: +%*1lli:+0X8000000000000000:0:-1: +%1lli:+0x8000000000000000:0:-1: +%*1lli:+0x8000000000000000:0:-1: +%1lli:+01000000000000000000000:0:-1: +%*1lli:+01000000000000000000000:0:-1: +%1lli:+0B1000000000000000000000000000000000000000000000000000000000000000:0:-1: +%*1lli:+0B1000000000000000000000000000000000000000000000000000000000000000:0:-1: +%1lli:+0b1000000000000000000000000000000000000000000000000000000000000000:0:-1: +%*1lli:+0b1000000000000000000000000000000000000000000000000000000000000000:0:-1: +%1lli:+9223372036897200049:0:-1: +%*1lli:+9223372036897200049:0:-1: +%1lli:+0X80000000028757b1:0:-1: +%*1lli:+0X80000000028757b1:0:-1: +%1lli:+0x80000000028757B1:0:-1: +%*1lli:+0x80000000028757B1:0:-1: +%1lli:+01000000000000241653661:0:-1: +%*1lli:+01000000000000241653661:0:-1: +%1lli:+0B1000000000000000000000000000000000000010100001110101011110110001:0:-1: +%*1lli:+0B1000000000000000000000000000000000000010100001110101011110110001:0:-1: +%1lli:+0b1000000000000000000000000000000000000010100001110101011110110001:0:-1: +%*1lli:+0b1000000000000000000000000000000000000010100001110101011110110001:0:-1: +%2lli::0:-1: +%*2lli::0:-1: +%2lli:-9223372036867121486:1:2:-9: +%*2lli:-9223372036867121486:0:2: +%2lli:-0X8000000000bc614e:1:2:0: +%*2lli:-0X8000000000bc614e:0:2: +%2lli:-0x8000000000BC614E:1:2:0: +%*2lli:-0x8000000000BC614E:0:2: +%2lli:-01000000000000057060516:1:2:0: +%*2lli:-01000000000000057060516:0:2: +%2lli:-0B1000000000000000000000000000000000000000101111000110000101001110:1:2:0: +%*2lli:-0B1000000000000000000000000000000000000000101111000110000101001110:0:2: +%2lli:-0b1000000000000000000000000000000000000000101111000110000101001110:1:2:0: +%*2lli:-0b1000000000000000000000000000000000000000101111000110000101001110:0:2: +%2lli:-9223372036854775809:1:2:-9: +%*2lli:-9223372036854775809:0:2: +%2lli:-0X8000000000000001:1:2:0: +%*2lli:-0X8000000000000001:0:2: +%2lli:-0x8000000000000001:1:2:0: +%*2lli:-0x8000000000000001:0:2: +%2lli:-01000000000000000000001:1:2:0: +%*2lli:-01000000000000000000001:0:2: +%2lli:-0B1000000000000000000000000000000000000000000000000000000000000001:1:2:0: +%*2lli:-0B1000000000000000000000000000000000000000000000000000000000000001:0:2: +%2lli:-0b1000000000000000000000000000000000000000000000000000000000000001:1:2:0: +%*2lli:-0b1000000000000000000000000000000000000000000000000000000000000001:0:2: +%2lli:-9223372036854775808:1:2:-9: +%*2lli:-9223372036854775808:0:2: +%2lli:-0X8000000000000000:1:2:0: +%*2lli:-0X8000000000000000:0:2: +%2lli:-0x8000000000000000:1:2:0: +%*2lli:-0x8000000000000000:0:2: +%2lli:-01000000000000000000000:1:2:0: +%*2lli:-01000000000000000000000:0:2: +%2lli:-0B1000000000000000000000000000000000000000000000000000000000000000:1:2:0: +%*2lli:-0B1000000000000000000000000000000000000000000000000000000000000000:0:2: +%2lli:-0b1000000000000000000000000000000000000000000000000000000000000000:1:2:0: +%*2lli:-0b1000000000000000000000000000000000000000000000000000000000000000:0:2: +%2lli:-123:1:2:-1: +%*2lli:-123:0:2: +%2lli:-0X7b:1:2:0: +%*2lli:-0X7b:0:2: +%2lli:-0x7B:1:2:0: +%*2lli:-0x7B:0:2: +%2lli:-0173:1:2:0: +%*2lli:-0173:0:2: +%2lli:-0B1111011:1:2:0: +%*2lli:-0B1111011:0:2: +%2lli:-0b1111011:1:2:0: +%*2lli:-0b1111011:0:2: +%2lli:-1:1:2:-1: +%*2lli:-1:0:2: +%2lli:-0X1:1:2:0: +%*2lli:-0X1:0:2: +%2lli:-0x1:1:2:0: +%*2lli:-0x1:0:2: +%2lli:-01:1:2:0: +%*2lli:-01:0:2: +%2lli:-0B1:1:2:0: +%*2lli:-0B1:0:2: +%2lli:-0b1:1:2:0: +%*2lli:-0b1:0:2: +%2lli:-0:1:2:0: +%*2lli:-0:0:2: +%2lli:-0X0:1:2:0: +%*2lli:-0X0:0:2: +%2lli:-0x0:1:2:0: +%*2lli:-0x0:0:2: +%2lli:-00:1:2:0: +%*2lli:-00:0:2: +%2lli:-0B0:1:2:0: +%*2lli:-0B0:0:2: +%2lli:-0b0:1:2:0: +%*2lli:-0b0:0:2: +%2lli:0:1:1:0: +%*2lli:0:0:1: +%2lli:0X0:0:-1: +%*2lli:0X0:0:-1: +%2lli:0x0:0:-1: +%*2lli:0x0:0:-1: +%2lli:00:1:2:0: +%*2lli:00:0:2: +%2lli:0B0:0:-1: +%*2lli:0B0:0:-1: +%2lli:0b0:0:-1: +%*2lli:0b0:0:-1: +%2lli:1:1:1:1: +%*2lli:1:0:1: +%2lli:0X1:0:-1: +%*2lli:0X1:0:-1: +%2lli:0x1:0:-1: +%*2lli:0x1:0:-1: +%2lli:01:1:2:1: +%*2lli:01:0:2: +%2lli:0B1:0:-1: +%*2lli:0B1:0:-1: +%2lli:0b1:0:-1: +%*2lli:0b1:0:-1: +%2lli:42:1:2:42: +%*2lli:42:0:2: +%2lli:0X2a:0:-1: +%*2lli:0X2a:0:-1: +%2lli:0x2A:0:-1: +%*2lli:0x2A:0:-1: +%2lli:052:1:2:5: +%*2lli:052:0:2: +%2lli:0B101010:0:-1: +%*2lli:0B101010:0:-1: +%2lli:0b101010:0:-1: +%*2lli:0b101010:0:-1: +%2lli:9223372036854775807:1:2:92: +%*2lli:9223372036854775807:0:2: +%2lli:0X7fffffffffffffff:0:-1: +%*2lli:0X7fffffffffffffff:0:-1: +%2lli:0x7FFFFFFFFFFFFFFF:0:-1: +%*2lli:0x7FFFFFFFFFFFFFFF:0:-1: +%2lli:0777777777777777777777:1:2:7: +%*2lli:0777777777777777777777:0:2: +%2lli:0B111111111111111111111111111111111111111111111111111111111111111:0:-1: +%*2lli:0B111111111111111111111111111111111111111111111111111111111111111:0:-1: +%2lli:0b111111111111111111111111111111111111111111111111111111111111111:0:-1: +%*2lli:0b111111111111111111111111111111111111111111111111111111111111111:0:-1: +%2lli:9223372036854775808:1:2:92: +%*2lli:9223372036854775808:0:2: +%2lli:0X8000000000000000:0:-1: +%*2lli:0X8000000000000000:0:-1: +%2lli:0x8000000000000000:0:-1: +%*2lli:0x8000000000000000:0:-1: +%2lli:01000000000000000000000:1:2:1: +%*2lli:01000000000000000000000:0:2: +%2lli:0B1000000000000000000000000000000000000000000000000000000000000000:0:-1: +%*2lli:0B1000000000000000000000000000000000000000000000000000000000000000:0:-1: +%2lli:0b1000000000000000000000000000000000000000000000000000000000000000:0:-1: +%*2lli:0b1000000000000000000000000000000000000000000000000000000000000000:0:-1: +%2lli:9223372036897200049:1:2:92: +%*2lli:9223372036897200049:0:2: +%2lli:0X80000000028757b1:0:-1: +%*2lli:0X80000000028757b1:0:-1: +%2lli:0x80000000028757B1:0:-1: +%*2lli:0x80000000028757B1:0:-1: +%2lli:01000000000000241653661:1:2:1: +%*2lli:01000000000000241653661:0:2: +%2lli:0B1000000000000000000000000000000000000010100001110101011110110001:0:-1: +%*2lli:0B1000000000000000000000000000000000000010100001110101011110110001:0:-1: +%2lli:0b1000000000000000000000000000000000000010100001110101011110110001:0:-1: +%*2lli:0b1000000000000000000000000000000000000010100001110101011110110001:0:-1: +%2lli:+0:1:2:0: +%*2lli:+0:0:2: +%2lli:+0X0:1:2:0: +%*2lli:+0X0:0:2: +%2lli:+0x0:1:2:0: +%*2lli:+0x0:0:2: +%2lli:+00:1:2:0: +%*2lli:+00:0:2: +%2lli:+0B0:1:2:0: +%*2lli:+0B0:0:2: +%2lli:+0b0:1:2:0: +%*2lli:+0b0:0:2: +%2lli:+1:1:2:1: +%*2lli:+1:0:2: +%2lli:+0X1:1:2:0: +%*2lli:+0X1:0:2: +%2lli:+0x1:1:2:0: +%*2lli:+0x1:0:2: +%2lli:+01:1:2:0: +%*2lli:+01:0:2: +%2lli:+0B1:1:2:0: +%*2lli:+0B1:0:2: +%2lli:+0b1:1:2:0: +%*2lli:+0b1:0:2: +%2lli:+42:1:2:4: +%*2lli:+42:0:2: +%2lli:+0X2a:1:2:0: +%*2lli:+0X2a:0:2: +%2lli:+0x2A:1:2:0: +%*2lli:+0x2A:0:2: +%2lli:+052:1:2:0: +%*2lli:+052:0:2: +%2lli:+0B101010:1:2:0: +%*2lli:+0B101010:0:2: +%2lli:+0b101010:1:2:0: +%*2lli:+0b101010:0:2: +%2lli:+9223372036854775807:1:2:9: +%*2lli:+9223372036854775807:0:2: +%2lli:+0X7fffffffffffffff:1:2:0: +%*2lli:+0X7fffffffffffffff:0:2: +%2lli:+0x7FFFFFFFFFFFFFFF:1:2:0: +%*2lli:+0x7FFFFFFFFFFFFFFF:0:2: +%2lli:+0777777777777777777777:1:2:0: +%*2lli:+0777777777777777777777:0:2: +%2lli:+0B111111111111111111111111111111111111111111111111111111111111111:1:2:0: +%*2lli:+0B111111111111111111111111111111111111111111111111111111111111111:0:2: +%2lli:+0b111111111111111111111111111111111111111111111111111111111111111:1:2:0: +%*2lli:+0b111111111111111111111111111111111111111111111111111111111111111:0:2: +%2lli:+9223372036854775808:1:2:9: +%*2lli:+9223372036854775808:0:2: +%2lli:+0X8000000000000000:1:2:0: +%*2lli:+0X8000000000000000:0:2: +%2lli:+0x8000000000000000:1:2:0: +%*2lli:+0x8000000000000000:0:2: +%2lli:+01000000000000000000000:1:2:0: +%*2lli:+01000000000000000000000:0:2: +%2lli:+0B1000000000000000000000000000000000000000000000000000000000000000:1:2:0: +%*2lli:+0B1000000000000000000000000000000000000000000000000000000000000000:0:2: +%2lli:+0b1000000000000000000000000000000000000000000000000000000000000000:1:2:0: +%*2lli:+0b1000000000000000000000000000000000000000000000000000000000000000:0:2: +%2lli:+9223372036897200049:1:2:9: +%*2lli:+9223372036897200049:0:2: +%2lli:+0X80000000028757b1:1:2:0: +%*2lli:+0X80000000028757b1:0:2: +%2lli:+0x80000000028757B1:1:2:0: +%*2lli:+0x80000000028757B1:0:2: +%2lli:+01000000000000241653661:1:2:0: +%*2lli:+01000000000000241653661:0:2: +%2lli:+0B1000000000000000000000000000000000000010100001110101011110110001:1:2:0: +%*2lli:+0B1000000000000000000000000000000000000010100001110101011110110001:0:2: +%2lli:+0b1000000000000000000000000000000000000010100001110101011110110001:1:2:0: +%*2lli:+0b1000000000000000000000000000000000000010100001110101011110110001:0:2: +%15lli::0:-1: +%*15lli::0:-1: +%15lli:-9223372036867121486:1:15:-92233720368671: +%*15lli:-9223372036867121486:0:15: +%15lli:-0X8000000000bc614e:1:15:-140737488355516: +%*15lli:-0X8000000000bc614e:0:15: +%15lli:-0x8000000000BC614E:1:15:-140737488355516: +%*15lli:-0x8000000000BC614E:0:15: +%15lli:-01000000000000057060516:1:15:-68719476736: +%*15lli:-01000000000000057060516:0:15: +%15lli:-0B1000000000000000000000000000000000000000101111000110000101001110:1:15:-2048: +%*15lli:-0B1000000000000000000000000000000000000000101111000110000101001110:0:15: +%15lli:-0b1000000000000000000000000000000000000000101111000110000101001110:1:15:-2048: +%*15lli:-0b1000000000000000000000000000000000000000101111000110000101001110:0:15: +%15lli:-9223372036854775809:1:15:-92233720368547: +%*15lli:-9223372036854775809:0:15: +%15lli:-0X8000000000000001:1:15:-140737488355328: +%*15lli:-0X8000000000000001:0:15: +%15lli:-0x8000000000000001:1:15:-140737488355328: +%*15lli:-0x8000000000000001:0:15: +%15lli:-01000000000000000000001:1:15:-68719476736: +%*15lli:-01000000000000000000001:0:15: +%15lli:-0B1000000000000000000000000000000000000000000000000000000000000001:1:15:-2048: +%*15lli:-0B1000000000000000000000000000000000000000000000000000000000000001:0:15: +%15lli:-0b1000000000000000000000000000000000000000000000000000000000000001:1:15:-2048: +%*15lli:-0b1000000000000000000000000000000000000000000000000000000000000001:0:15: +%15lli:-9223372036854775808:1:15:-92233720368547: +%*15lli:-9223372036854775808:0:15: +%15lli:-0X8000000000000000:1:15:-140737488355328: +%*15lli:-0X8000000000000000:0:15: +%15lli:-0x8000000000000000:1:15:-140737488355328: +%*15lli:-0x8000000000000000:0:15: +%15lli:-01000000000000000000000:1:15:-68719476736: +%*15lli:-01000000000000000000000:0:15: +%15lli:-0B1000000000000000000000000000000000000000000000000000000000000000:1:15:-2048: +%*15lli:-0B1000000000000000000000000000000000000000000000000000000000000000:0:15: +%15lli:-0b1000000000000000000000000000000000000000000000000000000000000000:1:15:-2048: +%*15lli:-0b1000000000000000000000000000000000000000000000000000000000000000:0:15: +%15lli:-123:1:4:-123: +%*15lli:-123:0:4: +%15lli:-0X7b:1:5:-123: +%*15lli:-0X7b:0:5: +%15lli:-0x7B:1:5:-123: +%*15lli:-0x7B:0:5: +%15lli:-0173:1:5:-123: +%*15lli:-0173:0:5: +%15lli:-0B1111011:1:10:-123: +%*15lli:-0B1111011:0:10: +%15lli:-0b1111011:1:10:-123: +%*15lli:-0b1111011:0:10: +%15lli:-1:1:2:-1: +%*15lli:-1:0:2: +%15lli:-0X1:1:4:-1: +%*15lli:-0X1:0:4: +%15lli:-0x1:1:4:-1: +%*15lli:-0x1:0:4: +%15lli:-01:1:3:-1: +%*15lli:-01:0:3: +%15lli:-0B1:1:4:-1: +%*15lli:-0B1:0:4: +%15lli:-0b1:1:4:-1: +%*15lli:-0b1:0:4: +%15lli:-0:1:2:0: +%*15lli:-0:0:2: +%15lli:-0X0:1:4:0: +%*15lli:-0X0:0:4: +%15lli:-0x0:1:4:0: +%*15lli:-0x0:0:4: +%15lli:-00:1:3:0: +%*15lli:-00:0:3: +%15lli:-0B0:1:4:0: +%*15lli:-0B0:0:4: +%15lli:-0b0:1:4:0: +%*15lli:-0b0:0:4: +%15lli:0:1:1:0: +%*15lli:0:0:1: +%15lli:0X0:1:3:0: +%*15lli:0X0:0:3: +%15lli:0x0:1:3:0: +%*15lli:0x0:0:3: +%15lli:00:1:2:0: +%*15lli:00:0:2: +%15lli:0B0:1:3:0: +%*15lli:0B0:0:3: +%15lli:0b0:1:3:0: +%*15lli:0b0:0:3: +%15lli:1:1:1:1: +%*15lli:1:0:1: +%15lli:0X1:1:3:1: +%*15lli:0X1:0:3: +%15lli:0x1:1:3:1: +%*15lli:0x1:0:3: +%15lli:01:1:2:1: +%*15lli:01:0:2: +%15lli:0B1:1:3:1: +%*15lli:0B1:0:3: +%15lli:0b1:1:3:1: +%*15lli:0b1:0:3: +%15lli:42:1:2:42: +%*15lli:42:0:2: +%15lli:0X2a:1:4:42: +%*15lli:0X2a:0:4: +%15lli:0x2A:1:4:42: +%*15lli:0x2A:0:4: +%15lli:052:1:3:42: +%*15lli:052:0:3: +%15lli:0B101010:1:8:42: +%*15lli:0B101010:0:8: +%15lli:0b101010:1:8:42: +%*15lli:0b101010:0:8: +%15lli:9223372036854775807:1:15:922337203685477: +%*15lli:9223372036854775807:0:15: +%15lli:0X7fffffffffffffff:1:15:2251799813685247: +%*15lli:0X7fffffffffffffff:0:15: +%15lli:0x7FFFFFFFFFFFFFFF:1:15:2251799813685247: +%*15lli:0x7FFFFFFFFFFFFFFF:0:15: +%15lli:0777777777777777777777:1:15:4398046511103: +%*15lli:0777777777777777777777:0:15: +%15lli:0B111111111111111111111111111111111111111111111111111111111111111:1:15:8191: +%*15lli:0B111111111111111111111111111111111111111111111111111111111111111:0:15: +%15lli:0b111111111111111111111111111111111111111111111111111111111111111:1:15:8191: +%*15lli:0b111111111111111111111111111111111111111111111111111111111111111:0:15: +%15lli:9223372036854775808:1:15:922337203685477: +%*15lli:9223372036854775808:0:15: +%15lli:0X8000000000000000:1:15:2251799813685248: +%*15lli:0X8000000000000000:0:15: +%15lli:0x8000000000000000:1:15:2251799813685248: +%*15lli:0x8000000000000000:0:15: +%15lli:01000000000000000000000:1:15:549755813888: +%*15lli:01000000000000000000000:0:15: +%15lli:0B1000000000000000000000000000000000000000000000000000000000000000:1:15:4096: +%*15lli:0B1000000000000000000000000000000000000000000000000000000000000000:0:15: +%15lli:0b1000000000000000000000000000000000000000000000000000000000000000:1:15:4096: +%*15lli:0b1000000000000000000000000000000000000000000000000000000000000000:0:15: +%15lli:9223372036897200049:1:15:922337203689720: +%*15lli:9223372036897200049:0:15: +%15lli:0X80000000028757b1:1:15:2251799813695605: +%*15lli:0X80000000028757b1:0:15: +%15lli:0x80000000028757B1:1:15:2251799813695605: +%*15lli:0x80000000028757B1:0:15: +%15lli:01000000000000241653661:1:15:549755813890: +%*15lli:01000000000000241653661:0:15: +%15lli:0B1000000000000000000000000000000000000010100001110101011110110001:1:15:4096: +%*15lli:0B1000000000000000000000000000000000000010100001110101011110110001:0:15: +%15lli:0b1000000000000000000000000000000000000010100001110101011110110001:1:15:4096: +%*15lli:0b1000000000000000000000000000000000000010100001110101011110110001:0:15: +%15lli:+0:1:2:0: +%*15lli:+0:0:2: +%15lli:+0X0:1:4:0: +%*15lli:+0X0:0:4: +%15lli:+0x0:1:4:0: +%*15lli:+0x0:0:4: +%15lli:+00:1:3:0: +%*15lli:+00:0:3: +%15lli:+0B0:1:4:0: +%*15lli:+0B0:0:4: +%15lli:+0b0:1:4:0: +%*15lli:+0b0:0:4: +%15lli:+1:1:2:1: +%*15lli:+1:0:2: +%15lli:+0X1:1:4:1: +%*15lli:+0X1:0:4: +%15lli:+0x1:1:4:1: +%*15lli:+0x1:0:4: +%15lli:+01:1:3:1: +%*15lli:+01:0:3: +%15lli:+0B1:1:4:1: +%*15lli:+0B1:0:4: +%15lli:+0b1:1:4:1: +%*15lli:+0b1:0:4: +%15lli:+42:1:3:42: +%*15lli:+42:0:3: +%15lli:+0X2a:1:5:42: +%*15lli:+0X2a:0:5: +%15lli:+0x2A:1:5:42: +%*15lli:+0x2A:0:5: +%15lli:+052:1:4:42: +%*15lli:+052:0:4: +%15lli:+0B101010:1:9:42: +%*15lli:+0B101010:0:9: +%15lli:+0b101010:1:9:42: +%*15lli:+0b101010:0:9: +%15lli:+9223372036854775807:1:15:92233720368547: +%*15lli:+9223372036854775807:0:15: +%15lli:+0X7fffffffffffffff:1:15:140737488355327: +%*15lli:+0X7fffffffffffffff:0:15: +%15lli:+0x7FFFFFFFFFFFFFFF:1:15:140737488355327: +%*15lli:+0x7FFFFFFFFFFFFFFF:0:15: +%15lli:+0777777777777777777777:1:15:549755813887: +%*15lli:+0777777777777777777777:0:15: +%15lli:+0B111111111111111111111111111111111111111111111111111111111111111:1:15:4095: +%*15lli:+0B111111111111111111111111111111111111111111111111111111111111111:0:15: +%15lli:+0b111111111111111111111111111111111111111111111111111111111111111:1:15:4095: +%*15lli:+0b111111111111111111111111111111111111111111111111111111111111111:0:15: +%15lli:+9223372036854775808:1:15:92233720368547: +%*15lli:+9223372036854775808:0:15: +%15lli:+0X8000000000000000:1:15:140737488355328: +%*15lli:+0X8000000000000000:0:15: +%15lli:+0x8000000000000000:1:15:140737488355328: +%*15lli:+0x8000000000000000:0:15: +%15lli:+01000000000000000000000:1:15:68719476736: +%*15lli:+01000000000000000000000:0:15: +%15lli:+0B1000000000000000000000000000000000000000000000000000000000000000:1:15:2048: +%*15lli:+0B1000000000000000000000000000000000000000000000000000000000000000:0:15: +%15lli:+0b1000000000000000000000000000000000000000000000000000000000000000:1:15:2048: +%*15lli:+0b1000000000000000000000000000000000000000000000000000000000000000:0:15: +%15lli:+9223372036897200049:1:15:92233720368972: +%*15lli:+9223372036897200049:0:15: +%15lli:+0X80000000028757b1:1:15:140737488355975: +%*15lli:+0X80000000028757b1:0:15: +%15lli:+0x80000000028757B1:1:15:140737488355975: +%*15lli:+0x80000000028757B1:0:15: +%15lli:+01000000000000241653661:1:15:68719476736: +%*15lli:+01000000000000241653661:0:15: +%15lli:+0B1000000000000000000000000000000000000010100001110101011110110001:1:15:2048: +%*15lli:+0B1000000000000000000000000000000000000010100001110101011110110001:0:15: +%15lli:+0b1000000000000000000000000000000000000010100001110101011110110001:1:15:2048: +%*15lli:+0b1000000000000000000000000000000000000010100001110101011110110001:0:15: +%25lli::0:-1: +%*25lli::0:-1: +%25lli:-9223372036867121486:1:20:-9223372036854775808: +%*25lli:-9223372036867121486:0:20: +%25lli:-0X8000000000bc614e:1:19:-9223372036854775808: +%*25lli:-0X8000000000bc614e:0:19: +%25lli:-0x8000000000BC614E:1:19:-9223372036854775808: +%*25lli:-0x8000000000BC614E:0:19: +%25lli:-01000000000000057060516:1:24:-9223372036854775808: +%*25lli:-01000000000000057060516:0:24: +%25lli:-0B1000000000000000000000000000000000000000101111000110000101001110:1:25:-2097152: +%*25lli:-0B1000000000000000000000000000000000000000101111000110000101001110:0:25: +%25lli:-0b1000000000000000000000000000000000000000101111000110000101001110:1:25:-2097152: +%*25lli:-0b1000000000000000000000000000000000000000101111000110000101001110:0:25: +%25lli:-9223372036854775809:1:20:-9223372036854775808: +%*25lli:-9223372036854775809:0:20: +%25lli:-0X8000000000000001:1:19:-9223372036854775808: +%*25lli:-0X8000000000000001:0:19: +%25lli:-0x8000000000000001:1:19:-9223372036854775808: +%*25lli:-0x8000000000000001:0:19: +%25lli:-01000000000000000000001:1:24:-9223372036854775808: +%*25lli:-01000000000000000000001:0:24: +%25lli:-0B1000000000000000000000000000000000000000000000000000000000000001:1:25:-2097152: +%*25lli:-0B1000000000000000000000000000000000000000000000000000000000000001:0:25: +%25lli:-0b1000000000000000000000000000000000000000000000000000000000000001:1:25:-2097152: +%*25lli:-0b1000000000000000000000000000000000000000000000000000000000000001:0:25: +%25lli:-9223372036854775808:1:20:-9223372036854775808: +%*25lli:-9223372036854775808:0:20: +%25lli:-0X8000000000000000:1:19:-9223372036854775808: +%*25lli:-0X8000000000000000:0:19: +%25lli:-0x8000000000000000:1:19:-9223372036854775808: +%*25lli:-0x8000000000000000:0:19: +%25lli:-01000000000000000000000:1:24:-9223372036854775808: +%*25lli:-01000000000000000000000:0:24: +%25lli:-0B1000000000000000000000000000000000000000000000000000000000000000:1:25:-2097152: +%*25lli:-0B1000000000000000000000000000000000000000000000000000000000000000:0:25: +%25lli:-0b1000000000000000000000000000000000000000000000000000000000000000:1:25:-2097152: +%*25lli:-0b1000000000000000000000000000000000000000000000000000000000000000:0:25: +%25lli:-123:1:4:-123: +%*25lli:-123:0:4: +%25lli:-0X7b:1:5:-123: +%*25lli:-0X7b:0:5: +%25lli:-0x7B:1:5:-123: +%*25lli:-0x7B:0:5: +%25lli:-0173:1:5:-123: +%*25lli:-0173:0:5: +%25lli:-0B1111011:1:10:-123: +%*25lli:-0B1111011:0:10: +%25lli:-0b1111011:1:10:-123: +%*25lli:-0b1111011:0:10: +%25lli:-1:1:2:-1: +%*25lli:-1:0:2: +%25lli:-0X1:1:4:-1: +%*25lli:-0X1:0:4: +%25lli:-0x1:1:4:-1: +%*25lli:-0x1:0:4: +%25lli:-01:1:3:-1: +%*25lli:-01:0:3: +%25lli:-0B1:1:4:-1: +%*25lli:-0B1:0:4: +%25lli:-0b1:1:4:-1: +%*25lli:-0b1:0:4: +%25lli:-0:1:2:0: +%*25lli:-0:0:2: +%25lli:-0X0:1:4:0: +%*25lli:-0X0:0:4: +%25lli:-0x0:1:4:0: +%*25lli:-0x0:0:4: +%25lli:-00:1:3:0: +%*25lli:-00:0:3: +%25lli:-0B0:1:4:0: +%*25lli:-0B0:0:4: +%25lli:-0b0:1:4:0: +%*25lli:-0b0:0:4: +%25lli:0:1:1:0: +%*25lli:0:0:1: +%25lli:0X0:1:3:0: +%*25lli:0X0:0:3: +%25lli:0x0:1:3:0: +%*25lli:0x0:0:3: +%25lli:00:1:2:0: +%*25lli:00:0:2: +%25lli:0B0:1:3:0: +%*25lli:0B0:0:3: +%25lli:0b0:1:3:0: +%*25lli:0b0:0:3: +%25lli:1:1:1:1: +%*25lli:1:0:1: +%25lli:0X1:1:3:1: +%*25lli:0X1:0:3: +%25lli:0x1:1:3:1: +%*25lli:0x1:0:3: +%25lli:01:1:2:1: +%*25lli:01:0:2: +%25lli:0B1:1:3:1: +%*25lli:0B1:0:3: +%25lli:0b1:1:3:1: +%*25lli:0b1:0:3: +%25lli:42:1:2:42: +%*25lli:42:0:2: +%25lli:0X2a:1:4:42: +%*25lli:0X2a:0:4: +%25lli:0x2A:1:4:42: +%*25lli:0x2A:0:4: +%25lli:052:1:3:42: +%*25lli:052:0:3: +%25lli:0B101010:1:8:42: +%*25lli:0B101010:0:8: +%25lli:0b101010:1:8:42: +%*25lli:0b101010:0:8: +%25lli:9223372036854775807:1:19:9223372036854775807: +%*25lli:9223372036854775807:0:19: +%25lli:0X7fffffffffffffff:1:18:9223372036854775807: +%*25lli:0X7fffffffffffffff:0:18: +%25lli:0x7FFFFFFFFFFFFFFF:1:18:9223372036854775807: +%*25lli:0x7FFFFFFFFFFFFFFF:0:18: +%25lli:0777777777777777777777:1:22:9223372036854775807: +%*25lli:0777777777777777777777:0:22: +%25lli:0B111111111111111111111111111111111111111111111111111111111111111:1:25:8388607: +%*25lli:0B111111111111111111111111111111111111111111111111111111111111111:0:25: +%25lli:0b111111111111111111111111111111111111111111111111111111111111111:1:25:8388607: +%*25lli:0b111111111111111111111111111111111111111111111111111111111111111:0:25: +%25lli:9223372036854775808:1:19:9223372036854775807: +%*25lli:9223372036854775808:0:19: +%25lli:0X8000000000000000:1:18:9223372036854775807: +%*25lli:0X8000000000000000:0:18: +%25lli:0x8000000000000000:1:18:9223372036854775807: +%*25lli:0x8000000000000000:0:18: +%25lli:01000000000000000000000:1:23:9223372036854775807: +%*25lli:01000000000000000000000:0:23: +%25lli:0B1000000000000000000000000000000000000000000000000000000000000000:1:25:4194304: +%*25lli:0B1000000000000000000000000000000000000000000000000000000000000000:0:25: +%25lli:0b1000000000000000000000000000000000000000000000000000000000000000:1:25:4194304: +%*25lli:0b1000000000000000000000000000000000000000000000000000000000000000:0:25: +%25lli:9223372036897200049:1:19:9223372036854775807: +%*25lli:9223372036897200049:0:19: +%25lli:0X80000000028757b1:1:18:9223372036854775807: +%*25lli:0X80000000028757b1:0:18: +%25lli:0x80000000028757B1:1:18:9223372036854775807: +%*25lli:0x80000000028757B1:0:18: +%25lli:01000000000000241653661:1:23:9223372036854775807: +%*25lli:01000000000000241653661:0:23: +%25lli:0B1000000000000000000000000000000000000010100001110101011110110001:1:25:4194304: +%*25lli:0B1000000000000000000000000000000000000010100001110101011110110001:0:25: +%25lli:0b1000000000000000000000000000000000000010100001110101011110110001:1:25:4194304: +%*25lli:0b1000000000000000000000000000000000000010100001110101011110110001:0:25: +%25lli:+0:1:2:0: +%*25lli:+0:0:2: +%25lli:+0X0:1:4:0: +%*25lli:+0X0:0:4: +%25lli:+0x0:1:4:0: +%*25lli:+0x0:0:4: +%25lli:+00:1:3:0: +%*25lli:+00:0:3: +%25lli:+0B0:1:4:0: +%*25lli:+0B0:0:4: +%25lli:+0b0:1:4:0: +%*25lli:+0b0:0:4: +%25lli:+1:1:2:1: +%*25lli:+1:0:2: +%25lli:+0X1:1:4:1: +%*25lli:+0X1:0:4: +%25lli:+0x1:1:4:1: +%*25lli:+0x1:0:4: +%25lli:+01:1:3:1: +%*25lli:+01:0:3: +%25lli:+0B1:1:4:1: +%*25lli:+0B1:0:4: +%25lli:+0b1:1:4:1: +%*25lli:+0b1:0:4: +%25lli:+42:1:3:42: +%*25lli:+42:0:3: +%25lli:+0X2a:1:5:42: +%*25lli:+0X2a:0:5: +%25lli:+0x2A:1:5:42: +%*25lli:+0x2A:0:5: +%25lli:+052:1:4:42: +%*25lli:+052:0:4: +%25lli:+0B101010:1:9:42: +%*25lli:+0B101010:0:9: +%25lli:+0b101010:1:9:42: +%*25lli:+0b101010:0:9: +%25lli:+9223372036854775807:1:20:9223372036854775807: +%*25lli:+9223372036854775807:0:20: +%25lli:+0X7fffffffffffffff:1:19:9223372036854775807: +%*25lli:+0X7fffffffffffffff:0:19: +%25lli:+0x7FFFFFFFFFFFFFFF:1:19:9223372036854775807: +%*25lli:+0x7FFFFFFFFFFFFFFF:0:19: +%25lli:+0777777777777777777777:1:23:9223372036854775807: +%*25lli:+0777777777777777777777:0:23: +%25lli:+0B111111111111111111111111111111111111111111111111111111111111111:1:25:4194303: +%*25lli:+0B111111111111111111111111111111111111111111111111111111111111111:0:25: +%25lli:+0b111111111111111111111111111111111111111111111111111111111111111:1:25:4194303: +%*25lli:+0b111111111111111111111111111111111111111111111111111111111111111:0:25: +%25lli:+9223372036854775808:1:20:9223372036854775807: +%*25lli:+9223372036854775808:0:20: +%25lli:+0X8000000000000000:1:19:9223372036854775807: +%*25lli:+0X8000000000000000:0:19: +%25lli:+0x8000000000000000:1:19:9223372036854775807: +%*25lli:+0x8000000000000000:0:19: +%25lli:+01000000000000000000000:1:24:9223372036854775807: +%*25lli:+01000000000000000000000:0:24: +%25lli:+0B1000000000000000000000000000000000000000000000000000000000000000:1:25:2097152: +%*25lli:+0B1000000000000000000000000000000000000000000000000000000000000000:0:25: +%25lli:+0b1000000000000000000000000000000000000000000000000000000000000000:1:25:2097152: +%*25lli:+0b1000000000000000000000000000000000000000000000000000000000000000:0:25: +%25lli:+9223372036897200049:1:20:9223372036854775807: +%*25lli:+9223372036897200049:0:20: +%25lli:+0X80000000028757b1:1:19:9223372036854775807: +%*25lli:+0X80000000028757b1:0:19: +%25lli:+0x80000000028757B1:1:19:9223372036854775807: +%*25lli:+0x80000000028757B1:0:19: +%25lli:+01000000000000241653661:1:24:9223372036854775807: +%*25lli:+01000000000000241653661:0:24: +%25lli:+0B1000000000000000000000000000000000000010100001110101011110110001:1:25:2097152: +%*25lli:+0B1000000000000000000000000000000000000010100001110101011110110001:0:25: +%25lli:+0b1000000000000000000000000000000000000010100001110101011110110001:1:25:2097152: +%*25lli:+0b1000000000000000000000000000000000000010100001110101011110110001:0:25: +%2lli: :0:-1: +%*2lli: :0:-1: +%2lli: -9223372036867121486:1:3:-9: +%*2lli: -9223372036867121486:0:3: +%2lli: -0X8000000000bc614e:1:3:0: +%*2lli: -0X8000000000bc614e:0:3: +%2lli: -0x8000000000BC614E:1:3:0: +%*2lli: -0x8000000000BC614E:0:3: +%2lli: -01000000000000057060516:1:3:0: +%*2lli: -01000000000000057060516:0:3: +%2lli: -0B1000000000000000000000000000000000000000101111000110000101001110:1:3:0: +%*2lli: -0B1000000000000000000000000000000000000000101111000110000101001110:0:3: +%2lli: -0b1000000000000000000000000000000000000000101111000110000101001110:1:3:0: +%*2lli: -0b1000000000000000000000000000000000000000101111000110000101001110:0:3: +%2lli: -9223372036854775809:1:3:-9: +%*2lli: -9223372036854775809:0:3: +%2lli: -0X8000000000000001:1:3:0: +%*2lli: -0X8000000000000001:0:3: +%2lli: -0x8000000000000001:1:3:0: +%*2lli: -0x8000000000000001:0:3: +%2lli: -01000000000000000000001:1:3:0: +%*2lli: -01000000000000000000001:0:3: +%2lli: -0B1000000000000000000000000000000000000000000000000000000000000001:1:3:0: +%*2lli: -0B1000000000000000000000000000000000000000000000000000000000000001:0:3: +%2lli: -0b1000000000000000000000000000000000000000000000000000000000000001:1:3:0: +%*2lli: -0b1000000000000000000000000000000000000000000000000000000000000001:0:3: +%2lli: -9223372036854775808:1:3:-9: +%*2lli: -9223372036854775808:0:3: +%2lli: -0X8000000000000000:1:3:0: +%*2lli: -0X8000000000000000:0:3: +%2lli: -0x8000000000000000:1:3:0: +%*2lli: -0x8000000000000000:0:3: +%2lli: -01000000000000000000000:1:3:0: +%*2lli: -01000000000000000000000:0:3: +%2lli: -0B1000000000000000000000000000000000000000000000000000000000000000:1:3:0: +%*2lli: -0B1000000000000000000000000000000000000000000000000000000000000000:0:3: +%2lli: -0b1000000000000000000000000000000000000000000000000000000000000000:1:3:0: +%*2lli: -0b1000000000000000000000000000000000000000000000000000000000000000:0:3: +%2lli: -123:1:3:-1: +%*2lli: -123:0:3: +%2lli: -0X7b:1:3:0: +%*2lli: -0X7b:0:3: +%2lli: -0x7B:1:3:0: +%*2lli: -0x7B:0:3: +%2lli: -0173:1:3:0: +%*2lli: -0173:0:3: +%2lli: -0B1111011:1:3:0: +%*2lli: -0B1111011:0:3: +%2lli: -0b1111011:1:3:0: +%*2lli: -0b1111011:0:3: +%2lli: -1:1:3:-1: +%*2lli: -1:0:3: +%2lli: -0X1:1:3:0: +%*2lli: -0X1:0:3: +%2lli: -0x1:1:3:0: +%*2lli: -0x1:0:3: +%2lli: -01:1:3:0: +%*2lli: -01:0:3: +%2lli: -0B1:1:3:0: +%*2lli: -0B1:0:3: +%2lli: -0b1:1:3:0: +%*2lli: -0b1:0:3: +%2lli: -0:1:3:0: +%*2lli: -0:0:3: +%2lli: -0X0:1:3:0: +%*2lli: -0X0:0:3: +%2lli: -0x0:1:3:0: +%*2lli: -0x0:0:3: +%2lli: -00:1:3:0: +%*2lli: -00:0:3: +%2lli: -0B0:1:3:0: +%*2lli: -0B0:0:3: +%2lli: -0b0:1:3:0: +%*2lli: -0b0:0:3: +%2lli: 0:1:2:0: +%*2lli: 0:0:2: +%2lli: 0X0:0:-1: +%*2lli: 0X0:0:-1: +%2lli: 0x0:0:-1: +%*2lli: 0x0:0:-1: +%2lli: 00:1:3:0: +%*2lli: 00:0:3: +%2lli: 0B0:0:-1: +%*2lli: 0B0:0:-1: +%2lli: 0b0:0:-1: +%*2lli: 0b0:0:-1: +%2lli: 1:1:2:1: +%*2lli: 1:0:2: +%2lli: 0X1:0:-1: +%*2lli: 0X1:0:-1: +%2lli: 0x1:0:-1: +%*2lli: 0x1:0:-1: +%2lli: 01:1:3:1: +%*2lli: 01:0:3: +%2lli: 0B1:0:-1: +%*2lli: 0B1:0:-1: +%2lli: 0b1:0:-1: +%*2lli: 0b1:0:-1: +%2lli: 42:1:3:42: +%*2lli: 42:0:3: +%2lli: 0X2a:0:-1: +%*2lli: 0X2a:0:-1: +%2lli: 0x2A:0:-1: +%*2lli: 0x2A:0:-1: +%2lli: 052:1:3:5: +%*2lli: 052:0:3: +%2lli: 0B101010:0:-1: +%*2lli: 0B101010:0:-1: +%2lli: 0b101010:0:-1: +%*2lli: 0b101010:0:-1: +%2lli: 9223372036854775807:1:3:92: +%*2lli: 9223372036854775807:0:3: +%2lli: 0X7fffffffffffffff:0:-1: +%*2lli: 0X7fffffffffffffff:0:-1: +%2lli: 0x7FFFFFFFFFFFFFFF:0:-1: +%*2lli: 0x7FFFFFFFFFFFFFFF:0:-1: +%2lli: 0777777777777777777777:1:3:7: +%*2lli: 0777777777777777777777:0:3: +%2lli: 0B111111111111111111111111111111111111111111111111111111111111111:0:-1: +%*2lli: 0B111111111111111111111111111111111111111111111111111111111111111:0:-1: +%2lli: 0b111111111111111111111111111111111111111111111111111111111111111:0:-1: +%*2lli: 0b111111111111111111111111111111111111111111111111111111111111111:0:-1: +%2lli: 9223372036854775808:1:3:92: +%*2lli: 9223372036854775808:0:3: +%2lli: 0X8000000000000000:0:-1: +%*2lli: 0X8000000000000000:0:-1: +%2lli: 0x8000000000000000:0:-1: +%*2lli: 0x8000000000000000:0:-1: +%2lli: 01000000000000000000000:1:3:1: +%*2lli: 01000000000000000000000:0:3: +%2lli: 0B1000000000000000000000000000000000000000000000000000000000000000:0:-1: +%*2lli: 0B1000000000000000000000000000000000000000000000000000000000000000:0:-1: +%2lli: 0b1000000000000000000000000000000000000000000000000000000000000000:0:-1: +%*2lli: 0b1000000000000000000000000000000000000000000000000000000000000000:0:-1: +%2lli: 9223372036897200049:1:3:92: +%*2lli: 9223372036897200049:0:3: +%2lli: 0X80000000028757b1:0:-1: +%*2lli: 0X80000000028757b1:0:-1: +%2lli: 0x80000000028757B1:0:-1: +%*2lli: 0x80000000028757B1:0:-1: +%2lli: 01000000000000241653661:1:3:1: +%*2lli: 01000000000000241653661:0:3: +%2lli: 0B1000000000000000000000000000000000000010100001110101011110110001:0:-1: +%*2lli: 0B1000000000000000000000000000000000000010100001110101011110110001:0:-1: +%2lli: 0b1000000000000000000000000000000000000010100001110101011110110001:0:-1: +%*2lli: 0b1000000000000000000000000000000000000010100001110101011110110001:0:-1: +%2lli: +0:1:3:0: +%*2lli: +0:0:3: +%2lli: +0X0:1:3:0: +%*2lli: +0X0:0:3: +%2lli: +0x0:1:3:0: +%*2lli: +0x0:0:3: +%2lli: +00:1:3:0: +%*2lli: +00:0:3: +%2lli: +0B0:1:3:0: +%*2lli: +0B0:0:3: +%2lli: +0b0:1:3:0: +%*2lli: +0b0:0:3: +%2lli: +1:1:3:1: +%*2lli: +1:0:3: +%2lli: +0X1:1:3:0: +%*2lli: +0X1:0:3: +%2lli: +0x1:1:3:0: +%*2lli: +0x1:0:3: +%2lli: +01:1:3:0: +%*2lli: +01:0:3: +%2lli: +0B1:1:3:0: +%*2lli: +0B1:0:3: +%2lli: +0b1:1:3:0: +%*2lli: +0b1:0:3: +%2lli: +42:1:3:4: +%*2lli: +42:0:3: +%2lli: +0X2a:1:3:0: +%*2lli: +0X2a:0:3: +%2lli: +0x2A:1:3:0: +%*2lli: +0x2A:0:3: +%2lli: +052:1:3:0: +%*2lli: +052:0:3: +%2lli: +0B101010:1:3:0: +%*2lli: +0B101010:0:3: +%2lli: +0b101010:1:3:0: +%*2lli: +0b101010:0:3: +%2lli: +9223372036854775807:1:3:9: +%*2lli: +9223372036854775807:0:3: +%2lli: +0X7fffffffffffffff:1:3:0: +%*2lli: +0X7fffffffffffffff:0:3: +%2lli: +0x7FFFFFFFFFFFFFFF:1:3:0: +%*2lli: +0x7FFFFFFFFFFFFFFF:0:3: +%2lli: +0777777777777777777777:1:3:0: +%*2lli: +0777777777777777777777:0:3: +%2lli: +0B111111111111111111111111111111111111111111111111111111111111111:1:3:0: +%*2lli: +0B111111111111111111111111111111111111111111111111111111111111111:0:3: +%2lli: +0b111111111111111111111111111111111111111111111111111111111111111:1:3:0: +%*2lli: +0b111111111111111111111111111111111111111111111111111111111111111:0:3: +%2lli: +9223372036854775808:1:3:9: +%*2lli: +9223372036854775808:0:3: +%2lli: +0X8000000000000000:1:3:0: +%*2lli: +0X8000000000000000:0:3: +%2lli: +0x8000000000000000:1:3:0: +%*2lli: +0x8000000000000000:0:3: +%2lli: +01000000000000000000000:1:3:0: +%*2lli: +01000000000000000000000:0:3: +%2lli: +0B1000000000000000000000000000000000000000000000000000000000000000:1:3:0: +%*2lli: +0B1000000000000000000000000000000000000000000000000000000000000000:0:3: +%2lli: +0b1000000000000000000000000000000000000000000000000000000000000000:1:3:0: +%*2lli: +0b1000000000000000000000000000000000000000000000000000000000000000:0:3: +%2lli: +9223372036897200049:1:3:9: +%*2lli: +9223372036897200049:0:3: +%2lli: +0X80000000028757b1:1:3:0: +%*2lli: +0X80000000028757b1:0:3: +%2lli: +0x80000000028757B1:1:3:0: +%*2lli: +0x80000000028757B1:0:3: +%2lli: +01000000000000241653661:1:3:0: +%*2lli: +01000000000000241653661:0:3: +%2lli: +0B1000000000000000000000000000000000000010100001110101011110110001:1:3:0: +%*2lli: +0B1000000000000000000000000000000000000010100001110101011110110001:0:3: +%2lli: +0b1000000000000000000000000000000000000010100001110101011110110001:1:3:0: +%*2lli: +0b1000000000000000000000000000000000000010100001110101011110110001:0:3: +%25lli: :0:-1: +%*25lli: :0:-1: +%25lli: -9223372036867121486:1:21:-9223372036854775808: +%*25lli: -9223372036867121486:0:21: +%25lli: -0X8000000000bc614e:1:20:-9223372036854775808: +%*25lli: -0X8000000000bc614e:0:20: +%25lli: -0x8000000000BC614E:1:20:-9223372036854775808: +%*25lli: -0x8000000000BC614E:0:20: +%25lli: -01000000000000057060516:1:25:-9223372036854775808: +%*25lli: -01000000000000057060516:0:25: +%25lli: -0B1000000000000000000000000000000000000000101111000110000101001110:1:26:-2097152: +%*25lli: -0B1000000000000000000000000000000000000000101111000110000101001110:0:26: +%25lli: -0b1000000000000000000000000000000000000000101111000110000101001110:1:26:-2097152: +%*25lli: -0b1000000000000000000000000000000000000000101111000110000101001110:0:26: +%25lli: -9223372036854775809:1:21:-9223372036854775808: +%*25lli: -9223372036854775809:0:21: +%25lli: -0X8000000000000001:1:20:-9223372036854775808: +%*25lli: -0X8000000000000001:0:20: +%25lli: -0x8000000000000001:1:20:-9223372036854775808: +%*25lli: -0x8000000000000001:0:20: +%25lli: -01000000000000000000001:1:25:-9223372036854775808: +%*25lli: -01000000000000000000001:0:25: +%25lli: -0B1000000000000000000000000000000000000000000000000000000000000001:1:26:-2097152: +%*25lli: -0B1000000000000000000000000000000000000000000000000000000000000001:0:26: +%25lli: -0b1000000000000000000000000000000000000000000000000000000000000001:1:26:-2097152: +%*25lli: -0b1000000000000000000000000000000000000000000000000000000000000001:0:26: +%25lli: -9223372036854775808:1:21:-9223372036854775808: +%*25lli: -9223372036854775808:0:21: +%25lli: -0X8000000000000000:1:20:-9223372036854775808: +%*25lli: -0X8000000000000000:0:20: +%25lli: -0x8000000000000000:1:20:-9223372036854775808: +%*25lli: -0x8000000000000000:0:20: +%25lli: -01000000000000000000000:1:25:-9223372036854775808: +%*25lli: -01000000000000000000000:0:25: +%25lli: -0B1000000000000000000000000000000000000000000000000000000000000000:1:26:-2097152: +%*25lli: -0B1000000000000000000000000000000000000000000000000000000000000000:0:26: +%25lli: -0b1000000000000000000000000000000000000000000000000000000000000000:1:26:-2097152: +%*25lli: -0b1000000000000000000000000000000000000000000000000000000000000000:0:26: +%25lli: -123:1:5:-123: +%*25lli: -123:0:5: +%25lli: -0X7b:1:6:-123: +%*25lli: -0X7b:0:6: +%25lli: -0x7B:1:6:-123: +%*25lli: -0x7B:0:6: +%25lli: -0173:1:6:-123: +%*25lli: -0173:0:6: +%25lli: -0B1111011:1:11:-123: +%*25lli: -0B1111011:0:11: +%25lli: -0b1111011:1:11:-123: +%*25lli: -0b1111011:0:11: +%25lli: -1:1:3:-1: +%*25lli: -1:0:3: +%25lli: -0X1:1:5:-1: +%*25lli: -0X1:0:5: +%25lli: -0x1:1:5:-1: +%*25lli: -0x1:0:5: +%25lli: -01:1:4:-1: +%*25lli: -01:0:4: +%25lli: -0B1:1:5:-1: +%*25lli: -0B1:0:5: +%25lli: -0b1:1:5:-1: +%*25lli: -0b1:0:5: +%25lli: -0:1:3:0: +%*25lli: -0:0:3: +%25lli: -0X0:1:5:0: +%*25lli: -0X0:0:5: +%25lli: -0x0:1:5:0: +%*25lli: -0x0:0:5: +%25lli: -00:1:4:0: +%*25lli: -00:0:4: +%25lli: -0B0:1:5:0: +%*25lli: -0B0:0:5: +%25lli: -0b0:1:5:0: +%*25lli: -0b0:0:5: +%25lli: 0:1:2:0: +%*25lli: 0:0:2: +%25lli: 0X0:1:4:0: +%*25lli: 0X0:0:4: +%25lli: 0x0:1:4:0: +%*25lli: 0x0:0:4: +%25lli: 00:1:3:0: +%*25lli: 00:0:3: +%25lli: 0B0:1:4:0: +%*25lli: 0B0:0:4: +%25lli: 0b0:1:4:0: +%*25lli: 0b0:0:4: +%25lli: 1:1:2:1: +%*25lli: 1:0:2: +%25lli: 0X1:1:4:1: +%*25lli: 0X1:0:4: +%25lli: 0x1:1:4:1: +%*25lli: 0x1:0:4: +%25lli: 01:1:3:1: +%*25lli: 01:0:3: +%25lli: 0B1:1:4:1: +%*25lli: 0B1:0:4: +%25lli: 0b1:1:4:1: +%*25lli: 0b1:0:4: +%25lli: 42:1:3:42: +%*25lli: 42:0:3: +%25lli: 0X2a:1:5:42: +%*25lli: 0X2a:0:5: +%25lli: 0x2A:1:5:42: +%*25lli: 0x2A:0:5: +%25lli: 052:1:4:42: +%*25lli: 052:0:4: +%25lli: 0B101010:1:9:42: +%*25lli: 0B101010:0:9: +%25lli: 0b101010:1:9:42: +%*25lli: 0b101010:0:9: +%25lli: 9223372036854775807:1:20:9223372036854775807: +%*25lli: 9223372036854775807:0:20: +%25lli: 0X7fffffffffffffff:1:19:9223372036854775807: +%*25lli: 0X7fffffffffffffff:0:19: +%25lli: 0x7FFFFFFFFFFFFFFF:1:19:9223372036854775807: +%*25lli: 0x7FFFFFFFFFFFFFFF:0:19: +%25lli: 0777777777777777777777:1:23:9223372036854775807: +%*25lli: 0777777777777777777777:0:23: +%25lli: 0B111111111111111111111111111111111111111111111111111111111111111:1:26:8388607: +%*25lli: 0B111111111111111111111111111111111111111111111111111111111111111:0:26: +%25lli: 0b111111111111111111111111111111111111111111111111111111111111111:1:26:8388607: +%*25lli: 0b111111111111111111111111111111111111111111111111111111111111111:0:26: +%25lli: 9223372036854775808:1:20:9223372036854775807: +%*25lli: 9223372036854775808:0:20: +%25lli: 0X8000000000000000:1:19:9223372036854775807: +%*25lli: 0X8000000000000000:0:19: +%25lli: 0x8000000000000000:1:19:9223372036854775807: +%*25lli: 0x8000000000000000:0:19: +%25lli: 01000000000000000000000:1:24:9223372036854775807: +%*25lli: 01000000000000000000000:0:24: +%25lli: 0B1000000000000000000000000000000000000000000000000000000000000000:1:26:4194304: +%*25lli: 0B1000000000000000000000000000000000000000000000000000000000000000:0:26: +%25lli: 0b1000000000000000000000000000000000000000000000000000000000000000:1:26:4194304: +%*25lli: 0b1000000000000000000000000000000000000000000000000000000000000000:0:26: +%25lli: 9223372036897200049:1:20:9223372036854775807: +%*25lli: 9223372036897200049:0:20: +%25lli: 0X80000000028757b1:1:19:9223372036854775807: +%*25lli: 0X80000000028757b1:0:19: +%25lli: 0x80000000028757B1:1:19:9223372036854775807: +%*25lli: 0x80000000028757B1:0:19: +%25lli: 01000000000000241653661:1:24:9223372036854775807: +%*25lli: 01000000000000241653661:0:24: +%25lli: 0B1000000000000000000000000000000000000010100001110101011110110001:1:26:4194304: +%*25lli: 0B1000000000000000000000000000000000000010100001110101011110110001:0:26: +%25lli: 0b1000000000000000000000000000000000000010100001110101011110110001:1:26:4194304: +%*25lli: 0b1000000000000000000000000000000000000010100001110101011110110001:0:26: +%25lli: +0:1:3:0: +%*25lli: +0:0:3: +%25lli: +0X0:1:5:0: +%*25lli: +0X0:0:5: +%25lli: +0x0:1:5:0: +%*25lli: +0x0:0:5: +%25lli: +00:1:4:0: +%*25lli: +00:0:4: +%25lli: +0B0:1:5:0: +%*25lli: +0B0:0:5: +%25lli: +0b0:1:5:0: +%*25lli: +0b0:0:5: +%25lli: +1:1:3:1: +%*25lli: +1:0:3: +%25lli: +0X1:1:5:1: +%*25lli: +0X1:0:5: +%25lli: +0x1:1:5:1: +%*25lli: +0x1:0:5: +%25lli: +01:1:4:1: +%*25lli: +01:0:4: +%25lli: +0B1:1:5:1: +%*25lli: +0B1:0:5: +%25lli: +0b1:1:5:1: +%*25lli: +0b1:0:5: +%25lli: +42:1:4:42: +%*25lli: +42:0:4: +%25lli: +0X2a:1:6:42: +%*25lli: +0X2a:0:6: +%25lli: +0x2A:1:6:42: +%*25lli: +0x2A:0:6: +%25lli: +052:1:5:42: +%*25lli: +052:0:5: +%25lli: +0B101010:1:10:42: +%*25lli: +0B101010:0:10: +%25lli: +0b101010:1:10:42: +%*25lli: +0b101010:0:10: +%25lli: +9223372036854775807:1:21:9223372036854775807: +%*25lli: +9223372036854775807:0:21: +%25lli: +0X7fffffffffffffff:1:20:9223372036854775807: +%*25lli: +0X7fffffffffffffff:0:20: +%25lli: +0x7FFFFFFFFFFFFFFF:1:20:9223372036854775807: +%*25lli: +0x7FFFFFFFFFFFFFFF:0:20: +%25lli: +0777777777777777777777:1:24:9223372036854775807: +%*25lli: +0777777777777777777777:0:24: +%25lli: +0B111111111111111111111111111111111111111111111111111111111111111:1:26:4194303: +%*25lli: +0B111111111111111111111111111111111111111111111111111111111111111:0:26: +%25lli: +0b111111111111111111111111111111111111111111111111111111111111111:1:26:4194303: +%*25lli: +0b111111111111111111111111111111111111111111111111111111111111111:0:26: +%25lli: +9223372036854775808:1:21:9223372036854775807: +%*25lli: +9223372036854775808:0:21: +%25lli: +0X8000000000000000:1:20:9223372036854775807: +%*25lli: +0X8000000000000000:0:20: +%25lli: +0x8000000000000000:1:20:9223372036854775807: +%*25lli: +0x8000000000000000:0:20: +%25lli: +01000000000000000000000:1:25:9223372036854775807: +%*25lli: +01000000000000000000000:0:25: +%25lli: +0B1000000000000000000000000000000000000000000000000000000000000000:1:26:2097152: +%*25lli: +0B1000000000000000000000000000000000000000000000000000000000000000:0:26: +%25lli: +0b1000000000000000000000000000000000000000000000000000000000000000:1:26:2097152: +%*25lli: +0b1000000000000000000000000000000000000000000000000000000000000000:0:26: +%25lli: +9223372036897200049:1:21:9223372036854775807: +%*25lli: +9223372036897200049:0:21: +%25lli: +0X80000000028757b1:1:20:9223372036854775807: +%*25lli: +0X80000000028757b1:0:20: +%25lli: +0x80000000028757B1:1:20:9223372036854775807: +%*25lli: +0x80000000028757B1:0:20: +%25lli: +01000000000000241653661:1:25:9223372036854775807: +%*25lli: +01000000000000241653661:0:25: +%25lli: +0B1000000000000000000000000000000000000010100001110101011110110001:1:26:2097152: +%*25lli: +0B1000000000000000000000000000000000000010100001110101011110110001:0:26: +%25lli: +0b1000000000000000000000000000000000000010100001110101011110110001:1:26:2097152: +%*25lli: +0b1000000000000000000000000000000000000010100001110101011110110001:0:26: diff --git a/stdio-common/tst-scanf-format-real.h b/stdio-common/tst-scanf-format-real.h new file mode 100644 index 0000000..639ac74 --- /dev/null +++ b/stdio-common/tst-scanf-format-real.h @@ -0,0 +1,363 @@ +/* Test feature wrapper for formatted real input. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <ctype.h> +#include <errno.h> +#include <float.h> +#include <tgmath.h> +#include <stdbool.h> +#include <stddef.h> +#include <stdlib.h> +#include <string.h> + +#include <support/support.h> + +/* Reference data is a case-inensitive signed datum, which is either a + hexadecimal floating constant or a literal representing infinity or + NaN data in any of the forms accepted by 'strtod' family functions, + whose binary representation is to match against byte-wise. + + We need to be careful with parsing reference data in the handling of + the sign as with the IBM long double binary format unary negation + of a positive value whose lower-magnitude part is zero produces a + bit pattern that is different from one produced by initialization or + conversions made by functions such as 'scanf' or 'strtod' from the + complementing negative value. The difference is in the sign of zero + held in the lower-magnitude part and therefore the bit patterns are + arithmetically equivalent, but they do not match byte-wise. + + Therefore we set the sign with the initial value of the significand, + either -0.0 or 0.0, which sets the sign of both parts according to + what 'scanf' does, and never negate it afterwards. + + Additionally the Intel long double binary format uses only 80 bits + out of 96 that the data type occupies. Therefore preinitialize the + reference value with the same 0xa5 bit pattern that the value under + test has been so that the byte-wise comparison matches as well for + the unused parts of the two data pieces. + + We use 'ldexp' to assemble the significand with the exponent, which + does not compromise verification, because internally this exercises + a code path different from one used by 'scanf' family functions for + this purpose. Specifically 'ldexp' uses 'scalbn', whereas 'scanf' + defers to 'strtod' which uses '__mpn_construct_double'. Analogously + for the remaining floating-point data types. */ + +#define nan(v, x) \ + _Generic((v), float: nanf, double: nan, long double: nanl) (x) + +#define pointer_to_value(val) (&(val)) + +#define initialize_value(val) \ + memset (&val, 0xa5, sizeof (val)) + +#define compare_real(x, y) \ + (memcmp (&(x), &(y), sizeof (y)) == 0) + +#define verify_input(f, val, count, errp) \ +({ \ + __label__ out; \ + bool match = true; \ + int err = 0; \ + type_t v; \ + \ + initialize_value (v); \ + /* Make sure it's been committed. */ \ + __asm__ ("" : : : "memory"); \ + v = read_real (&err); \ + if (err < 0) \ + goto out; \ + match = compare_real (val, v); \ + \ +out: \ + if (err || !match) \ + { \ + union \ + { \ + type_t v; \ + unsigned char x[sizeof (type_t)]; \ + } \ + uv = { .v = v }, ui = { .v = val }; \ + \ + printf ("error: %s:%d: input buffer: `", __FILE__, __LINE__); \ + for (size_t j = 0; j < sizeof (ui.x); j++) \ + printf ("%02hhx", ui.x[j]); \ + printf ("'\n"); \ + printf ("error: %s:%d: value buffer: `", __FILE__, __LINE__); \ + for (size_t j = 0; j < sizeof (uv.x); j++) \ + printf ("%02hhx", uv.x[j]); \ + printf ("'\n"); \ + } \ + \ + *errp = err; \ + match; \ +}) + +#define read_real(errp) \ +({ \ + __label__ out; \ + bool m = false; \ + int err = 0; \ + type_t v; \ + int ch; \ + \ + ch = read_input (); \ + if (ch == '-' || ch == '+') \ + { \ + m = ch == '-'; \ + ch = read_input (); \ + } \ + \ + switch (ch) \ + { \ + case '0': \ + break; \ + case 'I': \ + case 'i': \ + { \ + static const char unf[] = { 'N', 'F' }; \ + static const char lnf[] = { 'n', 'f' }; \ + size_t i; \ + \ + for (i = 0; i < sizeof (unf); i++) \ + { \ + ch = read_input (); \ + if (ch != unf[i] && ch != lnf[i]) \ + { \ + err = ch < 0 ? ch : INPUT_FORMAT; \ + v = NAN; \ + goto out; \ + } \ + } \ + \ + ch = read_input (); \ + if (ch == ':') \ + { \ + v = m ? -INFINITY : +INFINITY; \ + goto out; \ + } \ + \ + static const char uinity[] = { 'I', 'N', 'I', 'T', 'Y' }; \ + static const char linity[] = { 'i', 'n', 'i', 't', 'y' }; \ + \ + for (i = 0; i < sizeof (uinity); i++) \ + { \ + if (ch != uinity[i] && ch != linity[i]) \ + { \ + err = ch < 0 ? ch : INPUT_FORMAT; \ + v = NAN; \ + goto out; \ + } \ + ch = read_input (); \ + } \ + if (ch == ':') \ + { \ + v = m ? -INFINITY : +INFINITY; \ + goto out; \ + } \ + } \ + err = ch < 0 ? ch : INPUT_FORMAT; \ + v = NAN; \ + goto out; \ + \ + case 'N': \ + case 'n': \ + { \ + static const char uan[] = { 'A', 'N' }; \ + static const char lan[] = { 'a', 'n' }; \ + size_t i; \ + \ + for (i = 0; i < sizeof (uan); i++) \ + { \ + ch = read_input (); \ + if (ch != uan[i] && ch != lan[i]) \ + { \ + err = ch < 0 ? ch : INPUT_FORMAT; \ + v = NAN; \ + goto out; \ + } \ + } \ + \ + ch = read_input (); \ + if (ch == ':') \ + { \ + v = m ? -nan (v, ".") : nan (v, "."); \ + goto out; \ + } \ + \ + size_t seq_size = 0; \ + char *seq = NULL; \ + i = 0; \ + if (ch == '(') \ + while (1) \ + { \ + ch = read_input (); \ + if (ch == ')') \ + break; \ + if (ch != '_' && !isdigit (ch) \ + && !(ch >= 'A' && ch <= 'Z') \ + && !(ch >= 'a' && ch <= 'z')) \ + { \ + free (seq); \ + err = ch < 0 ? ch : INPUT_FORMAT; \ + v = NAN; \ + goto out; \ + } \ + if (i == seq_size) \ + { \ + seq_size += SIZE_CHUNK; \ + seq = xrealloc (seq, seq_size); \ + } \ + seq[i++] = ch; \ + } \ + seq[i] = '\0'; \ + \ + ch = read_input (); \ + if (ch == ':') \ + { \ + v = m ? -nan (v, seq) : nan (v, seq); \ + free (seq); \ + goto out; \ + } \ + free (seq); \ + } \ + err = ch < 0 ? ch : INPUT_FORMAT; \ + v = NAN; \ + goto out; \ + \ + default: \ + err = ch < 0 ? ch : INPUT_FORMAT; \ + v = NAN; \ + goto out; \ + } \ + \ + ch = read_input (); \ + if (ch != 'X' && ch != 'x') \ + { \ + err = ch < 0 ? ch : INPUT_FORMAT; \ + v = NAN; \ + goto out; \ + } \ + \ + type_t f = m ? -1.0 : 1.0; \ + v = m ? -0.0 : 0.0; \ + int i = 0; \ + do \ + { \ + int d = 0; \ + \ + ch = read_input (); \ + \ + if (i == 1) \ + switch (ch) \ + { \ + case '.': \ + i++; \ + continue; \ + \ + case ':': \ + case 'P': \ + case 'p': \ + break; \ + \ + default: \ + err = ch < 0 ? ch : INPUT_FORMAT; \ + v = NAN; \ + goto out; \ + } \ + \ + switch (ch) \ + { \ + case '0': \ + case '1': \ + case '2': \ + case '3': \ + case '4': \ + case '5': \ + case '6': \ + case '7': \ + case '8': \ + case '9': \ + d = ch - '0'; \ + break; \ + \ + case 'A': \ + case 'B': \ + case 'C': \ + case 'D': \ + case 'E': \ + case 'F': \ + d = ch - 'A' + 10; \ + break; \ + \ + case 'a': \ + case 'b': \ + case 'c': \ + case 'd': \ + case 'e': \ + case 'f': \ + d = ch - 'a' + 10; \ + break; \ + \ + case ':': \ + case 'P': \ + case 'p': \ + if (i == 0) \ + { \ + err = INPUT_FORMAT; \ + v = NAN; \ + goto out; \ + } \ + break; \ + \ + default: \ + err = ch < 0 ? ch : INPUT_FORMAT; \ + v = NAN; \ + goto out; \ + } \ + \ + v += f * d; \ + f /= 16.0l; \ + i++; \ + } \ + while (ch != ':' && ch != 'P' && ch != 'p'); \ + \ + long long exp = 0; \ + if (ch == 'P' || ch == 'p') \ + { \ + exp = read_integer (&err); \ + if (err) \ + { \ + v = NAN; \ + goto out; \ + } \ + } \ + \ + errno = 0; \ + v = ldexp (v, exp); \ + if ((v == HUGE_VALL || v == -HUGE_VALL) && errno != 0) \ + { \ + err = INPUT_OVERFLOW; \ + v = NAN; \ + goto out; \ + } \ + \ +out: \ + *errp = err; \ + v; \ +}) diff --git a/stdio-common/tst-scanf-format-s-c.c b/stdio-common/tst-scanf-format-s-c.c new file mode 100644 index 0000000..bbfc000 --- /dev/null +++ b/stdio-common/tst-scanf-format-s-c.c @@ -0,0 +1,22 @@ +/* Test for formatted 'scanf' input for the character conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-s.h" +#include "tst-scanf-format-character.h" +#include <tst-scanf-format-skeleton-c.c> diff --git a/stdio-common/tst-scanf-format-s-char.c b/stdio-common/tst-scanf-format-s-char.c new file mode 100644 index 0000000..c13527d --- /dev/null +++ b/stdio-common/tst-scanf-format-s-char.c @@ -0,0 +1,22 @@ +/* Test for formatted 'scanf' input for signed char conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-s.h" +#include "tst-scanf-format-integer.h" +#include <tst-scanf-format-skeleton-char.c> diff --git a/stdio-common/tst-scanf-format-s-double.c b/stdio-common/tst-scanf-format-s-double.c new file mode 100644 index 0000000..4baad01 --- /dev/null +++ b/stdio-common/tst-scanf-format-s-double.c @@ -0,0 +1,22 @@ +/* Test for formatted 'scanf' input for double conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-s.h" +#include "tst-scanf-format-real.h" +#include <tst-scanf-format-skeleton-double.c> diff --git a/stdio-common/tst-scanf-format-s-float.c b/stdio-common/tst-scanf-format-s-float.c new file mode 100644 index 0000000..301b262 --- /dev/null +++ b/stdio-common/tst-scanf-format-s-float.c @@ -0,0 +1,22 @@ +/* Test for formatted 'scanf' input for float conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-s.h" +#include "tst-scanf-format-real.h" +#include <tst-scanf-format-skeleton-float.c> diff --git a/stdio-common/tst-scanf-format-s-int.c b/stdio-common/tst-scanf-format-s-int.c new file mode 100644 index 0000000..e176fe9 --- /dev/null +++ b/stdio-common/tst-scanf-format-s-int.c @@ -0,0 +1,22 @@ +/* Test for formatted 'scanf' input for int conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-s.h" +#include "tst-scanf-format-integer.h" +#include <tst-scanf-format-skeleton-int.c> diff --git a/stdio-common/tst-scanf-format-s-ldouble.c b/stdio-common/tst-scanf-format-s-ldouble.c new file mode 100644 index 0000000..dbb007c --- /dev/null +++ b/stdio-common/tst-scanf-format-s-ldouble.c @@ -0,0 +1,22 @@ +/* Test for formatted 'scanf' input for long double conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-s.h" +#include "tst-scanf-format-real.h" +#include <tst-scanf-format-skeleton-ldouble.c> diff --git a/stdio-common/tst-scanf-format-s-llong.c b/stdio-common/tst-scanf-format-s-llong.c new file mode 100644 index 0000000..fe3d11a --- /dev/null +++ b/stdio-common/tst-scanf-format-s-llong.c @@ -0,0 +1,22 @@ +/* Test for formatted 'scanf' input for long long conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-s.h" +#include "tst-scanf-format-integer.h" +#include <tst-scanf-format-skeleton-llong.c> diff --git a/stdio-common/tst-scanf-format-s-long.c b/stdio-common/tst-scanf-format-s-long.c new file mode 100644 index 0000000..415e5fa --- /dev/null +++ b/stdio-common/tst-scanf-format-s-long.c @@ -0,0 +1,22 @@ +/* Test for formatted 'scanf' input for long conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-s.h" +#include "tst-scanf-format-integer.h" +#include <tst-scanf-format-skeleton-long.c> diff --git a/stdio-common/tst-scanf-format-s-short.c b/stdio-common/tst-scanf-format-s-short.c new file mode 100644 index 0000000..d545ee2 --- /dev/null +++ b/stdio-common/tst-scanf-format-s-short.c @@ -0,0 +1,22 @@ +/* Test for formatted 'scanf' input for short int conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-s.h" +#include "tst-scanf-format-integer.h" +#include <tst-scanf-format-skeleton-short.c> diff --git a/stdio-common/tst-scanf-format-s-uchar.c b/stdio-common/tst-scanf-format-s-uchar.c new file mode 100644 index 0000000..a1a7f73 --- /dev/null +++ b/stdio-common/tst-scanf-format-s-uchar.c @@ -0,0 +1,22 @@ +/* Test for formatted 'scanf' input for unsigned char conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-s.h" +#include "tst-scanf-format-integer.h" +#include <tst-scanf-format-skeleton-uchar.c> diff --git a/stdio-common/tst-scanf-format-s-uint.c b/stdio-common/tst-scanf-format-s-uint.c new file mode 100644 index 0000000..27b0f4a --- /dev/null +++ b/stdio-common/tst-scanf-format-s-uint.c @@ -0,0 +1,22 @@ +/* Test for formatted 'scanf' input for unsigned int conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-s.h" +#include "tst-scanf-format-integer.h" +#include <tst-scanf-format-skeleton-uint.c> diff --git a/stdio-common/tst-scanf-format-s-ullong.c b/stdio-common/tst-scanf-format-s-ullong.c new file mode 100644 index 0000000..9cc45b4 --- /dev/null +++ b/stdio-common/tst-scanf-format-s-ullong.c @@ -0,0 +1,22 @@ +/* Test for formatted 'scanf' input for unsigned long long int conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-s.h" +#include "tst-scanf-format-integer.h" +#include <tst-scanf-format-skeleton-ullong.c> diff --git a/stdio-common/tst-scanf-format-s-ulong.c b/stdio-common/tst-scanf-format-s-ulong.c new file mode 100644 index 0000000..9c5543e --- /dev/null +++ b/stdio-common/tst-scanf-format-s-ulong.c @@ -0,0 +1,22 @@ +/* Test for formatted 'scanf' input for unsigned long int conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-s.h" +#include "tst-scanf-format-integer.h" +#include <tst-scanf-format-skeleton-ulong.c> diff --git a/stdio-common/tst-scanf-format-s-ushort.c b/stdio-common/tst-scanf-format-s-ushort.c new file mode 100644 index 0000000..052a1ca --- /dev/null +++ b/stdio-common/tst-scanf-format-s-ushort.c @@ -0,0 +1,22 @@ +/* Test for formatted 'scanf' input for unsigned short int conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-s.h" +#include "tst-scanf-format-integer.h" +#include <tst-scanf-format-skeleton-ushort.c> diff --git a/stdio-common/tst-scanf-format-s.h b/stdio-common/tst-scanf-format-s.h new file mode 100644 index 0000000..dec38af --- /dev/null +++ b/stdio-common/tst-scanf-format-s.h @@ -0,0 +1,29 @@ +/* Test feature wrapper for formatted 'scanf' input. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <stdio.h> + +#define scanf_under_test(...) \ +({ \ + int result = scanf (__VA_ARGS__); \ + if (ferror (stdin)) \ + result = INPUT_ERROR; \ + else if (result == EOF) \ + result = INPUT_EOF; \ + result; \ +}) diff --git a/stdio-common/tst-scanf-format-short-d.input b/stdio-common/tst-scanf-format-short-d.input new file mode 100644 index 0000000..5d00932 --- /dev/null +++ b/stdio-common/tst-scanf-format-short-d.input @@ -0,0 +1,266 @@ +%hd::0:-1: +%*hd::0:-1: +%hd:-32891:1:6:32645: +%*hd:-32891:0:6: +%hd:-32769:1:6:32767: +%*hd:-32769:0:6: +%hd:-32768:1:6:-32768: +%*hd:-32768:0:6: +%hd:-123:1:4:-123: +%*hd:-123:0:4: +%hd:-1:1:2:-1: +%*hd:-1:0:2: +%hd:-0:1:2:0: +%*hd:-0:0:2: +%hd:0:1:1:0: +%*hd:0:0:1: +%hd:1:1:1:1: +%*hd:1:0:1: +%hd:42:1:2:42: +%*hd:42:0:2: +%hd:32767:1:5:32767: +%*hd:32767:0:5: +%hd:32768:1:5:-32768: +%*hd:32768:0:5: +%hd:32809:1:5:-32727: +%*hd:32809:0:5: +%hd:+0:1:2:0: +%*hd:+0:0:2: +%hd:+1:1:2:1: +%*hd:+1:0:2: +%hd:+42:1:3:42: +%*hd:+42:0:3: +%hd:+32767:1:6:32767: +%*hd:+32767:0:6: +%hd:+32768:1:6:-32768: +%*hd:+32768:0:6: +%hd:+32809:1:6:-32727: +%*hd:+32809:0:6: +%1hd::0:-1: +%*1hd::0:-1: +%1hd:-32891:0:-1: +%*1hd:-32891:0:-1: +%1hd:-32769:0:-1: +%*1hd:-32769:0:-1: +%1hd:-32768:0:-1: +%*1hd:-32768:0:-1: +%1hd:-123:0:-1: +%*1hd:-123:0:-1: +%1hd:-1:0:-1: +%*1hd:-1:0:-1: +%1hd:-0:0:-1: +%*1hd:-0:0:-1: +%1hd:0:1:1:0: +%*1hd:0:0:1: +%1hd:1:1:1:1: +%*1hd:1:0:1: +%1hd:42:1:1:4: +%*1hd:42:0:1: +%1hd:32767:1:1:3: +%*1hd:32767:0:1: +%1hd:32768:1:1:3: +%*1hd:32768:0:1: +%1hd:32809:1:1:3: +%*1hd:32809:0:1: +%1hd:+0:0:-1: +%*1hd:+0:0:-1: +%1hd:+1:0:-1: +%*1hd:+1:0:-1: +%1hd:+42:0:-1: +%*1hd:+42:0:-1: +%1hd:+32767:0:-1: +%*1hd:+32767:0:-1: +%1hd:+32768:0:-1: +%*1hd:+32768:0:-1: +%1hd:+32809:0:-1: +%*1hd:+32809:0:-1: +%2hd::0:-1: +%*2hd::0:-1: +%2hd:-32891:1:2:-3: +%*2hd:-32891:0:2: +%2hd:-32769:1:2:-3: +%*2hd:-32769:0:2: +%2hd:-32768:1:2:-3: +%*2hd:-32768:0:2: +%2hd:-123:1:2:-1: +%*2hd:-123:0:2: +%2hd:-1:1:2:-1: +%*2hd:-1:0:2: +%2hd:-0:1:2:0: +%*2hd:-0:0:2: +%2hd:0:1:1:0: +%*2hd:0:0:1: +%2hd:1:1:1:1: +%*2hd:1:0:1: +%2hd:42:1:2:42: +%*2hd:42:0:2: +%2hd:32767:1:2:32: +%*2hd:32767:0:2: +%2hd:32768:1:2:32: +%*2hd:32768:0:2: +%2hd:32809:1:2:32: +%*2hd:32809:0:2: +%2hd:+0:1:2:0: +%*2hd:+0:0:2: +%2hd:+1:1:2:1: +%*2hd:+1:0:2: +%2hd:+42:1:2:4: +%*2hd:+42:0:2: +%2hd:+32767:1:2:3: +%*2hd:+32767:0:2: +%2hd:+32768:1:2:3: +%*2hd:+32768:0:2: +%2hd:+32809:1:2:3: +%*2hd:+32809:0:2: +%4hd::0:-1: +%*4hd::0:-1: +%4hd:-32891:1:4:-328: +%*4hd:-32891:0:4: +%4hd:-32769:1:4:-327: +%*4hd:-32769:0:4: +%4hd:-32768:1:4:-327: +%*4hd:-32768:0:4: +%4hd:-123:1:4:-123: +%*4hd:-123:0:4: +%4hd:-1:1:2:-1: +%*4hd:-1:0:2: +%4hd:-0:1:2:0: +%*4hd:-0:0:2: +%4hd:0:1:1:0: +%*4hd:0:0:1: +%4hd:1:1:1:1: +%*4hd:1:0:1: +%4hd:42:1:2:42: +%*4hd:42:0:2: +%4hd:32767:1:4:3276: +%*4hd:32767:0:4: +%4hd:32768:1:4:3276: +%*4hd:32768:0:4: +%4hd:32809:1:4:3280: +%*4hd:32809:0:4: +%4hd:+0:1:2:0: +%*4hd:+0:0:2: +%4hd:+1:1:2:1: +%*4hd:+1:0:2: +%4hd:+42:1:3:42: +%*4hd:+42:0:3: +%4hd:+32767:1:4:327: +%*4hd:+32767:0:4: +%4hd:+32768:1:4:327: +%*4hd:+32768:0:4: +%4hd:+32809:1:4:328: +%*4hd:+32809:0:4: +%7hd::0:-1: +%*7hd::0:-1: +%7hd:-32891:1:6:32645: +%*7hd:-32891:0:6: +%7hd:-32769:1:6:32767: +%*7hd:-32769:0:6: +%7hd:-32768:1:6:-32768: +%*7hd:-32768:0:6: +%7hd:-123:1:4:-123: +%*7hd:-123:0:4: +%7hd:-1:1:2:-1: +%*7hd:-1:0:2: +%7hd:-0:1:2:0: +%*7hd:-0:0:2: +%7hd:0:1:1:0: +%*7hd:0:0:1: +%7hd:1:1:1:1: +%*7hd:1:0:1: +%7hd:42:1:2:42: +%*7hd:42:0:2: +%7hd:32767:1:5:32767: +%*7hd:32767:0:5: +%7hd:32768:1:5:-32768: +%*7hd:32768:0:5: +%7hd:32809:1:5:-32727: +%*7hd:32809:0:5: +%7hd:+0:1:2:0: +%*7hd:+0:0:2: +%7hd:+1:1:2:1: +%*7hd:+1:0:2: +%7hd:+42:1:3:42: +%*7hd:+42:0:3: +%7hd:+32767:1:6:32767: +%*7hd:+32767:0:6: +%7hd:+32768:1:6:-32768: +%*7hd:+32768:0:6: +%7hd:+32809:1:6:-32727: +%*7hd:+32809:0:6: +%2hd: :0:-1: +%*2hd: :0:-1: +%2hd: -32891:1:3:-3: +%*2hd: -32891:0:3: +%2hd: -32769:1:3:-3: +%*2hd: -32769:0:3: +%2hd: -32768:1:3:-3: +%*2hd: -32768:0:3: +%2hd: -123:1:3:-1: +%*2hd: -123:0:3: +%2hd: -1:1:3:-1: +%*2hd: -1:0:3: +%2hd: -0:1:3:0: +%*2hd: -0:0:3: +%2hd: 0:1:2:0: +%*2hd: 0:0:2: +%2hd: 1:1:2:1: +%*2hd: 1:0:2: +%2hd: 42:1:3:42: +%*2hd: 42:0:3: +%2hd: 32767:1:3:32: +%*2hd: 32767:0:3: +%2hd: 32768:1:3:32: +%*2hd: 32768:0:3: +%2hd: 32809:1:3:32: +%*2hd: 32809:0:3: +%2hd: +0:1:3:0: +%*2hd: +0:0:3: +%2hd: +1:1:3:1: +%*2hd: +1:0:3: +%2hd: +42:1:3:4: +%*2hd: +42:0:3: +%2hd: +32767:1:3:3: +%*2hd: +32767:0:3: +%2hd: +32768:1:3:3: +%*2hd: +32768:0:3: +%2hd: +32809:1:3:3: +%*2hd: +32809:0:3: +%7hd: :0:-1: +%*7hd: :0:-1: +%7hd: -32891:1:7:32645: +%*7hd: -32891:0:7: +%7hd: -32769:1:7:32767: +%*7hd: -32769:0:7: +%7hd: -32768:1:7:-32768: +%*7hd: -32768:0:7: +%7hd: -123:1:5:-123: +%*7hd: -123:0:5: +%7hd: -1:1:3:-1: +%*7hd: -1:0:3: +%7hd: -0:1:3:0: +%*7hd: -0:0:3: +%7hd: 0:1:2:0: +%*7hd: 0:0:2: +%7hd: 1:1:2:1: +%*7hd: 1:0:2: +%7hd: 42:1:3:42: +%*7hd: 42:0:3: +%7hd: 32767:1:6:32767: +%*7hd: 32767:0:6: +%7hd: 32768:1:6:-32768: +%*7hd: 32768:0:6: +%7hd: 32809:1:6:-32727: +%*7hd: 32809:0:6: +%7hd: +0:1:3:0: +%*7hd: +0:0:3: +%7hd: +1:1:3:1: +%*7hd: +1:0:3: +%7hd: +42:1:4:42: +%*7hd: +42:0:4: +%7hd: +32767:1:7:32767: +%*7hd: +32767:0:7: +%7hd: +32768:1:7:-32768: +%*7hd: +32768:0:7: +%7hd: +32809:1:7:-32727: +%*7hd: +32809:0:7: diff --git a/stdio-common/tst-scanf-format-short-i.input b/stdio-common/tst-scanf-format-short-i.input new file mode 100644 index 0000000..d88122e --- /dev/null +++ b/stdio-common/tst-scanf-format-short-i.input @@ -0,0 +1,1526 @@ +%hi::0:-1: +%*hi::0:-1: +%hi:-32891:1:6:32645: +%*hi:-32891:0:6: +%hi:-0X807b:1:7:32645: +%*hi:-0X807b:0:7: +%hi:-0x807B:1:7:32645: +%*hi:-0x807B:0:7: +%hi:-0100173:1:8:32645: +%*hi:-0100173:0:8: +%hi:-0B1000000001111011:1:19:32645: +%*hi:-0B1000000001111011:0:19: +%hi:-0b1000000001111011:1:19:32645: +%*hi:-0b1000000001111011:0:19: +%hi:-32769:1:6:32767: +%*hi:-32769:0:6: +%hi:-0X8001:1:7:32767: +%*hi:-0X8001:0:7: +%hi:-0x8001:1:7:32767: +%*hi:-0x8001:0:7: +%hi:-0100001:1:8:32767: +%*hi:-0100001:0:8: +%hi:-0B1000000000000001:1:19:32767: +%*hi:-0B1000000000000001:0:19: +%hi:-0b1000000000000001:1:19:32767: +%*hi:-0b1000000000000001:0:19: +%hi:-32768:1:6:-32768: +%*hi:-32768:0:6: +%hi:-0X8000:1:7:-32768: +%*hi:-0X8000:0:7: +%hi:-0x8000:1:7:-32768: +%*hi:-0x8000:0:7: +%hi:-0100000:1:8:-32768: +%*hi:-0100000:0:8: +%hi:-0B1000000000000000:1:19:-32768: +%*hi:-0B1000000000000000:0:19: +%hi:-0b1000000000000000:1:19:-32768: +%*hi:-0b1000000000000000:0:19: +%hi:-123:1:4:-123: +%*hi:-123:0:4: +%hi:-0X7b:1:5:-123: +%*hi:-0X7b:0:5: +%hi:-0x7B:1:5:-123: +%*hi:-0x7B:0:5: +%hi:-0173:1:5:-123: +%*hi:-0173:0:5: +%hi:-0B1111011:1:10:-123: +%*hi:-0B1111011:0:10: +%hi:-0b1111011:1:10:-123: +%*hi:-0b1111011:0:10: +%hi:-1:1:2:-1: +%*hi:-1:0:2: +%hi:-0X1:1:4:-1: +%*hi:-0X1:0:4: +%hi:-0x1:1:4:-1: +%*hi:-0x1:0:4: +%hi:-01:1:3:-1: +%*hi:-01:0:3: +%hi:-0B1:1:4:-1: +%*hi:-0B1:0:4: +%hi:-0b1:1:4:-1: +%*hi:-0b1:0:4: +%hi:-0:1:2:0: +%*hi:-0:0:2: +%hi:-0X0:1:4:0: +%*hi:-0X0:0:4: +%hi:-0x0:1:4:0: +%*hi:-0x0:0:4: +%hi:-00:1:3:0: +%*hi:-00:0:3: +%hi:-0B0:1:4:0: +%*hi:-0B0:0:4: +%hi:-0b0:1:4:0: +%*hi:-0b0:0:4: +%hi:0:1:1:0: +%*hi:0:0:1: +%hi:0X0:1:3:0: +%*hi:0X0:0:3: +%hi:0x0:1:3:0: +%*hi:0x0:0:3: +%hi:00:1:2:0: +%*hi:00:0:2: +%hi:0B0:1:3:0: +%*hi:0B0:0:3: +%hi:0b0:1:3:0: +%*hi:0b0:0:3: +%hi:1:1:1:1: +%*hi:1:0:1: +%hi:0X1:1:3:1: +%*hi:0X1:0:3: +%hi:0x1:1:3:1: +%*hi:0x1:0:3: +%hi:01:1:2:1: +%*hi:01:0:2: +%hi:0B1:1:3:1: +%*hi:0B1:0:3: +%hi:0b1:1:3:1: +%*hi:0b1:0:3: +%hi:42:1:2:42: +%*hi:42:0:2: +%hi:0X2a:1:4:42: +%*hi:0X2a:0:4: +%hi:0x2A:1:4:42: +%*hi:0x2A:0:4: +%hi:052:1:3:42: +%*hi:052:0:3: +%hi:0B101010:1:8:42: +%*hi:0B101010:0:8: +%hi:0b101010:1:8:42: +%*hi:0b101010:0:8: +%hi:32767:1:5:32767: +%*hi:32767:0:5: +%hi:0X7fff:1:6:32767: +%*hi:0X7fff:0:6: +%hi:0x7FFF:1:6:32767: +%*hi:0x7FFF:0:6: +%hi:077777:1:6:32767: +%*hi:077777:0:6: +%hi:0B111111111111111:1:17:32767: +%*hi:0B111111111111111:0:17: +%hi:0b111111111111111:1:17:32767: +%*hi:0b111111111111111:0:17: +%hi:32768:1:5:-32768: +%*hi:32768:0:5: +%hi:0X8000:1:6:-32768: +%*hi:0X8000:0:6: +%hi:0x8000:1:6:-32768: +%*hi:0x8000:0:6: +%hi:0100000:1:7:-32768: +%*hi:0100000:0:7: +%hi:0B1000000000000000:1:18:-32768: +%*hi:0B1000000000000000:0:18: +%hi:0b1000000000000000:1:18:-32768: +%*hi:0b1000000000000000:0:18: +%hi:32809:1:5:-32727: +%*hi:32809:0:5: +%hi:0X8029:1:6:-32727: +%*hi:0X8029:0:6: +%hi:0x8029:1:6:-32727: +%*hi:0x8029:0:6: +%hi:0100051:1:7:-32727: +%*hi:0100051:0:7: +%hi:0B1000000000101001:1:18:-32727: +%*hi:0B1000000000101001:0:18: +%hi:0b1000000000101001:1:18:-32727: +%*hi:0b1000000000101001:0:18: +%hi:+0:1:2:0: +%*hi:+0:0:2: +%hi:+0X0:1:4:0: +%*hi:+0X0:0:4: +%hi:+0x0:1:4:0: +%*hi:+0x0:0:4: +%hi:+00:1:3:0: +%*hi:+00:0:3: +%hi:+0B0:1:4:0: +%*hi:+0B0:0:4: +%hi:+0b0:1:4:0: +%*hi:+0b0:0:4: +%hi:+1:1:2:1: +%*hi:+1:0:2: +%hi:+0X1:1:4:1: +%*hi:+0X1:0:4: +%hi:+0x1:1:4:1: +%*hi:+0x1:0:4: +%hi:+01:1:3:1: +%*hi:+01:0:3: +%hi:+0B1:1:4:1: +%*hi:+0B1:0:4: +%hi:+0b1:1:4:1: +%*hi:+0b1:0:4: +%hi:+42:1:3:42: +%*hi:+42:0:3: +%hi:+0X2a:1:5:42: +%*hi:+0X2a:0:5: +%hi:+0x2A:1:5:42: +%*hi:+0x2A:0:5: +%hi:+052:1:4:42: +%*hi:+052:0:4: +%hi:+0B101010:1:9:42: +%*hi:+0B101010:0:9: +%hi:+0b101010:1:9:42: +%*hi:+0b101010:0:9: +%hi:+32767:1:6:32767: +%*hi:+32767:0:6: +%hi:+0X7fff:1:7:32767: +%*hi:+0X7fff:0:7: +%hi:+0x7FFF:1:7:32767: +%*hi:+0x7FFF:0:7: +%hi:+077777:1:7:32767: +%*hi:+077777:0:7: +%hi:+0B111111111111111:1:18:32767: +%*hi:+0B111111111111111:0:18: +%hi:+0b111111111111111:1:18:32767: +%*hi:+0b111111111111111:0:18: +%hi:+32768:1:6:-32768: +%*hi:+32768:0:6: +%hi:+0X8000:1:7:-32768: +%*hi:+0X8000:0:7: +%hi:+0x8000:1:7:-32768: +%*hi:+0x8000:0:7: +%hi:+0100000:1:8:-32768: +%*hi:+0100000:0:8: +%hi:+0B1000000000000000:1:19:-32768: +%*hi:+0B1000000000000000:0:19: +%hi:+0b1000000000000000:1:19:-32768: +%*hi:+0b1000000000000000:0:19: +%hi:+32809:1:6:-32727: +%*hi:+32809:0:6: +%hi:+0X8029:1:7:-32727: +%*hi:+0X8029:0:7: +%hi:+0x8029:1:7:-32727: +%*hi:+0x8029:0:7: +%hi:+0100051:1:8:-32727: +%*hi:+0100051:0:8: +%hi:+0B1000000000101001:1:19:-32727: +%*hi:+0B1000000000101001:0:19: +%hi:+0b1000000000101001:1:19:-32727: +%*hi:+0b1000000000101001:0:19: +%1hi::0:-1: +%*1hi::0:-1: +%1hi:-32891:0:-1: +%*1hi:-32891:0:-1: +%1hi:-0X807b:0:-1: +%*1hi:-0X807b:0:-1: +%1hi:-0x807B:0:-1: +%*1hi:-0x807B:0:-1: +%1hi:-0100173:0:-1: +%*1hi:-0100173:0:-1: +%1hi:-0B1000000001111011:0:-1: +%*1hi:-0B1000000001111011:0:-1: +%1hi:-0b1000000001111011:0:-1: +%*1hi:-0b1000000001111011:0:-1: +%1hi:-32769:0:-1: +%*1hi:-32769:0:-1: +%1hi:-0X8001:0:-1: +%*1hi:-0X8001:0:-1: +%1hi:-0x8001:0:-1: +%*1hi:-0x8001:0:-1: +%1hi:-0100001:0:-1: +%*1hi:-0100001:0:-1: +%1hi:-0B1000000000000001:0:-1: +%*1hi:-0B1000000000000001:0:-1: +%1hi:-0b1000000000000001:0:-1: +%*1hi:-0b1000000000000001:0:-1: +%1hi:-32768:0:-1: +%*1hi:-32768:0:-1: +%1hi:-0X8000:0:-1: +%*1hi:-0X8000:0:-1: +%1hi:-0x8000:0:-1: +%*1hi:-0x8000:0:-1: +%1hi:-0100000:0:-1: +%*1hi:-0100000:0:-1: +%1hi:-0B1000000000000000:0:-1: +%*1hi:-0B1000000000000000:0:-1: +%1hi:-0b1000000000000000:0:-1: +%*1hi:-0b1000000000000000:0:-1: +%1hi:-123:0:-1: +%*1hi:-123:0:-1: +%1hi:-0X7b:0:-1: +%*1hi:-0X7b:0:-1: +%1hi:-0x7B:0:-1: +%*1hi:-0x7B:0:-1: +%1hi:-0173:0:-1: +%*1hi:-0173:0:-1: +%1hi:-0B1111011:0:-1: +%*1hi:-0B1111011:0:-1: +%1hi:-0b1111011:0:-1: +%*1hi:-0b1111011:0:-1: +%1hi:-1:0:-1: +%*1hi:-1:0:-1: +%1hi:-0X1:0:-1: +%*1hi:-0X1:0:-1: +%1hi:-0x1:0:-1: +%*1hi:-0x1:0:-1: +%1hi:-01:0:-1: +%*1hi:-01:0:-1: +%1hi:-0B1:0:-1: +%*1hi:-0B1:0:-1: +%1hi:-0b1:0:-1: +%*1hi:-0b1:0:-1: +%1hi:-0:0:-1: +%*1hi:-0:0:-1: +%1hi:-0X0:0:-1: +%*1hi:-0X0:0:-1: +%1hi:-0x0:0:-1: +%*1hi:-0x0:0:-1: +%1hi:-00:0:-1: +%*1hi:-00:0:-1: +%1hi:-0B0:0:-1: +%*1hi:-0B0:0:-1: +%1hi:-0b0:0:-1: +%*1hi:-0b0:0:-1: +%1hi:0:1:1:0: +%*1hi:0:0:1: +%1hi:0X0:1:1:0: +%*1hi:0X0:0:1: +%1hi:0x0:1:1:0: +%*1hi:0x0:0:1: +%1hi:00:1:1:0: +%*1hi:00:0:1: +%1hi:0B0:1:1:0: +%*1hi:0B0:0:1: +%1hi:0b0:1:1:0: +%*1hi:0b0:0:1: +%1hi:1:1:1:1: +%*1hi:1:0:1: +%1hi:0X1:1:1:0: +%*1hi:0X1:0:1: +%1hi:0x1:1:1:0: +%*1hi:0x1:0:1: +%1hi:01:1:1:0: +%*1hi:01:0:1: +%1hi:0B1:1:1:0: +%*1hi:0B1:0:1: +%1hi:0b1:1:1:0: +%*1hi:0b1:0:1: +%1hi:42:1:1:4: +%*1hi:42:0:1: +%1hi:0X2a:1:1:0: +%*1hi:0X2a:0:1: +%1hi:0x2A:1:1:0: +%*1hi:0x2A:0:1: +%1hi:052:1:1:0: +%*1hi:052:0:1: +%1hi:0B101010:1:1:0: +%*1hi:0B101010:0:1: +%1hi:0b101010:1:1:0: +%*1hi:0b101010:0:1: +%1hi:32767:1:1:3: +%*1hi:32767:0:1: +%1hi:0X7fff:1:1:0: +%*1hi:0X7fff:0:1: +%1hi:0x7FFF:1:1:0: +%*1hi:0x7FFF:0:1: +%1hi:077777:1:1:0: +%*1hi:077777:0:1: +%1hi:0B111111111111111:1:1:0: +%*1hi:0B111111111111111:0:1: +%1hi:0b111111111111111:1:1:0: +%*1hi:0b111111111111111:0:1: +%1hi:32768:1:1:3: +%*1hi:32768:0:1: +%1hi:0X8000:1:1:0: +%*1hi:0X8000:0:1: +%1hi:0x8000:1:1:0: +%*1hi:0x8000:0:1: +%1hi:0100000:1:1:0: +%*1hi:0100000:0:1: +%1hi:0B1000000000000000:1:1:0: +%*1hi:0B1000000000000000:0:1: +%1hi:0b1000000000000000:1:1:0: +%*1hi:0b1000000000000000:0:1: +%1hi:32809:1:1:3: +%*1hi:32809:0:1: +%1hi:0X8029:1:1:0: +%*1hi:0X8029:0:1: +%1hi:0x8029:1:1:0: +%*1hi:0x8029:0:1: +%1hi:0100051:1:1:0: +%*1hi:0100051:0:1: +%1hi:0B1000000000101001:1:1:0: +%*1hi:0B1000000000101001:0:1: +%1hi:0b1000000000101001:1:1:0: +%*1hi:0b1000000000101001:0:1: +%1hi:+0:0:-1: +%*1hi:+0:0:-1: +%1hi:+0X0:0:-1: +%*1hi:+0X0:0:-1: +%1hi:+0x0:0:-1: +%*1hi:+0x0:0:-1: +%1hi:+00:0:-1: +%*1hi:+00:0:-1: +%1hi:+0B0:0:-1: +%*1hi:+0B0:0:-1: +%1hi:+0b0:0:-1: +%*1hi:+0b0:0:-1: +%1hi:+1:0:-1: +%*1hi:+1:0:-1: +%1hi:+0X1:0:-1: +%*1hi:+0X1:0:-1: +%1hi:+0x1:0:-1: +%*1hi:+0x1:0:-1: +%1hi:+01:0:-1: +%*1hi:+01:0:-1: +%1hi:+0B1:0:-1: +%*1hi:+0B1:0:-1: +%1hi:+0b1:0:-1: +%*1hi:+0b1:0:-1: +%1hi:+42:0:-1: +%*1hi:+42:0:-1: +%1hi:+0X2a:0:-1: +%*1hi:+0X2a:0:-1: +%1hi:+0x2A:0:-1: +%*1hi:+0x2A:0:-1: +%1hi:+052:0:-1: +%*1hi:+052:0:-1: +%1hi:+0B101010:0:-1: +%*1hi:+0B101010:0:-1: +%1hi:+0b101010:0:-1: +%*1hi:+0b101010:0:-1: +%1hi:+32767:0:-1: +%*1hi:+32767:0:-1: +%1hi:+0X7fff:0:-1: +%*1hi:+0X7fff:0:-1: +%1hi:+0x7FFF:0:-1: +%*1hi:+0x7FFF:0:-1: +%1hi:+077777:0:-1: +%*1hi:+077777:0:-1: +%1hi:+0B111111111111111:0:-1: +%*1hi:+0B111111111111111:0:-1: +%1hi:+0b111111111111111:0:-1: +%*1hi:+0b111111111111111:0:-1: +%1hi:+32768:0:-1: +%*1hi:+32768:0:-1: +%1hi:+0X8000:0:-1: +%*1hi:+0X8000:0:-1: +%1hi:+0x8000:0:-1: +%*1hi:+0x8000:0:-1: +%1hi:+0100000:0:-1: +%*1hi:+0100000:0:-1: +%1hi:+0B1000000000000000:0:-1: +%*1hi:+0B1000000000000000:0:-1: +%1hi:+0b1000000000000000:0:-1: +%*1hi:+0b1000000000000000:0:-1: +%1hi:+32809:0:-1: +%*1hi:+32809:0:-1: +%1hi:+0X8029:0:-1: +%*1hi:+0X8029:0:-1: +%1hi:+0x8029:0:-1: +%*1hi:+0x8029:0:-1: +%1hi:+0100051:0:-1: +%*1hi:+0100051:0:-1: +%1hi:+0B1000000000101001:0:-1: +%*1hi:+0B1000000000101001:0:-1: +%1hi:+0b1000000000101001:0:-1: +%*1hi:+0b1000000000101001:0:-1: +%2hi::0:-1: +%*2hi::0:-1: +%2hi:-32891:1:2:-3: +%*2hi:-32891:0:2: +%2hi:-0X807b:1:2:0: +%*2hi:-0X807b:0:2: +%2hi:-0x807B:1:2:0: +%*2hi:-0x807B:0:2: +%2hi:-0100173:1:2:0: +%*2hi:-0100173:0:2: +%2hi:-0B1000000001111011:1:2:0: +%*2hi:-0B1000000001111011:0:2: +%2hi:-0b1000000001111011:1:2:0: +%*2hi:-0b1000000001111011:0:2: +%2hi:-32769:1:2:-3: +%*2hi:-32769:0:2: +%2hi:-0X8001:1:2:0: +%*2hi:-0X8001:0:2: +%2hi:-0x8001:1:2:0: +%*2hi:-0x8001:0:2: +%2hi:-0100001:1:2:0: +%*2hi:-0100001:0:2: +%2hi:-0B1000000000000001:1:2:0: +%*2hi:-0B1000000000000001:0:2: +%2hi:-0b1000000000000001:1:2:0: +%*2hi:-0b1000000000000001:0:2: +%2hi:-32768:1:2:-3: +%*2hi:-32768:0:2: +%2hi:-0X8000:1:2:0: +%*2hi:-0X8000:0:2: +%2hi:-0x8000:1:2:0: +%*2hi:-0x8000:0:2: +%2hi:-0100000:1:2:0: +%*2hi:-0100000:0:2: +%2hi:-0B1000000000000000:1:2:0: +%*2hi:-0B1000000000000000:0:2: +%2hi:-0b1000000000000000:1:2:0: +%*2hi:-0b1000000000000000:0:2: +%2hi:-123:1:2:-1: +%*2hi:-123:0:2: +%2hi:-0X7b:1:2:0: +%*2hi:-0X7b:0:2: +%2hi:-0x7B:1:2:0: +%*2hi:-0x7B:0:2: +%2hi:-0173:1:2:0: +%*2hi:-0173:0:2: +%2hi:-0B1111011:1:2:0: +%*2hi:-0B1111011:0:2: +%2hi:-0b1111011:1:2:0: +%*2hi:-0b1111011:0:2: +%2hi:-1:1:2:-1: +%*2hi:-1:0:2: +%2hi:-0X1:1:2:0: +%*2hi:-0X1:0:2: +%2hi:-0x1:1:2:0: +%*2hi:-0x1:0:2: +%2hi:-01:1:2:0: +%*2hi:-01:0:2: +%2hi:-0B1:1:2:0: +%*2hi:-0B1:0:2: +%2hi:-0b1:1:2:0: +%*2hi:-0b1:0:2: +%2hi:-0:1:2:0: +%*2hi:-0:0:2: +%2hi:-0X0:1:2:0: +%*2hi:-0X0:0:2: +%2hi:-0x0:1:2:0: +%*2hi:-0x0:0:2: +%2hi:-00:1:2:0: +%*2hi:-00:0:2: +%2hi:-0B0:1:2:0: +%*2hi:-0B0:0:2: +%2hi:-0b0:1:2:0: +%*2hi:-0b0:0:2: +%2hi:0:1:1:0: +%*2hi:0:0:1: +%2hi:0X0:0:-1: +%*2hi:0X0:0:-1: +%2hi:0x0:0:-1: +%*2hi:0x0:0:-1: +%2hi:00:1:2:0: +%*2hi:00:0:2: +%2hi:0B0:0:-1: +%*2hi:0B0:0:-1: +%2hi:0b0:0:-1: +%*2hi:0b0:0:-1: +%2hi:1:1:1:1: +%*2hi:1:0:1: +%2hi:0X1:0:-1: +%*2hi:0X1:0:-1: +%2hi:0x1:0:-1: +%*2hi:0x1:0:-1: +%2hi:01:1:2:1: +%*2hi:01:0:2: +%2hi:0B1:0:-1: +%*2hi:0B1:0:-1: +%2hi:0b1:0:-1: +%*2hi:0b1:0:-1: +%2hi:42:1:2:42: +%*2hi:42:0:2: +%2hi:0X2a:0:-1: +%*2hi:0X2a:0:-1: +%2hi:0x2A:0:-1: +%*2hi:0x2A:0:-1: +%2hi:052:1:2:5: +%*2hi:052:0:2: +%2hi:0B101010:0:-1: +%*2hi:0B101010:0:-1: +%2hi:0b101010:0:-1: +%*2hi:0b101010:0:-1: +%2hi:32767:1:2:32: +%*2hi:32767:0:2: +%2hi:0X7fff:0:-1: +%*2hi:0X7fff:0:-1: +%2hi:0x7FFF:0:-1: +%*2hi:0x7FFF:0:-1: +%2hi:077777:1:2:7: +%*2hi:077777:0:2: +%2hi:0B111111111111111:0:-1: +%*2hi:0B111111111111111:0:-1: +%2hi:0b111111111111111:0:-1: +%*2hi:0b111111111111111:0:-1: +%2hi:32768:1:2:32: +%*2hi:32768:0:2: +%2hi:0X8000:0:-1: +%*2hi:0X8000:0:-1: +%2hi:0x8000:0:-1: +%*2hi:0x8000:0:-1: +%2hi:0100000:1:2:1: +%*2hi:0100000:0:2: +%2hi:0B1000000000000000:0:-1: +%*2hi:0B1000000000000000:0:-1: +%2hi:0b1000000000000000:0:-1: +%*2hi:0b1000000000000000:0:-1: +%2hi:32809:1:2:32: +%*2hi:32809:0:2: +%2hi:0X8029:0:-1: +%*2hi:0X8029:0:-1: +%2hi:0x8029:0:-1: +%*2hi:0x8029:0:-1: +%2hi:0100051:1:2:1: +%*2hi:0100051:0:2: +%2hi:0B1000000000101001:0:-1: +%*2hi:0B1000000000101001:0:-1: +%2hi:0b1000000000101001:0:-1: +%*2hi:0b1000000000101001:0:-1: +%2hi:+0:1:2:0: +%*2hi:+0:0:2: +%2hi:+0X0:1:2:0: +%*2hi:+0X0:0:2: +%2hi:+0x0:1:2:0: +%*2hi:+0x0:0:2: +%2hi:+00:1:2:0: +%*2hi:+00:0:2: +%2hi:+0B0:1:2:0: +%*2hi:+0B0:0:2: +%2hi:+0b0:1:2:0: +%*2hi:+0b0:0:2: +%2hi:+1:1:2:1: +%*2hi:+1:0:2: +%2hi:+0X1:1:2:0: +%*2hi:+0X1:0:2: +%2hi:+0x1:1:2:0: +%*2hi:+0x1:0:2: +%2hi:+01:1:2:0: +%*2hi:+01:0:2: +%2hi:+0B1:1:2:0: +%*2hi:+0B1:0:2: +%2hi:+0b1:1:2:0: +%*2hi:+0b1:0:2: +%2hi:+42:1:2:4: +%*2hi:+42:0:2: +%2hi:+0X2a:1:2:0: +%*2hi:+0X2a:0:2: +%2hi:+0x2A:1:2:0: +%*2hi:+0x2A:0:2: +%2hi:+052:1:2:0: +%*2hi:+052:0:2: +%2hi:+0B101010:1:2:0: +%*2hi:+0B101010:0:2: +%2hi:+0b101010:1:2:0: +%*2hi:+0b101010:0:2: +%2hi:+32767:1:2:3: +%*2hi:+32767:0:2: +%2hi:+0X7fff:1:2:0: +%*2hi:+0X7fff:0:2: +%2hi:+0x7FFF:1:2:0: +%*2hi:+0x7FFF:0:2: +%2hi:+077777:1:2:0: +%*2hi:+077777:0:2: +%2hi:+0B111111111111111:1:2:0: +%*2hi:+0B111111111111111:0:2: +%2hi:+0b111111111111111:1:2:0: +%*2hi:+0b111111111111111:0:2: +%2hi:+32768:1:2:3: +%*2hi:+32768:0:2: +%2hi:+0X8000:1:2:0: +%*2hi:+0X8000:0:2: +%2hi:+0x8000:1:2:0: +%*2hi:+0x8000:0:2: +%2hi:+0100000:1:2:0: +%*2hi:+0100000:0:2: +%2hi:+0B1000000000000000:1:2:0: +%*2hi:+0B1000000000000000:0:2: +%2hi:+0b1000000000000000:1:2:0: +%*2hi:+0b1000000000000000:0:2: +%2hi:+32809:1:2:3: +%*2hi:+32809:0:2: +%2hi:+0X8029:1:2:0: +%*2hi:+0X8029:0:2: +%2hi:+0x8029:1:2:0: +%*2hi:+0x8029:0:2: +%2hi:+0100051:1:2:0: +%*2hi:+0100051:0:2: +%2hi:+0B1000000000101001:1:2:0: +%*2hi:+0B1000000000101001:0:2: +%2hi:+0b1000000000101001:1:2:0: +%*2hi:+0b1000000000101001:0:2: +%4hi::0:-1: +%*4hi::0:-1: +%4hi:-32891:1:4:-328: +%*4hi:-32891:0:4: +%4hi:-0X807b:1:4:-8: +%*4hi:-0X807b:0:4: +%4hi:-0x807B:1:4:-8: +%*4hi:-0x807B:0:4: +%4hi:-0100173:1:4:-8: +%*4hi:-0100173:0:4: +%4hi:-0B1000000001111011:1:4:-1: +%*4hi:-0B1000000001111011:0:4: +%4hi:-0b1000000001111011:1:4:-1: +%*4hi:-0b1000000001111011:0:4: +%4hi:-32769:1:4:-327: +%*4hi:-32769:0:4: +%4hi:-0X8001:1:4:-8: +%*4hi:-0X8001:0:4: +%4hi:-0x8001:1:4:-8: +%*4hi:-0x8001:0:4: +%4hi:-0100001:1:4:-8: +%*4hi:-0100001:0:4: +%4hi:-0B1000000000000001:1:4:-1: +%*4hi:-0B1000000000000001:0:4: +%4hi:-0b1000000000000001:1:4:-1: +%*4hi:-0b1000000000000001:0:4: +%4hi:-32768:1:4:-327: +%*4hi:-32768:0:4: +%4hi:-0X8000:1:4:-8: +%*4hi:-0X8000:0:4: +%4hi:-0x8000:1:4:-8: +%*4hi:-0x8000:0:4: +%4hi:-0100000:1:4:-8: +%*4hi:-0100000:0:4: +%4hi:-0B1000000000000000:1:4:-1: +%*4hi:-0B1000000000000000:0:4: +%4hi:-0b1000000000000000:1:4:-1: +%*4hi:-0b1000000000000000:0:4: +%4hi:-123:1:4:-123: +%*4hi:-123:0:4: +%4hi:-0X7b:1:4:-7: +%*4hi:-0X7b:0:4: +%4hi:-0x7B:1:4:-7: +%*4hi:-0x7B:0:4: +%4hi:-0173:1:4:-15: +%*4hi:-0173:0:4: +%4hi:-0B1111011:1:4:-1: +%*4hi:-0B1111011:0:4: +%4hi:-0b1111011:1:4:-1: +%*4hi:-0b1111011:0:4: +%4hi:-1:1:2:-1: +%*4hi:-1:0:2: +%4hi:-0X1:1:4:-1: +%*4hi:-0X1:0:4: +%4hi:-0x1:1:4:-1: +%*4hi:-0x1:0:4: +%4hi:-01:1:3:-1: +%*4hi:-01:0:3: +%4hi:-0B1:1:4:-1: +%*4hi:-0B1:0:4: +%4hi:-0b1:1:4:-1: +%*4hi:-0b1:0:4: +%4hi:-0:1:2:0: +%*4hi:-0:0:2: +%4hi:-0X0:1:4:0: +%*4hi:-0X0:0:4: +%4hi:-0x0:1:4:0: +%*4hi:-0x0:0:4: +%4hi:-00:1:3:0: +%*4hi:-00:0:3: +%4hi:-0B0:1:4:0: +%*4hi:-0B0:0:4: +%4hi:-0b0:1:4:0: +%*4hi:-0b0:0:4: +%4hi:0:1:1:0: +%*4hi:0:0:1: +%4hi:0X0:1:3:0: +%*4hi:0X0:0:3: +%4hi:0x0:1:3:0: +%*4hi:0x0:0:3: +%4hi:00:1:2:0: +%*4hi:00:0:2: +%4hi:0B0:1:3:0: +%*4hi:0B0:0:3: +%4hi:0b0:1:3:0: +%*4hi:0b0:0:3: +%4hi:1:1:1:1: +%*4hi:1:0:1: +%4hi:0X1:1:3:1: +%*4hi:0X1:0:3: +%4hi:0x1:1:3:1: +%*4hi:0x1:0:3: +%4hi:01:1:2:1: +%*4hi:01:0:2: +%4hi:0B1:1:3:1: +%*4hi:0B1:0:3: +%4hi:0b1:1:3:1: +%*4hi:0b1:0:3: +%4hi:42:1:2:42: +%*4hi:42:0:2: +%4hi:0X2a:1:4:42: +%*4hi:0X2a:0:4: +%4hi:0x2A:1:4:42: +%*4hi:0x2A:0:4: +%4hi:052:1:3:42: +%*4hi:052:0:3: +%4hi:0B101010:1:4:2: +%*4hi:0B101010:0:4: +%4hi:0b101010:1:4:2: +%*4hi:0b101010:0:4: +%4hi:32767:1:4:3276: +%*4hi:32767:0:4: +%4hi:0X7fff:1:4:127: +%*4hi:0X7fff:0:4: +%4hi:0x7FFF:1:4:127: +%*4hi:0x7FFF:0:4: +%4hi:077777:1:4:511: +%*4hi:077777:0:4: +%4hi:0B111111111111111:1:4:3: +%*4hi:0B111111111111111:0:4: +%4hi:0b111111111111111:1:4:3: +%*4hi:0b111111111111111:0:4: +%4hi:32768:1:4:3276: +%*4hi:32768:0:4: +%4hi:0X8000:1:4:128: +%*4hi:0X8000:0:4: +%4hi:0x8000:1:4:128: +%*4hi:0x8000:0:4: +%4hi:0100000:1:4:64: +%*4hi:0100000:0:4: +%4hi:0B1000000000000000:1:4:2: +%*4hi:0B1000000000000000:0:4: +%4hi:0b1000000000000000:1:4:2: +%*4hi:0b1000000000000000:0:4: +%4hi:32809:1:4:3280: +%*4hi:32809:0:4: +%4hi:0X8029:1:4:128: +%*4hi:0X8029:0:4: +%4hi:0x8029:1:4:128: +%*4hi:0x8029:0:4: +%4hi:0100051:1:4:64: +%*4hi:0100051:0:4: +%4hi:0B1000000000101001:1:4:2: +%*4hi:0B1000000000101001:0:4: +%4hi:0b1000000000101001:1:4:2: +%*4hi:0b1000000000101001:0:4: +%4hi:+0:1:2:0: +%*4hi:+0:0:2: +%4hi:+0X0:1:4:0: +%*4hi:+0X0:0:4: +%4hi:+0x0:1:4:0: +%*4hi:+0x0:0:4: +%4hi:+00:1:3:0: +%*4hi:+00:0:3: +%4hi:+0B0:1:4:0: +%*4hi:+0B0:0:4: +%4hi:+0b0:1:4:0: +%*4hi:+0b0:0:4: +%4hi:+1:1:2:1: +%*4hi:+1:0:2: +%4hi:+0X1:1:4:1: +%*4hi:+0X1:0:4: +%4hi:+0x1:1:4:1: +%*4hi:+0x1:0:4: +%4hi:+01:1:3:1: +%*4hi:+01:0:3: +%4hi:+0B1:1:4:1: +%*4hi:+0B1:0:4: +%4hi:+0b1:1:4:1: +%*4hi:+0b1:0:4: +%4hi:+42:1:3:42: +%*4hi:+42:0:3: +%4hi:+0X2a:1:4:2: +%*4hi:+0X2a:0:4: +%4hi:+0x2A:1:4:2: +%*4hi:+0x2A:0:4: +%4hi:+052:1:4:42: +%*4hi:+052:0:4: +%4hi:+0B101010:1:4:1: +%*4hi:+0B101010:0:4: +%4hi:+0b101010:1:4:1: +%*4hi:+0b101010:0:4: +%4hi:+32767:1:4:327: +%*4hi:+32767:0:4: +%4hi:+0X7fff:1:4:7: +%*4hi:+0X7fff:0:4: +%4hi:+0x7FFF:1:4:7: +%*4hi:+0x7FFF:0:4: +%4hi:+077777:1:4:63: +%*4hi:+077777:0:4: +%4hi:+0B111111111111111:1:4:1: +%*4hi:+0B111111111111111:0:4: +%4hi:+0b111111111111111:1:4:1: +%*4hi:+0b111111111111111:0:4: +%4hi:+32768:1:4:327: +%*4hi:+32768:0:4: +%4hi:+0X8000:1:4:8: +%*4hi:+0X8000:0:4: +%4hi:+0x8000:1:4:8: +%*4hi:+0x8000:0:4: +%4hi:+0100000:1:4:8: +%*4hi:+0100000:0:4: +%4hi:+0B1000000000000000:1:4:1: +%*4hi:+0B1000000000000000:0:4: +%4hi:+0b1000000000000000:1:4:1: +%*4hi:+0b1000000000000000:0:4: +%4hi:+32809:1:4:328: +%*4hi:+32809:0:4: +%4hi:+0X8029:1:4:8: +%*4hi:+0X8029:0:4: +%4hi:+0x8029:1:4:8: +%*4hi:+0x8029:0:4: +%4hi:+0100051:1:4:8: +%*4hi:+0100051:0:4: +%4hi:+0B1000000000101001:1:4:1: +%*4hi:+0B1000000000101001:0:4: +%4hi:+0b1000000000101001:1:4:1: +%*4hi:+0b1000000000101001:0:4: +%7hi::0:-1: +%*7hi::0:-1: +%7hi:-32891:1:6:32645: +%*7hi:-32891:0:6: +%7hi:-0X807b:1:7:32645: +%*7hi:-0X807b:0:7: +%7hi:-0x807B:1:7:32645: +%*7hi:-0x807B:0:7: +%7hi:-0100173:1:7:-4111: +%*7hi:-0100173:0:7: +%7hi:-0B1000000001111011:1:7:-8: +%*7hi:-0B1000000001111011:0:7: +%7hi:-0b1000000001111011:1:7:-8: +%*7hi:-0b1000000001111011:0:7: +%7hi:-32769:1:6:32767: +%*7hi:-32769:0:6: +%7hi:-0X8001:1:7:32767: +%*7hi:-0X8001:0:7: +%7hi:-0x8001:1:7:32767: +%*7hi:-0x8001:0:7: +%7hi:-0100001:1:7:-4096: +%*7hi:-0100001:0:7: +%7hi:-0B1000000000000001:1:7:-8: +%*7hi:-0B1000000000000001:0:7: +%7hi:-0b1000000000000001:1:7:-8: +%*7hi:-0b1000000000000001:0:7: +%7hi:-32768:1:6:-32768: +%*7hi:-32768:0:6: +%7hi:-0X8000:1:7:-32768: +%*7hi:-0X8000:0:7: +%7hi:-0x8000:1:7:-32768: +%*7hi:-0x8000:0:7: +%7hi:-0100000:1:7:-4096: +%*7hi:-0100000:0:7: +%7hi:-0B1000000000000000:1:7:-8: +%*7hi:-0B1000000000000000:0:7: +%7hi:-0b1000000000000000:1:7:-8: +%*7hi:-0b1000000000000000:0:7: +%7hi:-123:1:4:-123: +%*7hi:-123:0:4: +%7hi:-0X7b:1:5:-123: +%*7hi:-0X7b:0:5: +%7hi:-0x7B:1:5:-123: +%*7hi:-0x7B:0:5: +%7hi:-0173:1:5:-123: +%*7hi:-0173:0:5: +%7hi:-0B1111011:1:7:-15: +%*7hi:-0B1111011:0:7: +%7hi:-0b1111011:1:7:-15: +%*7hi:-0b1111011:0:7: +%7hi:-1:1:2:-1: +%*7hi:-1:0:2: +%7hi:-0X1:1:4:-1: +%*7hi:-0X1:0:4: +%7hi:-0x1:1:4:-1: +%*7hi:-0x1:0:4: +%7hi:-01:1:3:-1: +%*7hi:-01:0:3: +%7hi:-0B1:1:4:-1: +%*7hi:-0B1:0:4: +%7hi:-0b1:1:4:-1: +%*7hi:-0b1:0:4: +%7hi:-0:1:2:0: +%*7hi:-0:0:2: +%7hi:-0X0:1:4:0: +%*7hi:-0X0:0:4: +%7hi:-0x0:1:4:0: +%*7hi:-0x0:0:4: +%7hi:-00:1:3:0: +%*7hi:-00:0:3: +%7hi:-0B0:1:4:0: +%*7hi:-0B0:0:4: +%7hi:-0b0:1:4:0: +%*7hi:-0b0:0:4: +%7hi:0:1:1:0: +%*7hi:0:0:1: +%7hi:0X0:1:3:0: +%*7hi:0X0:0:3: +%7hi:0x0:1:3:0: +%*7hi:0x0:0:3: +%7hi:00:1:2:0: +%*7hi:00:0:2: +%7hi:0B0:1:3:0: +%*7hi:0B0:0:3: +%7hi:0b0:1:3:0: +%*7hi:0b0:0:3: +%7hi:1:1:1:1: +%*7hi:1:0:1: +%7hi:0X1:1:3:1: +%*7hi:0X1:0:3: +%7hi:0x1:1:3:1: +%*7hi:0x1:0:3: +%7hi:01:1:2:1: +%*7hi:01:0:2: +%7hi:0B1:1:3:1: +%*7hi:0B1:0:3: +%7hi:0b1:1:3:1: +%*7hi:0b1:0:3: +%7hi:42:1:2:42: +%*7hi:42:0:2: +%7hi:0X2a:1:4:42: +%*7hi:0X2a:0:4: +%7hi:0x2A:1:4:42: +%*7hi:0x2A:0:4: +%7hi:052:1:3:42: +%*7hi:052:0:3: +%7hi:0B101010:1:7:21: +%*7hi:0B101010:0:7: +%7hi:0b101010:1:7:21: +%*7hi:0b101010:0:7: +%7hi:32767:1:5:32767: +%*7hi:32767:0:5: +%7hi:0X7fff:1:6:32767: +%*7hi:0X7fff:0:6: +%7hi:0x7FFF:1:6:32767: +%*7hi:0x7FFF:0:6: +%7hi:077777:1:6:32767: +%*7hi:077777:0:6: +%7hi:0B111111111111111:1:7:31: +%*7hi:0B111111111111111:0:7: +%7hi:0b111111111111111:1:7:31: +%*7hi:0b111111111111111:0:7: +%7hi:32768:1:5:-32768: +%*7hi:32768:0:5: +%7hi:0X8000:1:6:-32768: +%*7hi:0X8000:0:6: +%7hi:0x8000:1:6:-32768: +%*7hi:0x8000:0:6: +%7hi:0100000:1:7:-32768: +%*7hi:0100000:0:7: +%7hi:0B1000000000000000:1:7:16: +%*7hi:0B1000000000000000:0:7: +%7hi:0b1000000000000000:1:7:16: +%*7hi:0b1000000000000000:0:7: +%7hi:32809:1:5:-32727: +%*7hi:32809:0:5: +%7hi:0X8029:1:6:-32727: +%*7hi:0X8029:0:6: +%7hi:0x8029:1:6:-32727: +%*7hi:0x8029:0:6: +%7hi:0100051:1:7:-32727: +%*7hi:0100051:0:7: +%7hi:0B1000000000101001:1:7:16: +%*7hi:0B1000000000101001:0:7: +%7hi:0b1000000000101001:1:7:16: +%*7hi:0b1000000000101001:0:7: +%7hi:+0:1:2:0: +%*7hi:+0:0:2: +%7hi:+0X0:1:4:0: +%*7hi:+0X0:0:4: +%7hi:+0x0:1:4:0: +%*7hi:+0x0:0:4: +%7hi:+00:1:3:0: +%*7hi:+00:0:3: +%7hi:+0B0:1:4:0: +%*7hi:+0B0:0:4: +%7hi:+0b0:1:4:0: +%*7hi:+0b0:0:4: +%7hi:+1:1:2:1: +%*7hi:+1:0:2: +%7hi:+0X1:1:4:1: +%*7hi:+0X1:0:4: +%7hi:+0x1:1:4:1: +%*7hi:+0x1:0:4: +%7hi:+01:1:3:1: +%*7hi:+01:0:3: +%7hi:+0B1:1:4:1: +%*7hi:+0B1:0:4: +%7hi:+0b1:1:4:1: +%*7hi:+0b1:0:4: +%7hi:+42:1:3:42: +%*7hi:+42:0:3: +%7hi:+0X2a:1:5:42: +%*7hi:+0X2a:0:5: +%7hi:+0x2A:1:5:42: +%*7hi:+0x2A:0:5: +%7hi:+052:1:4:42: +%*7hi:+052:0:4: +%7hi:+0B101010:1:7:10: +%*7hi:+0B101010:0:7: +%7hi:+0b101010:1:7:10: +%*7hi:+0b101010:0:7: +%7hi:+32767:1:6:32767: +%*7hi:+32767:0:6: +%7hi:+0X7fff:1:7:32767: +%*7hi:+0X7fff:0:7: +%7hi:+0x7FFF:1:7:32767: +%*7hi:+0x7FFF:0:7: +%7hi:+077777:1:7:32767: +%*7hi:+077777:0:7: +%7hi:+0B111111111111111:1:7:15: +%*7hi:+0B111111111111111:0:7: +%7hi:+0b111111111111111:1:7:15: +%*7hi:+0b111111111111111:0:7: +%7hi:+32768:1:6:-32768: +%*7hi:+32768:0:6: +%7hi:+0X8000:1:7:-32768: +%*7hi:+0X8000:0:7: +%7hi:+0x8000:1:7:-32768: +%*7hi:+0x8000:0:7: +%7hi:+0100000:1:7:4096: +%*7hi:+0100000:0:7: +%7hi:+0B1000000000000000:1:7:8: +%*7hi:+0B1000000000000000:0:7: +%7hi:+0b1000000000000000:1:7:8: +%*7hi:+0b1000000000000000:0:7: +%7hi:+32809:1:6:-32727: +%*7hi:+32809:0:6: +%7hi:+0X8029:1:7:-32727: +%*7hi:+0X8029:0:7: +%7hi:+0x8029:1:7:-32727: +%*7hi:+0x8029:0:7: +%7hi:+0100051:1:7:4101: +%*7hi:+0100051:0:7: +%7hi:+0B1000000000101001:1:7:8: +%*7hi:+0B1000000000101001:0:7: +%7hi:+0b1000000000101001:1:7:8: +%*7hi:+0b1000000000101001:0:7: +%2hi: :0:-1: +%*2hi: :0:-1: +%2hi: -32891:1:3:-3: +%*2hi: -32891:0:3: +%2hi: -0X807b:1:3:0: +%*2hi: -0X807b:0:3: +%2hi: -0x807B:1:3:0: +%*2hi: -0x807B:0:3: +%2hi: -0100173:1:3:0: +%*2hi: -0100173:0:3: +%2hi: -0B1000000001111011:1:3:0: +%*2hi: -0B1000000001111011:0:3: +%2hi: -0b1000000001111011:1:3:0: +%*2hi: -0b1000000001111011:0:3: +%2hi: -32769:1:3:-3: +%*2hi: -32769:0:3: +%2hi: -0X8001:1:3:0: +%*2hi: -0X8001:0:3: +%2hi: -0x8001:1:3:0: +%*2hi: -0x8001:0:3: +%2hi: -0100001:1:3:0: +%*2hi: -0100001:0:3: +%2hi: -0B1000000000000001:1:3:0: +%*2hi: -0B1000000000000001:0:3: +%2hi: -0b1000000000000001:1:3:0: +%*2hi: -0b1000000000000001:0:3: +%2hi: -32768:1:3:-3: +%*2hi: -32768:0:3: +%2hi: -0X8000:1:3:0: +%*2hi: -0X8000:0:3: +%2hi: -0x8000:1:3:0: +%*2hi: -0x8000:0:3: +%2hi: -0100000:1:3:0: +%*2hi: -0100000:0:3: +%2hi: -0B1000000000000000:1:3:0: +%*2hi: -0B1000000000000000:0:3: +%2hi: -0b1000000000000000:1:3:0: +%*2hi: -0b1000000000000000:0:3: +%2hi: -123:1:3:-1: +%*2hi: -123:0:3: +%2hi: -0X7b:1:3:0: +%*2hi: -0X7b:0:3: +%2hi: -0x7B:1:3:0: +%*2hi: -0x7B:0:3: +%2hi: -0173:1:3:0: +%*2hi: -0173:0:3: +%2hi: -0B1111011:1:3:0: +%*2hi: -0B1111011:0:3: +%2hi: -0b1111011:1:3:0: +%*2hi: -0b1111011:0:3: +%2hi: -1:1:3:-1: +%*2hi: -1:0:3: +%2hi: -0X1:1:3:0: +%*2hi: -0X1:0:3: +%2hi: -0x1:1:3:0: +%*2hi: -0x1:0:3: +%2hi: -01:1:3:0: +%*2hi: -01:0:3: +%2hi: -0B1:1:3:0: +%*2hi: -0B1:0:3: +%2hi: -0b1:1:3:0: +%*2hi: -0b1:0:3: +%2hi: -0:1:3:0: +%*2hi: -0:0:3: +%2hi: -0X0:1:3:0: +%*2hi: -0X0:0:3: +%2hi: -0x0:1:3:0: +%*2hi: -0x0:0:3: +%2hi: -00:1:3:0: +%*2hi: -00:0:3: +%2hi: -0B0:1:3:0: +%*2hi: -0B0:0:3: +%2hi: -0b0:1:3:0: +%*2hi: -0b0:0:3: +%2hi: 0:1:2:0: +%*2hi: 0:0:2: +%2hi: 0X0:0:-1: +%*2hi: 0X0:0:-1: +%2hi: 0x0:0:-1: +%*2hi: 0x0:0:-1: +%2hi: 00:1:3:0: +%*2hi: 00:0:3: +%2hi: 0B0:0:-1: +%*2hi: 0B0:0:-1: +%2hi: 0b0:0:-1: +%*2hi: 0b0:0:-1: +%2hi: 1:1:2:1: +%*2hi: 1:0:2: +%2hi: 0X1:0:-1: +%*2hi: 0X1:0:-1: +%2hi: 0x1:0:-1: +%*2hi: 0x1:0:-1: +%2hi: 01:1:3:1: +%*2hi: 01:0:3: +%2hi: 0B1:0:-1: +%*2hi: 0B1:0:-1: +%2hi: 0b1:0:-1: +%*2hi: 0b1:0:-1: +%2hi: 42:1:3:42: +%*2hi: 42:0:3: +%2hi: 0X2a:0:-1: +%*2hi: 0X2a:0:-1: +%2hi: 0x2A:0:-1: +%*2hi: 0x2A:0:-1: +%2hi: 052:1:3:5: +%*2hi: 052:0:3: +%2hi: 0B101010:0:-1: +%*2hi: 0B101010:0:-1: +%2hi: 0b101010:0:-1: +%*2hi: 0b101010:0:-1: +%2hi: 32767:1:3:32: +%*2hi: 32767:0:3: +%2hi: 0X7fff:0:-1: +%*2hi: 0X7fff:0:-1: +%2hi: 0x7FFF:0:-1: +%*2hi: 0x7FFF:0:-1: +%2hi: 077777:1:3:7: +%*2hi: 077777:0:3: +%2hi: 0B111111111111111:0:-1: +%*2hi: 0B111111111111111:0:-1: +%2hi: 0b111111111111111:0:-1: +%*2hi: 0b111111111111111:0:-1: +%2hi: 32768:1:3:32: +%*2hi: 32768:0:3: +%2hi: 0X8000:0:-1: +%*2hi: 0X8000:0:-1: +%2hi: 0x8000:0:-1: +%*2hi: 0x8000:0:-1: +%2hi: 0100000:1:3:1: +%*2hi: 0100000:0:3: +%2hi: 0B1000000000000000:0:-1: +%*2hi: 0B1000000000000000:0:-1: +%2hi: 0b1000000000000000:0:-1: +%*2hi: 0b1000000000000000:0:-1: +%2hi: 32809:1:3:32: +%*2hi: 32809:0:3: +%2hi: 0X8029:0:-1: +%*2hi: 0X8029:0:-1: +%2hi: 0x8029:0:-1: +%*2hi: 0x8029:0:-1: +%2hi: 0100051:1:3:1: +%*2hi: 0100051:0:3: +%2hi: 0B1000000000101001:0:-1: +%*2hi: 0B1000000000101001:0:-1: +%2hi: 0b1000000000101001:0:-1: +%*2hi: 0b1000000000101001:0:-1: +%2hi: +0:1:3:0: +%*2hi: +0:0:3: +%2hi: +0X0:1:3:0: +%*2hi: +0X0:0:3: +%2hi: +0x0:1:3:0: +%*2hi: +0x0:0:3: +%2hi: +00:1:3:0: +%*2hi: +00:0:3: +%2hi: +0B0:1:3:0: +%*2hi: +0B0:0:3: +%2hi: +0b0:1:3:0: +%*2hi: +0b0:0:3: +%2hi: +1:1:3:1: +%*2hi: +1:0:3: +%2hi: +0X1:1:3:0: +%*2hi: +0X1:0:3: +%2hi: +0x1:1:3:0: +%*2hi: +0x1:0:3: +%2hi: +01:1:3:0: +%*2hi: +01:0:3: +%2hi: +0B1:1:3:0: +%*2hi: +0B1:0:3: +%2hi: +0b1:1:3:0: +%*2hi: +0b1:0:3: +%2hi: +42:1:3:4: +%*2hi: +42:0:3: +%2hi: +0X2a:1:3:0: +%*2hi: +0X2a:0:3: +%2hi: +0x2A:1:3:0: +%*2hi: +0x2A:0:3: +%2hi: +052:1:3:0: +%*2hi: +052:0:3: +%2hi: +0B101010:1:3:0: +%*2hi: +0B101010:0:3: +%2hi: +0b101010:1:3:0: +%*2hi: +0b101010:0:3: +%2hi: +32767:1:3:3: +%*2hi: +32767:0:3: +%2hi: +0X7fff:1:3:0: +%*2hi: +0X7fff:0:3: +%2hi: +0x7FFF:1:3:0: +%*2hi: +0x7FFF:0:3: +%2hi: +077777:1:3:0: +%*2hi: +077777:0:3: +%2hi: +0B111111111111111:1:3:0: +%*2hi: +0B111111111111111:0:3: +%2hi: +0b111111111111111:1:3:0: +%*2hi: +0b111111111111111:0:3: +%2hi: +32768:1:3:3: +%*2hi: +32768:0:3: +%2hi: +0X8000:1:3:0: +%*2hi: +0X8000:0:3: +%2hi: +0x8000:1:3:0: +%*2hi: +0x8000:0:3: +%2hi: +0100000:1:3:0: +%*2hi: +0100000:0:3: +%2hi: +0B1000000000000000:1:3:0: +%*2hi: +0B1000000000000000:0:3: +%2hi: +0b1000000000000000:1:3:0: +%*2hi: +0b1000000000000000:0:3: +%2hi: +32809:1:3:3: +%*2hi: +32809:0:3: +%2hi: +0X8029:1:3:0: +%*2hi: +0X8029:0:3: +%2hi: +0x8029:1:3:0: +%*2hi: +0x8029:0:3: +%2hi: +0100051:1:3:0: +%*2hi: +0100051:0:3: +%2hi: +0B1000000000101001:1:3:0: +%*2hi: +0B1000000000101001:0:3: +%2hi: +0b1000000000101001:1:3:0: +%*2hi: +0b1000000000101001:0:3: +%7hi: :0:-1: +%*7hi: :0:-1: +%7hi: -32891:1:7:32645: +%*7hi: -32891:0:7: +%7hi: -0X807b:1:8:32645: +%*7hi: -0X807b:0:8: +%7hi: -0x807B:1:8:32645: +%*7hi: -0x807B:0:8: +%7hi: -0100173:1:8:-4111: +%*7hi: -0100173:0:8: +%7hi: -0B1000000001111011:1:8:-8: +%*7hi: -0B1000000001111011:0:8: +%7hi: -0b1000000001111011:1:8:-8: +%*7hi: -0b1000000001111011:0:8: +%7hi: -32769:1:7:32767: +%*7hi: -32769:0:7: +%7hi: -0X8001:1:8:32767: +%*7hi: -0X8001:0:8: +%7hi: -0x8001:1:8:32767: +%*7hi: -0x8001:0:8: +%7hi: -0100001:1:8:-4096: +%*7hi: -0100001:0:8: +%7hi: -0B1000000000000001:1:8:-8: +%*7hi: -0B1000000000000001:0:8: +%7hi: -0b1000000000000001:1:8:-8: +%*7hi: -0b1000000000000001:0:8: +%7hi: -32768:1:7:-32768: +%*7hi: -32768:0:7: +%7hi: -0X8000:1:8:-32768: +%*7hi: -0X8000:0:8: +%7hi: -0x8000:1:8:-32768: +%*7hi: -0x8000:0:8: +%7hi: -0100000:1:8:-4096: +%*7hi: -0100000:0:8: +%7hi: -0B1000000000000000:1:8:-8: +%*7hi: -0B1000000000000000:0:8: +%7hi: -0b1000000000000000:1:8:-8: +%*7hi: -0b1000000000000000:0:8: +%7hi: -123:1:5:-123: +%*7hi: -123:0:5: +%7hi: -0X7b:1:6:-123: +%*7hi: -0X7b:0:6: +%7hi: -0x7B:1:6:-123: +%*7hi: -0x7B:0:6: +%7hi: -0173:1:6:-123: +%*7hi: -0173:0:6: +%7hi: -0B1111011:1:8:-15: +%*7hi: -0B1111011:0:8: +%7hi: -0b1111011:1:8:-15: +%*7hi: -0b1111011:0:8: +%7hi: -1:1:3:-1: +%*7hi: -1:0:3: +%7hi: -0X1:1:5:-1: +%*7hi: -0X1:0:5: +%7hi: -0x1:1:5:-1: +%*7hi: -0x1:0:5: +%7hi: -01:1:4:-1: +%*7hi: -01:0:4: +%7hi: -0B1:1:5:-1: +%*7hi: -0B1:0:5: +%7hi: -0b1:1:5:-1: +%*7hi: -0b1:0:5: +%7hi: -0:1:3:0: +%*7hi: -0:0:3: +%7hi: -0X0:1:5:0: +%*7hi: -0X0:0:5: +%7hi: -0x0:1:5:0: +%*7hi: -0x0:0:5: +%7hi: -00:1:4:0: +%*7hi: -00:0:4: +%7hi: -0B0:1:5:0: +%*7hi: -0B0:0:5: +%7hi: -0b0:1:5:0: +%*7hi: -0b0:0:5: +%7hi: 0:1:2:0: +%*7hi: 0:0:2: +%7hi: 0X0:1:4:0: +%*7hi: 0X0:0:4: +%7hi: 0x0:1:4:0: +%*7hi: 0x0:0:4: +%7hi: 00:1:3:0: +%*7hi: 00:0:3: +%7hi: 0B0:1:4:0: +%*7hi: 0B0:0:4: +%7hi: 0b0:1:4:0: +%*7hi: 0b0:0:4: +%7hi: 1:1:2:1: +%*7hi: 1:0:2: +%7hi: 0X1:1:4:1: +%*7hi: 0X1:0:4: +%7hi: 0x1:1:4:1: +%*7hi: 0x1:0:4: +%7hi: 01:1:3:1: +%*7hi: 01:0:3: +%7hi: 0B1:1:4:1: +%*7hi: 0B1:0:4: +%7hi: 0b1:1:4:1: +%*7hi: 0b1:0:4: +%7hi: 42:1:3:42: +%*7hi: 42:0:3: +%7hi: 0X2a:1:5:42: +%*7hi: 0X2a:0:5: +%7hi: 0x2A:1:5:42: +%*7hi: 0x2A:0:5: +%7hi: 052:1:4:42: +%*7hi: 052:0:4: +%7hi: 0B101010:1:8:21: +%*7hi: 0B101010:0:8: +%7hi: 0b101010:1:8:21: +%*7hi: 0b101010:0:8: +%7hi: 32767:1:6:32767: +%*7hi: 32767:0:6: +%7hi: 0X7fff:1:7:32767: +%*7hi: 0X7fff:0:7: +%7hi: 0x7FFF:1:7:32767: +%*7hi: 0x7FFF:0:7: +%7hi: 077777:1:7:32767: +%*7hi: 077777:0:7: +%7hi: 0B111111111111111:1:8:31: +%*7hi: 0B111111111111111:0:8: +%7hi: 0b111111111111111:1:8:31: +%*7hi: 0b111111111111111:0:8: +%7hi: 32768:1:6:-32768: +%*7hi: 32768:0:6: +%7hi: 0X8000:1:7:-32768: +%*7hi: 0X8000:0:7: +%7hi: 0x8000:1:7:-32768: +%*7hi: 0x8000:0:7: +%7hi: 0100000:1:8:-32768: +%*7hi: 0100000:0:8: +%7hi: 0B1000000000000000:1:8:16: +%*7hi: 0B1000000000000000:0:8: +%7hi: 0b1000000000000000:1:8:16: +%*7hi: 0b1000000000000000:0:8: +%7hi: 32809:1:6:-32727: +%*7hi: 32809:0:6: +%7hi: 0X8029:1:7:-32727: +%*7hi: 0X8029:0:7: +%7hi: 0x8029:1:7:-32727: +%*7hi: 0x8029:0:7: +%7hi: 0100051:1:8:-32727: +%*7hi: 0100051:0:8: +%7hi: 0B1000000000101001:1:8:16: +%*7hi: 0B1000000000101001:0:8: +%7hi: 0b1000000000101001:1:8:16: +%*7hi: 0b1000000000101001:0:8: +%7hi: +0:1:3:0: +%*7hi: +0:0:3: +%7hi: +0X0:1:5:0: +%*7hi: +0X0:0:5: +%7hi: +0x0:1:5:0: +%*7hi: +0x0:0:5: +%7hi: +00:1:4:0: +%*7hi: +00:0:4: +%7hi: +0B0:1:5:0: +%*7hi: +0B0:0:5: +%7hi: +0b0:1:5:0: +%*7hi: +0b0:0:5: +%7hi: +1:1:3:1: +%*7hi: +1:0:3: +%7hi: +0X1:1:5:1: +%*7hi: +0X1:0:5: +%7hi: +0x1:1:5:1: +%*7hi: +0x1:0:5: +%7hi: +01:1:4:1: +%*7hi: +01:0:4: +%7hi: +0B1:1:5:1: +%*7hi: +0B1:0:5: +%7hi: +0b1:1:5:1: +%*7hi: +0b1:0:5: +%7hi: +42:1:4:42: +%*7hi: +42:0:4: +%7hi: +0X2a:1:6:42: +%*7hi: +0X2a:0:6: +%7hi: +0x2A:1:6:42: +%*7hi: +0x2A:0:6: +%7hi: +052:1:5:42: +%*7hi: +052:0:5: +%7hi: +0B101010:1:8:10: +%*7hi: +0B101010:0:8: +%7hi: +0b101010:1:8:10: +%*7hi: +0b101010:0:8: +%7hi: +32767:1:7:32767: +%*7hi: +32767:0:7: +%7hi: +0X7fff:1:8:32767: +%*7hi: +0X7fff:0:8: +%7hi: +0x7FFF:1:8:32767: +%*7hi: +0x7FFF:0:8: +%7hi: +077777:1:8:32767: +%*7hi: +077777:0:8: +%7hi: +0B111111111111111:1:8:15: +%*7hi: +0B111111111111111:0:8: +%7hi: +0b111111111111111:1:8:15: +%*7hi: +0b111111111111111:0:8: +%7hi: +32768:1:7:-32768: +%*7hi: +32768:0:7: +%7hi: +0X8000:1:8:-32768: +%*7hi: +0X8000:0:8: +%7hi: +0x8000:1:8:-32768: +%*7hi: +0x8000:0:8: +%7hi: +0100000:1:8:4096: +%*7hi: +0100000:0:8: +%7hi: +0B1000000000000000:1:8:8: +%*7hi: +0B1000000000000000:0:8: +%7hi: +0b1000000000000000:1:8:8: +%*7hi: +0b1000000000000000:0:8: +%7hi: +32809:1:7:-32727: +%*7hi: +32809:0:7: +%7hi: +0X8029:1:8:-32727: +%*7hi: +0X8029:0:8: +%7hi: +0x8029:1:8:-32727: +%*7hi: +0x8029:0:8: +%7hi: +0100051:1:8:4101: +%*7hi: +0100051:0:8: +%7hi: +0B1000000000101001:1:8:8: +%*7hi: +0B1000000000101001:0:8: +%7hi: +0b1000000000101001:1:8:8: +%*7hi: +0b1000000000101001:0:8: diff --git a/stdio-common/tst-scanf-format-skeleton-c.c b/stdio-common/tst-scanf-format-skeleton-c.c new file mode 100644 index 0000000..181077f --- /dev/null +++ b/stdio-common/tst-scanf-format-skeleton-c.c @@ -0,0 +1,21 @@ +/* Test skeleton for formatted scanf input for character conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +typedef char *type_t; + +#include "tst-scanf-format-skeleton.c" diff --git a/stdio-common/tst-scanf-format-skeleton-char.c b/stdio-common/tst-scanf-format-skeleton-char.c new file mode 100644 index 0000000..a694de4 --- /dev/null +++ b/stdio-common/tst-scanf-format-skeleton-char.c @@ -0,0 +1,21 @@ +/* Test skeleton for formatted scanf input for signed char conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +typedef signed char type_t; + +#include "tst-scanf-format-skeleton.c" diff --git a/stdio-common/tst-scanf-format-skeleton-double.c b/stdio-common/tst-scanf-format-skeleton-double.c new file mode 100644 index 0000000..502f2ad --- /dev/null +++ b/stdio-common/tst-scanf-format-skeleton-double.c @@ -0,0 +1,21 @@ +/* Test skeleton for formatted scanf input for double conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +typedef double type_t; + +#include "tst-scanf-format-skeleton.c" diff --git a/stdio-common/tst-scanf-format-skeleton-float.c b/stdio-common/tst-scanf-format-skeleton-float.c new file mode 100644 index 0000000..2104c0f --- /dev/null +++ b/stdio-common/tst-scanf-format-skeleton-float.c @@ -0,0 +1,21 @@ +/* Test skeleton for formatted scanf input for float conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +typedef float type_t; + +#include "tst-scanf-format-skeleton.c" diff --git a/stdio-common/tst-scanf-format-skeleton-int.c b/stdio-common/tst-scanf-format-skeleton-int.c new file mode 100644 index 0000000..eb4e9de --- /dev/null +++ b/stdio-common/tst-scanf-format-skeleton-int.c @@ -0,0 +1,21 @@ +/* Test skeleton for formatted scanf input for int conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +typedef int type_t; + +#include "tst-scanf-format-skeleton.c" diff --git a/stdio-common/tst-scanf-format-skeleton-ldouble.c b/stdio-common/tst-scanf-format-skeleton-ldouble.c new file mode 100644 index 0000000..3649110 --- /dev/null +++ b/stdio-common/tst-scanf-format-skeleton-ldouble.c @@ -0,0 +1,21 @@ +/* Test skeleton for formatted scanf input for long double conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +typedef long double type_t; + +#include "tst-scanf-format-skeleton.c" diff --git a/stdio-common/tst-scanf-format-skeleton-llong.c b/stdio-common/tst-scanf-format-skeleton-llong.c new file mode 100644 index 0000000..8b8324e --- /dev/null +++ b/stdio-common/tst-scanf-format-skeleton-llong.c @@ -0,0 +1,21 @@ +/* Test skeleton for formatted scanf input for long long int conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +typedef long long int type_t; + +#include "tst-scanf-format-skeleton.c" diff --git a/stdio-common/tst-scanf-format-skeleton-long.c b/stdio-common/tst-scanf-format-skeleton-long.c new file mode 100644 index 0000000..91aa091 --- /dev/null +++ b/stdio-common/tst-scanf-format-skeleton-long.c @@ -0,0 +1,21 @@ +/* Test skeleton for formatted scanf input for long int conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +typedef long int type_t; + +#include "tst-scanf-format-skeleton.c" diff --git a/stdio-common/tst-scanf-format-skeleton-short.c b/stdio-common/tst-scanf-format-skeleton-short.c new file mode 100644 index 0000000..ca51a25 --- /dev/null +++ b/stdio-common/tst-scanf-format-skeleton-short.c @@ -0,0 +1,21 @@ +/* Test skeleton for formatted scanf input for short int conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +typedef short int type_t; + +#include "tst-scanf-format-skeleton.c" diff --git a/stdio-common/tst-scanf-format-skeleton-uchar.c b/stdio-common/tst-scanf-format-skeleton-uchar.c new file mode 100644 index 0000000..6be8917 --- /dev/null +++ b/stdio-common/tst-scanf-format-skeleton-uchar.c @@ -0,0 +1,22 @@ +/* Test skeleton for formatted scanf input for unsigned char conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#define TYPE_T_UNSIGNED_P 1 +typedef unsigned char type_t; + +#include "tst-scanf-format-skeleton.c" diff --git a/stdio-common/tst-scanf-format-skeleton-uint.c b/stdio-common/tst-scanf-format-skeleton-uint.c new file mode 100644 index 0000000..1508dc3 --- /dev/null +++ b/stdio-common/tst-scanf-format-skeleton-uint.c @@ -0,0 +1,22 @@ +/* Test skeleton for formatted scanf input for unsigned int conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#define TYPE_T_UNSIGNED_P 1 +typedef unsigned int type_t; + +#include "tst-scanf-format-skeleton.c" diff --git a/stdio-common/tst-scanf-format-skeleton-ullong.c b/stdio-common/tst-scanf-format-skeleton-ullong.c new file mode 100644 index 0000000..b0b8050 --- /dev/null +++ b/stdio-common/tst-scanf-format-skeleton-ullong.c @@ -0,0 +1,22 @@ +/* Test skeleton for formatted scanf input for unsigned long long int convs. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#define TYPE_T_UNSIGNED_P 1 +typedef unsigned long long int type_t; + +#include "tst-scanf-format-skeleton.c" diff --git a/stdio-common/tst-scanf-format-skeleton-ulong.c b/stdio-common/tst-scanf-format-skeleton-ulong.c new file mode 100644 index 0000000..3198825 --- /dev/null +++ b/stdio-common/tst-scanf-format-skeleton-ulong.c @@ -0,0 +1,22 @@ +/* Test skeleton for formatted scanf input for unsigned long int convs. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#define TYPE_T_UNSIGNED_P 1 +typedef unsigned long int type_t; + +#include "tst-scanf-format-skeleton.c" diff --git a/stdio-common/tst-scanf-format-skeleton-ushort.c b/stdio-common/tst-scanf-format-skeleton-ushort.c new file mode 100644 index 0000000..2b710c5 --- /dev/null +++ b/stdio-common/tst-scanf-format-skeleton-ushort.c @@ -0,0 +1,22 @@ +/* Test skeleton for formatted scanf input for unsigned short int conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#define TYPE_T_UNSIGNED_P 1 +typedef unsigned short int type_t; + +#include "tst-scanf-format-skeleton.c" diff --git a/stdio-common/tst-scanf-format-skeleton.c b/stdio-common/tst-scanf-format-skeleton.c new file mode 100644 index 0000000..bf1129b --- /dev/null +++ b/stdio-common/tst-scanf-format-skeleton.c @@ -0,0 +1,373 @@ +/* Test skeleton for formatted scanf input. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +/* The following definitions have to be supplied by the source including + this skeleton: + + Macros: + TYPE_T_UNSIGNED_P [optional] Set to 1 if handling an unsigned + integer conversion. + + Typedefs: + type_t Type to hold data produced by the conversion + handled. + + Callable objects: + scanf_under_test Wrapper for the 'scanf' family feature to be + tested. + verify_input Verifier called to determine whether there is a + match between the data retrieved by the feature + tested and MATCH reference data supplied by input. + pointer_to_value Converter making a pointer suitable for the + feature tested from the data holding type. + initialize_value Initializer for the data holder to use ahead of + each call to the feature tested. + + It is up to the source including this skeleton whether the individual + callable objects are going to be macros or actual functions. + + See tst-*scanf-format-*.c for usage examples. */ + +#include <ctype.h> +#include <dlfcn.h> +#include <mcheck.h> +#include <stdbool.h> +#include <stddef.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include <support/check.h> +#include <support/support.h> + +/* Tweak our environment according to any TYPE_T_UNSIGNED_P setting + supplied by the individual test case. */ +#ifndef TYPE_T_UNSIGNED_P +# define TYPE_T_UNSIGNED_P 0 +#endif +#if TYPE_T_UNSIGNED_P +# define UNSIGNED unsigned +#else +# define UNSIGNED +#endif + +/* Read and return a single character from standard input, returning + end-of-file or error status indication where applicable. */ + +static int +read_input (void) +{ + int c = getchar (); + if (ferror (stdin)) + c = INPUT_ERROR; + else if (feof (stdin)) + c = INPUT_EOF; + return c; +} + +/* Consume a signed decimal integer supplied by READ_INPUT above, up to + the following ':' field separator which is removed from input, making + sure the value requested does not overflow the range of the data type + according to TYPE_T_UNSIGNED_P. + + Return the value retrieved and set ERRP to zero on success, otherwise + set ERRP to the error code. */ + +static long long +read_integer (int *errp) +{ + bool m = false; + int ch; + + ch = read_input (); + if (ch == '-' || ch == '+') + { + m = ch == '-'; + ch = read_input (); + } + + if (ch == ':') + { + *errp = INPUT_FORMAT; + return 0; + } + + unsigned long long v = 0; + while (1) + { + unsigned long long v0 = v; + + if (isdigit (ch)) + { + v = 10 * v + (ch - '0'); + if (!(TYPE_T_UNSIGNED_P + || (v & ~((~0ULL) >> 1)) == 0 + || (m && v == ~((~0ULL) >> 1))) + || v < v0) + { + *errp = INPUT_OVERFLOW; + return 0; + } + } + else if (ch < 0) + { + *errp = ch; + return 0; + } + else if (ch != ':') + { + *errp = INPUT_FORMAT; + return 0; + } + else + break; + + ch = read_input (); + } + + *errp = 0; + return m ? -v : v; +} + +/* Return an error message corresponding to ERR. */ + +static const char * +get_error_message (int err) +{ + switch (err) + { + case INPUT_EOF: + return "input line %zi: premature end of input"; + case INPUT_ERROR: + return "input line %zi: error reading input data: %m"; + case INPUT_FORMAT: + return "input line %zi: input data format error"; + case INPUT_OVERFLOW: + return "input line %zi: input data arithmetic overflow"; + case OUTPUT_TERM: + return "input line %zi: string termination missing from output"; + case OUTPUT_OVERRUN: + return "input line %zi: output data overrun"; + default: + return "input line %zi: internal test error"; + } +} + +/* Consume a record supplied by READ_INPUT above, according to '%' and + any assignment-suppressing character '*', followed by any width W, + any length modifier L, and conversion C, all already provided in FMT + (along with trailing "%lln" implicitly appended by the caller) and + removed from input along with the following ':' field separator. + For convenience the last character of conversion C is supplied as + the F parameter. + + Record formats consumed: + + %*<L><C>:<INPUT>:<RESULT==0>:<COUNT==-1>: + %*<W><L><C>:<INPUT>:<RESULT==0>:<COUNT==-1>: + %<L><C>:<INPUT>:<RESULT==0>:<COUNT==-1>: + %<W><L><C>:<INPUT>:<RESULT==0>:<COUNT==-1>: + %*<L><C>:<INPUT>:<RESULT>:<COUNT>: + %*<W><L><C>:<INPUT>:<RESULT>:<COUNT>: + %<L><C>:<INPUT>:<RESULT!=0>:<COUNT>:<MATCH>: + %<W><L><C>:<INPUT>:<RESULT!=0>:<COUNT>:<MATCH>: + + Verify that the 'scanf' family function under test returned RESULT, + that the "%lln" conversion recorded COUNT characters or has not been + executed leaving the value at -1 as applicable, and where executed + that the conversion requested produced output matching MATCH. + + Return 0 on success, -1 on failure. */ + +static int +do_scanf (char f, char *fmt) +{ + bool value_match = true; + bool count_match = true; + long long count = -1; + bool match = true; + long long result; + long long r; + long long c; + type_t val; + int err; + int ch; + + initialize_value (val); + /* Make sure it's been committed. */ + __asm__ ("" : : : "memory"); + + if (fmt[1] == '*') + result = scanf_under_test (fmt, &count); + else + result = scanf_under_test (fmt, pointer_to_value (val), &count); + if (result < 0) + FAIL_RET (get_error_message (result), line); + + do + ch = read_input (); + while (ch != ':' && ch != INPUT_ERROR && ch != INPUT_EOF); + if (ch != ':') + FAIL_RET (get_error_message (ch), line); + + r = read_integer (&err); + if (err < 0) + FAIL_RET (get_error_message (err), line); + match &= r == result; + + c = read_integer (&err); + if (err < 0) + FAIL_RET (get_error_message (err), line); + match &= (count_match = c == count); + + if (r > 0) + { + match &= (value_match = verify_input (f, val, count, &err)); + if (err < 0) + FAIL_RET (get_error_message (err), line); + } + + ch = read_input (); + if (ch != '\n') + FAIL_RET (get_error_message (ch == INPUT_ERROR || ch == INPUT_EOF + ? ch : INPUT_FORMAT), line); + + if (!match) + { + if (r != result) + FAIL ("input line %zi: input assignment count mismatch: %lli", + line, result); + if (!count_match) + FAIL ("input line %zi: input character count mismatch: %lli", + line, count); + if (!value_match) + FAIL ("input line %zi: input value mismatch", line); + return -1; + } + + return 0; +} + +/* Consume a list of input records line by line supplied by READ_INPUT + above, discarding any that begin with the '#' line comment designator + and interpreting the initial part of the remaining ones from leading + '%' up to the first ':' field separator, which is removed from input, + by appending "%lln" to the part retrieved and handing over along with + the rest of input line to read to DO_SCANF above. Terminate upon the + end of input or the first processing error encountered. + + See the top of this file for the definitions that have to be + provided by the source including this skeleton. */ + +int +do_test (void) +{ + size_t fmt_size = 0; + char *fmt = NULL; + + mtrace (); + + int result = 0; + do + { + size_t i = 0; + int ch = 0; + char f; + + line++; + do + { + f = ch; + ch = read_input (); + if ((i == 0 && ch == '#') || ch == INPUT_EOF || ch == INPUT_ERROR) + break; + if (i == fmt_size) + { + fmt_size += SIZE_CHUNK; + fmt = xrealloc (fmt, fmt_size); + } + fmt[i++] = ch; + } + while (ch != ':'); + if (ch == INPUT_EOF && i == 0) + { + if (line == 1) + { + FAIL ("input line %zi: empty input", line); + result = -1; + } + break; + } + if (ch == INPUT_ERROR) + { + FAIL ("input line %zi: error reading format string: %m", line); + result = -1; + break; + } + if (ch == '#') + { + do + ch = read_input (); + while (ch != '\n' && ch != INPUT_EOF && ch != INPUT_ERROR); + if (ch == '\n') + continue; + + if (ch == INPUT_EOF) + FAIL ("input line %zi: premature end of input reading comment", + line); + else + FAIL ("input line %zi: error reading comment: %m", line); + result = -1; + break; + } + if (ch != ':' || i < 3 || fmt[0] != '%') + { + FAIL ("input line %zi: format string format error: \"%.*s\"", line, + (int) (i - 1), fmt); + result = -1; + break; + } + + if (i + 4 > fmt_size) + { + fmt_size += SIZE_CHUNK; + fmt = xrealloc (fmt, fmt_size); + } + fmt[i - 1] = '%'; + fmt[i++] = 'l'; + fmt[i++] = 'l'; + fmt[i++] = 'n'; + fmt[i++] = '\0'; + + result = do_scanf (f, fmt); + } + while (result == 0); + + free (fmt); + return result == 0 ? EXIT_SUCCESS : EXIT_FAILURE; +} + +/* Interpose 'dladdr' with a stub to speed up malloc tracing. */ + +int +dladdr (const void *addr, Dl_info *info) +{ + return 0; +} + +#include <support/test-driver.c> diff --git a/stdio-common/tst-scanf-format-skeleton.h b/stdio-common/tst-scanf-format-skeleton.h new file mode 100644 index 0000000..a34429f --- /dev/null +++ b/stdio-common/tst-scanf-format-skeleton.h @@ -0,0 +1,40 @@ +/* Test skeleton declarations for formatted scanf input. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <stddef.h> + +/* Amount dynamic memory allocations are increased by. */ +#define SIZE_CHUNK 32 + +/* Error codes for use by the tests. */ +enum +{ + INPUT_EOF = -1, /* Premature end of input. */ + INPUT_ERROR = -2, /* System error reading input data. */ + INPUT_FORMAT = -3, /* Input data format error. */ + INPUT_OVERFLOW = -4, /* Input data arithmetic overflow. */ + OUTPUT_TERM = -5, /* String termination missing from output. */ + OUTPUT_OVERRUN = -6 /* Output data overrun. */ +}; + +/* Input data retrieval handlers made available to individual tests. */ +static long long read_integer (int *); +static int read_input (void); + +/* Input data line number tracker. */ +static size_t line; diff --git a/stdio-common/tst-scanf-format-ss-c.c b/stdio-common/tst-scanf-format-ss-c.c new file mode 100644 index 0000000..58a7ce8 --- /dev/null +++ b/stdio-common/tst-scanf-format-ss-c.c @@ -0,0 +1,22 @@ +/* Test for formatted 'sscanf' input for the character conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-ss.h" +#include "tst-scanf-format-character.h" +#include "tst-scanf-format-skeleton-c.c" diff --git a/stdio-common/tst-scanf-format-ss-char.c b/stdio-common/tst-scanf-format-ss-char.c new file mode 100644 index 0000000..66eb04c --- /dev/null +++ b/stdio-common/tst-scanf-format-ss-char.c @@ -0,0 +1,22 @@ +/* Test for formatted 'sscanf' input for signed char conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-ss.h" +#include "tst-scanf-format-integer.h" +#include "tst-scanf-format-skeleton-char.c" diff --git a/stdio-common/tst-scanf-format-ss-double.c b/stdio-common/tst-scanf-format-ss-double.c new file mode 100644 index 0000000..2a9fd8a --- /dev/null +++ b/stdio-common/tst-scanf-format-ss-double.c @@ -0,0 +1,22 @@ +/* Test for formatted 'sscanf' input for double conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-ss.h" +#include "tst-scanf-format-real.h" +#include "tst-scanf-format-skeleton-double.c" diff --git a/stdio-common/tst-scanf-format-ss-float.c b/stdio-common/tst-scanf-format-ss-float.c new file mode 100644 index 0000000..640e35d --- /dev/null +++ b/stdio-common/tst-scanf-format-ss-float.c @@ -0,0 +1,22 @@ +/* Test for formatted 'sscanf' input for float conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-ss.h" +#include "tst-scanf-format-real.h" +#include "tst-scanf-format-skeleton-float.c" diff --git a/stdio-common/tst-scanf-format-ss-int.c b/stdio-common/tst-scanf-format-ss-int.c new file mode 100644 index 0000000..c01a0a3 --- /dev/null +++ b/stdio-common/tst-scanf-format-ss-int.c @@ -0,0 +1,22 @@ +/* Test for formatted 'sscanf' input for int conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-ss.h" +#include "tst-scanf-format-integer.h" +#include "tst-scanf-format-skeleton-int.c" diff --git a/stdio-common/tst-scanf-format-ss-ldouble.c b/stdio-common/tst-scanf-format-ss-ldouble.c new file mode 100644 index 0000000..3e57ab5 --- /dev/null +++ b/stdio-common/tst-scanf-format-ss-ldouble.c @@ -0,0 +1,22 @@ +/* Test for formatted 'sscanf' input for long double conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-ss.h" +#include "tst-scanf-format-real.h" +#include "tst-scanf-format-skeleton-ldouble.c" diff --git a/stdio-common/tst-scanf-format-ss-llong.c b/stdio-common/tst-scanf-format-ss-llong.c new file mode 100644 index 0000000..9c1603c --- /dev/null +++ b/stdio-common/tst-scanf-format-ss-llong.c @@ -0,0 +1,22 @@ +/* Test for formatted 'sscanf' input for long long conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-ss.h" +#include "tst-scanf-format-integer.h" +#include "tst-scanf-format-skeleton-llong.c" diff --git a/stdio-common/tst-scanf-format-ss-long.c b/stdio-common/tst-scanf-format-ss-long.c new file mode 100644 index 0000000..003cfac --- /dev/null +++ b/stdio-common/tst-scanf-format-ss-long.c @@ -0,0 +1,22 @@ +/* Test for formatted 'sscanf' input for long conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-ss.h" +#include "tst-scanf-format-integer.h" +#include "tst-scanf-format-skeleton-long.c" diff --git a/stdio-common/tst-scanf-format-ss-short.c b/stdio-common/tst-scanf-format-ss-short.c new file mode 100644 index 0000000..ba1a582 --- /dev/null +++ b/stdio-common/tst-scanf-format-ss-short.c @@ -0,0 +1,22 @@ +/* Test for formatted 'sscanf' input for short int conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-ss.h" +#include "tst-scanf-format-integer.h" +#include "tst-scanf-format-skeleton-short.c" diff --git a/stdio-common/tst-scanf-format-ss-uchar.c b/stdio-common/tst-scanf-format-ss-uchar.c new file mode 100644 index 0000000..1db1424 --- /dev/null +++ b/stdio-common/tst-scanf-format-ss-uchar.c @@ -0,0 +1,22 @@ +/* Test for formatted 'sscanf' input for unsigned char conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-ss.h" +#include "tst-scanf-format-integer.h" +#include "tst-scanf-format-skeleton-uchar.c" diff --git a/stdio-common/tst-scanf-format-ss-uint.c b/stdio-common/tst-scanf-format-ss-uint.c new file mode 100644 index 0000000..a296fb4 --- /dev/null +++ b/stdio-common/tst-scanf-format-ss-uint.c @@ -0,0 +1,22 @@ +/* Test for formatted 'sscanf' input for unsigned int conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-ss.h" +#include "tst-scanf-format-integer.h" +#include "tst-scanf-format-skeleton-uint.c" diff --git a/stdio-common/tst-scanf-format-ss-ullong.c b/stdio-common/tst-scanf-format-ss-ullong.c new file mode 100644 index 0000000..885d570 --- /dev/null +++ b/stdio-common/tst-scanf-format-ss-ullong.c @@ -0,0 +1,22 @@ +/* Test for formatted 'sscanf' input for unsigned long long int conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-ss.h" +#include "tst-scanf-format-integer.h" +#include "tst-scanf-format-skeleton-ullong.c" diff --git a/stdio-common/tst-scanf-format-ss-ulong.c b/stdio-common/tst-scanf-format-ss-ulong.c new file mode 100644 index 0000000..8a2f24d --- /dev/null +++ b/stdio-common/tst-scanf-format-ss-ulong.c @@ -0,0 +1,22 @@ +/* Test for formatted 'sscanf' input for unsigned long int conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-ss.h" +#include "tst-scanf-format-integer.h" +#include "tst-scanf-format-skeleton-ulong.c" diff --git a/stdio-common/tst-scanf-format-ss-ushort.c b/stdio-common/tst-scanf-format-ss-ushort.c new file mode 100644 index 0000000..4061888 --- /dev/null +++ b/stdio-common/tst-scanf-format-ss-ushort.c @@ -0,0 +1,22 @@ +/* Test for formatted 'sscanf' input for unsigned short int conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-ss.h" +#include "tst-scanf-format-integer.h" +#include "tst-scanf-format-skeleton-ushort.c" diff --git a/stdio-common/tst-scanf-format-ss.h b/stdio-common/tst-scanf-format-ss.h new file mode 100644 index 0000000..b35e5bc --- /dev/null +++ b/stdio-common/tst-scanf-format-ss.h @@ -0,0 +1,73 @@ +/* Test feature wrapper for formatted 'sscanf' input. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <stddef.h> +#include <stdio.h> +#include <stdlib.h> + +#include <support/support.h> + +static char *sscanf_buf; +static size_t sscanf_buf_size; + +static void __attribute__ ((destructor)) +scanf_under_test_fini (void) +{ + free (sscanf_buf); +} + +#define scanf_under_test(...) \ +({ \ + __label__ out; \ + size_t i = 0; \ + int result; \ + int ch; \ + \ + do \ + { \ + ch = read_input (); \ + if (ch < 0) \ + { \ + result = ch; \ + goto out; \ + } \ + if (i == sscanf_buf_size) \ + { \ + sscanf_buf_size += SIZE_CHUNK; \ + /* Add an extra byte for the terminating null character. */ \ + sscanf_buf = xrealloc (sscanf_buf, sscanf_buf_size + 1); \ + } \ + sscanf_buf[i++] = ch; \ + } \ + while (ch != ':'); \ + sscanf_buf[i++] = '\0'; \ + \ + ch = ungetc (ch, stdin); \ + if (ch == EOF) \ + { \ + result = INPUT_ERROR; \ + goto out; \ + } \ + \ + result = sscanf (sscanf_buf, __VA_ARGS__); \ + if (result == EOF) \ + result = INPUT_EOF; \ + \ +out: \ + result; \ +}) diff --git a/stdio-common/tst-scanf-format-uchar-b.input b/stdio-common/tst-scanf-format-uchar-b.input new file mode 100644 index 0000000..3287215 --- /dev/null +++ b/stdio-common/tst-scanf-format-uchar-b.input @@ -0,0 +1,644 @@ +%hhb::0:-1: +%*hhb::0:-1: +%hhb:-1111011:1:8:133: +%*hhb:-1111011:0:8: +%hhb:-0B1111011:1:10:133: +%*hhb:-0B1111011:0:10: +%hhb:-0b1111011:1:10:133: +%*hhb:-0b1111011:0:10: +%hhb:-1:1:2:255: +%*hhb:-1:0:2: +%hhb:-0B1:1:4:255: +%*hhb:-0B1:0:4: +%hhb:-0b1:1:4:255: +%*hhb:-0b1:0:4: +%hhb:-0:1:2:0: +%*hhb:-0:0:2: +%hhb:-0B0:1:4:0: +%*hhb:-0B0:0:4: +%hhb:-0b0:1:4:0: +%*hhb:-0b0:0:4: +%hhb:0:1:1:0: +%*hhb:0:0:1: +%hhb:0B0:1:3:0: +%*hhb:0B0:0:3: +%hhb:0b0:1:3:0: +%*hhb:0b0:0:3: +%hhb:1:1:1:1: +%*hhb:1:0:1: +%hhb:0B1:1:3:1: +%*hhb:0B1:0:3: +%hhb:0b1:1:3:1: +%*hhb:0b1:0:3: +%hhb:101010:1:6:42: +%*hhb:101010:0:6: +%hhb:0B101010:1:8:42: +%*hhb:0B101010:0:8: +%hhb:0b101010:1:8:42: +%*hhb:0b101010:0:8: +%hhb:11111111:1:8:255: +%*hhb:11111111:0:8: +%hhb:0B11111111:1:10:255: +%*hhb:0B11111111:0:10: +%hhb:0b11111111:1:10:255: +%*hhb:0b11111111:0:10: +%hhb:100000000:1:9:0: +%*hhb:100000000:0:9: +%hhb:0B100000000:1:11:0: +%*hhb:0B100000000:0:11: +%hhb:0b100000000:1:11:0: +%*hhb:0b100000000:0:11: +%hhb:100101001:1:9:41: +%*hhb:100101001:0:9: +%hhb:0B100101001:1:11:41: +%*hhb:0B100101001:0:11: +%hhb:0b100101001:1:11:41: +%*hhb:0b100101001:0:11: +%hhb:+0:1:2:0: +%*hhb:+0:0:2: +%hhb:+0B0:1:4:0: +%*hhb:+0B0:0:4: +%hhb:+0b0:1:4:0: +%*hhb:+0b0:0:4: +%hhb:+1:1:2:1: +%*hhb:+1:0:2: +%hhb:+0B1:1:4:1: +%*hhb:+0B1:0:4: +%hhb:+0b1:1:4:1: +%*hhb:+0b1:0:4: +%hhb:+101010:1:7:42: +%*hhb:+101010:0:7: +%hhb:+0B101010:1:9:42: +%*hhb:+0B101010:0:9: +%hhb:+0b101010:1:9:42: +%*hhb:+0b101010:0:9: +%hhb:+11111111:1:9:255: +%*hhb:+11111111:0:9: +%hhb:+0B11111111:1:11:255: +%*hhb:+0B11111111:0:11: +%hhb:+0b11111111:1:11:255: +%*hhb:+0b11111111:0:11: +%hhb:+100000000:1:10:0: +%*hhb:+100000000:0:10: +%hhb:+0B100000000:1:12:0: +%*hhb:+0B100000000:0:12: +%hhb:+0b100000000:1:12:0: +%*hhb:+0b100000000:0:12: +%hhb:+100101001:1:10:41: +%*hhb:+100101001:0:10: +%hhb:+0B100101001:1:12:41: +%*hhb:+0B100101001:0:12: +%hhb:+0b100101001:1:12:41: +%*hhb:+0b100101001:0:12: +%1hhb::0:-1: +%*1hhb::0:-1: +%1hhb:-1111011:0:-1: +%*1hhb:-1111011:0:-1: +%1hhb:-0B1111011:0:-1: +%*1hhb:-0B1111011:0:-1: +%1hhb:-0b1111011:0:-1: +%*1hhb:-0b1111011:0:-1: +%1hhb:-1:0:-1: +%*1hhb:-1:0:-1: +%1hhb:-0B1:0:-1: +%*1hhb:-0B1:0:-1: +%1hhb:-0b1:0:-1: +%*1hhb:-0b1:0:-1: +%1hhb:-0:0:-1: +%*1hhb:-0:0:-1: +%1hhb:-0B0:0:-1: +%*1hhb:-0B0:0:-1: +%1hhb:-0b0:0:-1: +%*1hhb:-0b0:0:-1: +%1hhb:0:1:1:0: +%*1hhb:0:0:1: +%1hhb:0B0:1:1:0: +%*1hhb:0B0:0:1: +%1hhb:0b0:1:1:0: +%*1hhb:0b0:0:1: +%1hhb:1:1:1:1: +%*1hhb:1:0:1: +%1hhb:0B1:1:1:0: +%*1hhb:0B1:0:1: +%1hhb:0b1:1:1:0: +%*1hhb:0b1:0:1: +%1hhb:101010:1:1:1: +%*1hhb:101010:0:1: +%1hhb:0B101010:1:1:0: +%*1hhb:0B101010:0:1: +%1hhb:0b101010:1:1:0: +%*1hhb:0b101010:0:1: +%1hhb:11111111:1:1:1: +%*1hhb:11111111:0:1: +%1hhb:0B11111111:1:1:0: +%*1hhb:0B11111111:0:1: +%1hhb:0b11111111:1:1:0: +%*1hhb:0b11111111:0:1: +%1hhb:100000000:1:1:1: +%*1hhb:100000000:0:1: +%1hhb:0B100000000:1:1:0: +%*1hhb:0B100000000:0:1: +%1hhb:0b100000000:1:1:0: +%*1hhb:0b100000000:0:1: +%1hhb:100101001:1:1:1: +%*1hhb:100101001:0:1: +%1hhb:0B100101001:1:1:0: +%*1hhb:0B100101001:0:1: +%1hhb:0b100101001:1:1:0: +%*1hhb:0b100101001:0:1: +%1hhb:+0:0:-1: +%*1hhb:+0:0:-1: +%1hhb:+0B0:0:-1: +%*1hhb:+0B0:0:-1: +%1hhb:+0b0:0:-1: +%*1hhb:+0b0:0:-1: +%1hhb:+1:0:-1: +%*1hhb:+1:0:-1: +%1hhb:+0B1:0:-1: +%*1hhb:+0B1:0:-1: +%1hhb:+0b1:0:-1: +%*1hhb:+0b1:0:-1: +%1hhb:+101010:0:-1: +%*1hhb:+101010:0:-1: +%1hhb:+0B101010:0:-1: +%*1hhb:+0B101010:0:-1: +%1hhb:+0b101010:0:-1: +%*1hhb:+0b101010:0:-1: +%1hhb:+11111111:0:-1: +%*1hhb:+11111111:0:-1: +%1hhb:+0B11111111:0:-1: +%*1hhb:+0B11111111:0:-1: +%1hhb:+0b11111111:0:-1: +%*1hhb:+0b11111111:0:-1: +%1hhb:+100000000:0:-1: +%*1hhb:+100000000:0:-1: +%1hhb:+0B100000000:0:-1: +%*1hhb:+0B100000000:0:-1: +%1hhb:+0b100000000:0:-1: +%*1hhb:+0b100000000:0:-1: +%1hhb:+100101001:0:-1: +%*1hhb:+100101001:0:-1: +%1hhb:+0B100101001:0:-1: +%*1hhb:+0B100101001:0:-1: +%1hhb:+0b100101001:0:-1: +%*1hhb:+0b100101001:0:-1: +%2hhb::0:-1: +%*2hhb::0:-1: +%2hhb:-1111011:1:2:255: +%*2hhb:-1111011:0:2: +%2hhb:-0B1111011:1:2:0: +%*2hhb:-0B1111011:0:2: +%2hhb:-0b1111011:1:2:0: +%*2hhb:-0b1111011:0:2: +%2hhb:-1:1:2:255: +%*2hhb:-1:0:2: +%2hhb:-0B1:1:2:0: +%*2hhb:-0B1:0:2: +%2hhb:-0b1:1:2:0: +%*2hhb:-0b1:0:2: +%2hhb:-0:1:2:0: +%*2hhb:-0:0:2: +%2hhb:-0B0:1:2:0: +%*2hhb:-0B0:0:2: +%2hhb:-0b0:1:2:0: +%*2hhb:-0b0:0:2: +%2hhb:0:1:1:0: +%*2hhb:0:0:1: +%2hhb:0B0:0:-1: +%*2hhb:0B0:0:-1: +%2hhb:0b0:0:-1: +%*2hhb:0b0:0:-1: +%2hhb:1:1:1:1: +%*2hhb:1:0:1: +%2hhb:0B1:0:-1: +%*2hhb:0B1:0:-1: +%2hhb:0b1:0:-1: +%*2hhb:0b1:0:-1: +%2hhb:101010:1:2:2: +%*2hhb:101010:0:2: +%2hhb:0B101010:0:-1: +%*2hhb:0B101010:0:-1: +%2hhb:0b101010:0:-1: +%*2hhb:0b101010:0:-1: +%2hhb:11111111:1:2:3: +%*2hhb:11111111:0:2: +%2hhb:0B11111111:0:-1: +%*2hhb:0B11111111:0:-1: +%2hhb:0b11111111:0:-1: +%*2hhb:0b11111111:0:-1: +%2hhb:100000000:1:2:2: +%*2hhb:100000000:0:2: +%2hhb:0B100000000:0:-1: +%*2hhb:0B100000000:0:-1: +%2hhb:0b100000000:0:-1: +%*2hhb:0b100000000:0:-1: +%2hhb:100101001:1:2:2: +%*2hhb:100101001:0:2: +%2hhb:0B100101001:0:-1: +%*2hhb:0B100101001:0:-1: +%2hhb:0b100101001:0:-1: +%*2hhb:0b100101001:0:-1: +%2hhb:+0:1:2:0: +%*2hhb:+0:0:2: +%2hhb:+0B0:1:2:0: +%*2hhb:+0B0:0:2: +%2hhb:+0b0:1:2:0: +%*2hhb:+0b0:0:2: +%2hhb:+1:1:2:1: +%*2hhb:+1:0:2: +%2hhb:+0B1:1:2:0: +%*2hhb:+0B1:0:2: +%2hhb:+0b1:1:2:0: +%*2hhb:+0b1:0:2: +%2hhb:+101010:1:2:1: +%*2hhb:+101010:0:2: +%2hhb:+0B101010:1:2:0: +%*2hhb:+0B101010:0:2: +%2hhb:+0b101010:1:2:0: +%*2hhb:+0b101010:0:2: +%2hhb:+11111111:1:2:1: +%*2hhb:+11111111:0:2: +%2hhb:+0B11111111:1:2:0: +%*2hhb:+0B11111111:0:2: +%2hhb:+0b11111111:1:2:0: +%*2hhb:+0b11111111:0:2: +%2hhb:+100000000:1:2:1: +%*2hhb:+100000000:0:2: +%2hhb:+0B100000000:1:2:0: +%*2hhb:+0B100000000:0:2: +%2hhb:+0b100000000:1:2:0: +%*2hhb:+0b100000000:0:2: +%2hhb:+100101001:1:2:1: +%*2hhb:+100101001:0:2: +%2hhb:+0B100101001:1:2:0: +%*2hhb:+0B100101001:0:2: +%2hhb:+0b100101001:1:2:0: +%*2hhb:+0b100101001:0:2: +%3hhb::0:-1: +%*3hhb::0:-1: +%3hhb:-1111011:1:3:253: +%*3hhb:-1111011:0:3: +%3hhb:-0B1111011:0:-1: +%*3hhb:-0B1111011:0:-1: +%3hhb:-0b1111011:0:-1: +%*3hhb:-0b1111011:0:-1: +%3hhb:-1:1:2:255: +%*3hhb:-1:0:2: +%3hhb:-0B1:0:-1: +%*3hhb:-0B1:0:-1: +%3hhb:-0b1:0:-1: +%*3hhb:-0b1:0:-1: +%3hhb:-0:1:2:0: +%*3hhb:-0:0:2: +%3hhb:-0B0:0:-1: +%*3hhb:-0B0:0:-1: +%3hhb:-0b0:0:-1: +%*3hhb:-0b0:0:-1: +%3hhb:0:1:1:0: +%*3hhb:0:0:1: +%3hhb:0B0:1:3:0: +%*3hhb:0B0:0:3: +%3hhb:0b0:1:3:0: +%*3hhb:0b0:0:3: +%3hhb:1:1:1:1: +%*3hhb:1:0:1: +%3hhb:0B1:1:3:1: +%*3hhb:0B1:0:3: +%3hhb:0b1:1:3:1: +%*3hhb:0b1:0:3: +%3hhb:101010:1:3:5: +%*3hhb:101010:0:3: +%3hhb:0B101010:1:3:1: +%*3hhb:0B101010:0:3: +%3hhb:0b101010:1:3:1: +%*3hhb:0b101010:0:3: +%3hhb:11111111:1:3:7: +%*3hhb:11111111:0:3: +%3hhb:0B11111111:1:3:1: +%*3hhb:0B11111111:0:3: +%3hhb:0b11111111:1:3:1: +%*3hhb:0b11111111:0:3: +%3hhb:100000000:1:3:4: +%*3hhb:100000000:0:3: +%3hhb:0B100000000:1:3:1: +%*3hhb:0B100000000:0:3: +%3hhb:0b100000000:1:3:1: +%*3hhb:0b100000000:0:3: +%3hhb:100101001:1:3:4: +%*3hhb:100101001:0:3: +%3hhb:0B100101001:1:3:1: +%*3hhb:0B100101001:0:3: +%3hhb:0b100101001:1:3:1: +%*3hhb:0b100101001:0:3: +%3hhb:+0:1:2:0: +%*3hhb:+0:0:2: +%3hhb:+0B0:0:-1: +%*3hhb:+0B0:0:-1: +%3hhb:+0b0:0:-1: +%*3hhb:+0b0:0:-1: +%3hhb:+1:1:2:1: +%*3hhb:+1:0:2: +%3hhb:+0B1:0:-1: +%*3hhb:+0B1:0:-1: +%3hhb:+0b1:0:-1: +%*3hhb:+0b1:0:-1: +%3hhb:+101010:1:3:2: +%*3hhb:+101010:0:3: +%3hhb:+0B101010:0:-1: +%*3hhb:+0B101010:0:-1: +%3hhb:+0b101010:0:-1: +%*3hhb:+0b101010:0:-1: +%3hhb:+11111111:1:3:3: +%*3hhb:+11111111:0:3: +%3hhb:+0B11111111:0:-1: +%*3hhb:+0B11111111:0:-1: +%3hhb:+0b11111111:0:-1: +%*3hhb:+0b11111111:0:-1: +%3hhb:+100000000:1:3:2: +%*3hhb:+100000000:0:3: +%3hhb:+0B100000000:0:-1: +%*3hhb:+0B100000000:0:-1: +%3hhb:+0b100000000:0:-1: +%*3hhb:+0b100000000:0:-1: +%3hhb:+100101001:1:3:2: +%*3hhb:+100101001:0:3: +%3hhb:+0B100101001:0:-1: +%*3hhb:+0B100101001:0:-1: +%3hhb:+0b100101001:0:-1: +%*3hhb:+0b100101001:0:-1: +%5hhb::0:-1: +%*5hhb::0:-1: +%5hhb:-1111011:1:5:241: +%*5hhb:-1111011:0:5: +%5hhb:-0B1111011:1:5:253: +%*5hhb:-0B1111011:0:5: +%5hhb:-0b1111011:1:5:253: +%*5hhb:-0b1111011:0:5: +%5hhb:-1:1:2:255: +%*5hhb:-1:0:2: +%5hhb:-0B1:1:4:255: +%*5hhb:-0B1:0:4: +%5hhb:-0b1:1:4:255: +%*5hhb:-0b1:0:4: +%5hhb:-0:1:2:0: +%*5hhb:-0:0:2: +%5hhb:-0B0:1:4:0: +%*5hhb:-0B0:0:4: +%5hhb:-0b0:1:4:0: +%*5hhb:-0b0:0:4: +%5hhb:0:1:1:0: +%*5hhb:0:0:1: +%5hhb:0B0:1:3:0: +%*5hhb:0B0:0:3: +%5hhb:0b0:1:3:0: +%*5hhb:0b0:0:3: +%5hhb:1:1:1:1: +%*5hhb:1:0:1: +%5hhb:0B1:1:3:1: +%*5hhb:0B1:0:3: +%5hhb:0b1:1:3:1: +%*5hhb:0b1:0:3: +%5hhb:101010:1:5:21: +%*5hhb:101010:0:5: +%5hhb:0B101010:1:5:5: +%*5hhb:0B101010:0:5: +%5hhb:0b101010:1:5:5: +%*5hhb:0b101010:0:5: +%5hhb:11111111:1:5:31: +%*5hhb:11111111:0:5: +%5hhb:0B11111111:1:5:7: +%*5hhb:0B11111111:0:5: +%5hhb:0b11111111:1:5:7: +%*5hhb:0b11111111:0:5: +%5hhb:100000000:1:5:16: +%*5hhb:100000000:0:5: +%5hhb:0B100000000:1:5:4: +%*5hhb:0B100000000:0:5: +%5hhb:0b100000000:1:5:4: +%*5hhb:0b100000000:0:5: +%5hhb:100101001:1:5:18: +%*5hhb:100101001:0:5: +%5hhb:0B100101001:1:5:4: +%*5hhb:0B100101001:0:5: +%5hhb:0b100101001:1:5:4: +%*5hhb:0b100101001:0:5: +%5hhb:+0:1:2:0: +%*5hhb:+0:0:2: +%5hhb:+0B0:1:4:0: +%*5hhb:+0B0:0:4: +%5hhb:+0b0:1:4:0: +%*5hhb:+0b0:0:4: +%5hhb:+1:1:2:1: +%*5hhb:+1:0:2: +%5hhb:+0B1:1:4:1: +%*5hhb:+0B1:0:4: +%5hhb:+0b1:1:4:1: +%*5hhb:+0b1:0:4: +%5hhb:+101010:1:5:10: +%*5hhb:+101010:0:5: +%5hhb:+0B101010:1:5:2: +%*5hhb:+0B101010:0:5: +%5hhb:+0b101010:1:5:2: +%*5hhb:+0b101010:0:5: +%5hhb:+11111111:1:5:15: +%*5hhb:+11111111:0:5: +%5hhb:+0B11111111:1:5:3: +%*5hhb:+0B11111111:0:5: +%5hhb:+0b11111111:1:5:3: +%*5hhb:+0b11111111:0:5: +%5hhb:+100000000:1:5:8: +%*5hhb:+100000000:0:5: +%5hhb:+0B100000000:1:5:2: +%*5hhb:+0B100000000:0:5: +%5hhb:+0b100000000:1:5:2: +%*5hhb:+0b100000000:0:5: +%5hhb:+100101001:1:5:9: +%*5hhb:+100101001:0:5: +%5hhb:+0B100101001:1:5:2: +%*5hhb:+0B100101001:0:5: +%5hhb:+0b100101001:1:5:2: +%*5hhb:+0b100101001:0:5: +%2hhb: :0:-1: +%*2hhb: :0:-1: +%2hhb: -1111011:1:3:255: +%*2hhb: -1111011:0:3: +%2hhb: -0B1111011:1:3:0: +%*2hhb: -0B1111011:0:3: +%2hhb: -0b1111011:1:3:0: +%*2hhb: -0b1111011:0:3: +%2hhb: -1:1:3:255: +%*2hhb: -1:0:3: +%2hhb: -0B1:1:3:0: +%*2hhb: -0B1:0:3: +%2hhb: -0b1:1:3:0: +%*2hhb: -0b1:0:3: +%2hhb: -0:1:3:0: +%*2hhb: -0:0:3: +%2hhb: -0B0:1:3:0: +%*2hhb: -0B0:0:3: +%2hhb: -0b0:1:3:0: +%*2hhb: -0b0:0:3: +%2hhb: 0:1:2:0: +%*2hhb: 0:0:2: +%2hhb: 0B0:0:-1: +%*2hhb: 0B0:0:-1: +%2hhb: 0b0:0:-1: +%*2hhb: 0b0:0:-1: +%2hhb: 1:1:2:1: +%*2hhb: 1:0:2: +%2hhb: 0B1:0:-1: +%*2hhb: 0B1:0:-1: +%2hhb: 0b1:0:-1: +%*2hhb: 0b1:0:-1: +%2hhb: 101010:1:3:2: +%*2hhb: 101010:0:3: +%2hhb: 0B101010:0:-1: +%*2hhb: 0B101010:0:-1: +%2hhb: 0b101010:0:-1: +%*2hhb: 0b101010:0:-1: +%2hhb: 11111111:1:3:3: +%*2hhb: 11111111:0:3: +%2hhb: 0B11111111:0:-1: +%*2hhb: 0B11111111:0:-1: +%2hhb: 0b11111111:0:-1: +%*2hhb: 0b11111111:0:-1: +%2hhb: 100000000:1:3:2: +%*2hhb: 100000000:0:3: +%2hhb: 0B100000000:0:-1: +%*2hhb: 0B100000000:0:-1: +%2hhb: 0b100000000:0:-1: +%*2hhb: 0b100000000:0:-1: +%2hhb: 100101001:1:3:2: +%*2hhb: 100101001:0:3: +%2hhb: 0B100101001:0:-1: +%*2hhb: 0B100101001:0:-1: +%2hhb: 0b100101001:0:-1: +%*2hhb: 0b100101001:0:-1: +%2hhb: +0:1:3:0: +%*2hhb: +0:0:3: +%2hhb: +0B0:1:3:0: +%*2hhb: +0B0:0:3: +%2hhb: +0b0:1:3:0: +%*2hhb: +0b0:0:3: +%2hhb: +1:1:3:1: +%*2hhb: +1:0:3: +%2hhb: +0B1:1:3:0: +%*2hhb: +0B1:0:3: +%2hhb: +0b1:1:3:0: +%*2hhb: +0b1:0:3: +%2hhb: +101010:1:3:1: +%*2hhb: +101010:0:3: +%2hhb: +0B101010:1:3:0: +%*2hhb: +0B101010:0:3: +%2hhb: +0b101010:1:3:0: +%*2hhb: +0b101010:0:3: +%2hhb: +11111111:1:3:1: +%*2hhb: +11111111:0:3: +%2hhb: +0B11111111:1:3:0: +%*2hhb: +0B11111111:0:3: +%2hhb: +0b11111111:1:3:0: +%*2hhb: +0b11111111:0:3: +%2hhb: +100000000:1:3:1: +%*2hhb: +100000000:0:3: +%2hhb: +0B100000000:1:3:0: +%*2hhb: +0B100000000:0:3: +%2hhb: +0b100000000:1:3:0: +%*2hhb: +0b100000000:0:3: +%2hhb: +100101001:1:3:1: +%*2hhb: +100101001:0:3: +%2hhb: +0B100101001:1:3:0: +%*2hhb: +0B100101001:0:3: +%2hhb: +0b100101001:1:3:0: +%*2hhb: +0b100101001:0:3: +%5hhb: :0:-1: +%*5hhb: :0:-1: +%5hhb: -1111011:1:6:241: +%*5hhb: -1111011:0:6: +%5hhb: -0B1111011:1:6:253: +%*5hhb: -0B1111011:0:6: +%5hhb: -0b1111011:1:6:253: +%*5hhb: -0b1111011:0:6: +%5hhb: -1:1:3:255: +%*5hhb: -1:0:3: +%5hhb: -0B1:1:5:255: +%*5hhb: -0B1:0:5: +%5hhb: -0b1:1:5:255: +%*5hhb: -0b1:0:5: +%5hhb: -0:1:3:0: +%*5hhb: -0:0:3: +%5hhb: -0B0:1:5:0: +%*5hhb: -0B0:0:5: +%5hhb: -0b0:1:5:0: +%*5hhb: -0b0:0:5: +%5hhb: 0:1:2:0: +%*5hhb: 0:0:2: +%5hhb: 0B0:1:4:0: +%*5hhb: 0B0:0:4: +%5hhb: 0b0:1:4:0: +%*5hhb: 0b0:0:4: +%5hhb: 1:1:2:1: +%*5hhb: 1:0:2: +%5hhb: 0B1:1:4:1: +%*5hhb: 0B1:0:4: +%5hhb: 0b1:1:4:1: +%*5hhb: 0b1:0:4: +%5hhb: 101010:1:6:21: +%*5hhb: 101010:0:6: +%5hhb: 0B101010:1:6:5: +%*5hhb: 0B101010:0:6: +%5hhb: 0b101010:1:6:5: +%*5hhb: 0b101010:0:6: +%5hhb: 11111111:1:6:31: +%*5hhb: 11111111:0:6: +%5hhb: 0B11111111:1:6:7: +%*5hhb: 0B11111111:0:6: +%5hhb: 0b11111111:1:6:7: +%*5hhb: 0b11111111:0:6: +%5hhb: 100000000:1:6:16: +%*5hhb: 100000000:0:6: +%5hhb: 0B100000000:1:6:4: +%*5hhb: 0B100000000:0:6: +%5hhb: 0b100000000:1:6:4: +%*5hhb: 0b100000000:0:6: +%5hhb: 100101001:1:6:18: +%*5hhb: 100101001:0:6: +%5hhb: 0B100101001:1:6:4: +%*5hhb: 0B100101001:0:6: +%5hhb: 0b100101001:1:6:4: +%*5hhb: 0b100101001:0:6: +%5hhb: +0:1:3:0: +%*5hhb: +0:0:3: +%5hhb: +0B0:1:5:0: +%*5hhb: +0B0:0:5: +%5hhb: +0b0:1:5:0: +%*5hhb: +0b0:0:5: +%5hhb: +1:1:3:1: +%*5hhb: +1:0:3: +%5hhb: +0B1:1:5:1: +%*5hhb: +0B1:0:5: +%5hhb: +0b1:1:5:1: +%*5hhb: +0b1:0:5: +%5hhb: +101010:1:6:10: +%*5hhb: +101010:0:6: +%5hhb: +0B101010:1:6:2: +%*5hhb: +0B101010:0:6: +%5hhb: +0b101010:1:6:2: +%*5hhb: +0b101010:0:6: +%5hhb: +11111111:1:6:15: +%*5hhb: +11111111:0:6: +%5hhb: +0B11111111:1:6:3: +%*5hhb: +0B11111111:0:6: +%5hhb: +0b11111111:1:6:3: +%*5hhb: +0b11111111:0:6: +%5hhb: +100000000:1:6:8: +%*5hhb: +100000000:0:6: +%5hhb: +0B100000000:1:6:2: +%*5hhb: +0B100000000:0:6: +%5hhb: +0b100000000:1:6:2: +%*5hhb: +0b100000000:0:6: +%5hhb: +100101001:1:6:9: +%*5hhb: +100101001:0:6: +%5hhb: +0B100101001:1:6:2: +%*5hhb: +0B100101001:0:6: +%5hhb: +0b100101001:1:6:2: +%*5hhb: +0b100101001:0:6: diff --git a/stdio-common/tst-scanf-format-uchar-o.input b/stdio-common/tst-scanf-format-uchar-o.input new file mode 100644 index 0000000..904665f --- /dev/null +++ b/stdio-common/tst-scanf-format-uchar-o.input @@ -0,0 +1,434 @@ +%hho::0:-1: +%*hho::0:-1: +%hho:-173:1:4:133: +%*hho:-173:0:4: +%hho:-0173:1:5:133: +%*hho:-0173:0:5: +%hho:-1:1:2:255: +%*hho:-1:0:2: +%hho:-01:1:3:255: +%*hho:-01:0:3: +%hho:-0:1:2:0: +%*hho:-0:0:2: +%hho:-00:1:3:0: +%*hho:-00:0:3: +%hho:0:1:1:0: +%*hho:0:0:1: +%hho:00:1:2:0: +%*hho:00:0:2: +%hho:1:1:1:1: +%*hho:1:0:1: +%hho:01:1:2:1: +%*hho:01:0:2: +%hho:52:1:2:42: +%*hho:52:0:2: +%hho:052:1:3:42: +%*hho:052:0:3: +%hho:377:1:3:255: +%*hho:377:0:3: +%hho:0377:1:4:255: +%*hho:0377:0:4: +%hho:400:1:3:0: +%*hho:400:0:3: +%hho:0400:1:4:0: +%*hho:0400:0:4: +%hho:451:1:3:41: +%*hho:451:0:3: +%hho:0451:1:4:41: +%*hho:0451:0:4: +%hho:+0:1:2:0: +%*hho:+0:0:2: +%hho:+00:1:3:0: +%*hho:+00:0:3: +%hho:+1:1:2:1: +%*hho:+1:0:2: +%hho:+01:1:3:1: +%*hho:+01:0:3: +%hho:+52:1:3:42: +%*hho:+52:0:3: +%hho:+052:1:4:42: +%*hho:+052:0:4: +%hho:+377:1:4:255: +%*hho:+377:0:4: +%hho:+0377:1:5:255: +%*hho:+0377:0:5: +%hho:+400:1:4:0: +%*hho:+400:0:4: +%hho:+0400:1:5:0: +%*hho:+0400:0:5: +%hho:+451:1:4:41: +%*hho:+451:0:4: +%hho:+0451:1:5:41: +%*hho:+0451:0:5: +%1hho::0:-1: +%*1hho::0:-1: +%1hho:-173:0:-1: +%*1hho:-173:0:-1: +%1hho:-0173:0:-1: +%*1hho:-0173:0:-1: +%1hho:-1:0:-1: +%*1hho:-1:0:-1: +%1hho:-01:0:-1: +%*1hho:-01:0:-1: +%1hho:-0:0:-1: +%*1hho:-0:0:-1: +%1hho:-00:0:-1: +%*1hho:-00:0:-1: +%1hho:0:1:1:0: +%*1hho:0:0:1: +%1hho:00:1:1:0: +%*1hho:00:0:1: +%1hho:1:1:1:1: +%*1hho:1:0:1: +%1hho:01:1:1:0: +%*1hho:01:0:1: +%1hho:52:1:1:5: +%*1hho:52:0:1: +%1hho:052:1:1:0: +%*1hho:052:0:1: +%1hho:377:1:1:3: +%*1hho:377:0:1: +%1hho:0377:1:1:0: +%*1hho:0377:0:1: +%1hho:400:1:1:4: +%*1hho:400:0:1: +%1hho:0400:1:1:0: +%*1hho:0400:0:1: +%1hho:451:1:1:4: +%*1hho:451:0:1: +%1hho:0451:1:1:0: +%*1hho:0451:0:1: +%1hho:+0:0:-1: +%*1hho:+0:0:-1: +%1hho:+00:0:-1: +%*1hho:+00:0:-1: +%1hho:+1:0:-1: +%*1hho:+1:0:-1: +%1hho:+01:0:-1: +%*1hho:+01:0:-1: +%1hho:+52:0:-1: +%*1hho:+52:0:-1: +%1hho:+052:0:-1: +%*1hho:+052:0:-1: +%1hho:+377:0:-1: +%*1hho:+377:0:-1: +%1hho:+0377:0:-1: +%*1hho:+0377:0:-1: +%1hho:+400:0:-1: +%*1hho:+400:0:-1: +%1hho:+0400:0:-1: +%*1hho:+0400:0:-1: +%1hho:+451:0:-1: +%*1hho:+451:0:-1: +%1hho:+0451:0:-1: +%*1hho:+0451:0:-1: +%2hho::0:-1: +%*2hho::0:-1: +%2hho:-173:1:2:255: +%*2hho:-173:0:2: +%2hho:-0173:1:2:0: +%*2hho:-0173:0:2: +%2hho:-1:1:2:255: +%*2hho:-1:0:2: +%2hho:-01:1:2:0: +%*2hho:-01:0:2: +%2hho:-0:1:2:0: +%*2hho:-0:0:2: +%2hho:-00:1:2:0: +%*2hho:-00:0:2: +%2hho:0:1:1:0: +%*2hho:0:0:1: +%2hho:00:1:2:0: +%*2hho:00:0:2: +%2hho:1:1:1:1: +%*2hho:1:0:1: +%2hho:01:1:2:1: +%*2hho:01:0:2: +%2hho:52:1:2:42: +%*2hho:52:0:2: +%2hho:052:1:2:5: +%*2hho:052:0:2: +%2hho:377:1:2:31: +%*2hho:377:0:2: +%2hho:0377:1:2:3: +%*2hho:0377:0:2: +%2hho:400:1:2:32: +%*2hho:400:0:2: +%2hho:0400:1:2:4: +%*2hho:0400:0:2: +%2hho:451:1:2:37: +%*2hho:451:0:2: +%2hho:0451:1:2:4: +%*2hho:0451:0:2: +%2hho:+0:1:2:0: +%*2hho:+0:0:2: +%2hho:+00:1:2:0: +%*2hho:+00:0:2: +%2hho:+1:1:2:1: +%*2hho:+1:0:2: +%2hho:+01:1:2:0: +%*2hho:+01:0:2: +%2hho:+52:1:2:5: +%*2hho:+52:0:2: +%2hho:+052:1:2:0: +%*2hho:+052:0:2: +%2hho:+377:1:2:3: +%*2hho:+377:0:2: +%2hho:+0377:1:2:0: +%*2hho:+0377:0:2: +%2hho:+400:1:2:4: +%*2hho:+400:0:2: +%2hho:+0400:1:2:0: +%*2hho:+0400:0:2: +%2hho:+451:1:2:4: +%*2hho:+451:0:2: +%2hho:+0451:1:2:0: +%*2hho:+0451:0:2: +%3hho::0:-1: +%*3hho::0:-1: +%3hho:-173:1:3:241: +%*3hho:-173:0:3: +%3hho:-0173:1:3:255: +%*3hho:-0173:0:3: +%3hho:-1:1:2:255: +%*3hho:-1:0:2: +%3hho:-01:1:3:255: +%*3hho:-01:0:3: +%3hho:-0:1:2:0: +%*3hho:-0:0:2: +%3hho:-00:1:3:0: +%*3hho:-00:0:3: +%3hho:0:1:1:0: +%*3hho:0:0:1: +%3hho:00:1:2:0: +%*3hho:00:0:2: +%3hho:1:1:1:1: +%*3hho:1:0:1: +%3hho:01:1:2:1: +%*3hho:01:0:2: +%3hho:52:1:2:42: +%*3hho:52:0:2: +%3hho:052:1:3:42: +%*3hho:052:0:3: +%3hho:377:1:3:255: +%*3hho:377:0:3: +%3hho:0377:1:3:31: +%*3hho:0377:0:3: +%3hho:400:1:3:0: +%*3hho:400:0:3: +%3hho:0400:1:3:32: +%*3hho:0400:0:3: +%3hho:451:1:3:41: +%*3hho:451:0:3: +%3hho:0451:1:3:37: +%*3hho:0451:0:3: +%3hho:+0:1:2:0: +%*3hho:+0:0:2: +%3hho:+00:1:3:0: +%*3hho:+00:0:3: +%3hho:+1:1:2:1: +%*3hho:+1:0:2: +%3hho:+01:1:3:1: +%*3hho:+01:0:3: +%3hho:+52:1:3:42: +%*3hho:+52:0:3: +%3hho:+052:1:3:5: +%*3hho:+052:0:3: +%3hho:+377:1:3:31: +%*3hho:+377:0:3: +%3hho:+0377:1:3:3: +%*3hho:+0377:0:3: +%3hho:+400:1:3:32: +%*3hho:+400:0:3: +%3hho:+0400:1:3:4: +%*3hho:+0400:0:3: +%3hho:+451:1:3:37: +%*3hho:+451:0:3: +%3hho:+0451:1:3:4: +%*3hho:+0451:0:3: +%5hho::0:-1: +%*5hho::0:-1: +%5hho:-173:1:4:133: +%*5hho:-173:0:4: +%5hho:-0173:1:5:133: +%*5hho:-0173:0:5: +%5hho:-1:1:2:255: +%*5hho:-1:0:2: +%5hho:-01:1:3:255: +%*5hho:-01:0:3: +%5hho:-0:1:2:0: +%*5hho:-0:0:2: +%5hho:-00:1:3:0: +%*5hho:-00:0:3: +%5hho:0:1:1:0: +%*5hho:0:0:1: +%5hho:00:1:2:0: +%*5hho:00:0:2: +%5hho:1:1:1:1: +%*5hho:1:0:1: +%5hho:01:1:2:1: +%*5hho:01:0:2: +%5hho:52:1:2:42: +%*5hho:52:0:2: +%5hho:052:1:3:42: +%*5hho:052:0:3: +%5hho:377:1:3:255: +%*5hho:377:0:3: +%5hho:0377:1:4:255: +%*5hho:0377:0:4: +%5hho:400:1:3:0: +%*5hho:400:0:3: +%5hho:0400:1:4:0: +%*5hho:0400:0:4: +%5hho:451:1:3:41: +%*5hho:451:0:3: +%5hho:0451:1:4:41: +%*5hho:0451:0:4: +%5hho:+0:1:2:0: +%*5hho:+0:0:2: +%5hho:+00:1:3:0: +%*5hho:+00:0:3: +%5hho:+1:1:2:1: +%*5hho:+1:0:2: +%5hho:+01:1:3:1: +%*5hho:+01:0:3: +%5hho:+52:1:3:42: +%*5hho:+52:0:3: +%5hho:+052:1:4:42: +%*5hho:+052:0:4: +%5hho:+377:1:4:255: +%*5hho:+377:0:4: +%5hho:+0377:1:5:255: +%*5hho:+0377:0:5: +%5hho:+400:1:4:0: +%*5hho:+400:0:4: +%5hho:+0400:1:5:0: +%*5hho:+0400:0:5: +%5hho:+451:1:4:41: +%*5hho:+451:0:4: +%5hho:+0451:1:5:41: +%*5hho:+0451:0:5: +%2hho: :0:-1: +%*2hho: :0:-1: +%2hho: -173:1:3:255: +%*2hho: -173:0:3: +%2hho: -0173:1:3:0: +%*2hho: -0173:0:3: +%2hho: -1:1:3:255: +%*2hho: -1:0:3: +%2hho: -01:1:3:0: +%*2hho: -01:0:3: +%2hho: -0:1:3:0: +%*2hho: -0:0:3: +%2hho: -00:1:3:0: +%*2hho: -00:0:3: +%2hho: 0:1:2:0: +%*2hho: 0:0:2: +%2hho: 00:1:3:0: +%*2hho: 00:0:3: +%2hho: 1:1:2:1: +%*2hho: 1:0:2: +%2hho: 01:1:3:1: +%*2hho: 01:0:3: +%2hho: 52:1:3:42: +%*2hho: 52:0:3: +%2hho: 052:1:3:5: +%*2hho: 052:0:3: +%2hho: 377:1:3:31: +%*2hho: 377:0:3: +%2hho: 0377:1:3:3: +%*2hho: 0377:0:3: +%2hho: 400:1:3:32: +%*2hho: 400:0:3: +%2hho: 0400:1:3:4: +%*2hho: 0400:0:3: +%2hho: 451:1:3:37: +%*2hho: 451:0:3: +%2hho: 0451:1:3:4: +%*2hho: 0451:0:3: +%2hho: +0:1:3:0: +%*2hho: +0:0:3: +%2hho: +00:1:3:0: +%*2hho: +00:0:3: +%2hho: +1:1:3:1: +%*2hho: +1:0:3: +%2hho: +01:1:3:0: +%*2hho: +01:0:3: +%2hho: +52:1:3:5: +%*2hho: +52:0:3: +%2hho: +052:1:3:0: +%*2hho: +052:0:3: +%2hho: +377:1:3:3: +%*2hho: +377:0:3: +%2hho: +0377:1:3:0: +%*2hho: +0377:0:3: +%2hho: +400:1:3:4: +%*2hho: +400:0:3: +%2hho: +0400:1:3:0: +%*2hho: +0400:0:3: +%2hho: +451:1:3:4: +%*2hho: +451:0:3: +%2hho: +0451:1:3:0: +%*2hho: +0451:0:3: +%5hho: :0:-1: +%*5hho: :0:-1: +%5hho: -173:1:5:133: +%*5hho: -173:0:5: +%5hho: -0173:1:6:133: +%*5hho: -0173:0:6: +%5hho: -1:1:3:255: +%*5hho: -1:0:3: +%5hho: -01:1:4:255: +%*5hho: -01:0:4: +%5hho: -0:1:3:0: +%*5hho: -0:0:3: +%5hho: -00:1:4:0: +%*5hho: -00:0:4: +%5hho: 0:1:2:0: +%*5hho: 0:0:2: +%5hho: 00:1:3:0: +%*5hho: 00:0:3: +%5hho: 1:1:2:1: +%*5hho: 1:0:2: +%5hho: 01:1:3:1: +%*5hho: 01:0:3: +%5hho: 52:1:3:42: +%*5hho: 52:0:3: +%5hho: 052:1:4:42: +%*5hho: 052:0:4: +%5hho: 377:1:4:255: +%*5hho: 377:0:4: +%5hho: 0377:1:5:255: +%*5hho: 0377:0:5: +%5hho: 400:1:4:0: +%*5hho: 400:0:4: +%5hho: 0400:1:5:0: +%*5hho: 0400:0:5: +%5hho: 451:1:4:41: +%*5hho: 451:0:4: +%5hho: 0451:1:5:41: +%*5hho: 0451:0:5: +%5hho: +0:1:3:0: +%*5hho: +0:0:3: +%5hho: +00:1:4:0: +%*5hho: +00:0:4: +%5hho: +1:1:3:1: +%*5hho: +1:0:3: +%5hho: +01:1:4:1: +%*5hho: +01:0:4: +%5hho: +52:1:4:42: +%*5hho: +52:0:4: +%5hho: +052:1:5:42: +%*5hho: +052:0:5: +%5hho: +377:1:5:255: +%*5hho: +377:0:5: +%5hho: +0377:1:6:255: +%*5hho: +0377:0:6: +%5hho: +400:1:5:0: +%*5hho: +400:0:5: +%5hho: +0400:1:6:0: +%*5hho: +0400:0:6: +%5hho: +451:1:5:41: +%*5hho: +451:0:5: +%5hho: +0451:1:6:41: +%*5hho: +0451:0:6: diff --git a/stdio-common/tst-scanf-format-uchar-u.input b/stdio-common/tst-scanf-format-uchar-u.input new file mode 100644 index 0000000..f392aa5 --- /dev/null +++ b/stdio-common/tst-scanf-format-uchar-u.input @@ -0,0 +1,224 @@ +%hhu::0:-1: +%*hhu::0:-1: +%hhu:-123:1:4:133: +%*hhu:-123:0:4: +%hhu:-1:1:2:255: +%*hhu:-1:0:2: +%hhu:-0:1:2:0: +%*hhu:-0:0:2: +%hhu:0:1:1:0: +%*hhu:0:0:1: +%hhu:1:1:1:1: +%*hhu:1:0:1: +%hhu:42:1:2:42: +%*hhu:42:0:2: +%hhu:255:1:3:255: +%*hhu:255:0:3: +%hhu:256:1:3:0: +%*hhu:256:0:3: +%hhu:297:1:3:41: +%*hhu:297:0:3: +%hhu:+0:1:2:0: +%*hhu:+0:0:2: +%hhu:+1:1:2:1: +%*hhu:+1:0:2: +%hhu:+42:1:3:42: +%*hhu:+42:0:3: +%hhu:+255:1:4:255: +%*hhu:+255:0:4: +%hhu:+256:1:4:0: +%*hhu:+256:0:4: +%hhu:+297:1:4:41: +%*hhu:+297:0:4: +%1hhu::0:-1: +%*1hhu::0:-1: +%1hhu:-123:0:-1: +%*1hhu:-123:0:-1: +%1hhu:-1:0:-1: +%*1hhu:-1:0:-1: +%1hhu:-0:0:-1: +%*1hhu:-0:0:-1: +%1hhu:0:1:1:0: +%*1hhu:0:0:1: +%1hhu:1:1:1:1: +%*1hhu:1:0:1: +%1hhu:42:1:1:4: +%*1hhu:42:0:1: +%1hhu:255:1:1:2: +%*1hhu:255:0:1: +%1hhu:256:1:1:2: +%*1hhu:256:0:1: +%1hhu:297:1:1:2: +%*1hhu:297:0:1: +%1hhu:+0:0:-1: +%*1hhu:+0:0:-1: +%1hhu:+1:0:-1: +%*1hhu:+1:0:-1: +%1hhu:+42:0:-1: +%*1hhu:+42:0:-1: +%1hhu:+255:0:-1: +%*1hhu:+255:0:-1: +%1hhu:+256:0:-1: +%*1hhu:+256:0:-1: +%1hhu:+297:0:-1: +%*1hhu:+297:0:-1: +%2hhu::0:-1: +%*2hhu::0:-1: +%2hhu:-123:1:2:255: +%*2hhu:-123:0:2: +%2hhu:-1:1:2:255: +%*2hhu:-1:0:2: +%2hhu:-0:1:2:0: +%*2hhu:-0:0:2: +%2hhu:0:1:1:0: +%*2hhu:0:0:1: +%2hhu:1:1:1:1: +%*2hhu:1:0:1: +%2hhu:42:1:2:42: +%*2hhu:42:0:2: +%2hhu:255:1:2:25: +%*2hhu:255:0:2: +%2hhu:256:1:2:25: +%*2hhu:256:0:2: +%2hhu:297:1:2:29: +%*2hhu:297:0:2: +%2hhu:+0:1:2:0: +%*2hhu:+0:0:2: +%2hhu:+1:1:2:1: +%*2hhu:+1:0:2: +%2hhu:+42:1:2:4: +%*2hhu:+42:0:2: +%2hhu:+255:1:2:2: +%*2hhu:+255:0:2: +%2hhu:+256:1:2:2: +%*2hhu:+256:0:2: +%2hhu:+297:1:2:2: +%*2hhu:+297:0:2: +%3hhu::0:-1: +%*3hhu::0:-1: +%3hhu:-123:1:3:244: +%*3hhu:-123:0:3: +%3hhu:-1:1:2:255: +%*3hhu:-1:0:2: +%3hhu:-0:1:2:0: +%*3hhu:-0:0:2: +%3hhu:0:1:1:0: +%*3hhu:0:0:1: +%3hhu:1:1:1:1: +%*3hhu:1:0:1: +%3hhu:42:1:2:42: +%*3hhu:42:0:2: +%3hhu:255:1:3:255: +%*3hhu:255:0:3: +%3hhu:256:1:3:0: +%*3hhu:256:0:3: +%3hhu:297:1:3:41: +%*3hhu:297:0:3: +%3hhu:+0:1:2:0: +%*3hhu:+0:0:2: +%3hhu:+1:1:2:1: +%*3hhu:+1:0:2: +%3hhu:+42:1:3:42: +%*3hhu:+42:0:3: +%3hhu:+255:1:3:25: +%*3hhu:+255:0:3: +%3hhu:+256:1:3:25: +%*3hhu:+256:0:3: +%3hhu:+297:1:3:29: +%*3hhu:+297:0:3: +%5hhu::0:-1: +%*5hhu::0:-1: +%5hhu:-123:1:4:133: +%*5hhu:-123:0:4: +%5hhu:-1:1:2:255: +%*5hhu:-1:0:2: +%5hhu:-0:1:2:0: +%*5hhu:-0:0:2: +%5hhu:0:1:1:0: +%*5hhu:0:0:1: +%5hhu:1:1:1:1: +%*5hhu:1:0:1: +%5hhu:42:1:2:42: +%*5hhu:42:0:2: +%5hhu:255:1:3:255: +%*5hhu:255:0:3: +%5hhu:256:1:3:0: +%*5hhu:256:0:3: +%5hhu:297:1:3:41: +%*5hhu:297:0:3: +%5hhu:+0:1:2:0: +%*5hhu:+0:0:2: +%5hhu:+1:1:2:1: +%*5hhu:+1:0:2: +%5hhu:+42:1:3:42: +%*5hhu:+42:0:3: +%5hhu:+255:1:4:255: +%*5hhu:+255:0:4: +%5hhu:+256:1:4:0: +%*5hhu:+256:0:4: +%5hhu:+297:1:4:41: +%*5hhu:+297:0:4: +%2hhu: :0:-1: +%*2hhu: :0:-1: +%2hhu: -123:1:3:255: +%*2hhu: -123:0:3: +%2hhu: -1:1:3:255: +%*2hhu: -1:0:3: +%2hhu: -0:1:3:0: +%*2hhu: -0:0:3: +%2hhu: 0:1:2:0: +%*2hhu: 0:0:2: +%2hhu: 1:1:2:1: +%*2hhu: 1:0:2: +%2hhu: 42:1:3:42: +%*2hhu: 42:0:3: +%2hhu: 255:1:3:25: +%*2hhu: 255:0:3: +%2hhu: 256:1:3:25: +%*2hhu: 256:0:3: +%2hhu: 297:1:3:29: +%*2hhu: 297:0:3: +%2hhu: +0:1:3:0: +%*2hhu: +0:0:3: +%2hhu: +1:1:3:1: +%*2hhu: +1:0:3: +%2hhu: +42:1:3:4: +%*2hhu: +42:0:3: +%2hhu: +255:1:3:2: +%*2hhu: +255:0:3: +%2hhu: +256:1:3:2: +%*2hhu: +256:0:3: +%2hhu: +297:1:3:2: +%*2hhu: +297:0:3: +%5hhu: :0:-1: +%*5hhu: :0:-1: +%5hhu: -123:1:5:133: +%*5hhu: -123:0:5: +%5hhu: -1:1:3:255: +%*5hhu: -1:0:3: +%5hhu: -0:1:3:0: +%*5hhu: -0:0:3: +%5hhu: 0:1:2:0: +%*5hhu: 0:0:2: +%5hhu: 1:1:2:1: +%*5hhu: 1:0:2: +%5hhu: 42:1:3:42: +%*5hhu: 42:0:3: +%5hhu: 255:1:4:255: +%*5hhu: 255:0:4: +%5hhu: 256:1:4:0: +%*5hhu: 256:0:4: +%5hhu: 297:1:4:41: +%*5hhu: 297:0:4: +%5hhu: +0:1:3:0: +%*5hhu: +0:0:3: +%5hhu: +1:1:3:1: +%*5hhu: +1:0:3: +%5hhu: +42:1:4:42: +%*5hhu: +42:0:4: +%5hhu: +255:1:5:255: +%*5hhu: +255:0:5: +%5hhu: +256:1:5:0: +%*5hhu: +256:0:5: +%5hhu: +297:1:5:41: +%*5hhu: +297:0:5: diff --git a/stdio-common/tst-scanf-format-uchar-x.input b/stdio-common/tst-scanf-format-uchar-x.input new file mode 100644 index 0000000..a1fd9a9 --- /dev/null +++ b/stdio-common/tst-scanf-format-uchar-x.input @@ -0,0 +1,710 @@ +%hhx::0:-1: +%*hhx::0:-1: +%hhx:-7b:1:3:133: +%*hhx:-7b:0:3: +%hhx:-7B:1:3:133: +%*hhx:-7B:0:3: +%hhx:-0X7b:1:5:133: +%*hhx:-0X7b:0:5: +%hhx:-0x7B:1:5:133: +%*hhx:-0x7B:0:5: +%hhx:-1:1:2:255: +%*hhx:-1:0:2: +%hhx:-0X1:1:4:255: +%*hhx:-0X1:0:4: +%hhx:-0x1:1:4:255: +%*hhx:-0x1:0:4: +%hhx:-0:1:2:0: +%*hhx:-0:0:2: +%hhx:-0X0:1:4:0: +%*hhx:-0X0:0:4: +%hhx:-0x0:1:4:0: +%*hhx:-0x0:0:4: +%hhx:0:1:1:0: +%*hhx:0:0:1: +%hhx:0X0:1:3:0: +%*hhx:0X0:0:3: +%hhx:0x0:1:3:0: +%*hhx:0x0:0:3: +%hhx:1:1:1:1: +%*hhx:1:0:1: +%hhx:0X1:1:3:1: +%*hhx:0X1:0:3: +%hhx:0x1:1:3:1: +%*hhx:0x1:0:3: +%hhx:2a:1:2:42: +%*hhx:2a:0:2: +%hhx:2A:1:2:42: +%*hhx:2A:0:2: +%hhx:0X2a:1:4:42: +%*hhx:0X2a:0:4: +%hhx:0x2A:1:4:42: +%*hhx:0x2A:0:4: +%hhx:ff:1:2:255: +%*hhx:ff:0:2: +%hhx:FF:1:2:255: +%*hhx:FF:0:2: +%hhx:0xFF:1:4:255: +%*hhx:0xFF:0:4: +%hhx:100:1:3:0: +%*hhx:100:0:3: +%hhx:0X100:1:5:0: +%*hhx:0X100:0:5: +%hhx:0x100:1:5:0: +%*hhx:0x100:0:5: +%hhx:129:1:3:41: +%*hhx:129:0:3: +%hhx:0X129:1:5:41: +%*hhx:0X129:0:5: +%hhx:0x129:1:5:41: +%*hhx:0x129:0:5: +%hhx:+0:1:2:0: +%*hhx:+0:0:2: +%hhx:+0X0:1:4:0: +%*hhx:+0X0:0:4: +%hhx:+0x0:1:4:0: +%*hhx:+0x0:0:4: +%hhx:+1:1:2:1: +%*hhx:+1:0:2: +%hhx:+0X1:1:4:1: +%*hhx:+0X1:0:4: +%hhx:+0x1:1:4:1: +%*hhx:+0x1:0:4: +%hhx:+2a:1:3:42: +%*hhx:+2a:0:3: +%hhx:+2A:1:3:42: +%*hhx:+2A:0:3: +%hhx:+0X2a:1:5:42: +%*hhx:+0X2a:0:5: +%hhx:+0x2A:1:5:42: +%*hhx:+0x2A:0:5: +%hhx:+ff:1:3:255: +%*hhx:+ff:0:3: +%hhx:+FF:1:3:255: +%*hhx:+FF:0:3: +%hhx:+0Xff:1:5:255: +%*hhx:+0Xff:0:5: +%hhx:+0xFF:1:5:255: +%*hhx:+0xFF:0:5: +%hhx:+100:1:4:0: +%*hhx:+100:0:4: +%hhx:+0X100:1:6:0: +%*hhx:+0X100:0:6: +%hhx:+0x100:1:6:0: +%*hhx:+0x100:0:6: +%hhx:+129:1:4:41: +%*hhx:+129:0:4: +%hhx:+0X129:1:6:41: +%*hhx:+0X129:0:6: +%hhx:+0x129:1:6:41: +%*hhx:+0x129:0:6: +%1hhx::0:-1: +%*1hhx::0:-1: +%1hhx:-7b:0:-1: +%*1hhx:-7b:0:-1: +%1hhx:-7B:0:-1: +%*1hhx:-7B:0:-1: +%1hhx:-0X7b:0:-1: +%*1hhx:-0X7b:0:-1: +%1hhx:-0x7B:0:-1: +%*1hhx:-0x7B:0:-1: +%1hhx:-1:0:-1: +%*1hhx:-1:0:-1: +%1hhx:-0X1:0:-1: +%*1hhx:-0X1:0:-1: +%1hhx:-0x1:0:-1: +%*1hhx:-0x1:0:-1: +%1hhx:-0:0:-1: +%*1hhx:-0:0:-1: +%1hhx:-0X0:0:-1: +%*1hhx:-0X0:0:-1: +%1hhx:-0x0:0:-1: +%*1hhx:-0x0:0:-1: +%1hhx:0:1:1:0: +%*1hhx:0:0:1: +%1hhx:0X0:1:1:0: +%*1hhx:0X0:0:1: +%1hhx:0x0:1:1:0: +%*1hhx:0x0:0:1: +%1hhx:1:1:1:1: +%*1hhx:1:0:1: +%1hhx:0X1:1:1:0: +%*1hhx:0X1:0:1: +%1hhx:0x1:1:1:0: +%*1hhx:0x1:0:1: +%1hhx:2a:1:1:2: +%*1hhx:2a:0:1: +%1hhx:2A:1:1:2: +%*1hhx:2A:0:1: +%1hhx:0X2a:1:1:0: +%*1hhx:0X2a:0:1: +%1hhx:0x2A:1:1:0: +%*1hhx:0x2A:0:1: +%1hhx:ff:1:1:15: +%*1hhx:ff:0:1: +%1hhx:FF:1:1:15: +%*1hhx:FF:0:1: +%1hhx:0xFF:1:1:0: +%*1hhx:0xFF:0:1: +%1hhx:100:1:1:1: +%*1hhx:100:0:1: +%1hhx:0X100:1:1:0: +%*1hhx:0X100:0:1: +%1hhx:0x100:1:1:0: +%*1hhx:0x100:0:1: +%1hhx:129:1:1:1: +%*1hhx:129:0:1: +%1hhx:0X129:1:1:0: +%*1hhx:0X129:0:1: +%1hhx:0x129:1:1:0: +%*1hhx:0x129:0:1: +%1hhx:+0:0:-1: +%*1hhx:+0:0:-1: +%1hhx:+0X0:0:-1: +%*1hhx:+0X0:0:-1: +%1hhx:+0x0:0:-1: +%*1hhx:+0x0:0:-1: +%1hhx:+1:0:-1: +%*1hhx:+1:0:-1: +%1hhx:+0X1:0:-1: +%*1hhx:+0X1:0:-1: +%1hhx:+0x1:0:-1: +%*1hhx:+0x1:0:-1: +%1hhx:+2a:0:-1: +%*1hhx:+2a:0:-1: +%1hhx:+2A:0:-1: +%*1hhx:+2A:0:-1: +%1hhx:+0X2a:0:-1: +%*1hhx:+0X2a:0:-1: +%1hhx:+0x2A:0:-1: +%*1hhx:+0x2A:0:-1: +%1hhx:+ff:0:-1: +%*1hhx:+ff:0:-1: +%1hhx:+FF:0:-1: +%*1hhx:+FF:0:-1: +%1hhx:+0Xff:0:-1: +%*1hhx:+0Xff:0:-1: +%1hhx:+0xFF:0:-1: +%*1hhx:+0xFF:0:-1: +%1hhx:+100:0:-1: +%*1hhx:+100:0:-1: +%1hhx:+0X100:0:-1: +%*1hhx:+0X100:0:-1: +%1hhx:+0x100:0:-1: +%*1hhx:+0x100:0:-1: +%1hhx:+129:0:-1: +%*1hhx:+129:0:-1: +%1hhx:+0X129:0:-1: +%*1hhx:+0X129:0:-1: +%1hhx:+0x129:0:-1: +%*1hhx:+0x129:0:-1: +%2hhx::0:-1: +%*2hhx::0:-1: +%2hhx:-7b:1:2:249: +%*2hhx:-7b:0:2: +%2hhx:-7B:1:2:249: +%*2hhx:-7B:0:2: +%2hhx:-0X7b:1:2:0: +%*2hhx:-0X7b:0:2: +%2hhx:-0x7B:1:2:0: +%*2hhx:-0x7B:0:2: +%2hhx:-1:1:2:255: +%*2hhx:-1:0:2: +%2hhx:-0X1:1:2:0: +%*2hhx:-0X1:0:2: +%2hhx:-0x1:1:2:0: +%*2hhx:-0x1:0:2: +%2hhx:-0:1:2:0: +%*2hhx:-0:0:2: +%2hhx:-0X0:1:2:0: +%*2hhx:-0X0:0:2: +%2hhx:-0x0:1:2:0: +%*2hhx:-0x0:0:2: +%2hhx:0:1:1:0: +%*2hhx:0:0:1: +%2hhx:0X0:0:-1: +%*2hhx:0X0:0:-1: +%2hhx:0x0:0:-1: +%*2hhx:0x0:0:-1: +%2hhx:1:1:1:1: +%*2hhx:1:0:1: +%2hhx:0X1:0:-1: +%*2hhx:0X1:0:-1: +%2hhx:0x1:0:-1: +%*2hhx:0x1:0:-1: +%2hhx:2a:1:2:42: +%*2hhx:2a:0:2: +%2hhx:2A:1:2:42: +%*2hhx:2A:0:2: +%2hhx:0X2a:0:-1: +%*2hhx:0X2a:0:-1: +%2hhx:0x2A:0:-1: +%*2hhx:0x2A:0:-1: +%2hhx:ff:1:2:255: +%*2hhx:ff:0:2: +%2hhx:FF:1:2:255: +%*2hhx:FF:0:2: +%2hhx:0Xff:0:-1: +%*2hhx:0Xff:0:-1: +%2hhx:0xFF:0:-1: +%*2hhx:0xFF:0:-1: +%2hhx:100:1:2:16: +%*2hhx:100:0:2: +%2hhx:0X100:0:-1: +%*2hhx:0X100:0:-1: +%2hhx:0x100:0:-1: +%*2hhx:0x100:0:-1: +%2hhx:129:1:2:18: +%*2hhx:129:0:2: +%2hhx:0X129:0:-1: +%*2hhx:0X129:0:-1: +%2hhx:0x129:0:-1: +%*2hhx:0x129:0:-1: +%2hhx:+0:1:2:0: +%*2hhx:+0:0:2: +%2hhx:+0X0:1:2:0: +%*2hhx:+0X0:0:2: +%2hhx:+0x0:1:2:0: +%*2hhx:+0x0:0:2: +%2hhx:+1:1:2:1: +%*2hhx:+1:0:2: +%2hhx:+0X1:1:2:0: +%*2hhx:+0X1:0:2: +%2hhx:+0x1:1:2:0: +%*2hhx:+0x1:0:2: +%2hhx:+2a:1:2:2: +%*2hhx:+2a:0:2: +%2hhx:+2A:1:2:2: +%*2hhx:+2A:0:2: +%2hhx:+0X2a:1:2:0: +%*2hhx:+0X2a:0:2: +%2hhx:+0x2A:1:2:0: +%*2hhx:+0x2A:0:2: +%2hhx:+ff:1:2:15: +%*2hhx:+ff:0:2: +%2hhx:+FF:1:2:15: +%*2hhx:+FF:0:2: +%2hhx:+0Xff:1:2:0: +%*2hhx:+0Xff:0:2: +%2hhx:+0xFF:1:2:0: +%*2hhx:+0xFF:0:2: +%2hhx:+100:1:2:1: +%*2hhx:+100:0:2: +%2hhx:+0X100:1:2:0: +%*2hhx:+0X100:0:2: +%2hhx:+0x100:1:2:0: +%*2hhx:+0x100:0:2: +%2hhx:+129:1:2:1: +%*2hhx:+129:0:2: +%2hhx:+0X129:1:2:0: +%*2hhx:+0X129:0:2: +%2hhx:+0x129:1:2:0: +%*2hhx:+0x129:0:2: +%3hhx::0:-1: +%*3hhx::0:-1: +%3hhx:-7b:1:3:133: +%*3hhx:-7b:0:3: +%3hhx:-7B:1:3:133: +%*3hhx:-7B:0:3: +%3hhx:-0X7b:0:-1: +%*3hhx:-0X7b:0:-1: +%3hhx:-0x7B:0:-1: +%*3hhx:-0x7B:0:-1: +%3hhx:-1:1:2:255: +%*3hhx:-1:0:2: +%3hhx:-0X1:0:-1: +%*3hhx:-0X1:0:-1: +%3hhx:-0x1:0:-1: +%*3hhx:-0x1:0:-1: +%3hhx:-0:1:2:0: +%*3hhx:-0:0:2: +%3hhx:-0X0:0:-1: +%*3hhx:-0X0:0:-1: +%3hhx:-0x0:0:-1: +%*3hhx:-0x0:0:-1: +%3hhx:0:1:1:0: +%*3hhx:0:0:1: +%3hhx:0X0:1:3:0: +%*3hhx:0X0:0:3: +%3hhx:0x0:1:3:0: +%*3hhx:0x0:0:3: +%3hhx:1:1:1:1: +%*3hhx:1:0:1: +%3hhx:0X1:1:3:1: +%*3hhx:0X1:0:3: +%3hhx:0x1:1:3:1: +%*3hhx:0x1:0:3: +%3hhx:2a:1:2:42: +%*3hhx:2a:0:2: +%3hhx:2A:1:2:42: +%*3hhx:2A:0:2: +%3hhx:0X2a:1:3:2: +%*3hhx:0X2a:0:3: +%3hhx:0x2A:1:3:2: +%*3hhx:0x2A:0:3: +%3hhx:ff:1:2:255: +%*3hhx:ff:0:2: +%3hhx:FF:1:2:255: +%*3hhx:FF:0:2: +%3hhx:0Xff:1:3:15: +%*3hhx:0Xff:0:3: +%3hhx:0xFF:1:3:15: +%*3hhx:0xFF:0:3: +%3hhx:100:1:3:0: +%*3hhx:100:0:3: +%3hhx:0X100:1:3:1: +%*3hhx:0X100:0:3: +%3hhx:0x100:1:3:1: +%*3hhx:0x100:0:3: +%3hhx:129:1:3:41: +%*3hhx:129:0:3: +%3hhx:0X129:1:3:1: +%*3hhx:0X129:0:3: +%3hhx:0x129:1:3:1: +%*3hhx:0x129:0:3: +%3hhx:+0:1:2:0: +%*3hhx:+0:0:2: +%3hhx:+0X0:0:-1: +%*3hhx:+0X0:0:-1: +%3hhx:+0x0:0:-1: +%*3hhx:+0x0:0:-1: +%3hhx:+1:1:2:1: +%*3hhx:+1:0:2: +%3hhx:+0X1:0:-1: +%*3hhx:+0X1:0:-1: +%3hhx:+0x1:0:-1: +%*3hhx:+0x1:0:-1: +%3hhx:+2a:1:3:42: +%*3hhx:+2a:0:3: +%3hhx:+2A:1:3:42: +%*3hhx:+2A:0:3: +%3hhx:+0X2a:0:-1: +%*3hhx:+0X2a:0:-1: +%3hhx:+0x2A:0:-1: +%*3hhx:+0x2A:0:-1: +%3hhx:+ff:1:3:255: +%*3hhx:+ff:0:3: +%3hhx:+FF:1:3:255: +%*3hhx:+FF:0:3: +%3hhx:+0Xff:0:-1: +%*3hhx:+0Xff:0:-1: +%3hhx:+0xFF:0:-1: +%*3hhx:+0xFF:0:-1: +%3hhx:+100:1:3:16: +%*3hhx:+100:0:3: +%3hhx:+0X100:0:-1: +%*3hhx:+0X100:0:-1: +%3hhx:+0x100:0:-1: +%*3hhx:+0x100:0:-1: +%3hhx:+129:1:3:18: +%*3hhx:+129:0:3: +%3hhx:+0X129:0:-1: +%*3hhx:+0X129:0:-1: +%3hhx:+0x129:0:-1: +%*3hhx:+0x129:0:-1: +%5hhx::0:-1: +%*5hhx::0:-1: +%5hhx:-7b:1:3:133: +%*5hhx:-7b:0:3: +%5hhx:-7B:1:3:133: +%*5hhx:-7B:0:3: +%5hhx:-0X7b:1:5:133: +%*5hhx:-0X7b:0:5: +%5hhx:-0x7B:1:5:133: +%*5hhx:-0x7B:0:5: +%5hhx:-1:1:2:255: +%*5hhx:-1:0:2: +%5hhx:-0X1:1:4:255: +%*5hhx:-0X1:0:4: +%5hhx:-0x1:1:4:255: +%*5hhx:-0x1:0:4: +%5hhx:-0:1:2:0: +%*5hhx:-0:0:2: +%5hhx:-0X0:1:4:0: +%*5hhx:-0X0:0:4: +%5hhx:-0x0:1:4:0: +%*5hhx:-0x0:0:4: +%5hhx:0:1:1:0: +%*5hhx:0:0:1: +%5hhx:0X0:1:3:0: +%*5hhx:0X0:0:3: +%5hhx:0x0:1:3:0: +%*5hhx:0x0:0:3: +%5hhx:1:1:1:1: +%*5hhx:1:0:1: +%5hhx:0X1:1:3:1: +%*5hhx:0X1:0:3: +%5hhx:0x1:1:3:1: +%*5hhx:0x1:0:3: +%5hhx:2a:1:2:42: +%*5hhx:2a:0:2: +%5hhx:2A:1:2:42: +%*5hhx:2A:0:2: +%5hhx:0X2a:1:4:42: +%*5hhx:0X2a:0:4: +%5hhx:0x2A:1:4:42: +%*5hhx:0x2A:0:4: +%5hhx:ff:1:2:255: +%*5hhx:ff:0:2: +%5hhx:FF:1:2:255: +%*5hhx:FF:0:2: +%5hhx:0Xff:1:4:255: +%*5hhx:0Xff:0:4: +%5hhx:0xFF:1:4:255: +%*5hhx:0xFF:0:4: +%5hhx:100:1:3:0: +%*5hhx:100:0:3: +%5hhx:0X100:1:5:0: +%*5hhx:0X100:0:5: +%5hhx:0x100:1:5:0: +%*5hhx:0x100:0:5: +%5hhx:129:1:3:41: +%*5hhx:129:0:3: +%5hhx:0X129:1:5:41: +%*5hhx:0X129:0:5: +%5hhx:0x129:1:5:41: +%*5hhx:0x129:0:5: +%5hhx:+0:1:2:0: +%*5hhx:+0:0:2: +%5hhx:+0X0:1:4:0: +%*5hhx:+0X0:0:4: +%5hhx:+0x0:1:4:0: +%*5hhx:+0x0:0:4: +%5hhx:+1:1:2:1: +%*5hhx:+1:0:2: +%5hhx:+0X1:1:4:1: +%*5hhx:+0X1:0:4: +%5hhx:+0x1:1:4:1: +%*5hhx:+0x1:0:4: +%5hhx:+2a:1:3:42: +%*5hhx:+2a:0:3: +%5hhx:+2A:1:3:42: +%*5hhx:+2A:0:3: +%5hhx:+0X2a:1:5:42: +%*5hhx:+0X2a:0:5: +%5hhx:+0x2A:1:5:42: +%*5hhx:+0x2A:0:5: +%5hhx:+ff:1:3:255: +%*5hhx:+ff:0:3: +%5hhx:+FF:1:3:255: +%*5hhx:+FF:0:3: +%5hhx:+0Xff:1:5:255: +%*5hhx:+0Xff:0:5: +%5hhx:+0xFF:1:5:255: +%*5hhx:+0xFF:0:5: +%5hhx:+100:1:4:0: +%*5hhx:+100:0:4: +%5hhx:+0X100:1:5:16: +%*5hhx:+0X100:0:5: +%5hhx:+0x100:1:5:16: +%*5hhx:+0x100:0:5: +%5hhx:+129:1:4:41: +%*5hhx:+129:0:4: +%5hhx:+0X129:1:5:18: +%*5hhx:+0X129:0:5: +%5hhx:+0x129:1:5:18: +%*5hhx:+0x129:0:5: +%2hhx: :0:-1: +%*2hhx: :0:-1: +%2hhx: -7b:1:3:249: +%*2hhx: -7b:0:3: +%2hhx: -7B:1:3:249: +%*2hhx: -7B:0:3: +%2hhx: -0X7b:1:3:0: +%*2hhx: -0X7b:0:3: +%2hhx: -0x7B:1:3:0: +%*2hhx: -0x7B:0:3: +%2hhx: -1:1:3:255: +%*2hhx: -1:0:3: +%2hhx: -0X1:1:3:0: +%*2hhx: -0X1:0:3: +%2hhx: -0x1:1:3:0: +%*2hhx: -0x1:0:3: +%2hhx: -0:1:3:0: +%*2hhx: -0:0:3: +%2hhx: -0X0:1:3:0: +%*2hhx: -0X0:0:3: +%2hhx: -0x0:1:3:0: +%*2hhx: -0x0:0:3: +%2hhx: 0:1:2:0: +%*2hhx: 0:0:2: +%2hhx: 0X0:0:-1: +%*2hhx: 0X0:0:-1: +%2hhx: 0x0:0:-1: +%*2hhx: 0x0:0:-1: +%2hhx: 1:1:2:1: +%*2hhx: 1:0:2: +%2hhx: 0X1:0:-1: +%*2hhx: 0X1:0:-1: +%2hhx: 0x1:0:-1: +%*2hhx: 0x1:0:-1: +%2hhx: 2a:1:3:42: +%*2hhx: 2a:0:3: +%2hhx: 2A:1:3:42: +%*2hhx: 2A:0:3: +%2hhx: 0X2a:0:-1: +%*2hhx: 0X2a:0:-1: +%2hhx: 0x2A:0:-1: +%*2hhx: 0x2A:0:-1: +%2hhx: ff:1:3:255: +%*2hhx: ff:0:3: +%2hhx: FF:1:3:255: +%*2hhx: FF:0:3: +%2hhx: 0Xff:0:-1: +%*2hhx: 0Xff:0:-1: +%2hhx: 0xFF:0:-1: +%*2hhx: 0xFF:0:-1: +%2hhx: 100:1:3:16: +%*2hhx: 100:0:3: +%2hhx: 0X100:0:-1: +%*2hhx: 0X100:0:-1: +%2hhx: 0x100:0:-1: +%*2hhx: 0x100:0:-1: +%2hhx: 129:1:3:18: +%*2hhx: 129:0:3: +%2hhx: 0X129:0:-1: +%*2hhx: 0X129:0:-1: +%2hhx: 0x129:0:-1: +%*2hhx: 0x129:0:-1: +%2hhx: +0:1:3:0: +%*2hhx: +0:0:3: +%2hhx: +0X0:1:3:0: +%*2hhx: +0X0:0:3: +%2hhx: +0x0:1:3:0: +%*2hhx: +0x0:0:3: +%2hhx: +1:1:3:1: +%*2hhx: +1:0:3: +%2hhx: +0X1:1:3:0: +%*2hhx: +0X1:0:3: +%2hhx: +0x1:1:3:0: +%*2hhx: +0x1:0:3: +%2hhx: +2a:1:3:2: +%*2hhx: +2a:0:3: +%2hhx: +2A:1:3:2: +%*2hhx: +2A:0:3: +%2hhx: +0X2a:1:3:0: +%*2hhx: +0X2a:0:3: +%2hhx: +0x2A:1:3:0: +%*2hhx: +0x2A:0:3: +%2hhx: +ff:1:3:15: +%*2hhx: +ff:0:3: +%2hhx: +FF:1:3:15: +%*2hhx: +FF:0:3: +%2hhx: +0Xff:1:3:0: +%*2hhx: +0Xff:0:3: +%2hhx: +0xFF:1:3:0: +%*2hhx: +0xFF:0:3: +%2hhx: +100:1:3:1: +%*2hhx: +100:0:3: +%2hhx: +0X100:1:3:0: +%*2hhx: +0X100:0:3: +%2hhx: +0x100:1:3:0: +%*2hhx: +0x100:0:3: +%2hhx: +129:1:3:1: +%*2hhx: +129:0:3: +%2hhx: +0X129:1:3:0: +%*2hhx: +0X129:0:3: +%2hhx: +0x129:1:3:0: +%*2hhx: +0x129:0:3: +%5hhx: :0:-1: +%*5hhx: :0:-1: +%5hhx: -7b:1:4:133: +%*5hhx: -7b:0:4: +%5hhx: -7B:1:4:133: +%*5hhx: -7B:0:4: +%5hhx: -0X7b:1:6:133: +%*5hhx: -0X7b:0:6: +%5hhx: -0x7B:1:6:133: +%*5hhx: -0x7B:0:6: +%5hhx: -1:1:3:255: +%*5hhx: -1:0:3: +%5hhx: -0X1:1:5:255: +%*5hhx: -0X1:0:5: +%5hhx: -0x1:1:5:255: +%*5hhx: -0x1:0:5: +%5hhx: -0:1:3:0: +%*5hhx: -0:0:3: +%5hhx: -0X0:1:5:0: +%*5hhx: -0X0:0:5: +%5hhx: -0x0:1:5:0: +%*5hhx: -0x0:0:5: +%5hhx: 0:1:2:0: +%*5hhx: 0:0:2: +%5hhx: 0X0:1:4:0: +%*5hhx: 0X0:0:4: +%5hhx: 0x0:1:4:0: +%*5hhx: 0x0:0:4: +%5hhx: 1:1:2:1: +%*5hhx: 1:0:2: +%5hhx: 0X1:1:4:1: +%*5hhx: 0X1:0:4: +%5hhx: 0x1:1:4:1: +%*5hhx: 0x1:0:4: +%5hhx: 2a:1:3:42: +%*5hhx: 2a:0:3: +%5hhx: 2A:1:3:42: +%*5hhx: 2A:0:3: +%5hhx: 0X2a:1:5:42: +%*5hhx: 0X2a:0:5: +%5hhx: 0x2A:1:5:42: +%*5hhx: 0x2A:0:5: +%5hhx: ff:1:3:255: +%*5hhx: ff:0:3: +%5hhx: FF:1:3:255: +%*5hhx: FF:0:3: +%5hhx: 0Xff:1:5:255: +%*5hhx: 0Xff:0:5: +%5hhx: 0xFF:1:5:255: +%*5hhx: 0xFF:0:5: +%5hhx: 100:1:4:0: +%*5hhx: 100:0:4: +%5hhx: 0X100:1:6:0: +%*5hhx: 0X100:0:6: +%5hhx: 0x100:1:6:0: +%*5hhx: 0x100:0:6: +%5hhx: 129:1:4:41: +%*5hhx: 129:0:4: +%5hhx: 0X129:1:6:41: +%*5hhx: 0X129:0:6: +%5hhx: 0x129:1:6:41: +%*5hhx: 0x129:0:6: +%5hhx: +0:1:3:0: +%*5hhx: +0:0:3: +%5hhx: +0X0:1:5:0: +%*5hhx: +0X0:0:5: +%5hhx: +0x0:1:5:0: +%*5hhx: +0x0:0:5: +%5hhx: +1:1:3:1: +%*5hhx: +1:0:3: +%5hhx: +0X1:1:5:1: +%*5hhx: +0X1:0:5: +%5hhx: +0x1:1:5:1: +%*5hhx: +0x1:0:5: +%5hhx: +2a:1:4:42: +%*5hhx: +2a:0:4: +%5hhx: +2A:1:4:42: +%*5hhx: +2A:0:4: +%5hhx: +0X2a:1:6:42: +%*5hhx: +0X2a:0:6: +%5hhx: +0x2A:1:6:42: +%*5hhx: +0x2A:0:6: +%5hhx: +ff:1:4:255: +%*5hhx: +ff:0:4: +%5hhx: +FF:1:4:255: +%*5hhx: +FF:0:4: +%5hhx: +0Xff:1:6:255: +%*5hhx: +0Xff:0:6: +%5hhx: +0xFF:1:6:255: +%*5hhx: +0xFF:0:6: +%5hhx: +100:1:5:0: +%*5hhx: +100:0:5: +%5hhx: +0X100:1:6:16: +%*5hhx: +0X100:0:6: +%5hhx: +0x100:1:6:16: +%*5hhx: +0x100:0:6: +%5hhx: +129:1:5:41: +%*5hhx: +129:0:5: +%5hhx: +0X129:1:6:18: +%*5hhx: +0X129:0:6: +%5hhx: +0x129:1:6:18: +%*5hhx: +0x129:0:6: diff --git a/stdio-common/tst-scanf-format-uchar-xx.input b/stdio-common/tst-scanf-format-uchar-xx.input new file mode 100644 index 0000000..6fe86c2 --- /dev/null +++ b/stdio-common/tst-scanf-format-uchar-xx.input @@ -0,0 +1,710 @@ +%hhX::0:-1: +%*hhX::0:-1: +%hhX:-7b:1:3:133: +%*hhX:-7b:0:3: +%hhX:-7B:1:3:133: +%*hhX:-7B:0:3: +%hhX:-0X7b:1:5:133: +%*hhX:-0X7b:0:5: +%hhX:-0x7B:1:5:133: +%*hhX:-0x7B:0:5: +%hhX:-1:1:2:255: +%*hhX:-1:0:2: +%hhX:-0X1:1:4:255: +%*hhX:-0X1:0:4: +%hhX:-0x1:1:4:255: +%*hhX:-0x1:0:4: +%hhX:-0:1:2:0: +%*hhX:-0:0:2: +%hhX:-0X0:1:4:0: +%*hhX:-0X0:0:4: +%hhX:-0x0:1:4:0: +%*hhX:-0x0:0:4: +%hhX:0:1:1:0: +%*hhX:0:0:1: +%hhX:0X0:1:3:0: +%*hhX:0X0:0:3: +%hhX:0x0:1:3:0: +%*hhX:0x0:0:3: +%hhX:1:1:1:1: +%*hhX:1:0:1: +%hhX:0X1:1:3:1: +%*hhX:0X1:0:3: +%hhX:0x1:1:3:1: +%*hhX:0x1:0:3: +%hhX:2a:1:2:42: +%*hhX:2a:0:2: +%hhX:2A:1:2:42: +%*hhX:2A:0:2: +%hhX:0X2a:1:4:42: +%*hhX:0X2a:0:4: +%hhX:0x2A:1:4:42: +%*hhX:0x2A:0:4: +%hhX:ff:1:2:255: +%*hhX:ff:0:2: +%hhX:FF:1:2:255: +%*hhX:FF:0:2: +%hhX:0xFF:1:4:255: +%*hhX:0xFF:0:4: +%hhX:100:1:3:0: +%*hhX:100:0:3: +%hhX:0X100:1:5:0: +%*hhX:0X100:0:5: +%hhX:0x100:1:5:0: +%*hhX:0x100:0:5: +%hhX:129:1:3:41: +%*hhX:129:0:3: +%hhX:0X129:1:5:41: +%*hhX:0X129:0:5: +%hhX:0x129:1:5:41: +%*hhX:0x129:0:5: +%hhX:+0:1:2:0: +%*hhX:+0:0:2: +%hhX:+0X0:1:4:0: +%*hhX:+0X0:0:4: +%hhX:+0x0:1:4:0: +%*hhX:+0x0:0:4: +%hhX:+1:1:2:1: +%*hhX:+1:0:2: +%hhX:+0X1:1:4:1: +%*hhX:+0X1:0:4: +%hhX:+0x1:1:4:1: +%*hhX:+0x1:0:4: +%hhX:+2a:1:3:42: +%*hhX:+2a:0:3: +%hhX:+2A:1:3:42: +%*hhX:+2A:0:3: +%hhX:+0X2a:1:5:42: +%*hhX:+0X2a:0:5: +%hhX:+0x2A:1:5:42: +%*hhX:+0x2A:0:5: +%hhX:+ff:1:3:255: +%*hhX:+ff:0:3: +%hhX:+FF:1:3:255: +%*hhX:+FF:0:3: +%hhX:+0Xff:1:5:255: +%*hhX:+0Xff:0:5: +%hhX:+0xFF:1:5:255: +%*hhX:+0xFF:0:5: +%hhX:+100:1:4:0: +%*hhX:+100:0:4: +%hhX:+0X100:1:6:0: +%*hhX:+0X100:0:6: +%hhX:+0x100:1:6:0: +%*hhX:+0x100:0:6: +%hhX:+129:1:4:41: +%*hhX:+129:0:4: +%hhX:+0X129:1:6:41: +%*hhX:+0X129:0:6: +%hhX:+0x129:1:6:41: +%*hhX:+0x129:0:6: +%1hhX::0:-1: +%*1hhX::0:-1: +%1hhX:-7b:0:-1: +%*1hhX:-7b:0:-1: +%1hhX:-7B:0:-1: +%*1hhX:-7B:0:-1: +%1hhX:-0X7b:0:-1: +%*1hhX:-0X7b:0:-1: +%1hhX:-0x7B:0:-1: +%*1hhX:-0x7B:0:-1: +%1hhX:-1:0:-1: +%*1hhX:-1:0:-1: +%1hhX:-0X1:0:-1: +%*1hhX:-0X1:0:-1: +%1hhX:-0x1:0:-1: +%*1hhX:-0x1:0:-1: +%1hhX:-0:0:-1: +%*1hhX:-0:0:-1: +%1hhX:-0X0:0:-1: +%*1hhX:-0X0:0:-1: +%1hhX:-0x0:0:-1: +%*1hhX:-0x0:0:-1: +%1hhX:0:1:1:0: +%*1hhX:0:0:1: +%1hhX:0X0:1:1:0: +%*1hhX:0X0:0:1: +%1hhX:0x0:1:1:0: +%*1hhX:0x0:0:1: +%1hhX:1:1:1:1: +%*1hhX:1:0:1: +%1hhX:0X1:1:1:0: +%*1hhX:0X1:0:1: +%1hhX:0x1:1:1:0: +%*1hhX:0x1:0:1: +%1hhX:2a:1:1:2: +%*1hhX:2a:0:1: +%1hhX:2A:1:1:2: +%*1hhX:2A:0:1: +%1hhX:0X2a:1:1:0: +%*1hhX:0X2a:0:1: +%1hhX:0x2A:1:1:0: +%*1hhX:0x2A:0:1: +%1hhX:ff:1:1:15: +%*1hhX:ff:0:1: +%1hhX:FF:1:1:15: +%*1hhX:FF:0:1: +%1hhX:0xFF:1:1:0: +%*1hhX:0xFF:0:1: +%1hhX:100:1:1:1: +%*1hhX:100:0:1: +%1hhX:0X100:1:1:0: +%*1hhX:0X100:0:1: +%1hhX:0x100:1:1:0: +%*1hhX:0x100:0:1: +%1hhX:129:1:1:1: +%*1hhX:129:0:1: +%1hhX:0X129:1:1:0: +%*1hhX:0X129:0:1: +%1hhX:0x129:1:1:0: +%*1hhX:0x129:0:1: +%1hhX:+0:0:-1: +%*1hhX:+0:0:-1: +%1hhX:+0X0:0:-1: +%*1hhX:+0X0:0:-1: +%1hhX:+0x0:0:-1: +%*1hhX:+0x0:0:-1: +%1hhX:+1:0:-1: +%*1hhX:+1:0:-1: +%1hhX:+0X1:0:-1: +%*1hhX:+0X1:0:-1: +%1hhX:+0x1:0:-1: +%*1hhX:+0x1:0:-1: +%1hhX:+2a:0:-1: +%*1hhX:+2a:0:-1: +%1hhX:+2A:0:-1: +%*1hhX:+2A:0:-1: +%1hhX:+0X2a:0:-1: +%*1hhX:+0X2a:0:-1: +%1hhX:+0x2A:0:-1: +%*1hhX:+0x2A:0:-1: +%1hhX:+ff:0:-1: +%*1hhX:+ff:0:-1: +%1hhX:+FF:0:-1: +%*1hhX:+FF:0:-1: +%1hhX:+0Xff:0:-1: +%*1hhX:+0Xff:0:-1: +%1hhX:+0xFF:0:-1: +%*1hhX:+0xFF:0:-1: +%1hhX:+100:0:-1: +%*1hhX:+100:0:-1: +%1hhX:+0X100:0:-1: +%*1hhX:+0X100:0:-1: +%1hhX:+0x100:0:-1: +%*1hhX:+0x100:0:-1: +%1hhX:+129:0:-1: +%*1hhX:+129:0:-1: +%1hhX:+0X129:0:-1: +%*1hhX:+0X129:0:-1: +%1hhX:+0x129:0:-1: +%*1hhX:+0x129:0:-1: +%2hhX::0:-1: +%*2hhX::0:-1: +%2hhX:-7b:1:2:249: +%*2hhX:-7b:0:2: +%2hhX:-7B:1:2:249: +%*2hhX:-7B:0:2: +%2hhX:-0X7b:1:2:0: +%*2hhX:-0X7b:0:2: +%2hhX:-0x7B:1:2:0: +%*2hhX:-0x7B:0:2: +%2hhX:-1:1:2:255: +%*2hhX:-1:0:2: +%2hhX:-0X1:1:2:0: +%*2hhX:-0X1:0:2: +%2hhX:-0x1:1:2:0: +%*2hhX:-0x1:0:2: +%2hhX:-0:1:2:0: +%*2hhX:-0:0:2: +%2hhX:-0X0:1:2:0: +%*2hhX:-0X0:0:2: +%2hhX:-0x0:1:2:0: +%*2hhX:-0x0:0:2: +%2hhX:0:1:1:0: +%*2hhX:0:0:1: +%2hhX:0X0:0:-1: +%*2hhX:0X0:0:-1: +%2hhX:0x0:0:-1: +%*2hhX:0x0:0:-1: +%2hhX:1:1:1:1: +%*2hhX:1:0:1: +%2hhX:0X1:0:-1: +%*2hhX:0X1:0:-1: +%2hhX:0x1:0:-1: +%*2hhX:0x1:0:-1: +%2hhX:2a:1:2:42: +%*2hhX:2a:0:2: +%2hhX:2A:1:2:42: +%*2hhX:2A:0:2: +%2hhX:0X2a:0:-1: +%*2hhX:0X2a:0:-1: +%2hhX:0x2A:0:-1: +%*2hhX:0x2A:0:-1: +%2hhX:ff:1:2:255: +%*2hhX:ff:0:2: +%2hhX:FF:1:2:255: +%*2hhX:FF:0:2: +%2hhX:0Xff:0:-1: +%*2hhX:0Xff:0:-1: +%2hhX:0xFF:0:-1: +%*2hhX:0xFF:0:-1: +%2hhX:100:1:2:16: +%*2hhX:100:0:2: +%2hhX:0X100:0:-1: +%*2hhX:0X100:0:-1: +%2hhX:0x100:0:-1: +%*2hhX:0x100:0:-1: +%2hhX:129:1:2:18: +%*2hhX:129:0:2: +%2hhX:0X129:0:-1: +%*2hhX:0X129:0:-1: +%2hhX:0x129:0:-1: +%*2hhX:0x129:0:-1: +%2hhX:+0:1:2:0: +%*2hhX:+0:0:2: +%2hhX:+0X0:1:2:0: +%*2hhX:+0X0:0:2: +%2hhX:+0x0:1:2:0: +%*2hhX:+0x0:0:2: +%2hhX:+1:1:2:1: +%*2hhX:+1:0:2: +%2hhX:+0X1:1:2:0: +%*2hhX:+0X1:0:2: +%2hhX:+0x1:1:2:0: +%*2hhX:+0x1:0:2: +%2hhX:+2a:1:2:2: +%*2hhX:+2a:0:2: +%2hhX:+2A:1:2:2: +%*2hhX:+2A:0:2: +%2hhX:+0X2a:1:2:0: +%*2hhX:+0X2a:0:2: +%2hhX:+0x2A:1:2:0: +%*2hhX:+0x2A:0:2: +%2hhX:+ff:1:2:15: +%*2hhX:+ff:0:2: +%2hhX:+FF:1:2:15: +%*2hhX:+FF:0:2: +%2hhX:+0Xff:1:2:0: +%*2hhX:+0Xff:0:2: +%2hhX:+0xFF:1:2:0: +%*2hhX:+0xFF:0:2: +%2hhX:+100:1:2:1: +%*2hhX:+100:0:2: +%2hhX:+0X100:1:2:0: +%*2hhX:+0X100:0:2: +%2hhX:+0x100:1:2:0: +%*2hhX:+0x100:0:2: +%2hhX:+129:1:2:1: +%*2hhX:+129:0:2: +%2hhX:+0X129:1:2:0: +%*2hhX:+0X129:0:2: +%2hhX:+0x129:1:2:0: +%*2hhX:+0x129:0:2: +%3hhX::0:-1: +%*3hhX::0:-1: +%3hhX:-7b:1:3:133: +%*3hhX:-7b:0:3: +%3hhX:-7B:1:3:133: +%*3hhX:-7B:0:3: +%3hhX:-0X7b:0:-1: +%*3hhX:-0X7b:0:-1: +%3hhX:-0x7B:0:-1: +%*3hhX:-0x7B:0:-1: +%3hhX:-1:1:2:255: +%*3hhX:-1:0:2: +%3hhX:-0X1:0:-1: +%*3hhX:-0X1:0:-1: +%3hhX:-0x1:0:-1: +%*3hhX:-0x1:0:-1: +%3hhX:-0:1:2:0: +%*3hhX:-0:0:2: +%3hhX:-0X0:0:-1: +%*3hhX:-0X0:0:-1: +%3hhX:-0x0:0:-1: +%*3hhX:-0x0:0:-1: +%3hhX:0:1:1:0: +%*3hhX:0:0:1: +%3hhX:0X0:1:3:0: +%*3hhX:0X0:0:3: +%3hhX:0x0:1:3:0: +%*3hhX:0x0:0:3: +%3hhX:1:1:1:1: +%*3hhX:1:0:1: +%3hhX:0X1:1:3:1: +%*3hhX:0X1:0:3: +%3hhX:0x1:1:3:1: +%*3hhX:0x1:0:3: +%3hhX:2a:1:2:42: +%*3hhX:2a:0:2: +%3hhX:2A:1:2:42: +%*3hhX:2A:0:2: +%3hhX:0X2a:1:3:2: +%*3hhX:0X2a:0:3: +%3hhX:0x2A:1:3:2: +%*3hhX:0x2A:0:3: +%3hhX:ff:1:2:255: +%*3hhX:ff:0:2: +%3hhX:FF:1:2:255: +%*3hhX:FF:0:2: +%3hhX:0Xff:1:3:15: +%*3hhX:0Xff:0:3: +%3hhX:0xFF:1:3:15: +%*3hhX:0xFF:0:3: +%3hhX:100:1:3:0: +%*3hhX:100:0:3: +%3hhX:0X100:1:3:1: +%*3hhX:0X100:0:3: +%3hhX:0x100:1:3:1: +%*3hhX:0x100:0:3: +%3hhX:129:1:3:41: +%*3hhX:129:0:3: +%3hhX:0X129:1:3:1: +%*3hhX:0X129:0:3: +%3hhX:0x129:1:3:1: +%*3hhX:0x129:0:3: +%3hhX:+0:1:2:0: +%*3hhX:+0:0:2: +%3hhX:+0X0:0:-1: +%*3hhX:+0X0:0:-1: +%3hhX:+0x0:0:-1: +%*3hhX:+0x0:0:-1: +%3hhX:+1:1:2:1: +%*3hhX:+1:0:2: +%3hhX:+0X1:0:-1: +%*3hhX:+0X1:0:-1: +%3hhX:+0x1:0:-1: +%*3hhX:+0x1:0:-1: +%3hhX:+2a:1:3:42: +%*3hhX:+2a:0:3: +%3hhX:+2A:1:3:42: +%*3hhX:+2A:0:3: +%3hhX:+0X2a:0:-1: +%*3hhX:+0X2a:0:-1: +%3hhX:+0x2A:0:-1: +%*3hhX:+0x2A:0:-1: +%3hhX:+ff:1:3:255: +%*3hhX:+ff:0:3: +%3hhX:+FF:1:3:255: +%*3hhX:+FF:0:3: +%3hhX:+0Xff:0:-1: +%*3hhX:+0Xff:0:-1: +%3hhX:+0xFF:0:-1: +%*3hhX:+0xFF:0:-1: +%3hhX:+100:1:3:16: +%*3hhX:+100:0:3: +%3hhX:+0X100:0:-1: +%*3hhX:+0X100:0:-1: +%3hhX:+0x100:0:-1: +%*3hhX:+0x100:0:-1: +%3hhX:+129:1:3:18: +%*3hhX:+129:0:3: +%3hhX:+0X129:0:-1: +%*3hhX:+0X129:0:-1: +%3hhX:+0x129:0:-1: +%*3hhX:+0x129:0:-1: +%5hhX::0:-1: +%*5hhX::0:-1: +%5hhX:-7b:1:3:133: +%*5hhX:-7b:0:3: +%5hhX:-7B:1:3:133: +%*5hhX:-7B:0:3: +%5hhX:-0X7b:1:5:133: +%*5hhX:-0X7b:0:5: +%5hhX:-0x7B:1:5:133: +%*5hhX:-0x7B:0:5: +%5hhX:-1:1:2:255: +%*5hhX:-1:0:2: +%5hhX:-0X1:1:4:255: +%*5hhX:-0X1:0:4: +%5hhX:-0x1:1:4:255: +%*5hhX:-0x1:0:4: +%5hhX:-0:1:2:0: +%*5hhX:-0:0:2: +%5hhX:-0X0:1:4:0: +%*5hhX:-0X0:0:4: +%5hhX:-0x0:1:4:0: +%*5hhX:-0x0:0:4: +%5hhX:0:1:1:0: +%*5hhX:0:0:1: +%5hhX:0X0:1:3:0: +%*5hhX:0X0:0:3: +%5hhX:0x0:1:3:0: +%*5hhX:0x0:0:3: +%5hhX:1:1:1:1: +%*5hhX:1:0:1: +%5hhX:0X1:1:3:1: +%*5hhX:0X1:0:3: +%5hhX:0x1:1:3:1: +%*5hhX:0x1:0:3: +%5hhX:2a:1:2:42: +%*5hhX:2a:0:2: +%5hhX:2A:1:2:42: +%*5hhX:2A:0:2: +%5hhX:0X2a:1:4:42: +%*5hhX:0X2a:0:4: +%5hhX:0x2A:1:4:42: +%*5hhX:0x2A:0:4: +%5hhX:ff:1:2:255: +%*5hhX:ff:0:2: +%5hhX:FF:1:2:255: +%*5hhX:FF:0:2: +%5hhX:0Xff:1:4:255: +%*5hhX:0Xff:0:4: +%5hhX:0xFF:1:4:255: +%*5hhX:0xFF:0:4: +%5hhX:100:1:3:0: +%*5hhX:100:0:3: +%5hhX:0X100:1:5:0: +%*5hhX:0X100:0:5: +%5hhX:0x100:1:5:0: +%*5hhX:0x100:0:5: +%5hhX:129:1:3:41: +%*5hhX:129:0:3: +%5hhX:0X129:1:5:41: +%*5hhX:0X129:0:5: +%5hhX:0x129:1:5:41: +%*5hhX:0x129:0:5: +%5hhX:+0:1:2:0: +%*5hhX:+0:0:2: +%5hhX:+0X0:1:4:0: +%*5hhX:+0X0:0:4: +%5hhX:+0x0:1:4:0: +%*5hhX:+0x0:0:4: +%5hhX:+1:1:2:1: +%*5hhX:+1:0:2: +%5hhX:+0X1:1:4:1: +%*5hhX:+0X1:0:4: +%5hhX:+0x1:1:4:1: +%*5hhX:+0x1:0:4: +%5hhX:+2a:1:3:42: +%*5hhX:+2a:0:3: +%5hhX:+2A:1:3:42: +%*5hhX:+2A:0:3: +%5hhX:+0X2a:1:5:42: +%*5hhX:+0X2a:0:5: +%5hhX:+0x2A:1:5:42: +%*5hhX:+0x2A:0:5: +%5hhX:+ff:1:3:255: +%*5hhX:+ff:0:3: +%5hhX:+FF:1:3:255: +%*5hhX:+FF:0:3: +%5hhX:+0Xff:1:5:255: +%*5hhX:+0Xff:0:5: +%5hhX:+0xFF:1:5:255: +%*5hhX:+0xFF:0:5: +%5hhX:+100:1:4:0: +%*5hhX:+100:0:4: +%5hhX:+0X100:1:5:16: +%*5hhX:+0X100:0:5: +%5hhX:+0x100:1:5:16: +%*5hhX:+0x100:0:5: +%5hhX:+129:1:4:41: +%*5hhX:+129:0:4: +%5hhX:+0X129:1:5:18: +%*5hhX:+0X129:0:5: +%5hhX:+0x129:1:5:18: +%*5hhX:+0x129:0:5: +%2hhX: :0:-1: +%*2hhX: :0:-1: +%2hhX: -7b:1:3:249: +%*2hhX: -7b:0:3: +%2hhX: -7B:1:3:249: +%*2hhX: -7B:0:3: +%2hhX: -0X7b:1:3:0: +%*2hhX: -0X7b:0:3: +%2hhX: -0x7B:1:3:0: +%*2hhX: -0x7B:0:3: +%2hhX: -1:1:3:255: +%*2hhX: -1:0:3: +%2hhX: -0X1:1:3:0: +%*2hhX: -0X1:0:3: +%2hhX: -0x1:1:3:0: +%*2hhX: -0x1:0:3: +%2hhX: -0:1:3:0: +%*2hhX: -0:0:3: +%2hhX: -0X0:1:3:0: +%*2hhX: -0X0:0:3: +%2hhX: -0x0:1:3:0: +%*2hhX: -0x0:0:3: +%2hhX: 0:1:2:0: +%*2hhX: 0:0:2: +%2hhX: 0X0:0:-1: +%*2hhX: 0X0:0:-1: +%2hhX: 0x0:0:-1: +%*2hhX: 0x0:0:-1: +%2hhX: 1:1:2:1: +%*2hhX: 1:0:2: +%2hhX: 0X1:0:-1: +%*2hhX: 0X1:0:-1: +%2hhX: 0x1:0:-1: +%*2hhX: 0x1:0:-1: +%2hhX: 2a:1:3:42: +%*2hhX: 2a:0:3: +%2hhX: 2A:1:3:42: +%*2hhX: 2A:0:3: +%2hhX: 0X2a:0:-1: +%*2hhX: 0X2a:0:-1: +%2hhX: 0x2A:0:-1: +%*2hhX: 0x2A:0:-1: +%2hhX: ff:1:3:255: +%*2hhX: ff:0:3: +%2hhX: FF:1:3:255: +%*2hhX: FF:0:3: +%2hhX: 0Xff:0:-1: +%*2hhX: 0Xff:0:-1: +%2hhX: 0xFF:0:-1: +%*2hhX: 0xFF:0:-1: +%2hhX: 100:1:3:16: +%*2hhX: 100:0:3: +%2hhX: 0X100:0:-1: +%*2hhX: 0X100:0:-1: +%2hhX: 0x100:0:-1: +%*2hhX: 0x100:0:-1: +%2hhX: 129:1:3:18: +%*2hhX: 129:0:3: +%2hhX: 0X129:0:-1: +%*2hhX: 0X129:0:-1: +%2hhX: 0x129:0:-1: +%*2hhX: 0x129:0:-1: +%2hhX: +0:1:3:0: +%*2hhX: +0:0:3: +%2hhX: +0X0:1:3:0: +%*2hhX: +0X0:0:3: +%2hhX: +0x0:1:3:0: +%*2hhX: +0x0:0:3: +%2hhX: +1:1:3:1: +%*2hhX: +1:0:3: +%2hhX: +0X1:1:3:0: +%*2hhX: +0X1:0:3: +%2hhX: +0x1:1:3:0: +%*2hhX: +0x1:0:3: +%2hhX: +2a:1:3:2: +%*2hhX: +2a:0:3: +%2hhX: +2A:1:3:2: +%*2hhX: +2A:0:3: +%2hhX: +0X2a:1:3:0: +%*2hhX: +0X2a:0:3: +%2hhX: +0x2A:1:3:0: +%*2hhX: +0x2A:0:3: +%2hhX: +ff:1:3:15: +%*2hhX: +ff:0:3: +%2hhX: +FF:1:3:15: +%*2hhX: +FF:0:3: +%2hhX: +0Xff:1:3:0: +%*2hhX: +0Xff:0:3: +%2hhX: +0xFF:1:3:0: +%*2hhX: +0xFF:0:3: +%2hhX: +100:1:3:1: +%*2hhX: +100:0:3: +%2hhX: +0X100:1:3:0: +%*2hhX: +0X100:0:3: +%2hhX: +0x100:1:3:0: +%*2hhX: +0x100:0:3: +%2hhX: +129:1:3:1: +%*2hhX: +129:0:3: +%2hhX: +0X129:1:3:0: +%*2hhX: +0X129:0:3: +%2hhX: +0x129:1:3:0: +%*2hhX: +0x129:0:3: +%5hhX: :0:-1: +%*5hhX: :0:-1: +%5hhX: -7b:1:4:133: +%*5hhX: -7b:0:4: +%5hhX: -7B:1:4:133: +%*5hhX: -7B:0:4: +%5hhX: -0X7b:1:6:133: +%*5hhX: -0X7b:0:6: +%5hhX: -0x7B:1:6:133: +%*5hhX: -0x7B:0:6: +%5hhX: -1:1:3:255: +%*5hhX: -1:0:3: +%5hhX: -0X1:1:5:255: +%*5hhX: -0X1:0:5: +%5hhX: -0x1:1:5:255: +%*5hhX: -0x1:0:5: +%5hhX: -0:1:3:0: +%*5hhX: -0:0:3: +%5hhX: -0X0:1:5:0: +%*5hhX: -0X0:0:5: +%5hhX: -0x0:1:5:0: +%*5hhX: -0x0:0:5: +%5hhX: 0:1:2:0: +%*5hhX: 0:0:2: +%5hhX: 0X0:1:4:0: +%*5hhX: 0X0:0:4: +%5hhX: 0x0:1:4:0: +%*5hhX: 0x0:0:4: +%5hhX: 1:1:2:1: +%*5hhX: 1:0:2: +%5hhX: 0X1:1:4:1: +%*5hhX: 0X1:0:4: +%5hhX: 0x1:1:4:1: +%*5hhX: 0x1:0:4: +%5hhX: 2a:1:3:42: +%*5hhX: 2a:0:3: +%5hhX: 2A:1:3:42: +%*5hhX: 2A:0:3: +%5hhX: 0X2a:1:5:42: +%*5hhX: 0X2a:0:5: +%5hhX: 0x2A:1:5:42: +%*5hhX: 0x2A:0:5: +%5hhX: ff:1:3:255: +%*5hhX: ff:0:3: +%5hhX: FF:1:3:255: +%*5hhX: FF:0:3: +%5hhX: 0Xff:1:5:255: +%*5hhX: 0Xff:0:5: +%5hhX: 0xFF:1:5:255: +%*5hhX: 0xFF:0:5: +%5hhX: 100:1:4:0: +%*5hhX: 100:0:4: +%5hhX: 0X100:1:6:0: +%*5hhX: 0X100:0:6: +%5hhX: 0x100:1:6:0: +%*5hhX: 0x100:0:6: +%5hhX: 129:1:4:41: +%*5hhX: 129:0:4: +%5hhX: 0X129:1:6:41: +%*5hhX: 0X129:0:6: +%5hhX: 0x129:1:6:41: +%*5hhX: 0x129:0:6: +%5hhX: +0:1:3:0: +%*5hhX: +0:0:3: +%5hhX: +0X0:1:5:0: +%*5hhX: +0X0:0:5: +%5hhX: +0x0:1:5:0: +%*5hhX: +0x0:0:5: +%5hhX: +1:1:3:1: +%*5hhX: +1:0:3: +%5hhX: +0X1:1:5:1: +%*5hhX: +0X1:0:5: +%5hhX: +0x1:1:5:1: +%*5hhX: +0x1:0:5: +%5hhX: +2a:1:4:42: +%*5hhX: +2a:0:4: +%5hhX: +2A:1:4:42: +%*5hhX: +2A:0:4: +%5hhX: +0X2a:1:6:42: +%*5hhX: +0X2a:0:6: +%5hhX: +0x2A:1:6:42: +%*5hhX: +0x2A:0:6: +%5hhX: +ff:1:4:255: +%*5hhX: +ff:0:4: +%5hhX: +FF:1:4:255: +%*5hhX: +FF:0:4: +%5hhX: +0Xff:1:6:255: +%*5hhX: +0Xff:0:6: +%5hhX: +0xFF:1:6:255: +%*5hhX: +0xFF:0:6: +%5hhX: +100:1:5:0: +%*5hhX: +100:0:5: +%5hhX: +0X100:1:6:16: +%*5hhX: +0X100:0:6: +%5hhX: +0x100:1:6:16: +%*5hhX: +0x100:0:6: +%5hhX: +129:1:5:41: +%*5hhX: +129:0:5: +%5hhX: +0X129:1:6:18: +%*5hhX: +0X129:0:6: +%5hhX: +0x129:1:6:18: +%*5hhX: +0x129:0:6: diff --git a/stdio-common/tst-scanf-format-ullong-b.input b/stdio-common/tst-scanf-format-ullong-b.input new file mode 100644 index 0000000..b010d51 --- /dev/null +++ b/stdio-common/tst-scanf-format-ullong-b.input @@ -0,0 +1,644 @@ +%llb::0:-1: +%*llb::0:-1: +%llb:-1111011:1:8:-123: +%*llb:-1111011:0:8: +%llb:-0B1111011:1:10:-123: +%*llb:-0B1111011:0:10: +%llb:-0b1111011:1:10:-123: +%*llb:-0b1111011:0:10: +%llb:-1:1:2:-1: +%*llb:-1:0:2: +%llb:-0B1:1:4:-1: +%*llb:-0B1:0:4: +%llb:-0b1:1:4:-1: +%*llb:-0b1:0:4: +%llb:-0:1:2:0: +%*llb:-0:0:2: +%llb:-0B0:1:4:0: +%*llb:-0B0:0:4: +%llb:-0b0:1:4:0: +%*llb:-0b0:0:4: +%llb:0:1:1:0: +%*llb:0:0:1: +%llb:0B0:1:3:0: +%*llb:0B0:0:3: +%llb:0b0:1:3:0: +%*llb:0b0:0:3: +%llb:1:1:1:1: +%*llb:1:0:1: +%llb:0B1:1:3:1: +%*llb:0B1:0:3: +%llb:0b1:1:3:1: +%*llb:0b1:0:3: +%llb:101010:1:6:42: +%*llb:101010:0:6: +%llb:0B101010:1:8:42: +%*llb:0B101010:0:8: +%llb:0b101010:1:8:42: +%*llb:0b101010:0:8: +%llb:1111111111111111111111111111111111111111111111111111111111111111:1:64:18446744073709551615: +%*llb:1111111111111111111111111111111111111111111111111111111111111111:0:64: +%llb:0B1111111111111111111111111111111111111111111111111111111111111111:1:66:18446744073709551615: +%*llb:0B1111111111111111111111111111111111111111111111111111111111111111:0:66: +%llb:0b1111111111111111111111111111111111111111111111111111111111111111:1:66:18446744073709551615: +%*llb:0b1111111111111111111111111111111111111111111111111111111111111111:0:66: +%llb:10000000000000000000000000000000000000000000000000000000000000000:1:65:18446744073709551615: +%*llb:10000000000000000000000000000000000000000000000000000000000000000:0:65: +%llb:0B10000000000000000000000000000000000000000000000000000000000000000:1:67:18446744073709551615: +%*llb:0B10000000000000000000000000000000000000000000000000000000000000000:0:67: +%llb:0b10000000000000000000000000000000000000000000000000000000000000000:1:67:18446744073709551615: +%*llb:0b10000000000000000000000000000000000000000000000000000000000000000:0:67: +%llb:10000000000000000000000000000000000000010100001110101011110110001:1:65:18446744073709551615: +%*llb:10000000000000000000000000000000000000010100001110101011110110001:0:65: +%llb:0B10000000000000000000000000000000000000010100001110101011110110001:1:67:18446744073709551615: +%*llb:0B10000000000000000000000000000000000000010100001110101011110110001:0:67: +%llb:0b10000000000000000000000000000000000000010100001110101011110110001:1:67:18446744073709551615: +%*llb:0b10000000000000000000000000000000000000010100001110101011110110001:0:67: +%llb:+0:1:2:0: +%*llb:+0:0:2: +%llb:+0B0:1:4:0: +%*llb:+0B0:0:4: +%llb:+0b0:1:4:0: +%*llb:+0b0:0:4: +%llb:+1:1:2:1: +%*llb:+1:0:2: +%llb:+0B1:1:4:1: +%*llb:+0B1:0:4: +%llb:+0b1:1:4:1: +%*llb:+0b1:0:4: +%llb:+101010:1:7:42: +%*llb:+101010:0:7: +%llb:+0B101010:1:9:42: +%*llb:+0B101010:0:9: +%llb:+0b101010:1:9:42: +%*llb:+0b101010:0:9: +%llb:+1111111111111111111111111111111111111111111111111111111111111111:1:65:18446744073709551615: +%*llb:+1111111111111111111111111111111111111111111111111111111111111111:0:65: +%llb:+0B1111111111111111111111111111111111111111111111111111111111111111:1:67:18446744073709551615: +%*llb:+0B1111111111111111111111111111111111111111111111111111111111111111:0:67: +%llb:+0b1111111111111111111111111111111111111111111111111111111111111111:1:67:18446744073709551615: +%*llb:+0b1111111111111111111111111111111111111111111111111111111111111111:0:67: +%llb:+10000000000000000000000000000000000000000000000000000000000000000:1:66:18446744073709551615: +%*llb:+10000000000000000000000000000000000000000000000000000000000000000:0:66: +%llb:+0B10000000000000000000000000000000000000000000000000000000000000000:1:68:18446744073709551615: +%*llb:+0B10000000000000000000000000000000000000000000000000000000000000000:0:68: +%llb:+0b10000000000000000000000000000000000000000000000000000000000000000:1:68:18446744073709551615: +%*llb:+0b10000000000000000000000000000000000000000000000000000000000000000:0:68: +%llb:+10000000000000000000000000000000000000010100001110101011110110001:1:66:18446744073709551615: +%*llb:+10000000000000000000000000000000000000010100001110101011110110001:0:66: +%llb:+0B10000000000000000000000000000000000000010100001110101011110110001:1:68:18446744073709551615: +%*llb:+0B10000000000000000000000000000000000000010100001110101011110110001:0:68: +%llb:+0b10000000000000000000000000000000000000010100001110101011110110001:1:68:18446744073709551615: +%*llb:+0b10000000000000000000000000000000000000010100001110101011110110001:0:68: +%1llb::0:-1: +%*1llb::0:-1: +%1llb:-1111011:0:-1: +%*1llb:-1111011:0:-1: +%1llb:-0B1111011:0:-1: +%*1llb:-0B1111011:0:-1: +%1llb:-0b1111011:0:-1: +%*1llb:-0b1111011:0:-1: +%1llb:-1:0:-1: +%*1llb:-1:0:-1: +%1llb:-0B1:0:-1: +%*1llb:-0B1:0:-1: +%1llb:-0b1:0:-1: +%*1llb:-0b1:0:-1: +%1llb:-0:0:-1: +%*1llb:-0:0:-1: +%1llb:-0B0:0:-1: +%*1llb:-0B0:0:-1: +%1llb:-0b0:0:-1: +%*1llb:-0b0:0:-1: +%1llb:0:1:1:0: +%*1llb:0:0:1: +%1llb:0B0:1:1:0: +%*1llb:0B0:0:1: +%1llb:0b0:1:1:0: +%*1llb:0b0:0:1: +%1llb:1:1:1:1: +%*1llb:1:0:1: +%1llb:0B1:1:1:0: +%*1llb:0B1:0:1: +%1llb:0b1:1:1:0: +%*1llb:0b1:0:1: +%1llb:101010:1:1:1: +%*1llb:101010:0:1: +%1llb:0B101010:1:1:0: +%*1llb:0B101010:0:1: +%1llb:0b101010:1:1:0: +%*1llb:0b101010:0:1: +%1llb:1111111111111111111111111111111111111111111111111111111111111111:1:1:1: +%*1llb:1111111111111111111111111111111111111111111111111111111111111111:0:1: +%1llb:0B1111111111111111111111111111111111111111111111111111111111111111:1:1:0: +%*1llb:0B1111111111111111111111111111111111111111111111111111111111111111:0:1: +%1llb:0b1111111111111111111111111111111111111111111111111111111111111111:1:1:0: +%*1llb:0b1111111111111111111111111111111111111111111111111111111111111111:0:1: +%1llb:10000000000000000000000000000000000000000000000000000000000000000:1:1:1: +%*1llb:10000000000000000000000000000000000000000000000000000000000000000:0:1: +%1llb:0B10000000000000000000000000000000000000000000000000000000000000000:1:1:0: +%*1llb:0B10000000000000000000000000000000000000000000000000000000000000000:0:1: +%1llb:0b10000000000000000000000000000000000000000000000000000000000000000:1:1:0: +%*1llb:0b10000000000000000000000000000000000000000000000000000000000000000:0:1: +%1llb:10000000000000000000000000000000000000010100001110101011110110001:1:1:1: +%*1llb:10000000000000000000000000000000000000010100001110101011110110001:0:1: +%1llb:0B10000000000000000000000000000000000000010100001110101011110110001:1:1:0: +%*1llb:0B10000000000000000000000000000000000000010100001110101011110110001:0:1: +%1llb:0b10000000000000000000000000000000000000010100001110101011110110001:1:1:0: +%*1llb:0b10000000000000000000000000000000000000010100001110101011110110001:0:1: +%1llb:+0:0:-1: +%*1llb:+0:0:-1: +%1llb:+0B0:0:-1: +%*1llb:+0B0:0:-1: +%1llb:+0b0:0:-1: +%*1llb:+0b0:0:-1: +%1llb:+1:0:-1: +%*1llb:+1:0:-1: +%1llb:+0B1:0:-1: +%*1llb:+0B1:0:-1: +%1llb:+0b1:0:-1: +%*1llb:+0b1:0:-1: +%1llb:+101010:0:-1: +%*1llb:+101010:0:-1: +%1llb:+0B101010:0:-1: +%*1llb:+0B101010:0:-1: +%1llb:+0b101010:0:-1: +%*1llb:+0b101010:0:-1: +%1llb:+1111111111111111111111111111111111111111111111111111111111111111:0:-1: +%*1llb:+1111111111111111111111111111111111111111111111111111111111111111:0:-1: +%1llb:+0B1111111111111111111111111111111111111111111111111111111111111111:0:-1: +%*1llb:+0B1111111111111111111111111111111111111111111111111111111111111111:0:-1: +%1llb:+0b1111111111111111111111111111111111111111111111111111111111111111:0:-1: +%*1llb:+0b1111111111111111111111111111111111111111111111111111111111111111:0:-1: +%1llb:+10000000000000000000000000000000000000000000000000000000000000000:0:-1: +%*1llb:+10000000000000000000000000000000000000000000000000000000000000000:0:-1: +%1llb:+0B10000000000000000000000000000000000000000000000000000000000000000:0:-1: +%*1llb:+0B10000000000000000000000000000000000000000000000000000000000000000:0:-1: +%1llb:+0b10000000000000000000000000000000000000000000000000000000000000000:0:-1: +%*1llb:+0b10000000000000000000000000000000000000000000000000000000000000000:0:-1: +%1llb:+10000000000000000000000000000000000000010100001110101011110110001:0:-1: +%*1llb:+10000000000000000000000000000000000000010100001110101011110110001:0:-1: +%1llb:+0B10000000000000000000000000000000000000010100001110101011110110001:0:-1: +%*1llb:+0B10000000000000000000000000000000000000010100001110101011110110001:0:-1: +%1llb:+0b10000000000000000000000000000000000000010100001110101011110110001:0:-1: +%*1llb:+0b10000000000000000000000000000000000000010100001110101011110110001:0:-1: +%2llb::0:-1: +%*2llb::0:-1: +%2llb:-1111011:1:2:-1: +%*2llb:-1111011:0:2: +%2llb:-0B1111011:1:2:0: +%*2llb:-0B1111011:0:2: +%2llb:-0b1111011:1:2:0: +%*2llb:-0b1111011:0:2: +%2llb:-1:1:2:-1: +%*2llb:-1:0:2: +%2llb:-0B1:1:2:0: +%*2llb:-0B1:0:2: +%2llb:-0b1:1:2:0: +%*2llb:-0b1:0:2: +%2llb:-0:1:2:0: +%*2llb:-0:0:2: +%2llb:-0B0:1:2:0: +%*2llb:-0B0:0:2: +%2llb:-0b0:1:2:0: +%*2llb:-0b0:0:2: +%2llb:0:1:1:0: +%*2llb:0:0:1: +%2llb:0B0:0:-1: +%*2llb:0B0:0:-1: +%2llb:0b0:0:-1: +%*2llb:0b0:0:-1: +%2llb:1:1:1:1: +%*2llb:1:0:1: +%2llb:0B1:0:-1: +%*2llb:0B1:0:-1: +%2llb:0b1:0:-1: +%*2llb:0b1:0:-1: +%2llb:101010:1:2:2: +%*2llb:101010:0:2: +%2llb:0B101010:0:-1: +%*2llb:0B101010:0:-1: +%2llb:0b101010:0:-1: +%*2llb:0b101010:0:-1: +%2llb:1111111111111111111111111111111111111111111111111111111111111111:1:2:3: +%*2llb:1111111111111111111111111111111111111111111111111111111111111111:0:2: +%2llb:0B1111111111111111111111111111111111111111111111111111111111111111:0:-1: +%*2llb:0B1111111111111111111111111111111111111111111111111111111111111111:0:-1: +%2llb:0b1111111111111111111111111111111111111111111111111111111111111111:0:-1: +%*2llb:0b1111111111111111111111111111111111111111111111111111111111111111:0:-1: +%2llb:10000000000000000000000000000000000000000000000000000000000000000:1:2:2: +%*2llb:10000000000000000000000000000000000000000000000000000000000000000:0:2: +%2llb:0B10000000000000000000000000000000000000000000000000000000000000000:0:-1: +%*2llb:0B10000000000000000000000000000000000000000000000000000000000000000:0:-1: +%2llb:0b10000000000000000000000000000000000000000000000000000000000000000:0:-1: +%*2llb:0b10000000000000000000000000000000000000000000000000000000000000000:0:-1: +%2llb:10000000000000000000000000000000000000010100001110101011110110001:1:2:2: +%*2llb:10000000000000000000000000000000000000010100001110101011110110001:0:2: +%2llb:0B10000000000000000000000000000000000000010100001110101011110110001:0:-1: +%*2llb:0B10000000000000000000000000000000000000010100001110101011110110001:0:-1: +%2llb:0b10000000000000000000000000000000000000010100001110101011110110001:0:-1: +%*2llb:0b10000000000000000000000000000000000000010100001110101011110110001:0:-1: +%2llb:+0:1:2:0: +%*2llb:+0:0:2: +%2llb:+0B0:1:2:0: +%*2llb:+0B0:0:2: +%2llb:+0b0:1:2:0: +%*2llb:+0b0:0:2: +%2llb:+1:1:2:1: +%*2llb:+1:0:2: +%2llb:+0B1:1:2:0: +%*2llb:+0B1:0:2: +%2llb:+0b1:1:2:0: +%*2llb:+0b1:0:2: +%2llb:+101010:1:2:1: +%*2llb:+101010:0:2: +%2llb:+0B101010:1:2:0: +%*2llb:+0B101010:0:2: +%2llb:+0b101010:1:2:0: +%*2llb:+0b101010:0:2: +%2llb:+1111111111111111111111111111111111111111111111111111111111111111:1:2:1: +%*2llb:+1111111111111111111111111111111111111111111111111111111111111111:0:2: +%2llb:+0B1111111111111111111111111111111111111111111111111111111111111111:1:2:0: +%*2llb:+0B1111111111111111111111111111111111111111111111111111111111111111:0:2: +%2llb:+0b1111111111111111111111111111111111111111111111111111111111111111:1:2:0: +%*2llb:+0b1111111111111111111111111111111111111111111111111111111111111111:0:2: +%2llb:+10000000000000000000000000000000000000000000000000000000000000000:1:2:1: +%*2llb:+10000000000000000000000000000000000000000000000000000000000000000:0:2: +%2llb:+0B10000000000000000000000000000000000000000000000000000000000000000:1:2:0: +%*2llb:+0B10000000000000000000000000000000000000000000000000000000000000000:0:2: +%2llb:+0b10000000000000000000000000000000000000000000000000000000000000000:1:2:0: +%*2llb:+0b10000000000000000000000000000000000000000000000000000000000000000:0:2: +%2llb:+10000000000000000000000000000000000000010100001110101011110110001:1:2:1: +%*2llb:+10000000000000000000000000000000000000010100001110101011110110001:0:2: +%2llb:+0B10000000000000000000000000000000000000010100001110101011110110001:1:2:0: +%*2llb:+0B10000000000000000000000000000000000000010100001110101011110110001:0:2: +%2llb:+0b10000000000000000000000000000000000000010100001110101011110110001:1:2:0: +%*2llb:+0b10000000000000000000000000000000000000010100001110101011110110001:0:2: +%15llb::0:-1: +%*15llb::0:-1: +%15llb:-1111011:1:8:-123: +%*15llb:-1111011:0:8: +%15llb:-0B1111011:1:10:-123: +%*15llb:-0B1111011:0:10: +%15llb:-0b1111011:1:10:-123: +%*15llb:-0b1111011:0:10: +%15llb:-1:1:2:-1: +%*15llb:-1:0:2: +%15llb:-0B1:1:4:-1: +%*15llb:-0B1:0:4: +%15llb:-0b1:1:4:-1: +%*15llb:-0b1:0:4: +%15llb:-0:1:2:0: +%*15llb:-0:0:2: +%15llb:-0B0:1:4:0: +%*15llb:-0B0:0:4: +%15llb:-0b0:1:4:0: +%*15llb:-0b0:0:4: +%15llb:0:1:1:0: +%*15llb:0:0:1: +%15llb:0B0:1:3:0: +%*15llb:0B0:0:3: +%15llb:0b0:1:3:0: +%*15llb:0b0:0:3: +%15llb:1:1:1:1: +%*15llb:1:0:1: +%15llb:0B1:1:3:1: +%*15llb:0B1:0:3: +%15llb:0b1:1:3:1: +%*15llb:0b1:0:3: +%15llb:101010:1:6:42: +%*15llb:101010:0:6: +%15llb:0B101010:1:8:42: +%*15llb:0B101010:0:8: +%15llb:0b101010:1:8:42: +%*15llb:0b101010:0:8: +%15llb:1111111111111111111111111111111111111111111111111111111111111111:1:15:32767: +%*15llb:1111111111111111111111111111111111111111111111111111111111111111:0:15: +%15llb:0B1111111111111111111111111111111111111111111111111111111111111111:1:15:8191: +%*15llb:0B1111111111111111111111111111111111111111111111111111111111111111:0:15: +%15llb:0b1111111111111111111111111111111111111111111111111111111111111111:1:15:8191: +%*15llb:0b1111111111111111111111111111111111111111111111111111111111111111:0:15: +%15llb:10000000000000000000000000000000000000000000000000000000000000000:1:15:16384: +%*15llb:10000000000000000000000000000000000000000000000000000000000000000:0:15: +%15llb:0B10000000000000000000000000000000000000000000000000000000000000000:1:15:4096: +%*15llb:0B10000000000000000000000000000000000000000000000000000000000000000:0:15: +%15llb:0b10000000000000000000000000000000000000000000000000000000000000000:1:15:4096: +%*15llb:0b10000000000000000000000000000000000000000000000000000000000000000:0:15: +%15llb:10000000000000000000000000000000000000010100001110101011110110001:1:15:16384: +%*15llb:10000000000000000000000000000000000000010100001110101011110110001:0:15: +%15llb:0B10000000000000000000000000000000000000010100001110101011110110001:1:15:4096: +%*15llb:0B10000000000000000000000000000000000000010100001110101011110110001:0:15: +%15llb:0b10000000000000000000000000000000000000010100001110101011110110001:1:15:4096: +%*15llb:0b10000000000000000000000000000000000000010100001110101011110110001:0:15: +%15llb:+0:1:2:0: +%*15llb:+0:0:2: +%15llb:+0B0:1:4:0: +%*15llb:+0B0:0:4: +%15llb:+0b0:1:4:0: +%*15llb:+0b0:0:4: +%15llb:+1:1:2:1: +%*15llb:+1:0:2: +%15llb:+0B1:1:4:1: +%*15llb:+0B1:0:4: +%15llb:+0b1:1:4:1: +%*15llb:+0b1:0:4: +%15llb:+101010:1:7:42: +%*15llb:+101010:0:7: +%15llb:+0B101010:1:9:42: +%*15llb:+0B101010:0:9: +%15llb:+0b101010:1:9:42: +%*15llb:+0b101010:0:9: +%15llb:+1111111111111111111111111111111111111111111111111111111111111111:1:15:16383: +%*15llb:+1111111111111111111111111111111111111111111111111111111111111111:0:15: +%15llb:+0B1111111111111111111111111111111111111111111111111111111111111111:1:15:4095: +%*15llb:+0B1111111111111111111111111111111111111111111111111111111111111111:0:15: +%15llb:+0b1111111111111111111111111111111111111111111111111111111111111111:1:15:4095: +%*15llb:+0b1111111111111111111111111111111111111111111111111111111111111111:0:15: +%15llb:+10000000000000000000000000000000000000000000000000000000000000000:1:15:8192: +%*15llb:+10000000000000000000000000000000000000000000000000000000000000000:0:15: +%15llb:+0B10000000000000000000000000000000000000000000000000000000000000000:1:15:2048: +%*15llb:+0B10000000000000000000000000000000000000000000000000000000000000000:0:15: +%15llb:+0b10000000000000000000000000000000000000000000000000000000000000000:1:15:2048: +%*15llb:+0b10000000000000000000000000000000000000000000000000000000000000000:0:15: +%15llb:+10000000000000000000000000000000000000010100001110101011110110001:1:15:8192: +%*15llb:+10000000000000000000000000000000000000010100001110101011110110001:0:15: +%15llb:+0B10000000000000000000000000000000000000010100001110101011110110001:1:15:2048: +%*15llb:+0B10000000000000000000000000000000000000010100001110101011110110001:0:15: +%15llb:+0b10000000000000000000000000000000000000010100001110101011110110001:1:15:2048: +%*15llb:+0b10000000000000000000000000000000000000010100001110101011110110001:0:15: +%25llb::0:-1: +%*25llb::0:-1: +%25llb:-1111011:1:8:-123: +%*25llb:-1111011:0:8: +%25llb:-0B1111011:1:10:-123: +%*25llb:-0B1111011:0:10: +%25llb:-0b1111011:1:10:-123: +%*25llb:-0b1111011:0:10: +%25llb:-1:1:2:-1: +%*25llb:-1:0:2: +%25llb:-0B1:1:4:-1: +%*25llb:-0B1:0:4: +%25llb:-0b1:1:4:-1: +%*25llb:-0b1:0:4: +%25llb:-0:1:2:0: +%*25llb:-0:0:2: +%25llb:-0B0:1:4:0: +%*25llb:-0B0:0:4: +%25llb:-0b0:1:4:0: +%*25llb:-0b0:0:4: +%25llb:0:1:1:0: +%*25llb:0:0:1: +%25llb:0B0:1:3:0: +%*25llb:0B0:0:3: +%25llb:0b0:1:3:0: +%*25llb:0b0:0:3: +%25llb:1:1:1:1: +%*25llb:1:0:1: +%25llb:0B1:1:3:1: +%*25llb:0B1:0:3: +%25llb:0b1:1:3:1: +%*25llb:0b1:0:3: +%25llb:101010:1:6:42: +%*25llb:101010:0:6: +%25llb:0B101010:1:8:42: +%*25llb:0B101010:0:8: +%25llb:0b101010:1:8:42: +%*25llb:0b101010:0:8: +%25llb:1111111111111111111111111111111111111111111111111111111111111111:1:25:33554431: +%*25llb:1111111111111111111111111111111111111111111111111111111111111111:0:25: +%25llb:0B1111111111111111111111111111111111111111111111111111111111111111:1:25:8388607: +%*25llb:0B1111111111111111111111111111111111111111111111111111111111111111:0:25: +%25llb:0b1111111111111111111111111111111111111111111111111111111111111111:1:25:8388607: +%*25llb:0b1111111111111111111111111111111111111111111111111111111111111111:0:25: +%25llb:10000000000000000000000000000000000000000000000000000000000000000:1:25:16777216: +%*25llb:10000000000000000000000000000000000000000000000000000000000000000:0:25: +%25llb:0B10000000000000000000000000000000000000000000000000000000000000000:1:25:4194304: +%*25llb:0B10000000000000000000000000000000000000000000000000000000000000000:0:25: +%25llb:0b10000000000000000000000000000000000000000000000000000000000000000:1:25:4194304: +%*25llb:0b10000000000000000000000000000000000000000000000000000000000000000:0:25: +%25llb:10000000000000000000000000000000000000010100001110101011110110001:1:25:16777216: +%*25llb:10000000000000000000000000000000000000010100001110101011110110001:0:25: +%25llb:0B10000000000000000000000000000000000000010100001110101011110110001:1:25:4194304: +%*25llb:0B10000000000000000000000000000000000000010100001110101011110110001:0:25: +%25llb:0b10000000000000000000000000000000000000010100001110101011110110001:1:25:4194304: +%*25llb:0b10000000000000000000000000000000000000010100001110101011110110001:0:25: +%25llb:+0:1:2:0: +%*25llb:+0:0:2: +%25llb:+0B0:1:4:0: +%*25llb:+0B0:0:4: +%25llb:+0b0:1:4:0: +%*25llb:+0b0:0:4: +%25llb:+1:1:2:1: +%*25llb:+1:0:2: +%25llb:+0B1:1:4:1: +%*25llb:+0B1:0:4: +%25llb:+0b1:1:4:1: +%*25llb:+0b1:0:4: +%25llb:+101010:1:7:42: +%*25llb:+101010:0:7: +%25llb:+0B101010:1:9:42: +%*25llb:+0B101010:0:9: +%25llb:+0b101010:1:9:42: +%*25llb:+0b101010:0:9: +%25llb:+1111111111111111111111111111111111111111111111111111111111111111:1:25:16777215: +%*25llb:+1111111111111111111111111111111111111111111111111111111111111111:0:25: +%25llb:+0B1111111111111111111111111111111111111111111111111111111111111111:1:25:4194303: +%*25llb:+0B1111111111111111111111111111111111111111111111111111111111111111:0:25: +%25llb:+0b1111111111111111111111111111111111111111111111111111111111111111:1:25:4194303: +%*25llb:+0b1111111111111111111111111111111111111111111111111111111111111111:0:25: +%25llb:+10000000000000000000000000000000000000000000000000000000000000000:1:25:8388608: +%*25llb:+10000000000000000000000000000000000000000000000000000000000000000:0:25: +%25llb:+0B10000000000000000000000000000000000000000000000000000000000000000:1:25:2097152: +%*25llb:+0B10000000000000000000000000000000000000000000000000000000000000000:0:25: +%25llb:+0b10000000000000000000000000000000000000000000000000000000000000000:1:25:2097152: +%*25llb:+0b10000000000000000000000000000000000000000000000000000000000000000:0:25: +%25llb:+10000000000000000000000000000000000000010100001110101011110110001:1:25:8388608: +%*25llb:+10000000000000000000000000000000000000010100001110101011110110001:0:25: +%25llb:+0B10000000000000000000000000000000000000010100001110101011110110001:1:25:2097152: +%*25llb:+0B10000000000000000000000000000000000000010100001110101011110110001:0:25: +%25llb:+0b10000000000000000000000000000000000000010100001110101011110110001:1:25:2097152: +%*25llb:+0b10000000000000000000000000000000000000010100001110101011110110001:0:25: +%2llb: :0:-1: +%*2llb: :0:-1: +%2llb: -1111011:1:3:-1: +%*2llb: -1111011:0:3: +%2llb: -0B1111011:1:3:0: +%*2llb: -0B1111011:0:3: +%2llb: -0b1111011:1:3:0: +%*2llb: -0b1111011:0:3: +%2llb: -1:1:3:-1: +%*2llb: -1:0:3: +%2llb: -0B1:1:3:0: +%*2llb: -0B1:0:3: +%2llb: -0b1:1:3:0: +%*2llb: -0b1:0:3: +%2llb: -0:1:3:0: +%*2llb: -0:0:3: +%2llb: -0B0:1:3:0: +%*2llb: -0B0:0:3: +%2llb: -0b0:1:3:0: +%*2llb: -0b0:0:3: +%2llb: 0:1:2:0: +%*2llb: 0:0:2: +%2llb: 0B0:0:-1: +%*2llb: 0B0:0:-1: +%2llb: 0b0:0:-1: +%*2llb: 0b0:0:-1: +%2llb: 1:1:2:1: +%*2llb: 1:0:2: +%2llb: 0B1:0:-1: +%*2llb: 0B1:0:-1: +%2llb: 0b1:0:-1: +%*2llb: 0b1:0:-1: +%2llb: 101010:1:3:2: +%*2llb: 101010:0:3: +%2llb: 0B101010:0:-1: +%*2llb: 0B101010:0:-1: +%2llb: 0b101010:0:-1: +%*2llb: 0b101010:0:-1: +%2llb: 1111111111111111111111111111111111111111111111111111111111111111:1:3:3: +%*2llb: 1111111111111111111111111111111111111111111111111111111111111111:0:3: +%2llb: 0B1111111111111111111111111111111111111111111111111111111111111111:0:-1: +%*2llb: 0B1111111111111111111111111111111111111111111111111111111111111111:0:-1: +%2llb: 0b1111111111111111111111111111111111111111111111111111111111111111:0:-1: +%*2llb: 0b1111111111111111111111111111111111111111111111111111111111111111:0:-1: +%2llb: 10000000000000000000000000000000000000000000000000000000000000000:1:3:2: +%*2llb: 10000000000000000000000000000000000000000000000000000000000000000:0:3: +%2llb: 0B10000000000000000000000000000000000000000000000000000000000000000:0:-1: +%*2llb: 0B10000000000000000000000000000000000000000000000000000000000000000:0:-1: +%2llb: 0b10000000000000000000000000000000000000000000000000000000000000000:0:-1: +%*2llb: 0b10000000000000000000000000000000000000000000000000000000000000000:0:-1: +%2llb: 10000000000000000000000000000000000000010100001110101011110110001:1:3:2: +%*2llb: 10000000000000000000000000000000000000010100001110101011110110001:0:3: +%2llb: 0B10000000000000000000000000000000000000010100001110101011110110001:0:-1: +%*2llb: 0B10000000000000000000000000000000000000010100001110101011110110001:0:-1: +%2llb: 0b10000000000000000000000000000000000000010100001110101011110110001:0:-1: +%*2llb: 0b10000000000000000000000000000000000000010100001110101011110110001:0:-1: +%2llb: +0:1:3:0: +%*2llb: +0:0:3: +%2llb: +0B0:1:3:0: +%*2llb: +0B0:0:3: +%2llb: +0b0:1:3:0: +%*2llb: +0b0:0:3: +%2llb: +1:1:3:1: +%*2llb: +1:0:3: +%2llb: +0B1:1:3:0: +%*2llb: +0B1:0:3: +%2llb: +0b1:1:3:0: +%*2llb: +0b1:0:3: +%2llb: +101010:1:3:1: +%*2llb: +101010:0:3: +%2llb: +0B101010:1:3:0: +%*2llb: +0B101010:0:3: +%2llb: +0b101010:1:3:0: +%*2llb: +0b101010:0:3: +%2llb: +1111111111111111111111111111111111111111111111111111111111111111:1:3:1: +%*2llb: +1111111111111111111111111111111111111111111111111111111111111111:0:3: +%2llb: +0B1111111111111111111111111111111111111111111111111111111111111111:1:3:0: +%*2llb: +0B1111111111111111111111111111111111111111111111111111111111111111:0:3: +%2llb: +0b1111111111111111111111111111111111111111111111111111111111111111:1:3:0: +%*2llb: +0b1111111111111111111111111111111111111111111111111111111111111111:0:3: +%2llb: +10000000000000000000000000000000000000000000000000000000000000000:1:3:1: +%*2llb: +10000000000000000000000000000000000000000000000000000000000000000:0:3: +%2llb: +0B10000000000000000000000000000000000000000000000000000000000000000:1:3:0: +%*2llb: +0B10000000000000000000000000000000000000000000000000000000000000000:0:3: +%2llb: +0b10000000000000000000000000000000000000000000000000000000000000000:1:3:0: +%*2llb: +0b10000000000000000000000000000000000000000000000000000000000000000:0:3: +%2llb: +10000000000000000000000000000000000000010100001110101011110110001:1:3:1: +%*2llb: +10000000000000000000000000000000000000010100001110101011110110001:0:3: +%2llb: +0B10000000000000000000000000000000000000010100001110101011110110001:1:3:0: +%*2llb: +0B10000000000000000000000000000000000000010100001110101011110110001:0:3: +%2llb: +0b10000000000000000000000000000000000000010100001110101011110110001:1:3:0: +%*2llb: +0b10000000000000000000000000000000000000010100001110101011110110001:0:3: +%25llb: :0:-1: +%*25llb: :0:-1: +%25llb: -1111011:1:9:-123: +%*25llb: -1111011:0:9: +%25llb: -0B1111011:1:11:-123: +%*25llb: -0B1111011:0:11: +%25llb: -0b1111011:1:11:-123: +%*25llb: -0b1111011:0:11: +%25llb: -1:1:3:-1: +%*25llb: -1:0:3: +%25llb: -0B1:1:5:-1: +%*25llb: -0B1:0:5: +%25llb: -0b1:1:5:-1: +%*25llb: -0b1:0:5: +%25llb: -0:1:3:0: +%*25llb: -0:0:3: +%25llb: -0B0:1:5:0: +%*25llb: -0B0:0:5: +%25llb: -0b0:1:5:0: +%*25llb: -0b0:0:5: +%25llb: 0:1:2:0: +%*25llb: 0:0:2: +%25llb: 0B0:1:4:0: +%*25llb: 0B0:0:4: +%25llb: 0b0:1:4:0: +%*25llb: 0b0:0:4: +%25llb: 1:1:2:1: +%*25llb: 1:0:2: +%25llb: 0B1:1:4:1: +%*25llb: 0B1:0:4: +%25llb: 0b1:1:4:1: +%*25llb: 0b1:0:4: +%25llb: 101010:1:7:42: +%*25llb: 101010:0:7: +%25llb: 0B101010:1:9:42: +%*25llb: 0B101010:0:9: +%25llb: 0b101010:1:9:42: +%*25llb: 0b101010:0:9: +%25llb: 1111111111111111111111111111111111111111111111111111111111111111:1:26:33554431: +%*25llb: 1111111111111111111111111111111111111111111111111111111111111111:0:26: +%25llb: 0B1111111111111111111111111111111111111111111111111111111111111111:1:26:8388607: +%*25llb: 0B1111111111111111111111111111111111111111111111111111111111111111:0:26: +%25llb: 0b1111111111111111111111111111111111111111111111111111111111111111:1:26:8388607: +%*25llb: 0b1111111111111111111111111111111111111111111111111111111111111111:0:26: +%25llb: 10000000000000000000000000000000000000000000000000000000000000000:1:26:16777216: +%*25llb: 10000000000000000000000000000000000000000000000000000000000000000:0:26: +%25llb: 0B10000000000000000000000000000000000000000000000000000000000000000:1:26:4194304: +%*25llb: 0B10000000000000000000000000000000000000000000000000000000000000000:0:26: +%25llb: 0b10000000000000000000000000000000000000000000000000000000000000000:1:26:4194304: +%*25llb: 0b10000000000000000000000000000000000000000000000000000000000000000:0:26: +%25llb: 10000000000000000000000000000000000000010100001110101011110110001:1:26:16777216: +%*25llb: 10000000000000000000000000000000000000010100001110101011110110001:0:26: +%25llb: 0B10000000000000000000000000000000000000010100001110101011110110001:1:26:4194304: +%*25llb: 0B10000000000000000000000000000000000000010100001110101011110110001:0:26: +%25llb: 0b10000000000000000000000000000000000000010100001110101011110110001:1:26:4194304: +%*25llb: 0b10000000000000000000000000000000000000010100001110101011110110001:0:26: +%25llb: +0:1:3:0: +%*25llb: +0:0:3: +%25llb: +0B0:1:5:0: +%*25llb: +0B0:0:5: +%25llb: +0b0:1:5:0: +%*25llb: +0b0:0:5: +%25llb: +1:1:3:1: +%*25llb: +1:0:3: +%25llb: +0B1:1:5:1: +%*25llb: +0B1:0:5: +%25llb: +0b1:1:5:1: +%*25llb: +0b1:0:5: +%25llb: +101010:1:8:42: +%*25llb: +101010:0:8: +%25llb: +0B101010:1:10:42: +%*25llb: +0B101010:0:10: +%25llb: +0b101010:1:10:42: +%*25llb: +0b101010:0:10: +%25llb: +1111111111111111111111111111111111111111111111111111111111111111:1:26:16777215: +%*25llb: +1111111111111111111111111111111111111111111111111111111111111111:0:26: +%25llb: +0B1111111111111111111111111111111111111111111111111111111111111111:1:26:4194303: +%*25llb: +0B1111111111111111111111111111111111111111111111111111111111111111:0:26: +%25llb: +0b1111111111111111111111111111111111111111111111111111111111111111:1:26:4194303: +%*25llb: +0b1111111111111111111111111111111111111111111111111111111111111111:0:26: +%25llb: +10000000000000000000000000000000000000000000000000000000000000000:1:26:8388608: +%*25llb: +10000000000000000000000000000000000000000000000000000000000000000:0:26: +%25llb: +0B10000000000000000000000000000000000000000000000000000000000000000:1:26:2097152: +%*25llb: +0B10000000000000000000000000000000000000000000000000000000000000000:0:26: +%25llb: +0b10000000000000000000000000000000000000000000000000000000000000000:1:26:2097152: +%*25llb: +0b10000000000000000000000000000000000000000000000000000000000000000:0:26: +%25llb: +10000000000000000000000000000000000000010100001110101011110110001:1:26:8388608: +%*25llb: +10000000000000000000000000000000000000010100001110101011110110001:0:26: +%25llb: +0B10000000000000000000000000000000000000010100001110101011110110001:1:26:2097152: +%*25llb: +0B10000000000000000000000000000000000000010100001110101011110110001:0:26: +%25llb: +0b10000000000000000000000000000000000000010100001110101011110110001:1:26:2097152: +%*25llb: +0b10000000000000000000000000000000000000010100001110101011110110001:0:26: diff --git a/stdio-common/tst-scanf-format-ullong-o.input b/stdio-common/tst-scanf-format-ullong-o.input new file mode 100644 index 0000000..98af9ce --- /dev/null +++ b/stdio-common/tst-scanf-format-ullong-o.input @@ -0,0 +1,434 @@ +%llo::0:-1: +%*llo::0:-1: +%llo:-173:1:4:-123: +%*llo:-173:0:4: +%llo:-0173:1:5:-123: +%*llo:-0173:0:5: +%llo:-1:1:2:-1: +%*llo:-1:0:2: +%llo:-01:1:3:-1: +%*llo:-01:0:3: +%llo:-0:1:2:0: +%*llo:-0:0:2: +%llo:-00:1:3:0: +%*llo:-00:0:3: +%llo:0:1:1:0: +%*llo:0:0:1: +%llo:00:1:2:0: +%*llo:00:0:2: +%llo:1:1:1:1: +%*llo:1:0:1: +%llo:01:1:2:1: +%*llo:01:0:2: +%llo:52:1:2:42: +%*llo:52:0:2: +%llo:052:1:3:42: +%*llo:052:0:3: +%llo:1777777777777777777777:1:22:18446744073709551615: +%*llo:1777777777777777777777:0:22: +%llo:01777777777777777777777:1:23:18446744073709551615: +%*llo:01777777777777777777777:0:23: +%llo:2000000000000000000000:1:22:18446744073709551615: +%*llo:2000000000000000000000:0:22: +%llo:02000000000000000000000:1:23:18446744073709551615: +%*llo:02000000000000000000000:0:23: +%llo:2000000000000241653661:1:22:18446744073709551615: +%*llo:2000000000000241653661:0:22: +%llo:02000000000000241653661:1:23:18446744073709551615: +%*llo:02000000000000241653661:0:23: +%llo:+0:1:2:0: +%*llo:+0:0:2: +%llo:+00:1:3:0: +%*llo:+00:0:3: +%llo:+1:1:2:1: +%*llo:+1:0:2: +%llo:+01:1:3:1: +%*llo:+01:0:3: +%llo:+52:1:3:42: +%*llo:+52:0:3: +%llo:+052:1:4:42: +%*llo:+052:0:4: +%llo:+1777777777777777777777:1:23:18446744073709551615: +%*llo:+1777777777777777777777:0:23: +%llo:+01777777777777777777777:1:24:18446744073709551615: +%*llo:+01777777777777777777777:0:24: +%llo:+2000000000000000000000:1:23:18446744073709551615: +%*llo:+2000000000000000000000:0:23: +%llo:+02000000000000000000000:1:24:18446744073709551615: +%*llo:+02000000000000000000000:0:24: +%llo:+2000000000000241653661:1:23:18446744073709551615: +%*llo:+2000000000000241653661:0:23: +%llo:+02000000000000241653661:1:24:18446744073709551615: +%*llo:+02000000000000241653661:0:24: +%1llo::0:-1: +%*1llo::0:-1: +%1llo:-173:0:-1: +%*1llo:-173:0:-1: +%1llo:-0173:0:-1: +%*1llo:-0173:0:-1: +%1llo:-1:0:-1: +%*1llo:-1:0:-1: +%1llo:-01:0:-1: +%*1llo:-01:0:-1: +%1llo:-0:0:-1: +%*1llo:-0:0:-1: +%1llo:-00:0:-1: +%*1llo:-00:0:-1: +%1llo:0:1:1:0: +%*1llo:0:0:1: +%1llo:00:1:1:0: +%*1llo:00:0:1: +%1llo:1:1:1:1: +%*1llo:1:0:1: +%1llo:01:1:1:0: +%*1llo:01:0:1: +%1llo:52:1:1:5: +%*1llo:52:0:1: +%1llo:052:1:1:0: +%*1llo:052:0:1: +%1llo:1777777777777777777777:1:1:1: +%*1llo:1777777777777777777777:0:1: +%1llo:01777777777777777777777:1:1:0: +%*1llo:01777777777777777777777:0:1: +%1llo:2000000000000000000000:1:1:2: +%*1llo:2000000000000000000000:0:1: +%1llo:02000000000000000000000:1:1:0: +%*1llo:02000000000000000000000:0:1: +%1llo:2000000000000241653661:1:1:2: +%*1llo:2000000000000241653661:0:1: +%1llo:02000000000000241653661:1:1:0: +%*1llo:02000000000000241653661:0:1: +%1llo:+0:0:-1: +%*1llo:+0:0:-1: +%1llo:+00:0:-1: +%*1llo:+00:0:-1: +%1llo:+1:0:-1: +%*1llo:+1:0:-1: +%1llo:+01:0:-1: +%*1llo:+01:0:-1: +%1llo:+52:0:-1: +%*1llo:+52:0:-1: +%1llo:+052:0:-1: +%*1llo:+052:0:-1: +%1llo:+1777777777777777777777:0:-1: +%*1llo:+1777777777777777777777:0:-1: +%1llo:+01777777777777777777777:0:-1: +%*1llo:+01777777777777777777777:0:-1: +%1llo:+2000000000000000000000:0:-1: +%*1llo:+2000000000000000000000:0:-1: +%1llo:+02000000000000000000000:0:-1: +%*1llo:+02000000000000000000000:0:-1: +%1llo:+2000000000000241653661:0:-1: +%*1llo:+2000000000000241653661:0:-1: +%1llo:+02000000000000241653661:0:-1: +%*1llo:+02000000000000241653661:0:-1: +%2llo::0:-1: +%*2llo::0:-1: +%2llo:-173:1:2:-1: +%*2llo:-173:0:2: +%2llo:-0173:1:2:0: +%*2llo:-0173:0:2: +%2llo:-1:1:2:-1: +%*2llo:-1:0:2: +%2llo:-01:1:2:0: +%*2llo:-01:0:2: +%2llo:-0:1:2:0: +%*2llo:-0:0:2: +%2llo:-00:1:2:0: +%*2llo:-00:0:2: +%2llo:0:1:1:0: +%*2llo:0:0:1: +%2llo:00:1:2:0: +%*2llo:00:0:2: +%2llo:1:1:1:1: +%*2llo:1:0:1: +%2llo:01:1:2:1: +%*2llo:01:0:2: +%2llo:52:1:2:42: +%*2llo:52:0:2: +%2llo:052:1:2:5: +%*2llo:052:0:2: +%2llo:1777777777777777777777:1:2:15: +%*2llo:1777777777777777777777:0:2: +%2llo:01777777777777777777777:1:2:1: +%*2llo:01777777777777777777777:0:2: +%2llo:2000000000000000000000:1:2:16: +%*2llo:2000000000000000000000:0:2: +%2llo:02000000000000000000000:1:2:2: +%*2llo:02000000000000000000000:0:2: +%2llo:2000000000000241653661:1:2:16: +%*2llo:2000000000000241653661:0:2: +%2llo:02000000000000241653661:1:2:2: +%*2llo:02000000000000241653661:0:2: +%2llo:+0:1:2:0: +%*2llo:+0:0:2: +%2llo:+00:1:2:0: +%*2llo:+00:0:2: +%2llo:+1:1:2:1: +%*2llo:+1:0:2: +%2llo:+01:1:2:0: +%*2llo:+01:0:2: +%2llo:+52:1:2:5: +%*2llo:+52:0:2: +%2llo:+052:1:2:0: +%*2llo:+052:0:2: +%2llo:+1777777777777777777777:1:2:1: +%*2llo:+1777777777777777777777:0:2: +%2llo:+01777777777777777777777:1:2:0: +%*2llo:+01777777777777777777777:0:2: +%2llo:+2000000000000000000000:1:2:2: +%*2llo:+2000000000000000000000:0:2: +%2llo:+02000000000000000000000:1:2:0: +%*2llo:+02000000000000000000000:0:2: +%2llo:+2000000000000241653661:1:2:2: +%*2llo:+2000000000000241653661:0:2: +%2llo:+02000000000000241653661:1:2:0: +%*2llo:+02000000000000241653661:0:2: +%15llo::0:-1: +%*15llo::0:-1: +%15llo:-173:1:4:-123: +%*15llo:-173:0:4: +%15llo:-0173:1:5:-123: +%*15llo:-0173:0:5: +%15llo:-1:1:2:-1: +%*15llo:-1:0:2: +%15llo:-01:1:3:-1: +%*15llo:-01:0:3: +%15llo:-0:1:2:0: +%*15llo:-0:0:2: +%15llo:-00:1:3:0: +%*15llo:-00:0:3: +%15llo:0:1:1:0: +%*15llo:0:0:1: +%15llo:00:1:2:0: +%*15llo:00:0:2: +%15llo:1:1:1:1: +%*15llo:1:0:1: +%15llo:01:1:2:1: +%*15llo:01:0:2: +%15llo:52:1:2:42: +%*15llo:52:0:2: +%15llo:052:1:3:42: +%*15llo:052:0:3: +%15llo:1777777777777777777777:1:15:8796093022207: +%*15llo:1777777777777777777777:0:15: +%15llo:01777777777777777777777:1:15:1099511627775: +%*15llo:01777777777777777777777:0:15: +%15llo:2000000000000000000000:1:15:8796093022208: +%*15llo:2000000000000000000000:0:15: +%15llo:02000000000000000000000:1:15:1099511627776: +%*15llo:02000000000000000000000:0:15: +%15llo:2000000000000241653661:1:15:8796093022228: +%*15llo:2000000000000241653661:0:15: +%15llo:02000000000000241653661:1:15:1099511627778: +%*15llo:02000000000000241653661:0:15: +%15llo:+0:1:2:0: +%*15llo:+0:0:2: +%15llo:+00:1:3:0: +%*15llo:+00:0:3: +%15llo:+1:1:2:1: +%*15llo:+1:0:2: +%15llo:+01:1:3:1: +%*15llo:+01:0:3: +%15llo:+52:1:3:42: +%*15llo:+52:0:3: +%15llo:+052:1:4:42: +%*15llo:+052:0:4: +%15llo:+1777777777777777777777:1:15:1099511627775: +%*15llo:+1777777777777777777777:0:15: +%15llo:+01777777777777777777777:1:15:137438953471: +%*15llo:+01777777777777777777777:0:15: +%15llo:+2000000000000000000000:1:15:1099511627776: +%*15llo:+2000000000000000000000:0:15: +%15llo:+02000000000000000000000:1:15:137438953472: +%*15llo:+02000000000000000000000:0:15: +%15llo:+2000000000000241653661:1:15:1099511627778: +%*15llo:+2000000000000241653661:0:15: +%15llo:+02000000000000241653661:1:15:137438953472: +%*15llo:+02000000000000241653661:0:15: +%25llo::0:-1: +%*25llo::0:-1: +%25llo:-173:1:4:-123: +%*25llo:-173:0:4: +%25llo:-0173:1:5:-123: +%*25llo:-0173:0:5: +%25llo:-1:1:2:-1: +%*25llo:-1:0:2: +%25llo:-01:1:3:-1: +%*25llo:-01:0:3: +%25llo:-0:1:2:0: +%*25llo:-0:0:2: +%25llo:-00:1:3:0: +%*25llo:-00:0:3: +%25llo:0:1:1:0: +%*25llo:0:0:1: +%25llo:00:1:2:0: +%*25llo:00:0:2: +%25llo:1:1:1:1: +%*25llo:1:0:1: +%25llo:01:1:2:1: +%*25llo:01:0:2: +%25llo:52:1:2:42: +%*25llo:52:0:2: +%25llo:052:1:3:42: +%*25llo:052:0:3: +%25llo:1777777777777777777777:1:22:18446744073709551615: +%*25llo:1777777777777777777777:0:22: +%25llo:01777777777777777777777:1:23:18446744073709551615: +%*25llo:01777777777777777777777:0:23: +%25llo:2000000000000000000000:1:22:18446744073709551615: +%*25llo:2000000000000000000000:0:22: +%25llo:02000000000000000000000:1:23:18446744073709551615: +%*25llo:02000000000000000000000:0:23: +%25llo:2000000000000241653661:1:22:18446744073709551615: +%*25llo:2000000000000241653661:0:22: +%25llo:02000000000000241653661:1:23:18446744073709551615: +%*25llo:02000000000000241653661:0:23: +%25llo:+0:1:2:0: +%*25llo:+0:0:2: +%25llo:+00:1:3:0: +%*25llo:+00:0:3: +%25llo:+1:1:2:1: +%*25llo:+1:0:2: +%25llo:+01:1:3:1: +%*25llo:+01:0:3: +%25llo:+52:1:3:42: +%*25llo:+52:0:3: +%25llo:+052:1:4:42: +%*25llo:+052:0:4: +%25llo:+1777777777777777777777:1:23:18446744073709551615: +%*25llo:+1777777777777777777777:0:23: +%25llo:+01777777777777777777777:1:24:18446744073709551615: +%*25llo:+01777777777777777777777:0:24: +%25llo:+2000000000000000000000:1:23:18446744073709551615: +%*25llo:+2000000000000000000000:0:23: +%25llo:+02000000000000000000000:1:24:18446744073709551615: +%*25llo:+02000000000000000000000:0:24: +%25llo:+2000000000000241653661:1:23:18446744073709551615: +%*25llo:+2000000000000241653661:0:23: +%25llo:+02000000000000241653661:1:24:18446744073709551615: +%*25llo:+02000000000000241653661:0:24: +%2llo: :0:-1: +%*2llo: :0:-1: +%2llo: -173:1:3:-1: +%*2llo: -173:0:3: +%2llo: -0173:1:3:0: +%*2llo: -0173:0:3: +%2llo: -1:1:3:-1: +%*2llo: -1:0:3: +%2llo: -01:1:3:0: +%*2llo: -01:0:3: +%2llo: -0:1:3:0: +%*2llo: -0:0:3: +%2llo: -00:1:3:0: +%*2llo: -00:0:3: +%2llo: 0:1:2:0: +%*2llo: 0:0:2: +%2llo: 00:1:3:0: +%*2llo: 00:0:3: +%2llo: 1:1:2:1: +%*2llo: 1:0:2: +%2llo: 01:1:3:1: +%*2llo: 01:0:3: +%2llo: 52:1:3:42: +%*2llo: 52:0:3: +%2llo: 052:1:3:5: +%*2llo: 052:0:3: +%2llo: 1777777777777777777777:1:3:15: +%*2llo: 1777777777777777777777:0:3: +%2llo: 01777777777777777777777:1:3:1: +%*2llo: 01777777777777777777777:0:3: +%2llo: 2000000000000000000000:1:3:16: +%*2llo: 2000000000000000000000:0:3: +%2llo: 02000000000000000000000:1:3:2: +%*2llo: 02000000000000000000000:0:3: +%2llo: 2000000000000241653661:1:3:16: +%*2llo: 2000000000000241653661:0:3: +%2llo: 02000000000000241653661:1:3:2: +%*2llo: 02000000000000241653661:0:3: +%2llo: +0:1:3:0: +%*2llo: +0:0:3: +%2llo: +00:1:3:0: +%*2llo: +00:0:3: +%2llo: +1:1:3:1: +%*2llo: +1:0:3: +%2llo: +01:1:3:0: +%*2llo: +01:0:3: +%2llo: +52:1:3:5: +%*2llo: +52:0:3: +%2llo: +052:1:3:0: +%*2llo: +052:0:3: +%2llo: +1777777777777777777777:1:3:1: +%*2llo: +1777777777777777777777:0:3: +%2llo: +01777777777777777777777:1:3:0: +%*2llo: +01777777777777777777777:0:3: +%2llo: +2000000000000000000000:1:3:2: +%*2llo: +2000000000000000000000:0:3: +%2llo: +02000000000000000000000:1:3:0: +%*2llo: +02000000000000000000000:0:3: +%2llo: +2000000000000241653661:1:3:2: +%*2llo: +2000000000000241653661:0:3: +%2llo: +02000000000000241653661:1:3:0: +%*2llo: +02000000000000241653661:0:3: +%25llo: :0:-1: +%*25llo: :0:-1: +%25llo: -173:1:5:-123: +%*25llo: -173:0:5: +%25llo: -0173:1:6:-123: +%*25llo: -0173:0:6: +%25llo: -1:1:3:-1: +%*25llo: -1:0:3: +%25llo: -01:1:4:-1: +%*25llo: -01:0:4: +%25llo: -0:1:3:0: +%*25llo: -0:0:3: +%25llo: -00:1:4:0: +%*25llo: -00:0:4: +%25llo: 0:1:2:0: +%*25llo: 0:0:2: +%25llo: 00:1:3:0: +%*25llo: 00:0:3: +%25llo: 1:1:2:1: +%*25llo: 1:0:2: +%25llo: 01:1:3:1: +%*25llo: 01:0:3: +%25llo: 52:1:3:42: +%*25llo: 52:0:3: +%25llo: 052:1:4:42: +%*25llo: 052:0:4: +%25llo: 1777777777777777777777:1:23:18446744073709551615: +%*25llo: 1777777777777777777777:0:23: +%25llo: 01777777777777777777777:1:24:18446744073709551615: +%*25llo: 01777777777777777777777:0:24: +%25llo: 2000000000000000000000:1:23:18446744073709551615: +%*25llo: 2000000000000000000000:0:23: +%25llo: 02000000000000000000000:1:24:18446744073709551615: +%*25llo: 02000000000000000000000:0:24: +%25llo: 2000000000000241653661:1:23:18446744073709551615: +%*25llo: 2000000000000241653661:0:23: +%25llo: 02000000000000241653661:1:24:18446744073709551615: +%*25llo: 02000000000000241653661:0:24: +%25llo: +0:1:3:0: +%*25llo: +0:0:3: +%25llo: +00:1:4:0: +%*25llo: +00:0:4: +%25llo: +1:1:3:1: +%*25llo: +1:0:3: +%25llo: +01:1:4:1: +%*25llo: +01:0:4: +%25llo: +52:1:4:42: +%*25llo: +52:0:4: +%25llo: +052:1:5:42: +%*25llo: +052:0:5: +%25llo: +1777777777777777777777:1:24:18446744073709551615: +%*25llo: +1777777777777777777777:0:24: +%25llo: +01777777777777777777777:1:25:18446744073709551615: +%*25llo: +01777777777777777777777:0:25: +%25llo: +2000000000000000000000:1:24:18446744073709551615: +%*25llo: +2000000000000000000000:0:24: +%25llo: +02000000000000000000000:1:25:18446744073709551615: +%*25llo: +02000000000000000000000:0:25: +%25llo: +2000000000000241653661:1:24:18446744073709551615: +%*25llo: +2000000000000241653661:0:24: +%25llo: +02000000000000241653661:1:25:18446744073709551615: +%*25llo: +02000000000000241653661:0:25: diff --git a/stdio-common/tst-scanf-format-ullong-u.input b/stdio-common/tst-scanf-format-ullong-u.input new file mode 100644 index 0000000..9260e70 --- /dev/null +++ b/stdio-common/tst-scanf-format-ullong-u.input @@ -0,0 +1,224 @@ +%llu::0:-1: +%*llu::0:-1: +%llu:-123:1:4:18446744073709551493: +%*llu:-123:0:4: +%llu:-1:1:2:18446744073709551615: +%*llu:-1:0:2: +%llu:-0:1:2:0: +%*llu:-0:0:2: +%llu:0:1:1:0: +%*llu:0:0:1: +%llu:1:1:1:1: +%*llu:1:0:1: +%llu:42:1:2:42: +%*llu:42:0:2: +%llu:18446744073709551615:1:20:18446744073709551615: +%*llu:18446744073709551615:0:20: +%llu:18446744073709551616:1:20:18446744073709551615: +%*llu:18446744073709551616:0:20: +%llu:18446744073751975857:1:20:18446744073709551615: +%*llu:18446744073751975857:0:20: +%llu:+0:1:2:0: +%*llu:+0:0:2: +%llu:+1:1:2:1: +%*llu:+1:0:2: +%llu:+42:1:3:42: +%*llu:+42:0:3: +%llu:+18446744073709551615:1:21:18446744073709551615: +%*llu:+18446744073709551615:0:21: +%llu:+18446744073709551616:1:21:18446744073709551615: +%*llu:+18446744073709551616:0:21: +%llu:+18446744073751975857:1:21:18446744073709551615: +%*llu:+18446744073751975857:0:21: +%1llu::0:-1: +%*1llu::0:-1: +%1llu:-123:0:-1: +%*1llu:-123:0:-1: +%1llu:-1:0:-1: +%*1llu:-1:0:-1: +%1llu:-0:0:-1: +%*1llu:-0:0:-1: +%1llu:0:1:1:0: +%*1llu:0:0:1: +%1llu:1:1:1:1: +%*1llu:1:0:1: +%1llu:42:1:1:4: +%*1llu:42:0:1: +%1llu:18446744073709551615:1:1:1: +%*1llu:18446744073709551615:0:1: +%1llu:18446744073709551616:1:1:1: +%*1llu:18446744073709551616:0:1: +%1llu:18446744073751975857:1:1:1: +%*1llu:18446744073751975857:0:1: +%1llu:+0:0:-1: +%*1llu:+0:0:-1: +%1llu:+1:0:-1: +%*1llu:+1:0:-1: +%1llu:+42:0:-1: +%*1llu:+42:0:-1: +%1llu:+18446744073709551615:0:-1: +%*1llu:+18446744073709551615:0:-1: +%1llu:+18446744073709551616:0:-1: +%*1llu:+18446744073709551616:0:-1: +%1llu:+18446744073751975857:0:-1: +%*1llu:+18446744073751975857:0:-1: +%2llu::0:-1: +%*2llu::0:-1: +%2llu:-123:1:2:18446744073709551615: +%*2llu:-123:0:2: +%2llu:-1:1:2:18446744073709551615: +%*2llu:-1:0:2: +%2llu:-0:1:2:0: +%*2llu:-0:0:2: +%2llu:0:1:1:0: +%*2llu:0:0:1: +%2llu:1:1:1:1: +%*2llu:1:0:1: +%2llu:42:1:2:42: +%*2llu:42:0:2: +%2llu:18446744073709551615:1:2:18: +%*2llu:18446744073709551615:0:2: +%2llu:18446744073709551616:1:2:18: +%*2llu:18446744073709551616:0:2: +%2llu:18446744073751975857:1:2:18: +%*2llu:18446744073751975857:0:2: +%2llu:+0:1:2:0: +%*2llu:+0:0:2: +%2llu:+1:1:2:1: +%*2llu:+1:0:2: +%2llu:+42:1:2:4: +%*2llu:+42:0:2: +%2llu:+18446744073709551615:1:2:1: +%*2llu:+18446744073709551615:0:2: +%2llu:+18446744073709551616:1:2:1: +%*2llu:+18446744073709551616:0:2: +%2llu:+18446744073751975857:1:2:1: +%*2llu:+18446744073751975857:0:2: +%15llu::0:-1: +%*15llu::0:-1: +%15llu:-123:1:4:18446744073709551493: +%*15llu:-123:0:4: +%15llu:-1:1:2:18446744073709551615: +%*15llu:-1:0:2: +%15llu:-0:1:2:0: +%*15llu:-0:0:2: +%15llu:0:1:1:0: +%*15llu:0:0:1: +%15llu:1:1:1:1: +%*15llu:1:0:1: +%15llu:42:1:2:42: +%*15llu:42:0:2: +%15llu:18446744073709551615:1:15:184467440737095: +%*15llu:18446744073709551615:0:15: +%15llu:18446744073709551616:1:15:184467440737095: +%*15llu:18446744073709551616:0:15: +%15llu:18446744073751975857:1:15:184467440737519: +%*15llu:18446744073751975857:0:15: +%15llu:+0:1:2:0: +%*15llu:+0:0:2: +%15llu:+1:1:2:1: +%*15llu:+1:0:2: +%15llu:+42:1:3:42: +%*15llu:+42:0:3: +%15llu:+18446744073709551615:1:15:18446744073709: +%*15llu:+18446744073709551615:0:15: +%15llu:+18446744073709551616:1:15:18446744073709: +%*15llu:+18446744073709551616:0:15: +%15llu:+18446744073751975857:1:15:18446744073751: +%*15llu:+18446744073751975857:0:15: +%25llu::0:-1: +%*25llu::0:-1: +%25llu:-123:1:4:18446744073709551493: +%*25llu:-123:0:4: +%25llu:-1:1:2:18446744073709551615: +%*25llu:-1:0:2: +%25llu:-0:1:2:0: +%*25llu:-0:0:2: +%25llu:0:1:1:0: +%*25llu:0:0:1: +%25llu:1:1:1:1: +%*25llu:1:0:1: +%25llu:42:1:2:42: +%*25llu:42:0:2: +%25llu:18446744073709551615:1:20:18446744073709551615: +%*25llu:18446744073709551615:0:20: +%25llu:18446744073709551616:1:20:18446744073709551615: +%*25llu:18446744073709551616:0:20: +%25llu:18446744073751975857:1:20:18446744073709551615: +%*25llu:18446744073751975857:0:20: +%25llu:+0:1:2:0: +%*25llu:+0:0:2: +%25llu:+1:1:2:1: +%*25llu:+1:0:2: +%25llu:+42:1:3:42: +%*25llu:+42:0:3: +%25llu:+18446744073709551615:1:21:18446744073709551615: +%*25llu:+18446744073709551615:0:21: +%25llu:+18446744073709551616:1:21:18446744073709551615: +%*25llu:+18446744073709551616:0:21: +%25llu:+18446744073751975857:1:21:18446744073709551615: +%*25llu:+18446744073751975857:0:21: +%2llu: :0:-1: +%*2llu: :0:-1: +%2llu: -123:1:3:18446744073709551615: +%*2llu: -123:0:3: +%2llu: -1:1:3:18446744073709551615: +%*2llu: -1:0:3: +%2llu: -0:1:3:0: +%*2llu: -0:0:3: +%2llu: 0:1:2:0: +%*2llu: 0:0:2: +%2llu: 1:1:2:1: +%*2llu: 1:0:2: +%2llu: 42:1:3:42: +%*2llu: 42:0:3: +%2llu: 18446744073709551615:1:3:18: +%*2llu: 18446744073709551615:0:3: +%2llu: 18446744073709551616:1:3:18: +%*2llu: 18446744073709551616:0:3: +%2llu: 18446744073751975857:1:3:18: +%*2llu: 18446744073751975857:0:3: +%2llu: +0:1:3:0: +%*2llu: +0:0:3: +%2llu: +1:1:3:1: +%*2llu: +1:0:3: +%2llu: +42:1:3:4: +%*2llu: +42:0:3: +%2llu: +18446744073709551615:1:3:1: +%*2llu: +18446744073709551615:0:3: +%2llu: +18446744073709551616:1:3:1: +%*2llu: +18446744073709551616:0:3: +%2llu: +18446744073751975857:1:3:1: +%*2llu: +18446744073751975857:0:3: +%25llu: :0:-1: +%*25llu: :0:-1: +%25llu: -123:1:5:18446744073709551493: +%*25llu: -123:0:5: +%25llu: -1:1:3:18446744073709551615: +%*25llu: -1:0:3: +%25llu: -0:1:3:0: +%*25llu: -0:0:3: +%25llu: 0:1:2:0: +%*25llu: 0:0:2: +%25llu: 1:1:2:1: +%*25llu: 1:0:2: +%25llu: 42:1:3:42: +%*25llu: 42:0:3: +%25llu: 18446744073709551615:1:21:18446744073709551615: +%*25llu: 18446744073709551615:0:21: +%25llu: 18446744073709551616:1:21:18446744073709551615: +%*25llu: 18446744073709551616:0:21: +%25llu: 18446744073751975857:1:21:18446744073709551615: +%*25llu: 18446744073751975857:0:21: +%25llu: +0:1:3:0: +%*25llu: +0:0:3: +%25llu: +1:1:3:1: +%*25llu: +1:0:3: +%25llu: +42:1:4:42: +%*25llu: +42:0:4: +%25llu: +18446744073709551615:1:22:18446744073709551615: +%*25llu: +18446744073709551615:0:22: +%25llu: +18446744073709551616:1:22:18446744073709551615: +%*25llu: +18446744073709551616:0:22: +%25llu: +18446744073751975857:1:22:18446744073709551615: +%*25llu: +18446744073751975857:0:22: diff --git a/stdio-common/tst-scanf-format-ullong-x.input b/stdio-common/tst-scanf-format-ullong-x.input new file mode 100644 index 0000000..1833713 --- /dev/null +++ b/stdio-common/tst-scanf-format-ullong-x.input @@ -0,0 +1,742 @@ +%llx::0:-1: +%*llx::0:-1: +%llx:-7b:1:3:18446744073709551493: +%*llx:-7b:0:3: +%llx:-7B:1:3:18446744073709551493: +%*llx:-7B:0:3: +%llx:-0X7b:1:5:18446744073709551493: +%*llx:-0X7b:0:5: +%llx:-0x7B:1:5:18446744073709551493: +%*llx:-0x7B:0:5: +%llx:-1:1:2:18446744073709551615: +%*llx:-1:0:2: +%llx:-0X1:1:4:18446744073709551615: +%*llx:-0X1:0:4: +%llx:-0x1:1:4:18446744073709551615: +%*llx:-0x1:0:4: +%llx:-0:1:2:0: +%*llx:-0:0:2: +%llx:-0X0:1:4:0: +%*llx:-0X0:0:4: +%llx:-0x0:1:4:0: +%*llx:-0x0:0:4: +%llx:0:1:1:0: +%*llx:0:0:1: +%llx:0X0:1:3:0: +%*llx:0X0:0:3: +%llx:0x0:1:3:0: +%*llx:0x0:0:3: +%llx:1:1:1:1: +%*llx:1:0:1: +%llx:0X1:1:3:1: +%*llx:0X1:0:3: +%llx:0x1:1:3:1: +%*llx:0x1:0:3: +%llx:2a:1:2:42: +%*llx:2a:0:2: +%llx:2A:1:2:42: +%*llx:2A:0:2: +%llx:0X2a:1:4:42: +%*llx:0X2a:0:4: +%llx:0x2A:1:4:42: +%*llx:0x2A:0:4: +%llx:ffffffffffffffff:1:16:18446744073709551615: +%*llx:ffffffffffffffff:0:16: +%llx:FFFFFFFFFFFFFFFF:1:16:18446744073709551615: +%*llx:FFFFFFFFFFFFFFFF:0:16: +%llx:0Xffffffffffffffff:1:18:18446744073709551615: +%*llx:0Xffffffffffffffff:0:18: +%llx:0xFFFFFFFFFFFFFFFF:1:18:18446744073709551615: +%*llx:0xFFFFFFFFFFFFFFFF:0:18: +%llx:10000000000000000:1:17:18446744073709551615: +%*llx:10000000000000000:0:17: +%llx:0X10000000000000000:1:19:18446744073709551615: +%*llx:0X10000000000000000:0:19: +%llx:0x10000000000000000:1:19:18446744073709551615: +%*llx:0x10000000000000000:0:19: +%llx:100000000028757b1:1:17:18446744073709551615: +%*llx:100000000028757b1:0:17: +%llx:100000000028757B1:1:17:18446744073709551615: +%*llx:100000000028757B1:0:17: +%llx:0X100000000028757b1:1:19:18446744073709551615: +%*llx:0X100000000028757b1:0:19: +%llx:0x100000000028757B1:1:19:18446744073709551615: +%*llx:0x100000000028757B1:0:19: +%llx:+0:1:2:0: +%*llx:+0:0:2: +%llx:+0X0:1:4:0: +%*llx:+0X0:0:4: +%llx:+0x0:1:4:0: +%*llx:+0x0:0:4: +%llx:+1:1:2:1: +%*llx:+1:0:2: +%llx:+0X1:1:4:1: +%*llx:+0X1:0:4: +%llx:+0x1:1:4:1: +%*llx:+0x1:0:4: +%llx:+2a:1:3:42: +%*llx:+2a:0:3: +%llx:+2A:1:3:42: +%*llx:+2A:0:3: +%llx:+0X2a:1:5:42: +%*llx:+0X2a:0:5: +%llx:+0x2A:1:5:42: +%*llx:+0x2A:0:5: +%llx:+ffffffffffffffff:1:17:18446744073709551615: +%*llx:+ffffffffffffffff:0:17: +%llx:+FFFFFFFFFFFFFFFF:1:17:18446744073709551615: +%*llx:+FFFFFFFFFFFFFFFF:0:17: +%llx:+0Xffffffffffffffff:1:19:18446744073709551615: +%*llx:+0Xffffffffffffffff:0:19: +%llx:+0xFFFFFFFFFFFFFFFF:1:19:18446744073709551615: +%*llx:+0xFFFFFFFFFFFFFFFF:0:19: +%llx:+10000000000000000:1:18:18446744073709551615: +%*llx:+10000000000000000:0:18: +%llx:+0X10000000000000000:1:20:18446744073709551615: +%*llx:+0X10000000000000000:0:20: +%llx:+0x10000000000000000:1:20:18446744073709551615: +%*llx:+0x10000000000000000:0:20: +%llx:+100000000028757b1:1:18:18446744073709551615: +%*llx:+100000000028757b1:0:18: +%llx:+100000000028757B1:1:18:18446744073709551615: +%*llx:+100000000028757B1:0:18: +%llx:+0X100000000028757b1:1:20:18446744073709551615: +%*llx:+0X100000000028757b1:0:20: +%llx:+0x100000000028757B1:1:20:18446744073709551615: +%*llx:+0x100000000028757B1:0:20: +%1llx::0:-1: +%*1llx::0:-1: +%1llx:-7b:0:-1: +%*1llx:-7b:0:-1: +%1llx:-7B:0:-1: +%*1llx:-7B:0:-1: +%1llx:-0X7b:0:-1: +%*1llx:-0X7b:0:-1: +%1llx:-0x7B:0:-1: +%*1llx:-0x7B:0:-1: +%1llx:-1:0:-1: +%*1llx:-1:0:-1: +%1llx:-0X1:0:-1: +%*1llx:-0X1:0:-1: +%1llx:-0x1:0:-1: +%*1llx:-0x1:0:-1: +%1llx:-0:0:-1: +%*1llx:-0:0:-1: +%1llx:-0X0:0:-1: +%*1llx:-0X0:0:-1: +%1llx:-0x0:0:-1: +%*1llx:-0x0:0:-1: +%1llx:0:1:1:0: +%*1llx:0:0:1: +%1llx:0X0:1:1:0: +%*1llx:0X0:0:1: +%1llx:0x0:1:1:0: +%*1llx:0x0:0:1: +%1llx:1:1:1:1: +%*1llx:1:0:1: +%1llx:0X1:1:1:0: +%*1llx:0X1:0:1: +%1llx:0x1:1:1:0: +%*1llx:0x1:0:1: +%1llx:2a:1:1:2: +%*1llx:2a:0:1: +%1llx:2A:1:1:2: +%*1llx:2A:0:1: +%1llx:0X2a:1:1:0: +%*1llx:0X2a:0:1: +%1llx:0x2A:1:1:0: +%*1llx:0x2A:0:1: +%1llx:ffffffffffffffff:1:1:15: +%*1llx:ffffffffffffffff:0:1: +%1llx:FFFFFFFFFFFFFFFF:1:1:15: +%*1llx:FFFFFFFFFFFFFFFF:0:1: +%1llx:0Xffffffffffffffff:1:1:0: +%*1llx:0Xffffffffffffffff:0:1: +%1llx:0xFFFFFFFFFFFFFFFF:1:1:0: +%*1llx:0xFFFFFFFFFFFFFFFF:0:1: +%1llx:10000000000000000:1:1:1: +%*1llx:10000000000000000:0:1: +%1llx:0X10000000000000000:1:1:0: +%*1llx:0X10000000000000000:0:1: +%1llx:0x10000000000000000:1:1:0: +%*1llx:0x10000000000000000:0:1: +%1llx:100000000028757b1:1:1:1: +%*1llx:100000000028757b1:0:1: +%1llx:100000000028757B1:1:1:1: +%*1llx:100000000028757B1:0:1: +%1llx:0X100000000028757b1:1:1:0: +%*1llx:0X100000000028757b1:0:1: +%1llx:0x100000000028757B1:1:1:0: +%*1llx:0x100000000028757B1:0:1: +%1llx:+0:0:-1: +%*1llx:+0:0:-1: +%1llx:+0X0:0:-1: +%*1llx:+0X0:0:-1: +%1llx:+0x0:0:-1: +%*1llx:+0x0:0:-1: +%1llx:+1:0:-1: +%*1llx:+1:0:-1: +%1llx:+0X1:0:-1: +%*1llx:+0X1:0:-1: +%1llx:+0x1:0:-1: +%*1llx:+0x1:0:-1: +%1llx:+2a:0:-1: +%*1llx:+2a:0:-1: +%1llx:+2A:0:-1: +%*1llx:+2A:0:-1: +%1llx:+0X2a:0:-1: +%*1llx:+0X2a:0:-1: +%1llx:+0x2A:0:-1: +%*1llx:+0x2A:0:-1: +%1llx:+ffffffffffffffff:0:-1: +%*1llx:+ffffffffffffffff:0:-1: +%1llx:+FFFFFFFFFFFFFFFF:0:-1: +%*1llx:+FFFFFFFFFFFFFFFF:0:-1: +%1llx:+0Xffffffffffffffff:0:-1: +%*1llx:+0Xffffffffffffffff:0:-1: +%1llx:+0xFFFFFFFFFFFFFFFF:0:-1: +%*1llx:+0xFFFFFFFFFFFFFFFF:0:-1: +%1llx:+10000000000000000:0:-1: +%*1llx:+10000000000000000:0:-1: +%1llx:+0X10000000000000000:0:-1: +%*1llx:+0X10000000000000000:0:-1: +%1llx:+0x10000000000000000:0:-1: +%*1llx:+0x10000000000000000:0:-1: +%1llx:+100000000028757b1:0:-1: +%*1llx:+100000000028757b1:0:-1: +%1llx:+100000000028757B1:0:-1: +%*1llx:+100000000028757B1:0:-1: +%1llx:+0X100000000028757b1:0:-1: +%*1llx:+0X100000000028757b1:0:-1: +%1llx:+0x100000000028757B1:0:-1: +%*1llx:+0x100000000028757B1:0:-1: +%2llx::0:-1: +%*2llx::0:-1: +%2llx:-7b:1:2:18446744073709551609: +%*2llx:-7b:0:2: +%2llx:-7B:1:2:18446744073709551609: +%*2llx:-7B:0:2: +%2llx:-0X7b:1:2:0: +%*2llx:-0X7b:0:2: +%2llx:-0x7B:1:2:0: +%*2llx:-0x7B:0:2: +%2llx:-1:1:2:18446744073709551615: +%*2llx:-1:0:2: +%2llx:-0X1:1:2:0: +%*2llx:-0X1:0:2: +%2llx:-0x1:1:2:0: +%*2llx:-0x1:0:2: +%2llx:-0:1:2:0: +%*2llx:-0:0:2: +%2llx:-0X0:1:2:0: +%*2llx:-0X0:0:2: +%2llx:-0x0:1:2:0: +%*2llx:-0x0:0:2: +%2llx:0:1:1:0: +%*2llx:0:0:1: +%2llx:0X0:0:-1: +%*2llx:0X0:0:-1: +%2llx:0x0:0:-1: +%*2llx:0x0:0:-1: +%2llx:1:1:1:1: +%*2llx:1:0:1: +%2llx:0X1:0:-1: +%*2llx:0X1:0:-1: +%2llx:0x1:0:-1: +%*2llx:0x1:0:-1: +%2llx:2a:1:2:42: +%*2llx:2a:0:2: +%2llx:2A:1:2:42: +%*2llx:2A:0:2: +%2llx:0X2a:0:-1: +%*2llx:0X2a:0:-1: +%2llx:0x2A:0:-1: +%*2llx:0x2A:0:-1: +%2llx:ffffffffffffffff:1:2:255: +%*2llx:ffffffffffffffff:0:2: +%2llx:FFFFFFFFFFFFFFFF:1:2:255: +%*2llx:FFFFFFFFFFFFFFFF:0:2: +%2llx:0Xffffffffffffffff:0:-1: +%*2llx:0Xffffffffffffffff:0:-1: +%2llx:0xFFFFFFFFFFFFFFFF:0:-1: +%*2llx:0xFFFFFFFFFFFFFFFF:0:-1: +%2llx:10000000000000000:1:2:16: +%*2llx:10000000000000000:0:2: +%2llx:0X10000000000000000:0:-1: +%*2llx:0X10000000000000000:0:-1: +%2llx:0x10000000000000000:0:-1: +%*2llx:0x10000000000000000:0:-1: +%2llx:100000000028757b1:1:2:16: +%*2llx:100000000028757b1:0:2: +%2llx:100000000028757B1:1:2:16: +%*2llx:100000000028757B1:0:2: +%2llx:0X100000000028757b1:0:-1: +%*2llx:0X100000000028757b1:0:-1: +%2llx:0x100000000028757B1:0:-1: +%*2llx:0x100000000028757B1:0:-1: +%2llx:+0:1:2:0: +%*2llx:+0:0:2: +%2llx:+0X0:1:2:0: +%*2llx:+0X0:0:2: +%2llx:+0x0:1:2:0: +%*2llx:+0x0:0:2: +%2llx:+1:1:2:1: +%*2llx:+1:0:2: +%2llx:+0X1:1:2:0: +%*2llx:+0X1:0:2: +%2llx:+0x1:1:2:0: +%*2llx:+0x1:0:2: +%2llx:+2a:1:2:2: +%*2llx:+2a:0:2: +%2llx:+2A:1:2:2: +%*2llx:+2A:0:2: +%2llx:+0X2a:1:2:0: +%*2llx:+0X2a:0:2: +%2llx:+0x2A:1:2:0: +%*2llx:+0x2A:0:2: +%2llx:+ffffffffffffffff:1:2:15: +%*2llx:+ffffffffffffffff:0:2: +%2llx:+FFFFFFFFFFFFFFFF:1:2:15: +%*2llx:+FFFFFFFFFFFFFFFF:0:2: +%2llx:+0Xffffffffffffffff:1:2:0: +%*2llx:+0Xffffffffffffffff:0:2: +%2llx:+0xFFFFFFFFFFFFFFFF:1:2:0: +%*2llx:+0xFFFFFFFFFFFFFFFF:0:2: +%2llx:+10000000000000000:1:2:1: +%*2llx:+10000000000000000:0:2: +%2llx:+0X10000000000000000:1:2:0: +%*2llx:+0X10000000000000000:0:2: +%2llx:+0x10000000000000000:1:2:0: +%*2llx:+0x10000000000000000:0:2: +%2llx:+100000000028757b1:1:2:1: +%*2llx:+100000000028757b1:0:2: +%2llx:+100000000028757B1:1:2:1: +%*2llx:+100000000028757B1:0:2: +%2llx:+0X100000000028757b1:1:2:0: +%*2llx:+0X100000000028757b1:0:2: +%2llx:+0x100000000028757B1:1:2:0: +%*2llx:+0x100000000028757B1:0:2: +%15llx::0:-1: +%*15llx::0:-1: +%15llx:-7b:1:3:18446744073709551493: +%*15llx:-7b:0:3: +%15llx:-7B:1:3:18446744073709551493: +%*15llx:-7B:0:3: +%15llx:-0X7b:1:5:18446744073709551493: +%*15llx:-0X7b:0:5: +%15llx:-0x7B:1:5:18446744073709551493: +%*15llx:-0x7B:0:5: +%15llx:-1:1:2:18446744073709551615: +%*15llx:-1:0:2: +%15llx:-0X1:1:4:18446744073709551615: +%*15llx:-0X1:0:4: +%15llx:-0x1:1:4:18446744073709551615: +%*15llx:-0x1:0:4: +%15llx:-0:1:2:0: +%*15llx:-0:0:2: +%15llx:-0X0:1:4:0: +%*15llx:-0X0:0:4: +%15llx:-0x0:1:4:0: +%*15llx:-0x0:0:4: +%15llx:0:1:1:0: +%*15llx:0:0:1: +%15llx:0X0:1:3:0: +%*15llx:0X0:0:3: +%15llx:0x0:1:3:0: +%*15llx:0x0:0:3: +%15llx:1:1:1:1: +%*15llx:1:0:1: +%15llx:0X1:1:3:1: +%*15llx:0X1:0:3: +%15llx:0x1:1:3:1: +%*15llx:0x1:0:3: +%15llx:2a:1:2:42: +%*15llx:2a:0:2: +%15llx:2A:1:2:42: +%*15llx:2A:0:2: +%15llx:0X2a:1:4:42: +%*15llx:0X2a:0:4: +%15llx:0x2A:1:4:42: +%*15llx:0x2A:0:4: +%15llx:ffffffffffffffff:1:15:1152921504606846975: +%*15llx:ffffffffffffffff:0:15: +%15llx:FFFFFFFFFFFFFFFF:1:15:1152921504606846975: +%*15llx:FFFFFFFFFFFFFFFF:0:15: +%15llx:0Xffffffffffffffff:1:15:4503599627370495: +%*15llx:0Xffffffffffffffff:0:15: +%15llx:0xFFFFFFFFFFFFFFFF:1:15:4503599627370495: +%*15llx:0xFFFFFFFFFFFFFFFF:0:15: +%15llx:10000000000000000:1:15:72057594037927936: +%*15llx:10000000000000000:0:15: +%15llx:0X10000000000000000:1:15:281474976710656: +%*15llx:0X10000000000000000:0:15: +%15llx:0x10000000000000000:1:15:281474976710656: +%*15llx:0x10000000000000000:0:15: +%15llx:100000000028757b1:1:15:72057594038093655: +%*15llx:100000000028757b1:0:15: +%15llx:100000000028757B1:1:15:72057594038093655: +%*15llx:100000000028757B1:0:15: +%15llx:0X100000000028757b1:1:15:281474976711303: +%*15llx:0X100000000028757b1:0:15: +%15llx:0x100000000028757B1:1:15:281474976711303: +%*15llx:0x100000000028757B1:0:15: +%15llx:+0:1:2:0: +%*15llx:+0:0:2: +%15llx:+0X0:1:4:0: +%*15llx:+0X0:0:4: +%15llx:+0x0:1:4:0: +%*15llx:+0x0:0:4: +%15llx:+1:1:2:1: +%*15llx:+1:0:2: +%15llx:+0X1:1:4:1: +%*15llx:+0X1:0:4: +%15llx:+0x1:1:4:1: +%*15llx:+0x1:0:4: +%15llx:+2a:1:3:42: +%*15llx:+2a:0:3: +%15llx:+2A:1:3:42: +%*15llx:+2A:0:3: +%15llx:+0X2a:1:5:42: +%*15llx:+0X2a:0:5: +%15llx:+0x2A:1:5:42: +%*15llx:+0x2A:0:5: +%15llx:+ffffffffffffffff:1:15:72057594037927935: +%*15llx:+ffffffffffffffff:0:15: +%15llx:+FFFFFFFFFFFFFFFF:1:15:72057594037927935: +%*15llx:+FFFFFFFFFFFFFFFF:0:15: +%15llx:+0Xffffffffffffffff:1:15:281474976710655: +%*15llx:+0Xffffffffffffffff:0:15: +%15llx:+0xFFFFFFFFFFFFFFFF:1:15:281474976710655: +%*15llx:+0xFFFFFFFFFFFFFFFF:0:15: +%15llx:+10000000000000000:1:15:4503599627370496: +%*15llx:+10000000000000000:0:15: +%15llx:+0X10000000000000000:1:15:17592186044416: +%*15llx:+0X10000000000000000:0:15: +%15llx:+0x10000000000000000:1:15:17592186044416: +%*15llx:+0x10000000000000000:0:15: +%15llx:+100000000028757b1:1:15:4503599627380853: +%*15llx:+100000000028757b1:0:15: +%15llx:+100000000028757B1:1:15:4503599627380853: +%*15llx:+100000000028757B1:0:15: +%15llx:+0X100000000028757b1:1:15:17592186044456: +%*15llx:+0X100000000028757b1:0:15: +%15llx:+0x100000000028757B1:1:15:17592186044456: +%*15llx:+0x100000000028757B1:0:15: +%25llx::0:-1: +%*25llx::0:-1: +%25llx:-7b:1:3:18446744073709551493: +%*25llx:-7b:0:3: +%25llx:-7B:1:3:18446744073709551493: +%*25llx:-7B:0:3: +%25llx:-0X7b:1:5:18446744073709551493: +%*25llx:-0X7b:0:5: +%25llx:-0x7B:1:5:18446744073709551493: +%*25llx:-0x7B:0:5: +%25llx:-1:1:2:18446744073709551615: +%*25llx:-1:0:2: +%25llx:-0X1:1:4:18446744073709551615: +%*25llx:-0X1:0:4: +%25llx:-0x1:1:4:18446744073709551615: +%*25llx:-0x1:0:4: +%25llx:-0:1:2:0: +%*25llx:-0:0:2: +%25llx:-0X0:1:4:0: +%*25llx:-0X0:0:4: +%25llx:-0x0:1:4:0: +%*25llx:-0x0:0:4: +%25llx:0:1:1:0: +%*25llx:0:0:1: +%25llx:0X0:1:3:0: +%*25llx:0X0:0:3: +%25llx:0x0:1:3:0: +%*25llx:0x0:0:3: +%25llx:1:1:1:1: +%*25llx:1:0:1: +%25llx:0X1:1:3:1: +%*25llx:0X1:0:3: +%25llx:0x1:1:3:1: +%*25llx:0x1:0:3: +%25llx:2a:1:2:42: +%*25llx:2a:0:2: +%25llx:2A:1:2:42: +%*25llx:2A:0:2: +%25llx:0X2a:1:4:42: +%*25llx:0X2a:0:4: +%25llx:0x2A:1:4:42: +%*25llx:0x2A:0:4: +%25llx:ffffffffffffffff:1:16:18446744073709551615: +%*25llx:ffffffffffffffff:0:16: +%25llx:FFFFFFFFFFFFFFFF:1:16:18446744073709551615: +%*25llx:FFFFFFFFFFFFFFFF:0:16: +%25llx:0Xffffffffffffffff:1:18:18446744073709551615: +%*25llx:0Xffffffffffffffff:0:18: +%25llx:0xFFFFFFFFFFFFFFFF:1:18:18446744073709551615: +%*25llx:0xFFFFFFFFFFFFFFFF:0:18: +%25llx:10000000000000000:1:17:18446744073709551615: +%*25llx:10000000000000000:0:17: +%25llx:0X10000000000000000:1:19:18446744073709551615: +%*25llx:0X10000000000000000:0:19: +%25llx:0x10000000000000000:1:19:18446744073709551615: +%*25llx:0x10000000000000000:0:19: +%25llx:100000000028757b1:1:17:18446744073709551615: +%*25llx:100000000028757b1:0:17: +%25llx:100000000028757B1:1:17:18446744073709551615: +%*25llx:100000000028757B1:0:17: +%25llx:0X100000000028757b1:1:19:18446744073709551615: +%*25llx:0X100000000028757b1:0:19: +%25llx:0x100000000028757B1:1:19:18446744073709551615: +%*25llx:0x100000000028757B1:0:19: +%25llx:+0:1:2:0: +%*25llx:+0:0:2: +%25llx:+0X0:1:4:0: +%*25llx:+0X0:0:4: +%25llx:+0x0:1:4:0: +%*25llx:+0x0:0:4: +%25llx:+1:1:2:1: +%*25llx:+1:0:2: +%25llx:+0X1:1:4:1: +%*25llx:+0X1:0:4: +%25llx:+0x1:1:4:1: +%*25llx:+0x1:0:4: +%25llx:+2a:1:3:42: +%*25llx:+2a:0:3: +%25llx:+2A:1:3:42: +%*25llx:+2A:0:3: +%25llx:+0X2a:1:5:42: +%*25llx:+0X2a:0:5: +%25llx:+0x2A:1:5:42: +%*25llx:+0x2A:0:5: +%25llx:+ffffffffffffffff:1:17:18446744073709551615: +%*25llx:+ffffffffffffffff:0:17: +%25llx:+FFFFFFFFFFFFFFFF:1:17:18446744073709551615: +%*25llx:+FFFFFFFFFFFFFFFF:0:17: +%25llx:+0Xffffffffffffffff:1:19:18446744073709551615: +%*25llx:+0Xffffffffffffffff:0:19: +%25llx:+0xFFFFFFFFFFFFFFFF:1:19:18446744073709551615: +%*25llx:+0xFFFFFFFFFFFFFFFF:0:19: +%25llx:+10000000000000000:1:18:18446744073709551615: +%*25llx:+10000000000000000:0:18: +%25llx:+0X10000000000000000:1:20:18446744073709551615: +%*25llx:+0X10000000000000000:0:20: +%25llx:+0x10000000000000000:1:20:18446744073709551615: +%*25llx:+0x10000000000000000:0:20: +%25llx:+100000000028757b1:1:18:18446744073709551615: +%*25llx:+100000000028757b1:0:18: +%25llx:+100000000028757B1:1:18:18446744073709551615: +%*25llx:+100000000028757B1:0:18: +%25llx:+0X100000000028757b1:1:20:18446744073709551615: +%*25llx:+0X100000000028757b1:0:20: +%25llx:+0x100000000028757B1:1:20:18446744073709551615: +%*25llx:+0x100000000028757B1:0:20: +%2llx: :0:-1: +%*2llx: :0:-1: +%2llx: -7b:1:3:18446744073709551609: +%*2llx: -7b:0:3: +%2llx: -7B:1:3:18446744073709551609: +%*2llx: -7B:0:3: +%2llx: -0X7b:1:3:0: +%*2llx: -0X7b:0:3: +%2llx: -0x7B:1:3:0: +%*2llx: -0x7B:0:3: +%2llx: -1:1:3:18446744073709551615: +%*2llx: -1:0:3: +%2llx: -0X1:1:3:0: +%*2llx: -0X1:0:3: +%2llx: -0x1:1:3:0: +%*2llx: -0x1:0:3: +%2llx: -0:1:3:0: +%*2llx: -0:0:3: +%2llx: -0X0:1:3:0: +%*2llx: -0X0:0:3: +%2llx: -0x0:1:3:0: +%*2llx: -0x0:0:3: +%2llx: 0:1:2:0: +%*2llx: 0:0:2: +%2llx: 0X0:0:-1: +%*2llx: 0X0:0:-1: +%2llx: 0x0:0:-1: +%*2llx: 0x0:0:-1: +%2llx: 1:1:2:1: +%*2llx: 1:0:2: +%2llx: 0X1:0:-1: +%*2llx: 0X1:0:-1: +%2llx: 0x1:0:-1: +%*2llx: 0x1:0:-1: +%2llx: 2a:1:3:42: +%*2llx: 2a:0:3: +%2llx: 2A:1:3:42: +%*2llx: 2A:0:3: +%2llx: 0X2a:0:-1: +%*2llx: 0X2a:0:-1: +%2llx: 0x2A:0:-1: +%*2llx: 0x2A:0:-1: +%2llx: ffffffffffffffff:1:3:255: +%*2llx: ffffffffffffffff:0:3: +%2llx: FFFFFFFFFFFFFFFF:1:3:255: +%*2llx: FFFFFFFFFFFFFFFF:0:3: +%2llx: 0Xffffffffffffffff:0:-1: +%*2llx: 0Xffffffffffffffff:0:-1: +%2llx: 0xFFFFFFFFFFFFFFFF:0:-1: +%*2llx: 0xFFFFFFFFFFFFFFFF:0:-1: +%2llx: 10000000000000000:1:3:16: +%*2llx: 10000000000000000:0:3: +%2llx: 0X10000000000000000:0:-1: +%*2llx: 0X10000000000000000:0:-1: +%2llx: 0x10000000000000000:0:-1: +%*2llx: 0x10000000000000000:0:-1: +%2llx: 100000000028757b1:1:3:16: +%*2llx: 100000000028757b1:0:3: +%2llx: 100000000028757B1:1:3:16: +%*2llx: 100000000028757B1:0:3: +%2llx: 0X100000000028757b1:0:-1: +%*2llx: 0X100000000028757b1:0:-1: +%2llx: 0x100000000028757B1:0:-1: +%*2llx: 0x100000000028757B1:0:-1: +%2llx: +0:1:3:0: +%*2llx: +0:0:3: +%2llx: +0X0:1:3:0: +%*2llx: +0X0:0:3: +%2llx: +0x0:1:3:0: +%*2llx: +0x0:0:3: +%2llx: +1:1:3:1: +%*2llx: +1:0:3: +%2llx: +0X1:1:3:0: +%*2llx: +0X1:0:3: +%2llx: +0x1:1:3:0: +%*2llx: +0x1:0:3: +%2llx: +2a:1:3:2: +%*2llx: +2a:0:3: +%2llx: +2A:1:3:2: +%*2llx: +2A:0:3: +%2llx: +0X2a:1:3:0: +%*2llx: +0X2a:0:3: +%2llx: +0x2A:1:3:0: +%*2llx: +0x2A:0:3: +%2llx: +ffffffffffffffff:1:3:15: +%*2llx: +ffffffffffffffff:0:3: +%2llx: +FFFFFFFFFFFFFFFF:1:3:15: +%*2llx: +FFFFFFFFFFFFFFFF:0:3: +%2llx: +0Xffffffffffffffff:1:3:0: +%*2llx: +0Xffffffffffffffff:0:3: +%2llx: +0xFFFFFFFFFFFFFFFF:1:3:0: +%*2llx: +0xFFFFFFFFFFFFFFFF:0:3: +%2llx: +10000000000000000:1:3:1: +%*2llx: +10000000000000000:0:3: +%2llx: +0X10000000000000000:1:3:0: +%*2llx: +0X10000000000000000:0:3: +%2llx: +0x10000000000000000:1:3:0: +%*2llx: +0x10000000000000000:0:3: +%2llx: +100000000028757b1:1:3:1: +%*2llx: +100000000028757b1:0:3: +%2llx: +100000000028757B1:1:3:1: +%*2llx: +100000000028757B1:0:3: +%2llx: +0X100000000028757b1:1:3:0: +%*2llx: +0X100000000028757b1:0:3: +%2llx: +0x100000000028757B1:1:3:0: +%*2llx: +0x100000000028757B1:0:3: +%25llx: :0:-1: +%*25llx: :0:-1: +%25llx: -7b:1:4:18446744073709551493: +%*25llx: -7b:0:4: +%25llx: -7B:1:4:18446744073709551493: +%*25llx: -7B:0:4: +%25llx: -0X7b:1:6:18446744073709551493: +%*25llx: -0X7b:0:6: +%25llx: -0x7B:1:6:18446744073709551493: +%*25llx: -0x7B:0:6: +%25llx: -1:1:3:18446744073709551615: +%*25llx: -1:0:3: +%25llx: -0X1:1:5:18446744073709551615: +%*25llx: -0X1:0:5: +%25llx: -0x1:1:5:18446744073709551615: +%*25llx: -0x1:0:5: +%25llx: -0:1:3:0: +%*25llx: -0:0:3: +%25llx: -0X0:1:5:0: +%*25llx: -0X0:0:5: +%25llx: -0x0:1:5:0: +%*25llx: -0x0:0:5: +%25llx: 0:1:2:0: +%*25llx: 0:0:2: +%25llx: 0X0:1:4:0: +%*25llx: 0X0:0:4: +%25llx: 0x0:1:4:0: +%*25llx: 0x0:0:4: +%25llx: 1:1:2:1: +%*25llx: 1:0:2: +%25llx: 0X1:1:4:1: +%*25llx: 0X1:0:4: +%25llx: 0x1:1:4:1: +%*25llx: 0x1:0:4: +%25llx: 2a:1:3:42: +%*25llx: 2a:0:3: +%25llx: 2A:1:3:42: +%*25llx: 2A:0:3: +%25llx: 0X2a:1:5:42: +%*25llx: 0X2a:0:5: +%25llx: 0x2A:1:5:42: +%*25llx: 0x2A:0:5: +%25llx: ffffffffffffffff:1:17:18446744073709551615: +%*25llx: ffffffffffffffff:0:17: +%25llx: FFFFFFFFFFFFFFFF:1:17:18446744073709551615: +%*25llx: FFFFFFFFFFFFFFFF:0:17: +%25llx: 0Xffffffffffffffff:1:19:18446744073709551615: +%*25llx: 0Xffffffffffffffff:0:19: +%25llx: 0xFFFFFFFFFFFFFFFF:1:19:18446744073709551615: +%*25llx: 0xFFFFFFFFFFFFFFFF:0:19: +%25llx: 10000000000000000:1:18:18446744073709551615: +%*25llx: 10000000000000000:0:18: +%25llx: 0X10000000000000000:1:20:18446744073709551615: +%*25llx: 0X10000000000000000:0:20: +%25llx: 0x10000000000000000:1:20:18446744073709551615: +%*25llx: 0x10000000000000000:0:20: +%25llx: 100000000028757b1:1:18:18446744073709551615: +%*25llx: 100000000028757b1:0:18: +%25llx: 100000000028757B1:1:18:18446744073709551615: +%*25llx: 100000000028757B1:0:18: +%25llx: 0X100000000028757b1:1:20:18446744073709551615: +%*25llx: 0X100000000028757b1:0:20: +%25llx: 0x100000000028757B1:1:20:18446744073709551615: +%*25llx: 0x100000000028757B1:0:20: +%25llx: +0:1:3:0: +%*25llx: +0:0:3: +%25llx: +0X0:1:5:0: +%*25llx: +0X0:0:5: +%25llx: +0x0:1:5:0: +%*25llx: +0x0:0:5: +%25llx: +1:1:3:1: +%*25llx: +1:0:3: +%25llx: +0X1:1:5:1: +%*25llx: +0X1:0:5: +%25llx: +0x1:1:5:1: +%*25llx: +0x1:0:5: +%25llx: +2a:1:4:42: +%*25llx: +2a:0:4: +%25llx: +2A:1:4:42: +%*25llx: +2A:0:4: +%25llx: +0X2a:1:6:42: +%*25llx: +0X2a:0:6: +%25llx: +0x2A:1:6:42: +%*25llx: +0x2A:0:6: +%25llx: +ffffffffffffffff:1:18:18446744073709551615: +%*25llx: +ffffffffffffffff:0:18: +%25llx: +FFFFFFFFFFFFFFFF:1:18:18446744073709551615: +%*25llx: +FFFFFFFFFFFFFFFF:0:18: +%25llx: +0Xffffffffffffffff:1:20:18446744073709551615: +%*25llx: +0Xffffffffffffffff:0:20: +%25llx: +0xFFFFFFFFFFFFFFFF:1:20:18446744073709551615: +%*25llx: +0xFFFFFFFFFFFFFFFF:0:20: +%25llx: +10000000000000000:1:19:18446744073709551615: +%*25llx: +10000000000000000:0:19: +%25llx: +0X10000000000000000:1:21:18446744073709551615: +%*25llx: +0X10000000000000000:0:21: +%25llx: +0x10000000000000000:1:21:18446744073709551615: +%*25llx: +0x10000000000000000:0:21: +%25llx: +100000000028757b1:1:19:18446744073709551615: +%*25llx: +100000000028757b1:0:19: +%25llx: +100000000028757B1:1:19:18446744073709551615: +%*25llx: +100000000028757B1:0:19: +%25llx: +0X100000000028757b1:1:21:18446744073709551615: +%*25llx: +0X100000000028757b1:0:21: +%25llx: +0x100000000028757B1:1:21:18446744073709551615: +%*25llx: +0x100000000028757B1:0:21: diff --git a/stdio-common/tst-scanf-format-ullong-xx.input b/stdio-common/tst-scanf-format-ullong-xx.input new file mode 100644 index 0000000..df1ca93 --- /dev/null +++ b/stdio-common/tst-scanf-format-ullong-xx.input @@ -0,0 +1,742 @@ +%llX::0:-1: +%*llX::0:-1: +%llX:-7b:1:3:18446744073709551493: +%*llX:-7b:0:3: +%llX:-7B:1:3:18446744073709551493: +%*llX:-7B:0:3: +%llX:-0X7b:1:5:18446744073709551493: +%*llX:-0X7b:0:5: +%llX:-0x7B:1:5:18446744073709551493: +%*llX:-0x7B:0:5: +%llX:-1:1:2:18446744073709551615: +%*llX:-1:0:2: +%llX:-0X1:1:4:18446744073709551615: +%*llX:-0X1:0:4: +%llX:-0x1:1:4:18446744073709551615: +%*llX:-0x1:0:4: +%llX:-0:1:2:0: +%*llX:-0:0:2: +%llX:-0X0:1:4:0: +%*llX:-0X0:0:4: +%llX:-0x0:1:4:0: +%*llX:-0x0:0:4: +%llX:0:1:1:0: +%*llX:0:0:1: +%llX:0X0:1:3:0: +%*llX:0X0:0:3: +%llX:0x0:1:3:0: +%*llX:0x0:0:3: +%llX:1:1:1:1: +%*llX:1:0:1: +%llX:0X1:1:3:1: +%*llX:0X1:0:3: +%llX:0x1:1:3:1: +%*llX:0x1:0:3: +%llX:2a:1:2:42: +%*llX:2a:0:2: +%llX:2A:1:2:42: +%*llX:2A:0:2: +%llX:0X2a:1:4:42: +%*llX:0X2a:0:4: +%llX:0x2A:1:4:42: +%*llX:0x2A:0:4: +%llX:ffffffffffffffff:1:16:18446744073709551615: +%*llX:ffffffffffffffff:0:16: +%llX:FFFFFFFFFFFFFFFF:1:16:18446744073709551615: +%*llX:FFFFFFFFFFFFFFFF:0:16: +%llX:0Xffffffffffffffff:1:18:18446744073709551615: +%*llX:0Xffffffffffffffff:0:18: +%llX:0xFFFFFFFFFFFFFFFF:1:18:18446744073709551615: +%*llX:0xFFFFFFFFFFFFFFFF:0:18: +%llX:10000000000000000:1:17:18446744073709551615: +%*llX:10000000000000000:0:17: +%llX:0X10000000000000000:1:19:18446744073709551615: +%*llX:0X10000000000000000:0:19: +%llX:0x10000000000000000:1:19:18446744073709551615: +%*llX:0x10000000000000000:0:19: +%llX:100000000028757b1:1:17:18446744073709551615: +%*llX:100000000028757b1:0:17: +%llX:100000000028757B1:1:17:18446744073709551615: +%*llX:100000000028757B1:0:17: +%llX:0X100000000028757b1:1:19:18446744073709551615: +%*llX:0X100000000028757b1:0:19: +%llX:0x100000000028757B1:1:19:18446744073709551615: +%*llX:0x100000000028757B1:0:19: +%llX:+0:1:2:0: +%*llX:+0:0:2: +%llX:+0X0:1:4:0: +%*llX:+0X0:0:4: +%llX:+0x0:1:4:0: +%*llX:+0x0:0:4: +%llX:+1:1:2:1: +%*llX:+1:0:2: +%llX:+0X1:1:4:1: +%*llX:+0X1:0:4: +%llX:+0x1:1:4:1: +%*llX:+0x1:0:4: +%llX:+2a:1:3:42: +%*llX:+2a:0:3: +%llX:+2A:1:3:42: +%*llX:+2A:0:3: +%llX:+0X2a:1:5:42: +%*llX:+0X2a:0:5: +%llX:+0x2A:1:5:42: +%*llX:+0x2A:0:5: +%llX:+ffffffffffffffff:1:17:18446744073709551615: +%*llX:+ffffffffffffffff:0:17: +%llX:+FFFFFFFFFFFFFFFF:1:17:18446744073709551615: +%*llX:+FFFFFFFFFFFFFFFF:0:17: +%llX:+0Xffffffffffffffff:1:19:18446744073709551615: +%*llX:+0Xffffffffffffffff:0:19: +%llX:+0xFFFFFFFFFFFFFFFF:1:19:18446744073709551615: +%*llX:+0xFFFFFFFFFFFFFFFF:0:19: +%llX:+10000000000000000:1:18:18446744073709551615: +%*llX:+10000000000000000:0:18: +%llX:+0X10000000000000000:1:20:18446744073709551615: +%*llX:+0X10000000000000000:0:20: +%llX:+0x10000000000000000:1:20:18446744073709551615: +%*llX:+0x10000000000000000:0:20: +%llX:+100000000028757b1:1:18:18446744073709551615: +%*llX:+100000000028757b1:0:18: +%llX:+100000000028757B1:1:18:18446744073709551615: +%*llX:+100000000028757B1:0:18: +%llX:+0X100000000028757b1:1:20:18446744073709551615: +%*llX:+0X100000000028757b1:0:20: +%llX:+0x100000000028757B1:1:20:18446744073709551615: +%*llX:+0x100000000028757B1:0:20: +%1llX::0:-1: +%*1llX::0:-1: +%1llX:-7b:0:-1: +%*1llX:-7b:0:-1: +%1llX:-7B:0:-1: +%*1llX:-7B:0:-1: +%1llX:-0X7b:0:-1: +%*1llX:-0X7b:0:-1: +%1llX:-0x7B:0:-1: +%*1llX:-0x7B:0:-1: +%1llX:-1:0:-1: +%*1llX:-1:0:-1: +%1llX:-0X1:0:-1: +%*1llX:-0X1:0:-1: +%1llX:-0x1:0:-1: +%*1llX:-0x1:0:-1: +%1llX:-0:0:-1: +%*1llX:-0:0:-1: +%1llX:-0X0:0:-1: +%*1llX:-0X0:0:-1: +%1llX:-0x0:0:-1: +%*1llX:-0x0:0:-1: +%1llX:0:1:1:0: +%*1llX:0:0:1: +%1llX:0X0:1:1:0: +%*1llX:0X0:0:1: +%1llX:0x0:1:1:0: +%*1llX:0x0:0:1: +%1llX:1:1:1:1: +%*1llX:1:0:1: +%1llX:0X1:1:1:0: +%*1llX:0X1:0:1: +%1llX:0x1:1:1:0: +%*1llX:0x1:0:1: +%1llX:2a:1:1:2: +%*1llX:2a:0:1: +%1llX:2A:1:1:2: +%*1llX:2A:0:1: +%1llX:0X2a:1:1:0: +%*1llX:0X2a:0:1: +%1llX:0x2A:1:1:0: +%*1llX:0x2A:0:1: +%1llX:ffffffffffffffff:1:1:15: +%*1llX:ffffffffffffffff:0:1: +%1llX:FFFFFFFFFFFFFFFF:1:1:15: +%*1llX:FFFFFFFFFFFFFFFF:0:1: +%1llX:0Xffffffffffffffff:1:1:0: +%*1llX:0Xffffffffffffffff:0:1: +%1llX:0xFFFFFFFFFFFFFFFF:1:1:0: +%*1llX:0xFFFFFFFFFFFFFFFF:0:1: +%1llX:10000000000000000:1:1:1: +%*1llX:10000000000000000:0:1: +%1llX:0X10000000000000000:1:1:0: +%*1llX:0X10000000000000000:0:1: +%1llX:0x10000000000000000:1:1:0: +%*1llX:0x10000000000000000:0:1: +%1llX:100000000028757b1:1:1:1: +%*1llX:100000000028757b1:0:1: +%1llX:100000000028757B1:1:1:1: +%*1llX:100000000028757B1:0:1: +%1llX:0X100000000028757b1:1:1:0: +%*1llX:0X100000000028757b1:0:1: +%1llX:0x100000000028757B1:1:1:0: +%*1llX:0x100000000028757B1:0:1: +%1llX:+0:0:-1: +%*1llX:+0:0:-1: +%1llX:+0X0:0:-1: +%*1llX:+0X0:0:-1: +%1llX:+0x0:0:-1: +%*1llX:+0x0:0:-1: +%1llX:+1:0:-1: +%*1llX:+1:0:-1: +%1llX:+0X1:0:-1: +%*1llX:+0X1:0:-1: +%1llX:+0x1:0:-1: +%*1llX:+0x1:0:-1: +%1llX:+2a:0:-1: +%*1llX:+2a:0:-1: +%1llX:+2A:0:-1: +%*1llX:+2A:0:-1: +%1llX:+0X2a:0:-1: +%*1llX:+0X2a:0:-1: +%1llX:+0x2A:0:-1: +%*1llX:+0x2A:0:-1: +%1llX:+ffffffffffffffff:0:-1: +%*1llX:+ffffffffffffffff:0:-1: +%1llX:+FFFFFFFFFFFFFFFF:0:-1: +%*1llX:+FFFFFFFFFFFFFFFF:0:-1: +%1llX:+0Xffffffffffffffff:0:-1: +%*1llX:+0Xffffffffffffffff:0:-1: +%1llX:+0xFFFFFFFFFFFFFFFF:0:-1: +%*1llX:+0xFFFFFFFFFFFFFFFF:0:-1: +%1llX:+10000000000000000:0:-1: +%*1llX:+10000000000000000:0:-1: +%1llX:+0X10000000000000000:0:-1: +%*1llX:+0X10000000000000000:0:-1: +%1llX:+0x10000000000000000:0:-1: +%*1llX:+0x10000000000000000:0:-1: +%1llX:+100000000028757b1:0:-1: +%*1llX:+100000000028757b1:0:-1: +%1llX:+100000000028757B1:0:-1: +%*1llX:+100000000028757B1:0:-1: +%1llX:+0X100000000028757b1:0:-1: +%*1llX:+0X100000000028757b1:0:-1: +%1llX:+0x100000000028757B1:0:-1: +%*1llX:+0x100000000028757B1:0:-1: +%2llX::0:-1: +%*2llX::0:-1: +%2llX:-7b:1:2:18446744073709551609: +%*2llX:-7b:0:2: +%2llX:-7B:1:2:18446744073709551609: +%*2llX:-7B:0:2: +%2llX:-0X7b:1:2:0: +%*2llX:-0X7b:0:2: +%2llX:-0x7B:1:2:0: +%*2llX:-0x7B:0:2: +%2llX:-1:1:2:18446744073709551615: +%*2llX:-1:0:2: +%2llX:-0X1:1:2:0: +%*2llX:-0X1:0:2: +%2llX:-0x1:1:2:0: +%*2llX:-0x1:0:2: +%2llX:-0:1:2:0: +%*2llX:-0:0:2: +%2llX:-0X0:1:2:0: +%*2llX:-0X0:0:2: +%2llX:-0x0:1:2:0: +%*2llX:-0x0:0:2: +%2llX:0:1:1:0: +%*2llX:0:0:1: +%2llX:0X0:0:-1: +%*2llX:0X0:0:-1: +%2llX:0x0:0:-1: +%*2llX:0x0:0:-1: +%2llX:1:1:1:1: +%*2llX:1:0:1: +%2llX:0X1:0:-1: +%*2llX:0X1:0:-1: +%2llX:0x1:0:-1: +%*2llX:0x1:0:-1: +%2llX:2a:1:2:42: +%*2llX:2a:0:2: +%2llX:2A:1:2:42: +%*2llX:2A:0:2: +%2llX:0X2a:0:-1: +%*2llX:0X2a:0:-1: +%2llX:0x2A:0:-1: +%*2llX:0x2A:0:-1: +%2llX:ffffffffffffffff:1:2:255: +%*2llX:ffffffffffffffff:0:2: +%2llX:FFFFFFFFFFFFFFFF:1:2:255: +%*2llX:FFFFFFFFFFFFFFFF:0:2: +%2llX:0Xffffffffffffffff:0:-1: +%*2llX:0Xffffffffffffffff:0:-1: +%2llX:0xFFFFFFFFFFFFFFFF:0:-1: +%*2llX:0xFFFFFFFFFFFFFFFF:0:-1: +%2llX:10000000000000000:1:2:16: +%*2llX:10000000000000000:0:2: +%2llX:0X10000000000000000:0:-1: +%*2llX:0X10000000000000000:0:-1: +%2llX:0x10000000000000000:0:-1: +%*2llX:0x10000000000000000:0:-1: +%2llX:100000000028757b1:1:2:16: +%*2llX:100000000028757b1:0:2: +%2llX:100000000028757B1:1:2:16: +%*2llX:100000000028757B1:0:2: +%2llX:0X100000000028757b1:0:-1: +%*2llX:0X100000000028757b1:0:-1: +%2llX:0x100000000028757B1:0:-1: +%*2llX:0x100000000028757B1:0:-1: +%2llX:+0:1:2:0: +%*2llX:+0:0:2: +%2llX:+0X0:1:2:0: +%*2llX:+0X0:0:2: +%2llX:+0x0:1:2:0: +%*2llX:+0x0:0:2: +%2llX:+1:1:2:1: +%*2llX:+1:0:2: +%2llX:+0X1:1:2:0: +%*2llX:+0X1:0:2: +%2llX:+0x1:1:2:0: +%*2llX:+0x1:0:2: +%2llX:+2a:1:2:2: +%*2llX:+2a:0:2: +%2llX:+2A:1:2:2: +%*2llX:+2A:0:2: +%2llX:+0X2a:1:2:0: +%*2llX:+0X2a:0:2: +%2llX:+0x2A:1:2:0: +%*2llX:+0x2A:0:2: +%2llX:+ffffffffffffffff:1:2:15: +%*2llX:+ffffffffffffffff:0:2: +%2llX:+FFFFFFFFFFFFFFFF:1:2:15: +%*2llX:+FFFFFFFFFFFFFFFF:0:2: +%2llX:+0Xffffffffffffffff:1:2:0: +%*2llX:+0Xffffffffffffffff:0:2: +%2llX:+0xFFFFFFFFFFFFFFFF:1:2:0: +%*2llX:+0xFFFFFFFFFFFFFFFF:0:2: +%2llX:+10000000000000000:1:2:1: +%*2llX:+10000000000000000:0:2: +%2llX:+0X10000000000000000:1:2:0: +%*2llX:+0X10000000000000000:0:2: +%2llX:+0x10000000000000000:1:2:0: +%*2llX:+0x10000000000000000:0:2: +%2llX:+100000000028757b1:1:2:1: +%*2llX:+100000000028757b1:0:2: +%2llX:+100000000028757B1:1:2:1: +%*2llX:+100000000028757B1:0:2: +%2llX:+0X100000000028757b1:1:2:0: +%*2llX:+0X100000000028757b1:0:2: +%2llX:+0x100000000028757B1:1:2:0: +%*2llX:+0x100000000028757B1:0:2: +%15llX::0:-1: +%*15llX::0:-1: +%15llX:-7b:1:3:18446744073709551493: +%*15llX:-7b:0:3: +%15llX:-7B:1:3:18446744073709551493: +%*15llX:-7B:0:3: +%15llX:-0X7b:1:5:18446744073709551493: +%*15llX:-0X7b:0:5: +%15llX:-0x7B:1:5:18446744073709551493: +%*15llX:-0x7B:0:5: +%15llX:-1:1:2:18446744073709551615: +%*15llX:-1:0:2: +%15llX:-0X1:1:4:18446744073709551615: +%*15llX:-0X1:0:4: +%15llX:-0x1:1:4:18446744073709551615: +%*15llX:-0x1:0:4: +%15llX:-0:1:2:0: +%*15llX:-0:0:2: +%15llX:-0X0:1:4:0: +%*15llX:-0X0:0:4: +%15llX:-0x0:1:4:0: +%*15llX:-0x0:0:4: +%15llX:0:1:1:0: +%*15llX:0:0:1: +%15llX:0X0:1:3:0: +%*15llX:0X0:0:3: +%15llX:0x0:1:3:0: +%*15llX:0x0:0:3: +%15llX:1:1:1:1: +%*15llX:1:0:1: +%15llX:0X1:1:3:1: +%*15llX:0X1:0:3: +%15llX:0x1:1:3:1: +%*15llX:0x1:0:3: +%15llX:2a:1:2:42: +%*15llX:2a:0:2: +%15llX:2A:1:2:42: +%*15llX:2A:0:2: +%15llX:0X2a:1:4:42: +%*15llX:0X2a:0:4: +%15llX:0x2A:1:4:42: +%*15llX:0x2A:0:4: +%15llX:ffffffffffffffff:1:15:1152921504606846975: +%*15llX:ffffffffffffffff:0:15: +%15llX:FFFFFFFFFFFFFFFF:1:15:1152921504606846975: +%*15llX:FFFFFFFFFFFFFFFF:0:15: +%15llX:0Xffffffffffffffff:1:15:4503599627370495: +%*15llX:0Xffffffffffffffff:0:15: +%15llX:0xFFFFFFFFFFFFFFFF:1:15:4503599627370495: +%*15llX:0xFFFFFFFFFFFFFFFF:0:15: +%15llX:10000000000000000:1:15:72057594037927936: +%*15llX:10000000000000000:0:15: +%15llX:0X10000000000000000:1:15:281474976710656: +%*15llX:0X10000000000000000:0:15: +%15llX:0x10000000000000000:1:15:281474976710656: +%*15llX:0x10000000000000000:0:15: +%15llX:100000000028757b1:1:15:72057594038093655: +%*15llX:100000000028757b1:0:15: +%15llX:100000000028757B1:1:15:72057594038093655: +%*15llX:100000000028757B1:0:15: +%15llX:0X100000000028757b1:1:15:281474976711303: +%*15llX:0X100000000028757b1:0:15: +%15llX:0x100000000028757B1:1:15:281474976711303: +%*15llX:0x100000000028757B1:0:15: +%15llX:+0:1:2:0: +%*15llX:+0:0:2: +%15llX:+0X0:1:4:0: +%*15llX:+0X0:0:4: +%15llX:+0x0:1:4:0: +%*15llX:+0x0:0:4: +%15llX:+1:1:2:1: +%*15llX:+1:0:2: +%15llX:+0X1:1:4:1: +%*15llX:+0X1:0:4: +%15llX:+0x1:1:4:1: +%*15llX:+0x1:0:4: +%15llX:+2a:1:3:42: +%*15llX:+2a:0:3: +%15llX:+2A:1:3:42: +%*15llX:+2A:0:3: +%15llX:+0X2a:1:5:42: +%*15llX:+0X2a:0:5: +%15llX:+0x2A:1:5:42: +%*15llX:+0x2A:0:5: +%15llX:+ffffffffffffffff:1:15:72057594037927935: +%*15llX:+ffffffffffffffff:0:15: +%15llX:+FFFFFFFFFFFFFFFF:1:15:72057594037927935: +%*15llX:+FFFFFFFFFFFFFFFF:0:15: +%15llX:+0Xffffffffffffffff:1:15:281474976710655: +%*15llX:+0Xffffffffffffffff:0:15: +%15llX:+0xFFFFFFFFFFFFFFFF:1:15:281474976710655: +%*15llX:+0xFFFFFFFFFFFFFFFF:0:15: +%15llX:+10000000000000000:1:15:4503599627370496: +%*15llX:+10000000000000000:0:15: +%15llX:+0X10000000000000000:1:15:17592186044416: +%*15llX:+0X10000000000000000:0:15: +%15llX:+0x10000000000000000:1:15:17592186044416: +%*15llX:+0x10000000000000000:0:15: +%15llX:+100000000028757b1:1:15:4503599627380853: +%*15llX:+100000000028757b1:0:15: +%15llX:+100000000028757B1:1:15:4503599627380853: +%*15llX:+100000000028757B1:0:15: +%15llX:+0X100000000028757b1:1:15:17592186044456: +%*15llX:+0X100000000028757b1:0:15: +%15llX:+0x100000000028757B1:1:15:17592186044456: +%*15llX:+0x100000000028757B1:0:15: +%25llX::0:-1: +%*25llX::0:-1: +%25llX:-7b:1:3:18446744073709551493: +%*25llX:-7b:0:3: +%25llX:-7B:1:3:18446744073709551493: +%*25llX:-7B:0:3: +%25llX:-0X7b:1:5:18446744073709551493: +%*25llX:-0X7b:0:5: +%25llX:-0x7B:1:5:18446744073709551493: +%*25llX:-0x7B:0:5: +%25llX:-1:1:2:18446744073709551615: +%*25llX:-1:0:2: +%25llX:-0X1:1:4:18446744073709551615: +%*25llX:-0X1:0:4: +%25llX:-0x1:1:4:18446744073709551615: +%*25llX:-0x1:0:4: +%25llX:-0:1:2:0: +%*25llX:-0:0:2: +%25llX:-0X0:1:4:0: +%*25llX:-0X0:0:4: +%25llX:-0x0:1:4:0: +%*25llX:-0x0:0:4: +%25llX:0:1:1:0: +%*25llX:0:0:1: +%25llX:0X0:1:3:0: +%*25llX:0X0:0:3: +%25llX:0x0:1:3:0: +%*25llX:0x0:0:3: +%25llX:1:1:1:1: +%*25llX:1:0:1: +%25llX:0X1:1:3:1: +%*25llX:0X1:0:3: +%25llX:0x1:1:3:1: +%*25llX:0x1:0:3: +%25llX:2a:1:2:42: +%*25llX:2a:0:2: +%25llX:2A:1:2:42: +%*25llX:2A:0:2: +%25llX:0X2a:1:4:42: +%*25llX:0X2a:0:4: +%25llX:0x2A:1:4:42: +%*25llX:0x2A:0:4: +%25llX:ffffffffffffffff:1:16:18446744073709551615: +%*25llX:ffffffffffffffff:0:16: +%25llX:FFFFFFFFFFFFFFFF:1:16:18446744073709551615: +%*25llX:FFFFFFFFFFFFFFFF:0:16: +%25llX:0Xffffffffffffffff:1:18:18446744073709551615: +%*25llX:0Xffffffffffffffff:0:18: +%25llX:0xFFFFFFFFFFFFFFFF:1:18:18446744073709551615: +%*25llX:0xFFFFFFFFFFFFFFFF:0:18: +%25llX:10000000000000000:1:17:18446744073709551615: +%*25llX:10000000000000000:0:17: +%25llX:0X10000000000000000:1:19:18446744073709551615: +%*25llX:0X10000000000000000:0:19: +%25llX:0x10000000000000000:1:19:18446744073709551615: +%*25llX:0x10000000000000000:0:19: +%25llX:100000000028757b1:1:17:18446744073709551615: +%*25llX:100000000028757b1:0:17: +%25llX:100000000028757B1:1:17:18446744073709551615: +%*25llX:100000000028757B1:0:17: +%25llX:0X100000000028757b1:1:19:18446744073709551615: +%*25llX:0X100000000028757b1:0:19: +%25llX:0x100000000028757B1:1:19:18446744073709551615: +%*25llX:0x100000000028757B1:0:19: +%25llX:+0:1:2:0: +%*25llX:+0:0:2: +%25llX:+0X0:1:4:0: +%*25llX:+0X0:0:4: +%25llX:+0x0:1:4:0: +%*25llX:+0x0:0:4: +%25llX:+1:1:2:1: +%*25llX:+1:0:2: +%25llX:+0X1:1:4:1: +%*25llX:+0X1:0:4: +%25llX:+0x1:1:4:1: +%*25llX:+0x1:0:4: +%25llX:+2a:1:3:42: +%*25llX:+2a:0:3: +%25llX:+2A:1:3:42: +%*25llX:+2A:0:3: +%25llX:+0X2a:1:5:42: +%*25llX:+0X2a:0:5: +%25llX:+0x2A:1:5:42: +%*25llX:+0x2A:0:5: +%25llX:+ffffffffffffffff:1:17:18446744073709551615: +%*25llX:+ffffffffffffffff:0:17: +%25llX:+FFFFFFFFFFFFFFFF:1:17:18446744073709551615: +%*25llX:+FFFFFFFFFFFFFFFF:0:17: +%25llX:+0Xffffffffffffffff:1:19:18446744073709551615: +%*25llX:+0Xffffffffffffffff:0:19: +%25llX:+0xFFFFFFFFFFFFFFFF:1:19:18446744073709551615: +%*25llX:+0xFFFFFFFFFFFFFFFF:0:19: +%25llX:+10000000000000000:1:18:18446744073709551615: +%*25llX:+10000000000000000:0:18: +%25llX:+0X10000000000000000:1:20:18446744073709551615: +%*25llX:+0X10000000000000000:0:20: +%25llX:+0x10000000000000000:1:20:18446744073709551615: +%*25llX:+0x10000000000000000:0:20: +%25llX:+100000000028757b1:1:18:18446744073709551615: +%*25llX:+100000000028757b1:0:18: +%25llX:+100000000028757B1:1:18:18446744073709551615: +%*25llX:+100000000028757B1:0:18: +%25llX:+0X100000000028757b1:1:20:18446744073709551615: +%*25llX:+0X100000000028757b1:0:20: +%25llX:+0x100000000028757B1:1:20:18446744073709551615: +%*25llX:+0x100000000028757B1:0:20: +%2llX: :0:-1: +%*2llX: :0:-1: +%2llX: -7b:1:3:18446744073709551609: +%*2llX: -7b:0:3: +%2llX: -7B:1:3:18446744073709551609: +%*2llX: -7B:0:3: +%2llX: -0X7b:1:3:0: +%*2llX: -0X7b:0:3: +%2llX: -0x7B:1:3:0: +%*2llX: -0x7B:0:3: +%2llX: -1:1:3:18446744073709551615: +%*2llX: -1:0:3: +%2llX: -0X1:1:3:0: +%*2llX: -0X1:0:3: +%2llX: -0x1:1:3:0: +%*2llX: -0x1:0:3: +%2llX: -0:1:3:0: +%*2llX: -0:0:3: +%2llX: -0X0:1:3:0: +%*2llX: -0X0:0:3: +%2llX: -0x0:1:3:0: +%*2llX: -0x0:0:3: +%2llX: 0:1:2:0: +%*2llX: 0:0:2: +%2llX: 0X0:0:-1: +%*2llX: 0X0:0:-1: +%2llX: 0x0:0:-1: +%*2llX: 0x0:0:-1: +%2llX: 1:1:2:1: +%*2llX: 1:0:2: +%2llX: 0X1:0:-1: +%*2llX: 0X1:0:-1: +%2llX: 0x1:0:-1: +%*2llX: 0x1:0:-1: +%2llX: 2a:1:3:42: +%*2llX: 2a:0:3: +%2llX: 2A:1:3:42: +%*2llX: 2A:0:3: +%2llX: 0X2a:0:-1: +%*2llX: 0X2a:0:-1: +%2llX: 0x2A:0:-1: +%*2llX: 0x2A:0:-1: +%2llX: ffffffffffffffff:1:3:255: +%*2llX: ffffffffffffffff:0:3: +%2llX: FFFFFFFFFFFFFFFF:1:3:255: +%*2llX: FFFFFFFFFFFFFFFF:0:3: +%2llX: 0Xffffffffffffffff:0:-1: +%*2llX: 0Xffffffffffffffff:0:-1: +%2llX: 0xFFFFFFFFFFFFFFFF:0:-1: +%*2llX: 0xFFFFFFFFFFFFFFFF:0:-1: +%2llX: 10000000000000000:1:3:16: +%*2llX: 10000000000000000:0:3: +%2llX: 0X10000000000000000:0:-1: +%*2llX: 0X10000000000000000:0:-1: +%2llX: 0x10000000000000000:0:-1: +%*2llX: 0x10000000000000000:0:-1: +%2llX: 100000000028757b1:1:3:16: +%*2llX: 100000000028757b1:0:3: +%2llX: 100000000028757B1:1:3:16: +%*2llX: 100000000028757B1:0:3: +%2llX: 0X100000000028757b1:0:-1: +%*2llX: 0X100000000028757b1:0:-1: +%2llX: 0x100000000028757B1:0:-1: +%*2llX: 0x100000000028757B1:0:-1: +%2llX: +0:1:3:0: +%*2llX: +0:0:3: +%2llX: +0X0:1:3:0: +%*2llX: +0X0:0:3: +%2llX: +0x0:1:3:0: +%*2llX: +0x0:0:3: +%2llX: +1:1:3:1: +%*2llX: +1:0:3: +%2llX: +0X1:1:3:0: +%*2llX: +0X1:0:3: +%2llX: +0x1:1:3:0: +%*2llX: +0x1:0:3: +%2llX: +2a:1:3:2: +%*2llX: +2a:0:3: +%2llX: +2A:1:3:2: +%*2llX: +2A:0:3: +%2llX: +0X2a:1:3:0: +%*2llX: +0X2a:0:3: +%2llX: +0x2A:1:3:0: +%*2llX: +0x2A:0:3: +%2llX: +ffffffffffffffff:1:3:15: +%*2llX: +ffffffffffffffff:0:3: +%2llX: +FFFFFFFFFFFFFFFF:1:3:15: +%*2llX: +FFFFFFFFFFFFFFFF:0:3: +%2llX: +0Xffffffffffffffff:1:3:0: +%*2llX: +0Xffffffffffffffff:0:3: +%2llX: +0xFFFFFFFFFFFFFFFF:1:3:0: +%*2llX: +0xFFFFFFFFFFFFFFFF:0:3: +%2llX: +10000000000000000:1:3:1: +%*2llX: +10000000000000000:0:3: +%2llX: +0X10000000000000000:1:3:0: +%*2llX: +0X10000000000000000:0:3: +%2llX: +0x10000000000000000:1:3:0: +%*2llX: +0x10000000000000000:0:3: +%2llX: +100000000028757b1:1:3:1: +%*2llX: +100000000028757b1:0:3: +%2llX: +100000000028757B1:1:3:1: +%*2llX: +100000000028757B1:0:3: +%2llX: +0X100000000028757b1:1:3:0: +%*2llX: +0X100000000028757b1:0:3: +%2llX: +0x100000000028757B1:1:3:0: +%*2llX: +0x100000000028757B1:0:3: +%25llX: :0:-1: +%*25llX: :0:-1: +%25llX: -7b:1:4:18446744073709551493: +%*25llX: -7b:0:4: +%25llX: -7B:1:4:18446744073709551493: +%*25llX: -7B:0:4: +%25llX: -0X7b:1:6:18446744073709551493: +%*25llX: -0X7b:0:6: +%25llX: -0x7B:1:6:18446744073709551493: +%*25llX: -0x7B:0:6: +%25llX: -1:1:3:18446744073709551615: +%*25llX: -1:0:3: +%25llX: -0X1:1:5:18446744073709551615: +%*25llX: -0X1:0:5: +%25llX: -0x1:1:5:18446744073709551615: +%*25llX: -0x1:0:5: +%25llX: -0:1:3:0: +%*25llX: -0:0:3: +%25llX: -0X0:1:5:0: +%*25llX: -0X0:0:5: +%25llX: -0x0:1:5:0: +%*25llX: -0x0:0:5: +%25llX: 0:1:2:0: +%*25llX: 0:0:2: +%25llX: 0X0:1:4:0: +%*25llX: 0X0:0:4: +%25llX: 0x0:1:4:0: +%*25llX: 0x0:0:4: +%25llX: 1:1:2:1: +%*25llX: 1:0:2: +%25llX: 0X1:1:4:1: +%*25llX: 0X1:0:4: +%25llX: 0x1:1:4:1: +%*25llX: 0x1:0:4: +%25llX: 2a:1:3:42: +%*25llX: 2a:0:3: +%25llX: 2A:1:3:42: +%*25llX: 2A:0:3: +%25llX: 0X2a:1:5:42: +%*25llX: 0X2a:0:5: +%25llX: 0x2A:1:5:42: +%*25llX: 0x2A:0:5: +%25llX: ffffffffffffffff:1:17:18446744073709551615: +%*25llX: ffffffffffffffff:0:17: +%25llX: FFFFFFFFFFFFFFFF:1:17:18446744073709551615: +%*25llX: FFFFFFFFFFFFFFFF:0:17: +%25llX: 0Xffffffffffffffff:1:19:18446744073709551615: +%*25llX: 0Xffffffffffffffff:0:19: +%25llX: 0xFFFFFFFFFFFFFFFF:1:19:18446744073709551615: +%*25llX: 0xFFFFFFFFFFFFFFFF:0:19: +%25llX: 10000000000000000:1:18:18446744073709551615: +%*25llX: 10000000000000000:0:18: +%25llX: 0X10000000000000000:1:20:18446744073709551615: +%*25llX: 0X10000000000000000:0:20: +%25llX: 0x10000000000000000:1:20:18446744073709551615: +%*25llX: 0x10000000000000000:0:20: +%25llX: 100000000028757b1:1:18:18446744073709551615: +%*25llX: 100000000028757b1:0:18: +%25llX: 100000000028757B1:1:18:18446744073709551615: +%*25llX: 100000000028757B1:0:18: +%25llX: 0X100000000028757b1:1:20:18446744073709551615: +%*25llX: 0X100000000028757b1:0:20: +%25llX: 0x100000000028757B1:1:20:18446744073709551615: +%*25llX: 0x100000000028757B1:0:20: +%25llX: +0:1:3:0: +%*25llX: +0:0:3: +%25llX: +0X0:1:5:0: +%*25llX: +0X0:0:5: +%25llX: +0x0:1:5:0: +%*25llX: +0x0:0:5: +%25llX: +1:1:3:1: +%*25llX: +1:0:3: +%25llX: +0X1:1:5:1: +%*25llX: +0X1:0:5: +%25llX: +0x1:1:5:1: +%*25llX: +0x1:0:5: +%25llX: +2a:1:4:42: +%*25llX: +2a:0:4: +%25llX: +2A:1:4:42: +%*25llX: +2A:0:4: +%25llX: +0X2a:1:6:42: +%*25llX: +0X2a:0:6: +%25llX: +0x2A:1:6:42: +%*25llX: +0x2A:0:6: +%25llX: +ffffffffffffffff:1:18:18446744073709551615: +%*25llX: +ffffffffffffffff:0:18: +%25llX: +FFFFFFFFFFFFFFFF:1:18:18446744073709551615: +%*25llX: +FFFFFFFFFFFFFFFF:0:18: +%25llX: +0Xffffffffffffffff:1:20:18446744073709551615: +%*25llX: +0Xffffffffffffffff:0:20: +%25llX: +0xFFFFFFFFFFFFFFFF:1:20:18446744073709551615: +%*25llX: +0xFFFFFFFFFFFFFFFF:0:20: +%25llX: +10000000000000000:1:19:18446744073709551615: +%*25llX: +10000000000000000:0:19: +%25llX: +0X10000000000000000:1:21:18446744073709551615: +%*25llX: +0X10000000000000000:0:21: +%25llX: +0x10000000000000000:1:21:18446744073709551615: +%*25llX: +0x10000000000000000:0:21: +%25llX: +100000000028757b1:1:19:18446744073709551615: +%*25llX: +100000000028757b1:0:19: +%25llX: +100000000028757B1:1:19:18446744073709551615: +%*25llX: +100000000028757B1:0:19: +%25llX: +0X100000000028757b1:1:21:18446744073709551615: +%*25llX: +0X100000000028757b1:0:21: +%25llX: +0x100000000028757B1:1:21:18446744073709551615: +%*25llX: +0x100000000028757B1:0:21: diff --git a/stdio-common/tst-scanf-format-ushort-b.input b/stdio-common/tst-scanf-format-ushort-b.input new file mode 100644 index 0000000..ed1168d --- /dev/null +++ b/stdio-common/tst-scanf-format-ushort-b.input @@ -0,0 +1,644 @@ +%hb::0:-1: +%*hb::0:-1: +%hb:-1111011:1:8:65413: +%*hb:-1111011:0:8: +%hb:-0B1111011:1:10:65413: +%*hb:-0B1111011:0:10: +%hb:-0b1111011:1:10:65413: +%*hb:-0b1111011:0:10: +%hb:-1:1:2:65535: +%*hb:-1:0:2: +%hb:-0B1:1:4:65535: +%*hb:-0B1:0:4: +%hb:-0b1:1:4:65535: +%*hb:-0b1:0:4: +%hb:-0:1:2:0: +%*hb:-0:0:2: +%hb:-0B0:1:4:0: +%*hb:-0B0:0:4: +%hb:-0b0:1:4:0: +%*hb:-0b0:0:4: +%hb:0:1:1:0: +%*hb:0:0:1: +%hb:0B0:1:3:0: +%*hb:0B0:0:3: +%hb:0b0:1:3:0: +%*hb:0b0:0:3: +%hb:1:1:1:1: +%*hb:1:0:1: +%hb:0B1:1:3:1: +%*hb:0B1:0:3: +%hb:0b1:1:3:1: +%*hb:0b1:0:3: +%hb:101010:1:6:42: +%*hb:101010:0:6: +%hb:0B101010:1:8:42: +%*hb:0B101010:0:8: +%hb:0b101010:1:8:42: +%*hb:0b101010:0:8: +%hb:1111111111111111:1:16:65535: +%*hb:1111111111111111:0:16: +%hb:0B1111111111111111:1:18:65535: +%*hb:0B1111111111111111:0:18: +%hb:0b1111111111111111:1:18:65535: +%*hb:0b1111111111111111:0:18: +%hb:10000000000000000:1:17:0: +%*hb:10000000000000000:0:17: +%hb:0B10000000000000000:1:19:0: +%*hb:0B10000000000000000:0:19: +%hb:0b10000000000000000:1:19:0: +%*hb:0b10000000000000000:0:19: +%hb:10000000000101001:1:17:41: +%*hb:10000000000101001:0:17: +%hb:0B10000000000101001:1:19:41: +%*hb:0B10000000000101001:0:19: +%hb:0b10000000000101001:1:19:41: +%*hb:0b10000000000101001:0:19: +%hb:+0:1:2:0: +%*hb:+0:0:2: +%hb:+0B0:1:4:0: +%*hb:+0B0:0:4: +%hb:+0b0:1:4:0: +%*hb:+0b0:0:4: +%hb:+1:1:2:1: +%*hb:+1:0:2: +%hb:+0B1:1:4:1: +%*hb:+0B1:0:4: +%hb:+0b1:1:4:1: +%*hb:+0b1:0:4: +%hb:+101010:1:7:42: +%*hb:+101010:0:7: +%hb:+0B101010:1:9:42: +%*hb:+0B101010:0:9: +%hb:+0b101010:1:9:42: +%*hb:+0b101010:0:9: +%hb:+1111111111111111:1:17:65535: +%*hb:+1111111111111111:0:17: +%hb:+0B1111111111111111:1:19:65535: +%*hb:+0B1111111111111111:0:19: +%hb:+0b1111111111111111:1:19:65535: +%*hb:+0b1111111111111111:0:19: +%hb:+10000000000000000:1:18:0: +%*hb:+10000000000000000:0:18: +%hb:+0B10000000000000000:1:20:0: +%*hb:+0B10000000000000000:0:20: +%hb:+0b10000000000000000:1:20:0: +%*hb:+0b10000000000000000:0:20: +%hb:+10000000000101001:1:18:41: +%*hb:+10000000000101001:0:18: +%hb:+0B10000000000101001:1:20:41: +%*hb:+0B10000000000101001:0:20: +%hb:+0b10000000000101001:1:20:41: +%*hb:+0b10000000000101001:0:20: +%1hb::0:-1: +%*1hb::0:-1: +%1hb:-1111011:0:-1: +%*1hb:-1111011:0:-1: +%1hb:-0B1111011:0:-1: +%*1hb:-0B1111011:0:-1: +%1hb:-0b1111011:0:-1: +%*1hb:-0b1111011:0:-1: +%1hb:-1:0:-1: +%*1hb:-1:0:-1: +%1hb:-0B1:0:-1: +%*1hb:-0B1:0:-1: +%1hb:-0b1:0:-1: +%*1hb:-0b1:0:-1: +%1hb:-0:0:-1: +%*1hb:-0:0:-1: +%1hb:-0B0:0:-1: +%*1hb:-0B0:0:-1: +%1hb:-0b0:0:-1: +%*1hb:-0b0:0:-1: +%1hb:0:1:1:0: +%*1hb:0:0:1: +%1hb:0B0:1:1:0: +%*1hb:0B0:0:1: +%1hb:0b0:1:1:0: +%*1hb:0b0:0:1: +%1hb:1:1:1:1: +%*1hb:1:0:1: +%1hb:0B1:1:1:0: +%*1hb:0B1:0:1: +%1hb:0b1:1:1:0: +%*1hb:0b1:0:1: +%1hb:101010:1:1:1: +%*1hb:101010:0:1: +%1hb:0B101010:1:1:0: +%*1hb:0B101010:0:1: +%1hb:0b101010:1:1:0: +%*1hb:0b101010:0:1: +%1hb:1111111111111111:1:1:1: +%*1hb:1111111111111111:0:1: +%1hb:0B1111111111111111:1:1:0: +%*1hb:0B1111111111111111:0:1: +%1hb:0b1111111111111111:1:1:0: +%*1hb:0b1111111111111111:0:1: +%1hb:10000000000000000:1:1:1: +%*1hb:10000000000000000:0:1: +%1hb:0B10000000000000000:1:1:0: +%*1hb:0B10000000000000000:0:1: +%1hb:0b10000000000000000:1:1:0: +%*1hb:0b10000000000000000:0:1: +%1hb:10000000000101001:1:1:1: +%*1hb:10000000000101001:0:1: +%1hb:0B10000000000101001:1:1:0: +%*1hb:0B10000000000101001:0:1: +%1hb:0b10000000000101001:1:1:0: +%*1hb:0b10000000000101001:0:1: +%1hb:+0:0:-1: +%*1hb:+0:0:-1: +%1hb:+0B0:0:-1: +%*1hb:+0B0:0:-1: +%1hb:+0b0:0:-1: +%*1hb:+0b0:0:-1: +%1hb:+1:0:-1: +%*1hb:+1:0:-1: +%1hb:+0B1:0:-1: +%*1hb:+0B1:0:-1: +%1hb:+0b1:0:-1: +%*1hb:+0b1:0:-1: +%1hb:+101010:0:-1: +%*1hb:+101010:0:-1: +%1hb:+0B101010:0:-1: +%*1hb:+0B101010:0:-1: +%1hb:+0b101010:0:-1: +%*1hb:+0b101010:0:-1: +%1hb:+1111111111111111:0:-1: +%*1hb:+1111111111111111:0:-1: +%1hb:+0B1111111111111111:0:-1: +%*1hb:+0B1111111111111111:0:-1: +%1hb:+0b1111111111111111:0:-1: +%*1hb:+0b1111111111111111:0:-1: +%1hb:+10000000000000000:0:-1: +%*1hb:+10000000000000000:0:-1: +%1hb:+0B10000000000000000:0:-1: +%*1hb:+0B10000000000000000:0:-1: +%1hb:+0b10000000000000000:0:-1: +%*1hb:+0b10000000000000000:0:-1: +%1hb:+10000000000101001:0:-1: +%*1hb:+10000000000101001:0:-1: +%1hb:+0B10000000000101001:0:-1: +%*1hb:+0B10000000000101001:0:-1: +%1hb:+0b10000000000101001:0:-1: +%*1hb:+0b10000000000101001:0:-1: +%2hb::0:-1: +%*2hb::0:-1: +%2hb:-1111011:1:2:65535: +%*2hb:-1111011:0:2: +%2hb:-0B1111011:1:2:0: +%*2hb:-0B1111011:0:2: +%2hb:-0b1111011:1:2:0: +%*2hb:-0b1111011:0:2: +%2hb:-1:1:2:65535: +%*2hb:-1:0:2: +%2hb:-0B1:1:2:0: +%*2hb:-0B1:0:2: +%2hb:-0b1:1:2:0: +%*2hb:-0b1:0:2: +%2hb:-0:1:2:0: +%*2hb:-0:0:2: +%2hb:-0B0:1:2:0: +%*2hb:-0B0:0:2: +%2hb:-0b0:1:2:0: +%*2hb:-0b0:0:2: +%2hb:0:1:1:0: +%*2hb:0:0:1: +%2hb:0B0:0:-1: +%*2hb:0B0:0:-1: +%2hb:0b0:0:-1: +%*2hb:0b0:0:-1: +%2hb:1:1:1:1: +%*2hb:1:0:1: +%2hb:0B1:0:-1: +%*2hb:0B1:0:-1: +%2hb:0b1:0:-1: +%*2hb:0b1:0:-1: +%2hb:101010:1:2:2: +%*2hb:101010:0:2: +%2hb:0B101010:0:-1: +%*2hb:0B101010:0:-1: +%2hb:0b101010:0:-1: +%*2hb:0b101010:0:-1: +%2hb:1111111111111111:1:2:3: +%*2hb:1111111111111111:0:2: +%2hb:0B1111111111111111:0:-1: +%*2hb:0B1111111111111111:0:-1: +%2hb:0b1111111111111111:0:-1: +%*2hb:0b1111111111111111:0:-1: +%2hb:10000000000000000:1:2:2: +%*2hb:10000000000000000:0:2: +%2hb:0B10000000000000000:0:-1: +%*2hb:0B10000000000000000:0:-1: +%2hb:0b10000000000000000:0:-1: +%*2hb:0b10000000000000000:0:-1: +%2hb:10000000000101001:1:2:2: +%*2hb:10000000000101001:0:2: +%2hb:0B10000000000101001:0:-1: +%*2hb:0B10000000000101001:0:-1: +%2hb:0b10000000000101001:0:-1: +%*2hb:0b10000000000101001:0:-1: +%2hb:+0:1:2:0: +%*2hb:+0:0:2: +%2hb:+0B0:1:2:0: +%*2hb:+0B0:0:2: +%2hb:+0b0:1:2:0: +%*2hb:+0b0:0:2: +%2hb:+1:1:2:1: +%*2hb:+1:0:2: +%2hb:+0B1:1:2:0: +%*2hb:+0B1:0:2: +%2hb:+0b1:1:2:0: +%*2hb:+0b1:0:2: +%2hb:+101010:1:2:1: +%*2hb:+101010:0:2: +%2hb:+0B101010:1:2:0: +%*2hb:+0B101010:0:2: +%2hb:+0b101010:1:2:0: +%*2hb:+0b101010:0:2: +%2hb:+1111111111111111:1:2:1: +%*2hb:+1111111111111111:0:2: +%2hb:+0B1111111111111111:1:2:0: +%*2hb:+0B1111111111111111:0:2: +%2hb:+0b1111111111111111:1:2:0: +%*2hb:+0b1111111111111111:0:2: +%2hb:+10000000000000000:1:2:1: +%*2hb:+10000000000000000:0:2: +%2hb:+0B10000000000000000:1:2:0: +%*2hb:+0B10000000000000000:0:2: +%2hb:+0b10000000000000000:1:2:0: +%*2hb:+0b10000000000000000:0:2: +%2hb:+10000000000101001:1:2:1: +%*2hb:+10000000000101001:0:2: +%2hb:+0B10000000000101001:1:2:0: +%*2hb:+0B10000000000101001:0:2: +%2hb:+0b10000000000101001:1:2:0: +%*2hb:+0b10000000000101001:0:2: +%4hb::0:-1: +%*4hb::0:-1: +%4hb:-1111011:1:4:65529: +%*4hb:-1111011:0:4: +%4hb:-0B1111011:1:4:65535: +%*4hb:-0B1111011:0:4: +%4hb:-0b1111011:1:4:65535: +%*4hb:-0b1111011:0:4: +%4hb:-1:1:2:65535: +%*4hb:-1:0:2: +%4hb:-0B1:1:4:65535: +%*4hb:-0B1:0:4: +%4hb:-0b1:1:4:65535: +%*4hb:-0b1:0:4: +%4hb:-0:1:2:0: +%*4hb:-0:0:2: +%4hb:-0B0:1:4:0: +%*4hb:-0B0:0:4: +%4hb:-0b0:1:4:0: +%*4hb:-0b0:0:4: +%4hb:0:1:1:0: +%*4hb:0:0:1: +%4hb:0B0:1:3:0: +%*4hb:0B0:0:3: +%4hb:0b0:1:3:0: +%*4hb:0b0:0:3: +%4hb:1:1:1:1: +%*4hb:1:0:1: +%4hb:0B1:1:3:1: +%*4hb:0B1:0:3: +%4hb:0b1:1:3:1: +%*4hb:0b1:0:3: +%4hb:101010:1:4:10: +%*4hb:101010:0:4: +%4hb:0B101010:1:4:2: +%*4hb:0B101010:0:4: +%4hb:0b101010:1:4:2: +%*4hb:0b101010:0:4: +%4hb:1111111111111111:1:4:15: +%*4hb:1111111111111111:0:4: +%4hb:0B1111111111111111:1:4:3: +%*4hb:0B1111111111111111:0:4: +%4hb:0b1111111111111111:1:4:3: +%*4hb:0b1111111111111111:0:4: +%4hb:10000000000000000:1:4:8: +%*4hb:10000000000000000:0:4: +%4hb:0B10000000000000000:1:4:2: +%*4hb:0B10000000000000000:0:4: +%4hb:0b10000000000000000:1:4:2: +%*4hb:0b10000000000000000:0:4: +%4hb:10000000000101001:1:4:8: +%*4hb:10000000000101001:0:4: +%4hb:0B10000000000101001:1:4:2: +%*4hb:0B10000000000101001:0:4: +%4hb:0b10000000000101001:1:4:2: +%*4hb:0b10000000000101001:0:4: +%4hb:+0:1:2:0: +%*4hb:+0:0:2: +%4hb:+0B0:1:4:0: +%*4hb:+0B0:0:4: +%4hb:+0b0:1:4:0: +%*4hb:+0b0:0:4: +%4hb:+1:1:2:1: +%*4hb:+1:0:2: +%4hb:+0B1:1:4:1: +%*4hb:+0B1:0:4: +%4hb:+0b1:1:4:1: +%*4hb:+0b1:0:4: +%4hb:+101010:1:4:5: +%*4hb:+101010:0:4: +%4hb:+0B101010:1:4:1: +%*4hb:+0B101010:0:4: +%4hb:+0b101010:1:4:1: +%*4hb:+0b101010:0:4: +%4hb:+1111111111111111:1:4:7: +%*4hb:+1111111111111111:0:4: +%4hb:+0B1111111111111111:1:4:1: +%*4hb:+0B1111111111111111:0:4: +%4hb:+0b1111111111111111:1:4:1: +%*4hb:+0b1111111111111111:0:4: +%4hb:+10000000000000000:1:4:4: +%*4hb:+10000000000000000:0:4: +%4hb:+0B10000000000000000:1:4:1: +%*4hb:+0B10000000000000000:0:4: +%4hb:+0b10000000000000000:1:4:1: +%*4hb:+0b10000000000000000:0:4: +%4hb:+10000000000101001:1:4:4: +%*4hb:+10000000000101001:0:4: +%4hb:+0B10000000000101001:1:4:1: +%*4hb:+0B10000000000101001:0:4: +%4hb:+0b10000000000101001:1:4:1: +%*4hb:+0b10000000000101001:0:4: +%7hb::0:-1: +%*7hb::0:-1: +%7hb:-1111011:1:7:65475: +%*7hb:-1111011:0:7: +%7hb:-0B1111011:1:7:65521: +%*7hb:-0B1111011:0:7: +%7hb:-0b1111011:1:7:65521: +%*7hb:-0b1111011:0:7: +%7hb:-1:1:2:65535: +%*7hb:-1:0:2: +%7hb:-0B1:1:4:65535: +%*7hb:-0B1:0:4: +%7hb:-0b1:1:4:65535: +%*7hb:-0b1:0:4: +%7hb:-0:1:2:0: +%*7hb:-0:0:2: +%7hb:-0B0:1:4:0: +%*7hb:-0B0:0:4: +%7hb:-0b0:1:4:0: +%*7hb:-0b0:0:4: +%7hb:0:1:1:0: +%*7hb:0:0:1: +%7hb:0B0:1:3:0: +%*7hb:0B0:0:3: +%7hb:0b0:1:3:0: +%*7hb:0b0:0:3: +%7hb:1:1:1:1: +%*7hb:1:0:1: +%7hb:0B1:1:3:1: +%*7hb:0B1:0:3: +%7hb:0b1:1:3:1: +%*7hb:0b1:0:3: +%7hb:101010:1:6:42: +%*7hb:101010:0:6: +%7hb:0B101010:1:7:21: +%*7hb:0B101010:0:7: +%7hb:0b101010:1:7:21: +%*7hb:0b101010:0:7: +%7hb:1111111111111111:1:7:127: +%*7hb:1111111111111111:0:7: +%7hb:0B1111111111111111:1:7:31: +%*7hb:0B1111111111111111:0:7: +%7hb:0b1111111111111111:1:7:31: +%*7hb:0b1111111111111111:0:7: +%7hb:10000000000000000:1:7:64: +%*7hb:10000000000000000:0:7: +%7hb:0B10000000000000000:1:7:16: +%*7hb:0B10000000000000000:0:7: +%7hb:0b10000000000000000:1:7:16: +%*7hb:0b10000000000000000:0:7: +%7hb:10000000000101001:1:7:64: +%*7hb:10000000000101001:0:7: +%7hb:0B10000000000101001:1:7:16: +%*7hb:0B10000000000101001:0:7: +%7hb:0b10000000000101001:1:7:16: +%*7hb:0b10000000000101001:0:7: +%7hb:+0:1:2:0: +%*7hb:+0:0:2: +%7hb:+0B0:1:4:0: +%*7hb:+0B0:0:4: +%7hb:+0b0:1:4:0: +%*7hb:+0b0:0:4: +%7hb:+1:1:2:1: +%*7hb:+1:0:2: +%7hb:+0B1:1:4:1: +%*7hb:+0B1:0:4: +%7hb:+0b1:1:4:1: +%*7hb:+0b1:0:4: +%7hb:+101010:1:7:42: +%*7hb:+101010:0:7: +%7hb:+0B101010:1:7:10: +%*7hb:+0B101010:0:7: +%7hb:+0b101010:1:7:10: +%*7hb:+0b101010:0:7: +%7hb:+1111111111111111:1:7:63: +%*7hb:+1111111111111111:0:7: +%7hb:+0B1111111111111111:1:7:15: +%*7hb:+0B1111111111111111:0:7: +%7hb:+0b1111111111111111:1:7:15: +%*7hb:+0b1111111111111111:0:7: +%7hb:+10000000000000000:1:7:32: +%*7hb:+10000000000000000:0:7: +%7hb:+0B10000000000000000:1:7:8: +%*7hb:+0B10000000000000000:0:7: +%7hb:+0b10000000000000000:1:7:8: +%*7hb:+0b10000000000000000:0:7: +%7hb:+10000000000101001:1:7:32: +%*7hb:+10000000000101001:0:7: +%7hb:+0B10000000000101001:1:7:8: +%*7hb:+0B10000000000101001:0:7: +%7hb:+0b10000000000101001:1:7:8: +%*7hb:+0b10000000000101001:0:7: +%2hb: :0:-1: +%*2hb: :0:-1: +%2hb: -1111011:1:3:65535: +%*2hb: -1111011:0:3: +%2hb: -0B1111011:1:3:0: +%*2hb: -0B1111011:0:3: +%2hb: -0b1111011:1:3:0: +%*2hb: -0b1111011:0:3: +%2hb: -1:1:3:65535: +%*2hb: -1:0:3: +%2hb: -0B1:1:3:0: +%*2hb: -0B1:0:3: +%2hb: -0b1:1:3:0: +%*2hb: -0b1:0:3: +%2hb: -0:1:3:0: +%*2hb: -0:0:3: +%2hb: -0B0:1:3:0: +%*2hb: -0B0:0:3: +%2hb: -0b0:1:3:0: +%*2hb: -0b0:0:3: +%2hb: 0:1:2:0: +%*2hb: 0:0:2: +%2hb: 0B0:0:-1: +%*2hb: 0B0:0:-1: +%2hb: 0b0:0:-1: +%*2hb: 0b0:0:-1: +%2hb: 1:1:2:1: +%*2hb: 1:0:2: +%2hb: 0B1:0:-1: +%*2hb: 0B1:0:-1: +%2hb: 0b1:0:-1: +%*2hb: 0b1:0:-1: +%2hb: 101010:1:3:2: +%*2hb: 101010:0:3: +%2hb: 0B101010:0:-1: +%*2hb: 0B101010:0:-1: +%2hb: 0b101010:0:-1: +%*2hb: 0b101010:0:-1: +%2hb: 1111111111111111:1:3:3: +%*2hb: 1111111111111111:0:3: +%2hb: 0B1111111111111111:0:-1: +%*2hb: 0B1111111111111111:0:-1: +%2hb: 0b1111111111111111:0:-1: +%*2hb: 0b1111111111111111:0:-1: +%2hb: 10000000000000000:1:3:2: +%*2hb: 10000000000000000:0:3: +%2hb: 0B10000000000000000:0:-1: +%*2hb: 0B10000000000000000:0:-1: +%2hb: 0b10000000000000000:0:-1: +%*2hb: 0b10000000000000000:0:-1: +%2hb: 10000000000101001:1:3:2: +%*2hb: 10000000000101001:0:3: +%2hb: 0B10000000000101001:0:-1: +%*2hb: 0B10000000000101001:0:-1: +%2hb: 0b10000000000101001:0:-1: +%*2hb: 0b10000000000101001:0:-1: +%2hb: +0:1:3:0: +%*2hb: +0:0:3: +%2hb: +0B0:1:3:0: +%*2hb: +0B0:0:3: +%2hb: +0b0:1:3:0: +%*2hb: +0b0:0:3: +%2hb: +1:1:3:1: +%*2hb: +1:0:3: +%2hb: +0B1:1:3:0: +%*2hb: +0B1:0:3: +%2hb: +0b1:1:3:0: +%*2hb: +0b1:0:3: +%2hb: +101010:1:3:1: +%*2hb: +101010:0:3: +%2hb: +0B101010:1:3:0: +%*2hb: +0B101010:0:3: +%2hb: +0b101010:1:3:0: +%*2hb: +0b101010:0:3: +%2hb: +1111111111111111:1:3:1: +%*2hb: +1111111111111111:0:3: +%2hb: +0B1111111111111111:1:3:0: +%*2hb: +0B1111111111111111:0:3: +%2hb: +0b1111111111111111:1:3:0: +%*2hb: +0b1111111111111111:0:3: +%2hb: +10000000000000000:1:3:1: +%*2hb: +10000000000000000:0:3: +%2hb: +0B10000000000000000:1:3:0: +%*2hb: +0B10000000000000000:0:3: +%2hb: +0b10000000000000000:1:3:0: +%*2hb: +0b10000000000000000:0:3: +%2hb: +10000000000101001:1:3:1: +%*2hb: +10000000000101001:0:3: +%2hb: +0B10000000000101001:1:3:0: +%*2hb: +0B10000000000101001:0:3: +%2hb: +0b10000000000101001:1:3:0: +%*2hb: +0b10000000000101001:0:3: +%7hb: :0:-1: +%*7hb: :0:-1: +%7hb: -1111011:1:8:65475: +%*7hb: -1111011:0:8: +%7hb: -0B1111011:1:8:65521: +%*7hb: -0B1111011:0:8: +%7hb: -0b1111011:1:8:65521: +%*7hb: -0b1111011:0:8: +%7hb: -1:1:3:65535: +%*7hb: -1:0:3: +%7hb: -0B1:1:5:65535: +%*7hb: -0B1:0:5: +%7hb: -0b1:1:5:65535: +%*7hb: -0b1:0:5: +%7hb: -0:1:3:0: +%*7hb: -0:0:3: +%7hb: -0B0:1:5:0: +%*7hb: -0B0:0:5: +%7hb: -0b0:1:5:0: +%*7hb: -0b0:0:5: +%7hb: 0:1:2:0: +%*7hb: 0:0:2: +%7hb: 0B0:1:4:0: +%*7hb: 0B0:0:4: +%7hb: 0b0:1:4:0: +%*7hb: 0b0:0:4: +%7hb: 1:1:2:1: +%*7hb: 1:0:2: +%7hb: 0B1:1:4:1: +%*7hb: 0B1:0:4: +%7hb: 0b1:1:4:1: +%*7hb: 0b1:0:4: +%7hb: 101010:1:7:42: +%*7hb: 101010:0:7: +%7hb: 0B101010:1:8:21: +%*7hb: 0B101010:0:8: +%7hb: 0b101010:1:8:21: +%*7hb: 0b101010:0:8: +%7hb: 1111111111111111:1:8:127: +%*7hb: 1111111111111111:0:8: +%7hb: 0B1111111111111111:1:8:31: +%*7hb: 0B1111111111111111:0:8: +%7hb: 0b1111111111111111:1:8:31: +%*7hb: 0b1111111111111111:0:8: +%7hb: 10000000000000000:1:8:64: +%*7hb: 10000000000000000:0:8: +%7hb: 0B10000000000000000:1:8:16: +%*7hb: 0B10000000000000000:0:8: +%7hb: 0b10000000000000000:1:8:16: +%*7hb: 0b10000000000000000:0:8: +%7hb: 10000000000101001:1:8:64: +%*7hb: 10000000000101001:0:8: +%7hb: 0B10000000000101001:1:8:16: +%*7hb: 0B10000000000101001:0:8: +%7hb: 0b10000000000101001:1:8:16: +%*7hb: 0b10000000000101001:0:8: +%7hb: +0:1:3:0: +%*7hb: +0:0:3: +%7hb: +0B0:1:5:0: +%*7hb: +0B0:0:5: +%7hb: +0b0:1:5:0: +%*7hb: +0b0:0:5: +%7hb: +1:1:3:1: +%*7hb: +1:0:3: +%7hb: +0B1:1:5:1: +%*7hb: +0B1:0:5: +%7hb: +0b1:1:5:1: +%*7hb: +0b1:0:5: +%7hb: +101010:1:8:42: +%*7hb: +101010:0:8: +%7hb: +0B101010:1:8:10: +%*7hb: +0B101010:0:8: +%7hb: +0b101010:1:8:10: +%*7hb: +0b101010:0:8: +%7hb: +1111111111111111:1:8:63: +%*7hb: +1111111111111111:0:8: +%7hb: +0B1111111111111111:1:8:15: +%*7hb: +0B1111111111111111:0:8: +%7hb: +0b1111111111111111:1:8:15: +%*7hb: +0b1111111111111111:0:8: +%7hb: +10000000000000000:1:8:32: +%*7hb: +10000000000000000:0:8: +%7hb: +0B10000000000000000:1:8:8: +%*7hb: +0B10000000000000000:0:8: +%7hb: +0b10000000000000000:1:8:8: +%*7hb: +0b10000000000000000:0:8: +%7hb: +10000000000101001:1:8:32: +%*7hb: +10000000000101001:0:8: +%7hb: +0B10000000000101001:1:8:8: +%*7hb: +0B10000000000101001:0:8: +%7hb: +0b10000000000101001:1:8:8: +%*7hb: +0b10000000000101001:0:8: diff --git a/stdio-common/tst-scanf-format-ushort-o.input b/stdio-common/tst-scanf-format-ushort-o.input new file mode 100644 index 0000000..8276be4 --- /dev/null +++ b/stdio-common/tst-scanf-format-ushort-o.input @@ -0,0 +1,434 @@ +%ho::0:-1: +%*ho::0:-1: +%ho:-173:1:4:65413: +%*ho:-173:0:4: +%ho:-0173:1:5:65413: +%*ho:-0173:0:5: +%ho:-1:1:2:65535: +%*ho:-1:0:2: +%ho:-01:1:3:65535: +%*ho:-01:0:3: +%ho:-0:1:2:0: +%*ho:-0:0:2: +%ho:-00:1:3:0: +%*ho:-00:0:3: +%ho:0:1:1:0: +%*ho:0:0:1: +%ho:00:1:2:0: +%*ho:00:0:2: +%ho:1:1:1:1: +%*ho:1:0:1: +%ho:01:1:2:1: +%*ho:01:0:2: +%ho:52:1:2:42: +%*ho:52:0:2: +%ho:052:1:3:42: +%*ho:052:0:3: +%ho:177777:1:6:65535: +%*ho:177777:0:6: +%ho:0177777:1:7:65535: +%*ho:0177777:0:7: +%ho:200000:1:6:0: +%*ho:200000:0:6: +%ho:0200000:1:7:0: +%*ho:0200000:0:7: +%ho:200051:1:6:41: +%*ho:200051:0:6: +%ho:0200051:1:7:41: +%*ho:0200051:0:7: +%ho:+0:1:2:0: +%*ho:+0:0:2: +%ho:+00:1:3:0: +%*ho:+00:0:3: +%ho:+1:1:2:1: +%*ho:+1:0:2: +%ho:+01:1:3:1: +%*ho:+01:0:3: +%ho:+52:1:3:42: +%*ho:+52:0:3: +%ho:+052:1:4:42: +%*ho:+052:0:4: +%ho:+177777:1:7:65535: +%*ho:+177777:0:7: +%ho:+0177777:1:8:65535: +%*ho:+0177777:0:8: +%ho:+200000:1:7:0: +%*ho:+200000:0:7: +%ho:+0200000:1:8:0: +%*ho:+0200000:0:8: +%ho:+200051:1:7:41: +%*ho:+200051:0:7: +%ho:+0200051:1:8:41: +%*ho:+0200051:0:8: +%1ho::0:-1: +%*1ho::0:-1: +%1ho:-173:0:-1: +%*1ho:-173:0:-1: +%1ho:-0173:0:-1: +%*1ho:-0173:0:-1: +%1ho:-1:0:-1: +%*1ho:-1:0:-1: +%1ho:-01:0:-1: +%*1ho:-01:0:-1: +%1ho:-0:0:-1: +%*1ho:-0:0:-1: +%1ho:-00:0:-1: +%*1ho:-00:0:-1: +%1ho:0:1:1:0: +%*1ho:0:0:1: +%1ho:00:1:1:0: +%*1ho:00:0:1: +%1ho:1:1:1:1: +%*1ho:1:0:1: +%1ho:01:1:1:0: +%*1ho:01:0:1: +%1ho:52:1:1:5: +%*1ho:52:0:1: +%1ho:052:1:1:0: +%*1ho:052:0:1: +%1ho:177777:1:1:1: +%*1ho:177777:0:1: +%1ho:0177777:1:1:0: +%*1ho:0177777:0:1: +%1ho:200000:1:1:2: +%*1ho:200000:0:1: +%1ho:0200000:1:1:0: +%*1ho:0200000:0:1: +%1ho:200051:1:1:2: +%*1ho:200051:0:1: +%1ho:0200051:1:1:0: +%*1ho:0200051:0:1: +%1ho:+0:0:-1: +%*1ho:+0:0:-1: +%1ho:+00:0:-1: +%*1ho:+00:0:-1: +%1ho:+1:0:-1: +%*1ho:+1:0:-1: +%1ho:+01:0:-1: +%*1ho:+01:0:-1: +%1ho:+52:0:-1: +%*1ho:+52:0:-1: +%1ho:+052:0:-1: +%*1ho:+052:0:-1: +%1ho:+177777:0:-1: +%*1ho:+177777:0:-1: +%1ho:+0177777:0:-1: +%*1ho:+0177777:0:-1: +%1ho:+200000:0:-1: +%*1ho:+200000:0:-1: +%1ho:+0200000:0:-1: +%*1ho:+0200000:0:-1: +%1ho:+200051:0:-1: +%*1ho:+200051:0:-1: +%1ho:+0200051:0:-1: +%*1ho:+0200051:0:-1: +%2ho::0:-1: +%*2ho::0:-1: +%2ho:-173:1:2:65535: +%*2ho:-173:0:2: +%2ho:-0173:1:2:0: +%*2ho:-0173:0:2: +%2ho:-1:1:2:65535: +%*2ho:-1:0:2: +%2ho:-01:1:2:0: +%*2ho:-01:0:2: +%2ho:-0:1:2:0: +%*2ho:-0:0:2: +%2ho:-00:1:2:0: +%*2ho:-00:0:2: +%2ho:0:1:1:0: +%*2ho:0:0:1: +%2ho:00:1:2:0: +%*2ho:00:0:2: +%2ho:1:1:1:1: +%*2ho:1:0:1: +%2ho:01:1:2:1: +%*2ho:01:0:2: +%2ho:52:1:2:42: +%*2ho:52:0:2: +%2ho:052:1:2:5: +%*2ho:052:0:2: +%2ho:177777:1:2:15: +%*2ho:177777:0:2: +%2ho:0177777:1:2:1: +%*2ho:0177777:0:2: +%2ho:200000:1:2:16: +%*2ho:200000:0:2: +%2ho:0200000:1:2:2: +%*2ho:0200000:0:2: +%2ho:200051:1:2:16: +%*2ho:200051:0:2: +%2ho:0200051:1:2:2: +%*2ho:0200051:0:2: +%2ho:+0:1:2:0: +%*2ho:+0:0:2: +%2ho:+00:1:2:0: +%*2ho:+00:0:2: +%2ho:+1:1:2:1: +%*2ho:+1:0:2: +%2ho:+01:1:2:0: +%*2ho:+01:0:2: +%2ho:+52:1:2:5: +%*2ho:+52:0:2: +%2ho:+052:1:2:0: +%*2ho:+052:0:2: +%2ho:+177777:1:2:1: +%*2ho:+177777:0:2: +%2ho:+0177777:1:2:0: +%*2ho:+0177777:0:2: +%2ho:+200000:1:2:2: +%*2ho:+200000:0:2: +%2ho:+0200000:1:2:0: +%*2ho:+0200000:0:2: +%2ho:+200051:1:2:2: +%*2ho:+200051:0:2: +%2ho:+0200051:1:2:0: +%*2ho:+0200051:0:2: +%4ho::0:-1: +%*4ho::0:-1: +%4ho:-173:1:4:65413: +%*4ho:-173:0:4: +%4ho:-0173:1:4:65521: +%*4ho:-0173:0:4: +%4ho:-1:1:2:65535: +%*4ho:-1:0:2: +%4ho:-01:1:3:65535: +%*4ho:-01:0:3: +%4ho:-0:1:2:0: +%*4ho:-0:0:2: +%4ho:-00:1:3:0: +%*4ho:-00:0:3: +%4ho:0:1:1:0: +%*4ho:0:0:1: +%4ho:00:1:2:0: +%*4ho:00:0:2: +%4ho:1:1:1:1: +%*4ho:1:0:1: +%4ho:01:1:2:1: +%*4ho:01:0:2: +%4ho:52:1:2:42: +%*4ho:52:0:2: +%4ho:052:1:3:42: +%*4ho:052:0:3: +%4ho:177777:1:4:1023: +%*4ho:177777:0:4: +%4ho:0177777:1:4:127: +%*4ho:0177777:0:4: +%4ho:200000:1:4:1024: +%*4ho:200000:0:4: +%4ho:0200000:1:4:128: +%*4ho:0200000:0:4: +%4ho:200051:1:4:1024: +%*4ho:200051:0:4: +%4ho:0200051:1:4:128: +%*4ho:0200051:0:4: +%4ho:+0:1:2:0: +%*4ho:+0:0:2: +%4ho:+00:1:3:0: +%*4ho:+00:0:3: +%4ho:+1:1:2:1: +%*4ho:+1:0:2: +%4ho:+01:1:3:1: +%*4ho:+01:0:3: +%4ho:+52:1:3:42: +%*4ho:+52:0:3: +%4ho:+052:1:4:42: +%*4ho:+052:0:4: +%4ho:+177777:1:4:127: +%*4ho:+177777:0:4: +%4ho:+0177777:1:4:15: +%*4ho:+0177777:0:4: +%4ho:+200000:1:4:128: +%*4ho:+200000:0:4: +%4ho:+0200000:1:4:16: +%*4ho:+0200000:0:4: +%4ho:+200051:1:4:128: +%*4ho:+200051:0:4: +%4ho:+0200051:1:4:16: +%*4ho:+0200051:0:4: +%7ho::0:-1: +%*7ho::0:-1: +%7ho:-173:1:4:65413: +%*7ho:-173:0:4: +%7ho:-0173:1:5:65413: +%*7ho:-0173:0:5: +%7ho:-1:1:2:65535: +%*7ho:-1:0:2: +%7ho:-01:1:3:65535: +%*7ho:-01:0:3: +%7ho:-0:1:2:0: +%*7ho:-0:0:2: +%7ho:-00:1:3:0: +%*7ho:-00:0:3: +%7ho:0:1:1:0: +%*7ho:0:0:1: +%7ho:00:1:2:0: +%*7ho:00:0:2: +%7ho:1:1:1:1: +%*7ho:1:0:1: +%7ho:01:1:2:1: +%*7ho:01:0:2: +%7ho:52:1:2:42: +%*7ho:52:0:2: +%7ho:052:1:3:42: +%*7ho:052:0:3: +%7ho:177777:1:6:65535: +%*7ho:177777:0:6: +%7ho:0177777:1:7:65535: +%*7ho:0177777:0:7: +%7ho:200000:1:6:0: +%*7ho:200000:0:6: +%7ho:0200000:1:7:0: +%*7ho:0200000:0:7: +%7ho:200051:1:6:41: +%*7ho:200051:0:6: +%7ho:0200051:1:7:41: +%*7ho:0200051:0:7: +%7ho:+0:1:2:0: +%*7ho:+0:0:2: +%7ho:+00:1:3:0: +%*7ho:+00:0:3: +%7ho:+1:1:2:1: +%*7ho:+1:0:2: +%7ho:+01:1:3:1: +%*7ho:+01:0:3: +%7ho:+52:1:3:42: +%*7ho:+52:0:3: +%7ho:+052:1:4:42: +%*7ho:+052:0:4: +%7ho:+177777:1:7:65535: +%*7ho:+177777:0:7: +%7ho:+0177777:1:7:8191: +%*7ho:+0177777:0:7: +%7ho:+200000:1:7:0: +%*7ho:+200000:0:7: +%7ho:+0200000:1:7:8192: +%*7ho:+0200000:0:7: +%7ho:+200051:1:7:41: +%*7ho:+200051:0:7: +%7ho:+0200051:1:7:8197: +%*7ho:+0200051:0:7: +%2ho: :0:-1: +%*2ho: :0:-1: +%2ho: -173:1:3:65535: +%*2ho: -173:0:3: +%2ho: -0173:1:3:0: +%*2ho: -0173:0:3: +%2ho: -1:1:3:65535: +%*2ho: -1:0:3: +%2ho: -01:1:3:0: +%*2ho: -01:0:3: +%2ho: -0:1:3:0: +%*2ho: -0:0:3: +%2ho: -00:1:3:0: +%*2ho: -00:0:3: +%2ho: 0:1:2:0: +%*2ho: 0:0:2: +%2ho: 00:1:3:0: +%*2ho: 00:0:3: +%2ho: 1:1:2:1: +%*2ho: 1:0:2: +%2ho: 01:1:3:1: +%*2ho: 01:0:3: +%2ho: 52:1:3:42: +%*2ho: 52:0:3: +%2ho: 052:1:3:5: +%*2ho: 052:0:3: +%2ho: 177777:1:3:15: +%*2ho: 177777:0:3: +%2ho: 0177777:1:3:1: +%*2ho: 0177777:0:3: +%2ho: 200000:1:3:16: +%*2ho: 200000:0:3: +%2ho: 0200000:1:3:2: +%*2ho: 0200000:0:3: +%2ho: 200051:1:3:16: +%*2ho: 200051:0:3: +%2ho: 0200051:1:3:2: +%*2ho: 0200051:0:3: +%2ho: +0:1:3:0: +%*2ho: +0:0:3: +%2ho: +00:1:3:0: +%*2ho: +00:0:3: +%2ho: +1:1:3:1: +%*2ho: +1:0:3: +%2ho: +01:1:3:0: +%*2ho: +01:0:3: +%2ho: +52:1:3:5: +%*2ho: +52:0:3: +%2ho: +052:1:3:0: +%*2ho: +052:0:3: +%2ho: +177777:1:3:1: +%*2ho: +177777:0:3: +%2ho: +0177777:1:3:0: +%*2ho: +0177777:0:3: +%2ho: +200000:1:3:2: +%*2ho: +200000:0:3: +%2ho: +0200000:1:3:0: +%*2ho: +0200000:0:3: +%2ho: +200051:1:3:2: +%*2ho: +200051:0:3: +%2ho: +0200051:1:3:0: +%*2ho: +0200051:0:3: +%7ho: :0:-1: +%*7ho: :0:-1: +%7ho: -173:1:5:65413: +%*7ho: -173:0:5: +%7ho: -0173:1:6:65413: +%*7ho: -0173:0:6: +%7ho: -1:1:3:65535: +%*7ho: -1:0:3: +%7ho: -01:1:4:65535: +%*7ho: -01:0:4: +%7ho: -0:1:3:0: +%*7ho: -0:0:3: +%7ho: -00:1:4:0: +%*7ho: -00:0:4: +%7ho: 0:1:2:0: +%*7ho: 0:0:2: +%7ho: 00:1:3:0: +%*7ho: 00:0:3: +%7ho: 1:1:2:1: +%*7ho: 1:0:2: +%7ho: 01:1:3:1: +%*7ho: 01:0:3: +%7ho: 52:1:3:42: +%*7ho: 52:0:3: +%7ho: 052:1:4:42: +%*7ho: 052:0:4: +%7ho: 177777:1:7:65535: +%*7ho: 177777:0:7: +%7ho: 0177777:1:8:65535: +%*7ho: 0177777:0:8: +%7ho: 200000:1:7:0: +%*7ho: 200000:0:7: +%7ho: 0200000:1:8:0: +%*7ho: 0200000:0:8: +%7ho: 200051:1:7:41: +%*7ho: 200051:0:7: +%7ho: 0200051:1:8:41: +%*7ho: 0200051:0:8: +%7ho: +0:1:3:0: +%*7ho: +0:0:3: +%7ho: +00:1:4:0: +%*7ho: +00:0:4: +%7ho: +1:1:3:1: +%*7ho: +1:0:3: +%7ho: +01:1:4:1: +%*7ho: +01:0:4: +%7ho: +52:1:4:42: +%*7ho: +52:0:4: +%7ho: +052:1:5:42: +%*7ho: +052:0:5: +%7ho: +177777:1:8:65535: +%*7ho: +177777:0:8: +%7ho: +0177777:1:8:8191: +%*7ho: +0177777:0:8: +%7ho: +200000:1:8:0: +%*7ho: +200000:0:8: +%7ho: +0200000:1:8:8192: +%*7ho: +0200000:0:8: +%7ho: +200051:1:8:41: +%*7ho: +200051:0:8: +%7ho: +0200051:1:8:8197: +%*7ho: +0200051:0:8: diff --git a/stdio-common/tst-scanf-format-ushort-u.input b/stdio-common/tst-scanf-format-ushort-u.input new file mode 100644 index 0000000..56f7da5 --- /dev/null +++ b/stdio-common/tst-scanf-format-ushort-u.input @@ -0,0 +1,224 @@ +%hu::0:-1: +%*hu::0:-1: +%hu:-123:1:4:65413: +%*hu:-123:0:4: +%hu:-1:1:2:65535: +%*hu:-1:0:2: +%hu:-0:1:2:0: +%*hu:-0:0:2: +%hu:0:1:1:0: +%*hu:0:0:1: +%hu:1:1:1:1: +%*hu:1:0:1: +%hu:42:1:2:42: +%*hu:42:0:2: +%hu:65535:1:5:65535: +%*hu:65535:0:5: +%hu:65536:1:5:0: +%*hu:65536:0:5: +%hu:65577:1:5:41: +%*hu:65577:0:5: +%hu:+0:1:2:0: +%*hu:+0:0:2: +%hu:+1:1:2:1: +%*hu:+1:0:2: +%hu:+42:1:3:42: +%*hu:+42:0:3: +%hu:+65535:1:6:65535: +%*hu:+65535:0:6: +%hu:+65536:1:6:0: +%*hu:+65536:0:6: +%hu:+65577:1:6:41: +%*hu:+65577:0:6: +%1hu::0:-1: +%*1hu::0:-1: +%1hu:-123:0:-1: +%*1hu:-123:0:-1: +%1hu:-1:0:-1: +%*1hu:-1:0:-1: +%1hu:-0:0:-1: +%*1hu:-0:0:-1: +%1hu:0:1:1:0: +%*1hu:0:0:1: +%1hu:1:1:1:1: +%*1hu:1:0:1: +%1hu:42:1:1:4: +%*1hu:42:0:1: +%1hu:65535:1:1:6: +%*1hu:65535:0:1: +%1hu:65536:1:1:6: +%*1hu:65536:0:1: +%1hu:65577:1:1:6: +%*1hu:65577:0:1: +%1hu:+0:0:-1: +%*1hu:+0:0:-1: +%1hu:+1:0:-1: +%*1hu:+1:0:-1: +%1hu:+42:0:-1: +%*1hu:+42:0:-1: +%1hu:+65535:0:-1: +%*1hu:+65535:0:-1: +%1hu:+65536:0:-1: +%*1hu:+65536:0:-1: +%1hu:+65577:0:-1: +%*1hu:+65577:0:-1: +%2hu::0:-1: +%*2hu::0:-1: +%2hu:-123:1:2:65535: +%*2hu:-123:0:2: +%2hu:-1:1:2:65535: +%*2hu:-1:0:2: +%2hu:-0:1:2:0: +%*2hu:-0:0:2: +%2hu:0:1:1:0: +%*2hu:0:0:1: +%2hu:1:1:1:1: +%*2hu:1:0:1: +%2hu:42:1:2:42: +%*2hu:42:0:2: +%2hu:65535:1:2:65: +%*2hu:65535:0:2: +%2hu:65536:1:2:65: +%*2hu:65536:0:2: +%2hu:65577:1:2:65: +%*2hu:65577:0:2: +%2hu:+0:1:2:0: +%*2hu:+0:0:2: +%2hu:+1:1:2:1: +%*2hu:+1:0:2: +%2hu:+42:1:2:4: +%*2hu:+42:0:2: +%2hu:+65535:1:2:6: +%*2hu:+65535:0:2: +%2hu:+65536:1:2:6: +%*2hu:+65536:0:2: +%2hu:+65577:1:2:6: +%*2hu:+65577:0:2: +%4hu::0:-1: +%*4hu::0:-1: +%4hu:-123:1:4:65413: +%*4hu:-123:0:4: +%4hu:-1:1:2:65535: +%*4hu:-1:0:2: +%4hu:-0:1:2:0: +%*4hu:-0:0:2: +%4hu:0:1:1:0: +%*4hu:0:0:1: +%4hu:1:1:1:1: +%*4hu:1:0:1: +%4hu:42:1:2:42: +%*4hu:42:0:2: +%4hu:65535:1:4:6553: +%*4hu:65535:0:4: +%4hu:65536:1:4:6553: +%*4hu:65536:0:4: +%4hu:65577:1:4:6557: +%*4hu:65577:0:4: +%4hu:+0:1:2:0: +%*4hu:+0:0:2: +%4hu:+1:1:2:1: +%*4hu:+1:0:2: +%4hu:+42:1:3:42: +%*4hu:+42:0:3: +%4hu:+65535:1:4:655: +%*4hu:+65535:0:4: +%4hu:+65536:1:4:655: +%*4hu:+65536:0:4: +%4hu:+65577:1:4:655: +%*4hu:+65577:0:4: +%7hu::0:-1: +%*7hu::0:-1: +%7hu:-123:1:4:65413: +%*7hu:-123:0:4: +%7hu:-1:1:2:65535: +%*7hu:-1:0:2: +%7hu:-0:1:2:0: +%*7hu:-0:0:2: +%7hu:0:1:1:0: +%*7hu:0:0:1: +%7hu:1:1:1:1: +%*7hu:1:0:1: +%7hu:42:1:2:42: +%*7hu:42:0:2: +%7hu:65535:1:5:65535: +%*7hu:65535:0:5: +%7hu:65536:1:5:0: +%*7hu:65536:0:5: +%7hu:65577:1:5:41: +%*7hu:65577:0:5: +%7hu:+0:1:2:0: +%*7hu:+0:0:2: +%7hu:+1:1:2:1: +%*7hu:+1:0:2: +%7hu:+42:1:3:42: +%*7hu:+42:0:3: +%7hu:+65535:1:6:65535: +%*7hu:+65535:0:6: +%7hu:+65536:1:6:0: +%*7hu:+65536:0:6: +%7hu:+65577:1:6:41: +%*7hu:+65577:0:6: +%2hu: :0:-1: +%*2hu: :0:-1: +%2hu: -123:1:3:65535: +%*2hu: -123:0:3: +%2hu: -1:1:3:65535: +%*2hu: -1:0:3: +%2hu: -0:1:3:0: +%*2hu: -0:0:3: +%2hu: 0:1:2:0: +%*2hu: 0:0:2: +%2hu: 1:1:2:1: +%*2hu: 1:0:2: +%2hu: 42:1:3:42: +%*2hu: 42:0:3: +%2hu: 65535:1:3:65: +%*2hu: 65535:0:3: +%2hu: 65536:1:3:65: +%*2hu: 65536:0:3: +%2hu: 65577:1:3:65: +%*2hu: 65577:0:3: +%2hu: +0:1:3:0: +%*2hu: +0:0:3: +%2hu: +1:1:3:1: +%*2hu: +1:0:3: +%2hu: +42:1:3:4: +%*2hu: +42:0:3: +%2hu: +65535:1:3:6: +%*2hu: +65535:0:3: +%2hu: +65536:1:3:6: +%*2hu: +65536:0:3: +%2hu: +65577:1:3:6: +%*2hu: +65577:0:3: +%7hu: :0:-1: +%*7hu: :0:-1: +%7hu: -123:1:5:65413: +%*7hu: -123:0:5: +%7hu: -1:1:3:65535: +%*7hu: -1:0:3: +%7hu: -0:1:3:0: +%*7hu: -0:0:3: +%7hu: 0:1:2:0: +%*7hu: 0:0:2: +%7hu: 1:1:2:1: +%*7hu: 1:0:2: +%7hu: 42:1:3:42: +%*7hu: 42:0:3: +%7hu: 65535:1:6:65535: +%*7hu: 65535:0:6: +%7hu: 65536:1:6:0: +%*7hu: 65536:0:6: +%7hu: 65577:1:6:41: +%*7hu: 65577:0:6: +%7hu: +0:1:3:0: +%*7hu: +0:0:3: +%7hu: +1:1:3:1: +%*7hu: +1:0:3: +%7hu: +42:1:4:42: +%*7hu: +42:0:4: +%7hu: +65535:1:7:65535: +%*7hu: +65535:0:7: +%7hu: +65536:1:7:0: +%*7hu: +65536:0:7: +%7hu: +65577:1:7:41: +%*7hu: +65577:0:7: diff --git a/stdio-common/tst-scanf-format-ushort-x.input b/stdio-common/tst-scanf-format-ushort-x.input new file mode 100644 index 0000000..117b5c3 --- /dev/null +++ b/stdio-common/tst-scanf-format-ushort-x.input @@ -0,0 +1,714 @@ +%hx::0:-1: +%*hx::0:-1: +%hx:-7b:1:3:65413: +%*hx:-7b:0:3: +%hx:-7B:1:3:65413: +%*hx:-7B:0:3: +%hx:-0X7b:1:5:65413: +%*hx:-0X7b:0:5: +%hx:-0x7B:1:5:65413: +%*hx:-0x7B:0:5: +%hx:-1:1:2:65535: +%*hx:-1:0:2: +%hx:-0X1:1:4:65535: +%*hx:-0X1:0:4: +%hx:-0x1:1:4:65535: +%*hx:-0x1:0:4: +%hx:-0:1:2:0: +%*hx:-0:0:2: +%hx:-0X0:1:4:0: +%*hx:-0X0:0:4: +%hx:-0x0:1:4:0: +%*hx:-0x0:0:4: +%hx:0:1:1:0: +%*hx:0:0:1: +%hx:0X0:1:3:0: +%*hx:0X0:0:3: +%hx:0x0:1:3:0: +%*hx:0x0:0:3: +%hx:1:1:1:1: +%*hx:1:0:1: +%hx:0X1:1:3:1: +%*hx:0X1:0:3: +%hx:0x1:1:3:1: +%*hx:0x1:0:3: +%hx:2a:1:2:42: +%*hx:2a:0:2: +%hx:2A:1:2:42: +%*hx:2A:0:2: +%hx:0X2a:1:4:42: +%*hx:0X2a:0:4: +%hx:0x2A:1:4:42: +%*hx:0x2A:0:4: +%hx:ffff:1:4:65535: +%*hx:ffff:0:4: +%hx:FFFF:1:4:65535: +%*hx:FFFF:0:4: +%hx:0Xffff:1:6:65535: +%*hx:0Xffff:0:6: +%hx:0xFFFF:1:6:65535: +%*hx:0xFFFF:0:6: +%hx:10000:1:5:0: +%*hx:10000:0:5: +%hx:0X10000:1:7:0: +%*hx:0X10000:0:7: +%hx:0x10000:1:7:0: +%*hx:0x10000:0:7: +%hx:10029:1:5:41: +%*hx:10029:0:5: +%hx:0X10029:1:7:41: +%*hx:0X10029:0:7: +%hx:0x10029:1:7:41: +%*hx:0x10029:0:7: +%hx:+0:1:2:0: +%*hx:+0:0:2: +%hx:+0X0:1:4:0: +%*hx:+0X0:0:4: +%hx:+0x0:1:4:0: +%*hx:+0x0:0:4: +%hx:+1:1:2:1: +%*hx:+1:0:2: +%hx:+0X1:1:4:1: +%*hx:+0X1:0:4: +%hx:+0x1:1:4:1: +%*hx:+0x1:0:4: +%hx:+2a:1:3:42: +%*hx:+2a:0:3: +%hx:+2A:1:3:42: +%*hx:+2A:0:3: +%hx:+0X2a:1:5:42: +%*hx:+0X2a:0:5: +%hx:+0x2A:1:5:42: +%*hx:+0x2A:0:5: +%hx:+ffff:1:5:65535: +%*hx:+ffff:0:5: +%hx:+FFFF:1:5:65535: +%*hx:+FFFF:0:5: +%hx:+0Xffff:1:7:65535: +%*hx:+0Xffff:0:7: +%hx:+0xFFFF:1:7:65535: +%*hx:+0xFFFF:0:7: +%hx:+10000:1:6:0: +%*hx:+10000:0:6: +%hx:+0X10000:1:8:0: +%*hx:+0X10000:0:8: +%hx:+0x10000:1:8:0: +%*hx:+0x10000:0:8: +%hx:+10029:1:6:41: +%*hx:+10029:0:6: +%hx:+0X10029:1:8:41: +%*hx:+0X10029:0:8: +%hx:+0x10029:1:8:41: +%*hx:+0x10029:0:8: +%1hx::0:-1: +%*1hx::0:-1: +%1hx:-7b:0:-1: +%*1hx:-7b:0:-1: +%1hx:-7B:0:-1: +%*1hx:-7B:0:-1: +%1hx:-0X7b:0:-1: +%*1hx:-0X7b:0:-1: +%1hx:-0x7B:0:-1: +%*1hx:-0x7B:0:-1: +%1hx:-1:0:-1: +%*1hx:-1:0:-1: +%1hx:-0X1:0:-1: +%*1hx:-0X1:0:-1: +%1hx:-0x1:0:-1: +%*1hx:-0x1:0:-1: +%1hx:-0:0:-1: +%*1hx:-0:0:-1: +%1hx:-0X0:0:-1: +%*1hx:-0X0:0:-1: +%1hx:-0x0:0:-1: +%*1hx:-0x0:0:-1: +%1hx:0:1:1:0: +%*1hx:0:0:1: +%1hx:0X0:1:1:0: +%*1hx:0X0:0:1: +%1hx:0x0:1:1:0: +%*1hx:0x0:0:1: +%1hx:1:1:1:1: +%*1hx:1:0:1: +%1hx:0X1:1:1:0: +%*1hx:0X1:0:1: +%1hx:0x1:1:1:0: +%*1hx:0x1:0:1: +%1hx:2a:1:1:2: +%*1hx:2a:0:1: +%1hx:2A:1:1:2: +%*1hx:2A:0:1: +%1hx:0X2a:1:1:0: +%*1hx:0X2a:0:1: +%1hx:0x2A:1:1:0: +%*1hx:0x2A:0:1: +%1hx:ffff:1:1:15: +%*1hx:ffff:0:1: +%1hx:FFFF:1:1:15: +%*1hx:FFFF:0:1: +%1hx:0Xffff:1:1:0: +%*1hx:0Xffff:0:1: +%1hx:0xFFFF:1:1:0: +%*1hx:0xFFFF:0:1: +%1hx:10000:1:1:1: +%*1hx:10000:0:1: +%1hx:0X10000:1:1:0: +%*1hx:0X10000:0:1: +%1hx:0x10000:1:1:0: +%*1hx:0x10000:0:1: +%1hx:10029:1:1:1: +%*1hx:10029:0:1: +%1hx:0X10029:1:1:0: +%*1hx:0X10029:0:1: +%1hx:0x10029:1:1:0: +%*1hx:0x10029:0:1: +%1hx:+0:0:-1: +%*1hx:+0:0:-1: +%1hx:+0X0:0:-1: +%*1hx:+0X0:0:-1: +%1hx:+0x0:0:-1: +%*1hx:+0x0:0:-1: +%1hx:+1:0:-1: +%*1hx:+1:0:-1: +%1hx:+0X1:0:-1: +%*1hx:+0X1:0:-1: +%1hx:+0x1:0:-1: +%*1hx:+0x1:0:-1: +%1hx:+2a:0:-1: +%*1hx:+2a:0:-1: +%1hx:+2A:0:-1: +%*1hx:+2A:0:-1: +%1hx:+0X2a:0:-1: +%*1hx:+0X2a:0:-1: +%1hx:+0x2A:0:-1: +%*1hx:+0x2A:0:-1: +%1hx:+ffff:0:-1: +%*1hx:+ffff:0:-1: +%1hx:+FFFF:0:-1: +%*1hx:+FFFF:0:-1: +%1hx:+0Xffff:0:-1: +%*1hx:+0Xffff:0:-1: +%1hx:+0xFFFF:0:-1: +%*1hx:+0xFFFF:0:-1: +%1hx:+10000:0:-1: +%*1hx:+10000:0:-1: +%1hx:+0X10000:0:-1: +%*1hx:+0X10000:0:-1: +%1hx:+0x10000:0:-1: +%*1hx:+0x10000:0:-1: +%1hx:+10029:0:-1: +%*1hx:+10029:0:-1: +%1hx:+0X10029:0:-1: +%*1hx:+0X10029:0:-1: +%1hx:+0x10029:0:-1: +%*1hx:+0x10029:0:-1: +%2hx::0:-1: +%*2hx::0:-1: +%2hx:-7b:1:2:65529: +%*2hx:-7b:0:2: +%2hx:-7B:1:2:65529: +%*2hx:-7B:0:2: +%2hx:-0X7b:1:2:0: +%*2hx:-0X7b:0:2: +%2hx:-0x7B:1:2:0: +%*2hx:-0x7B:0:2: +%2hx:-1:1:2:65535: +%*2hx:-1:0:2: +%2hx:-0X1:1:2:0: +%*2hx:-0X1:0:2: +%2hx:-0x1:1:2:0: +%*2hx:-0x1:0:2: +%2hx:-0:1:2:0: +%*2hx:-0:0:2: +%2hx:-0X0:1:2:0: +%*2hx:-0X0:0:2: +%2hx:-0x0:1:2:0: +%*2hx:-0x0:0:2: +%2hx:0:1:1:0: +%*2hx:0:0:1: +%2hx:0X0:0:-1: +%*2hx:0X0:0:-1: +%2hx:0x0:0:-1: +%*2hx:0x0:0:-1: +%2hx:1:1:1:1: +%*2hx:1:0:1: +%2hx:0X1:0:-1: +%*2hx:0X1:0:-1: +%2hx:0x1:0:-1: +%*2hx:0x1:0:-1: +%2hx:2a:1:2:42: +%*2hx:2a:0:2: +%2hx:2A:1:2:42: +%*2hx:2A:0:2: +%2hx:0X2a:0:-1: +%*2hx:0X2a:0:-1: +%2hx:0x2A:0:-1: +%*2hx:0x2A:0:-1: +%2hx:ffff:1:2:255: +%*2hx:ffff:0:2: +%2hx:FFFF:1:2:255: +%*2hx:FFFF:0:2: +%2hx:0Xffff:0:-1: +%*2hx:0Xffff:0:-1: +%2hx:0xFFFF:0:-1: +%*2hx:0xFFFF:0:-1: +%2hx:10000:1:2:16: +%*2hx:10000:0:2: +%2hx:0X10000:0:-1: +%*2hx:0X10000:0:-1: +%2hx:0x10000:0:-1: +%*2hx:0x10000:0:-1: +%2hx:10029:1:2:16: +%*2hx:10029:0:2: +%2hx:0X10029:0:-1: +%*2hx:0X10029:0:-1: +%2hx:0x10029:0:-1: +%*2hx:0x10029:0:-1: +%2hx:+0:1:2:0: +%*2hx:+0:0:2: +%2hx:+0X0:1:2:0: +%*2hx:+0X0:0:2: +%2hx:+0x0:1:2:0: +%*2hx:+0x0:0:2: +%2hx:+1:1:2:1: +%*2hx:+1:0:2: +%2hx:+0X1:1:2:0: +%*2hx:+0X1:0:2: +%2hx:+0x1:1:2:0: +%*2hx:+0x1:0:2: +%2hx:+2a:1:2:2: +%*2hx:+2a:0:2: +%2hx:+2A:1:2:2: +%*2hx:+2A:0:2: +%2hx:+0X2a:1:2:0: +%*2hx:+0X2a:0:2: +%2hx:+0x2A:1:2:0: +%*2hx:+0x2A:0:2: +%2hx:+ffff:1:2:15: +%*2hx:+ffff:0:2: +%2hx:+FFFF:1:2:15: +%*2hx:+FFFF:0:2: +%2hx:+0Xffff:1:2:0: +%*2hx:+0Xffff:0:2: +%2hx:+0xFFFF:1:2:0: +%*2hx:+0xFFFF:0:2: +%2hx:+10000:1:2:1: +%*2hx:+10000:0:2: +%2hx:+0X10000:1:2:0: +%*2hx:+0X10000:0:2: +%2hx:+0x10000:1:2:0: +%*2hx:+0x10000:0:2: +%2hx:+10029:1:2:1: +%*2hx:+10029:0:2: +%2hx:+0X10029:1:2:0: +%*2hx:+0X10029:0:2: +%2hx:+0x10029:1:2:0: +%*2hx:+0x10029:0:2: +%4hx::0:-1: +%*4hx::0:-1: +%4hx:-7b:1:3:65413: +%*4hx:-7b:0:3: +%4hx:-7B:1:3:65413: +%*4hx:-7B:0:3: +%4hx:-0X7b:1:4:65529: +%*4hx:-0X7b:0:4: +%4hx:-0x7B:1:4:65529: +%*4hx:-0x7B:0:4: +%4hx:-1:1:2:65535: +%*4hx:-1:0:2: +%4hx:-0X1:1:4:65535: +%*4hx:-0X1:0:4: +%4hx:-0x1:1:4:65535: +%*4hx:-0x1:0:4: +%4hx:-0:1:2:0: +%*4hx:-0:0:2: +%4hx:-0X0:1:4:0: +%*4hx:-0X0:0:4: +%4hx:-0x0:1:4:0: +%*4hx:-0x0:0:4: +%4hx:0:1:1:0: +%*4hx:0:0:1: +%4hx:0X0:1:3:0: +%*4hx:0X0:0:3: +%4hx:0x0:1:3:0: +%*4hx:0x0:0:3: +%4hx:1:1:1:1: +%*4hx:1:0:1: +%4hx:0X1:1:3:1: +%*4hx:0X1:0:3: +%4hx:0x1:1:3:1: +%*4hx:0x1:0:3: +%4hx:2a:1:2:42: +%*4hx:2a:0:2: +%4hx:2A:1:2:42: +%*4hx:2A:0:2: +%4hx:0X2a:1:4:42: +%*4hx:0X2a:0:4: +%4hx:0x2A:1:4:42: +%*4hx:0x2A:0:4: +%4hx:ffff:1:4:65535: +%*4hx:ffff:0:4: +%4hx:FFFF:1:4:65535: +%*4hx:FFFF:0:4: +%4hx:0Xffff:1:4:255: +%*4hx:0Xffff:0:4: +%4hx:0xFFFF:1:4:255: +%*4hx:0xFFFF:0:4: +%4hx:10000:1:4:4096: +%*4hx:10000:0:4: +%4hx:0X10000:1:4:16: +%*4hx:0X10000:0:4: +%4hx:0x10000:1:4:16: +%*4hx:0x10000:0:4: +%4hx:10029:1:4:4098: +%*4hx:10029:0:4: +%4hx:0X10029:1:4:16: +%*4hx:0X10029:0:4: +%4hx:0x10029:1:4:16: +%*4hx:0x10029:0:4: +%4hx:+0:1:2:0: +%*4hx:+0:0:2: +%4hx:+0X0:1:4:0: +%*4hx:+0X0:0:4: +%4hx:+0x0:1:4:0: +%*4hx:+0x0:0:4: +%4hx:+1:1:2:1: +%*4hx:+1:0:2: +%4hx:+0X1:1:4:1: +%*4hx:+0X1:0:4: +%4hx:+0x1:1:4:1: +%*4hx:+0x1:0:4: +%4hx:+2a:1:3:42: +%*4hx:+2a:0:3: +%4hx:+2A:1:3:42: +%*4hx:+2A:0:3: +%4hx:+0X2a:1:4:2: +%*4hx:+0X2a:0:4: +%4hx:+0x2A:1:4:2: +%*4hx:+0x2A:0:4: +%4hx:+ffff:1:4:4095: +%*4hx:+ffff:0:4: +%4hx:+FFFF:1:4:4095: +%*4hx:+FFFF:0:4: +%4hx:+0Xffff:1:4:15: +%*4hx:+0Xffff:0:4: +%4hx:+0xFFFF:1:4:15: +%*4hx:+0xFFFF:0:4: +%4hx:+10000:1:4:256: +%*4hx:+10000:0:4: +%4hx:+0X10000:1:4:1: +%*4hx:+0X10000:0:4: +%4hx:+0x10000:1:4:1: +%*4hx:+0x10000:0:4: +%4hx:+10029:1:4:256: +%*4hx:+10029:0:4: +%4hx:+0X10029:1:4:1: +%*4hx:+0X10029:0:4: +%4hx:+0x10029:1:4:1: +%*4hx:+0x10029:0:4: +%7hx::0:-1: +%*7hx::0:-1: +%7hx:-7b:1:3:65413: +%*7hx:-7b:0:3: +%7hx:-7B:1:3:65413: +%*7hx:-7B:0:3: +%7hx:-0X7b:1:5:65413: +%*7hx:-0X7b:0:5: +%7hx:-0x7B:1:5:65413: +%*7hx:-0x7B:0:5: +%7hx:-1:1:2:65535: +%*7hx:-1:0:2: +%7hx:-0X1:1:4:65535: +%*7hx:-0X1:0:4: +%7hx:-0x1:1:4:65535: +%*7hx:-0x1:0:4: +%7hx:-0:1:2:0: +%*7hx:-0:0:2: +%7hx:-0X0:1:4:0: +%*7hx:-0X0:0:4: +%7hx:-0x0:1:4:0: +%*7hx:-0x0:0:4: +%7hx:0:1:1:0: +%*7hx:0:0:1: +%7hx:0X0:1:3:0: +%*7hx:0X0:0:3: +%7hx:0x0:1:3:0: +%*7hx:0x0:0:3: +%7hx:1:1:1:1: +%*7hx:1:0:1: +%7hx:0X1:1:3:1: +%*7hx:0X1:0:3: +%7hx:0x1:1:3:1: +%*7hx:0x1:0:3: +%7hx:2a:1:2:42: +%*7hx:2a:0:2: +%7hx:2A:1:2:42: +%*7hx:2A:0:2: +%7hx:0X2a:1:4:42: +%*7hx:0X2a:0:4: +%7hx:0x2A:1:4:42: +%*7hx:0x2A:0:4: +%7hx:ffff:1:4:65535: +%*7hx:ffff:0:4: +%7hx:FFFF:1:4:65535: +%*7hx:FFFF:0:4: +%7hx:0Xffff:1:6:65535: +%*7hx:0Xffff:0:6: +%7hx:0xFFFF:1:6:65535: +%*7hx:0xFFFF:0:6: +%7hx:10000:1:5:0: +%*7hx:10000:0:5: +%7hx:0X10000:1:7:0: +%*7hx:0X10000:0:7: +%7hx:0x10000:1:7:0: +%*7hx:0x10000:0:7: +%7hx:10029:1:5:41: +%*7hx:10029:0:5: +%7hx:0X10029:1:7:41: +%*7hx:0X10029:0:7: +%7hx:0x10029:1:7:41: +%*7hx:0x10029:0:7: +%7hx:+0:1:2:0: +%*7hx:+0:0:2: +%7hx:+0X0:1:4:0: +%*7hx:+0X0:0:4: +%7hx:+0x0:1:4:0: +%*7hx:+0x0:0:4: +%7hx:+1:1:2:1: +%*7hx:+1:0:2: +%7hx:+0X1:1:4:1: +%*7hx:+0X1:0:4: +%7hx:+0x1:1:4:1: +%*7hx:+0x1:0:4: +%7hx:+2a:1:3:42: +%*7hx:+2a:0:3: +%7hx:+2A:1:3:42: +%*7hx:+2A:0:3: +%7hx:+0X2a:1:5:42: +%*7hx:+0X2a:0:5: +%7hx:+0x2A:1:5:42: +%*7hx:+0x2A:0:5: +%7hx:+ffff:1:5:65535: +%*7hx:+ffff:0:5: +%7hx:+FFFF:1:5:65535: +%*7hx:+FFFF:0:5: +%7hx:+0Xffff:1:7:65535: +%*7hx:+0Xffff:0:7: +%7hx:+0xFFFF:1:7:65535: +%*7hx:+0xFFFF:0:7: +%7hx:+10000:1:6:0: +%*7hx:+10000:0:6: +%7hx:+0X10000:1:7:4096: +%*7hx:+0X10000:0:7: +%7hx:+0x10000:1:7:4096: +%*7hx:+0x10000:0:7: +%7hx:+10029:1:6:41: +%*7hx:+10029:0:6: +%7hx:+0X10029:1:7:4098: +%*7hx:+0X10029:0:7: +%7hx:+0x10029:1:7:4098: +%*7hx:+0x10029:0:7: +%2hx: :0:-1: +%*2hx: :0:-1: +%2hx: -7b:1:3:65529: +%*2hx: -7b:0:3: +%2hx: -7B:1:3:65529: +%*2hx: -7B:0:3: +%2hx: -0X7b:1:3:0: +%*2hx: -0X7b:0:3: +%2hx: -0x7B:1:3:0: +%*2hx: -0x7B:0:3: +%2hx: -1:1:3:65535: +%*2hx: -1:0:3: +%2hx: -0X1:1:3:0: +%*2hx: -0X1:0:3: +%2hx: -0x1:1:3:0: +%*2hx: -0x1:0:3: +%2hx: -0:1:3:0: +%*2hx: -0:0:3: +%2hx: -0X0:1:3:0: +%*2hx: -0X0:0:3: +%2hx: -0x0:1:3:0: +%*2hx: -0x0:0:3: +%2hx: 0:1:2:0: +%*2hx: 0:0:2: +%2hx: 0X0:0:-1: +%*2hx: 0X0:0:-1: +%2hx: 0x0:0:-1: +%*2hx: 0x0:0:-1: +%2hx: 1:1:2:1: +%*2hx: 1:0:2: +%2hx: 0X1:0:-1: +%*2hx: 0X1:0:-1: +%2hx: 0x1:0:-1: +%*2hx: 0x1:0:-1: +%2hx: 2a:1:3:42: +%*2hx: 2a:0:3: +%2hx: 2A:1:3:42: +%*2hx: 2A:0:3: +%2hx: 0X2a:0:-1: +%*2hx: 0X2a:0:-1: +%2hx: 0x2A:0:-1: +%*2hx: 0x2A:0:-1: +%2hx: ffff:1:3:255: +%*2hx: ffff:0:3: +%2hx: FFFF:1:3:255: +%*2hx: FFFF:0:3: +%2hx: 0Xffff:0:-1: +%*2hx: 0Xffff:0:-1: +%2hx: 0xFFFF:0:-1: +%*2hx: 0xFFFF:0:-1: +%2hx: 10000:1:3:16: +%*2hx: 10000:0:3: +%2hx: 0X10000:0:-1: +%*2hx: 0X10000:0:-1: +%2hx: 0x10000:0:-1: +%*2hx: 0x10000:0:-1: +%2hx: 10029:1:3:16: +%*2hx: 10029:0:3: +%2hx: 0X10029:0:-1: +%*2hx: 0X10029:0:-1: +%2hx: 0x10029:0:-1: +%*2hx: 0x10029:0:-1: +%2hx: +0:1:3:0: +%*2hx: +0:0:3: +%2hx: +0X0:1:3:0: +%*2hx: +0X0:0:3: +%2hx: +0x0:1:3:0: +%*2hx: +0x0:0:3: +%2hx: +1:1:3:1: +%*2hx: +1:0:3: +%2hx: +0X1:1:3:0: +%*2hx: +0X1:0:3: +%2hx: +0x1:1:3:0: +%*2hx: +0x1:0:3: +%2hx: +2a:1:3:2: +%*2hx: +2a:0:3: +%2hx: +2A:1:3:2: +%*2hx: +2A:0:3: +%2hx: +0X2a:1:3:0: +%*2hx: +0X2a:0:3: +%2hx: +0x2A:1:3:0: +%*2hx: +0x2A:0:3: +%2hx: +ffff:1:3:15: +%*2hx: +ffff:0:3: +%2hx: +FFFF:1:3:15: +%*2hx: +FFFF:0:3: +%2hx: +0Xffff:1:3:0: +%*2hx: +0Xffff:0:3: +%2hx: +0xFFFF:1:3:0: +%*2hx: +0xFFFF:0:3: +%2hx: +10000:1:3:1: +%*2hx: +10000:0:3: +%2hx: +0X10000:1:3:0: +%*2hx: +0X10000:0:3: +%2hx: +0x10000:1:3:0: +%*2hx: +0x10000:0:3: +%2hx: +10029:1:3:1: +%*2hx: +10029:0:3: +%2hx: +0X10029:1:3:0: +%*2hx: +0X10029:0:3: +%2hx: +0x10029:1:3:0: +%*2hx: +0x10029:0:3: +%7hx: :0:-1: +%*7hx: :0:-1: +%7hx: -7b:1:4:65413: +%*7hx: -7b:0:4: +%7hx: -7B:1:4:65413: +%*7hx: -7B:0:4: +%7hx: -0X7b:1:6:65413: +%*7hx: -0X7b:0:6: +%7hx: -0x7B:1:6:65413: +%*7hx: -0x7B:0:6: +%7hx: -1:1:3:65535: +%*7hx: -1:0:3: +%7hx: -0X1:1:5:65535: +%*7hx: -0X1:0:5: +%7hx: -0x1:1:5:65535: +%*7hx: -0x1:0:5: +%7hx: -0:1:3:0: +%*7hx: -0:0:3: +%7hx: -0X0:1:5:0: +%*7hx: -0X0:0:5: +%7hx: -0x0:1:5:0: +%*7hx: -0x0:0:5: +%7hx: 0:1:2:0: +%*7hx: 0:0:2: +%7hx: 0X0:1:4:0: +%*7hx: 0X0:0:4: +%7hx: 0x0:1:4:0: +%*7hx: 0x0:0:4: +%7hx: 1:1:2:1: +%*7hx: 1:0:2: +%7hx: 0X1:1:4:1: +%*7hx: 0X1:0:4: +%7hx: 0x1:1:4:1: +%*7hx: 0x1:0:4: +%7hx: 2a:1:3:42: +%*7hx: 2a:0:3: +%7hx: 2A:1:3:42: +%*7hx: 2A:0:3: +%7hx: 0X2a:1:5:42: +%*7hx: 0X2a:0:5: +%7hx: 0x2A:1:5:42: +%*7hx: 0x2A:0:5: +%7hx: ffff:1:5:65535: +%*7hx: ffff:0:5: +%7hx: FFFF:1:5:65535: +%*7hx: FFFF:0:5: +%7hx: 0Xffff:1:7:65535: +%*7hx: 0Xffff:0:7: +%7hx: 0xFFFF:1:7:65535: +%*7hx: 0xFFFF:0:7: +%7hx: 10000:1:6:0: +%*7hx: 10000:0:6: +%7hx: 0X10000:1:8:0: +%*7hx: 0X10000:0:8: +%7hx: 0x10000:1:8:0: +%*7hx: 0x10000:0:8: +%7hx: 10029:1:6:41: +%*7hx: 10029:0:6: +%7hx: 0X10029:1:8:41: +%*7hx: 0X10029:0:8: +%7hx: 0x10029:1:8:41: +%*7hx: 0x10029:0:8: +%7hx: +0:1:3:0: +%*7hx: +0:0:3: +%7hx: +0X0:1:5:0: +%*7hx: +0X0:0:5: +%7hx: +0x0:1:5:0: +%*7hx: +0x0:0:5: +%7hx: +1:1:3:1: +%*7hx: +1:0:3: +%7hx: +0X1:1:5:1: +%*7hx: +0X1:0:5: +%7hx: +0x1:1:5:1: +%*7hx: +0x1:0:5: +%7hx: +2a:1:4:42: +%*7hx: +2a:0:4: +%7hx: +2A:1:4:42: +%*7hx: +2A:0:4: +%7hx: +0X2a:1:6:42: +%*7hx: +0X2a:0:6: +%7hx: +0x2A:1:6:42: +%*7hx: +0x2A:0:6: +%7hx: +ffff:1:6:65535: +%*7hx: +ffff:0:6: +%7hx: +FFFF:1:6:65535: +%*7hx: +FFFF:0:6: +%7hx: +0Xffff:1:8:65535: +%*7hx: +0Xffff:0:8: +%7hx: +0xFFFF:1:8:65535: +%*7hx: +0xFFFF:0:8: +%7hx: +10000:1:7:0: +%*7hx: +10000:0:7: +%7hx: +0X10000:1:8:4096: +%*7hx: +0X10000:0:8: +%7hx: +0x10000:1:8:4096: +%*7hx: +0x10000:0:8: +%7hx: +10029:1:7:41: +%*7hx: +10029:0:7: +%7hx: +0X10029:1:8:4098: +%*7hx: +0X10029:0:8: +%7hx: +0x10029:1:8:4098: +%*7hx: +0x10029:0:8: diff --git a/stdio-common/tst-scanf-format-ushort-xx.input b/stdio-common/tst-scanf-format-ushort-xx.input new file mode 100644 index 0000000..fca910a --- /dev/null +++ b/stdio-common/tst-scanf-format-ushort-xx.input @@ -0,0 +1,714 @@ +%hX::0:-1: +%*hX::0:-1: +%hX:-7b:1:3:65413: +%*hX:-7b:0:3: +%hX:-7B:1:3:65413: +%*hX:-7B:0:3: +%hX:-0X7b:1:5:65413: +%*hX:-0X7b:0:5: +%hX:-0x7B:1:5:65413: +%*hX:-0x7B:0:5: +%hX:-1:1:2:65535: +%*hX:-1:0:2: +%hX:-0X1:1:4:65535: +%*hX:-0X1:0:4: +%hX:-0x1:1:4:65535: +%*hX:-0x1:0:4: +%hX:-0:1:2:0: +%*hX:-0:0:2: +%hX:-0X0:1:4:0: +%*hX:-0X0:0:4: +%hX:-0x0:1:4:0: +%*hX:-0x0:0:4: +%hX:0:1:1:0: +%*hX:0:0:1: +%hX:0X0:1:3:0: +%*hX:0X0:0:3: +%hX:0x0:1:3:0: +%*hX:0x0:0:3: +%hX:1:1:1:1: +%*hX:1:0:1: +%hX:0X1:1:3:1: +%*hX:0X1:0:3: +%hX:0x1:1:3:1: +%*hX:0x1:0:3: +%hX:2a:1:2:42: +%*hX:2a:0:2: +%hX:2A:1:2:42: +%*hX:2A:0:2: +%hX:0X2a:1:4:42: +%*hX:0X2a:0:4: +%hX:0x2A:1:4:42: +%*hX:0x2A:0:4: +%hX:ffff:1:4:65535: +%*hX:ffff:0:4: +%hX:FFFF:1:4:65535: +%*hX:FFFF:0:4: +%hX:0Xffff:1:6:65535: +%*hX:0Xffff:0:6: +%hX:0xFFFF:1:6:65535: +%*hX:0xFFFF:0:6: +%hX:10000:1:5:0: +%*hX:10000:0:5: +%hX:0X10000:1:7:0: +%*hX:0X10000:0:7: +%hX:0x10000:1:7:0: +%*hX:0x10000:0:7: +%hX:10029:1:5:41: +%*hX:10029:0:5: +%hX:0X10029:1:7:41: +%*hX:0X10029:0:7: +%hX:0x10029:1:7:41: +%*hX:0x10029:0:7: +%hX:+0:1:2:0: +%*hX:+0:0:2: +%hX:+0X0:1:4:0: +%*hX:+0X0:0:4: +%hX:+0x0:1:4:0: +%*hX:+0x0:0:4: +%hX:+1:1:2:1: +%*hX:+1:0:2: +%hX:+0X1:1:4:1: +%*hX:+0X1:0:4: +%hX:+0x1:1:4:1: +%*hX:+0x1:0:4: +%hX:+2a:1:3:42: +%*hX:+2a:0:3: +%hX:+2A:1:3:42: +%*hX:+2A:0:3: +%hX:+0X2a:1:5:42: +%*hX:+0X2a:0:5: +%hX:+0x2A:1:5:42: +%*hX:+0x2A:0:5: +%hX:+ffff:1:5:65535: +%*hX:+ffff:0:5: +%hX:+FFFF:1:5:65535: +%*hX:+FFFF:0:5: +%hX:+0Xffff:1:7:65535: +%*hX:+0Xffff:0:7: +%hX:+0xFFFF:1:7:65535: +%*hX:+0xFFFF:0:7: +%hX:+10000:1:6:0: +%*hX:+10000:0:6: +%hX:+0X10000:1:8:0: +%*hX:+0X10000:0:8: +%hX:+0x10000:1:8:0: +%*hX:+0x10000:0:8: +%hX:+10029:1:6:41: +%*hX:+10029:0:6: +%hX:+0X10029:1:8:41: +%*hX:+0X10029:0:8: +%hX:+0x10029:1:8:41: +%*hX:+0x10029:0:8: +%1hX::0:-1: +%*1hX::0:-1: +%1hX:-7b:0:-1: +%*1hX:-7b:0:-1: +%1hX:-7B:0:-1: +%*1hX:-7B:0:-1: +%1hX:-0X7b:0:-1: +%*1hX:-0X7b:0:-1: +%1hX:-0x7B:0:-1: +%*1hX:-0x7B:0:-1: +%1hX:-1:0:-1: +%*1hX:-1:0:-1: +%1hX:-0X1:0:-1: +%*1hX:-0X1:0:-1: +%1hX:-0x1:0:-1: +%*1hX:-0x1:0:-1: +%1hX:-0:0:-1: +%*1hX:-0:0:-1: +%1hX:-0X0:0:-1: +%*1hX:-0X0:0:-1: +%1hX:-0x0:0:-1: +%*1hX:-0x0:0:-1: +%1hX:0:1:1:0: +%*1hX:0:0:1: +%1hX:0X0:1:1:0: +%*1hX:0X0:0:1: +%1hX:0x0:1:1:0: +%*1hX:0x0:0:1: +%1hX:1:1:1:1: +%*1hX:1:0:1: +%1hX:0X1:1:1:0: +%*1hX:0X1:0:1: +%1hX:0x1:1:1:0: +%*1hX:0x1:0:1: +%1hX:2a:1:1:2: +%*1hX:2a:0:1: +%1hX:2A:1:1:2: +%*1hX:2A:0:1: +%1hX:0X2a:1:1:0: +%*1hX:0X2a:0:1: +%1hX:0x2A:1:1:0: +%*1hX:0x2A:0:1: +%1hX:ffff:1:1:15: +%*1hX:ffff:0:1: +%1hX:FFFF:1:1:15: +%*1hX:FFFF:0:1: +%1hX:0Xffff:1:1:0: +%*1hX:0Xffff:0:1: +%1hX:0xFFFF:1:1:0: +%*1hX:0xFFFF:0:1: +%1hX:10000:1:1:1: +%*1hX:10000:0:1: +%1hX:0X10000:1:1:0: +%*1hX:0X10000:0:1: +%1hX:0x10000:1:1:0: +%*1hX:0x10000:0:1: +%1hX:10029:1:1:1: +%*1hX:10029:0:1: +%1hX:0X10029:1:1:0: +%*1hX:0X10029:0:1: +%1hX:0x10029:1:1:0: +%*1hX:0x10029:0:1: +%1hX:+0:0:-1: +%*1hX:+0:0:-1: +%1hX:+0X0:0:-1: +%*1hX:+0X0:0:-1: +%1hX:+0x0:0:-1: +%*1hX:+0x0:0:-1: +%1hX:+1:0:-1: +%*1hX:+1:0:-1: +%1hX:+0X1:0:-1: +%*1hX:+0X1:0:-1: +%1hX:+0x1:0:-1: +%*1hX:+0x1:0:-1: +%1hX:+2a:0:-1: +%*1hX:+2a:0:-1: +%1hX:+2A:0:-1: +%*1hX:+2A:0:-1: +%1hX:+0X2a:0:-1: +%*1hX:+0X2a:0:-1: +%1hX:+0x2A:0:-1: +%*1hX:+0x2A:0:-1: +%1hX:+ffff:0:-1: +%*1hX:+ffff:0:-1: +%1hX:+FFFF:0:-1: +%*1hX:+FFFF:0:-1: +%1hX:+0Xffff:0:-1: +%*1hX:+0Xffff:0:-1: +%1hX:+0xFFFF:0:-1: +%*1hX:+0xFFFF:0:-1: +%1hX:+10000:0:-1: +%*1hX:+10000:0:-1: +%1hX:+0X10000:0:-1: +%*1hX:+0X10000:0:-1: +%1hX:+0x10000:0:-1: +%*1hX:+0x10000:0:-1: +%1hX:+10029:0:-1: +%*1hX:+10029:0:-1: +%1hX:+0X10029:0:-1: +%*1hX:+0X10029:0:-1: +%1hX:+0x10029:0:-1: +%*1hX:+0x10029:0:-1: +%2hX::0:-1: +%*2hX::0:-1: +%2hX:-7b:1:2:65529: +%*2hX:-7b:0:2: +%2hX:-7B:1:2:65529: +%*2hX:-7B:0:2: +%2hX:-0X7b:1:2:0: +%*2hX:-0X7b:0:2: +%2hX:-0x7B:1:2:0: +%*2hX:-0x7B:0:2: +%2hX:-1:1:2:65535: +%*2hX:-1:0:2: +%2hX:-0X1:1:2:0: +%*2hX:-0X1:0:2: +%2hX:-0x1:1:2:0: +%*2hX:-0x1:0:2: +%2hX:-0:1:2:0: +%*2hX:-0:0:2: +%2hX:-0X0:1:2:0: +%*2hX:-0X0:0:2: +%2hX:-0x0:1:2:0: +%*2hX:-0x0:0:2: +%2hX:0:1:1:0: +%*2hX:0:0:1: +%2hX:0X0:0:-1: +%*2hX:0X0:0:-1: +%2hX:0x0:0:-1: +%*2hX:0x0:0:-1: +%2hX:1:1:1:1: +%*2hX:1:0:1: +%2hX:0X1:0:-1: +%*2hX:0X1:0:-1: +%2hX:0x1:0:-1: +%*2hX:0x1:0:-1: +%2hX:2a:1:2:42: +%*2hX:2a:0:2: +%2hX:2A:1:2:42: +%*2hX:2A:0:2: +%2hX:0X2a:0:-1: +%*2hX:0X2a:0:-1: +%2hX:0x2A:0:-1: +%*2hX:0x2A:0:-1: +%2hX:ffff:1:2:255: +%*2hX:ffff:0:2: +%2hX:FFFF:1:2:255: +%*2hX:FFFF:0:2: +%2hX:0Xffff:0:-1: +%*2hX:0Xffff:0:-1: +%2hX:0xFFFF:0:-1: +%*2hX:0xFFFF:0:-1: +%2hX:10000:1:2:16: +%*2hX:10000:0:2: +%2hX:0X10000:0:-1: +%*2hX:0X10000:0:-1: +%2hX:0x10000:0:-1: +%*2hX:0x10000:0:-1: +%2hX:10029:1:2:16: +%*2hX:10029:0:2: +%2hX:0X10029:0:-1: +%*2hX:0X10029:0:-1: +%2hX:0x10029:0:-1: +%*2hX:0x10029:0:-1: +%2hX:+0:1:2:0: +%*2hX:+0:0:2: +%2hX:+0X0:1:2:0: +%*2hX:+0X0:0:2: +%2hX:+0x0:1:2:0: +%*2hX:+0x0:0:2: +%2hX:+1:1:2:1: +%*2hX:+1:0:2: +%2hX:+0X1:1:2:0: +%*2hX:+0X1:0:2: +%2hX:+0x1:1:2:0: +%*2hX:+0x1:0:2: +%2hX:+2a:1:2:2: +%*2hX:+2a:0:2: +%2hX:+2A:1:2:2: +%*2hX:+2A:0:2: +%2hX:+0X2a:1:2:0: +%*2hX:+0X2a:0:2: +%2hX:+0x2A:1:2:0: +%*2hX:+0x2A:0:2: +%2hX:+ffff:1:2:15: +%*2hX:+ffff:0:2: +%2hX:+FFFF:1:2:15: +%*2hX:+FFFF:0:2: +%2hX:+0Xffff:1:2:0: +%*2hX:+0Xffff:0:2: +%2hX:+0xFFFF:1:2:0: +%*2hX:+0xFFFF:0:2: +%2hX:+10000:1:2:1: +%*2hX:+10000:0:2: +%2hX:+0X10000:1:2:0: +%*2hX:+0X10000:0:2: +%2hX:+0x10000:1:2:0: +%*2hX:+0x10000:0:2: +%2hX:+10029:1:2:1: +%*2hX:+10029:0:2: +%2hX:+0X10029:1:2:0: +%*2hX:+0X10029:0:2: +%2hX:+0x10029:1:2:0: +%*2hX:+0x10029:0:2: +%4hX::0:-1: +%*4hX::0:-1: +%4hX:-7b:1:3:65413: +%*4hX:-7b:0:3: +%4hX:-7B:1:3:65413: +%*4hX:-7B:0:3: +%4hX:-0X7b:1:4:65529: +%*4hX:-0X7b:0:4: +%4hX:-0x7B:1:4:65529: +%*4hX:-0x7B:0:4: +%4hX:-1:1:2:65535: +%*4hX:-1:0:2: +%4hX:-0X1:1:4:65535: +%*4hX:-0X1:0:4: +%4hX:-0x1:1:4:65535: +%*4hX:-0x1:0:4: +%4hX:-0:1:2:0: +%*4hX:-0:0:2: +%4hX:-0X0:1:4:0: +%*4hX:-0X0:0:4: +%4hX:-0x0:1:4:0: +%*4hX:-0x0:0:4: +%4hX:0:1:1:0: +%*4hX:0:0:1: +%4hX:0X0:1:3:0: +%*4hX:0X0:0:3: +%4hX:0x0:1:3:0: +%*4hX:0x0:0:3: +%4hX:1:1:1:1: +%*4hX:1:0:1: +%4hX:0X1:1:3:1: +%*4hX:0X1:0:3: +%4hX:0x1:1:3:1: +%*4hX:0x1:0:3: +%4hX:2a:1:2:42: +%*4hX:2a:0:2: +%4hX:2A:1:2:42: +%*4hX:2A:0:2: +%4hX:0X2a:1:4:42: +%*4hX:0X2a:0:4: +%4hX:0x2A:1:4:42: +%*4hX:0x2A:0:4: +%4hX:ffff:1:4:65535: +%*4hX:ffff:0:4: +%4hX:FFFF:1:4:65535: +%*4hX:FFFF:0:4: +%4hX:0Xffff:1:4:255: +%*4hX:0Xffff:0:4: +%4hX:0xFFFF:1:4:255: +%*4hX:0xFFFF:0:4: +%4hX:10000:1:4:4096: +%*4hX:10000:0:4: +%4hX:0X10000:1:4:16: +%*4hX:0X10000:0:4: +%4hX:0x10000:1:4:16: +%*4hX:0x10000:0:4: +%4hX:10029:1:4:4098: +%*4hX:10029:0:4: +%4hX:0X10029:1:4:16: +%*4hX:0X10029:0:4: +%4hX:0x10029:1:4:16: +%*4hX:0x10029:0:4: +%4hX:+0:1:2:0: +%*4hX:+0:0:2: +%4hX:+0X0:1:4:0: +%*4hX:+0X0:0:4: +%4hX:+0x0:1:4:0: +%*4hX:+0x0:0:4: +%4hX:+1:1:2:1: +%*4hX:+1:0:2: +%4hX:+0X1:1:4:1: +%*4hX:+0X1:0:4: +%4hX:+0x1:1:4:1: +%*4hX:+0x1:0:4: +%4hX:+2a:1:3:42: +%*4hX:+2a:0:3: +%4hX:+2A:1:3:42: +%*4hX:+2A:0:3: +%4hX:+0X2a:1:4:2: +%*4hX:+0X2a:0:4: +%4hX:+0x2A:1:4:2: +%*4hX:+0x2A:0:4: +%4hX:+ffff:1:4:4095: +%*4hX:+ffff:0:4: +%4hX:+FFFF:1:4:4095: +%*4hX:+FFFF:0:4: +%4hX:+0Xffff:1:4:15: +%*4hX:+0Xffff:0:4: +%4hX:+0xFFFF:1:4:15: +%*4hX:+0xFFFF:0:4: +%4hX:+10000:1:4:256: +%*4hX:+10000:0:4: +%4hX:+0X10000:1:4:1: +%*4hX:+0X10000:0:4: +%4hX:+0x10000:1:4:1: +%*4hX:+0x10000:0:4: +%4hX:+10029:1:4:256: +%*4hX:+10029:0:4: +%4hX:+0X10029:1:4:1: +%*4hX:+0X10029:0:4: +%4hX:+0x10029:1:4:1: +%*4hX:+0x10029:0:4: +%7hX::0:-1: +%*7hX::0:-1: +%7hX:-7b:1:3:65413: +%*7hX:-7b:0:3: +%7hX:-7B:1:3:65413: +%*7hX:-7B:0:3: +%7hX:-0X7b:1:5:65413: +%*7hX:-0X7b:0:5: +%7hX:-0x7B:1:5:65413: +%*7hX:-0x7B:0:5: +%7hX:-1:1:2:65535: +%*7hX:-1:0:2: +%7hX:-0X1:1:4:65535: +%*7hX:-0X1:0:4: +%7hX:-0x1:1:4:65535: +%*7hX:-0x1:0:4: +%7hX:-0:1:2:0: +%*7hX:-0:0:2: +%7hX:-0X0:1:4:0: +%*7hX:-0X0:0:4: +%7hX:-0x0:1:4:0: +%*7hX:-0x0:0:4: +%7hX:0:1:1:0: +%*7hX:0:0:1: +%7hX:0X0:1:3:0: +%*7hX:0X0:0:3: +%7hX:0x0:1:3:0: +%*7hX:0x0:0:3: +%7hX:1:1:1:1: +%*7hX:1:0:1: +%7hX:0X1:1:3:1: +%*7hX:0X1:0:3: +%7hX:0x1:1:3:1: +%*7hX:0x1:0:3: +%7hX:2a:1:2:42: +%*7hX:2a:0:2: +%7hX:2A:1:2:42: +%*7hX:2A:0:2: +%7hX:0X2a:1:4:42: +%*7hX:0X2a:0:4: +%7hX:0x2A:1:4:42: +%*7hX:0x2A:0:4: +%7hX:ffff:1:4:65535: +%*7hX:ffff:0:4: +%7hX:FFFF:1:4:65535: +%*7hX:FFFF:0:4: +%7hX:0Xffff:1:6:65535: +%*7hX:0Xffff:0:6: +%7hX:0xFFFF:1:6:65535: +%*7hX:0xFFFF:0:6: +%7hX:10000:1:5:0: +%*7hX:10000:0:5: +%7hX:0X10000:1:7:0: +%*7hX:0X10000:0:7: +%7hX:0x10000:1:7:0: +%*7hX:0x10000:0:7: +%7hX:10029:1:5:41: +%*7hX:10029:0:5: +%7hX:0X10029:1:7:41: +%*7hX:0X10029:0:7: +%7hX:0x10029:1:7:41: +%*7hX:0x10029:0:7: +%7hX:+0:1:2:0: +%*7hX:+0:0:2: +%7hX:+0X0:1:4:0: +%*7hX:+0X0:0:4: +%7hX:+0x0:1:4:0: +%*7hX:+0x0:0:4: +%7hX:+1:1:2:1: +%*7hX:+1:0:2: +%7hX:+0X1:1:4:1: +%*7hX:+0X1:0:4: +%7hX:+0x1:1:4:1: +%*7hX:+0x1:0:4: +%7hX:+2a:1:3:42: +%*7hX:+2a:0:3: +%7hX:+2A:1:3:42: +%*7hX:+2A:0:3: +%7hX:+0X2a:1:5:42: +%*7hX:+0X2a:0:5: +%7hX:+0x2A:1:5:42: +%*7hX:+0x2A:0:5: +%7hX:+ffff:1:5:65535: +%*7hX:+ffff:0:5: +%7hX:+FFFF:1:5:65535: +%*7hX:+FFFF:0:5: +%7hX:+0Xffff:1:7:65535: +%*7hX:+0Xffff:0:7: +%7hX:+0xFFFF:1:7:65535: +%*7hX:+0xFFFF:0:7: +%7hX:+10000:1:6:0: +%*7hX:+10000:0:6: +%7hX:+0X10000:1:7:4096: +%*7hX:+0X10000:0:7: +%7hX:+0x10000:1:7:4096: +%*7hX:+0x10000:0:7: +%7hX:+10029:1:6:41: +%*7hX:+10029:0:6: +%7hX:+0X10029:1:7:4098: +%*7hX:+0X10029:0:7: +%7hX:+0x10029:1:7:4098: +%*7hX:+0x10029:0:7: +%2hX: :0:-1: +%*2hX: :0:-1: +%2hX: -7b:1:3:65529: +%*2hX: -7b:0:3: +%2hX: -7B:1:3:65529: +%*2hX: -7B:0:3: +%2hX: -0X7b:1:3:0: +%*2hX: -0X7b:0:3: +%2hX: -0x7B:1:3:0: +%*2hX: -0x7B:0:3: +%2hX: -1:1:3:65535: +%*2hX: -1:0:3: +%2hX: -0X1:1:3:0: +%*2hX: -0X1:0:3: +%2hX: -0x1:1:3:0: +%*2hX: -0x1:0:3: +%2hX: -0:1:3:0: +%*2hX: -0:0:3: +%2hX: -0X0:1:3:0: +%*2hX: -0X0:0:3: +%2hX: -0x0:1:3:0: +%*2hX: -0x0:0:3: +%2hX: 0:1:2:0: +%*2hX: 0:0:2: +%2hX: 0X0:0:-1: +%*2hX: 0X0:0:-1: +%2hX: 0x0:0:-1: +%*2hX: 0x0:0:-1: +%2hX: 1:1:2:1: +%*2hX: 1:0:2: +%2hX: 0X1:0:-1: +%*2hX: 0X1:0:-1: +%2hX: 0x1:0:-1: +%*2hX: 0x1:0:-1: +%2hX: 2a:1:3:42: +%*2hX: 2a:0:3: +%2hX: 2A:1:3:42: +%*2hX: 2A:0:3: +%2hX: 0X2a:0:-1: +%*2hX: 0X2a:0:-1: +%2hX: 0x2A:0:-1: +%*2hX: 0x2A:0:-1: +%2hX: ffff:1:3:255: +%*2hX: ffff:0:3: +%2hX: FFFF:1:3:255: +%*2hX: FFFF:0:3: +%2hX: 0Xffff:0:-1: +%*2hX: 0Xffff:0:-1: +%2hX: 0xFFFF:0:-1: +%*2hX: 0xFFFF:0:-1: +%2hX: 10000:1:3:16: +%*2hX: 10000:0:3: +%2hX: 0X10000:0:-1: +%*2hX: 0X10000:0:-1: +%2hX: 0x10000:0:-1: +%*2hX: 0x10000:0:-1: +%2hX: 10029:1:3:16: +%*2hX: 10029:0:3: +%2hX: 0X10029:0:-1: +%*2hX: 0X10029:0:-1: +%2hX: 0x10029:0:-1: +%*2hX: 0x10029:0:-1: +%2hX: +0:1:3:0: +%*2hX: +0:0:3: +%2hX: +0X0:1:3:0: +%*2hX: +0X0:0:3: +%2hX: +0x0:1:3:0: +%*2hX: +0x0:0:3: +%2hX: +1:1:3:1: +%*2hX: +1:0:3: +%2hX: +0X1:1:3:0: +%*2hX: +0X1:0:3: +%2hX: +0x1:1:3:0: +%*2hX: +0x1:0:3: +%2hX: +2a:1:3:2: +%*2hX: +2a:0:3: +%2hX: +2A:1:3:2: +%*2hX: +2A:0:3: +%2hX: +0X2a:1:3:0: +%*2hX: +0X2a:0:3: +%2hX: +0x2A:1:3:0: +%*2hX: +0x2A:0:3: +%2hX: +ffff:1:3:15: +%*2hX: +ffff:0:3: +%2hX: +FFFF:1:3:15: +%*2hX: +FFFF:0:3: +%2hX: +0Xffff:1:3:0: +%*2hX: +0Xffff:0:3: +%2hX: +0xFFFF:1:3:0: +%*2hX: +0xFFFF:0:3: +%2hX: +10000:1:3:1: +%*2hX: +10000:0:3: +%2hX: +0X10000:1:3:0: +%*2hX: +0X10000:0:3: +%2hX: +0x10000:1:3:0: +%*2hX: +0x10000:0:3: +%2hX: +10029:1:3:1: +%*2hX: +10029:0:3: +%2hX: +0X10029:1:3:0: +%*2hX: +0X10029:0:3: +%2hX: +0x10029:1:3:0: +%*2hX: +0x10029:0:3: +%7hX: :0:-1: +%*7hX: :0:-1: +%7hX: -7b:1:4:65413: +%*7hX: -7b:0:4: +%7hX: -7B:1:4:65413: +%*7hX: -7B:0:4: +%7hX: -0X7b:1:6:65413: +%*7hX: -0X7b:0:6: +%7hX: -0x7B:1:6:65413: +%*7hX: -0x7B:0:6: +%7hX: -1:1:3:65535: +%*7hX: -1:0:3: +%7hX: -0X1:1:5:65535: +%*7hX: -0X1:0:5: +%7hX: -0x1:1:5:65535: +%*7hX: -0x1:0:5: +%7hX: -0:1:3:0: +%*7hX: -0:0:3: +%7hX: -0X0:1:5:0: +%*7hX: -0X0:0:5: +%7hX: -0x0:1:5:0: +%*7hX: -0x0:0:5: +%7hX: 0:1:2:0: +%*7hX: 0:0:2: +%7hX: 0X0:1:4:0: +%*7hX: 0X0:0:4: +%7hX: 0x0:1:4:0: +%*7hX: 0x0:0:4: +%7hX: 1:1:2:1: +%*7hX: 1:0:2: +%7hX: 0X1:1:4:1: +%*7hX: 0X1:0:4: +%7hX: 0x1:1:4:1: +%*7hX: 0x1:0:4: +%7hX: 2a:1:3:42: +%*7hX: 2a:0:3: +%7hX: 2A:1:3:42: +%*7hX: 2A:0:3: +%7hX: 0X2a:1:5:42: +%*7hX: 0X2a:0:5: +%7hX: 0x2A:1:5:42: +%*7hX: 0x2A:0:5: +%7hX: ffff:1:5:65535: +%*7hX: ffff:0:5: +%7hX: FFFF:1:5:65535: +%*7hX: FFFF:0:5: +%7hX: 0Xffff:1:7:65535: +%*7hX: 0Xffff:0:7: +%7hX: 0xFFFF:1:7:65535: +%*7hX: 0xFFFF:0:7: +%7hX: 10000:1:6:0: +%*7hX: 10000:0:6: +%7hX: 0X10000:1:8:0: +%*7hX: 0X10000:0:8: +%7hX: 0x10000:1:8:0: +%*7hX: 0x10000:0:8: +%7hX: 10029:1:6:41: +%*7hX: 10029:0:6: +%7hX: 0X10029:1:8:41: +%*7hX: 0X10029:0:8: +%7hX: 0x10029:1:8:41: +%*7hX: 0x10029:0:8: +%7hX: +0:1:3:0: +%*7hX: +0:0:3: +%7hX: +0X0:1:5:0: +%*7hX: +0X0:0:5: +%7hX: +0x0:1:5:0: +%*7hX: +0x0:0:5: +%7hX: +1:1:3:1: +%*7hX: +1:0:3: +%7hX: +0X1:1:5:1: +%*7hX: +0X1:0:5: +%7hX: +0x1:1:5:1: +%*7hX: +0x1:0:5: +%7hX: +2a:1:4:42: +%*7hX: +2a:0:4: +%7hX: +2A:1:4:42: +%*7hX: +2A:0:4: +%7hX: +0X2a:1:6:42: +%*7hX: +0X2a:0:6: +%7hX: +0x2A:1:6:42: +%*7hX: +0x2A:0:6: +%7hX: +ffff:1:6:65535: +%*7hX: +ffff:0:6: +%7hX: +FFFF:1:6:65535: +%*7hX: +FFFF:0:6: +%7hX: +0Xffff:1:8:65535: +%*7hX: +0Xffff:0:8: +%7hX: +0xFFFF:1:8:65535: +%*7hX: +0xFFFF:0:8: +%7hX: +10000:1:7:0: +%*7hX: +10000:0:7: +%7hX: +0X10000:1:8:4096: +%*7hX: +0X10000:0:8: +%7hX: +0x10000:1:8:4096: +%*7hX: +0x10000:0:8: +%7hX: +10029:1:7:41: +%*7hX: +10029:0:7: +%7hX: +0X10029:1:8:4098: +%*7hX: +0X10029:0:8: +%7hX: +0x10029:1:8:4098: +%*7hX: +0x10029:0:8: diff --git a/stdio-common/tst-scanf-format-v-c.c b/stdio-common/tst-scanf-format-v-c.c new file mode 100644 index 0000000..0e2c000 --- /dev/null +++ b/stdio-common/tst-scanf-format-v-c.c @@ -0,0 +1,22 @@ +/* Test for formatted 'vscanf' input for the character conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-v.h" +#include "tst-scanf-format-character.h" +#include "tst-scanf-format-skeleton-c.c" diff --git a/stdio-common/tst-scanf-format-v-char.c b/stdio-common/tst-scanf-format-v-char.c new file mode 100644 index 0000000..be3a56c --- /dev/null +++ b/stdio-common/tst-scanf-format-v-char.c @@ -0,0 +1,22 @@ +/* Test for formatted 'vscanf' input for signed char conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-v.h" +#include "tst-scanf-format-integer.h" +#include "tst-scanf-format-skeleton-char.c" diff --git a/stdio-common/tst-scanf-format-v-double.c b/stdio-common/tst-scanf-format-v-double.c new file mode 100644 index 0000000..9188631 --- /dev/null +++ b/stdio-common/tst-scanf-format-v-double.c @@ -0,0 +1,22 @@ +/* Test for formatted 'vscanf' input for double conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-v.h" +#include "tst-scanf-format-real.h" +#include "tst-scanf-format-skeleton-double.c" diff --git a/stdio-common/tst-scanf-format-v-float.c b/stdio-common/tst-scanf-format-v-float.c new file mode 100644 index 0000000..5d289d3 --- /dev/null +++ b/stdio-common/tst-scanf-format-v-float.c @@ -0,0 +1,22 @@ +/* Test for formatted 'vscanf' input for float conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-v.h" +#include "tst-scanf-format-real.h" +#include "tst-scanf-format-skeleton-float.c" diff --git a/stdio-common/tst-scanf-format-v-int.c b/stdio-common/tst-scanf-format-v-int.c new file mode 100644 index 0000000..770a686 --- /dev/null +++ b/stdio-common/tst-scanf-format-v-int.c @@ -0,0 +1,22 @@ +/* Test for formatted 'vscanf' input for int conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-v.h" +#include "tst-scanf-format-integer.h" +#include "tst-scanf-format-skeleton-int.c" diff --git a/stdio-common/tst-scanf-format-v-ldouble.c b/stdio-common/tst-scanf-format-v-ldouble.c new file mode 100644 index 0000000..8215ea7 --- /dev/null +++ b/stdio-common/tst-scanf-format-v-ldouble.c @@ -0,0 +1,22 @@ +/* Test for formatted 'vscanf' input for long double conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-v.h" +#include "tst-scanf-format-real.h" +#include "tst-scanf-format-skeleton-ldouble.c" diff --git a/stdio-common/tst-scanf-format-v-llong.c b/stdio-common/tst-scanf-format-v-llong.c new file mode 100644 index 0000000..2a1ef02 --- /dev/null +++ b/stdio-common/tst-scanf-format-v-llong.c @@ -0,0 +1,22 @@ +/* Test for formatted 'vscanf' input for long long conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-v.h" +#include "tst-scanf-format-integer.h" +#include "tst-scanf-format-skeleton-llong.c" diff --git a/stdio-common/tst-scanf-format-v-long.c b/stdio-common/tst-scanf-format-v-long.c new file mode 100644 index 0000000..8376032 --- /dev/null +++ b/stdio-common/tst-scanf-format-v-long.c @@ -0,0 +1,22 @@ +/* Test for formatted 'vscanf' input for long conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-v.h" +#include "tst-scanf-format-integer.h" +#include "tst-scanf-format-skeleton-long.c" diff --git a/stdio-common/tst-scanf-format-v-short.c b/stdio-common/tst-scanf-format-v-short.c new file mode 100644 index 0000000..23b9c56 --- /dev/null +++ b/stdio-common/tst-scanf-format-v-short.c @@ -0,0 +1,22 @@ +/* Test for formatted 'vscanf' input for short int conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-v.h" +#include "tst-scanf-format-integer.h" +#include "tst-scanf-format-skeleton-short.c" diff --git a/stdio-common/tst-scanf-format-v-uchar.c b/stdio-common/tst-scanf-format-v-uchar.c new file mode 100644 index 0000000..861db22 --- /dev/null +++ b/stdio-common/tst-scanf-format-v-uchar.c @@ -0,0 +1,22 @@ +/* Test for formatted 'vscanf' input for unsigned char conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-v.h" +#include "tst-scanf-format-integer.h" +#include "tst-scanf-format-skeleton-uchar.c" diff --git a/stdio-common/tst-scanf-format-v-uint.c b/stdio-common/tst-scanf-format-v-uint.c new file mode 100644 index 0000000..30e58c5 --- /dev/null +++ b/stdio-common/tst-scanf-format-v-uint.c @@ -0,0 +1,22 @@ +/* Test for formatted 'vscanf' input for unsigned int conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-v.h" +#include "tst-scanf-format-integer.h" +#include "tst-scanf-format-skeleton-uint.c" diff --git a/stdio-common/tst-scanf-format-v-ullong.c b/stdio-common/tst-scanf-format-v-ullong.c new file mode 100644 index 0000000..ee2914d --- /dev/null +++ b/stdio-common/tst-scanf-format-v-ullong.c @@ -0,0 +1,22 @@ +/* Test for formatted 'vscanf' input for unsigned long long int conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-v.h" +#include "tst-scanf-format-integer.h" +#include "tst-scanf-format-skeleton-ullong.c" diff --git a/stdio-common/tst-scanf-format-v-ulong.c b/stdio-common/tst-scanf-format-v-ulong.c new file mode 100644 index 0000000..f7864dd --- /dev/null +++ b/stdio-common/tst-scanf-format-v-ulong.c @@ -0,0 +1,22 @@ +/* Test for formatted 'vscanf' input for unsigned long int conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-v.h" +#include "tst-scanf-format-integer.h" +#include "tst-scanf-format-skeleton-ulong.c" diff --git a/stdio-common/tst-scanf-format-v-ushort.c b/stdio-common/tst-scanf-format-v-ushort.c new file mode 100644 index 0000000..79ca16b --- /dev/null +++ b/stdio-common/tst-scanf-format-v-ushort.c @@ -0,0 +1,22 @@ +/* Test for formatted 'vscanf' input for unsigned short int conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-v.h" +#include "tst-scanf-format-integer.h" +#include "tst-scanf-format-skeleton-ushort.c" diff --git a/stdio-common/tst-scanf-format-v.h b/stdio-common/tst-scanf-format-v.h new file mode 100644 index 0000000..bf19877 --- /dev/null +++ b/stdio-common/tst-scanf-format-v.h @@ -0,0 +1,36 @@ +/* Test feature wrapper for formatted 'vscanf' input. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <stdarg.h> +#include <stdio.h> + +static int +scanf_under_test (const char *restrict fmt, ...) +{ + va_list ap; + int result; + + va_start (ap, fmt); + result = vscanf (fmt, ap); + va_end (ap); + if (ferror (stdin)) + result = INPUT_ERROR; + else if (result == EOF) + result = INPUT_EOF; + return result; +} diff --git a/stdio-common/tst-scanf-format-vf-c.c b/stdio-common/tst-scanf-format-vf-c.c new file mode 100644 index 0000000..307bfe8 --- /dev/null +++ b/stdio-common/tst-scanf-format-vf-c.c @@ -0,0 +1,22 @@ +/* Test for formatted 'vfscanf' input for the character conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-vf.h" +#include "tst-scanf-format-character.h" +#include "tst-scanf-format-skeleton-c.c" diff --git a/stdio-common/tst-scanf-format-vf-char.c b/stdio-common/tst-scanf-format-vf-char.c new file mode 100644 index 0000000..602899b --- /dev/null +++ b/stdio-common/tst-scanf-format-vf-char.c @@ -0,0 +1,22 @@ +/* Test for formatted 'vfscanf' input for signed char conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-vf.h" +#include "tst-scanf-format-integer.h" +#include "tst-scanf-format-skeleton-char.c" diff --git a/stdio-common/tst-scanf-format-vf-double.c b/stdio-common/tst-scanf-format-vf-double.c new file mode 100644 index 0000000..8b58bbe --- /dev/null +++ b/stdio-common/tst-scanf-format-vf-double.c @@ -0,0 +1,22 @@ +/* Test for formatted 'vfscanf' input for double conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-vf.h" +#include "tst-scanf-format-real.h" +#include "tst-scanf-format-skeleton-double.c" diff --git a/stdio-common/tst-scanf-format-vf-float.c b/stdio-common/tst-scanf-format-vf-float.c new file mode 100644 index 0000000..81dad06 --- /dev/null +++ b/stdio-common/tst-scanf-format-vf-float.c @@ -0,0 +1,22 @@ +/* Test for formatted 'vfscanf' input for float conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-vf.h" +#include "tst-scanf-format-real.h" +#include "tst-scanf-format-skeleton-float.c" diff --git a/stdio-common/tst-scanf-format-vf-int.c b/stdio-common/tst-scanf-format-vf-int.c new file mode 100644 index 0000000..8038791 --- /dev/null +++ b/stdio-common/tst-scanf-format-vf-int.c @@ -0,0 +1,22 @@ +/* Test for formatted 'vfscanf' input for int conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-vf.h" +#include "tst-scanf-format-integer.h" +#include "tst-scanf-format-skeleton-int.c" diff --git a/stdio-common/tst-scanf-format-vf-ldouble.c b/stdio-common/tst-scanf-format-vf-ldouble.c new file mode 100644 index 0000000..ec9a7c4 --- /dev/null +++ b/stdio-common/tst-scanf-format-vf-ldouble.c @@ -0,0 +1,22 @@ +/* Test for formatted 'vfscanf' input for long double conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-vf.h" +#include "tst-scanf-format-real.h" +#include "tst-scanf-format-skeleton-ldouble.c" diff --git a/stdio-common/tst-scanf-format-vf-llong.c b/stdio-common/tst-scanf-format-vf-llong.c new file mode 100644 index 0000000..adc4b12 --- /dev/null +++ b/stdio-common/tst-scanf-format-vf-llong.c @@ -0,0 +1,22 @@ +/* Test for formatted 'vfscanf' input for long long conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-vf.h" +#include "tst-scanf-format-integer.h" +#include "tst-scanf-format-skeleton-llong.c" diff --git a/stdio-common/tst-scanf-format-vf-long.c b/stdio-common/tst-scanf-format-vf-long.c new file mode 100644 index 0000000..5f26d6c --- /dev/null +++ b/stdio-common/tst-scanf-format-vf-long.c @@ -0,0 +1,22 @@ +/* Test for formatted 'vfscanf' input for long conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-vf.h" +#include "tst-scanf-format-integer.h" +#include "tst-scanf-format-skeleton-long.c" diff --git a/stdio-common/tst-scanf-format-vf-short.c b/stdio-common/tst-scanf-format-vf-short.c new file mode 100644 index 0000000..0e081ea --- /dev/null +++ b/stdio-common/tst-scanf-format-vf-short.c @@ -0,0 +1,22 @@ +/* Test for formatted 'vfscanf' input for short int conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-vf.h" +#include "tst-scanf-format-integer.h" +#include "tst-scanf-format-skeleton-short.c" diff --git a/stdio-common/tst-scanf-format-vf-uchar.c b/stdio-common/tst-scanf-format-vf-uchar.c new file mode 100644 index 0000000..2e879f5 --- /dev/null +++ b/stdio-common/tst-scanf-format-vf-uchar.c @@ -0,0 +1,22 @@ +/* Test for formatted 'vfscanf' input for unsigned char conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-vf.h" +#include "tst-scanf-format-integer.h" +#include "tst-scanf-format-skeleton-uchar.c" diff --git a/stdio-common/tst-scanf-format-vf-uint.c b/stdio-common/tst-scanf-format-vf-uint.c new file mode 100644 index 0000000..4874f86 --- /dev/null +++ b/stdio-common/tst-scanf-format-vf-uint.c @@ -0,0 +1,22 @@ +/* Test for formatted 'vfscanf' input for unsigned int conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-vf.h" +#include "tst-scanf-format-integer.h" +#include "tst-scanf-format-skeleton-uint.c" diff --git a/stdio-common/tst-scanf-format-vf-ullong.c b/stdio-common/tst-scanf-format-vf-ullong.c new file mode 100644 index 0000000..dde0901 --- /dev/null +++ b/stdio-common/tst-scanf-format-vf-ullong.c @@ -0,0 +1,22 @@ +/* Test for formatted 'vfscanf' input for unsigned long long int conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-vf.h" +#include "tst-scanf-format-integer.h" +#include "tst-scanf-format-skeleton-ullong.c" diff --git a/stdio-common/tst-scanf-format-vf-ulong.c b/stdio-common/tst-scanf-format-vf-ulong.c new file mode 100644 index 0000000..8102306 --- /dev/null +++ b/stdio-common/tst-scanf-format-vf-ulong.c @@ -0,0 +1,22 @@ +/* Test for formatted 'vfscanf' input for unsigned long int conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-vf.h" +#include "tst-scanf-format-integer.h" +#include "tst-scanf-format-skeleton-ulong.c" diff --git a/stdio-common/tst-scanf-format-vf-ushort.c b/stdio-common/tst-scanf-format-vf-ushort.c new file mode 100644 index 0000000..cb8eb4b --- /dev/null +++ b/stdio-common/tst-scanf-format-vf-ushort.c @@ -0,0 +1,22 @@ +/* Test for formatted 'vfscanf' input for unsigned short int conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-vf.h" +#include "tst-scanf-format-integer.h" +#include "tst-scanf-format-skeleton-ushort.c" diff --git a/stdio-common/tst-scanf-format-vf.h b/stdio-common/tst-scanf-format-vf.h new file mode 100644 index 0000000..6037e63 --- /dev/null +++ b/stdio-common/tst-scanf-format-vf.h @@ -0,0 +1,36 @@ +/* Test feature wrapper for formatted 'vfscanf' input. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <stdarg.h> +#include <stdio.h> + +static int +scanf_under_test (const char *restrict fmt, ...) +{ + va_list ap; + int result; + + va_start (ap, fmt); + result = vfscanf (stdin, fmt, ap); + va_end (ap); + if (ferror (stdin)) + result = INPUT_ERROR; + else if (result == EOF) + result = INPUT_EOF; + return result; +} diff --git a/stdio-common/tst-scanf-format-vs-c.c b/stdio-common/tst-scanf-format-vs-c.c new file mode 100644 index 0000000..2df5aa7 --- /dev/null +++ b/stdio-common/tst-scanf-format-vs-c.c @@ -0,0 +1,22 @@ +/* Test for formatted 'vsscanf' input for the character conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-vs.h" +#include "tst-scanf-format-character.h" +#include "tst-scanf-format-skeleton-c.c" diff --git a/stdio-common/tst-scanf-format-vs-char.c b/stdio-common/tst-scanf-format-vs-char.c new file mode 100644 index 0000000..ae4d8e0 --- /dev/null +++ b/stdio-common/tst-scanf-format-vs-char.c @@ -0,0 +1,22 @@ +/* Test for formatted 'vsscanf' input for signed char conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-vs.h" +#include "tst-scanf-format-integer.h" +#include "tst-scanf-format-skeleton-char.c" diff --git a/stdio-common/tst-scanf-format-vs-double.c b/stdio-common/tst-scanf-format-vs-double.c new file mode 100644 index 0000000..cd459a8 --- /dev/null +++ b/stdio-common/tst-scanf-format-vs-double.c @@ -0,0 +1,22 @@ +/* Test for formatted 'vsscanf' input for double conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-vs.h" +#include "tst-scanf-format-real.h" +#include "tst-scanf-format-skeleton-double.c" diff --git a/stdio-common/tst-scanf-format-vs-float.c b/stdio-common/tst-scanf-format-vs-float.c new file mode 100644 index 0000000..7872afe --- /dev/null +++ b/stdio-common/tst-scanf-format-vs-float.c @@ -0,0 +1,22 @@ +/* Test for formatted 'vsscanf' input for float conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-vs.h" +#include "tst-scanf-format-real.h" +#include "tst-scanf-format-skeleton-float.c" diff --git a/stdio-common/tst-scanf-format-vs-int.c b/stdio-common/tst-scanf-format-vs-int.c new file mode 100644 index 0000000..e67b4be --- /dev/null +++ b/stdio-common/tst-scanf-format-vs-int.c @@ -0,0 +1,22 @@ +/* Test for formatted 'vsscanf' input for int conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-vs.h" +#include "tst-scanf-format-integer.h" +#include "tst-scanf-format-skeleton-int.c" diff --git a/stdio-common/tst-scanf-format-vs-ldouble.c b/stdio-common/tst-scanf-format-vs-ldouble.c new file mode 100644 index 0000000..4d299c2 --- /dev/null +++ b/stdio-common/tst-scanf-format-vs-ldouble.c @@ -0,0 +1,22 @@ +/* Test for formatted 'vsscanf' input for long double conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-vs.h" +#include "tst-scanf-format-real.h" +#include "tst-scanf-format-skeleton-ldouble.c" diff --git a/stdio-common/tst-scanf-format-vs-llong.c b/stdio-common/tst-scanf-format-vs-llong.c new file mode 100644 index 0000000..06c8cc9 --- /dev/null +++ b/stdio-common/tst-scanf-format-vs-llong.c @@ -0,0 +1,22 @@ +/* Test for formatted 'vsscanf' input for long long conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-vs.h" +#include "tst-scanf-format-integer.h" +#include "tst-scanf-format-skeleton-llong.c" diff --git a/stdio-common/tst-scanf-format-vs-long.c b/stdio-common/tst-scanf-format-vs-long.c new file mode 100644 index 0000000..575a6cb --- /dev/null +++ b/stdio-common/tst-scanf-format-vs-long.c @@ -0,0 +1,22 @@ +/* Test for formatted 'vsscanf' input for long conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-vs.h" +#include "tst-scanf-format-integer.h" +#include "tst-scanf-format-skeleton-long.c" diff --git a/stdio-common/tst-scanf-format-vs-short.c b/stdio-common/tst-scanf-format-vs-short.c new file mode 100644 index 0000000..5473471 --- /dev/null +++ b/stdio-common/tst-scanf-format-vs-short.c @@ -0,0 +1,22 @@ +/* Test for formatted 'vsscanf' input for short int conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-vs.h" +#include "tst-scanf-format-integer.h" +#include "tst-scanf-format-skeleton-short.c" diff --git a/stdio-common/tst-scanf-format-vs-uchar.c b/stdio-common/tst-scanf-format-vs-uchar.c new file mode 100644 index 0000000..5a29b9b --- /dev/null +++ b/stdio-common/tst-scanf-format-vs-uchar.c @@ -0,0 +1,22 @@ +/* Test for formatted 'vsscanf' input for unsigned char conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-vs.h" +#include "tst-scanf-format-integer.h" +#include "tst-scanf-format-skeleton-uchar.c" diff --git a/stdio-common/tst-scanf-format-vs-uint.c b/stdio-common/tst-scanf-format-vs-uint.c new file mode 100644 index 0000000..b9486b1 --- /dev/null +++ b/stdio-common/tst-scanf-format-vs-uint.c @@ -0,0 +1,22 @@ +/* Test for formatted 'vsscanf' input for unsigned int conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-vs.h" +#include "tst-scanf-format-integer.h" +#include "tst-scanf-format-skeleton-uint.c" diff --git a/stdio-common/tst-scanf-format-vs-ullong.c b/stdio-common/tst-scanf-format-vs-ullong.c new file mode 100644 index 0000000..5396a78 --- /dev/null +++ b/stdio-common/tst-scanf-format-vs-ullong.c @@ -0,0 +1,22 @@ +/* Test for formatted 'vsscanf' input for unsigned long long int conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-vs.h" +#include "tst-scanf-format-integer.h" +#include "tst-scanf-format-skeleton-ullong.c" diff --git a/stdio-common/tst-scanf-format-vs-ulong.c b/stdio-common/tst-scanf-format-vs-ulong.c new file mode 100644 index 0000000..3dbc142 --- /dev/null +++ b/stdio-common/tst-scanf-format-vs-ulong.c @@ -0,0 +1,22 @@ +/* Test for formatted 'vsscanf' input for unsigned long int conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-vs.h" +#include "tst-scanf-format-integer.h" +#include "tst-scanf-format-skeleton-ulong.c" diff --git a/stdio-common/tst-scanf-format-vs-ushort.c b/stdio-common/tst-scanf-format-vs-ushort.c new file mode 100644 index 0000000..0f28b36 --- /dev/null +++ b/stdio-common/tst-scanf-format-vs-ushort.c @@ -0,0 +1,22 @@ +/* Test for formatted 'vsscanf' input for unsigned short int conversions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include "tst-scanf-format-skeleton.h" +#include "tst-scanf-format-vs.h" +#include "tst-scanf-format-integer.h" +#include "tst-scanf-format-skeleton-ushort.c" diff --git a/stdio-common/tst-scanf-format-vs.h b/stdio-common/tst-scanf-format-vs.h new file mode 100644 index 0000000..d49690d --- /dev/null +++ b/stdio-common/tst-scanf-format-vs.h @@ -0,0 +1,77 @@ +/* Test feature wrapper for formatted 'vsscanf' input. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <stdarg.h> +#include <stddef.h> +#include <stdio.h> +#include <stdlib.h> + +#include <support/support.h> + +static char *sscanf_buf; +static size_t sscanf_buf_size; + +static void __attribute__ ((destructor)) +scanf_under_test_fini (void) +{ + free (sscanf_buf); +} + +static int +scanf_under_test (const char *restrict fmt, ...) +{ + size_t i = 0; + va_list ap; + int result; + int ch; + + do + { + ch = read_input (); + if (ch < 0) + { + result = ch; + goto out; + } + if (i == sscanf_buf_size) + { + sscanf_buf_size += SIZE_CHUNK; + /* Add an extra byte for the terminating null character. */ + sscanf_buf = xrealloc (sscanf_buf, sscanf_buf_size + 1); + } + sscanf_buf[i++] = ch; + } + while (ch != ':'); + sscanf_buf[i++] = '\0'; + + ch = ungetc (ch, stdin); + if (ch == EOF) + { + result = INPUT_ERROR; + goto out; + } + + va_start (ap, fmt); + result = vsscanf (sscanf_buf, fmt, ap); + va_end (ap); + if (result == EOF) + result = INPUT_EOF; + +out: + return result; +} diff --git a/stdio-common/tst-scanf-intn-main.c b/stdio-common/tst-scanf-intn-main.c index 5964e42..0274d8e 100644 --- a/stdio-common/tst-scanf-intn-main.c +++ b/stdio-common/tst-scanf-intn-main.c @@ -1,5 +1,5 @@ /* Test scanf formats for intN_t, int_leastN_t and int_fastN_t types. - Copyright (C) 2023-2024 Free Software Foundation, Inc. + Copyright (C) 2023-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/tst-scanf-intn.c b/stdio-common/tst-scanf-intn.c index 9ad5c8c..dcfa1b8 100644 --- a/stdio-common/tst-scanf-intn.c +++ b/stdio-common/tst-scanf-intn.c @@ -1,6 +1,6 @@ /* Test scanf formats for intN_t, int_leastN_t and int_fastN_t types. Narrow string version. - Copyright (C) 2023-2024 Free Software Foundation, Inc. + Copyright (C) 2023-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/tst-scanf-nan.c b/stdio-common/tst-scanf-nan.c new file mode 100644 index 0000000..7450b37 --- /dev/null +++ b/stdio-common/tst-scanf-nan.c @@ -0,0 +1,83 @@ +/* Test scanf formats for nan, nan(), nan(n-char-sequence) types. + Copyright The GNU Toolchain Authors. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <stdint.h> +#include <stdio.h> + +#include <support/check.h> + +#define CHECK_SCANF_RET(OK, STR, FMT, ...) \ + do \ + { \ + int ret = sscanf (STR, FMT, __VA_ARGS__); \ + TEST_VERIFY (ret == (OK)); \ + } \ + while (0) + +/* Valid nan types: + 1. nan + 2. nan() + 3. nan([a-zA-Z0-9_]+) + Any other nan format is invalid and should produce a conversion error. + The return value denotes the number of valid conversions. On conversion + error the rest of the input is discarded. */ +static int +do_test (void) +{ + int a; + float b; + double c; + long double d; + + /* All valid inputs. */ + CHECK_SCANF_RET (1, "nan", "%lf", &c); + CHECK_SCANF_RET (1, "nan()", "%lf", &c); + CHECK_SCANF_RET (1, "nan(12345)", "%lf", &c); + CHECK_SCANF_RET (2, "nan12", "%lf%d", &c, &a); + CHECK_SCANF_RET (2, "nan nan()", "%f%Lf", &b, &d); + CHECK_SCANF_RET (2, "nan nan(12345foo)", "%lf%Lf", &c, &d); + CHECK_SCANF_RET (3, "nan nan() 12.234", "%lf%Lf%f", &c, &d, &b); + CHECK_SCANF_RET (4, "nannan()nan(foo)1234", "%lf%f%Lf%d", &c, &b, &d, &a); + + /* Partially valid inputs. */ + CHECK_SCANF_RET (1, "nan( )", "%3lf", &c); + CHECK_SCANF_RET (1, "nan nan(", "%lf%f", &c, &b); + + /* Invalid inputs. */ + + /* Dangling parentheses. */ + CHECK_SCANF_RET (0, "nan(", "%lf", &c); + CHECK_SCANF_RET (0, "nan(123", "%lf", &c); + CHECK_SCANF_RET (0, "nan(12345", "%lf%d", &c, &a); + + /* Field width is not sufficient for valid conversion. */ + CHECK_SCANF_RET (0, "nan()", "%4Lf", &d); + CHECK_SCANF_RET (0, "nan(1", "%5lf", &c); + + /* Space is not a valid character. */ + CHECK_SCANF_RET (0, "nan( )", "%lf", &c); + CHECK_SCANF_RET (0, "nan( )12.34", "%Lf%f", &d, &b); + CHECK_SCANF_RET (0, "nan(12 foo)", "%f", &b); + + /* Period '.' is not a valid character. */ + CHECK_SCANF_RET (0, "nan(12.34) nan(FooBar)", "%lf%Lf", &c, &d); + + return 0; +} + +#include <support/test-driver.c> diff --git a/stdio-common/tst-scanf-round.c b/stdio-common/tst-scanf-round.c index dde18e3..a2918d9 100644 --- a/stdio-common/tst-scanf-round.c +++ b/stdio-common/tst-scanf-round.c @@ -1,6 +1,6 @@ /* Test for correct rounding of negative floating-point numbers by scanf (bug 23280). - Copyright (C) 2018-2024 Free Software Foundation, Inc. + Copyright (C) 2018-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/tst-scanf-to_inpunct.c b/stdio-common/tst-scanf-to_inpunct.c index 6fc038f..fc65eed 100644 --- a/stdio-common/tst-scanf-to_inpunct.c +++ b/stdio-common/tst-scanf-to_inpunct.c @@ -1,6 +1,6 @@ /* Test scanf for languages with mapping pairs of alternate digits and separators. - Copyright (C) 2023-2024 Free Software Foundation, Inc. + Copyright (C) 2023-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -18,6 +18,7 @@ <https://www.gnu.org/licenses/>. */ #include <array_length.h> +#include <libc-diag.h> #include <stdio.h> #include <support/support.h> #include <support/check.h> @@ -68,7 +69,11 @@ do_test (void) for (int i = 0; i < array_length (inputs); i++) { int n; + /* clang does not support 'I' specifier. */ + DIAG_PUSH_NEEDS_COMMENT_CLANG; + DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wformat"); sscanf (inputs[i].str, "%Id", &n); + DIAG_POP_NEEDS_COMMENT_CLANG; TEST_COMPARE (n, inputs[i].n); } diff --git a/stdio-common/tst-setvbuf2-ind.c b/stdio-common/tst-setvbuf2-ind.c new file mode 100644 index 0000000..fda2942 --- /dev/null +++ b/stdio-common/tst-setvbuf2-ind.c @@ -0,0 +1,2 @@ +#define INDEPENDENT_PART 1 +#include "tst-setvbuf2.c" diff --git a/stdio-common/tst-setvbuf2.c b/stdio-common/tst-setvbuf2.c new file mode 100644 index 0000000..84d8b43 --- /dev/null +++ b/stdio-common/tst-setvbuf2.c @@ -0,0 +1,1033 @@ +/* Test setvbuf under various conditions. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +/* This file is used twice, once as the test itself (where do_test + is defined) and once as a subprocess we spawn to test stdin et all + (where main is defined). INDEPENDENT_PART is defined for the + latter. + + Note also that the purpose of this test is to test setvbuf, not the + underlying buffering code. */ + +#include <stdbool.h> +#include <stdio.h> +#include <stdio_ext.h> +#include <stdlib.h> +#include <unistd.h> +#include <fcntl.h> +#include <string.h> +#include <errno.h> +#include <signal.h> +#include <libio.h> +#include <termios.h> + +#include <support/support.h> +#include <support/check.h> +#include <support/temp_file.h> +#include <support/xstdio.h> +#include <support/xunistd.h> +#include <support/xthread.h> +#include <support/tty.h> + +/* Dear future developer: If you are reading this, you are likely + trying to change or understand this test. In that case, these + debug/dump macros will be helpful. */ +#if 0 +# define debug printf ("\033[3%dm%s:%d\033[0m\n", \ + (__LINE__ % 6) + 1, __FUNCTION__, __LINE__); + +static void +dumpfp (FILE *fp) +{ + char f[10], *p=f; + + if (fp->_flags & _IO_UNBUFFERED) + *p++ = 'N'; + if (fp->_flags & _IO_LINE_BUF) + *p++ = 'L'; + if (p == f) + *p++ = 'B'; + *p = 0; + + printf ("FILE %p flags %s" + " read %p \033[%dm%+ld \033[%dm%+ld\033[0m" + " write %p \033[%dm%+ld \033[%dm%+ld\033[0m %ld" + " buf %p \033[%dm%+ld\033[0m sz %ld pend %ld\n", + fp, f, + + fp->_IO_read_base, + fp->_IO_read_ptr == fp->_IO_read_base ? 33 : 32, + fp->_IO_read_ptr - fp->_IO_read_base, + fp->_IO_read_end == fp->_IO_read_base ? 33 : 36, + fp->_IO_read_end - fp->_IO_read_base, + + fp->_IO_write_base, + fp->_IO_write_ptr == fp->_IO_write_base ? 33 : 32, + fp->_IO_write_ptr - fp->_IO_write_base, + fp->_IO_write_end == fp->_IO_write_base ? 33 : 36, + fp->_IO_write_end - fp->_IO_write_base, + fp->_IO_write_end - fp->_IO_write_base, + + fp->_IO_buf_base, + fp->_IO_buf_end == fp->_IO_buf_base ? 33 : 35, + fp->_IO_buf_end - fp->_IO_buf_base, + __fbufsize (fp), __fpending (fp) + ); +} +#else +# define debug +# define dumpfp(FP) +#endif + +#ifndef INDEPENDENT_PART +/* st_blksize value for that file, or BUFSIZ if out of range. */ +static int blksize = BUFSIZ; +#endif + +/* Our test buffer. */ +#define TEST_BUFSIZE 42 +static int bufsize = TEST_BUFSIZE < BUFSIZ ? TEST_BUFSIZE : BUFSIZ; +static char *buffer; + +/* Test data, both written to that file and used as an in-memory + stream. */ +char test_data[2 * BUFSIZ]; + +#define TEST_STRING "abcdef\n" + +enum test_source_case + { + test_source_file, + test_source_pipe, + test_source_fifo, + test_source_pseudo_terminal, + test_source_dev_null, + test_source_count, + }; + +static const char *const test_source_name[test_source_count] = + { + "regular file", + "pipe", + "fifo", + "pseudo_terminal", + "dev_null" + }; + +enum test_stream_case + { + test_stream_stdin, + test_stream_stdout, + test_stream_stderr, + test_stream_fopen_r, + test_stream_fdopen_r, + test_stream_fopen_w, + test_stream_fdopen_w, + test_stream_count + }; + +static bool test_stream_reads[test_stream_count] = + { + true, + false, + false, + true, + true, + false, + false + }; + +static const char *const test_stream_name[test_stream_count] = + { + "stdin", + "stdout", + "stderr", + "fopen (read)", + "fdopen (read)", + "fopen (write)", + "fdopen (write)" + }; + +enum test_config_case + { + test_config_none, + test_config_unbuffered, + test_config_line, + test_config_fully, + test_config_count + }; + +static const char *const test_config_name[test_config_count] = + { + "no change", + "unbuffered", + "line buffered", + "fully buffered" + }; + +FILE *test_stream; + +char *test_file_name = NULL; +int pty_fd; +char *test_pipe_name = NULL; +int test_pipe[2]; + +/* This is either -1 or represents a pre-opened file descriptor for + the test as returned by prepare_test_file. */ +int test_fd; + +/*------------------------------------------------------------*/ + +/* Note that throughout this test we reopen, remove, and change + to/from a fifo, the test file. This would normally cause a race + condition, except that we're in a test container. No other process + can run in the test container simultaneously. */ + +void +prepare_test_data (void) +{ + buffer = (char *) xmalloc (bufsize); + +#ifndef INDEPENDENT_PART + /* Both file and pipe need this. */ + if (test_file_name == NULL) + { + debug; + int fd = create_temp_file ("tst-setvbuf2", &test_file_name); + TEST_VERIFY_EXIT (fd != -1); + struct stat64 st; + xfstat64 (fd, &st); + if (st.st_blksize > 0 && st.st_blksize < BUFSIZ) + blksize = st.st_blksize; + xclose (fd); + } +#endif + + for (size_t i = 0; i < 2 * BUFSIZ; i++) + { + unsigned char c = TEST_STRING[i % strlen (TEST_STRING)]; + test_data[i] = c; + } +} + +#ifndef INDEPENDENT_PART + +/* These functions provide a source/sink for the "other" side of any + pipe-style descriptor we're using for test. */ + +static pthread_t writer_thread_tid = 0; +static pthread_t reader_thread_tid = 0; + +typedef struct { + int fd; + const char *fname; +} ThreadData; +/* It's OK if this is static, we only run one at a time. */ +ThreadData thread_data; + +static void +end_thread (pthread_t *ptid) +{ + if (*ptid) + { + pthread_cancel (*ptid); + xpthread_join (*ptid); + /* The descriptor was passed in, or the helper thread made + sufficient progress and opened the file. */ + if (thread_data.fd >= 0) + xclose (thread_data.fd); + *ptid = 0; + } +} + +static void * +writer_thread_proc (void *closure) +{ + ThreadData *td = (ThreadData *) closure; + int fd; + int i; + ssize_t wn; + debug; + + if (td->fname) + td->fd = xopen (td->fname, O_WRONLY, 0777); + fd = td->fd; + + while (1) + { + i = 0; + while (i < BUFSIZ) + { + wn = write (fd, test_data + i, BUFSIZ - i); + if (wn <= 0) + break; + i += wn; + } + } + return NULL; +} + +static void * +reader_thread_proc (void *closure) +{ + ThreadData *td = (ThreadData *) closure; + int fd; + ssize_t rn; + int n = 0; + debug; + + if (td->fname) + td->fd = xopen (td->fname, O_RDONLY, 0777); + fd = td->fd; + + while (1) + { + char buf[BUFSIZ]; + rn = read (fd, buf, BUFSIZ); + if (rn <= 0) + break; + TEST_COMPARE_BLOB (buf, rn, test_data+n, rn); + n += rn; + } + return NULL; +} + +static void +start_writer_thread (int fd) +{ + debug; + thread_data.fd = fd; + thread_data.fname = NULL; + writer_thread_tid = xpthread_create (NULL, writer_thread_proc, + (void *)&thread_data); +} + +static void +start_writer_thread_n (const char *fname) +{ + debug; + thread_data.fd = -1; + thread_data.fname = fname; + writer_thread_tid = xpthread_create (NULL, writer_thread_proc, + (void *)&thread_data); +} + +static void +end_writer_thread (void) +{ + debug; + end_thread (&writer_thread_tid); +} + +static void +start_reader_thread (int fd) +{ + debug; + thread_data.fd = fd; + thread_data.fname = NULL; + reader_thread_tid = xpthread_create (NULL, reader_thread_proc, + (void *)&thread_data); +} + +static void +start_reader_thread_n (const char *fname) +{ + debug; + thread_data.fd = -1; + thread_data.fname = fname; + reader_thread_tid = xpthread_create (NULL, reader_thread_proc, + (void *)&thread_data); +} + +static void +end_reader_thread (void) +{ + debug; + end_thread (&reader_thread_tid); +} + +/*------------------------------------------------------------*/ + +/* These two functions are reponsible for choosing a file to be tested + against, typically by returning a filename but in a few cases also + providing a file descriptor (i.e. for fdopen). */ + +static const char * +prepare_test_file (enum test_source_case f, enum test_stream_case s) +{ + debug; + + test_fd = -1; + + switch (f) + { + case test_source_file: + { + if (test_stream_reads[f]) + { + debug; + FILE *fp = xfopen (test_file_name, "w"); + TEST_VERIFY_EXIT (fwrite (test_data, 1, 2 * BUFSIZ, fp) + == 2 * BUFSIZ); + xfclose (fp); + } + debug; + return test_file_name; + } + + case test_source_pipe: + { + debug; + xpipe (test_pipe); + if (test_stream_reads[s]) + { + start_writer_thread (test_pipe[1]); + test_fd = test_pipe[0]; + } + else + { + start_reader_thread (test_pipe[0]); + test_fd = test_pipe[1]; + } + test_pipe_name = xasprintf ("/proc/self/fd/%d", test_fd); + debug; + return test_pipe_name; + } + + case test_source_fifo: + { + /* We do not want to fail/exit if the file doesn't exist. */ + unlink (test_file_name); + xmkfifo (test_file_name, 0600); + debug; + if (test_stream_reads[s]) + start_writer_thread_n (test_file_name); + else + start_reader_thread_n (test_file_name); + debug; + return test_file_name; + } + + case test_source_pseudo_terminal: + { + support_openpty (&pty_fd, &test_fd, &test_pipe_name, NULL, NULL); + + debug; + if (test_stream_reads[s]) + start_writer_thread (pty_fd); + else + start_reader_thread (pty_fd); + + debug; + return test_pipe_name; + } + + case test_source_dev_null: + debug; + return "/dev/null"; + + default: + abort (); + } +} + +static void +unprepare_test_file (FILE *fp, + enum test_source_case f, + enum test_stream_case s) +{ + debug; + switch (f) + { + case test_source_file: + break; + + case test_source_pipe: + free (test_pipe_name); + if (test_stream_reads[s]) + end_writer_thread (); + else + end_reader_thread (); + break; + + case test_source_fifo: + if (test_stream_reads[s]) + end_writer_thread (); + else + end_reader_thread (); + unlink (test_file_name); + break; + + case test_source_pseudo_terminal: + free (test_pipe_name); + if (test_stream_reads[s]) + end_writer_thread (); + else + end_reader_thread (); + break; + + case test_source_dev_null: + break; + + default: + abort (); + } + debug; +} + +/*------------------------------------------------------------*/ + +/* This function takes a filename and returns a file descriptor, + opened according to the method requested. */ + +static FILE * +open_test_stream (enum test_source_case f, enum test_stream_case s) +{ + int fd; + FILE *fp; + const char *fname; + + debug; + fname = prepare_test_file (f, s); + if (fname == NULL) + return NULL; + + switch (s) + { + case test_stream_stdin: + fp = xfopen (fname, "r"); + break; + + case test_stream_stdout: + fp = xfopen (fname, "w"); + break; + + case test_stream_stderr: + fp = xfopen (fname, "w"); + break; + + case test_stream_fopen_r: + fp = xfopen (fname, "r"); + break; + + case test_stream_fdopen_r: + if (test_fd == -1) + fd = xopen (fname, O_RDONLY, 0); + else + fd = test_fd; + fp = fdopen (fd, "r"); + break; + + case test_stream_fopen_w: + fp = xfopen (fname, "w"); + break; + + case test_stream_fdopen_w: + fd = xopen (fname, O_WRONLY|O_CREAT|O_TRUNC, 0777); + fp = fdopen (fd, "w"); + break; + + default: + abort (); + } + TEST_VERIFY_EXIT (fp != NULL); + + if (f == test_source_pseudo_terminal) + { + struct termios t; + /* We disable the NL to CR-LF conversion so that we can compare + data without having to remove the extra CRs. */ + if (tcgetattr (fileno (fp), &t) < 0) + FAIL_EXIT1 ("tcgetattr failed: %m"); + t.c_oflag &= ~ONLCR; + if (tcsetattr (fileno (fp), TCSANOW, &t) < 0) + FAIL_EXIT1 ("tcsetattr failed: %m"); + } + + debug; + printf ("source %s stream %s file %s fd %d\n", + test_source_name[f], + test_stream_name[s], fname, fileno (fp)); + return fp; +} + +#endif + +/*------------------------------------------------------------*/ + +/* These functions do the actual testing - setting various buffering + options and verifying that they buffer as expected. */ + +static void +test_put_string (FILE *fp, const char *s, int count) +{ + while (*s && count--) + { + fputc (*s++, fp); + TEST_VERIFY_EXIT (!ferror (fp)); + } +} + +int +verify_fully_buffered (FILE *fp, + enum test_source_case f, + enum test_stream_case s, + enum test_config_case c) +{ + debug; + if (test_stream_reads[s]) + { + char buf[10]; + dumpfp (fp); + size_t fc = fread (buf, 1, 10 - 1, fp); + dumpfp (fp); + + ssize_t count = fp->_IO_read_ptr - fp->_IO_read_base; + + TEST_VERIFY (fp->_IO_read_base != NULL); + if (f == test_source_dev_null) + { + TEST_VERIFY (fc == 0); + TEST_VERIFY (count == 0); + } + else if (f == test_source_pseudo_terminal) + { + TEST_VERIFY (fc == 9); + TEST_VERIFY (count == 3 || count == 10); + } + else + { + TEST_VERIFY (fc == 9); + TEST_VERIFY (count == 10); + } + + /* We already checked for the first character being 'a'. */ + if (count > 1) + { + TEST_COMPARE_BLOB (buf, count - 1, test_data + 1, count - 1); + TEST_COMPARE_BLOB (fp->_IO_read_base, count, test_data, count); + } + } + else + { + dumpfp (fp); + test_put_string (fp, test_data + 1, 10 - 1); + dumpfp (fp); + TEST_COMPARE (fp->_IO_write_ptr - fp->_IO_write_base, 10); + TEST_COMPARE_BLOB (fp->_IO_write_base, 10, test_data, 10); + } + + TEST_COMPARE ((fp->_flags & (_IO_UNBUFFERED | _IO_LINE_BUF)), 0); + if (c != test_config_none) + TEST_COMPARE (__fbufsize (fp), bufsize); + return 0; +} + +int +verify_line_buffered (FILE *fp, + enum test_source_case f, + enum test_stream_case s, + enum test_config_case c) +{ + debug; + /* "line buffered" for inputs is not really defined; what you really + want here is to control the device providing input. For GLIBC a + line-buffered input is treated as fully buffered. */ + if (test_stream_reads[s]) + { + char buf[10]; + dumpfp (fp); + size_t fc = fread (buf, 1, 10 - 1, fp); + dumpfp (fp); + + ssize_t count = fp->_IO_read_ptr - fp->_IO_read_base; + + TEST_VERIFY (fp->_IO_read_base != NULL); + if (f == test_source_dev_null) + { + TEST_VERIFY (fc == 0); + TEST_VERIFY (count == 0); + } + else if (f == test_source_pseudo_terminal) + { + TEST_VERIFY (fc == 9); + TEST_VERIFY (count == 3 || count == 10); + } + else + { + TEST_VERIFY (fc == 9); + TEST_VERIFY (count == 10); + } + + /* We already checked for the first character being 'a'. */ + if (count > 1) + { + TEST_COMPARE_BLOB (buf, count - 1, test_data + 1, count - 1); + TEST_COMPARE_BLOB (fp->_IO_read_base, count, test_data, count); + } + } + else + { + dumpfp (fp); + test_put_string (fp, test_data + 1, 10 - 1); + dumpfp (fp); + TEST_COMPARE (fp->_IO_write_ptr - fp->_IO_write_base, 3); + /* The first "abcdef\n" got flushed, leaving "abc". */ + TEST_COMPARE_BLOB (fp->_IO_write_base, 3, test_data + 7, 3); + } + + TEST_COMPARE ((fp->_flags & (_IO_UNBUFFERED | _IO_LINE_BUF)), _IO_LINE_BUF); + if (c != test_config_none) + TEST_COMPARE (__fbufsize (fp), bufsize); + return 0; +} + +int +verify_unbuffered (FILE *fp, + enum test_source_case f, + enum test_stream_case s, + enum test_config_case c) +{ + debug; + if (test_stream_reads[s]) + { + /* We've already read one byte. */ + dumpfp (fp); + TEST_VERIFY (fp->_IO_read_base != NULL); + if (f == test_source_dev_null) + TEST_COMPARE (fp->_IO_read_ptr - fp->_IO_read_base, 0); + else + { + TEST_COMPARE (fp->_IO_read_ptr - fp->_IO_read_base, 1); + TEST_COMPARE (fp->_IO_read_base[0], test_data[0]); + TEST_VERIFY (fp->_IO_read_ptr == fp->_IO_read_end); + } + } + else + { + dumpfp (fp); + fputc (test_data[1], fp); + dumpfp (fp); + TEST_COMPARE (fp->_IO_write_ptr - fp->_IO_write_base, 0); + TEST_COMPARE (fp->_IO_write_base[0], test_data[1]); + TEST_VERIFY (fp->_IO_write_end == fp->_IO_write_base); + } + TEST_COMPARE ((fp->_flags & (_IO_UNBUFFERED | _IO_LINE_BUF)), + _IO_UNBUFFERED); + TEST_COMPARE (__fbufsize (fp), 1); + return 0; +} + +static int +do_setvbuf (FILE *fp, void *buf, int flags, int size, + enum test_stream_case s) +{ + if (s != test_stream_stdout) + printf ("SETVBUF %p %p %s %d\n", + fp, buf, + flags == _IONBF ? "_IONBF" + : flags == _IOLBF ? "_IOLBF" + : flags == _IOFBF ? "_IOFBF" + : "???", size); + if (setvbuf (fp, buf, flags, size)) + { + perror ("setvbuf"); + return 1; + } + return 0; +} + +int +do_second_part (FILE *fp, + enum test_source_case f, + enum test_stream_case s, + enum test_config_case c) +{ + /* At this point, FP is the stream to test according to the other + parameters. */ + + int rv = 0; + int flags_before; + int flags_after; + + debug; + + flags_before = fp->_flags & (_IO_UNBUFFERED | _IO_LINE_BUF); + + /* This is where we do the thing we're testing for. */ + switch (c) + { + case test_config_none: + /* Buffering is unchanged. */ + break; + + case test_config_unbuffered: + do_setvbuf (fp, NULL, _IONBF, 0, s); + break; + + case test_config_line: + do_setvbuf (fp, buffer, _IOLBF, bufsize, s); + break; + + case test_config_fully: + do_setvbuf (fp, buffer, _IOFBF, bufsize, s); + break; + + default: + abort (); + } + + flags_after = fp->_flags & (_IO_UNBUFFERED | _IO_LINE_BUF); + + /* Check the buffer mode after we touch it, if we touched it. */ + switch (c) + { + case test_config_none: + /* Buffering is unchanged, but may change on the first read/write. */ + TEST_COMPARE (flags_after, flags_before); + break; + + case test_config_unbuffered: + TEST_COMPARE (flags_after, _IO_UNBUFFERED); + break; + + case test_config_line: + TEST_COMPARE (flags_after, _IO_LINE_BUF); + break; + + case test_config_fully: + TEST_COMPARE (flags_after, 0); + break; + + default: + abort (); + } + + /* Glibc defers calculating the appropriate buffering mechanism + until it reads from or writes to the device. So we read one + character here, and account for that in the tests. */ + if (test_stream_reads[s]) + { + dumpfp (fp); + int c = fgetc (fp); + if (c != TEST_STRING[0] && f != test_source_dev_null) + FAIL ("first char read is %c not %c", c, TEST_STRING[0]); + dumpfp (fp); + } + else + { + dumpfp (fp); + fputc (TEST_STRING[0], fp); + dumpfp (fp); + } + + switch (fp->_flags & (_IO_UNBUFFERED | _IO_LINE_BUF)) + { + case _IO_LINE_BUF: + rv += verify_line_buffered (fp, f, s, c); + break; + + case _IO_UNBUFFERED: + rv += verify_unbuffered (fp, f, s, c); + break; + + case 0: /* Fully buffered. */ + rv += verify_fully_buffered (fp, f, s, c); + break; + + default: + abort (); + } + + + xfclose (fp); + return rv; +} + +/*------------------------------------------------------------*/ + +#ifdef INDEPENDENT_PART +/* This part is the independent sub-process we call to test stdin et + al. */ + +int +main (int argc, char **argv) +{ + /* This is one of the subprocesses we created to test stdin et + al. */ + FILE *fp; + + /* If we're called as a regular test, instead of as a sub-process, + don't complain. */ + if (argc == 1) + return 0; + + if (argc != 4) + { + int i; + for (i = 0; i <= argc; i ++) + printf ("argv[%d] = `%s'\n", i, argv[i] ?: "(null)"); + FAIL_EXIT1 ("sub-process called wrong"); + } + + prepare_test_data (); + + enum test_source_case f = atoi (argv[1]); + enum test_stream_case s = atoi (argv[2]); + enum test_config_case c = atoi (argv[3]); + + if (s != test_stream_stdout) + printf ("\n\033[41mRunning test %s : %s : %s\033[0m\n", + test_source_name[f], + test_stream_name[s], + test_config_name[c]); + + switch (s) + { + case test_stream_stdin: + fp = stdin; + break; + case test_stream_stdout: + fp = stdout; + break; + case test_stream_stderr: + fp = stderr; + break; + default: + abort (); + } + + return do_second_part (fp, f, s, c); +} + +#else +/* This part is the standard test process. */ + +/* Spawn an independent sub-process with std* redirected. */ +int +recurse (FILE *fp, + enum test_source_case f, + enum test_stream_case s, + enum test_config_case c) +{ + /* We need to test stdin, stdout, or stderr, which means creating a + subprocess with one of those redirected from FP. */ + debug; + + pid_t pid; + int status; + + pid = fork (); + + switch (pid) + { + case -1: /* error */ + perror ("fork"); + return 1; + break; + + default: /* parent */ + xfclose (fp); + xwaitpid (pid, &status, 0); + if (WIFEXITED (status) + && WEXITSTATUS (status) == 0) + return 0; + return 1; + + case 0: /* child */ + switch (s) + { + case test_stream_stdin: + xclose (0); + dup2 (fileno (fp), 0); + break; + case test_stream_stdout: + xclose (1); + dup2 (fileno (fp), 1); + break; + case test_stream_stderr: + xclose (2); + dup2 (fileno (fp), 2); + break; + default: + abort (); + } + fclose (fp); + + /* At this point, we have to run a program... which is tricky to + properly support for remote targets or crosses, because of + glibc versions etc. Hence we run in a test-container. */ + + char fs[10], ss[10], cs[10]; + sprintf (fs, "%d", f); + sprintf (ss, "%d", s); + sprintf (cs, "%d", c); + execl (IND_PROC, IND_PROC, fs, ss, cs, NULL); + if (s == test_stream_stdout) + fprintf (stderr, "execl (%s) failed, ", IND_PROC); + else + printf ("execl (%s) failed, ", IND_PROC); + perror ("The error was"); + exit (1); + break; + } + + return 0; +} + +int +do_test (void) +{ + int rv = 0; + + signal (SIGPIPE, SIG_IGN); + + prepare_test_data (); + + for (enum test_source_case f = 0; f < test_source_count; ++f) + for (enum test_stream_case s = 0; s < test_stream_count; ++s) + for (enum test_config_case c = 0; c < test_config_count; ++c) + { + printf ("\n\033[43mRunning test %s : %s : %s\033[0m\n", + test_source_name[f], + test_stream_name[s], + test_config_name[c]); + + FILE *fp = open_test_stream (f, s); + + if (fp) + { + + if (s <= test_stream_stderr) + rv += recurse (fp, f, s, c); + else + rv += do_second_part (fp, f, s, c); + + unprepare_test_file (fp, f, s); + } + } + + free (buffer); + + printf ("return %d\n", rv); + return rv; +} + +# include <support/test-driver.c> +#endif + diff --git a/stdio-common/tst-sprintf-errno.c b/stdio-common/tst-sprintf-errno.c index e00c3fb..a0aa8b8 100644 --- a/stdio-common/tst-sprintf-errno.c +++ b/stdio-common/tst-sprintf-errno.c @@ -1,5 +1,5 @@ /* Test the %m, %#m printf specifiers via asprintf. - Copyright (C) 2021-2024 Free Software Foundation, Inc. + Copyright (C) 2021-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -24,7 +24,7 @@ /* GCC does not yet know about the %#m specifier. */ DIAG_PUSH_NEEDS_COMMENT; -DIAG_IGNORE_NEEDS_COMMENT (11, "-Wformat="); +DIAG_IGNORE_NEEDS_COMMENT_GCC (11, "-Wformat="); static int do_test (void) diff --git a/stdio-common/tst-sprintf3.c b/stdio-common/tst-sprintf3.c index 8189910..ffbe9a6 100644 --- a/stdio-common/tst-sprintf3.c +++ b/stdio-common/tst-sprintf3.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2012-2024 Free Software Foundation, Inc. +/* Copyright (C) 2012-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/tst-sscanf.c b/stdio-common/tst-sscanf.c index 3cf6567..a8fbd00 100644 --- a/stdio-common/tst-sscanf.c +++ b/stdio-common/tst-sscanf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2024 Free Software Foundation, Inc. +/* Copyright (C) 2000-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/tst-tmpnam.c b/stdio-common/tst-tmpnam.c index 6844c0f..b19cc07 100644 --- a/stdio-common/tst-tmpnam.c +++ b/stdio-common/tst-tmpnam.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1998-2024 Free Software Foundation, Inc. +/* Copyright (C) 1998-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/tst-unbputc.sh b/stdio-common/tst-unbputc.sh index 9fe4eee..537a3f9 100755 --- a/stdio-common/tst-unbputc.sh +++ b/stdio-common/tst-unbputc.sh @@ -1,6 +1,6 @@ #!/bin/sh # Testing the stdio implementation -# Copyright (C) 2000-2024 Free Software Foundation, Inc. +# Copyright (C) 2000-2025 Free Software Foundation, Inc. # This file is part of the GNU C Library. # The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/tst-ungetc-fflush.c b/stdio-common/tst-ungetc-fflush.c new file mode 100644 index 0000000..a86d1fd --- /dev/null +++ b/stdio-common/tst-ungetc-fflush.c @@ -0,0 +1,64 @@ +/* Test flushing input file after ungetc (bug 5994). + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <stdio.h> + +#include <support/check.h> +#include <support/temp_file.h> +#include <support/xstdio.h> +#include <support/xunistd.h> + +int +do_test (void) +{ + char *filename = NULL; + int fd = create_temp_file ("tst-ungetc-fflush", &filename); + TEST_VERIFY_EXIT (fd != -1); + xclose (fd); + + /* Test as in bug 5994. */ + FILE *fp = xfopen (filename, "w"); + TEST_VERIFY_EXIT (fputs ("#include", fp) >= 0); + xfclose (fp); + fp = xfopen (filename, "r"); + TEST_COMPARE (fgetc (fp), '#'); + TEST_COMPARE (fgetc (fp), 'i'); + TEST_COMPARE (ungetc ('@', fp), '@'); + TEST_COMPARE (fflush (fp), 0); + TEST_COMPARE (lseek (fileno (fp), 0, SEEK_CUR), 1); + TEST_COMPARE (fgetc (fp), 'i'); + TEST_COMPARE (fgetc (fp), 'n'); + xfclose (fp); + + /* Test as in bug 12799 (duplicate of 5994). */ + fp = xfopen (filename, "w+"); + TEST_VERIFY_EXIT (fputs ("hello world", fp) >= 0); + rewind (fp); + TEST_VERIFY (fileno (fp) >= 0); + char buffer[10]; + TEST_COMPARE (fread (buffer, 1, 5, fp), 5); + TEST_COMPARE (fgetc (fp), ' '); + TEST_COMPARE (ungetc ('@', fp), '@'); + TEST_COMPARE (fflush (fp), 0); + TEST_COMPARE (fgetc (fp), ' '); + xfclose (fp); + + return 0; +} + +#include <support/test-driver.c> diff --git a/stdio-common/tst-ungetc-leak.c b/stdio-common/tst-ungetc-leak.c new file mode 100644 index 0000000..6c5152b --- /dev/null +++ b/stdio-common/tst-ungetc-leak.c @@ -0,0 +1,32 @@ +/* Test for memory leak with ungetc when stream is unused. + Copyright The GNU Toolchain Authors. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <stdio.h> +#include <mcheck.h> +#include <support/check.h> +#include <support/support.h> + +static int +do_test (void) +{ + mtrace (); + TEST_COMPARE (ungetc('y', stdin), 'y'); + return 0; +} + +#include <support/test-driver.c> diff --git a/stdio-common/tst-ungetc-nomem.c b/stdio-common/tst-ungetc-nomem.c new file mode 100644 index 0000000..0872de6 --- /dev/null +++ b/stdio-common/tst-ungetc-nomem.c @@ -0,0 +1,121 @@ +/* Test ungetc behavior with malloc failures. + Copyright The GNU Toolchain Authors. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <dlfcn.h> +#include <stdio.h> +#include <string.h> +#include <support/check.h> +#include <support/support.h> +#include <support/temp_file.h> +#include <support/xstdio.h> + +static volatile bool fail = false; + +/* Induce a malloc failure whenever FAIL is set; we use the __LIBC_MALLOC entry + point to avoid the other alternative, which is RTLD_NEXT. */ +void * +malloc (size_t sz) +{ + if (fail) + return NULL; + + static void *(*real_malloc) (size_t); + + if (real_malloc == NULL) + real_malloc = dlsym (RTLD_NEXT, "malloc"); + + return real_malloc (sz); +} + +static int +do_test (void) +{ + char *filename = NULL; + struct stat props = {}; + size_t bufsz = 0; + + create_temp_file ("tst-ungetc-nomem.", &filename); + if (stat (filename, &props) != 0) + FAIL_EXIT1 ("Could not get file status: %m\n"); + + FILE *fp = fopen (filename, "w"); + + /* The libio buffer sizes are the same as block size. This is to ensure that + the test runs at the read underflow boundary as well. */ + bufsz = props.st_blksize + 2; + + char *buf = xmalloc (bufsz); + memset (buf, 'a', bufsz); + + if (fwrite (buf, sizeof (char), bufsz, fp) != bufsz) + FAIL_EXIT1 ("fwrite failed: %m\n"); + xfclose (fp); + + /* Begin test. */ + fp = xfopen (filename, "r"); + + while (!feof (fp)) + { + /* Reset the pushback buffer state. */ + fseek (fp, 0, SEEK_CUR); + + fail = true; + /* 1: First ungetc should always succeed, as the standard requires. */ + TEST_COMPARE (ungetc ('b', fp), 'b'); + + /* 2: This will result in resizing, which should fail. */ + TEST_COMPARE (ungetc ('c', fp), EOF); + + /* 3: Now allow the resizing, which should immediately fill up the buffer + too, since this allocates only double the current buffer, i.e. + 2-bytes. */ + fail = false; + TEST_COMPARE (ungetc ('d', fp), 'd'); + + /* 4: And fail again because this again forces an alloc, which fails. */ + fail = true; + TEST_COMPARE (ungetc ('e', fp), EOF); + + /* 5: Enable allocations again so that we now get a 4-byte buffer. Now + both calls should work. */ + fail = false; + TEST_COMPARE (ungetc ('f', fp), 'f'); + fail = true; + TEST_COMPARE (ungetc ('g', fp), 'g'); + + /* Drain out the x's. */ + TEST_COMPARE (fgetc (fp), 'g'); + TEST_COMPARE (fgetc (fp), 'f'); + TEST_COMPARE (fgetc (fp), 'd'); + + /* Finally, drain out the first char we had pushed back, followed by one + more char from the stream, if present. */ + TEST_COMPARE (fgetc (fp), 'b'); + char c = fgetc (fp); + if (!feof (fp)) + TEST_COMPARE (c, 'a'); + } + + /* Final sanity check before we're done. */ + TEST_COMPARE (ferror (fp), 0); + xfclose (fp); + + return 0; +} + +#include <support/test-driver.c> diff --git a/stdio-common/tst-ungetc.c b/stdio-common/tst-ungetc.c index 1344b2b..9629882 100644 --- a/stdio-common/tst-ungetc.c +++ b/stdio-common/tst-ungetc.c @@ -1,70 +1,74 @@ -/* Test for ungetc bugs. */ +/* Test for ungetc bugs. + Copyright (C) 1996-2025 Free Software Foundation, Inc. + Copyright The GNU Toolchain Authors. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ #include <stdio.h> #include <stdlib.h> -#include <unistd.h> - -#undef assert -#define assert(x) \ - if (!(x)) \ - { \ - fputs ("test failed: " #x "\n", stderr); \ - retval = 1; \ - goto the_end; \ - } +#include <support/check.h> +#include <support/support.h> +#include <support/temp_file.h> +#include <support/xstdio.h> +#include <support/xunistd.h> -int -main (int argc, char *argv[]) +static int +do_test (void) { - char name[] = "/tmp/tst-ungetc.XXXXXX"; + char *name = NULL; FILE *fp = NULL; - int retval = 0; int c; char buffer[64]; - int fd = mkstemp (name); + int fd = create_temp_file ("tst-ungetc.", &name); if (fd == -1) - { - printf ("mkstemp failed: %m\n"); - return 1; - } - close (fd); - fp = fopen (name, "w"); - assert (fp != NULL) - fputs ("bla", fp); - fclose (fp); - fp = NULL; + FAIL_EXIT1 ("cannot create temporary file: %m"); + xclose (fd); - fp = fopen (name, "r"); - assert (fp != NULL); - assert (ungetc ('z', fp) == 'z'); - assert (getc (fp) == 'z'); - assert (getc (fp) == 'b'); - assert (getc (fp) == 'l'); - assert (ungetc ('m', fp) == 'm'); - assert (getc (fp) == 'm'); - assert ((c = getc (fp)) == 'a'); - assert (getc (fp) == EOF); - assert (ungetc (c, fp) == c); - assert (feof (fp) == 0); - assert (getc (fp) == c); - assert (getc (fp) == EOF); - fclose (fp); - fp = NULL; + fp = xfopen (name, "w"); + fputs ("bla", fp); + xfclose (fp); - fp = fopen (name, "r"); - assert (fp != NULL); - assert (getc (fp) == 'b'); - assert (getc (fp) == 'l'); - assert (ungetc ('b', fp) == 'b'); - assert (fread (buffer, 1, 64, fp) == 2); - assert (buffer[0] == 'b'); - assert (buffer[1] == 'a'); + fp = xfopen (name, "r"); + TEST_VERIFY_EXIT (ungetc ('z', fp) == 'z'); + TEST_VERIFY_EXIT (getc (fp) == 'z'); + TEST_VERIFY_EXIT (getc (fp) == 'b'); + TEST_VERIFY_EXIT (getc (fp) == 'l'); + TEST_VERIFY_EXIT (ungetc ('m', fp) == 'm'); + TEST_VERIFY_EXIT (ungetc ('n', fp) == 'n'); + TEST_VERIFY_EXIT (getc (fp) == 'n'); + TEST_VERIFY_EXIT (getc (fp) == 'm'); + TEST_VERIFY_EXIT ((c = getc (fp)) == 'a'); + TEST_VERIFY_EXIT (getc (fp) == EOF); + TEST_VERIFY_EXIT (ungetc (c, fp) == c); + TEST_VERIFY_EXIT (feof (fp) == 0); + TEST_VERIFY_EXIT (getc (fp) == c); + TEST_VERIFY_EXIT (getc (fp) == EOF); + xfclose (fp); -the_end: - if (fp != NULL) - fclose (fp); - unlink (name); + fp = xfopen (name, "r"); + TEST_VERIFY_EXIT (getc (fp) == 'b'); + TEST_VERIFY_EXIT (getc (fp) == 'l'); + TEST_VERIFY_EXIT (ungetc ('b', fp) == 'b'); + TEST_VERIFY_EXIT (fread (buffer, 1, 64, fp) == 2); + TEST_VERIFY_EXIT (buffer[0] == 'b'); + TEST_VERIFY_EXIT (buffer[1] == 'a'); + xfclose (fp); - return retval; + return 0; } + +#include <support/test-driver.c> diff --git a/stdio-common/tst-unlockedio.c b/stdio-common/tst-unlockedio.c index 8ff6b07..09fbf05 100644 --- a/stdio-common/tst-unlockedio.c +++ b/stdio-common/tst-unlockedio.c @@ -1,5 +1,5 @@ /* Test for some *_unlocked stdio interfaces. - Copyright (C) 2004-2024 Free Software Foundation, Inc. + Copyright (C) 2004-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -32,7 +32,10 @@ static int do_test (void) { const char blah[] = "BLAH"; + DIAG_PUSH_NEEDS_COMMENT_CLANG; + DIAG_IGNORE_NEEDS_COMMENT_CLANG (3.4, "-Wgnu-folding-constant"); char buf[strlen (blah) + 1]; + DIAG_POP_NEEDS_COMMENT_CLANG; FILE *fp, *f; const char *cp; char *wp; @@ -51,6 +54,9 @@ do_test (void) fread_unlocked below as well. */ DIAG_PUSH_NEEDS_COMMENT; DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wdiv-by-zero"); + /* clang warns about the implicit conversion from double to size_t, + which is required by this tests. */ + DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wliteral-conversion"); if (ftello (fp) != 0 || fwrite_unlocked (blah, blah - blah, strlen (blah), f++) != 0 || f != fp + 1 @@ -104,6 +110,7 @@ do_test (void) /* See explanation above. */ DIAG_PUSH_NEEDS_COMMENT; DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wdiv-by-zero"); + DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wliteral-conversion"); if (ftello (fp) != 0 || fread_unlocked (buf, buf - buf, strlen (blah), f++) != 0 || f != fp + 1 diff --git a/stdio-common/tst-vfprintf-mbs-prec.c b/stdio-common/tst-vfprintf-mbs-prec.c index 63ebde9..81f9c4f 100644 --- a/stdio-common/tst-vfprintf-mbs-prec.c +++ b/stdio-common/tst-vfprintf-mbs-prec.c @@ -1,5 +1,5 @@ /* Test for wchar_t/multi-byte conversion and precision in vfprintf. - Copyright (C) 2017-2024 Free Software Foundation, Inc. + Copyright (C) 2017-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/tst-vfprintf-user-type.c b/stdio-common/tst-vfprintf-user-type.c index de2b9d1..3fc98b3 100644 --- a/stdio-common/tst-vfprintf-user-type.c +++ b/stdio-common/tst-vfprintf-user-type.c @@ -1,5 +1,5 @@ /* Test for user-defined types in vfprintf. - Copyright (C) 2017-2024 Free Software Foundation, Inc. + Copyright (C) 2017-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/tst-vfprintf-width-i18n.c b/stdio-common/tst-vfprintf-width-i18n.c index 1be6dd7..6d7fd8f 100644 --- a/stdio-common/tst-vfprintf-width-i18n.c +++ b/stdio-common/tst-vfprintf-width-i18n.c @@ -1,5 +1,5 @@ /* Test for width of non-ASCII digit sequences. - Copyright (C) 2022-2024 Free Software Foundation, Inc. + Copyright (C) 2022-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -23,6 +23,7 @@ #include <stdio.h> #include <support/support.h> #include <support/check.h> +#include <libc-diag.h> static int do_test (void) @@ -48,6 +49,9 @@ do_test (void) TEST_COMPARE_STRING (buf, " INR12,345.67"); /* Translated. */ + /* clang does not know about the GNU extension 'I'. */ + DIAG_PUSH_NEEDS_COMMENT_CLANG; + DIAG_IGNORE_NEEDS_COMMENT_CLANG (14, "-Wformat-invalid-specifier"); TEST_COMPARE (sprintf (buf, "%I16d", 12345), 16); TEST_COMPARE_STRING (buf, " १२३४५"); TEST_COMPARE (sprintf (buf, "%I12.2f", 12345.67), 26); @@ -58,6 +62,7 @@ do_test (void) TEST_COMPARE_STRING (buf, " १२,३४५"); TEST_COMPARE (sprintf (buf, "%'I12.2f", 12345.67), 26); TEST_COMPARE_STRING (buf, " १२,३४५.६७"); + DIAG_POP_NEEDS_COMMENT_CLANG; xsetlocale (LC_ALL, "ps_AF.UTF-8"); @@ -78,6 +83,8 @@ do_test (void) TEST_COMPARE_STRING (buf, " 12٬346 AFN"); /* Counts bytes. */ /* Translated. */ + DIAG_PUSH_NEEDS_COMMENT_CLANG; + DIAG_IGNORE_NEEDS_COMMENT_CLANG (14, "-Wformat-invalid-specifier"); TEST_COMPARE (sprintf (buf, "%I11d", 12345), 11); TEST_COMPARE_STRING (buf, " ١٢٣۴٥"); TEST_COMPARE (sprintf (buf, "%I12.2f", 12345.67), 20); @@ -88,6 +95,7 @@ do_test (void) TEST_COMPARE_STRING (buf, " ١٢٬٣۴٥"); TEST_COMPARE (sprintf (buf, "%'I12.2f", 12345.67), 21); TEST_COMPARE_STRING (buf, " ١٢٬٣۴٥٫٦٧"); + DIAG_POP_NEEDS_COMMENT_CLANG; return 0; } diff --git a/stdio-common/tst-vfprintf-width-prec-alloc.c b/stdio-common/tst-vfprintf-width-prec-alloc.c index a7c9b9c..1ff7653 100644 --- a/stdio-common/tst-vfprintf-width-prec-alloc.c +++ b/stdio-common/tst-vfprintf-width-prec-alloc.c @@ -1,5 +1,5 @@ /* Test large width or precision does not involve large allocation. - Copyright (C) 2020-2024 Free Software Foundation, Inc. + Copyright (C) 2020-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/tst-vfprintf-width-prec.c b/stdio-common/tst-vfprintf-width-prec.c index e4f2dfd..61f154a 100644 --- a/stdio-common/tst-vfprintf-width-prec.c +++ b/stdio-common/tst-vfprintf-width-prec.c @@ -1,5 +1,5 @@ /* Test for memory leak with large width and precision. - Copyright (C) 1991-2024 Free Software Foundation, Inc. + Copyright (C) 1991-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/tstgetln.c b/stdio-common/tstgetln.c index b2e8263..0b5c2be 100644 --- a/stdio-common/tstgetln.c +++ b/stdio-common/tstgetln.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1992-2024 Free Software Foundation, Inc. +/* Copyright (C) 1992-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -16,6 +16,7 @@ <https://www.gnu.org/licenses/>. */ #include <stdio.h> +#include <libc-diag.h> int main (int argc, char *argv[]) @@ -26,7 +27,12 @@ main (int argc, char *argv[]) while ((len = getline (&buf, &size, stdin)) != -1) { + /* clang do not handle %Z format. */ + DIAG_PUSH_NEEDS_COMMENT_CLANG; + DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wformat-invalid-specifier"); + DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wformat-extra-args"); printf ("bufsize %Zu; read %Zd: ", size, len); + DIAG_POP_NEEDS_COMMENT_CLANG; if (fwrite (buf, len, 1, stdout) != 1) { perror ("fwrite"); diff --git a/stdio-common/tstscanf.c b/stdio-common/tstscanf.c index 80c3cf8..f70319d 100644 --- a/stdio-common/tstscanf.c +++ b/stdio-common/tstscanf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2024 Free Software Foundation, Inc. +/* Copyright (C) 1991-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -151,7 +151,7 @@ main (int argc, char **argv) { 2, -12.8F, "degrees", "" }, { 0, 0.0F, "", "" }, { 3, 10.0F, "LBS", "fertilizer" }, - { 3, 100.0F, "rgs", "energy" }, + { 0, 0.0F, "", "" }, { -1, 0.0F, "", "" }}; size_t rounds = 0; float quant; diff --git a/stdio-common/vfprintf-internal.c b/stdio-common/vfprintf-internal.c index 771beca..fa41e1b 100644 --- a/stdio-common/vfprintf-internal.c +++ b/stdio-common/vfprintf-internal.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2024 Free Software Foundation, Inc. +/* Copyright (C) 1991-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -576,7 +576,8 @@ static const uint8_t jump_table[] = /* Handle positional format specifiers. */ static void printf_positional (struct Xprintf_buffer *buf, - const CHAR_T *format, int readonly_format, + const CHAR_T *format, + enum readonly_error_type readonly_format, va_list ap, va_list *ap_savep, int nspecs_done, const UCHAR_T *lead_str_end, CHAR_T *work_buffer, int save_errno, @@ -626,9 +627,7 @@ Xprintf_buffer (struct Xprintf_buffer *buf, const CHAR_T *format, /* For the %m format we may need the current `errno' value. */ int save_errno = errno; - /* 1 if format is in read-only memory, -1 if it is in writable memory, - 0 if unknown. */ - int readonly_format = 0; + enum readonly_error_type readonly_format = readonly_noerror; /* Initialize local variables. */ grouping = (const char *) -1; @@ -1045,7 +1044,7 @@ do_positional: static void printf_positional (struct Xprintf_buffer * buf, const CHAR_T *format, - int readonly_format, + enum readonly_error_type readonly_format, va_list ap, va_list *ap_savep, int nspecs_done, const UCHAR_T *lead_str_end, CHAR_T *work_buffer, int save_errno, diff --git a/stdio-common/vfprintf-process-arg.c b/stdio-common/vfprintf-process-arg.c index af6b570..90b5e61 100644 --- a/stdio-common/vfprintf-process-arg.c +++ b/stdio-common/vfprintf-process-arg.c @@ -1,5 +1,5 @@ /* Argument-processing fragment for vfprintf. - Copyright (C) 1991-2024 Free Software Foundation, Inc. + Copyright (C) 1991-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -324,16 +324,24 @@ LABEL (form_pointer): LABEL (form_number): if ((mode_flags & PRINTF_FORTIFY) != 0) { - if (! readonly_format) - { - extern int __readonly_area (const void *, size_t) - attribute_hidden; - readonly_format - = __readonly_area (format, ((STR_LEN (format) + 1) - * sizeof (CHAR_T))); - } - if (readonly_format < 0) - __libc_fatal ("*** %n in writable segment detected ***\n"); + if (readonly_format == readonly_noerror) + readonly_format = __readonly_area (format, ((STR_LEN (format) + 1) + * sizeof (CHAR_T))); + switch (readonly_format) + { + case readonly_area_writable: + __libc_fatal ("*** %n in writable segments detected ***\n"); + /* The format is not within ELF segments and opening /proc/self/maps + failed because there are too many files. */ + case readonly_procfs_open_fail: + __libc_fatal ("*** procfs could not open ***\n"); + /* The /proc/self/maps can not be opened either because it is not + available or the process does not have the right permission. Since + it should not be attacker-controlled we can avoid failure. */ + case readonly_procfs_inaccessible: + case readonly_noerror: + break; + } } /* Answer the count of characters written. */ void *ptrptr = process_arg_pointer (); diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c index 77d32a5..1c23aef 100644 --- a/stdio-common/vfprintf.c +++ b/stdio-common/vfprintf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2024 Free Software Foundation, Inc. +/* Copyright (C) 1991-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/vfscanf-internal.c b/stdio-common/vfscanf-internal.c index 1b82def..86ae501 100644 --- a/stdio-common/vfscanf-internal.c +++ b/stdio-common/vfscanf-internal.c @@ -1,5 +1,5 @@ /* Internal functions for the *scanf* implementation. - Copyright (C) 1991-2024 Free Software Foundation, Inc. + Copyright (C) 1991-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -1463,22 +1463,24 @@ __vfscanf_internal (FILE *s, const char *format, va_list argptr, /* Look for a leading indication of base. */ if (width != 0 && c == L_('0')) { + WINT_T ctmp = c; + if (width > 0) --width; - - char_buffer_add (&charbuf, c); c = inchar (); - if (width != 0 && TOLOWER (c) == L_('x')) + if (width != 0 + && TOLOWER (c) == L_('x') + && (base == 0 || base == 16)) { - if (base == 0) - base = 16; - if (base == 16) - { - if (width > 0) - --width; - c = inchar (); - } + base = 16; + if (width > 0) + --width; + /* If we try to read a number in hexadecimal notation + and we have only the `0x' prefix, this is an error. */ + if (width == 0) + conv_error (); + c = inchar (); } else if (width != 0 && TOLOWER (c) == L_('b') @@ -1489,10 +1491,18 @@ __vfscanf_internal (FILE *s, const char *format, va_list argptr, base = 2; if (width > 0) --width; + /* If we try to read a number in binary notation and + we have only the `0b' prefix, this is an error. */ + if (width == 0) + conv_error (); c = inchar (); } - else if (base == 0) - base = 8; + else + { + if (base == 0) + base = 8; + char_buffer_add (&charbuf, ctmp); + } } if (base == 0) @@ -1727,7 +1737,7 @@ __vfscanf_internal (FILE *s, const char *format, va_list argptr, #endif } - if (n < 10) + if (n < num_digits_len) { /* Found it. */ from_level = level; @@ -2028,7 +2038,51 @@ digits_extended_fail: if (width > 0) --width; char_buffer_add (&charbuf, c); - /* It is "nan". */ + /* It is at least "nan". Now we check for nan() and + nan(n-char-sequence). */ + if (width != 0 && inchar () != EOF) + { + if (c == L_('(')) + { + if (width > 0) + --width; + char_buffer_add (&charbuf, c); + /* A '(' was observed, check for a closing ')', there + may or may not be a n-char-sequence in between. We + have to check the longest prefix until there is a + conversion error or closing parenthesis. */ + do + { + if (__glibc_unlikely (width == 0 + || inchar () == EOF)) + { + /* Conversion error because we ran out of + characters. */ + conv_error (); + break; + } + if (!((c >= L_('0') && c <= L_('9')) + || (c >= L_('A') && c <= L_('Z')) + || (c >= L_('a') && c <= L_('z')) + || c == L_('_') || c == L_(')'))) + { + /* Invalid character was observed. Only valid + characters are [a-zA-Z0-9_] and ')'. */ + conv_error (); + break; + } + if (width > 0) + --width; + char_buffer_add (&charbuf, c); + } + while (c != L_(')')); + /* The loop only exits successfully when ')' is the + last character. */ + } + else + /* It is only 'nan'. */ + ungetc (c, s); + } goto scan_float; } else if (TOLOWER (c) == L_('i')) @@ -2101,8 +2155,13 @@ digits_extended_fail: c = inchar (); if (width > 0) --width; - if (width != 0 && TOLOWER (c) == L_('x')) + if (TOLOWER (c) == L_('x')) { + /* If we try to read a number in hexadecimal notation + and we have only the `0x' prefix, this is an error. */ + if (width == 0) + conv_error (); + /* It is a number in hexadecimal format. */ char_buffer_add (&charbuf, c); @@ -2145,6 +2204,7 @@ digits_extended_fail: { char_buffer_add (&charbuf, exp_char); got_e = got_dot = 1; + got_digit = 0; } else { @@ -2365,7 +2425,7 @@ digits_extended_fail: if (got_e && charbuf.current[-1] == exp_char && (c == L_('-') || c == L_('+'))) char_buffer_add (&charbuf, c); - else if (char_buffer_size (&charbuf) > got_sign && !got_e + else if (got_digit && !got_e && (CHAR_T) TOLOWER (c) == exp_char) { char_buffer_add (&charbuf, exp_char); @@ -2382,7 +2442,10 @@ digits_extended_fail: if (c == wcdigits[n]) { if (n < 10) - char_buffer_add (&charbuf, L_('0') + n); + { + char_buffer_add (&charbuf, L_('0') + n); + got_digit = 1; + } else if (n == 11 && !got_dot) { char_buffer_add (&charbuf, decimal); @@ -2417,7 +2480,10 @@ digits_extended_fail: width = avail; if (n < 10) - char_buffer_add (&charbuf, L_('0') + n); + { + char_buffer_add (&charbuf, L_('0') + n); + got_digit = 1; + } else if (n == 11 && !got_dot) { /* Add all the characters. */ @@ -2488,11 +2554,13 @@ digits_extended_fail: /* Have we read any character? If we try to read a number in hexadecimal notation and we have read only the `0x' - prefix this is an error. */ + prefix this is an error. Also it is an error where we + have read no digits after the exponent character. */ if (__glibc_unlikely (char_buffer_size (&charbuf) == got_sign || ((flags & HEXA_FLOAT) && (char_buffer_size (&charbuf) - == 2 + got_sign)))) + == 2 + got_sign))) + || (got_e && !got_digit)) conv_error (); scan_float: diff --git a/stdio-common/vfscanf.c b/stdio-common/vfscanf.c index c25cfff..1a05ac5 100644 --- a/stdio-common/vfscanf.c +++ b/stdio-common/vfscanf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2024 Free Software Foundation, Inc. +/* Copyright (C) 1991-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/vfwprintf.c b/stdio-common/vfwprintf.c index ed8841c..b037f18 100644 --- a/stdio-common/vfwprintf.c +++ b/stdio-common/vfwprintf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2024 Free Software Foundation, Inc. +/* Copyright (C) 1991-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/vfwscanf.c b/stdio-common/vfwscanf.c index 2ce4ccd..261512f 100644 --- a/stdio-common/vfwscanf.c +++ b/stdio-common/vfwscanf.c @@ -1,5 +1,5 @@ /* Implementation and symbols for vfwscanf. - Copyright (C) 2018-2024 Free Software Foundation, Inc. + Copyright (C) 2018-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/vprintf.c b/stdio-common/vprintf.c index f838eed..9505db5 100644 --- a/stdio-common/vprintf.c +++ b/stdio-common/vprintf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2024 Free Software Foundation, Inc. +/* Copyright (C) 1991-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/wprintf_buffer_as_file.c b/stdio-common/wprintf_buffer_as_file.c index 142dec4..2db38c5 100644 --- a/stdio-common/wprintf_buffer_as_file.c +++ b/stdio-common/wprintf_buffer_as_file.c @@ -1,5 +1,5 @@ /* FILE * interface to a struct __wprintf_buffer. Wide version. - Copyright (C) 2022-2024 Free Software Foundation, Inc. + Copyright (C) 2022-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/wprintf_buffer_done.c b/stdio-common/wprintf_buffer_done.c index 1dcaa10..f93cfa7 100644 --- a/stdio-common/wprintf_buffer_done.c +++ b/stdio-common/wprintf_buffer_done.c @@ -1,5 +1,5 @@ /* Final status reporting for struct __wprintf_buffer. Wide version. - Copyright (C) 2022-2024 Free Software Foundation, Inc. + Copyright (C) 2022-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/wprintf_buffer_flush.c b/stdio-common/wprintf_buffer_flush.c index 98c3313..24e41b5 100644 --- a/stdio-common/wprintf_buffer_flush.c +++ b/stdio-common/wprintf_buffer_flush.c @@ -1,5 +1,5 @@ /* Flush a struct __wprintf_buffer. Wide version. - Copyright (C) 2022-2024 Free Software Foundation, Inc. + Copyright (C) 2022-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/wprintf_buffer_pad_1.c b/stdio-common/wprintf_buffer_pad_1.c index 31709ee..262a0d1 100644 --- a/stdio-common/wprintf_buffer_pad_1.c +++ b/stdio-common/wprintf_buffer_pad_1.c @@ -1,5 +1,5 @@ /* Write repeated characters to struct __wprintf_buffer. Wide version. - Copyright (C) 2022-2024 Free Software Foundation, Inc. + Copyright (C) 2022-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/wprintf_buffer_putc_1.c b/stdio-common/wprintf_buffer_putc_1.c index 85e1ded..c3284f1 100644 --- a/stdio-common/wprintf_buffer_putc_1.c +++ b/stdio-common/wprintf_buffer_putc_1.c @@ -1,5 +1,5 @@ /* Overflow character write function for struct __wprintf_buffer. Wide version. - Copyright (C) 2022-2024 Free Software Foundation, Inc. + Copyright (C) 2022-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/wprintf_buffer_puts_1.c b/stdio-common/wprintf_buffer_puts_1.c index 0c947a9..0b264f0 100644 --- a/stdio-common/wprintf_buffer_puts_1.c +++ b/stdio-common/wprintf_buffer_puts_1.c @@ -1,5 +1,5 @@ /* String write function struct __wprintf_buffer. Wide version. - Copyright (C) 2022-2024 Free Software Foundation, Inc. + Copyright (C) 2022-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/wprintf_buffer_to_file.c b/stdio-common/wprintf_buffer_to_file.c index 6325a9a..767243d 100644 --- a/stdio-common/wprintf_buffer_to_file.c +++ b/stdio-common/wprintf_buffer_to_file.c @@ -1,5 +1,5 @@ /* Wide printf buffers writing data to a FILE *. - Copyright (C) 2022-2024 Free Software Foundation, Inc. + Copyright (C) 2022-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/wprintf_buffer_write.c b/stdio-common/wprintf_buffer_write.c index aca28a7..fef9a94 100644 --- a/stdio-common/wprintf_buffer_write.c +++ b/stdio-common/wprintf_buffer_write.c @@ -1,5 +1,5 @@ /* Blob write function for struct __wprintf_buffer. Wide version. - Copyright (C) 2022-2024 Free Software Foundation, Inc. + Copyright (C) 2022-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/stdio-common/wprintf_function_invoke.c b/stdio-common/wprintf_function_invoke.c index 9618b0b..654f945 100644 --- a/stdio-common/wprintf_function_invoke.c +++ b/stdio-common/wprintf_function_invoke.c @@ -1,5 +1,5 @@ /* Invoke a printf specifier handler. Wide version. - Copyright (C) 2022-2024 Free Software Foundation, Inc. + Copyright (C) 2022-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or |