about summary refs log tree commit diff
path: root/wcsmbs/Makefile
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2023-03-02 19:10:37 +0000
committerJoseph Myers <joseph@codesourcery.com>2023-03-02 19:10:37 +0000
commitdee2bea048b688b643a9a3b44b26ca9f7a706fe8 (patch)
tree3e7cd1057154850968d13023bc2e082cfc7940ad /wcsmbs/Makefile
parent51aeab9a363a0d000d0912aa3d6490463a26fba2 (diff)
downloadglibc-dee2bea048b688b643a9a3b44b26ca9f7a706fe8.tar.gz
glibc-dee2bea048b688b643a9a3b44b26ca9f7a706fe8.tar.xz
glibc-dee2bea048b688b643a9a3b44b26ca9f7a706fe8.zip
C2x scanf binary constant handling
C2x adds binary integer constants starting with 0b or 0B, and supports
those constants for the %i scanf format (in addition to the %b format,
which isn't yet implemented for scanf in glibc).  Implement that scanf
support for glibc.

As with the strtol support, this is incompatible with previous C
standard versions, in that such an input string starting with 0b or 0B
was previously required to be parsed as 0 (with the rest of the input
potentially matching subsequent parts of the scanf format string).
Thus this patch adds 12 new __isoc23_* functions per long double
format (12, 24 or 36 depending on how many long double formats the
glibc configuration supports), with appropriate header redirection
support (generally very closely following that for the __isoc99_*
scanf functions - note that __GLIBC_USE (DEPRECATED_SCANF) takes
precedence over __GLIBC_USE (C2X_STRTOL), so the case of GNU
extensions to C89 continues to get old-style GNU %a and does not get
this new feature).  The function names would remain as __isoc23_* even
if C2x ends up published in 2024 rather than 2023.

When scanf %b support is added, I think it will be appropriate for all
versions of scanf to follow C2x rules for inputs to the %b format
(given that there are no compatibility concerns for a new format).

Tested for x86_64 (full glibc testsuite).  The first version was also
tested for powerpc (32-bit) and powerpc64le (stdio-common/ and wcsmbs/
tests), and with build-many-glibcs.py.
Diffstat (limited to 'wcsmbs/Makefile')
-rw-r--r--wcsmbs/Makefile16
1 files changed, 15 insertions, 1 deletions
diff --git a/wcsmbs/Makefile b/wcsmbs/Makefile
index 16ece4c110..b12a3b0750 100644
--- a/wcsmbs/Makefile
+++ b/wcsmbs/Makefile
@@ -43,6 +43,8 @@ routines := wcscat wcschr wcscmp wcscpy wcscspn wcsdup wcslen wcsncat \
 	    wcsmbsload mbsrtowcs_l \
 	    isoc99_wscanf isoc99_vwscanf isoc99_fwscanf isoc99_vfwscanf \
 	    isoc99_swscanf isoc99_vswscanf \
+	    isoc23_wscanf isoc23_vwscanf isoc23_fwscanf isoc23_vfwscanf \
+	    isoc23_swscanf isoc23_vswscanf \
 	    mbrtoc8 c8rtomb mbrtoc16 c16rtomb mbrtoc32 c32rtomb
 
 strop-tests :=  wcscmp wcsncmp wmemcmp wcslen wcschr wcsrchr wcscpy wcsnlen \
@@ -59,7 +61,11 @@ tests := tst-wcstof wcsmbs-tst1 tst-wcsnlen tst-btowc tst-mbrtowc \
 	 tst-wcstol-binary-c11 \
 	 tst-wcstol-binary-c2x \
 	 tst-wcstol-binary-gnu11 \
-	 tst-wcstol-binary-gnu2x
+	 tst-wcstol-binary-gnu2x \
+	 tst-wscanf-binary-c11 \
+	 tst-wscanf-binary-c2x \
+	 tst-wscanf-binary-gnu11 \
+	 tst-wscanf-binary-gnu89
 
 include ../Rules
 
@@ -118,6 +124,10 @@ CFLAGS-isoc99_wscanf.c += -fexceptions
 CFLAGS-isoc99_fwscanf.c += -fexceptions
 CFLAGS-isoc99_vwscanf.c += -fexceptions
 CFLAGS-isoc99_vfwscanf.c += -fexceptions
+CFLAGS-isoc23_wscanf.c += -fexceptions
+CFLAGS-isoc23_fwscanf.c += -fexceptions
+CFLAGS-isoc23_vwscanf.c += -fexceptions
+CFLAGS-isoc23_vfwscanf.c += -fexceptions
 
 CPPFLAGS += $(libio-mtsafe)
 
@@ -134,3 +144,7 @@ CFLAGS-tst-wcstol-binary-c11.c += -std=c11
 CFLAGS-tst-wcstol-binary-c2x.c += -std=c11
 CFLAGS-tst-wcstol-binary-gnu11.c += -std=gnu11
 CFLAGS-tst-wcstol-binary-gnu2x.c += -std=gnu11
+CFLAGS-tst-wscanf-binary-c11.c += -std=c11 -DOBJPFX=\"$(objpfx)\"
+CFLAGS-tst-wscanf-binary-c2x.c += -std=c11 -DOBJPFX=\"$(objpfx)\"
+CFLAGS-tst-wscanf-binary-gnu11.c += -std=gnu11 -DOBJPFX=\"$(objpfx)\"
+CFLAGS-tst-wscanf-binary-gnu89.c += -std=gnu89 -DOBJPFX=\"$(objpfx)\"