OSDN Git Service

* c-common.c (flag_external_templates): Remove.
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 22 Dec 2003 23:57:08 +0000 (23:57 +0000)
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 22 Dec 2003 23:57:08 +0000 (23:57 +0000)
(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

15 files changed:
gcc/ChangeLog
gcc/c-common.c
gcc/c-common.h
gcc/c-opts.c
gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/cp/decl2.c
gcc/cp/lex.c
gcc/cp/name-lookup.c
gcc/cp/pt.c
gcc/doc/invoke.texi
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/lookup/ns1.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.jason/template18.C [deleted file]
gcc/testsuite/g++.old-deja/g++.jason/template37.C [deleted file]

index 90f97f2..e0e2bd3 100644 (file)
@@ -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
index a52a3cb..ce90433 100644 (file)
@@ -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;
index a5b8fa1..e3ae91f 100644 (file)
@@ -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;
index 3f89f9d..59bce76 100644 (file)
@@ -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.  */
index 4e4864f..9e39313 100644 (file)
@@ -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.
index c4b9df7..09b0022 100644 (file)
@@ -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
index 726251f..92b661d 100644 (file)
@@ -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.  */
index b2d2f1c..d22f5b0 100644 (file)
@@ -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;
 }
index f19987d..0be758f 100644 (file)
@@ -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);
index d8b953a..e7a8863 100644 (file)
@@ -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);
     }
index c262796..5d3583f 100644 (file)
@@ -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
index f376569..c96f5ec 100644 (file)
@@ -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 (file)
index 0000000..feeaf75
--- /dev/null
@@ -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 (file)
index bf293ed..0000000
+++ /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 (file)
index 23309a4..0000000
+++ /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;
-  }