+2015-10-19 Joost VandeVondele <vondele@gnu.gcc.org>
+
+ PR middle-end/68002
+ * common.opt (fkeep-static-functions): New option.
+ * doc/invoke.texi: Document it.
+ * cgraphunit.c (cgraph_node::finalize_function): Use it.
+
2015-10-19 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
* sched-int.h (struct autopref_multipass_data_): Remove offset
declared inline and nested functions. These were optimized out
in the original implementation and it is unclear whether we want
to change the behavior here. */
- if ((!opt_for_fn (decl, optimize)
+ if (((!opt_for_fn (decl, optimize) || flag_keep_static_functions)
&& !node->cpp_implicit_alias
&& !DECL_DISREGARD_INLINE_LIMITS (decl)
&& !DECL_DECLARED_INLINE_P (decl)
Common Report Var(flag_keep_inline_functions)
Generate code for functions even if they are fully inlined
+fkeep-static-functions
+Common Report Var(flag_keep_static_functions)
+Generate code for static functions even if they are never called
+
fkeep-static-consts
Common Report Var(flag_keep_static_consts) Init(1)
Emit static const variables even if they are not used
-fira-loop-pressure -fno-ira-share-save-slots @gol
-fno-ira-share-spill-slots -fira-verbose=@var{n} @gol
-fisolate-erroneous-paths-dereference -fisolate-erroneous-paths-attribute @gol
--fivopts -fkeep-inline-functions -fkeep-static-consts @gol
--flive-range-shrinkage @gol
+-fivopts -fkeep-inline-functions -fkeep-static-functions @gol
+-fkeep-static-consts -flive-range-shrinkage @gol
-floop-block -floop-interchange -floop-strip-mine @gol
-floop-unroll-and-jam -floop-nest-optimize @gol
-floop-parallelize-all -flra-remat -flto -flto-compression-level @gol
@code{extern inline} extension in GNU C90@. In C++, emit any and all
inline functions into the object file.
+@item -fkeep-static-functions
+@optindex fkeep-static-functions
+Emit @code{static} functions into the object file, even if the function
+is never used.
+
@item -fkeep-static-consts
@opindex fkeep-static-consts
Emit variables declared @code{static const} when optimization isn't turned
+2015-10-17 Joost VandeVondele <vondele@gnu.gcc.org>
+
+ PR middle-end/68002
+ * gcc.dg/PR68002.c: New test.
+
2015-10-19 Richard Sandiford <richard.sandiford@arm.com>
* gcc.dg/builtins-20.c: Remove undefined behavior.
--- /dev/null
+/* Ensure static functions can be kept. */
+/* { dg-do compile } */
+/* { dg-options "-O1 -fkeep-static-functions" } */
+
+static void bar () { }
+
+/* { dg-final { scan-assembler "bar" } } */