https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80036
Bug ID: 80036 Summary: Source line not printed for diagnostic if expanded from a macro Product: gcc Version: 7.0.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: joriswu at gmail dot com Target Milestone: --- If a diagnostic is printed for code that expands from a macro, and the macro is defined in a header file, the source line is not shown. Only the include stack is : macros.h: extern void print_it(const char *fmt, int i); #define print_int(x) print_it("%d",(x)) code.c: #include "macros.h" void test(void) { int unint; print_int(uninit); } gcc -c -Wall test.c In file included from test.c:1:0: test.c: In function 'test': macros.h:1:22: warning: 'uninit' is used uninitialized in this function [-Wuninitialized] #define print_int(x) print_it("%d",(x)) ^~~~~~~~ test.c:7:7: note: 'uninit' was declared here int uninit; ^~~~~~ so the offending line print_int() is not shown.