This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/81544] attribute noreturn and warn_unused_result on the same function accepted


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);
                                      ^

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]