This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Joseph Myers wrote:
+ /* GCC in C99 mode treats %a as the C99 format expecting float *, + but glibc with _GNU_SOURCE treats %as as the GNU allocation + extension, so resulting in "warning: format '%a' expects argument + of type 'float *', but argument 3 has type 'char **'". This + applies to the other %as, %aS and %a[] formats below as well. */ + DIAG_PUSH_NEEDS_COMMENT; + DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wformat"); if (sscanf (" 1.25s x", "%as%2c", &sp, c) != 2) FAIL (); else @@ -32,10 +40,14 @@ main (void) memset (sp, 'x', sizeof "1.25s"); free (sp); } + DIAG_POP_NEEDS_COMMENT;
This sort of thing looks intrusive. Instead, how about defining a macro 'C99_sscanf' that does the push and pop and commentary, and then simply replacing warned-about uses of sscanf with C99_scanf? That'd be a lot easier to read, and it's more along the lines of Roland's original suggestion.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |