[Bug c/81544] attribute noreturn and warn_unused_result on the same function accepted
msebor at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Jul 24 22:30:00 GMT 2017
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);
^
More information about the Gcc-bugs
mailing list