This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
(C++) patch for -fno-implicit-inline-templates
- To: egcs-patches at cygnus dot com
- Subject: (C++) patch for -fno-implicit-inline-templates
- From: Jason Merrill <jason at cygnus dot com>
- Date: Sat, 3 Oct 1998 22:45:48 -0700
Installed. By default, g++ emits implicit instantiations of inline
templates even with -fno-implicit-templates, so that the explicit
instantiations needed will be the same with or without -O. Some people
don't like this, so I've added an option.
1998-10-03 Jason Merrill <jason@yorick.cygnus.com>
* decl2.c: Add -f{no-,}implicit-inline-templates.
(lang_decode_option): Unset it if -frepo.
(import_export_decl): Check it.
Index: decl2.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/decl2.c,v
retrieving revision 1.138
diff -c -p -r1.138 decl2.c
*** decl2.c 1998/10/03 15:46:48 1.138
--- decl2.c 1998/10/04 05:43:05
*************** int flag_alt_external_templates;
*** 173,178 ****
--- 173,184 ----
int flag_implicit_templates = 1;
+ /* Nonzero means that implicit instantiations of inline templates will be
+ emitted if needed, even if instantiations of non-inline templates
+ aren't. */
+
+ int flag_implicit_inline_templates = 1;
+
/* Nonzero means allow numerical priorities on constructors. */
#ifdef USE_INIT_PRIORITY
*************** static struct { char *string; int *varia
*** 474,479 ****
--- 480,486 ----
{"implement-inlines", &flag_implement_inlines, 1},
{"external-templates", &flag_external_templates, 1},
{"implicit-templates", &flag_implicit_templates, 1},
+ {"implicit-inline-templates", &flag_implicit_inline_templates, 1},
{"init-priority", &flag_init_priority, 1},
{"huge-objects", &flag_huge_objects, 1},
{"conserve-space", &flag_conserve_space, 1},
*************** import_export_decl (decl)
*** 2856,2862 ****
DECL_NOT_REALLY_EXTERN (decl) = 1;
if ((DECL_IMPLICIT_INSTANTIATION (decl)
|| DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION (decl))
! && (flag_implicit_templates || DECL_THIS_INLINE (decl)))
{
if (!TREE_PUBLIC (decl))
/* Templates are allowed to have internal linkage. See
--- 2864,2871 ----
DECL_NOT_REALLY_EXTERN (decl) = 1;
if ((DECL_IMPLICIT_INSTANTIATION (decl)
|| DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION (decl))
! && (flag_implicit_templates
! || (flag_implicit_inline_templates && DECL_THIS_INLINE (decl))))
{
if (!TREE_PUBLIC (decl))
/* Templates are allowed to have internal linkage. See