public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <law@redhat.com>
To: Marek Polacek <polacek@redhat.com>, Martin Sebor <msebor@gmail.com>
Cc: Jakub Jelinek <jakub@redhat.com>,
	GCC Patches <gcc-patches@gcc.gnu.org>,
	Jason Merrill <jason@redhat.com>
Subject: Re: C++ PATCH for c++/60364 - noreturn after first decl not diagnosed (v2)
Date: Wed, 19 Jun 2019 19:31:00 -0000	[thread overview]
Message-ID: <7ea944e7-5dae-d469-11d9-38aa54a2fdb5@redhat.com> (raw)
In-Reply-To: <20190617181053.GR5989@redhat.com>

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  <polacek@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

  reply	other threads:[~2019-06-19 19:31 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-15 14:29 C++ PATCH for c++/60364 - noreturn after first decl not diagnosed Marek Polacek
2019-06-15 14:33 ` Jakub Jelinek
2019-06-15 14:39   ` Marek Polacek
2019-06-16 16:10     ` C++ PATCH for c++/60364 - noreturn after first decl not diagnosed (v2) Marek Polacek
2019-06-16 16:19       ` Jakub Jelinek
2019-06-16 16:37         ` C++ PATCH for c++/60364 - noreturn after first decl not diagnosed (v3) Marek Polacek
2019-06-17 15:48           ` Jakub Jelinek
2019-06-17 18:15             ` Marek Polacek
2019-06-17 15:02       ` C++ PATCH for c++/60364 - noreturn after first decl not diagnosed (v2) Martin Sebor
2019-06-17 18:11         ` Marek Polacek
2019-06-19 19:31           ` Jeff Law [this message]
2019-06-20 16:44           ` Joseph Myers
2019-06-20 16:49             ` Marek Polacek
2019-06-20 17:08               ` Joseph Myers
2019-06-20 17:14                 ` Marek Polacek
2019-06-20 17:57               ` Jakub Jelinek
2019-06-20 19:12                 ` Marek Polacek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7ea944e7-5dae-d469-11d9-38aa54a2fdb5@redhat.com \
    --to=law@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=jason@redhat.com \
    --cc=msebor@gmail.com \
    --cc=polacek@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).