This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/81544] attribute noreturn and warn_unused_result on the same function accepted
- From: "msebor at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 24 Jul 2017 22:29:54 +0000
- Subject: [Bug c/81544] attribute noreturn and warn_unused_result on the same function accepted
- Auto-submitted: auto-generated
- References: <bug-81544-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81544
--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
An example of how conflicting attributes could be handled is the mutually
exclusive pair of attributes always_inline and noinline:
$ cat b.c && gcc -O2 -S -Wall -Wextra -Wpedantic b.c
void __attribute__ ((noinline)) f (void);
void __attribute__ ((always_inline)) f (void);
void __attribute__ ((always_inline)) g (void);
void __attribute__ ((noinline)) g (void);
b.c:2:38: warning: declaration of ‘f’ with attribute ‘always_inline’ follows
declaration with attribute ‘noinline’ [-Wattributes]
void __attribute__ ((always_inline)) f (void);
^
b.c:1:33: note: previous declaration of ‘f’ was here
void __attribute__ ((noinline)) f (void);
^
b.c:5:33: warning: declaration of ‘g’ with attribute ‘noinline’ follows
declaration with attribute ‘always_inline’ [-Wattributes]
void __attribute__ ((noinline)) g (void);
^
b.c:4:38: note: previous declaration of ‘g’ was here
void __attribute__ ((always_inline)) g (void);
^