https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81824
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |diagnostic Status|UNCONFIRMED |NEW Last reconfirmed| |2017-08-11 CC| |msebor at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> --- Confirmed with the C++ test case below. I'll look into the warning but I wonder if in addition it would be worth to add some intrinsics to query and manipulate attributes. For instance, if the built-in __builtin_attributes__(X) extracted all attributes from a declaration or a type it could be used to easily declare __foo with all the same attributes as foo: void foo (void) __attribute__ ((nothrow)); __typeof__ (foo) __foo __attribute ((__builtin_attributes__ ((foo)))); Attributes could be removed by using another built-in, say __builtin_remove_attribute. $ cat z.c && gcc -O2 -S -Wall -Wextra -Wpedantic -Wunused -fdump-tree-optimized=/dev/stdout -xc++ z.c extern "C" { void foo (void) __attribute__ ((nothrow)); __typeof__ (foo) __foo; void bar (void) __attribute__ ((nothrow)); __typeof__ (bar) __bar __attribute__ ((nothrow)); #if DEF void __foo (void) { } void __bar (void) { } void foo (void) __attribute__ ((weak, alias ("__foo"))); void bar (void) __attribute__ ((weak, alias ("__bar"))); #else void call_foo (void) { try { __foo (); } catch (...) { __builtin_abort (); } } void call_bar (void) { try { __bar (); } catch (...) { __builtin_abort (); } } #endif } ;; Function void call_foo() (call_foo, funcdef_no=0, decl_uid=2282, cgraph_uid=0, symbol_order=0) void call_foo() () { void * _1; <bb 2> [100.00%] [count: INV]: __foo (); <bb 3> [100.00%] [count: INV]: return; <bb 4> [0.00%] [count: INV]: <L0>: _1 = __builtin_eh_pointer (1); __cxa_begin_catch (_1); __builtin_abort (); } ;; Function void call_bar() (call_bar, funcdef_no=1, decl_uid=2286, cgraph_uid=1, symbol_order=1) void call_bar() () { void * _1; <bb 2> [100.00%] [count: INV]: __bar (); [tail call] return; }