Commit 1a10290c by Mark Mitchell Committed by Mark Mitchell

re PR c++/15871 (g++ does not honour -fkeep-inline-functions)

	PR c++/15871
	* semantics.c (expand_or_defer_fn): Honor -fkeep-inline-functions.

	PR c++/15871
	* doc/invoke.texi (-fkeep-inline-functions): Update documentation.

	PR c++/15871
	* g++.dg/opt/inline8.C: New test.

From-SVN: r86144
parent 1bc7e466
2004-08-17 Mark Mitchell <mark@codesourcery.com>
PR c++/15871
* doc/invoke.texi (-fkeep-inline-functions): Update documentation.
2004-08-17 Robert Bowdidge <bowdidge@apple.com> 2004-08-17 Robert Bowdidge <bowdidge@apple.com>
* config/rs6000/x-darwin: Add -mdynamic-no-pic to gcc build flags. * config/rs6000/x-darwin: Add -mdynamic-no-pic to gcc build flags.
......
2004-08-17 Mark Mitchell <mark@codesourcery.com> 2004-08-17 Mark Mitchell <mark@codesourcery.com>
PR c++/15871
* semantics.c (expand_or_defer_fn): Honor -fkeep-inline-functions.
PR c++/16965 PR c++/16965
* cp-tree.h (qualified_name_lookup_error): Add parameter. * cp-tree.h (qualified_name_lookup_error): Add parameter.
* name-lookup.c (do_class_using_decl): Restrict set of entities * name-lookup.c (do_class_using_decl): Restrict set of entities
......
...@@ -2959,7 +2959,7 @@ expand_or_defer_fn (tree fn) ...@@ -2959,7 +2959,7 @@ expand_or_defer_fn (tree fn)
/* We make a decision about linkage for these functions at the end /* We make a decision about linkage for these functions at the end
of the compilation. Until that point, we do not want the back of the compilation. Until that point, we do not want the back
end to output them -- but we do want it to see the bodies of end to output them -- but we do want it to see the bodies of
these fucntions so that it can inline them as appropriate. */ these functions so that it can inline them as appropriate. */
if (DECL_DECLARED_INLINE_P (fn) || DECL_IMPLICIT_INSTANTIATION (fn)) if (DECL_DECLARED_INLINE_P (fn) || DECL_IMPLICIT_INSTANTIATION (fn))
{ {
if (!at_eof) if (!at_eof)
...@@ -2970,6 +2970,12 @@ expand_or_defer_fn (tree fn) ...@@ -2970,6 +2970,12 @@ expand_or_defer_fn (tree fn)
} }
else else
import_export_decl (fn); import_export_decl (fn);
/* If the user wants us to keep all inline functions, then mark
this function as needed so that finish_file will make sure to
output it later. */
if (flag_keep_inline_functions && DECL_DECLARED_INLINE_P (fn))
mark_needed (fn);
} }
/* There's no reason to do any of the work here if we're only doing /* There's no reason to do any of the work here if we're only doing
......
...@@ -4055,10 +4055,11 @@ release to an another. ...@@ -4055,10 +4055,11 @@ release to an another.
@item -fkeep-inline-functions @item -fkeep-inline-functions
@opindex fkeep-inline-functions @opindex fkeep-inline-functions
Even if all calls to a given function are integrated, and the function In C, emit @code{static} functions that are declared @code{inline}
is declared @code{static}, nevertheless output a separate run-time into the object file, even if the function has been inlined into all
callable version of the function. This switch does not affect of its callers. This switch does not affect functions using the
@code{extern inline} functions. @code{extern inline} extension in GNU C. In C++, emit any and all
inline functions into the object file.
@item -fkeep-static-consts @item -fkeep-static-consts
@opindex fkeep-static-consts @opindex fkeep-static-consts
......
2004-08-17 Mark Mitchell <mark@codesourcery.com> 2004-08-17 Mark Mitchell <mark@codesourcery.com>
PR c++/15871
* g++.dg/opt/inline8.C: New test.
PR c++/16965 PR c++/16965
* g++.dg/parse/error17.C: New test. * g++.dg/parse/error17.C: New test.
......
// PR c++/15871
// { dg-options "-O2 -fkeep-inline-functions" }
// { dg-final { scan-assembler "foo" } }
inline void foo(void) { }
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