https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98021
--- Comment #11 from eggert at cs dot ucla.edu --- (In reply to Andreas Schwab from comment #10) > See the #line directive. GCC already treats that case differently, and it can continue to do so. Come to think of it, GCC works better with #line than it does without. GCC should treat the ordinary case more like it already treats the #line case, except that GCC shouldn't say "warning" twice of course (it sounds like an old episode of "Lost in Space" :-). :::::::::::::: foo.c :::::::::::::: #include "bar.h" :::::::::::::: bar.h :::::::::::::: #warning "You are too close to the curb" #line 100 "baz.h" #warning "Tomorrow is the deadline for paying taxes" $ gcc -S foo.c In file included from foo.c:1: bar.h:1:2: warning: #warning "You are too close to the curb" [-Wcpp] 1 | #warning "You are too close to the curb" | ^~~~~~~ In file included from foo.c:1: baz.h:100:2: warning: #warning "Tomorrow is the deadline for paying taxes" [-Wcpp]