Commit 31928556 by Jason Merrill

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
parent 46fe5381
1998-08-24 Nathan Sidwell <nathan@acm.org>
* lex.c (real_yylex): Don't warn about long long constants if
we're allowing long long.
1998-08-23 Martin von Lwis <loewis@informatik.hu-berlin.de>
* 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 <mark@markmitchell.com> 1998-08-23 Mark Mitchell <mark@markmitchell.com>
* decl.c (grokdeclarator): Complain about in-class initialization * decl.c (grokdeclarator): Complain about in-class initialization
......
...@@ -3503,12 +3503,11 @@ pushdecl (x) ...@@ -3503,12 +3503,11 @@ pushdecl (x)
if (TREE_PUBLIC (x) && TREE_CODE (x) != FUNCTION_DECL) if (TREE_PUBLIC (x) && TREE_CODE (x) != FUNCTION_DECL)
{ {
tree decl; tree decl;
tree bindings = binding_for_name (name, current_namespace);
if (BINDING_VALUE (bindings) != NULL_TREE if (IDENTIFIER_NAMESPACE_VALUE (name) != NULL_TREE
&& (DECL_EXTERNAL (BINDING_VALUE (bindings)) && (DECL_EXTERNAL (IDENTIFIER_NAMESPACE_VALUE (name))
|| TREE_PUBLIC (BINDING_VALUE (bindings)))) || TREE_PUBLIC (IDENTIFIER_NAMESPACE_VALUE (name))))
decl = BINDING_VALUE (bindings); decl = IDENTIFIER_NAMESPACE_VALUE (name);
else else
decl = NULL_TREE; decl = NULL_TREE;
...@@ -3527,11 +3526,10 @@ pushdecl (x) ...@@ -3527,11 +3526,10 @@ pushdecl (x)
if (namespace_bindings_p ()) if (namespace_bindings_p ())
{ {
/* Install a global value. */ /* Install a global value. */
tree bindings = binding_for_name (name, current_namespace);
/* If the first global decl has external linkage, /* If the first global decl has external linkage,
warn if we later see static one. */ 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; TREE_PUBLIC (name) = 1;
/* Don't install an artificial TYPE_DECL if we already have /* Don't install an artificial TYPE_DECL if we already have
...@@ -3541,9 +3539,10 @@ pushdecl (x) ...@@ -3541,9 +3539,10 @@ pushdecl (x)
|| ! DECL_ARTIFICIAL (x)) || ! DECL_ARTIFICIAL (x))
{ {
if (TREE_CODE (x) == FUNCTION_DECL) if (TREE_CODE (x) == FUNCTION_DECL)
my_friendly_assert ((BINDING_VALUE (bindings) == NULL_TREE) my_friendly_assert
|| BINDING_VALUE (bindings) == x, 378); ((IDENTIFIER_GLOBAL_VALUE (name) == NULL_TREE)
BINDING_VALUE (bindings) = x; || (IDENTIFIER_GLOBAL_VALUE (name) == x), 378);
SET_IDENTIFIER_NAMESPACE_VALUE (name, x);
} }
/* Don't forget if the function was used via an implicit decl. */ /* Don't forget if the function was used via an implicit decl. */
...@@ -3573,7 +3572,7 @@ pushdecl (x) ...@@ -3573,7 +3572,7 @@ pushdecl (x)
{ {
/* Here to install a non-global value. */ /* Here to install a non-global value. */
tree oldlocal = IDENTIFIER_LOCAL_VALUE (name); 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 /* Don't install an artificial TYPE_DECL if we already have
another _DECL with that name. */ another _DECL with that name. */
...@@ -3596,24 +3595,24 @@ pushdecl (x) ...@@ -3596,24 +3595,24 @@ pushdecl (x)
have a global definition or declaration for the function. */ have a global definition or declaration for the function. */
if (oldlocal == NULL_TREE if (oldlocal == NULL_TREE
&& DECL_EXTERNAL (x) && DECL_EXTERNAL (x)
&& BINDING_VALUE (oldglobal) != NULL_TREE && oldglobal != NULL_TREE
&& TREE_CODE (x) == FUNCTION_DECL && TREE_CODE (x) == FUNCTION_DECL
&& TREE_CODE (BINDING_VALUE (oldglobal)) == FUNCTION_DECL) && TREE_CODE (oldglobal) == FUNCTION_DECL)
{ {
/* We have one. Their types must agree. */ /* We have one. Their types must agree. */
if (decls_match (x, BINDING_VALUE (oldglobal))) if (decls_match (x, oldglobal))
/* OK */; /* OK */;
else else
{ {
cp_warning ("extern declaration of `%#D' doesn't match", x); 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, /* If we have a local external declaration,
and no file-scope declaration has yet been seen, and no file-scope declaration has yet been seen,
then if we later have a file-scope decl it must not be static. */ then if we later have a file-scope decl it must not be static. */
if (oldlocal == NULL_TREE if (oldlocal == NULL_TREE
&& BINDING_VALUE (oldglobal) == NULL_TREE && oldglobal == NULL_TREE
&& DECL_EXTERNAL (x) && DECL_EXTERNAL (x)
&& TREE_PUBLIC (x)) && TREE_PUBLIC (x))
{ {
...@@ -3663,7 +3662,7 @@ pushdecl (x) ...@@ -3663,7 +3662,7 @@ pushdecl (x)
warnstring = "declaration of `%s' shadows a member of `this'"; warnstring = "declaration of `%s' shadows a member of `this'";
else if (oldlocal != NULL_TREE) else if (oldlocal != NULL_TREE)
warnstring = "declaration of `%s' shadows previous local"; 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 */ /* XXX shadow warnings in outer-more namespaces */
warnstring = "declaration of `%s' shadows global declaration"; warnstring = "declaration of `%s' shadows global declaration";
...@@ -4505,7 +4504,6 @@ lookup_tag (form, name, binding_level, thislevel_only) ...@@ -4505,7 +4504,6 @@ lookup_tag (form, name, binding_level, thislevel_only)
} }
else if (level->namespace_p) else if (level->namespace_p)
/* Do namespace lookup. */ /* Do namespace lookup. */
/* XXX: is this a real lookup, considering using-directives etc. ??? */
for (tail = current_namespace; 1; tail = CP_DECL_CONTEXT (tail)) for (tail = current_namespace; 1; tail = CP_DECL_CONTEXT (tail))
{ {
tree old = binding_for_name (name, tail); tree old = binding_for_name (name, tail);
......
...@@ -8,9 +8,7 @@ ...@@ -8,9 +8,7 @@
extern "C++" { extern "C++" {
#ifdef __HONOR_STD
namespace std { namespace std {
#endif
class exception { class exception {
public: public:
...@@ -34,9 +32,7 @@ unexpected_handler set_unexpected (unexpected_handler); ...@@ -34,9 +32,7 @@ unexpected_handler set_unexpected (unexpected_handler);
void unexpected () __attribute__ ((__noreturn__)); void unexpected () __attribute__ ((__noreturn__));
bool uncaught_exception (); bool uncaught_exception ();
#ifdef __HONOR_STD
} // namespace std } // namespace std
#endif
} // extern "C++" } // extern "C++"
......
...@@ -10,9 +10,7 @@ ...@@ -10,9 +10,7 @@
extern "C++" { extern "C++" {
#ifdef __HONOR_STD
namespace std { namespace std {
#endif
class bad_alloc : public exception { class bad_alloc : public exception {
public: public:
...@@ -24,9 +22,7 @@ namespace std { ...@@ -24,9 +22,7 @@ namespace std {
typedef void (*new_handler)(); typedef void (*new_handler)();
new_handler set_new_handler (new_handler); new_handler set_new_handler (new_handler);
#ifdef __HONOR_STD
} // namespace std } // namespace std
#endif
// replaceable signatures // replaceable signatures
void *operator new (size_t) throw (std::bad_alloc); void *operator new (size_t) throw (std::bad_alloc);
......
...@@ -5,9 +5,7 @@ ...@@ -5,9 +5,7 @@
#include <new> #include <new>
#ifdef __HONOR_STD
using std::new_handler; using std::new_handler;
using std::set_new_handler; using std::set_new_handler;
#endif
#endif // __NEW_H__ #endif // __NEW_H__
...@@ -8,9 +8,7 @@ ...@@ -8,9 +8,7 @@
extern "C++" { extern "C++" {
#ifdef __HONOR_STD
namespace std { namespace std {
#endif
class type_info { class type_info {
private: private:
...@@ -63,9 +61,7 @@ class bad_typeid : public exception { ...@@ -63,9 +61,7 @@ class bad_typeid : public exception {
virtual ~bad_typeid () { } virtual ~bad_typeid () { }
}; };
#ifdef __HONOR_STD
} // namespace std } // namespace std
#endif
} // extern "C++" } // extern "C++"
#endif #endif
...@@ -36,7 +36,6 @@ Boston, MA 02111-1307, USA. */ ...@@ -36,7 +36,6 @@ Boston, MA 02111-1307, USA. */
-undef -D__GNUC__=%v1 -D__GNUG__=%v1 -D__cplusplus -D__GNUC_MINOR__=%v2\ -undef -D__GNUC__=%v1 -D__GNUG__=%v1 -D__cplusplus -D__GNUC_MINOR__=%v2\
%{ansi:-trigraphs -D__STRICT_ANSI__} %{!undef:%{!ansi:%p} %P}\ %{ansi:-trigraphs -D__STRICT_ANSI__} %{!undef:%{!ansi:%p} %P}\
%{!fno-exceptions:-D__EXCEPTIONS}\ %{!fno-exceptions:-D__EXCEPTIONS}\
%{fhonor-std:-D__HONOR_STD} %{fnew-abi:-D__HONOR_STD}\
%c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}} %{trigraphs}\ %c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}} %{trigraphs}\
%{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*} %Z\ %{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*} %Z\
%i %{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}}\n}\ %i %{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}}\n}\
...@@ -46,7 +45,6 @@ Boston, MA 02111-1307, USA. */ ...@@ -46,7 +45,6 @@ Boston, MA 02111-1307, USA. */
-D__GNUC_MINOR__=%v2\ -D__GNUC_MINOR__=%v2\
%{ansi:-trigraphs -D__STRICT_ANSI__} %{!undef:%{!ansi:%p} %P}\ %{ansi:-trigraphs -D__STRICT_ANSI__} %{!undef:%{!ansi:%p} %P}\
%{!fno-exceptions:-D__EXCEPTIONS}\ %{!fno-exceptions:-D__EXCEPTIONS}\
%{fhonor-std:-D__HONOR_STD} %{fnew-abi:-D__HONOR_STD}\
%c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\ %c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\
%{trigraphs}\ %{trigraphs}\
%{!Q:-quiet} -dumpbase %b.cc %{d*} %{m*} %{a}\ %{!Q:-quiet} -dumpbase %b.cc %{d*} %{m*} %{a}\
...@@ -66,7 +64,6 @@ Boston, MA 02111-1307, USA. */ ...@@ -66,7 +64,6 @@ Boston, MA 02111-1307, USA. */
-undef -D__GNUC__=%v1 -D__GNUG__=%v1 -D__cplusplus -D__GNUC_MINOR__=%v2\ -undef -D__GNUC__=%v1 -D__GNUG__=%v1 -D__cplusplus -D__GNUC_MINOR__=%v2\
%{ansi:-trigraphs -D__STRICT_ANSI__} %{!undef:%{!ansi:%p} %P}\ %{ansi:-trigraphs -D__STRICT_ANSI__} %{!undef:%{!ansi:%p} %P}\
%{!fno-exceptions:-D__EXCEPTIONS}\ %{!fno-exceptions:-D__EXCEPTIONS}\
%{fhonor-std:-D__HONOR_STD} %{fnew-abi:-D__HONOR_STD}\
%c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}} %{trigraphs}\ %c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}} %{trigraphs}\
%{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*} %Z\ %{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", %i %{!M:%{!MM:%{!E:%{!pipe:%g.ii}}}}%{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}} |\n",
......
...@@ -3823,7 +3823,7 @@ real_yylex () ...@@ -3823,7 +3823,7 @@ real_yylex ()
{ {
if (spec_long_long) if (spec_long_long)
error ("three `l's in integer constant"); 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"); pedwarn ("ANSI C++ forbids long long integer constants");
spec_long_long = 1; spec_long_long = 1;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment