On 6/17/19 12:10 PM, Marek Polacek wrote: > On Mon, Jun 17, 2019 at 09:02:17AM -0600, Martin Sebor wrote: >>> diff --git gcc/cp/tree.c gcc/cp/tree.c >>> index cd021b7f594..bb695e14e73 100644 >>> --- gcc/cp/tree.c >>> +++ gcc/cp/tree.c >>> @@ -4453,6 +4453,8 @@ const struct attribute_spec std_attribute_table[] = >>> handle_likeliness_attribute, attr_cold_hot_exclusions }, >>> { "unlikely", 0, 0, false, false, false, false, >>> handle_likeliness_attribute, attr_cold_hot_exclusions }, >>> + { "noreturn", 0, 0, true, false, false, false, >>> + handle_noreturn_attribute, NULL }, >> ^^^^ >> >> The GNU attribute is made mutually exclusive with a bunch of other >> attributes (e.g., malloc or warn_unused_result) by setting the last >> member to the array of exclusive attribute. Does the change preserve >> this relationship some other way? > Oop, no, that is a bug. I meant to go back to that, but I'd forgotten to add > an XXX comment as I'm wont to, and the testsuite doesn't test that, so it > slipped. Fixed & new test added. Thanks for catching it. > > Also added a test for the scenario Jakub pointed out in the other mail. > > Bootstrapped/regtested on x86_64-linux, ok for trunk? > > 2019-06-17 Marek Polacek <pola...@redhat.com> > > PR c++/60364 - noreturn after first decl not diagnosed. > * attribs.c (get_attribute_namespace): No longer static. > (decl_attributes): Avoid shadowing. Preserve the C++11 form for C++11 > attributes. > (attr_noreturn_exclusions): Make it extern. > * attribs.h (get_attribute_namespace): Declare. > * tree-inline.c (function_attribute_inlinable_p): Use > get_attribute_name. > > * c-attribs.c (handle_noreturn_attribute): No longer static. > * c-common.h (handle_noreturn_attribute, attr_noreturn_exclusions): > Declare. > * c-format.c (check_function_format): Use get_attribute_name. > > * decl.c (duplicate_decls): Give an error when a function is > declared [[noreturn]] after its first declaration. > * parser.c (cp_parser_std_attribute): Don't treat C++11 noreturn > attribute as equivalent to GNU's. > * tree.c (std_attribute_table): Add noreturn. > > * g++.dg/warn/noreturn-8.C: New test. > * g++.dg/warn/noreturn-9.C: New test. > * g++.dg/warn/noreturn-10.C: New test. > * g++.dg/warn/noreturn-11.C: New test. > Turns out there was more generic stuff than C++ specific stuff here. So I went ahead and walked through it.
OK for the trunk. jeff