| lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 1 | #include <stdio.h> | 
|  | 2 | #include <libc-internal.h> | 
|  | 3 |  | 
|  | 4 | static int | 
|  | 5 | do_test (void) | 
|  | 6 | { | 
|  | 7 | static const char buf[] = " "; | 
|  | 8 | char *str; | 
|  | 9 |  | 
|  | 10 | /* GCC in C99 mode treats %a as the C99 format expecting float *, | 
|  | 11 | but glibc with _GNU_SOURCE treats %as as the GNU allocation | 
|  | 12 | extension, so resulting in "warning: format '%a' expects argument | 
|  | 13 | of type 'float *', but argument 3 has type 'char **'".  This | 
|  | 14 | applies to the other %as, %aS and %a[] formats below as well.  */ | 
|  | 15 | DIAG_PUSH_NEEDS_COMMENT; | 
|  | 16 | DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wformat"); | 
|  | 17 | int r = sscanf (buf, "%as", &str); | 
|  | 18 | DIAG_POP_NEEDS_COMMENT; | 
|  | 19 | printf ("%d %p\n", r, str); | 
|  | 20 |  | 
|  | 21 | return r != -1 || str != NULL; | 
|  | 22 | } | 
|  | 23 |  | 
|  | 24 | #define TEST_FUNCTION do_test () | 
|  | 25 | #include "../test-skeleton.c" |