From 1dbb6023c73cfb340b24d8c81cf31f41f8f1805b Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Thu, 2 Aug 2001 10:51:17 +0000 Subject: Kill -fhonor-std. .: 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 --- gcc/ChangeLog | 7 ++++ gcc/cp/ChangeLog | 30 ++++++++++++++ gcc/cp/NEWS | 4 ++ gcc/cp/cp-tree.h | 12 ------ gcc/cp/decl.c | 56 ++++---------------------- gcc/cp/decl2.c | 21 ++-------- gcc/cp/dump.c | 4 -- gcc/cp/except.c | 7 +--- gcc/cp/init.c | 6 --- gcc/cp/lang-options.h | 3 -- gcc/cp/rtti.c | 6 +-- gcc/doc/c-tree.texi | 16 -------- gcc/doc/invoke.texi | 15 +------ gcc/testsuite/ChangeLog | 7 ++++ gcc/testsuite/g++.old-deja/g++.ns/ns14.C | 2 +- gcc/testsuite/g++.old-deja/g++.other/std1.C | 1 - gcc/testsuite/g++.old-deja/g++.robertl/eb133.C | 3 +- 17 files changed, 67 insertions(+), 133 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 27de1f8..ee75869 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2001-08-02 Nathan Sidwell + + 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 * mips.md (movdicc): Make conditional on TARGET_64BIT. Likewise diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 393da2e..7474c83 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,33 @@ +2001-08-02 Nathan Sidwell + + 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 * tree.c (cp_tree_equal): WITH_CLEANUP_EXPR node to use its second diff --git a/gcc/cp/NEWS b/gcc/cp/NEWS index 69b6fb4..2d3632c 100644 --- a/gcc/cp/NEWS +++ b/gcc/cp/NEWS @@ -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 { diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index c485c43..4980cf4 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -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] diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index c9867da..1a34bb9 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -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, diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 7ce343c..1b7be18 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -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; diff --git a/gcc/cp/dump.c b/gcc/cp/dump.c index 4826585..17a6b30 100644 --- a/gcc/cp/dump.c +++ b/gcc/cp/dump.c @@ -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)) diff --git a/gcc/cp/except.c b/gcc/cp/except.c index 46ffd6e..fef5b53 100644 --- a/gcc/cp/except.c +++ b/gcc/cp/except.c @@ -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); diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 6dbef0b..487543e 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -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); diff --git a/gcc/cp/lang-options.h b/gcc/cp/lang-options.h index 172461a..5a3f94a 100644 --- a/gcc/cp/lang-options.h +++ b/gcc/cp/lang-options.h @@ -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", "" }, diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c index da1484c..f8c6031 100644 --- a/gcc/cp/rtti.c +++ b/gcc/cp/rtti.c @@ -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); } diff --git a/gcc/doc/c-tree.texi b/gcc/doc/c-tree.texi index a35ab45..7d926c7 100644 --- a/gcc/doc/c-tree.texi +++ b/gcc/doc/c-tree.texi @@ -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 diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index d51e201..7f1a79c 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -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 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0fd0ee3..d5ae377 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2001-08-02 Nathan Sidwell + + 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 * lib/g77.exp: Load gcc-defs.exp for common procedures diff --git a/gcc/testsuite/g++.old-deja/g++.ns/ns14.C b/gcc/testsuite/g++.old-deja/g++.ns/ns14.C index 5a3cc70..4049139 100644 --- a/gcc/testsuite/g++.old-deja/g++.ns/ns14.C +++ b/gcc/testsuite/g++.old-deja/g++.ns/ns14.C @@ -1,4 +1,4 @@ -//Special g++ Options: -fhonor-std + namespace std{ int f(){ return 0; diff --git a/gcc/testsuite/g++.old-deja/g++.other/std1.C b/gcc/testsuite/g++.old-deja/g++.other/std1.C index 21a232a..dc36519 100644 --- a/gcc/testsuite/g++.old-deja/g++.other/std1.C +++ b/gcc/testsuite/g++.old-deja/g++.other/std1.C @@ -1,5 +1,4 @@ // Build don't link: -// Special g++ Options: -fhonor-std // Origin: Mark Mitchell extern "C" int memcmp (const void * __s1, diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb133.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb133.C index 788d603..e2b25f6 100644 --- a/gcc/testsuite/g++.old-deja/g++.robertl/eb133.C +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb133.C @@ -1,9 +1,10 @@ // Build don't link: -// Special g++ Options: -fno-honor-std // Gives ICE 109 // From: Klaus-Georg Adams // Reported against EGCS snaps 98/06/28. +using namespace std; + int main() { try { -- cgit v1.1