diff options
author | Mike Stump <mrs@gcc.gnu.org> | 1996-10-11 20:19:33 +0000 |
---|---|---|
committer | Mike Stump <mrs@gcc.gnu.org> | 1996-10-11 20:19:33 +0000 |
commit | d22c85969b4555d97d16a2f6704bf57b7d712cd3 (patch) | |
tree | 831fede3889f6c6924b3d0336991173527a83689 /gcc | |
parent | 3d4683cb70b1f1f075e7d2c1f865de215f25679d (diff) | |
download | gcc-d22c85969b4555d97d16a2f6704bf57b7d712cd3.zip gcc-d22c85969b4555d97d16a2f6704bf57b7d712cd3.tar.gz gcc-d22c85969b4555d97d16a2f6704bf57b7d712cd3.tar.bz2 |
89th Cygnus<->FSF quick merge
From-SVN: r12953
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/decl.c | 105 | ||||
-rw-r--r-- | gcc/cp/decl2.c | 29 | ||||
-rw-r--r-- | gcc/cp/gxx.gperf | 1 | ||||
-rw-r--r-- | gcc/cp/hash.h | 212 | ||||
-rw-r--r-- | gcc/cp/lex.c | 47 | ||||
-rw-r--r-- | gcc/cp/method.c | 59 | ||||
-rw-r--r-- | gcc/cp/parse.y | 19 | ||||
-rw-r--r-- | gcc/cp/pt.c | 6 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 67 | ||||
-rw-r--r-- | gcc/cp/typeck2.c | 7 |
10 files changed, 167 insertions, 385 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 245d521..5aca192 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -562,7 +562,7 @@ struct binding_level /* List of VAR_DECLS saved from a previous for statement. These would be dead in ANSI-conforming code, but might - be referenced in traditional code. */ + be referenced in ARM-era code. */ tree dead_vars_from_for; /* 1 for the level that holds the parameters of a function. @@ -591,7 +591,7 @@ struct binding_level unsigned namespace_p : 1; /* True if this level is that of a for-statement where we need to - worry about ambiguous (traditional or ANSI) scope rules. */ + worry about ambiguous (ARM or ANSI) scope rules. */ unsigned is_for_scope : 1; /* Two bits left for this word. */ @@ -2067,16 +2067,6 @@ pushtag (name, type, globalize) newdecl = 1; d = build_decl (TYPE_DECL, name, type); SET_DECL_ARTIFICIAL (d); -#ifdef DWARF_DEBUGGING_INFO - if (write_symbols == DWARF_DEBUG) - { - /* Mark the TYPE_DECL node we created just above as an - gratuitous one. We need to do this so that dwarfout.c - will understand that it is not supposed to output a - TAG_typedef DIE for it. */ - DECL_IGNORED_P (d) = 1; - } -#endif /* DWARF_DEBUGGING_INFO */ set_identifier_type_value_with_scope (name, type, b); } else @@ -2103,17 +2093,6 @@ pushtag (name, type, globalize) newdecl = 1; d = build_decl (TYPE_DECL, name, type); SET_DECL_ARTIFICIAL (d); -#ifdef DWARF_DEBUGGING_INFO - if (write_symbols == DWARF_DEBUG) - { - /* Mark the TYPE_DECL node we created just above as an - gratuitous one. We need to do this so that dwarfout.c - will understand that it is not supposed to output a - TAG_typedef DIE for it. */ - DECL_IGNORED_P (d) = 1; - } -#endif /* DWARF_DEBUGGING_INFO */ - TYPE_MAIN_DECL (type) = d; DECL_CONTEXT (d) = context; if (! globalize && processing_template_decl && IS_AGGR_TYPE (type)) @@ -2334,9 +2313,6 @@ decls_match (newdecl, olddecl) Note that this does not apply to the C++ case of declaring a variable `extern const' and then later `const'. - Don't complain if -traditional, since traditional compilers - don't complain. - Don't complain about built-in functions, since they are beyond the user's control. */ @@ -2351,8 +2327,7 @@ warn_extern_redeclared_static (newdecl, olddecl) static char *implicit_extern_static_warning = "`%D' was declared implicitly `extern' and later `static'"; - if (flag_traditional - || TREE_CODE (newdecl) == TYPE_DECL) + if (TREE_CODE (newdecl) == TYPE_DECL) return; name = DECL_ASSEMBLER_NAME (newdecl); @@ -2413,14 +2388,9 @@ duplicate_decls (newdecl, olddecl) && TREE_CODE (TREE_TYPE (olddecl)) == ERROR_MARK)) types_match = 1; - if (flag_traditional && TREE_CODE (newdecl) == FUNCTION_DECL - && IDENTIFIER_IMPLICIT_DECL (DECL_ASSEMBLER_NAME (newdecl)) == olddecl) - /* If -traditional, avoid error for redeclaring fcn - after implicit decl. */ - ; - else if (TREE_CODE (olddecl) == FUNCTION_DECL - && DECL_ARTIFICIAL (olddecl) - && (DECL_BUILT_IN (olddecl) || DECL_BUILT_IN_NONANSI (olddecl))) + if (TREE_CODE (olddecl) == FUNCTION_DECL + && DECL_ARTIFICIAL (olddecl) + && (DECL_BUILT_IN (olddecl) || DECL_BUILT_IN_NONANSI (olddecl))) { /* If you declare a built-in or predefined function name as static, the old definition is overridden, but optionally warn this was a @@ -2917,13 +2887,17 @@ duplicate_decls (newdecl, olddecl) obstack_free (&permanent_obstack, newdecl); } - else if (LANG_DECL_PERMANENT (ol)) + else if (LANG_DECL_PERMANENT (ol) && ol != nl) { if (DECL_MAIN_VARIANT (olddecl) == olddecl) { /* Save these lang_decls that would otherwise be lost. */ extern tree free_lang_decl_chain; tree free_lang_decl = (tree) ol; + + if (DECL_LANG_SPECIFIC (olddecl) == ol) + abort (); + TREE_CHAIN (free_lang_decl) = free_lang_decl_chain; free_lang_decl_chain = free_lang_decl; } @@ -3160,12 +3134,6 @@ pushdecl (x) } } - /* In PCC-compatibility mode, extern decls of vars with no current decl - take effect at top level no matter where they are. */ - if (flag_traditional && DECL_EXTERNAL (x) - && lookup_name (name, 0) == NULL_TREE) - b = global_binding_level; - /* This name is new in its binding level. Install the new declaration and return it. */ if (b == global_binding_level) @@ -3625,7 +3593,7 @@ implicitly_declare (functionid) /* Save the decl permanently so we can warn if definition follows. In ANSI C, warn_implicit is usually false, so the saves little space. But in C++, it's usually true, hence the extra code. */ - if (temp && (flag_traditional || !warn_implicit || toplevel_bindings_p ())) + if (temp && (! warn_implicit || toplevel_bindings_p ())) end_temporary_allocation (); /* We used to reuse an old implicit decl here, @@ -3637,8 +3605,7 @@ implicitly_declare (functionid) TREE_PUBLIC (decl) = 1; /* ANSI standard says implicit declarations are in the innermost block. - So we record the decl in the standard fashion. - If flag_traditional is set, pushdecl does it top-level. */ + So we record the decl in the standard fashion. */ pushdecl (decl); rest_of_decl_compilation (decl, NULL_PTR, 0, 0); @@ -4695,8 +4662,6 @@ init_decl_processing () tree decl; register tree endlink, int_endlink, double_endlink; tree fields[20]; - /* Either char* or void*. */ - tree traditional_ptr_type_node; /* Data type of memcpy. */ tree memcpy_ftype, strlen_ftype; int wchar_type_size; @@ -4819,13 +4784,10 @@ init_decl_processing () record_builtin_type (RID_MAX, "unsigned short", short_unsigned_type_node); /* `unsigned long' is the standard type for sizeof. - Traditionally, use a signed type. Note that stddef.h uses `unsigned long', and this must agree, even of long and int are the same size. */ sizetype = TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (get_identifier (SIZE_TYPE))); - if (flag_traditional && TREE_UNSIGNED (sizetype)) - sizetype = signed_type (sizetype); ptrdiff_type_node = TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (get_identifier (PTRDIFF_TYPE))); @@ -5017,11 +4979,8 @@ init_decl_processing () tree_cons (NULL_TREE, const_string_type_node, endlink)); - traditional_ptr_type_node - = (flag_traditional ? string_type_node : ptr_type_node); - memcpy_ftype /* memcpy prototype */ - = build_function_type (traditional_ptr_type_node, + = build_function_type (ptr_type_node, tree_cons (NULL_TREE, ptr_type_node, tree_cons (NULL_TREE, const_ptr_type_node, tree_cons (NULL_TREE, @@ -6546,8 +6505,7 @@ cp_finish_decl (decl, init, asmspec_tree, need_pop, flags) /* ??? FIXME: What about nested classes? */ int toplev = toplevel_bindings_p () || pseudo_global_level_p (); int was_temp - = ((flag_traditional - || (TREE_STATIC (decl) && TYPE_NEEDS_DESTRUCTOR (type))) + = (TREE_STATIC (decl) && TYPE_NEEDS_DESTRUCTOR (type) && allocation_temporary_p ()); if (was_temp) @@ -6709,7 +6667,7 @@ cp_finish_decl (decl, init, asmspec_tree, need_pop, flags) /* Check to see if the same name is already bound at the outer level, either because it was directly declared, or because a dead for-decl got preserved. In either case, - the code would not have been valid under the traditional + the code would not have been valid under the ARM scope rules, so clear is_for_scope for the current_binding_level. @@ -7507,9 +7465,6 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist) else if (decl_context == BITFIELD) bitfield = 1, decl_context = FIELD; - if (flag_traditional && allocation_temporary_p ()) - end_temporary_allocation (); - /* Look inside a declarator for the name being declared and get it as a string, for an error message. */ { @@ -8059,8 +8014,6 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist) /* Decide whether an integer type is signed or not. Optionally treat bitfields as signed by default. */ if (RIDBIT_SETP (RID_UNSIGNED, specbits) - /* Traditionally, all bitfields are unsigned. */ - || (bitfield && flag_traditional) || (bitfield && ! flag_signed_bitfields && (explicit_int || explicit_char /* A typedef for plain `int' without `signed' @@ -8659,16 +8612,6 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist) name); } - /* Traditionally, declaring return type float means double. */ - - if (flag_traditional - && TYPE_MAIN_VARIANT (type) == float_type_node) - { - type = build_type_variant (double_type_node, - TYPE_READONLY (type), - TYPE_VOLATILE (type)); - } - /* Construct the function type and go to the next inner layer of declarator. */ @@ -8700,10 +8643,9 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist) } } - /* ANSI seems to say that `const int foo ();' + /* ANSI says that `const int foo ();' does not make the function foo const. */ - type = build_function_type (type, - flag_traditional ? 0 : arg_types); + type = build_function_type (type, arg_types); } break; @@ -12030,10 +11972,6 @@ finish_function (lineno, call_poplevel, nested) /* Must mark the RESULT_DECL as being in this function. */ DECL_CONTEXT (DECL_RESULT (fndecl)) = fndecl; - /* Obey `register' declarations if `setjmp' is called in this fn. */ - if (flag_traditional && current_function_calls_setjmp) - setjmp_protect (DECL_INITIAL (fndecl)); - /* Set the BLOCK_SUPERCONTEXT of the outermost function scope to point to the FUNCTION_DECL node itself. */ BLOCK_SUPERCONTEXT (DECL_INITIAL (fndecl)) = fndecl; @@ -12108,12 +12046,7 @@ finish_function (lineno, call_poplevel, nested) DECL_INITIAL (fndecl) = error_mark_node; /* And we need the arguments for template instantiation. */ if (! processing_template_decl) - { - if (! DECL_CONSTRUCTOR_P (fndecl) - || !(TYPE_USES_VIRTUAL_BASECLASSES - (TYPE_METHOD_BASETYPE (fntype)))) - DECL_ARGUMENTS (fndecl) = NULL_TREE; - } + DECL_ARGUMENTS (fndecl) = NULL_TREE; } if (DECL_STATIC_CONSTRUCTOR (fndecl)) diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 2a26a59..0775bb2 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -42,6 +42,7 @@ extern tree cleanups_this_call; static void grok_function_init PROTO((tree, tree)); void import_export_decl (); extern int current_class_depth; +extern int symout_time; /* A list of virtual function tables we must make sure to write out. */ tree pending_vtables; @@ -104,7 +105,8 @@ int flag_no_builtin; int flag_no_nonansi_builtin; -/* Nonzero means do some things the same way PCC does. */ +/* Nonzero means do some things the same way PCC does. Only provided so + the compiler will link. */ int flag_traditional; @@ -184,20 +186,11 @@ int warn_cast_qual; int warn_template_debugging; -/* Warn about traditional constructs whose meanings changed in ANSI C. */ - -int warn_traditional; - /* Nonzero means warn about sizeof(function) or addition/subtraction of function pointers. */ int warn_pointer_arith = 1; -/* Nonzero means warn for non-prototype function decls - or non-prototyped defs without previous prototype. */ - -int warn_strict_prototypes; - /* Nonzero means warn for any function def without prototype decl. */ int warn_missing_prototypes; @@ -439,7 +432,7 @@ lang_decode_option (p) char *p; { if (!strcmp (p, "-ftraditional") || !strcmp (p, "-traditional")) - flag_traditional = 1, dollars_in_ident = 1, flag_writable_strings = 1, + dollars_in_ident = 1, flag_writable_strings = 1, flag_this_is_variable = 1, flag_new_for_scope = 0; /* The +e options are for cfront compatibility. They come in as `-+eN', to kludge around gcc.c's argument handling. */ @@ -536,14 +529,10 @@ lang_decode_option (p) warn_write_strings = setting; else if (!strcmp (p, "cast-qual")) warn_cast_qual = setting; - else if (!strcmp (p, "traditional")) - warn_traditional = setting; else if (!strcmp (p, "char-subscripts")) warn_char_subscripts = setting; else if (!strcmp (p, "pointer-arith")) warn_pointer_arith = setting; - else if (!strcmp (p, "strict-prototypes")) - warn_strict_prototypes = setting; else if (!strcmp (p, "missing-prototypes")) warn_missing_prototypes = setting; else if (!strcmp (p, "redundant-decls")) @@ -1149,8 +1138,7 @@ delete_sanity (exp, size, doing_vec, use_global_delete) { case 2: maxindex = build_binary_op (MINUS_EXPR, size, integer_one_node, 1); - if (! flag_traditional) - pedwarn ("anachronistic use of array size in vector delete"); + pedwarn ("anachronistic use of array size in vector delete"); /* Fall through. */ case 1: break; @@ -2777,6 +2765,13 @@ finish_file () { tree decl = TREE_VALUE (vars); +#ifdef DWARF_DEBUGGING_INFO + /* Output DWARF information for file-scope tentative data object + declarations. */ + + if (write_symbols == DWARF_DEBUG) + TIMEVAR (symout_time, dwarfout_file_scope_decl (decl, 1)); +#endif if (DECL_TEMPLATE_INSTANTIATION (decl) && ! DECL_IN_AGGR_P (decl)) { diff --git a/gcc/cp/gxx.gperf b/gcc/cp/gxx.gperf index 598b66a..6cb2a97 100644 --- a/gcc/cp/gxx.gperf +++ b/gcc/cp/gxx.gperf @@ -67,7 +67,6 @@ not_eq, EQCOMPARE, NORID, operator, OPERATOR, NORID, or, OROR, NORID, or_eq, ASSIGN, NORID, -overload, OVERLOAD, NORID, private, VISSPEC, RID_PRIVATE, protected, VISSPEC, RID_PROTECTED, public, VISSPEC, RID_PUBLIC, diff --git a/gcc/cp/hash.h b/gcc/cp/hash.h index 436424f..d3f6be7 100644 --- a/gcc/cp/hash.h +++ b/gcc/cp/hash.h @@ -3,12 +3,12 @@ /* Command-line: gperf -p -j1 -g -o -t -N is_reserved_word -k1,4,$,7 gplus.gperf */ struct resword { char *name; short token; enum rid rid;}; -#define TOTAL_KEYWORDS 98 +#define TOTAL_KEYWORDS 97 #define MIN_WORD_LENGTH 2 #define MAX_WORD_LENGTH 16 #define MIN_HASH_VALUE 4 -#define MAX_HASH_VALUE 258 -/* maximum key range = 255, duplicates = 0 */ +#define MAX_HASH_VALUE 202 +/* maximum key range = 199, duplicates = 0 */ #ifdef __GNUC__ inline @@ -18,21 +18,21 @@ hash (str, len) register char *str; register int unsigned len; { - static unsigned short asso_values[] = + static unsigned char asso_values[] = { - 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, - 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, - 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, - 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, - 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, - 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, - 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, - 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, - 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, - 259, 259, 259, 259, 259, 0, 259, 27, 17, 20, - 40, 0, 64, 6, 10, 89, 259, 2, 110, 44, - 13, 107, 40, 10, 18, 55, 1, 3, 5, 17, - 2, 4, 259, 259, 259, 259, 259, 259, + 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, + 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, + 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, + 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, + 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, + 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, + 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, + 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, + 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, + 203, 203, 203, 203, 203, 0, 203, 29, 22, 32, + 35, 0, 73, 8, 19, 48, 203, 0, 7, 15, + 11, 66, 9, 11, 19, 58, 1, 7, 83, 21, + 89, 5, 203, 203, 203, 203, 203, 203, }; register int hval = len; @@ -67,150 +67,132 @@ is_reserved_word (str, len) {"",}, {"",}, {"",}, {"",}, {"else", ELSE, NORID,}, {"true", CXX_TRUE, NORID,}, - {"",}, {"",}, + {"",}, {"",}, {"",}, {"try", TRY, NORID,}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, + {"",}, {"",}, {"",}, {"",}, {"",}, {"not", '!', NORID,}, - {"xor_eq", ASSIGN, NORID,}, + {"",}, {"extern", SCSPEC, RID_EXTERN,}, + {"",}, + {"template", TEMPLATE, RID_TEMPLATE,}, + {"__null", CONSTANT, RID_NULL}, {"",}, {"",}, {"",}, - {"xor", '^', NORID,}, - {"case", CASE, NORID,}, + {"typename", TYPENAME_KEYWORD, NORID,}, {"",}, {"",}, - {"using", USING, NORID,}, - {"__extension__", EXTENSION, NORID}, + {"long", TYPESPEC, RID_LONG,}, {"not_eq", EQCOMPARE, NORID,}, - {"",}, {"",}, - {"continue", CONTINUE, NORID,}, - {"new", NEW, NORID,}, + {"__alignof__", ALIGNOF, NORID}, {"__inline", SCSPEC, RID_INLINE}, - {"",}, + {"using", USING, NORID,}, {"__inline__", SCSPEC, RID_INLINE}, + {"while", WHILE, NORID,}, + {"enum", ENUM, NORID,}, + {"new", NEW, NORID,}, + {"case", CASE, NORID,}, {"",}, {"",}, {"",}, - {"return", RETURN, NORID,}, - {"",}, {"",}, - {"and_eq", ASSIGN, NORID,}, - {"",}, {"",}, + {"bool", TYPESPEC, RID_BOOL,}, {"delete", DELETE, NORID,}, {"typeid", TYPEID, NORID,}, - {"__wchar_t", TYPESPEC, RID_WCHAR /* Unique to ANSI C++ */,}, - {"namespace", NAMESPACE, NORID,}, - {"template", TEMPLATE, RID_TEMPLATE,}, - {"break", BREAK, NORID,}, - {"private", VISSPEC, RID_PRIVATE,}, - {"typename", TYPENAME_KEYWORD, NORID,}, - {"",}, - {"catch", CATCH, NORID,}, - {"",}, {"",}, {"",}, {"",}, - {"char", TYPESPEC, RID_CHAR,}, - {"",}, - {"__asm__", GCC_ASM_KEYWORD, NORID}, - {"double", TYPESPEC, RID_DOUBLE,}, - {"",}, - {"struct", AGGR, RID_RECORD,}, - {"reinterpret_cast", REINTERPRET_CAST, NORID,}, - {"",}, - {"static_cast", STATIC_CAST, NORID,}, - {"",}, - {"and", ANDAND, NORID,}, - {"typeof", TYPEOF, NORID,}, - {"switch", SWITCH, NORID,}, + {"return", RETURN, NORID,}, {"",}, + {"__label__", LABEL, NORID}, + {"and_eq", ASSIGN, NORID,}, {"asm", ASM_KEYWORD, NORID,}, - {"",}, - {"default", DEFAULT, NORID,}, + {"continue", CONTINUE, NORID,}, + {"namespace", NAMESPACE, NORID,}, {"",}, {"mutable", SCSPEC, RID_MUTABLE,}, - {"short", TYPESPEC, RID_SHORT,}, - {"signature", AGGR, RID_SIGNATURE /* Extension */,}, - {"const", CV_QUALIFIER, RID_CONST,}, - {"static", SCSPEC, RID_STATIC,}, - {"",}, {"",}, - {"for", FOR, NORID,}, - {"",}, {"",}, {"",}, - {"void", TYPESPEC, RID_VOID,}, - {"bitand", '&', NORID,}, - {"protected", VISSPEC, RID_PROTECTED,}, - {"enum", ENUM, NORID,}, {"int", TYPESPEC, RID_INT,}, - {"",}, {"",}, {"",}, - {"float", TYPESPEC, RID_FLOAT,}, + {"compl", '~', NORID,}, + {"public", VISSPEC, RID_PUBLIC,}, + {"protected", VISSPEC, RID_PROTECTED,}, + {"break", BREAK, NORID,}, {"",}, {"__signed__", TYPESPEC, RID_SIGNED}, - {"dynamic_cast", DYNAMIC_CAST, NORID,}, - {"__attribute", ATTRIBUTE, NORID}, {"",}, + {"__attribute", ATTRIBUTE, NORID}, + {"__wchar_t", TYPESPEC, RID_WCHAR /* Unique to ANSI C++ */,}, {"__attribute__", ATTRIBUTE, NORID}, - {"__asm", GCC_ASM_KEYWORD, NORID}, - {"",}, - {"const_cast", CONST_CAST, NORID,}, - {"",}, {"",}, {"",}, - {"friend", SCSPEC, RID_FRIEND,}, + {"double", TYPESPEC, RID_DOUBLE,}, + {"explicit", SCSPEC, RID_EXPLICIT,}, + {"__asm__", GCC_ASM_KEYWORD, NORID}, + {"reinterpret_cast", REINTERPRET_CAST, NORID,}, + {"and", ANDAND, NORID,}, {"",}, {"",}, {"",}, - {"signed", TYPESPEC, RID_SIGNED,}, - {"this", THIS, NORID,}, + {"static_cast", STATIC_CAST, NORID,}, + {"struct", AGGR, RID_RECORD,}, + {"default", DEFAULT, NORID,}, + {"char", TYPESPEC, RID_CHAR,}, {"__const", CV_QUALIFIER, RID_CONST}, {"__const__", CV_QUALIFIER, RID_CONST}, {"__volatile", CV_QUALIFIER, RID_VOLATILE}, - {"__null", CONSTANT, RID_NULL}, + {"__asm", GCC_ASM_KEYWORD, NORID}, {"__volatile__", CV_QUALIFIER, RID_VOLATILE}, + {"typeof", TYPEOF, NORID,}, {"__typeof__", TYPEOF, NORID}, {"or_eq", ASSIGN, NORID,}, + {"short", TYPESPEC, RID_SHORT,}, + {"switch", SWITCH, NORID,}, + {"signature", AGGR, RID_SIGNATURE /* Extension */,}, {"",}, - {"false", CXX_FALSE, NORID,}, - {"sizeof", SIZEOF, NORID,}, - {"long", TYPESPEC, RID_LONG,}, {"or", OROR, NORID,}, + {"catch", CATCH, NORID,}, {"union", AGGR, RID_UNION,}, {"__signature__", AGGR, RID_SIGNATURE /* Extension */,}, + {"__signed", TYPESPEC, RID_SIGNED}, + {"bitand", '&', NORID,}, {"throw", THROW, NORID,}, - {"",}, - {"while", WHILE, NORID,}, {"register", SCSPEC, RID_REGISTER,}, - {"__alignof__", ALIGNOF, NORID}, - {"class", AGGR, RID_CLASS,}, - {"typedef", SCSPEC, RID_TYPEDEF,}, - {"__signed", TYPESPEC, RID_SIGNED}, - {"",}, {"",}, + {"for", FOR, NORID,}, + {"const", CV_QUALIFIER, RID_CONST,}, + {"static", SCSPEC, RID_STATIC,}, {"unsigned", TYPESPEC, RID_UNSIGNED,}, - {"",}, {"",}, {"",}, {"",}, {"",}, - {"__label__", LABEL, NORID}, - {"bitor", '|', NORID,}, + {"private", VISSPEC, RID_PRIVATE,}, + {"__alignof", ALIGNOF, NORID}, {"",}, + {"inline", SCSPEC, RID_INLINE,}, {"do", DO, NORID,}, - {"volatile", CV_QUALIFIER, RID_VOLATILE,}, - {"",}, {"",}, {"",}, {"",}, - {"if", IF, NORID,}, + {"",}, + {"virtual", SCSPEC, RID_VIRTUAL,}, + {"xor_eq", ASSIGN, NORID,}, + {"",}, + {"float", TYPESPEC, RID_FLOAT,}, + {"dynamic_cast", DYNAMIC_CAST, NORID,}, + {"signed", TYPESPEC, RID_SIGNED,}, + {"xor", '^', NORID,}, + {"bitor", '|', NORID,}, + {"__extension__", EXTENSION, NORID}, + {"friend", SCSPEC, RID_FRIEND,}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"__sigof__", SIGOF, NORID /* Extension */,}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, + {"this", THIS, NORID,}, + {"",}, + {"if", IF, NORID,}, {"",}, {"",}, {"",}, - {"compl", '~', NORID,}, - {"public", VISSPEC, RID_PUBLIC,}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"__typeof", TYPEOF, NORID}, - {"inline", SCSPEC, RID_INLINE,}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, + {"volatile", CV_QUALIFIER, RID_VOLATILE,}, {"",}, {"",}, - {"__alignof", ALIGNOF, NORID}, - {"",}, {"",}, {"",}, - {"overload", OVERLOAD, NORID,}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"explicit", SCSPEC, RID_EXPLICIT,}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, + {"__sigof__", SIGOF, NORID /* Extension */,}, + {"",}, {"",}, + {"const_cast", CONST_CAST, NORID,}, + {"",}, {"",}, + {"false", CXX_FALSE, NORID,}, + {"sizeof", SIZEOF, NORID,}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"goto", GOTO, NORID,}, - {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"sigof", SIGOF, NORID /* Extension */,}, - {"",}, - {"virtual", SCSPEC, RID_VIRTUAL,}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, - {"bool", TYPESPEC, RID_BOOL,}, - {"",}, {"",}, {"",}, + {"__typeof", TYPEOF, NORID}, + {"class", AGGR, RID_CLASS,}, + {"typedef", SCSPEC, RID_TYPEDEF,}, + {"",}, {"",}, + {"void", TYPESPEC, RID_VOID,}, + {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"auto", SCSPEC, RID_AUTO,}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"operator", OPERATOR, NORID,}, + {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, + {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, + {"",}, {"",}, {"",}, {"",}, {"",}, + {"sigof", SIGOF, NORID /* Extension */,}, }; if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c index f91d939..4888981 100644 --- a/gcc/cp/lex.c +++ b/gcc/cp/lex.c @@ -821,8 +821,6 @@ init_lex () UNSET_RESERVED_WORD ("xor"); UNSET_RESERVED_WORD ("xor_eq"); } - if (! flag_traditional) - UNSET_RESERVED_WORD ("overload"); token_count = init_parse (); interface_unknown = 1; @@ -2339,12 +2337,6 @@ readescape (ignore_ptr) switch (c) { case 'x': - if (warn_traditional) - warning ("the meaning of `\\x' varies with -traditional"); - - if (flag_traditional) - return c; - code = 0; count = 0; nonnull = 0; @@ -2419,11 +2411,6 @@ readescape (ignore_ptr) return TARGET_BS; case 'a': - if (warn_traditional) - warning ("the meaning of `\\a' varies with -traditional"); - - if (flag_traditional) - return c; return TARGET_BELL; case 'v': @@ -3527,7 +3514,6 @@ real_yylex () TREE_TYPE (yylval.ttype) = long_long_unsigned_type_node; if (!spec_long && !spec_unsigned - && !(flag_traditional && base != 10) && int_fits_type_p (yylval.ttype, integer_type_node)) { type = integer_type_node; @@ -3546,12 +3532,7 @@ real_yylex () else if (! spec_long_long && int_fits_type_p (yylval.ttype, long_unsigned_type_node)) - { - if (flag_traditional && !spec_unsigned) - type = long_integer_type_node; - else - type = long_unsigned_type_node; - } + type = long_unsigned_type_node; else if (! spec_unsigned /* Verify value does not overflow into sign bit. */ @@ -3562,12 +3543,7 @@ real_yylex () else if (int_fits_type_p (yylval.ttype, long_long_unsigned_type_node)) - { - if (flag_traditional && !spec_unsigned) - type = long_long_integer_type_node; - else - type = long_long_unsigned_type_node; - } + type = long_long_unsigned_type_node; else { @@ -3667,7 +3643,7 @@ real_yylex () num_chars = max_chars; error ("character constant too long"); } - else if (num_chars != 1 && ! flag_traditional) + else if (num_chars != 1) warning ("multi-character character constant"); /* If char type is signed, sign-extend the constant. */ @@ -4094,22 +4070,7 @@ build_lang_decl (code, name, type) == TREE_PERMANENT (t), 234); DECL_MAIN_VARIANT (t) = t; if (current_lang_name == lang_name_cplusplus) - { - DECL_LANGUAGE (t) = lang_cplusplus; -#if 0 -#ifndef NO_AUTO_OVERLOAD - if (code == FUNCTION_DECL && name != 0 - && ! (IDENTIFIER_LENGTH (name) == 4 - && IDENTIFIER_POINTER (name)[0] == 'm' - && strcmp (IDENTIFIER_POINTER (name), "main") == 0) - && ! (IDENTIFIER_LENGTH (name) > 10 - && IDENTIFIER_POINTER (name)[0] == '_' - && IDENTIFIER_POINTER (name)[1] == '_' - && strncmp (IDENTIFIER_POINTER (name)+2, "builtin_", 8) == 0)) - TREE_OVERLOADED (name) = 1; -#endif -#endif - } + DECL_LANGUAGE (t) = lang_cplusplus; else if (current_lang_name == lang_name_c) DECL_LANGUAGE (t) = lang_c; else my_friendly_abort (64); diff --git a/gcc/cp/method.c b/gcc/cp/method.c index b127002..f032c9b 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -62,10 +62,6 @@ static char *scratch_firstobj; # define OB_FINISH() (obstack_1grow (&scratch_obstack, '\0')) # define OB_LAST() (obstack_next_free (&scratch_obstack)[-1]) -#ifdef NO_AUTO_OVERLOAD -int is_overloaded (); -#endif - void init_method () { @@ -1108,56 +1104,6 @@ get_id_2 (name, name2) OB_FINISH (); return get_identifier (obstack_base (&scratch_obstack)); } - -/* Top-level interface to explicit overload requests. Allow NAME - to be overloaded. Error if NAME is already declared for the current - scope. Warning if function is redundantly overloaded. */ - -void -declare_overloaded (name) - tree name; -{ -#ifdef NO_AUTO_OVERLOAD - if (is_overloaded (name)) - warning ("function `%s' already declared overloaded", - IDENTIFIER_POINTER (name)); - else if (IDENTIFIER_GLOBAL_VALUE (name)) - error ("overloading function `%s' that is already defined", - IDENTIFIER_POINTER (name)); - else - { - TREE_OVERLOADED (name) = 1; - IDENTIFIER_GLOBAL_VALUE (name) = build_tree_list (name, NULL_TREE); - TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (name)) = unknown_type_node; - } -#else - if (current_lang_name == lang_name_cplusplus) - { - if (0) - warning ("functions are implicitly overloaded in C++"); - } - else if (current_lang_name == lang_name_c) - error ("overloading function `%s' cannot be done in C language context"); - else - my_friendly_abort (76); -#endif -} - -#ifdef NO_AUTO_OVERLOAD -/* Check to see if NAME is overloaded. For first approximation, - check to see if its TREE_OVERLOADED is set. This is used on - IDENTIFIER nodes. */ - -int -is_overloaded (name) - tree name; -{ - /* @@ */ - return (TREE_OVERLOADED (name) - && (! IDENTIFIER_CLASS_VALUE (name) || current_class_type == 0) - && ! IDENTIFIER_LOCAL_VALUE (name)); -} -#endif /* Given a tree_code CODE, and some arguments (at least one), attempt to use an overloaded operator on the arguments. @@ -1428,9 +1374,8 @@ build_opfncall (code, flags, xarg1, xarg2, arg3) /* There's probably a LOT of code in the world that relies upon this old behavior. */ - if (! flag_traditional) - pedwarn ("no `operator%s (int)' declared for postfix `%s', using prefix operator instead", - op, op); + pedwarn ("no `operator%s (int)' declared for postfix `%s', using prefix operator instead", + op, op); xarg2 = NULL_TREE; binary_is_unary = 1; } diff --git a/gcc/cp/parse.y b/gcc/cp/parse.y index 774bb04..d29d4a8 100644 --- a/gcc/cp/parse.y +++ b/gcc/cp/parse.y @@ -144,7 +144,7 @@ empty_parms () /* the reserved words... C++ extensions */ %token <ttype> AGGR %token <ttype> VISSPEC -%token DELETE NEW OVERLOAD THIS OPERATOR CXX_TRUE CXX_FALSE +%token DELETE NEW THIS OPERATOR CXX_TRUE CXX_FALSE %token NAMESPACE TYPENAME_KEYWORD USING %token LEFT_RIGHT TEMPLATE %token TYPEID DYNAMIC_CAST STATIC_CAST REINTERPRET_CAST CONST_CAST @@ -359,7 +359,6 @@ extdef: { if (pending_inlines) do_pending_inlines (); } | template_def { if (pending_inlines) do_pending_inlines (); } - | overloaddef | asm_keyword '(' string ')' ';' { if (TREE_CHAIN ($3)) $3 = combine_strings ($3); assemble_asm ($3); } @@ -469,18 +468,6 @@ template_parm: { $$ = build_tree_list ($3, $1.t); } ; -overloaddef: - OVERLOAD ov_identifiers ';' - { warning ("use of `overload' is an anachronism"); } - ; - -ov_identifiers: - IDENTIFIER - { declare_overloaded ($1); } - | ov_identifiers ',' IDENTIFIER - { declare_overloaded ($3); } - ; - template_def: template_header extdef @@ -764,13 +751,13 @@ member_init_list: member_init: '(' nonnull_exprlist ')' { - if (current_class_name && !flag_traditional) + if (current_class_name) pedwarn ("anachronistic old style base class initializer"); expand_member_init (current_class_ref, NULL_TREE, $2); } | LEFT_RIGHT { - if (current_class_name && !flag_traditional) + if (current_class_name) pedwarn ("anachronistic old style base class initializer"); expand_member_init (current_class_ref, NULL_TREE, void_type_node); } diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 5b7caf3..99943e2 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -1434,7 +1434,11 @@ tsubst (t, args, nargs, in_decl) if (type == TREE_TYPE (t) && (! member || ctx == DECL_CLASS_CONTEXT (t))) - return t; + { + t = copy_node (t); + copy_lang_decl (t); + return t; + } /* Do we already have this instantiation? */ if (DECL_TEMPLATE_INFO (t) != NULL_TREE) diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 8d77956..dfcc28f 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -1573,9 +1573,6 @@ default_conversion (exp) if (t != type) return convert (t, exp); } - if (flag_traditional - && TYPE_MAIN_VARIANT (type) == float_type_node) - return convert (double_type_node, exp); return exp; } @@ -3474,18 +3471,12 @@ build_binary_op_nodefault (code, orig_op0, orig_op1, error_code) else if (code0 == POINTER_TYPE && code1 == INTEGER_TYPE) { result_type = type0; - if (pedantic) - pedwarn ("ANSI C++ forbids comparison between pointer and integer"); - else if (! flag_traditional) - warning ("comparison between pointer and integer"); + pedwarn ("ANSI C++ forbids comparison between pointer and integer"); } else if (code0 == INTEGER_TYPE && code1 == POINTER_TYPE) { result_type = type1; - if (pedantic) - pedwarn ("ANSI C++ forbids comparison between pointer and integer"); - else if (! flag_traditional) - warning ("comparison between pointer and integer"); + pedwarn ("ANSI C++ forbids comparison between pointer and integer"); } break; } @@ -4493,7 +4484,6 @@ unary_complex_lvalue (code, arg) is really the representation of a pointer to it. Here give the representation its true type. */ tree t; - tree offset; my_friendly_assert (TREE_CODE (arg) != SCOPE_REF, 313); @@ -4508,6 +4498,9 @@ unary_complex_lvalue (code, arg) return build_unary_op (ADDR_EXPR, t, 0); else { + tree type; + tree offset = integer_zero_node; + if (TREE_OPERAND (arg, 0) && (TREE_CODE (TREE_OPERAND (arg, 0)) != NOP_EXPR || TREE_OPERAND (TREE_OPERAND (arg, 0), 0) != error_mark_node)) @@ -4519,10 +4512,23 @@ unary_complex_lvalue (code, arg) return error_mark_node; } - /* Add in the offset to the right subobject. */ - offset = get_delta_difference (DECL_FIELD_CONTEXT (t), - TREE_TYPE (TREE_OPERAND (arg, 0)), - 0); + type = TREE_TYPE (TREE_OPERAND (arg, 0)); + + if (TREE_CODE (TREE_TYPE (arg)) == OFFSET_TYPE) + { + /* Add in the offset to the intermediate subobject, if any. */ + offset = get_delta_difference (TYPE_OFFSET_BASETYPE (TREE_TYPE (arg)), + type, + 0); + type = TYPE_OFFSET_BASETYPE (TREE_TYPE (arg)); + } + + /* Now in the offset to the final subobject. */ + offset = size_binop (PLUS_EXPR, + offset, + get_delta_difference (DECL_FIELD_CONTEXT (t), + type, + 0)); /* Add in the offset to the field. */ offset = size_binop (PLUS_EXPR, offset, @@ -6063,13 +6069,13 @@ get_delta_difference (from, to, force) if (!force) { error_not_base_type (from, to); - error (" in pointer to member function conversion"); + error (" in pointer to member conversion"); return delta; } binfo = get_binfo (to, from, 1); if (binfo == error_mark_node) { - error (" in pointer to member function conversion"); + error (" in pointer to member conversion"); return delta; } if (binfo == 0) @@ -6546,31 +6552,6 @@ convert_for_assignment (type, rhs, errtype, fndecl, parmnum) } } } - else if (TREE_CODE (ttr) == OFFSET_TYPE - && TREE_CODE (ttl) != OFFSET_TYPE) - { - /* Normally, pointers to different type codes (other - than void) are not compatible, but we perform - some type instantiation if that resolves the - ambiguity of (X Y::*) and (X *). */ - - if (current_class_ptr) - { - if (TREE_CODE (rhs) == INTEGER_CST) - { - rhs = build (PLUS_EXPR, build_pointer_type (TREE_TYPE (ttr)), - current_class_ptr, rhs); - return convert_for_assignment (type, rhs, - errtype, fndecl, parmnum); - } - } - if (TREE_CODE (ttl) == METHOD_TYPE) - error ("%s between pointer-to-method and pointer-to-member types", - errtype); - else - error ("%s between pointer and pointer-to-member types", errtype); - return error_mark_node; - } else { int add_quals = 0, const_parity = 0, volatile_parity = 0; diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index 786ca79..9395cc8 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -879,12 +879,7 @@ digest_init (type, init, tail) *tail = old_tail_contents; return process_init_constructor (type, 0, tail); } - else if (flag_traditional) - /* Traditionally one can say `char x[100] = 0;'. */ - return process_init_constructor (type, - build_nt (CONSTRUCTOR, NULL_TREE, - tree_cons (NULL_TREE, init, NULL_TREE)), - (tree*)0); + if (code != ARRAY_TYPE) return convert_for_initialization (NULL_TREE, type, init, LOOKUP_NORMAL, "initialization", NULL_TREE, 0); |