re PR middle-end/42674 (Bogus "no return statement in function returning non-void" warning)
PR middle-end/42674 * c-decl.c (finish_function): Don't emit -Wreturn-type warnings in functions with noreturn attribute. * decl.c (finish_function): Don't emit -Wreturn-type warnings in functions with noreturn attribute. * c-c++-common/pr42674.c: New test. From-SVN: r155922
This commit is contained in:
parent
0a4d38f60b
commit
350dd84512
|
@ -1,5 +1,9 @@
|
|||
2010-01-14 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR middle-end/42674
|
||||
* c-decl.c (finish_function): Don't emit -Wreturn-type warnings in
|
||||
functions with noreturn attribute.
|
||||
|
||||
PR c++/42608
|
||||
* varasm.c (declare_weak): Add weak attribute to decl if it
|
||||
doesn't have one already.
|
||||
|
|
|
@ -6777,6 +6777,8 @@ finish_function (void)
|
|||
&& !current_function_returns_value && !current_function_returns_null
|
||||
/* Don't complain if we are no-return. */
|
||||
&& !current_function_returns_abnormally
|
||||
/* Don't complain if we are declared noreturn. */
|
||||
&& !TREE_THIS_VOLATILE (fndecl)
|
||||
/* Don't warn for main(). */
|
||||
&& !MAIN_NAME_P (DECL_NAME (fndecl))
|
||||
/* Or if they didn't actually specify a return type. */
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
2010-01-14 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR middle-end/42674
|
||||
* decl.c (finish_function): Don't emit -Wreturn-type warnings in
|
||||
functions with noreturn attribute.
|
||||
|
||||
2010-01-14 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/42655
|
||||
|
|
|
@ -12353,6 +12353,8 @@ finish_function (int flags)
|
|||
&& !current_function_returns_value && !current_function_returns_null
|
||||
/* Don't complain if we abort or throw. */
|
||||
&& !current_function_returns_abnormally
|
||||
/* Don't complain if we are declared noreturn. */
|
||||
&& !TREE_THIS_VOLATILE (fndecl)
|
||||
&& !DECL_NAME (DECL_RESULT (fndecl))
|
||||
&& !TREE_NO_WARNING (fndecl)
|
||||
/* Structor return values (if any) are set by the compiler. */
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
2010-01-14 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR middle-end/42674
|
||||
* c-c++-common/pr42674.c: New test.
|
||||
|
||||
PR c++/42608
|
||||
* g++.dg/template/instantiate11.C: New test.
|
||||
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
/* PR middle-end/42674 */
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-Wreturn-type" } */
|
||||
|
||||
extern void bar (void);
|
||||
static int foo (void) __attribute__ ((__noreturn__, __used__));
|
||||
|
||||
static int
|
||||
foo (void)
|
||||
{
|
||||
while (1)
|
||||
bar ();
|
||||
}
|
Loading…
Reference in New Issue