https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52952

--- Comment #53 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
(In reply to Manuel López-Ibáñez from comment #51)
> 2. Locations within strings expanded from a macro

(2) should also be fixed for gcc 9 by r264887:

/tmp/foo.c: In function ‘foo’:
/tmp/foo.c:2:25: warning: format ‘%d’ expects argument of type ‘int’, but
argument 2 has type ‘double’ [-Wformat=]
2 | #define c               " %d %d "
  |                         ^~~~~~~~~
/tmp/foo.c:3:20: note: in expansion of macro ‘c’
3 |   __builtin_printf(c, 0.5, 0);
  |                    ^
/tmp/foo.c:2:28: note: format string is defined here
2 | #define c               " %d %d "
  |                           ~^
  |                            |
  |                            int
  |                           %f
/tmp/foo.c:6:20: warning: format ‘%d’ expects argument of type ‘int’, but
argument 2 has type ‘double’ [-Wformat=]
6 |   __builtin_printf(a, 0.5);
  |                    ^  ~~~
  |                       |
  |                       double

(same output for both C and C++)

> 3. Location within strings from a const char array.

(3) isn't yet fixed, as can be seen above.

Reply via email to