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

            Bug ID: 78425
           Summary: Atrtibute warning message location incorrect
           Product: gcc
           Version: 6.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: suckfish at ihug dot co.nz
  Target Milestone: ---

The following C++ code produces a warning message, but the location given for
the warning message is not right.  (gcc claims it comes from the expansion of
the macro GOOD.  In fact it comes from the expansion of BAD).
-----------
#define BAD [[notreturn]]
#define GOOD __attribute__((format(printf,1,2)))
void foo BAD (const char * fmt, ...) GOOD;
-----------
$ gcc -c temp.cc 
temp.cc:2:48: warning: ‘notreturn’ attribute directive ignored [-Wattributes]
 #define GOOD __attribute__((format(printf,1,2)))
                                                ^
temp.cc:4:38: note: in expansion of macro ‘GOOD’
 void foo BAD (const char * fmt, ...) GOOD;
                                      ^~~~
$ gcc --version
gcc (GCC) 6.2.1 20160916 (Red Hat 6.2.1-2)

Reply via email to