https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68582
Bug ID: 68582 Summary: -Wunused-function doesn't warn about unused static __attribute__((noreturn)) functions Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: palves at redhat dot com Target Milestone: --- With: $ gcc6 -v: ... GNU C11 (GCC) version 6.0.0 20151117 (experimental) (x86_64-pc-linux-gnu) ... This warns, as expected: $ cat not-used.c void abort(void); static void foo (void) { abort (); } int main () {return 0;} $ gcc6 not-used.c -o not-used -Wunused-function not-used.c:2:13: warning: ‘foo’ defined but not used [-Wunused-function] static void foo (void) { abort (); } ^~~ Adding __attribute__((noreturn)) to foo silences the warning: $ cat not-used.c void abort(void); static __attribute__((noreturn)) void foo (void) { abort (); } int main () {return 0;} $ gcc6 not-used.c -o not-used -Wunused-function $ Couldn't find this documented in the manual.