This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/68582] New: -Wunused-function doesn't warn about unused static __attribute__((noreturn)) functions
- From: "palves at redhat dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 27 Nov 2015 11:07:16 +0000
- Subject: [Bug c/68582] New: -Wunused-function doesn't warn about unused static __attribute__((noreturn)) functions
- Auto-submitted: auto-generated
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.