summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2003-12-22 23:57:08 +0000
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2003-12-22 23:57:08 +0000
commitc79f94a2de0ff5b84115ead430c145bd55f9f145 (patch)
treebfd19fff8d2b9d5fc60b710cb3426bd7f1df5b92
parenteaa2deb0c5c041225bd90f5e328e6cf2f4915c9a (diff)
downloadgcc-c79f94a2de0ff5b84115ead430c145bd55f9f145.tar.gz
* c-common.c (flag_external_templates): Remove.
(flag_alt_external_templates): Likewise. * c-common.h (flag_external_templates): Remove. (flag_alt_external_templates): Likewise. * c-opts.c (c_common_handle_option): Unsupport -falt-external-templates and -ftemplates. * doc/invoke.texi: Remove mention of -fexternal-templates and -falt-external-templates. * decl.c (start_function): Do not check flag_alt_external_templates or flag_external_templates. * decl2.c (warn_if_unknown_interface): Likewise. * lex.c (extract_interface_info): Likewise. * pt.c (lookup_template_class): Likewise. PR c++/12862 * name-lookup.c (pushdecl): Look up all namespace-scope entities in their corresponding namespace. * g++.old-deja/g++.jason/template18.C: Remove. * g++.old-deja/g++.jason/template37.C: Likewise. PR c++/12862 * g++.dg/lookup/ns1.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@74954 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog11
-rw-r--r--gcc/c-common.c11
-rw-r--r--gcc/c-common.h11
-rw-r--r--gcc/c-opts.c15
-rw-r--r--gcc/cp/ChangeLog10
-rw-r--r--gcc/cp/decl.c6
-rw-r--r--gcc/cp/decl2.c19
-rw-r--r--gcc/cp/lex.c13
-rw-r--r--gcc/cp/name-lookup.c3
-rw-r--r--gcc/cp/pt.c60
-rw-r--r--gcc/doc/invoke.texi21
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/g++.dg/lookup/ns1.C22
-rw-r--r--gcc/testsuite/g++.old-deja/g++.jason/template18.C18
-rw-r--r--gcc/testsuite/g++.old-deja/g++.jason/template37.C40
15 files changed, 61 insertions, 205 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 90f97f2d535..e0e2bd3ebc2 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,14 @@
+2003-12-22 Mark Mitchell <mark@codesourcery.com>
+
+ * c-common.c (flag_external_templates): Remove.
+ (flag_alt_external_templates): Likewise.
+ * c-common.h (flag_external_templates): Remove.
+ (flag_alt_external_templates): Likewise.
+ * c-opts.c (c_common_handle_option): Unsupport
+ -falt-external-templates and -ftemplates.
+ * doc/invoke.texi: Remove mention of -fexternal-templates and
+ -falt-external-templates.
+
2003-12-22 Andrew Pinski <pinskia@physics.uc.edu>
PR target/13466
diff --git a/gcc/c-common.c b/gcc/c-common.c
index a52a3cbfe2b..ce90433c855 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -510,17 +510,6 @@ int flag_no_gnu_keywords;
int flag_implement_inlines = 1;
-/* Nonzero means do emit exported implementations of templates, instead of
- multiple static copies in each file that needs a definition. */
-
-int flag_external_templates;
-
-/* Nonzero means that the decision to emit or not emit the implementation of a
- template depends on where the template is instantiated, rather than where
- it is defined. */
-
-int flag_alt_external_templates;
-
/* Nonzero means that implicit instantiations will be emitted if needed. */
int flag_implicit_templates = 1;
diff --git a/gcc/c-common.h b/gcc/c-common.h
index a5b8fa11ea6..e3ae91fb311 100644
--- a/gcc/c-common.h
+++ b/gcc/c-common.h
@@ -674,17 +674,6 @@ extern int flag_no_gnu_keywords;
extern int flag_implement_inlines;
-/* Nonzero means do emit exported implementations of templates, instead of
- multiple static copies in each file that needs a definition. */
-
-extern int flag_external_templates;
-
-/* Nonzero means that the decision to emit or not emit the implementation of a
- template depends on where the template is instantiated, rather than where
- it is defined. */
-
-extern int flag_alt_external_templates;
-
/* Nonzero means that implicit instantiations will be emitted if needed. */
extern int flag_implicit_templates;
diff --git a/gcc/c-opts.c b/gcc/c-opts.c
index 3f89f9d1c9e..59bce76607b 100644
--- a/gcc/c-opts.c
+++ b/gcc/c-opts.c
@@ -672,7 +672,9 @@ c_common_handle_option (size_t scode, const char *arg, int value)
/* Fall through. */
case OPT_fall_virtual:
+ case OPT_falt_external_templates:
case OPT_fenum_int_equiv:
+ case OPT_fexternal_templates:
case OPT_fguiding_decls:
case OPT_fhonor_std:
case OPT_fhuge_objects:
@@ -697,15 +699,6 @@ c_common_handle_option (size_t scode, const char *arg, int value)
flag_access_control = value;
break;
- case OPT_falt_external_templates:
- flag_alt_external_templates = value;
- if (value)
- flag_external_templates = true;
- cp_deprecated:
- warning ("switch \"%s\" is deprecated, please see documentation "
- "for details", option->opt_text);
- break;
-
case OPT_fasm:
flag_no_asm = !value;
break;
@@ -799,10 +792,6 @@ c_common_handle_option (size_t scode, const char *arg, int value)
flag_enforce_eh_specs = value;
break;
- case OPT_fexternal_templates:
- flag_external_templates = value;
- goto cp_deprecated;
-
case OPT_ffixed_form:
case OPT_ffixed_line_length_:
/* Fortran front end options ignored when preprocessing only. */
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 4e4864fd24a..9e39313868a 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,15 @@
2003-12-22 Mark Mitchell <mark@codesourcery.com>
+ * decl.c (start_function): Do not check
+ flag_alt_external_templates or flag_external_templates.
+ * decl2.c (warn_if_unknown_interface): Likewise.
+ * lex.c (extract_interface_info): Likewise.
+ * pt.c (lookup_template_class): Likewise.
+
+ PR c++/12862
+ * name-lookup.c (pushdecl): Look up all namespace-scope entities
+ in their corresponding namespace.
+
PR c++/12397
* typeck.c (finish_class_member_access_expr): Don't tree
IDENTIFIER_NODEs as non-dependent expressions.
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index c4b9df7b49b..09b002201cc 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -10310,8 +10310,7 @@ start_function (tree declspecs, tree declarator, tree attrs, int flags)
If it belongs to someone else's interface, it is also external.
This only affects inlines and template instantiations. */
else if (interface_unknown == 0
- && (! DECL_TEMPLATE_INSTANTIATION (decl1)
- || flag_alt_external_templates))
+ && ! DECL_TEMPLATE_INSTANTIATION (decl1))
{
if (DECL_DECLARED_INLINE_P (decl1)
|| DECL_TEMPLATE_INSTANTIATION (decl1)
@@ -10332,8 +10331,7 @@ start_function (tree declspecs, tree declarator, tree attrs, int flags)
DECL_INTERFACE_KNOWN (decl1) = 1;
}
else if (interface_unknown && interface_only
- && (! DECL_TEMPLATE_INSTANTIATION (decl1)
- || flag_alt_external_templates))
+ && ! DECL_TEMPLATE_INSTANTIATION (decl1))
{
/* If MULTIPLE_SYMBOL_SPACES is defined and we saw a #pragma
interface, we will have interface_only set but not
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 726251f98fa..92b661d7298 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -167,23 +167,8 @@ warn_if_unknown_interface (tree decl)
if (already_warned++)
return;
- if (flag_alt_external_templates)
- {
- tree til = tinst_for_decl ();
- location_t saved_loc = input_location;
-
- if (til)
- {
- input_line = TINST_LINE (til);
- input_filename = TINST_FILE (til);
- }
- warning ("template `%#D' instantiated in file without #pragma interface",
- decl);
- input_location = saved_loc;
- }
- else
- cp_warning_at ("template `%#D' defined in file without #pragma interface",
- decl);
+ cp_warning_at ("template `%#D' defined in file without #pragma interface",
+ decl);
}
/* A subroutine of the parser, to handle a component list. */
diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c
index b2d2f1c31fd..d22f5b063c1 100644
--- a/gcc/cp/lex.c
+++ b/gcc/cp/lex.c
@@ -436,18 +436,9 @@ cxx_init (void)
void
extract_interface_info (void)
{
- struct c_fileinfo *finfo = 0;
-
- if (flag_alt_external_templates)
- {
- tree til = tinst_for_decl ();
-
- if (til)
- finfo = get_fileinfo (TINST_FILE (til));
- }
- if (!finfo)
- finfo = get_fileinfo (input_filename);
+ struct c_fileinfo *finfo;
+ finfo = get_fileinfo (input_filename);
interface_only = finfo->interface_only;
interface_unknown = finfo->interface_unknown;
}
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index f19987d055f..0be758f450d 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -590,8 +590,7 @@ pushdecl (tree x)
/* In case this decl was explicitly namespace-qualified, look it
up in its namespace context. */
- if (TREE_CODE (x) == VAR_DECL && DECL_NAMESPACE_SCOPE_P (x)
- && namespace_bindings_p ())
+ if (DECL_NAMESPACE_SCOPE_P (x) && namespace_bindings_p ())
t = namespace_binding (name, DECL_CONTEXT (x));
else
t = lookup_name_current_level (name);
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index d8b953a4686..e7a886380c2 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -4485,19 +4485,7 @@ lookup_template_class (tree d1,
is set up. */
if (TREE_CODE (t) != ENUMERAL_TYPE)
DECL_NAME (type_decl) = classtype_mangled_name (t);
- if (!is_partial_instantiation)
- {
- /* For backwards compatibility; code that uses
- -fexternal-templates expects looking up a template to
- instantiate it. I think DDD still relies on this.
- (jason 8/20/1998) */
- if (TREE_CODE (t) != ENUMERAL_TYPE
- && flag_external_templates
- && CLASSTYPE_INTERFACE_KNOWN (TREE_TYPE (template))
- && ! CLASSTYPE_INTERFACE_ONLY (TREE_TYPE (template)))
- add_pending_template (t);
- }
- else
+ if (is_partial_instantiation)
/* If the type makes use of template parameters, the
code that generates debugging information will crash. */
DECL_IGNORED_P (TYPE_STUB_DECL (t)) = 1;
@@ -5279,24 +5267,7 @@ instantiate_class_template (tree type)
args = inner_args;
}
- if (flag_external_templates)
- {
- if (flag_alt_external_templates)
- {
- CLASSTYPE_INTERFACE_ONLY (type) = interface_only;
- SET_CLASSTYPE_INTERFACE_UNKNOWN_X (type, interface_unknown);
- }
- else
- {
- CLASSTYPE_INTERFACE_ONLY (type) = CLASSTYPE_INTERFACE_ONLY (pattern);
- SET_CLASSTYPE_INTERFACE_UNKNOWN_X
- (type, CLASSTYPE_INTERFACE_UNKNOWN (pattern));
- }
- }
- else
- {
- SET_CLASSTYPE_INTERFACE_UNKNOWN (type);
- }
+ SET_CLASSTYPE_INTERFACE_UNKNOWN (type);
/* Set the input location to the template definition. This is needed
if tsubsting causes an error. */
@@ -8642,9 +8613,6 @@ instantiate_template (tree tmpl, tree targ_ptr, tsubst_flags_t complain)
template, not the most general template. */
DECL_TI_TEMPLATE (fndecl) = tmpl;
- if (flag_external_templates)
- add_pending_template (fndecl);
-
/* If we've just instantiated the main entry point for a function,
instantiate all the alternate entry points as well. We do this
by cloning the instantiation of the main entry point, not by
@@ -10529,9 +10497,6 @@ do_decl_instantiation (tree decl, tree storage)
return;
}
- if (flag_external_templates)
- return;
-
if (storage == NULL_TREE)
;
else if (storage == ridpointers[(int) RID_EXTERN])
@@ -10600,11 +10565,6 @@ do_type_instantiation (tree t, tree storage, tsubst_flags_t complain)
complete_type (t);
- /* With -fexternal-templates, explicit instantiations are treated the same
- as implicit ones. */
- if (flag_external_templates)
- return;
-
if (!COMPLETE_TYPE_P (t))
{
if (complain & tf_error)
@@ -10987,22 +10947,6 @@ instantiate_decl (tree d, int defer_ok)
else
repo_template_used (d);
- if (flag_external_templates && ! DECL_INTERFACE_KNOWN (d))
- {
- if (flag_alt_external_templates)
- {
- if (interface_unknown)
- warn_if_unknown_interface (d);
- }
- else if (DECL_INTERFACE_KNOWN (code_pattern))
- {
- DECL_INTERFACE_KNOWN (d) = 1;
- DECL_NOT_REALLY_EXTERN (d) = ! DECL_EXTERNAL (code_pattern);
- }
- else
- warn_if_unknown_interface (code_pattern);
- }
-
if (at_eof)
import_export_decl (d);
}
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index c2627960ccd..5d3583f391b 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -174,8 +174,7 @@ in the following sections.
@gccoptlist{-fabi-version=@var{n} -fno-access-control -fcheck-new @gol
-fconserve-space -fno-const-strings @gol
-fno-elide-constructors @gol
--fno-enforce-eh-specs -fexternal-templates @gol
--falt-external-templates @gol
+-fno-enforce-eh-specs @gol
-ffor-scope -fno-for-scope -fno-gnu-keywords @gol
-fno-implicit-templates @gol
-fno-implicit-inline-templates @gol
@@ -1336,24 +1335,6 @@ option violates the C++ standard, but may be useful for reducing code
size in production builds, much like defining @samp{NDEBUG}. The compiler
will still optimize based on the exception specifications.
-@item -fexternal-templates
-@opindex fexternal-templates
-
-Cause @samp{#pragma interface} and @samp{implementation} to apply to
-template instantiation; template instances are emitted or not according
-to the location of the template definition. @xref{Template
-Instantiation}, for more information.
-
-This option is deprecated.
-
-@item -falt-external-templates
-@opindex falt-external-templates
-Similar to @option{-fexternal-templates}, but template instances are
-emitted or not according to the place where they are first instantiated.
-@xref{Template Instantiation}, for more information.
-
-This option is deprecated.
-
@item -ffor-scope
@itemx -fno-for-scope
@opindex ffor-scope
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index f3765698ea9..c96f5ec2a2a 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,11 @@
2003-12-22 Mark Mitchell <mark@codesourcery.com>
+ * g++.old-deja/g++.jason/template18.C: Remove.
+ * g++.old-deja/g++.jason/template37.C: Likewise.
+
+ PR c++/12862
+ * g++.dg/lookup/ns1.C: New test.
+
PR c++/12397
* g++.dg/template/lookup3.C: New test.
diff --git a/gcc/testsuite/g++.dg/lookup/ns1.C b/gcc/testsuite/g++.dg/lookup/ns1.C
new file mode 100644
index 00000000000..feeaf751cad
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lookup/ns1.C
@@ -0,0 +1,22 @@
+// PR c++/12862
+
+typedef int Thingo;
+
+namespace A
+{
+ void
+ Thingo();
+}
+
+void
+A::Thingo()
+{
+ ;
+}
+
+int
+main()
+{
+ A::Thingo();
+ return 0;
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template18.C b/gcc/testsuite/g++.old-deja/g++.jason/template18.C
deleted file mode 100644
index bf293ed2b86..00000000000
--- a/gcc/testsuite/g++.old-deja/g++.jason/template18.C
+++ /dev/null
@@ -1,18 +0,0 @@
-// { dg-do link }
-// { dg-options "-g -fno-inline -Wno-deprecated -fexternal-templates" }
-// GROUPS passed templates
-// Bug: g++ emits template instances when it shouldn't.
-// Suppressed-instantiation tests like this are known to break on
-// Cygwin, because of the MULTIPLE_SYMBOL_SPACES stuff. This is OK.
-
-
-#pragma implementation "irrelevant_file"
-#line 1 "template18.h"
-#pragma interface
-template <class T> inline T min (T a, T b) { return a<b?a:b; }
-#line 13 "template18.C"
-
-main()
-{
- min (1, 1); // { dg-error "" "" { target *-*-* } 0 } should produce an undefined symbol error.
-}
diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template37.C b/gcc/testsuite/g++.old-deja/g++.jason/template37.C
deleted file mode 100644
index 23309a46b68..00000000000
--- a/gcc/testsuite/g++.old-deja/g++.jason/template37.C
+++ /dev/null
@@ -1,40 +0,0 @@
-// { dg-do run }
-// { dg-options "-Wno-deprecated -fexternal-templates" }
-// { dg-warning "switch.*deprecated" "" { target *-*-* } 0 }
-
-// PRMS Id: 9930
-// Test of -fexternal-templates hackery in new template code
-
- #pragma implementation "foo.hh"
- #pragma interface "foo.hh"
-
- template<class T>
- class ONE
- {
- public:
- static void func();
- };
-
- template<class T>
- void ONE<T>::func()
- {
- }
-
- template <>
- class ONE<int>
- {
- public:
- static void func();
- };
-
- void ONE<int>::func()
- {
- }
-
-int main()
- {
- ONE<char>::func();
- ONE<int>::func();
-
- return 0;
- }