[Bug c++/60364] [[noreturn]] specified for second declaration but not first doesn't result in a diagnostic

2019-06-19 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60364

Marek Polacek  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #7 from Marek Polacek  ---
Fixed.

[Bug c++/60364] [[noreturn]] specified for second declaration but not first doesn't result in a diagnostic

2019-06-19 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60364

--- Comment #6 from Marek Polacek  ---
Author: mpolacek
Date: Wed Jun 19 21:27:45 2019
New Revision: 272486

URL: https://gcc.gnu.org/viewcvs?rev=272486&root=gcc&view=rev
Log:
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.

Added:
trunk/gcc/testsuite/g++.dg/warn/noreturn-10.C
trunk/gcc/testsuite/g++.dg/warn/noreturn-11.C
trunk/gcc/testsuite/g++.dg/warn/noreturn-8.C
trunk/gcc/testsuite/g++.dg/warn/noreturn-9.C
Modified:
trunk/gcc/ChangeLog
trunk/gcc/attribs.c
trunk/gcc/attribs.h
trunk/gcc/c-family/ChangeLog
trunk/gcc/c-family/c-attribs.c
trunk/gcc/c-family/c-common.h
trunk/gcc/c-family/c-format.c
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/decl.c
trunk/gcc/cp/parser.c
trunk/gcc/cp/tree.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-inline.c

[Bug c++/60364] [[noreturn]] specified for second declaration but not first doesn't result in a diagnostic

2019-06-15 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60364

Marek Polacek  changed:

   What|Removed |Added

   Keywords||patch
 Status|NEW |ASSIGNED
 CC||mpolacek at gcc dot gnu.org
   Assignee|unassigned at gcc dot gnu.org  |mpolacek at gcc dot 
gnu.org

--- Comment #5 from Marek Polacek  ---
Patch posted:
https://gcc.gnu.org/ml/gcc-patches/2019-06/msg00880.html

[Bug c++/60364] [[noreturn]] specified for second declaration but not first doesn't result in a diagnostic

2018-10-16 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60364

--- Comment #4 from Martin Sebor  ---
*** Bug 84352 has been marked as a duplicate of this bug. ***

[Bug c++/60364] [[noreturn]] specified for second declaration but not first doesn't result in a diagnostic

2017-02-16 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60364

Martin Sebor  changed:

   What|Removed |Added

 CC||msebor at gcc dot gnu.org
  Known to fail||4.9.3, 5.3.0, 6.2.0, 7.0

--- Comment #3 from Martin Sebor  ---
Today's trunk of GCC 7.0 still accepts the code.  Clang rejects it as expected:

$ clang++ -S -Wall -Wextra -Wpedantic -std=c++14 t.C
t.C:3:13: error: function declared '[[noreturn]]' after its first declaration
void func [[noreturn]] ();
^
t.C:1:6: note: declaration missing '[[noreturn]]' attribute is here
void func ();
 ^
1 error generated.

[Bug c++/60364] [[noreturn]] specified for second declaration but not first doesn't result in a diagnostic

2015-06-30 Thread paolo.carlini at oracle dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60364

Paolo Carlini  changed:

   What|Removed |Added

 Status|ASSIGNED|NEW
   Assignee|paolo.carlini at oracle dot com|unassigned at gcc dot 
gnu.org

--- Comment #2 from Paolo Carlini  ---
Nope.


[Bug c++/60364] [[noreturn]] specified for second declaration but not first doesn't result in a diagnostic

2015-06-30 Thread paolo.carlini at oracle dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60364

Paolo Carlini  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2015-06-30
   Assignee|unassigned at gcc dot gnu.org  |paolo.carlini at oracle 
dot com
 Ever confirmed|0   |1

--- Comment #1 from Paolo Carlini  ---
Mine.