Observe that on void __attribute ((always_inline)) foo (void); void __attribute ((noinline)) foo (void); $ ./cc1 -quiet q.cc q.cc:2:31: warning: declaration of ‘foo’ with attribute ‘noinline’ follows declaration with attribute ‘always_inline’ [-Wattributes] void __attribute ((noinline)) foo (void); ^~~ q.cc:1:36: note: previous declaration of ‘foo’ was here void __attribute ((always_inline)) foo (void); ^~~ but cc1plus is silent. I think we need to factor out some code out of diagnose_mismatched_decls.
Testing a patch.
Author: mpolacek Date: Wed May 11 17:07:37 2016 New Revision: 236129 URL: https://gcc.gnu.org/viewcvs?rev=236129&root=gcc&view=rev Log: PR c++/71024 * c-common.c (diagnose_mismatched_attributes): New function. * c-common.h (diagnose_mismatched_attributes): Declare. * c-decl.c (diagnose_mismatched_decls): Factor out code to diagnose_mismatched_attributes and call it. * decl.c (duplicate_decls): Call diagnose_mismatched_decls. * c-c++-common/attributes-3.c: New test. Added: trunk/gcc/testsuite/c-c++-common/attributes-3.c Modified: trunk/gcc/c-family/ChangeLog trunk/gcc/c-family/c-common.c trunk/gcc/c-family/c-common.h trunk/gcc/c/ChangeLog trunk/gcc/c/c-decl.c trunk/gcc/cp/ChangeLog trunk/gcc/cp/decl.c trunk/gcc/testsuite/ChangeLog
Fixed.