This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC 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]

[Bug c/77331] incorrect range location in -Wformat with a concatenated format literal


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

Michał Mirosław <mirq-gccboogs at rere dot qmqm.pl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mirq-gccboogs at rere dot qmqm.pl

--- Comment #1 from Michał Mirosław <mirq-gccboogs at rere dot qmqm.pl> ---
This looks similar (related to PR#52952?): when showing error for concatenated
format string, caret does not point to the triggering format.

void foo(const char *fmt, ...) __attribute__((format(printf, 1, 2)));

#define PREFIX "a:"
#define A(fmt, args...) foo(PREFIX fmt ".", ##args)

void bar()
{
        A("%");
}

$ arm-linux-gnueabihf-gcc-7 -fsyntax-only -Wformat foo.c 

foo.c: In function ‘bar’:
foo.c:3:16: warning: conversion lacks type at end of format [-Wformat=]
 #define PREFIX "a:"
                ^
foo.c:4:29: note: in expansion of macro ‘PREFIX’
 #define A(fmt, args...) foo(PREFIX fmt ".", ##args)
                             ^~~~~~
foo.c:8:2: note: in expansion of macro ‘A’
  A("%");
  ^
foo.c:4:41: note: format string is defined here
 #define A(fmt, args...) foo(PREFIX fmt ".", ##args)
                                         ^

The same happens with gcc-6.3.0.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]