if (TREE_CODE (decl) == FUNCTION_DECL
&& DECL_INITIAL (decl) == NULL_TREE
&& DECL_EXTERNAL (decl)
- && !TREE_PUBLIC (decl))
+ && !TREE_PUBLIC (decl)
+ && !warning_suppressed_p (decl, OPT_Wunused))
{
if (C_DECL_USED (decl))
{
- /* TODO: Add OPT_Wundefined-inline. */
if (pedwarn (input_location, 0, "%q+F used but never defined",
decl))
- suppress_warning (decl /* OPT_Wundefined-inline. */);
+ suppress_warning (decl, OPT_Wunused);
}
/* For -Wunused-function warn about unused static prototypes. */
else if (warn_unused_function
&& ! DECL_ARTIFICIAL (decl)
- && ! warning_suppressed_p (decl, OPT_Wunused_function))
- {
- if (warning (OPT_Wunused_function,
- "%q+F declared %<static%> but never defined",
- decl))
- suppress_warning (decl, OPT_Wunused_function);
- }
+ && warning (OPT_Wunused_function,
+ "%q+F declared %<static%> but never defined",
+ decl))
+ suppress_warning (decl, OPT_Wunused);
}
wrapup_global_declaration_1 (decl);
"of a function or non-automatic variable");
input = error_mark_node;
}
+ else if (TREE_CODE (TREE_OPERAND (t, 0)) == FUNCTION_DECL)
+ suppress_warning (TREE_OPERAND (t, 0), OPT_Wunused);
}
}
else
if (warning_suppressed_p (decl, OPT_Wunused))
;
else if (snode->referred_to_p (/*include_self=*/false))
- pedwarn (input_location, 0, "%q+F used but never defined", decl);
- else
- warning (OPT_Wunused_function, "%q+F declared %<static%> but never "
- "defined", decl);
+ {
+ if (pedwarn (input_location, 0, "%q+F used but never defined", decl))
+ suppress_warning (decl, OPT_Wunused);
+ }
+ else if (warning (OPT_Wunused_function,
+ "%q+F declared %<static%> but never defined", decl))
+ suppress_warning (decl, OPT_Wunused);
}
/* Warn about static fns or vars defined but not used. */
&& !TREE_PUBLIC (decl)
&& !DECL_ARTIFICIAL (decl)
&& !DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION (decl)
- && !warning_suppressed_p (decl, OPT_Wunused_function))
- warning_at (DECL_SOURCE_LOCATION (decl),
- OPT_Wunused_function,
- "%qF declared %<static%> but never defined", decl);
+ && !warning_suppressed_p (decl, OPT_Wunused)
+ && warning_at (DECL_SOURCE_LOCATION (decl), OPT_Wunused_function,
+ "%qF declared %<static%> but never defined",
+ decl))
+ suppress_warning (decl, OPT_Wunused);
if (VAR_P (decl)
&& DECL_EXTERNAL (decl)
"of a function or non-automatic variable");
operand = error_mark_node;
}
+ else if (TREE_CODE (TREE_OPERAND (t, 0)) == FUNCTION_DECL)
+ suppress_warning (TREE_OPERAND (t, 0), OPT_Wunused);
}
}
else
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-Wall" } */
+
+static void asm_fn(); /* { dg-bogus "but never defined" } */
+asm("%cc0:" :: ":"(&asm_fn));