http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55768
Bug #: 55768 Summary: Use of unknown __attribute__ in function definition is flagged with an error Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: dnovi...@gcc.gnu.org CC: ja...@gcc.gnu.org I am not sure whether this is a bug, but it is a behaviour change since 4.7. The compiler usually rejects attributes applied to function definitions: int foo(int x, int y) __attribute__((const)) { return x * y; } $ gcc47 -c a.cc a.cc:1:23: error: attributes are not allowed on a function-definition $ But if the compiler does not recognize the attribute, then it says nothing: int foo(int x, int y) __attribute__((no_thread_safety_analysis)) { return x * y; } $ gcc47 -c a.cc $ This has changed in 4.8. We now emit an error even if we do not understand the attribute: a.cc:1:23: error: attributes are not allowed on a function-definition int foo(int x, int y) __attribute__((no_thread_safety_analysis)) ^ Is this a case where the user code should be changed to accomodate the rule of not allowing attributes on function definitions? In fact, shouldn't the compiler just allow attributes on function definitions?