Commit d22c8596 by Mike Stump

89th Cygnus<->FSF quick merge

From-SVN: r12953
parent 3d4683cb
......@@ -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))
{
......
......@@ -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,
......
......@@ -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);
......
......@@ -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;
}
......
......@@ -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);
}
......
......@@ -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)
......
......@@ -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;
......
......@@ -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);
......
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