re PR middle-end/68582 (-Wunused-function doesn't warn about unused static __attribute__((noreturn)) functions)
PR middle-end/68582 * cgraphunit.c (check_global_declaration): Only depend on TREE_THIS_VOLATILE for VAR_DECLs. * c-c++-common/pr68582.c: New test. From-SVN: r231116
This commit is contained in:
parent
6c59645f5d
commit
8b6ab677a2
4 changed files with 37 additions and 1 deletions
|
@ -1,3 +1,9 @@
|
|||
2015-12-01 Marek Polacek <polacek@redhat.com>
|
||||
|
||||
PR middle-end/68582
|
||||
* cgraphunit.c (check_global_declaration): Only depend on TREE_THIS_VOLATILE
|
||||
for VAR_DECLs.
|
||||
|
||||
2015-12-01 Richard Sandiford <richard.sandiford@arm.com>
|
||||
|
||||
PR tree-optimization/68474
|
||||
|
|
|
@ -956,7 +956,7 @@ check_global_declaration (symtab_node *snode)
|
|||
&& ! DECL_ABSTRACT_ORIGIN (decl)
|
||||
&& ! TREE_PUBLIC (decl)
|
||||
/* A volatile variable might be used in some non-obvious way. */
|
||||
&& ! TREE_THIS_VOLATILE (decl)
|
||||
&& (! VAR_P (decl) || ! TREE_THIS_VOLATILE (decl))
|
||||
/* Global register variables must be declared to reserve them. */
|
||||
&& ! (TREE_CODE (decl) == VAR_DECL && DECL_REGISTER (decl))
|
||||
/* Global ctors and dtors are called by the runtime. */
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2015-12-01 Marek Polacek <polacek@redhat.com>
|
||||
|
||||
PR middle-end/68582
|
||||
* c-c++-common/pr68582.c: New test.
|
||||
|
||||
2015-12-01 Richard Sandiford <richard.sandiford@arm.com>
|
||||
|
||||
PR tree-optimization/68474
|
||||
|
|
25
gcc/testsuite/c-c++-common/pr68582.c
Normal file
25
gcc/testsuite/c-c++-common/pr68582.c
Normal file
|
@ -0,0 +1,25 @@
|
|||
/* PR middle-end/68582 */
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-Wunused-function" } */
|
||||
|
||||
/* We failed to give the warning for functions with TREE_THIS_VOLATILE set. */
|
||||
|
||||
static void
|
||||
fn1 (void) /* { dg-warning "defined but not used" } */
|
||||
{
|
||||
__builtin_abort ();
|
||||
}
|
||||
|
||||
__attribute__ ((noreturn))
|
||||
static void
|
||||
fn2 (void) /* { dg-warning "defined but not used" } */
|
||||
{
|
||||
__builtin_abort ();
|
||||
}
|
||||
|
||||
__attribute__ ((volatile))
|
||||
static void
|
||||
fn3 (void) /* { dg-warning "defined but not used" } */
|
||||
{
|
||||
__builtin_abort ();
|
||||
}
|
Loading…
Add table
Reference in a new issue