]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Kill -fhonor-std.
authorNathan Sidwell <nathan@codesourcery.com>
Thu, 2 Aug 2001 10:51:17 +0000 (10:51 +0000)
committerNathan Sidwell <nathan@gcc.gnu.org>
Thu, 2 Aug 2001 10:51:17 +0000 (10:51 +0000)
.: Kill -fhonor-std.
* doc/c-tree.texi (Namespaces): Remove std & -fhonor-std
interaction.
* doc/invoke.texi (C++ Dialect Options): Remove -fno-honor-std.
cp:
Kill -fhonor-std.
* NEWS: Document.
* cp-tree.h (flag_honor_std): Remove.
(CPTI_FAKE_STD): Remove.
(std_node): Remove comment about it being NULL.
(fake_std_node): Remove.
* decl.c (in_fake_std): Remove.
(walk_namespaces_r): Remove fake_std_node check.
(push_namespace): Remove in_fake_std code.
(pop_namespace): Likewise.
(lookup_name_real): Remove fake_std_node check.
(init_decl_processing): Always create std_node. Always add
std:: things there.
(builtin_function): Always put non '_' fns in std.
* decl2.c (flag_honor_std): Remove.
(lang_f_options): Remove honor-std.
(unsupported_options): Add honor-std.
(set_decl_namespace): Remove fake_std_node check.
(validate_nonmember_using_decl): Likewise.
(do_using_directive): Likewise.
(handle_class_head): Likewise.
* dump.c (cp_dump_tree): Likewise.
* except.c (init_exception_processing): Adjust.
* init.c (build_member_call): Remove fake_std_node check.
(build_offset_ref): Likewise.
* lang-options.h: Remove -fhonor-std, -fno-honor-std.
* rtti.c (init_rtti_processing): Adjust.
testsuite:
Kill -fhonor-std.
* g++.old-deja/g++.ns/ns14.C: Remove special options.
* g++.old-deja/g++.other/std1.C: Likewise.
* g++.old-deja/g++.robertl/eb133.C: Likewise. Add using directive.

From-SVN: r44569

17 files changed:
gcc/ChangeLog
gcc/cp/ChangeLog
gcc/cp/NEWS
gcc/cp/cp-tree.h
gcc/cp/decl.c
gcc/cp/decl2.c
gcc/cp/dump.c
gcc/cp/except.c
gcc/cp/init.c
gcc/cp/lang-options.h
gcc/cp/rtti.c
gcc/doc/c-tree.texi
gcc/doc/invoke.texi
gcc/testsuite/ChangeLog
gcc/testsuite/g++.old-deja/g++.ns/ns14.C
gcc/testsuite/g++.old-deja/g++.other/std1.C
gcc/testsuite/g++.old-deja/g++.robertl/eb133.C

index 27de1f8509fe52dcf7f4687d66f450b7979e68ac..ee75869dfa7b7da34eacd05ed70d33d8000328ac 100644 (file)
@@ -1,3 +1,10 @@
+2001-08-02  Nathan Sidwell  <nathan@codesourcery.com>
+
+       Kill -fhonor-std.
+       * doc/c-tree.texi (Namespaces): Remove std & -fhonor-std
+       interaction.
+       * doc/invoke.texi (C++ Dialect Options): Remove -fno-honor-std.
+
 2001-08-02  Richard Sandiford  <rsandifo@redhat.com>
 
        * mips.md (movdicc): Make conditional on TARGET_64BIT.  Likewise
index 393da2e43322384baa4acf8f6dda276d9bfb5aa2..7474c83f264f7772d8e4c7b9d31db336ce01c756 100644 (file)
@@ -1,3 +1,33 @@
+2001-08-02  Nathan Sidwell  <nathan@codesourcery.com>
+
+       Kill -fhonor-std.
+       * NEWS: Document.
+       * cp-tree.h (flag_honor_std): Remove.
+       (CPTI_FAKE_STD): Remove.
+       (std_node): Remove comment about it being NULL.
+       (fake_std_node): Remove.
+       * decl.c (in_fake_std): Remove.
+       (walk_namespaces_r): Remove fake_std_node check.
+       (push_namespace): Remove in_fake_std code.
+       (pop_namespace): Likewise.
+       (lookup_name_real): Remove fake_std_node check.
+       (init_decl_processing): Always create std_node. Always add
+       std:: things there.
+       (builtin_function): Always put non '_' fns in std.
+       * decl2.c (flag_honor_std): Remove.
+       (lang_f_options): Remove honor-std.
+       (unsupported_options): Add honor-std.
+       (set_decl_namespace): Remove fake_std_node check.
+       (validate_nonmember_using_decl): Likewise.
+       (do_using_directive): Likewise.
+       (handle_class_head): Likewise.
+       * dump.c (cp_dump_tree): Likewise.
+       * except.c (init_exception_processing): Adjust.
+       * init.c (build_member_call): Remove fake_std_node check.
+       (build_offset_ref): Likewise.
+       * lang-options.h: Remove -fhonor-std, -fno-honor-std.
+       * rtti.c (init_rtti_processing): Adjust.
+
 2001-07-31  Alexandre Petit-Bianco  <apbianco@redhat.com>
 
        * tree.c (cp_tree_equal): WITH_CLEANUP_EXPR node to use its second
index 69b6fb46ff725068d9eeba3772d3afa5f05214ab..2d3632cdf015957b32c3f886c97434dfe84cf1b0 100644 (file)
@@ -1,5 +1,9 @@
 *** Changes in GCC 3.1:
 
+* -fhonor-std and -fno-honor-std have been removed. -fno-honor-std was
+  a workaround to allow std compliant code to work with the non-std
+  compliant libstdc++-v2. libstdc++-v3 is std compliant.
+
 * The C++ ABI has been changed to correctly handle this code:
        
     struct A {
index c485c4341dad3b1748d22d0004c8f839af3f07f1..4980cf4bf6763a13c7a9981af6eb8d84f57bc791 100644 (file)
@@ -209,10 +209,6 @@ Boston, MA 02111-1307, USA.  */
 
 extern int flag_use_cxa_atexit;
 
-/* Nonzero to not ignore namespace std. */
-
-extern int flag_honor_std;
-
 /* Nonzero means generate 'rtti' that give run-time type information.  */
 
 extern int flag_rtti;
@@ -526,7 +522,6 @@ enum cp_tree_index
     CPTI_VTBL_TYPE,
     CPTI_VTBL_PTR_TYPE,
     CPTI_STD,
-    CPTI_FAKE_STD,
     CPTI_ABI,
     CPTI_TYPE_INFO_TYPE,
     CPTI_TINFO_DECL_TYPE,
@@ -613,14 +608,7 @@ extern tree cp_global_trees[CPTI_MAX];
 #define unknown_type_node              cp_global_trees[CPTI_UNKNOWN_TYPE]
 #define vtbl_type_node                 cp_global_trees[CPTI_VTBL_TYPE]
 #define vtbl_ptr_type_node             cp_global_trees[CPTI_VTBL_PTR_TYPE]
-/* When the `std' namespace is a real namespace, this is the
-   corresponding NAMESPACE_DECL.  When the `std' namespace is an alias
-   for the global namespace, this is NULL_TREE.  */
 #define std_node                       cp_global_trees[CPTI_STD]
-/* When the `std' namespace is a real namespace, this is the
-   ERROR_MARK_NODE.  Otherwise, this is a dummy NAMESPACE_DECL that
-   should be treated like the global namespace.  */
-#define fake_std_node                   cp_global_trees[CPTI_FAKE_STD]
 #define abi_node                        cp_global_trees[CPTI_ABI]
 #define type_info_type_node            cp_global_trees[CPTI_TYPE_INFO_TYPE]
 #define tinfo_decl_type                        cp_global_trees[CPTI_TINFO_DECL_TYPE]
index c9867da52099adecf5a71174a2e0360526680caf..1a34bb9ed614aa9967a443edcfc6f35207039cb7 100644 (file)
@@ -206,11 +206,6 @@ tree cp_global_trees[CPTI_MAX];
 
 static tree global_type_node;
 
-/* If non-zero, this is the number of times we have entered the `std'
-   namespace when we are treating that namespace as an alias for the
-   global namespace.  */
-static int in_fake_std;
-
 /* Expect only namespace names now. */
 static int only_namespace_names;
 
@@ -1794,12 +1789,6 @@ walk_namespaces_r (namespace, f, data)
       if (TREE_CODE (current) != NAMESPACE_DECL
          || DECL_NAMESPACE_ALIAS (current))
        continue;
-      if (!DECL_LANG_SPECIFIC (current))
-       {
-         /* Hmm. std. */
-         my_friendly_assert (current == fake_std_node, 393);
-         continue;
-       }
 
       /* We found a namespace.  */
       result |= walk_namespaces_r (current, f, data);
@@ -2279,13 +2268,6 @@ push_namespace (name)
         need_new = 0;
       implicit_use = 1;
     }
-  else if (current_namespace == global_namespace
-          && !flag_honor_std
-          && name == std_identifier)
-    {
-      in_fake_std++;
-      return;
-    }
   else
     {
       /* Check whether this is an extended namespace definition. */
@@ -2331,12 +2313,7 @@ push_namespace (name)
 void
 pop_namespace ()
 {
-  if (current_namespace == global_namespace)
-    {
-      my_friendly_assert (in_fake_std > 0, 980421);
-      in_fake_std--;
-      return;
-    }
+  my_friendly_assert (current_namespace != global_namespace, 20010801);
   current_namespace = CP_DECL_CONTEXT (current_namespace);
   /* The binding level is not popped, as it might be re-opened later.  */
   suspend_binding_level ();
@@ -5892,10 +5869,6 @@ lookup_name_real (name, prefer_type, nonclass, namespaces_only)
       if (looking_for_template)
         flags |= LOOKUP_TEMPLATES_EXPECTED;
 
-      /* std:: becomes :: for now.  */
-      if (got_scope && got_scope == fake_std_node)
-       got_scope = void_type_node;
-
       if (got_scope)
        type = got_scope;
       else if (got_object != error_mark_node)
@@ -6377,20 +6350,9 @@ init_decl_processing ()
   declare_namespace_level ();
 
   /* Create the `std' namespace.  */
-  if (flag_honor_std)
-    {
-      push_namespace (std_identifier);
-      std_node = current_namespace;
-      pop_namespace ();
-      fake_std_node = error_mark_node;
-    }
-  else
-    {
-      fake_std_node = build_decl (NAMESPACE_DECL,
-                                 std_identifier,
-                                 void_type_node);
-      pushdecl (fake_std_node);
-    }
+  push_namespace (std_identifier);
+  std_node = current_namespace;
+  pop_namespace ();
 
   c_common_nodes_and_builtins ();
 
@@ -6492,12 +6454,10 @@ init_decl_processing ()
     tree bad_alloc_type_node, newtype, deltype;
     tree ptr_ftype_sizetype;
 
-    if (flag_honor_std)
-      push_namespace (std_identifier);
+    push_namespace (std_identifier);
     bad_alloc_type_node = xref_tag
       (class_type_node, get_identifier ("bad_alloc"), 1);
-    if (flag_honor_std)
-      pop_namespace ();
+    pop_namespace ();
     ptr_ftype_sizetype 
       = build_function_type (ptr_type_node,
                             tree_cons (NULL_TREE,
@@ -6666,13 +6626,13 @@ builtin_function (name, type, code, class, libname)
 
   /* All builtins that don't begin with an `_' should go in the `std'
      namespace.  */
-  if (flag_honor_std && name[0] != '_')
+  if (name[0] != '_')
     {
       push_namespace (std_identifier);
       DECL_CONTEXT (decl) = std_node;
     }
   pushdecl (decl);
-  if (flag_honor_std && name[0] != '_')
+  if (name[0] != '_')
     pop_namespace ();
 
   /* Since `pushdecl' relies on DECL_ASSEMBLER_NAME instead of DECL_NAME,
index 7ce343c08997ed6e25ab311c64f805fe4c1a30b6..1b7be185116df5dc3a5b8fe5ddb0be6ecb81445a 100644 (file)
@@ -378,10 +378,6 @@ int flag_weak = 1;
 
 int flag_use_cxa_atexit;
 
-/* Nonzero to not ignore namespace std. */
-
-int flag_honor_std = 1;
-
 /* 0 if we should not perform inlining.
    1 if we should expand functions calls inline at the tree level.  
    2 if we should consider *all* functions to be inline 
@@ -448,7 +444,6 @@ lang_f_options[] =
   {"for-scope", &flag_new_for_scope, 2},
   {"gnu-keywords", &flag_no_gnu_keywords, 0},
   {"handle-exceptions", &flag_exceptions, 1},
-  {"honor-std", &flag_honor_std, 1},
   {"implement-inlines", &flag_implement_inlines, 1},
   {"implicit-inline-templates", &flag_implicit_inline_templates, 1},
   {"implicit-templates", &flag_implicit_templates, 1},
@@ -473,6 +468,7 @@ static const char * const unsupported_options[] = {
   "cond-mismatch",
   "enum-int-equiv",
   "guiding-decls",
+  "honor-std",
   "huge-objects",
   "labels-ok",
   "new-abi",
@@ -4403,8 +4399,7 @@ set_decl_namespace (decl, scope, friendp)
      int friendp;
 {
   tree old;
-  if (scope == fake_std_node)
-    scope = global_namespace;
+  
   /* Get rid of namespace aliases. */
   scope = ORIGINAL_NAMESPACE (scope);
   
@@ -4913,13 +4908,7 @@ validate_nonmember_using_decl (decl, scope, name)
      tree *scope;
      tree *name;
 {
-  if (TREE_CODE (decl) == SCOPE_REF
-      && TREE_OPERAND (decl, 0) == fake_std_node)
-    {
-      *scope = global_namespace;
-      *name = TREE_OPERAND (decl, 1);
-    }
-  else if (TREE_CODE (decl) == SCOPE_REF)
+  if (TREE_CODE (decl) == SCOPE_REF)
     {
       *scope = TREE_OPERAND (decl, 0);
       *name = TREE_OPERAND (decl, 1);
@@ -5156,8 +5145,6 @@ void
 do_using_directive (namespace)
      tree namespace;
 {
-  if (namespace == fake_std_node)
-    return;
   if (building_stmt_tree ())
     add_stmt (build_stmt (USING_STMT, namespace));
   
@@ -5260,8 +5247,6 @@ handle_class_head (aggr, scope, id)
   
       if (current == NULL_TREE)
         current = current_namespace;
-      if (scope == fake_std_node)
-        scope = global_namespace;
       if (scope == NULL_TREE)
         scope = global_namespace;
 
index 4826585c11d4596297d8cd14a1e7534fe0f46771..17a6b30b7058cd472a599f2914b409b6d5eaeec2 100644 (file)
@@ -158,10 +158,6 @@ cp_dump_tree (di, t)
       break;
 
     case NAMESPACE_DECL:
-      /* The fake `::std' namespace does not have DECL_LANG_SPECIFIC,
-        and therefore many other macros do not work on it.  */
-      if (t == fake_std_node)
-       break;
       if (DECL_NAMESPACE_ALIAS (t))
        dump_child ("alis", DECL_NAMESPACE_ALIAS (t));
       else if (!dump_flag (di, TDF_SLIM, t))
index 46ffd6e5b760a74dd95987185192ce2df3caa0f6..fef5b53ec62f3dc2cd768b045c2764687d39a4af 100644 (file)
@@ -62,16 +62,13 @@ init_exception_processing ()
 {
   tree tmp;
 
-  if (flag_honor_std)
-    push_namespace (std_identifier);
-
   /* void std::terminate (); */
+  push_namespace (std_identifier);
   tmp = build_function_type (void_type_node, void_list_node);
   terminate_node = build_cp_library_fn_ptr ("terminate", tmp);
   TREE_THIS_VOLATILE (terminate_node) = 1;
   TREE_NOTHROW (terminate_node) = 1;
-  if (flag_honor_std)
-    pop_namespace ();
+  pop_namespace ();
 
   /* void __cxa_call_unexpected(void *); */
   tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node);
index 6dbef0b336147971f151ac920a1faabc5b1f3b5e..487543e6386c9671ac1ecc9cec07c888dd2b5149 100644 (file)
@@ -1503,9 +1503,6 @@ build_member_call (type, name, parmlist)
   if (DECL_P (name))
     name = DECL_NAME (name);
 
-  if (type == fake_std_node)
-    return build_x_function_call (do_scoped_id (name, 0), parmlist,
-                                 current_class_ref);
   if (TREE_CODE (type) == NAMESPACE_DECL)
     return build_x_function_call (lookup_namespace_name (type, name),
                                  parmlist, current_class_ref);
@@ -1638,9 +1635,6 @@ build_offset_ref (type, name)
   if (TREE_CODE (name) == TEMPLATE_DECL)
     return name;
 
-  if (type == fake_std_node)
-    return do_scoped_id (name, 0);
-
   if (processing_template_decl || uses_template_parms (type))
     return build_min_nt (SCOPE_REF, type, name);
 
index 172461a95065e5480752019028b7f24044ea049f..5a3f94a4d408c2e48d1a6db545f965fafd89c8ab 100644 (file)
@@ -64,9 +64,6 @@ DEFINE_LANG_NAME ("C++")
     N_("Do not recognise GNU defined keywords") },
   { "-fhandle-exceptions", "" },
   { "-fno-handle-exceptions", "" },
-  { "-fhonor-std", "" },
-  { "-fno-honor-std", 
-    N_("Do not treat the namespace `std' as a normal namespace") },
   { "-fhuge-objects", 
     N_("Enable support for huge objects") },
   { "-fno-huge-objects", "" },
index da1484c931d2a6ec2ef1f601403fbcb6e8b15996..f8c6031e45eac5cf4ed927cfb518fba18aa7b56d 100644 (file)
@@ -71,12 +71,10 @@ static int doing_runtime = 0;
 void
 init_rtti_processing ()
 {
-  if (flag_honor_std)
-    push_namespace (std_identifier);
+  push_namespace (std_identifier);
   type_info_type_node = xref_tag
     (class_type_node, get_identifier ("type_info"), 1);
-  if (flag_honor_std)
-    pop_namespace ();
+  pop_namespace ();
   tinfo_decl_type = 
     build_qualified_type (type_info_type_node, TYPE_QUAL_CONST);
 }
index a35ab4550e9c0105ecd493591bdd69212186215b..7d926c7538868a297295e3865edc947db1c78084 100644 (file)
@@ -620,22 +620,6 @@ representation, the global namespace is no different from any other
 namespace.  Thus, in what follows, we describe namespaces generally,
 rather than the global namespace in particular.
 
-The @code{::std} namespace, however, @emph{is} special when
-@code{flag_honor_std} is not set.  When @code{flag_honor_std} is set,
-the @code{std} namespace is just like any other namespace.  When
-@code{flag_honor_std} is not set, however, the @code{::std} namespace is
-treated as a synonym for the global namespace, thereby allowing users to
-write code that will work with compilers that put the standard library
-in the @code{::std} namespace.  The @code{std} namespace is represented
-by the variable @code{std_node}.  Although @code{std_node} is a
-@code{NAMESPACE_DECL}, it does not have all the fields required of a
-real namespace, and the macros and functions described here do not work,
-in general.  It is safest simply to ignore @code{std_node} should you
-encounter it while examining the internal representation.  In
-particular, you will encounter @code{std_node} while looking at the
-members of the global namespace.  Just skip it without attempting to
-examine its members.
-
 The following macros and functions can be used on a @code{NAMESPACE_DECL}:
 
 @ftable @code
index d51e20105fb23acc10b77ae0edc3fbef5e05ef62..7f1a79c2b20bc19956c8ec999d517e404b124b68 100644 (file)
@@ -174,7 +174,7 @@ in the following sections.
 -fno-elide-constructors @gol
 -fno-enforce-eh-specs  -fexternal-templates @gol
 -falt-external-templates @gol
--ffor-scope  -fno-for-scope  -fno-gnu-keywords  -fno-honor-std @gol
+-ffor-scope  -fno-for-scope  -fno-gnu-keywords @gol
 -fno-implicit-templates @gol
 -fno-implicit-inline-templates @gol
 -fno-implement-inlines  -fms-extensions @gol
@@ -1356,19 +1356,6 @@ Do not recognize @code{typeof} as a keyword, so that code can use this
 word as an identifier.  You can use the keyword @code{__typeof__} instead.
 @option{-ansi} implies @option{-fno-gnu-keywords}.
 
-@item -fno-honor-std
-@opindex fno-honor-std
-Ignore @code{namespace std}, instead of treating it as a real namespace.
-With this switch, the compiler will ignore
-@code{namespace-declarations}, @code{using-declarations},
-@code{using-directives}, and @code{namespace-names}, if they involve
-@code{std}.
-
-This option is only useful if you have manually compiled the C++
-run-time library with the same switch.  Otherwise, your programs will
-not link.  The use of this option is not recommended, and the option may
-be removed from a future version of G++.
-
 @item -fno-implicit-templates
 @opindex fno-implicit-templates
 Never emit code for non-inline templates which are instantiated
index 0fd0ee30fc7f143d5901faabfa4ee87b04287105..d5ae377b1b03550d9b5669ac2bf5c18d6daab441 100644 (file)
@@ -1,3 +1,10 @@
+2001-08-02  Nathan Sidwell  <nathan@codesourcery.com>
+
+       Kill -fhonor-std.
+       * g++.old-deja/g++.ns/ns14.C: Remove special options.
+       * g++.old-deja/g++.other/std1.C: Likewise.
+       * g++.old-deja/g++.robertl/eb133.C: Likewise. Add using directive.
+
 2001-08-01  David Billinghurst <David.Billinghurst@riotinto.com>
 
        * lib/g77.exp:  Load gcc-defs.exp for common procedures
index 5a3cc7010748aeabb9a47ea021ad062c8f549565..4049139eae9feede389f9ea5fa81c12645f3d248 100644 (file)
@@ -1,4 +1,4 @@
-//Special g++ Options: -fhonor-std
+
 namespace std{ 
   int f(){
     return 0;
index 21a232a0879bf65b2afb2d0d09e41615f31e5df3..dc36519d0506c12770291c4e99713d052290c53d 100644 (file)
@@ -1,5 +1,4 @@
 // Build don't link:
-// Special g++ Options: -fhonor-std
 // Origin: Mark Mitchell <mark@codesourcery.com>
 
 extern "C" int memcmp (const void * __s1,
index 788d60388cca1bd42c180fde42720f08dd555e82..e2b25f6ef08cf473e5727d1dd6ef481214771ccd 100644 (file)
@@ -1,9 +1,10 @@
 // Build don't link:
-// Special g++ Options: -fno-honor-std
 // Gives ICE 109
 // From: Klaus-Georg Adams <Klaus-Georg.Adams@chemie.uni-karlsruhe.de> 
 // Reported against EGCS snaps 98/06/28.
 
+using namespace std;
+
 int main()
 {
        try {