about summary refs log tree commit diff
path: root/wcsmbs
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2023-09-28 17:27:58 +0000
committerJoseph Myers <joseph@codesourcery.com>2023-09-28 17:28:15 +0000
commitcdbf8229bb1438998b211e4760a97d94a13674d4 (patch)
treec3253d92a5c54051f664dcee3c64372df858f741 /wcsmbs
parentaea4ddb87168d0475777e605f3bb576b0f62b3a2 (diff)
downloadglibc-cdbf8229bb1438998b211e4760a97d94a13674d4.tar.gz
glibc-cdbf8229bb1438998b211e4760a97d94a13674d4.tar.xz
glibc-cdbf8229bb1438998b211e4760a97d94a13674d4.zip
C2x scanf %wN, %wfN support
ISO C2x defines scanf length modifiers wN (for intN_t / int_leastN_t /
uintN_t / uint_leastN_t) and wfN (for int_fastN_t / uint_fastN_t).
Add support for those length modifiers, similar to the printf support
previously added.

Tested for x86_64 and x86.
Diffstat (limited to 'wcsmbs')
-rw-r--r--wcsmbs/Makefile1
-rw-r--r--wcsmbs/tst-wscanf-intn.c24
2 files changed, 25 insertions, 0 deletions
diff --git a/wcsmbs/Makefile b/wcsmbs/Makefile
index 431136b9c9..cde9a3221e 100644
--- a/wcsmbs/Makefile
+++ b/wcsmbs/Makefile
@@ -196,6 +196,7 @@ tests := \
   tst-wscanf-binary-c2x \
   tst-wscanf-binary-gnu11 \
   tst-wscanf-binary-gnu89 \
+  tst-wscanf-intn \
   tst-wscanf-to_inpunct \
   wcsatcliff \
   wcsmbs-tst1 \
diff --git a/wcsmbs/tst-wscanf-intn.c b/wcsmbs/tst-wscanf-intn.c
new file mode 100644
index 0000000000..8b6e6d3c0e
--- /dev/null
+++ b/wcsmbs/tst-wscanf-intn.c
@@ -0,0 +1,24 @@
+/* Test scanf formats for intN_t, int_leastN_t and int_fastN_t types.
+   Wide string version.
+   Copyright (C) 2023 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have 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 SSCANF swscanf
+#define STRLEN wcslen
+#define L_(C) L ## C
+
+#include "../stdio-common/tst-scanf-intn-main.c"