Commit 8b6ab677 by Marek Polacek Committed by Marek Polacek

re PR middle-end/68582 (-Wunused-function doesn't warn about unused static…

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
parent 6c59645f
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> 2015-12-01 Richard Sandiford <richard.sandiford@arm.com>
PR tree-optimization/68474 PR tree-optimization/68474
...@@ -956,7 +956,7 @@ check_global_declaration (symtab_node *snode) ...@@ -956,7 +956,7 @@ check_global_declaration (symtab_node *snode)
&& ! DECL_ABSTRACT_ORIGIN (decl) && ! DECL_ABSTRACT_ORIGIN (decl)
&& ! TREE_PUBLIC (decl) && ! TREE_PUBLIC (decl)
/* A volatile variable might be used in some non-obvious way. */ /* 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. */ /* Global register variables must be declared to reserve them. */
&& ! (TREE_CODE (decl) == VAR_DECL && DECL_REGISTER (decl)) && ! (TREE_CODE (decl) == VAR_DECL && DECL_REGISTER (decl))
/* Global ctors and dtors are called by the runtime. */ /* Global ctors and dtors are called by the runtime. */
......
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> 2015-12-01 Richard Sandiford <richard.sandiford@arm.com>
PR tree-optimization/68474 PR tree-optimization/68474
......
/* 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 ();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment