From 319285566b1f3cca49a1188fc6825e794982caa9 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Sun, 23 Aug 1998 22:00:27 -0400 Subject: [PATCH] lex.c (real_yylex): Don't warn about long long constants if we're allowing long long. * lex.c (real_yylex): Don't warn about long long constants if we're allowing long long. * decl.c (pushdecl): Use IDENTIFIER_NAMESPACE_VALUE instead of accessing bindings directly. * lang-specs.h: Remove __HONOR_STD. * inc/exception, inc/new, inc/new.h, inc/typeinfo: Likewise. From-SVN: r21926 --- gcc/cp/ChangeLog | 13 +++++++++++++ gcc/cp/decl.c | 34 ++++++++++++++++------------------ gcc/cp/inc/exception | 4 ---- gcc/cp/inc/new | 4 ---- gcc/cp/inc/new.h | 2 -- gcc/cp/inc/typeinfo | 4 ---- gcc/cp/lang-specs.h | 3 --- gcc/cp/lex.c | 2 +- 8 files changed, 30 insertions(+), 36 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 4fa37401874..3e511084efe 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,16 @@ +1998-08-24 Nathan Sidwell + + * lex.c (real_yylex): Don't warn about long long constants if + we're allowing long long. + +1998-08-23 Martin von Löwis + + * decl.c (pushdecl): Use IDENTIFIER_NAMESPACE_VALUE instead of + accessing bindings directly. + + * lang-specs.h: Remove __HONOR_STD. + * inc/exception, inc/new, inc/new.h, inc/typeinfo: Likewise. + 1998-08-23 Mark Mitchell * decl.c (grokdeclarator): Complain about in-class initialization diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 5940996510c..4942b5d0f58 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -3503,12 +3503,11 @@ pushdecl (x) if (TREE_PUBLIC (x) && TREE_CODE (x) != FUNCTION_DECL) { tree decl; - tree bindings = binding_for_name (name, current_namespace); - if (BINDING_VALUE (bindings) != NULL_TREE - && (DECL_EXTERNAL (BINDING_VALUE (bindings)) - || TREE_PUBLIC (BINDING_VALUE (bindings)))) - decl = BINDING_VALUE (bindings); + if (IDENTIFIER_NAMESPACE_VALUE (name) != NULL_TREE + && (DECL_EXTERNAL (IDENTIFIER_NAMESPACE_VALUE (name)) + || TREE_PUBLIC (IDENTIFIER_NAMESPACE_VALUE (name)))) + decl = IDENTIFIER_NAMESPACE_VALUE (name); else decl = NULL_TREE; @@ -3527,11 +3526,10 @@ pushdecl (x) if (namespace_bindings_p ()) { /* Install a global value. */ - tree bindings = binding_for_name (name, current_namespace); /* If the first global decl has external linkage, warn if we later see static one. */ - if (BINDING_VALUE (bindings) == NULL_TREE && TREE_PUBLIC (x)) + if (IDENTIFIER_GLOBAL_VALUE (name) == NULL_TREE && TREE_PUBLIC (x)) TREE_PUBLIC (name) = 1; /* Don't install an artificial TYPE_DECL if we already have @@ -3541,9 +3539,10 @@ pushdecl (x) || ! DECL_ARTIFICIAL (x)) { if (TREE_CODE (x) == FUNCTION_DECL) - my_friendly_assert ((BINDING_VALUE (bindings) == NULL_TREE) - || BINDING_VALUE (bindings) == x, 378); - BINDING_VALUE (bindings) = x; + my_friendly_assert + ((IDENTIFIER_GLOBAL_VALUE (name) == NULL_TREE) + || (IDENTIFIER_GLOBAL_VALUE (name) == x), 378); + SET_IDENTIFIER_NAMESPACE_VALUE (name, x); } /* Don't forget if the function was used via an implicit decl. */ @@ -3573,7 +3572,7 @@ pushdecl (x) { /* Here to install a non-global value. */ tree oldlocal = IDENTIFIER_LOCAL_VALUE (name); - tree oldglobal = binding_for_name (name, current_namespace); + tree oldglobal = IDENTIFIER_NAMESPACE_VALUE (name); /* Don't install an artificial TYPE_DECL if we already have another _DECL with that name. */ @@ -3596,24 +3595,24 @@ pushdecl (x) have a global definition or declaration for the function. */ if (oldlocal == NULL_TREE && DECL_EXTERNAL (x) - && BINDING_VALUE (oldglobal) != NULL_TREE + && oldglobal != NULL_TREE && TREE_CODE (x) == FUNCTION_DECL - && TREE_CODE (BINDING_VALUE (oldglobal)) == FUNCTION_DECL) + && TREE_CODE (oldglobal) == FUNCTION_DECL) { /* We have one. Their types must agree. */ - if (decls_match (x, BINDING_VALUE (oldglobal))) + if (decls_match (x, oldglobal)) /* OK */; else { cp_warning ("extern declaration of `%#D' doesn't match", x); - cp_warning_at ("global declaration `%#D'", BINDING_VALUE (oldglobal)); + cp_warning_at ("global declaration `%#D'", oldglobal); } } /* If we have a local external declaration, and no file-scope declaration has yet been seen, then if we later have a file-scope decl it must not be static. */ if (oldlocal == NULL_TREE - && BINDING_VALUE (oldglobal) == NULL_TREE + && oldglobal == NULL_TREE && DECL_EXTERNAL (x) && TREE_PUBLIC (x)) { @@ -3663,7 +3662,7 @@ pushdecl (x) warnstring = "declaration of `%s' shadows a member of `this'"; else if (oldlocal != NULL_TREE) warnstring = "declaration of `%s' shadows previous local"; - else if (BINDING_VALUE (oldglobal) != NULL_TREE) + else if (oldglobal != NULL_TREE) /* XXX shadow warnings in outer-more namespaces */ warnstring = "declaration of `%s' shadows global declaration"; @@ -4505,7 +4504,6 @@ lookup_tag (form, name, binding_level, thislevel_only) } else if (level->namespace_p) /* Do namespace lookup. */ - /* XXX: is this a real lookup, considering using-directives etc. ??? */ for (tail = current_namespace; 1; tail = CP_DECL_CONTEXT (tail)) { tree old = binding_for_name (name, tail); diff --git a/gcc/cp/inc/exception b/gcc/cp/inc/exception index 9954146bf4c..b7aa1f42d40 100644 --- a/gcc/cp/inc/exception +++ b/gcc/cp/inc/exception @@ -8,9 +8,7 @@ extern "C++" { -#ifdef __HONOR_STD namespace std { -#endif class exception { public: @@ -34,9 +32,7 @@ unexpected_handler set_unexpected (unexpected_handler); void unexpected () __attribute__ ((__noreturn__)); bool uncaught_exception (); -#ifdef __HONOR_STD } // namespace std -#endif } // extern "C++" diff --git a/gcc/cp/inc/new b/gcc/cp/inc/new index 0f25a5c2b85..93a3231ab69 100644 --- a/gcc/cp/inc/new +++ b/gcc/cp/inc/new @@ -10,9 +10,7 @@ extern "C++" { -#ifdef __HONOR_STD namespace std { -#endif class bad_alloc : public exception { public: @@ -24,9 +22,7 @@ namespace std { typedef void (*new_handler)(); new_handler set_new_handler (new_handler); -#ifdef __HONOR_STD } // namespace std -#endif // replaceable signatures void *operator new (size_t) throw (std::bad_alloc); diff --git a/gcc/cp/inc/new.h b/gcc/cp/inc/new.h index 799db7eeaed..006be7efb07 100644 --- a/gcc/cp/inc/new.h +++ b/gcc/cp/inc/new.h @@ -5,9 +5,7 @@ #include -#ifdef __HONOR_STD using std::new_handler; using std::set_new_handler; -#endif #endif // __NEW_H__ diff --git a/gcc/cp/inc/typeinfo b/gcc/cp/inc/typeinfo index 64b2a819a1e..a735525b7b8 100644 --- a/gcc/cp/inc/typeinfo +++ b/gcc/cp/inc/typeinfo @@ -8,9 +8,7 @@ extern "C++" { -#ifdef __HONOR_STD namespace std { -#endif class type_info { private: @@ -63,9 +61,7 @@ class bad_typeid : public exception { virtual ~bad_typeid () { } }; -#ifdef __HONOR_STD } // namespace std -#endif } // extern "C++" #endif diff --git a/gcc/cp/lang-specs.h b/gcc/cp/lang-specs.h index b208ca18dbc..8daebbc308a 100644 --- a/gcc/cp/lang-specs.h +++ b/gcc/cp/lang-specs.h @@ -36,7 +36,6 @@ Boston, MA 02111-1307, USA. */ -undef -D__GNUC__=%v1 -D__GNUG__=%v1 -D__cplusplus -D__GNUC_MINOR__=%v2\ %{ansi:-trigraphs -D__STRICT_ANSI__} %{!undef:%{!ansi:%p} %P}\ %{!fno-exceptions:-D__EXCEPTIONS}\ - %{fhonor-std:-D__HONOR_STD} %{fnew-abi:-D__HONOR_STD}\ %c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}} %{trigraphs}\ %{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*} %Z\ %i %{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}}\n}\ @@ -46,7 +45,6 @@ Boston, MA 02111-1307, USA. */ -D__GNUC_MINOR__=%v2\ %{ansi:-trigraphs -D__STRICT_ANSI__} %{!undef:%{!ansi:%p} %P}\ %{!fno-exceptions:-D__EXCEPTIONS}\ - %{fhonor-std:-D__HONOR_STD} %{fnew-abi:-D__HONOR_STD}\ %c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\ %{trigraphs}\ %{!Q:-quiet} -dumpbase %b.cc %{d*} %{m*} %{a}\ @@ -66,7 +64,6 @@ Boston, MA 02111-1307, USA. */ -undef -D__GNUC__=%v1 -D__GNUG__=%v1 -D__cplusplus -D__GNUC_MINOR__=%v2\ %{ansi:-trigraphs -D__STRICT_ANSI__} %{!undef:%{!ansi:%p} %P}\ %{!fno-exceptions:-D__EXCEPTIONS}\ - %{fhonor-std:-D__HONOR_STD} %{fnew-abi:-D__HONOR_STD}\ %c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}} %{trigraphs}\ %{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*} %Z\ %i %{!M:%{!MM:%{!E:%{!pipe:%g.ii}}}}%{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}} |\n", diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c index 8ded741b576..36c5c74f4e8 100644 --- a/gcc/cp/lex.c +++ b/gcc/cp/lex.c @@ -3823,7 +3823,7 @@ real_yylex () { if (spec_long_long) error ("three `l's in integer constant"); - else if (pedantic) + else if (pedantic && ! in_system_header && warn_long_long) pedwarn ("ANSI C++ forbids long long integer constants"); spec_long_long = 1; } -- 2.30.2