]> git.ipfire.org Git - thirdparty/glibc.git/blob - stdio-common/scanf7.c
Refer to C23 in place of C2X in glibc
[thirdparty/glibc.git] / stdio-common / scanf7.c
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <libc-diag.h>
4
5 int
6 main (int argc, char *argv[])
7 {
8 long long int n;
9 int ret;
10
11 n = -1;
12 ret = sscanf ("1000", "%lld", &n);
13 printf ("%%lld: ret: %d, n: %Ld\n", ret, n);
14 if (ret != 1 || n != 1000L)
15 abort ();
16
17 n = -2;
18
19 /* We are testing a corner case of the scanf format string here. */
20 DIAG_PUSH_NEEDS_COMMENT;
21 DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wformat");
22 DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wformat-extra-args");
23
24 ret = sscanf ("1000", "%llld", &n);
25
26 DIAG_POP_NEEDS_COMMENT;
27
28 printf ("%%llld: ret: %d, n: %Ld\n", ret, n);
29 if (ret > 0 || n >= 0L)
30 abort ();
31
32 return 0;
33 }