When we have a static declaration without definition we diagnose
that and turn it into an extern declaration. That can alter
the outcome of maybe_special_function_p here and there's really
no point in doing that, so don't.
PR tree-optimization/108449
* cgraphunit.cc (check_global_declaration): Do not turn
undefined statics into externs.
* gcc.dg/pr108449.c: New testcase.
else
warning (OPT_Wunused_function, "%q+F declared %<static%> but never "
"defined", decl);
- /* This symbol is effectively an "extern" declaration now. */
- TREE_PUBLIC (decl) = 1;
}
/* Warn about static fns or vars defined but not used. */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O" } */
+
+static int vfork(); /* { dg-warning "used but never defined" } */
+void f() { vfork(); }