Commit 2986ae00 by Mike Stump

38th Cygnus<->FSF merge

From-SVN: r7337
parent 639010af
Thu May 19 12:08:48 1994 Jason Merrill (jason@deneb.cygnus.com)
* cvt.c (type_promotes_to): Make sure bool promotes to int rather
than unsigned on platforms where sizeof(char)==sizeof(int).
Wed May 18 14:27:06 1994 Jason Merrill (jason@deneb.cygnus.com)
* typeck.c (build_c_cast): Tack on a NOP_EXPR when casting to
another variant.
(build_modify_expr): Don't strip NOP_EXPRs, and don't get tricky
and treat them as lvalues.
* decl.c (shadow_tag): Do complain about forward declarations of
enums and empty declarations.
* parse.y: Don't complain about forward declarations of enums and
empty declarations.
* typeck.c (convert_for_assignment): Complain about changing
the signedness of a pointer's target type.
* parse.y (stmt): Move duplicated code for checking case values from
here.
* decl2.c (check_cp_case_value): To here. And add a call to
constant_expression_warning.
* typeck.c (convert_for_assignment): Don't complain about assigning
a negative value to bool.
* decl.c (init_decl_processing): Make bool unsigned.
* class.c (finish_struct): Allow bool bitfields.
Wed May 18 14:41:59 1994 Mike Stump (mrs@cygnus.com)
* class.c (finish_base_struct): Make sure we set BINFO_VTABLE and
BINFO_VIRTUALS when we choose a new base class to inherit from.
* class.c (modify_one_vtable): Use get_vfield_offset to get the
offset to the most base class subobject that we derived this binfo
from.
* class.c (finish_struct): Move code to calculate the
DECL_FIELD_BITPOS of the vfield up, as we need might need it for
new calls to get_vfield_offset in modify_one_vtable.
Wed May 18 12:35:27 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
* Make-lang.in (c++.install-man): Get g++.1 from $(srcdir)/cp.
Wed May 18 03:28:35 1994 Jason Merrill (jason@deneb.cygnus.com)
* cvt.c (build_type_conversion): Lose special handling of
truthvalues.
* search.c (dfs_pushdecls): Improve shadowing warning.
Tue May 17 13:34:46 1994 Jason Merrill (jason@deneb.cygnus.com)
* init.c (build_delete): Throw away const and volatile on `this'.
* decl.c (finish_enum): Put the constants in TYPE_VALUES again,
rather than the enumerators.
(pushtag): s/cdecl/c_decl/g
Mon May 16 23:04:01 1994 Stephen R. van den Berg (berg@pool.informatik.rwth-aachen.de)
* cp/typeck.c (common_type): Attribute merging.
(comp_types): Utilise COMP_TYPE_ATTRIBUTES macro.
* cp/parse.y: Revamp attribute parsing.
Mon May 16 01:40:34 1994 Jason Merrill (jason@deneb.cygnus.com)
* decl.c (shadow_tag): Also check for inappropriate use of auto and
register.
* method.c (build_overload_name): Clarify that the illegal case is a
pointer or reference to array of unknown bound.
* error.c (dump_type_prefix): Print references to arrays properly.
* typeck.c (various): Be more helpful in pointer
comparison diagnostics.
* tree.c (lvalue_p): MODIFY_EXPRs are lvalues again. Isn't this
fun?
* parse.y: Also catch an error after valid stmts.
* search.c (dfs_init_vbase_pointers): Don't abort because `this' is
const.
* typeck.c (convert_for_initialization): If call to
convert_to_reference generated a diagnostic, print out the parm
number and function decl if any.
* errfn.c (cp_thing): Check atarg1 to determine whether or not we're
specifying a line, not atarg.
* tree.c (build_cplus_method_type): Always make `this' const.
* decl2.c (grokclassfn): If -fthis-is-variable and this function is
a constructor or destructor, make `this' non-const.
* typeck.c (build_modify_expr): Don't warn specially about
assignment to `this' here anymore, since it will be caught by the
usual machinery.
* various: Disallow specific GNU extensions (variable-size arrays,
etc.) when flag_ansi is set, not necessarily when pedantic is set,
so that people can compile with -pedantic-errors for tighter const
checking and such without losing desirable extensions.
* typeck2.c (build_functional_cast): Call build_method_call with
LOOKUP_PROTECT.
(process_init_constructor): Only process FIELD_DECLs.
* decl.c (finish_decl): Also force static consts with no explicit
initializer that need constructing into the data segment.
* init.c (build_delete): Undo last patch, as it interferes with
automatic cleanups.
Sat May 14 01:59:31 1994 Jason Merrill (jason@deneb.cygnus.com)
* call.c, class.h, cp-tree.h, cvt.c, decl2.c: Lose old overloading
code.
* init.c (build_delete): pedwarn about using plain delete to delete
an array.
Fri May 13 16:45:07 1994 Jason Merrill (jason@deneb.cygnus.com)
* typeck.c (comp_target_types): Be more helpful in contravariance
warnings, and make them pedwarns.
* decl.c (grokdeclarator): Use decl_context to decide whether or not
this is an access declaration.
* class.c (finish_struct_bits): Set TYPE_HAS_INT_CONVERSION if it
has a conversion to enum or bool, too.
Fri May 13 16:31:27 1994 Mike Stump (mrs@cygnus.com)
* method.c (emit_thunk): Make declaration for
current_call_is_indirect local (needed for hppa).
Fri May 13 16:16:37 1994 Jason Merrill (jason@deneb.cygnus.com)
* pt.c (uses_template_parms): Grok BOOLEAN_TYPE.
(tsubst): Ditto.
Fri May 13 16:23:32 1994 Mike Stump (mrs@cygnus.com)
* pt.c (tsubst): If there is already a function for this expansion,
use it.
* pt.c (instantiate_template): Ditto.
Fri May 13 10:30:42 1994 Brendan Kehoe (brendan@lisa.cygnus.com)
* parse.y (implicitly_scoped_stmt, simple_stmt case): Use
kept_level_p for MARK_ENDS argument to expand_end_bindings, to avoid
generating debug info for unemitted symbols on some systems.
* cp-tree.h (build_static_cast, build_reinterpret_cast,
build_const_cast): Add declarations.
Fri May 13 09:50:31 1994 Mike Stump (mrs@cygnus.com)
* search.c (expand_indirect_vtbls_init): Fix breakage from Apr 27
fix. We now try get_binfo, and if that doesn't find what we want,
we go back to the old method, which still sometimes fails.
Fri May 13 01:43:18 1994 Jason Merrill (jason@deneb.cygnus.com)
* parse.y (initdcl): Call cplus_decl_attributes on the right
variable.
* decl2.c (cplus_decl_attributes): Don't call decl_attributes for
void_type_node.
* typeck.c (build_binary_op_nodefault): Change result_type for
comparison ops to bool.
(build_binary_op): Convert args of && and || to bool.
* cvt.c (build_default_binary_type_conversion): Convert args of &&
and || to bool.
(build_default_unary_type_conversion): Convert arg of ! to bool.
(type_promotes_to): bool promotes to int.
Fri May 13 01:43:18 1994 Mike Stump (mrs@cygnus.com)
Implement the new builtin `bool' type.
* typeck.c (build_binary_op_nodefault): Convert args of && and || to
bool.
(build_unary_op): Convert arg of ! to bool.
* parse.y: Know true and false. Use bool_truthvalue_conversion.
* method.c (build_overload_value): Know bool.
(build_overload_name): Ditto.
* lex.c (init_lex): Set up RID_BOOL.
* gxx.gperf: Add bool, true, false.
* error.c (*): Know bool.
* decl.c (init_decl_processing): Set up bool, true, false.
* cvt.c (cp_convert): Handle conversion to bool.
(build_type_conversion): Ditto.
* *.c: Accept bool where integers and enums are accepted (use
INTEGRAL_CODE_P macro).
Thu May 12 19:13:54 1994 Richard Earnshaw (rwe11@cl.cam.ac.uk)
* g++.c: Use #ifdef for __MSDOS__, not #if.
......
......@@ -1490,6 +1490,12 @@ finish_base_struct (t, b, t_binfo)
if (b->has_virtual == 0)
{
first_vfn_base_index = i;
/* Update these two, now that we know what vtable we are
going to extend. This is so that we can add virtual
functions, and override them properly. */
BINFO_VTABLE (t_binfo) = TYPE_BINFO_VTABLE (basetype);
BINFO_VIRTUALS (t_binfo) = TYPE_BINFO_VIRTUALS (basetype);
b->has_virtual = CLASSTYPE_VSIZE (basetype);
b->vfield = CLASSTYPE_VFIELD (basetype);
CLASSTYPE_VFIELD (t) = b->vfield;
......@@ -1678,7 +1684,9 @@ finish_struct_bits (t, max_has_virtual)
else
conv_index = ptr_conv;
}
else if (typecode_p (return_type, INTEGER_TYPE))
else if (typecode_p (return_type, INTEGER_TYPE)
|| typecode_p (return_type, BOOLEAN_TYPE)
|| typecode_p (return_type, ENUMERAL_TYPE))
{
TYPE_HAS_INT_CONVERSION (t) = 1;
conv_index = int_conv;
......@@ -2160,9 +2168,11 @@ modify_one_vtable (binfo, t, fndecl, pfn)
}
}
/* Find the right offset for the this pointer based on the base
class we just found. */
base_offset = BINFO_OFFSET (binfo);
/* Find the right offset for the this pointer based on the
base class we just found. We have to take into
consideration the virtual base class pointers that we
stick in before the virtual function table pointer. */
base_offset = get_vfield_offset (binfo);
this_offset = size_binop (MINUS_EXPR, offset, base_offset);
/* Make sure we can modify the derived association with immunity. */
......@@ -2929,10 +2939,9 @@ finish_struct (t, list_of_fieldlists, warn_anon)
/* Invalid bit-field size done by grokfield. */
/* Detect invalid bit-field type. */
if (DECL_INITIAL (x)
&& TREE_CODE (TREE_TYPE (x)) != INTEGER_TYPE
&& TREE_CODE (TREE_TYPE (x)) != ENUMERAL_TYPE)
&& ! INTEGRAL_TYPE_P (TREE_TYPE (x)))
{
cp_error_at ("bit-field `%D' has invalid type", x);
cp_error_at ("bit-field `%#D' with non-integral type", x);
DECL_INITIAL (x) = NULL;
}
......@@ -3499,6 +3508,27 @@ finish_struct (t, list_of_fieldlists, warn_anon)
}
}
/* Set up the DECL_FIELD_BITPOS of the vfield if we need to, as we
might need to know it for setting up the offsets in the vtable
(or in thunks) below. */
if (vfield != NULL_TREE
&& DECL_FIELD_CONTEXT (vfield) != t)
{
tree binfo = get_binfo (DECL_FIELD_CONTEXT (vfield), t, 0);
tree offset = BINFO_OFFSET (binfo);
vfield = copy_node (vfield);
copy_lang_decl (vfield);
if (! integer_zerop (offset))
offset = size_binop (MULT_EXPR, offset, size_int (BITS_PER_UNIT));
DECL_FIELD_CONTEXT (vfield) = t;
DECL_CLASS_CONTEXT (vfield) = t;
DECL_FIELD_BITPOS (vfield)
= size_binop (PLUS_EXPR, offset, DECL_FIELD_BITPOS (vfield));
CLASSTYPE_VFIELD (t) = vfield;
}
#ifdef NOTQUITE
cp_warning ("Doing hard virtuals for %T...", t);
#endif
......@@ -3739,6 +3769,8 @@ finish_struct (t, list_of_fieldlists, warn_anon)
DECL_REGISTER (vtbl_ptr) = 1;
CLASSTYPE_VTBL_PTR (t) = vtbl_ptr;
}
#if 0
/* This is now done above. */
if (DECL_FIELD_CONTEXT (vfield) != t)
{
tree binfo = get_binfo (DECL_FIELD_CONTEXT (vfield), t, 0);
......@@ -3755,6 +3787,7 @@ finish_struct (t, list_of_fieldlists, warn_anon)
= size_binop (PLUS_EXPR, offset, DECL_FIELD_BITPOS (vfield));
CLASSTYPE_VFIELD (t) = vfield;
}
#endif
/* In addition to this one, all the other vfields should be listed. */
/* Before that can be done, we have to have FIELD_DECLs for them, and
......
......@@ -39,34 +39,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
and one uses pointers of strictly higher type (derived where
another uses base), then that alternative is silently chosen.
If two candidates have a non-monotonic derived/base pointer
relationship, and/or a non-monotonic easy conversion relationship,
then a warning is emitted to show which paths are possible, and
which one is being chosen.
For example:
int i;
double x;
overload f;
int f (int, int);
double f (double, double);
f (i, x); // draws a warning
struct B
{
f (int);
} *bb;
struct D : B
{
f (double);
} *dd;
dd->f (x); // exact match
dd->f (i); // draws warning
Note that this technique really only works for 255 arguments. Perhaps
this is not enough. */
......@@ -102,36 +74,19 @@ struct harshness_code
struct candidate
{
/* OLD METHOD */
unsigned char evil; /* !0 if this will never convert. */
unsigned char ellipsis; /* !0 if a match against an ellipsis occurred */
unsigned char user; /* !0 if at least one user-defined type conv. */
unsigned short b_or_d; /* count number of derived->base or
base->derived conv. */
unsigned short easy; /* count number of builtin type conv. */
/* NEW METHOD */
struct harshness_code h; /* Used for single-argument conversions. */
int h_len; /* The length of the harshness vector. */
/* Both methods. */
tree function; /* A FUNCTION_DECL */
tree basetypes; /* The path to function. */
tree arg; /* first parm to function. */
/* This union is only here while we maintain both the old and new
argument matching schemes. When it goes away, all v.ansi_harshness
references will be just `harshness'. */
union
{
/* Indexed by argument number, encodes evil, user, d_to_b, and easy
strikes for that argument. At end of array, we store the index+1
of where we started using default parameters, or 0 if there are
none. */
struct harshness_code *ansi_harshness; /* NEW METHOD */
unsigned short *old_harshness; /* OLD METHOD */
} v;
/* Indexed by argument number, encodes evil, user, d_to_b, and easy
strikes for that argument. At end of array, we store the index+1
of where we started using default parameters, or 0 if there are
none. */
struct harshness_code *harshness;
union
{
......
......@@ -280,11 +280,6 @@ extern int flag_ansi;
extern int flag_handle_exceptions;
/* Nonzero means do argument matching for overloading according to the
ANSI rules, rather than what g++ used to believe to be correct. */
extern int flag_ansi_overloading;
/* Nonzero means recognize and handle signature language constructs. */
extern int flag_handle_signatures;
......@@ -1132,6 +1127,10 @@ struct lang_decl
|| TYPE_MAIN_VARIANT (t) == short_integer_type_node \
|| TYPE_MAIN_VARIANT (t) == short_unsigned_type_node))
#define INTEGRAL_CODE_P(CODE) \
(CODE == INTEGER_TYPE || CODE == ENUMERAL_TYPE || CODE == BOOLEAN_TYPE)
#define ARITHMETIC_TYPE_P(TYPE) (INTEGRAL_TYPE_P (TYPE) || FLOAT_TYPE_P (TYPE))
/* Mark which labels are explicitly declared.
These may be shadowed, and may be referenced from nested functions. */
#define C_DECLARED_LABEL_FLAG(label) TREE_LANG_FLAG_1 (label)
......@@ -1367,6 +1366,7 @@ extern tree delta_type_node;
extern tree long_long_integer_type_node, long_long_unsigned_type_node;
/* For building calls to `delete'. */
extern tree integer_two_node, integer_three_node;
extern tree bool_type_node, true_node, false_node;
/* in except.c */
extern tree current_exception_type;
......@@ -1938,6 +1938,7 @@ extern tree reparse_absdcl_as_casts PROTO((tree, tree));
extern tree reparse_decl_as_expr PROTO((tree, tree));
extern tree finish_decl_parsing PROTO((tree));
extern tree lookup_name_nonclass PROTO((tree));
extern tree check_cp_case_value PROTO((tree));
/* in edsel.c */
......@@ -2217,6 +2218,7 @@ extern tree array_type_nelts_total PROTO((tree));
extern tree array_type_nelts_top PROTO((tree));
/* in typeck.c */
extern tree bool_truthvalue_conversion PROTO((tree));
extern tree target_type PROTO((tree));
extern tree require_complete_type PROTO((tree));
extern int type_unknown_p PROTO((tree));
......@@ -2262,6 +2264,9 @@ extern tree build_x_conditional_expr PROTO((tree, tree, tree));
extern tree build_conditional_expr PROTO((tree, tree, tree));
extern tree build_x_compound_expr PROTO((tree));
extern tree build_compound_expr PROTO((tree));
extern tree build_static_cast PROTO((tree, tree));
extern tree build_reinterpret_cast PROTO((tree, tree));
extern tree build_const_cast PROTO((tree, tree));
extern tree build_c_cast PROTO((tree, tree));
extern tree build_modify_expr PROTO((tree, enum tree_code, tree));
extern int language_lvalue_valid PROTO((tree));
......
......@@ -96,17 +96,10 @@ int flag_signed_bitfields = 1;
int flag_no_ident = 0;
/* Nonzero means handle things in ANSI, instead of GNU fashion. This
flag should be tested for language behavior that's different between
ANSI and GNU, but not so horrible as to merit a PEDANTIC label. */
/* Nonzero means disable GNU extensions. */
int flag_ansi = 0;
/* Nonzero means do argument matching for overloading according to the
ANSI rules, rather than what g++ used to believe to be correct. */
int flag_ansi_overloading = 1;
/* Nonzero means do emit exported implementations of functions even if
they can be inlined. */
......@@ -359,7 +352,6 @@ static struct { char *string; int *variable; int on_value;} lang_f_options[] =
{"nonnull-objects", &flag_assume_nonnull_objects, 1},
{"implement-inlines", &flag_implement_inlines, 1},
{"external-templates", &flag_external_templates, 1},
{"ansi-overloading", &flag_ansi_overloading, 1},
{"huge-objects", &flag_huge_objects, 1},
{"conserve-space", &flag_conserve_space, 1},
{"vtable-thunks", &flag_vtable_thunks, 1},
......@@ -797,9 +789,11 @@ grokclassfn (ctype, cname, function, flags, quals)
we may wish to make it special. */
tree type = TREE_VALUE (arg_types);
if (flags == DTOR_FLAG)
if ((flag_this_is_variable > 0)
&& (flags == DTOR_FLAG || DECL_CONSTRUCTOR_P (function)))
type = TYPE_MAIN_VARIANT (type);
else if (DECL_CONSTRUCTOR_P (function))
if (DECL_CONSTRUCTOR_P (function))
{
if (TYPE_USES_VIRTUAL_BASECLASSES (ctype))
{
......@@ -824,14 +818,7 @@ grokclassfn (ctype, cname, function, flags, quals)
/* We can make this a register, so long as we don't
accidentally complain if someone tries to take its address. */
DECL_REGISTER (parm) = 1;
#if 0
/* it is wrong to flag the object as readonly, when
flag_this_is_variable is 0. */
if (flags != DTOR_FLAG
&& (flag_this_is_variable <= 0 || TYPE_READONLY (type)))
#else
if (flags != DTOR_FLAG && TYPE_READONLY (type))
#endif
if (TYPE_READONLY (type))
TREE_READONLY (parm) = 1;
TREE_CHAIN (parm) = last_function_parms;
last_function_parms = parm;
......@@ -1044,7 +1031,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 ("ANSI C++ forbids array size in vector delete");
pedwarn ("anachronistic use of array size in vector delete");
/* Fall through. */
case 1:
elt_size = c_sizeof (type);
......@@ -1800,7 +1787,7 @@ build_push_scope (cname, name)
void cplus_decl_attributes (decl, attributes)
tree decl, attributes;
{
if (decl)
if (decl && decl != void_type_node)
decl_attributes (decl, attributes);
}
......@@ -2952,3 +2939,43 @@ finish_decl_parsing (decl)
return NULL_TREE;
}
}
tree
check_cp_case_value (value)
tree value;
{
if (value == NULL_TREE)
return value;
/* build_c_cast puts on a NOP_EXPR to make a non-lvalue.
Strip such NOP_EXPRs. */
if (TREE_CODE (value) == NOP_EXPR
&& TREE_TYPE (value) == TREE_TYPE (TREE_OPERAND (value, 0)))
value = TREE_OPERAND (value, 0);
if (TREE_READONLY_DECL_P (value))
{
value = decl_constant_value (value);
/* build_c_cast puts on a NOP_EXPR to make a non-lvalue.
Strip such NOP_EXPRs. */
if (TREE_CODE (value) == NOP_EXPR
&& TREE_TYPE (value) == TREE_TYPE (TREE_OPERAND (value, 0)))
value = TREE_OPERAND (value, 0);
}
value = fold (value);
if (TREE_CODE (value) != INTEGER_CST
&& value != error_mark_node)
{
cp_error ("case label `%E' does not reduce to an integer constant",
value);
value = error_mark_node;
}
else
/* Promote char or short to int. */
value = default_conversion (value);
constant_expression_warning (value);
return value;
}
......@@ -120,7 +120,7 @@ cp_thing (errfn, atarg1, format, arglist)
if (arg >= NARGS) abort ();
if (maybe_here && atarg)
if (maybe_here && atarg1)
atarg = args[arg];
/* Must use a temporary to avoid calling *function twice */
......
......@@ -198,6 +198,7 @@ dump_type (t, v)
/* fall through. */
case REAL_TYPE:
case VOID_TYPE:
case BOOLEAN_TYPE:
dump_readonly_or_volatile (t, after);
OB_PUTID (TYPE_IDENTIFIER (t));
break;
......@@ -356,6 +357,10 @@ dump_type_prefix (t, v)
switch (TREE_CODE (sub))
{
case ARRAY_TYPE:
OB_PUTC2 (' ', '(');
break;
case POINTER_TYPE:
/* We don't want "char * &" */
if (! (TYPE_READONLY (sub) || TYPE_VOLATILE (sub)))
......@@ -405,6 +410,7 @@ dump_type_prefix (t, v)
case ERROR_MARK:
case IDENTIFIER_NODE:
case INTEGER_TYPE:
case BOOLEAN_TYPE:
case REAL_TYPE:
case RECORD_TYPE:
case TEMPLATE_TYPE_PARM:
......@@ -476,6 +482,7 @@ dump_type_suffix (t, v)
case ERROR_MARK:
case IDENTIFIER_NODE:
case INTEGER_TYPE:
case BOOLEAN_TYPE:
case REAL_TYPE:
case RECORD_TYPE:
case TEMPLATE_TYPE_PARM:
......
......@@ -28,6 +28,7 @@ __volatile__, TYPE_QUAL, RID_VOLATILE
__wchar_t, TYPESPEC, RID_WCHAR /* Unique to ANSI C++ */,
asm, ASM_KEYWORD, NORID,
auto, SCSPEC, RID_AUTO,
bool, TYPESPEC, RID_BOOL,
break, BREAK, NORID,
case, CASE, NORID,
catch, CATCH, NORID,
......@@ -45,6 +46,7 @@ dynamic_cast, DYNAMIC_CAST, NORID,
else, ELSE, NORID,
enum, ENUM, NORID,
extern, SCSPEC, RID_EXTERN,
false, CXX_FALSE, NORID,
float, TYPESPEC, RID_FLOAT,
for, FOR, NORID,
friend, SCSPEC, RID_FRIEND,
......@@ -76,6 +78,7 @@ switch, SWITCH, NORID,
this, THIS, NORID,
throw, THROW, NORID,
template, TEMPLATE, RID_TEMPLATE,
true, CXX_TRUE, NORID,
try, TRY, NORID,
typedef, SCSPEC, RID_TYPEDEF,
typeof, TYPEOF, NORID,
......
......@@ -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 83
#define TOTAL_KEYWORDS 86
#define MIN_WORD_LENGTH 2
#define MAX_WORD_LENGTH 16
#define MIN_HASH_VALUE 4
#define MAX_HASH_VALUE 170
/* maximum key range = 167, duplicates = 0 */
#define MAX_HASH_VALUE 171
/* maximum key range = 168, duplicates = 0 */
#ifdef __GNUC__
inline
......@@ -20,19 +20,19 @@ hash (str, len)
{
static unsigned char asso_values[] =
{
171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
171, 171, 171, 171, 171, 0, 171, 62, 5, 65,
27, 0, 18, 7, 10, 48, 171, 1, 30, 7,
79, 0, 33, 171, 18, 0, 4, 26, 13, 0,
1, 24, 171, 171, 171, 171, 171, 171,
172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
172, 172, 172, 172, 172, 0, 172, 36, 1, 61,
0, 0, 30, 44, 44, 35, 172, 7, 12, 53,
40, 17, 6, 172, 28, 2, 4, 35, 31, 51,
5, 7, 172, 172, 172, 172, 172, 172,
};
register int hval = len;
......@@ -65,120 +65,120 @@ is_reserved_word (str, len)
{
{"",}, {"",}, {"",}, {"",},
{"else", ELSE, NORID,},
{"",}, {"",},
{"",},
{"delete", DELETE, NORID,},
{"double", TYPESPEC, RID_DOUBLE,},
{"true", CXX_TRUE, NORID,},
{"__asm__", GCC_ASM_KEYWORD, NORID},
{"typeid", TYPEID, NORID,},
{"",},
{"this", THIS, NORID,},
{"throw", THROW, NORID,},
{"",},
{"try", TRY, NORID,},
{"",}, {"",}, {"",}, {"",},
{"do", DO, NORID,},
{"",},
{"static_cast", STATIC_CAST, NORID,},
{"template", TEMPLATE, RID_TEMPLATE,},
{"protected", VISSPEC, RID_PROTECTED,},
{"",},
{"__classof__", CLASSOF, NORID},
{"",},
{"__headof__", HEADOF, NORID},
{"goto", GOTO, NORID,},
{"__asm", GCC_ASM_KEYWORD, NORID},
{"",},
{"bool", TYPESPEC, RID_BOOL,},
{"__const__", TYPE_QUAL, RID_CONST},
{"__volatile", TYPE_QUAL, RID_VOLATILE},
{"__const", TYPE_QUAL, RID_CONST},
{"__volatile__", TYPE_QUAL, RID_VOLATILE},
{"",},
{"enum", ENUM, NORID,},
{"static_cast", STATIC_CAST, NORID,},
{"switch", SWITCH, NORID,},
{"",}, {"",},
{"sigof", SIGOF, NORID /* Extension */,},
{"__typeof__", TYPEOF, NORID},
{"void", TYPESPEC, RID_VOID,},
{"friend", SCSPEC, RID_FRIEND,},
{"false", CXX_FALSE, NORID,},
{"sizeof", SIZEOF, NORID,},
{"",},
{"__headof", HEADOF, NORID},
{"short", TYPESPEC, RID_SHORT,},
{"typeof", TYPEOF, NORID,},
{"do", DO, NORID,},
{"",},
{"try", TRY, NORID,},
{"",},
{"delete", DELETE, NORID,},
{"__typeof__", TYPEOF, NORID},
{"while", WHILE, NORID,},
{"struct", AGGR, RID_RECORD,},
{"typeid", TYPEID, NORID,},
{"double", TYPESPEC, RID_DOUBLE,},
{"for", FOR, NORID,},
{"",},
{"__classof__", CLASSOF, NORID},
{"",}, {"",},
{"operator", OPERATOR, NORID,},
{"",}, {"",},
{"typedef", SCSPEC, RID_TYPEDEF,},
{"long", TYPESPEC, RID_LONG,},
{"template", TEMPLATE, RID_TEMPLATE,},
{"__typeof", TYPEOF, NORID},
{"friend", SCSPEC, RID_FRIEND,},
{"",},
{"private", VISSPEC, RID_PRIVATE,},
{"",},
{"int", TYPESPEC, RID_INT,},
{"",},
{"__classof", CLASSOF, NORID},
{"__signed", TYPESPEC, RID_SIGNED},
{"private", VISSPEC, RID_PRIVATE,},
{"__signed__", TYPESPEC, RID_SIGNED},
{"",}, {"",},
{"headof", HEADOF, NORID,},
{"",},
{"extern", SCSPEC, RID_EXTERN,},
{"struct", AGGR, RID_RECORD,},
{"signed", TYPESPEC, RID_SIGNED,},
{"break", BREAK, NORID,},
{"__attribute", ATTRIBUTE, NORID},
{"",},
{"default", DEFAULT, NORID,},
{"__attribute__", ATTRIBUTE, NORID},
{"auto", SCSPEC, RID_AUTO,},
{"__classof", CLASSOF, NORID},
{"sigof", SIGOF, NORID /* Extension */,},
{"__headof", HEADOF, NORID},
{"switch", SWITCH, NORID,},
{"__label__", LABEL, NORID},
{"__extension__", EXTENSION, NORID},
{"",},
{"__asm", GCC_ASM_KEYWORD, NORID},
{"for", FOR, NORID,},
{"__typeof", TYPEOF, NORID},
{"__alignof__", ALIGNOF, NORID},
{"",},
{"if", IF, NORID,},
{"case", CASE, NORID,},
{"virtual", SCSPEC, RID_VIRTUAL,},
{"if", IF, NORID,},
{"while", WHILE, NORID,},
{"",},
{"class", AGGR, RID_CLASS,},
{"void", TYPESPEC, RID_VOID,},
{"asm", ASM_KEYWORD, NORID,},
{"break", BREAK, NORID,},
{"typedef", SCSPEC, RID_TYPEDEF,},
{"const", TYPE_QUAL, RID_CONST,},
{"static", SCSPEC, RID_STATIC,},
{"mutable", SCSPEC, RID_MUTABLE,},
{"protected", VISSPEC, RID_PROTECTED,},
{"",}, {"",}, {"",}, {"",},
{"new", NEW, NORID,},
{"__signed", TYPESPEC, RID_SIGNED},
{"virtual", SCSPEC, RID_VIRTUAL,},
{"extern", SCSPEC, RID_EXTERN,},
{"",}, {"",}, {"",},
{"auto", SCSPEC, RID_AUTO,},
{"float", TYPESPEC, RID_FLOAT,},
{"inline", SCSPEC, RID_INLINE,},
{"throw", THROW, NORID,},
{"unsigned", TYPESPEC, RID_UNSIGNED,},
{"",},
{"headof", HEADOF, NORID,},
{"",},
{"goto", GOTO, NORID,},
{"",}, {"",},
{"public", VISSPEC, RID_PUBLIC,},
{"signature", AGGR, RID_SIGNATURE /* Extension */,},
{"volatile", TYPE_QUAL, RID_VOLATILE,},
{"__inline", SCSPEC, RID_INLINE},
{"overload", OVERLOAD, NORID,},
{"__inline__", SCSPEC, RID_INLINE},
{"__alignof", ALIGNOF, NORID},
{"asm", ASM_KEYWORD, NORID,},
{"",},
{"new", NEW, NORID,},
{"",},
{"mutable", SCSPEC, RID_MUTABLE,},
{"union", AGGR, RID_UNION,},
{"operator", OPERATOR, NORID,},
{"register", SCSPEC, RID_REGISTER,},
{"__extension__", EXTENSION, NORID},
{"",}, {"",},
{"__wchar_t", TYPESPEC, RID_WCHAR /* Unique to ANSI C++ */,},
{"",}, {"",}, {"",}, {"",},
{"__label__", LABEL, NORID},
{"inline", SCSPEC, RID_INLINE,},
{"",},
{"long", TYPESPEC, RID_LONG,},
{"",}, {"",}, {"",},
{"continue", CONTINUE, NORID,},
{"default", DEFAULT, NORID,},
{"char", TYPESPEC, RID_CHAR,},
{"return", RETURN, NORID,},
{"enum", ENUM, NORID,},
{"",}, {"",},
{"classof", CLASSOF, NORID,},
{"unsigned", TYPESPEC, RID_UNSIGNED,},
{"union", AGGR, RID_UNION,},
{"",},
{"signed", TYPESPEC, RID_SIGNED,},
{"volatile", TYPE_QUAL, RID_VOLATILE,},
{"signature", AGGR, RID_SIGNATURE /* Extension */,},
{"overload", OVERLOAD, NORID,},
{"dynamic_cast", DYNAMIC_CAST, NORID,},
{"",}, {"",},
{"reinterpret_cast", REINTERPRET_CAST, NORID,},
{"",}, {"",}, {"",}, {"",},
{"__alignof__", ALIGNOF, NORID},
{"char", TYPESPEC, RID_CHAR,},
{"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",},
{"return", RETURN, NORID,},
{"",}, {"",}, {"",}, {"",},
{"public", VISSPEC, RID_PUBLIC,},
{"reinterpret_cast", REINTERPRET_CAST, NORID,},
{"__alignof", ALIGNOF, NORID},
{"classof", CLASSOF, NORID,},
{"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",},
{"const_cast", CONST_CAST, NORID,},
{"catch", CATCH, NORID,},
{"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",},
{"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",},
{"",}, {"",},
{"__inline", SCSPEC, RID_INLINE},
{"",},
{"__inline__", SCSPEC, RID_INLINE},
{"",},
{"dynamic_cast", DYNAMIC_CAST, NORID,},
{"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",},
{"",}, {"",}, {"",}, {"",}, {"",},
{"catch", CATCH, NORID,},
};
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
......
......@@ -3566,7 +3566,7 @@ build_delete (type, addr, auto_delete, flags, use_global_delete)
if (TREE_CODE (type) == POINTER_TYPE)
{
type = TREE_TYPE (type);
type = TYPE_MAIN_VARIANT (TREE_TYPE (type));
if (TYPE_SIZE (type) == 0)
{
incomplete_type_error (0, type);
......@@ -3582,6 +3582,9 @@ build_delete (type, addr, auto_delete, flags, use_global_delete)
}
if (TREE_SIDE_EFFECTS (addr))
addr = save_expr (addr);
/* throw away const and volatile on target type of addr */
addr = convert_force (build_pointer_type (type), addr);
ref = build_indirect_ref (addr, NULL_PTR);
ptr = 1;
}
......
......@@ -577,6 +577,9 @@ init_lex ()
ridpointers[(int) RID_INT] = get_identifier ("int");
SET_IDENTIFIER_AS_LIST (ridpointers[(int) RID_INT],
build_tree_list (NULL_TREE, ridpointers[(int) RID_INT]));
ridpointers[(int) RID_BOOL] = get_identifier ("bool");
SET_IDENTIFIER_AS_LIST (ridpointers[(int) RID_BOOL],
build_tree_list (NULL_TREE, ridpointers[(int) RID_BOOL]));
ridpointers[(int) RID_CHAR] = get_identifier ("char");
SET_IDENTIFIER_AS_LIST (ridpointers[(int) RID_CHAR],
build_tree_list (NULL_TREE, ridpointers[(int) RID_CHAR]));
......@@ -4442,9 +4445,9 @@ real_yylex ()
value = MIN_MAX;
nextchar = c1;
}
if (pedantic)
error ("use of `operator %s' is not standard C++",
token_buffer);
if (flag_ansi)
pedwarn ("use of `operator %s' is not standard C++",
token_buffer);
goto done;
}
......
......@@ -26,6 +26,7 @@ enum rid
{
RID_UNUSED,
RID_INT,
RID_BOOL,
RID_CHAR,
RID_WCHAR,
RID_FLOAT,
......
......@@ -366,6 +366,11 @@ build_overload_value (type, value)
icat (TREE_INT_CST_LOW (value));
return;
}
case BOOLEAN_TYPE:
{
icat (TREE_INT_CST_LOW (value));
return;
}
#ifndef REAL_IS_NOT_DOUBLE
case REAL_TYPE:
{
......@@ -587,10 +592,7 @@ build_overload_name (parmtypes, begin, end)
OB_PUTC ('A');
if (TYPE_DOMAIN (parmtype) == NULL_TREE)
{
error ("parameter type with unspecified array bounds invalid");
icat (1);
}
error ("pointer or reference to array of unknown bound in parm type");
else
{
length = array_type_nelts (parmtype);
......@@ -701,6 +703,10 @@ build_overload_name (parmtypes, begin, end)
my_friendly_abort (73);
break;
case BOOLEAN_TYPE:
OB_PUTC ('b');
break;
case REAL_TYPE:
parmtype = TYPE_MAIN_VARIANT (parmtype);
if (parmtype == long_double_type_node)
......@@ -1703,7 +1709,7 @@ emit_thunk (thunk_fndecl)
int delta = THUNK_DELTA (thunk_fndecl);
int tem;
int failure = 0;
extern int current_call_is_indirect; /* Needed for (at least) HPPA. */
int current_call_is_indirect = 0; /* needed for HPPA FUNCTION_ARG */
/* Used to remember which regs we need to emit a USE rtx for. */
rtx need_use[FIRST_PSEUDO_REGISTER];
......
......@@ -782,6 +782,7 @@ uses_template_parms (t)
case REAL_TYPE:
case VOID_TYPE:
case ENUMERAL_TYPE:
case BOOLEAN_TYPE:
return 0;
/* constants */
......@@ -1142,6 +1143,7 @@ tsubst (t, args, nargs, in_decl)
case VOID_TYPE:
case REAL_TYPE:
case ENUMERAL_TYPE:
case BOOLEAN_TYPE:
case INTEGER_CST:
case REAL_CST:
case STRING_CST:
......@@ -1351,6 +1353,11 @@ tsubst (t, args, nargs, in_decl)
DECL_CONTEXT (t) != NULL_TREE);
r = build_lang_decl (FUNCTION_DECL, r, type);
}
else if (DECL_INLINE (r) && DECL_SAVED_INSNS (r))
{
/* This overrides the template version, use it. */
return r;
}
}
}
TREE_PUBLIC (r) = TREE_PUBLIC (t);
......@@ -1638,8 +1645,10 @@ instantiate_template (tmpl, targ_ptr)
DECL_ARGUMENTS (fndecl) = TREE_CHAIN (DECL_ARGUMENTS (fndecl));
}
/* If we have a preexisting version of this function, don't expand
the template version, use the other instead. */
t = DECL_TEMPLATE_INFO (tmpl);
if (t->text)
if (t->text && !(DECL_INLINE (fndecl) && DECL_SAVED_INSNS (fndecl)))
{
p = (struct pending_inline *) permalloc (sizeof (struct pending_inline));
p->parm_vec = t->parm_vec;
......
......@@ -2426,7 +2426,7 @@ dfs_init_vbase_pointers (binfo)
this_vbase_ptr = vbase_decl_ptr_intermediate;
if (TYPE_POINTER_TO (type) != TREE_TYPE (this_vbase_ptr))
if (TYPE_POINTER_TO (type) != TYPE_MAIN_VARIANT (TREE_TYPE (this_vbase_ptr)))
my_friendly_abort (125);
while (fields && DECL_NAME (fields)
......@@ -2525,9 +2525,30 @@ expand_indirect_vtbls_init (binfo, true_exp, decl_ptr, use_computed_offsets)
if (use_computed_offsets)
addr = (tree)CLASSTYPE_SEARCH_SLOT (BINFO_TYPE (vbases));
else
addr = convert_pointer_to_real (vbases, vbase_decl_ptr);
if (addr == error_mark_node)
continue;
{
tree vbinfo = get_binfo (TREE_TYPE (vbases),
TREE_TYPE (vbase_decl),
0);
/* See is we can get lucky. */
if (TREE_VIA_VIRTUAL (vbinfo))
addr = convert_pointer_to_real (vbinfo, vbase_decl_ptr);
else
{
/* We go through all these contortions to avoid this
call, as it will fail when the virtual base type
is ambiguous from here. We don't yet have a way
to search for and find just an instance of the
virtual base class. Searching for the binfo in
vbases won't work, as we don't have the vbase
pointer field, for all vbases in the main class,
only direct vbases. */
addr = convert_pointer_to_real (TREE_TYPE (vbases),
vbase_decl_ptr);
if (addr == error_mark_node)
continue;
}
}
/* Do all vtables from this virtual base. */
/* This assumes that virtual bases can never serve as parent
......@@ -2877,12 +2898,16 @@ dfs_pushdecls (binfo)
{
/* Only complain if we shadow something we can access. */
if (old
&& warn_shadow
&& ((DECL_LANG_SPECIFIC (old)
&& DECL_CLASS_CONTEXT (old) == current_class_type)
|| ! TREE_PRIVATE (old)))
/* Should figure out access control more accurately. */
cp_warning ("shadowing member `%#D' with member function `%#D'",
old, *methods);
{
cp_warning_at ("member `%#D' is shadowed", old);
cp_warning_at ("by member function `%#D'", *methods);
warning ("in this context");
}
tmp = build_tree_list (DECL_NAME (*methods), *methods);
}
pop_obstacks ();
......
......@@ -94,6 +94,9 @@ lvalue_p (ref)
return (lvalue_p (TREE_OPERAND (ref, 1))
&& lvalue_p (TREE_OPERAND (ref, 2)));
case MODIFY_EXPR:
return 1;
case COMPOUND_EXPR:
return lvalue_p (TREE_OPERAND (ref, 1));
}
......@@ -111,7 +114,7 @@ lvalue_or_else (ref, string)
{
int win = lvalue_p (ref);
if (! win)
error ("invalid lvalue in %s", string);
error ("non-lvalue in %s", string);
return win;
}
......@@ -305,13 +308,7 @@ build_cplus_method_type (basetype, rettype, argtypes)
else
{
ptype = build_pointer_type (basetype);
#if 0
/* it is wrong to flag the object the pointer points to as readonly
when flag_this_is_variable is 0. */
ptype = build_type_variant (ptype, flag_this_is_variable <= 0, 0);
#else
ptype = build_type_variant (ptype, 0, 0);
#endif
ptype = build_type_variant (ptype, 1, 0);
}
/* The actual arglist for this function includes a "hidden" argument
which is "this". Put it into the list of argument types. */
......
......@@ -766,6 +766,7 @@ digest_init (type, init, tail)
if (code == INTEGER_TYPE || code == REAL_TYPE || code == POINTER_TYPE
|| code == ENUMERAL_TYPE || code == REFERENCE_TYPE
|| code == BOOLEAN_TYPE
|| (code == RECORD_TYPE && ! raw_constructor
&& (IS_SIGNATURE_POINTER (type) || IS_SIGNATURE_REFERENCE (type))))
{
......@@ -951,13 +952,7 @@ process_init_constructor (type, init, elts)
continue;
}
if (TREE_CODE (field) == CONST_DECL || TREE_CODE (field) == TYPE_DECL)
continue;
/* A static member isn't considered "part of the object", so
it has no business even thinking about involving itself in
what an initializer-list is trying to do. */
if (TREE_CODE (field) == VAR_DECL && TREE_STATIC (field))
if (TREE_CODE (field) != FIELD_DECL)
continue;
if (TREE_VALUE (tail) != 0)
......@@ -1462,16 +1457,18 @@ build_functional_cast (exp, parms)
}
{
int flags = LOOKUP_SPECULATIVELY|LOOKUP_COMPLAIN;
int flags = LOOKUP_SPECULATIVELY|LOOKUP_NORMAL;
if (parms && TREE_CHAIN (parms) == NULL_TREE)
flags |= LOOKUP_NO_CONVERSION;
try_again:
expr_as_ctor = build_method_call (NULL_TREE, name, parms,
NULL_TREE, flags);
if (expr_as_ctor && expr_as_ctor != error_mark_node)
if (expr_as_ctor == error_mark_node)
return error_mark_node;
else if (expr_as_ctor)
{
if (expr_as_conversion && expr_as_conversion != error_mark_node)
{
......@@ -1514,18 +1511,6 @@ build_functional_cast (exp, parms)
return expr_as_ctor;
}
/* If it didn't work going through constructor, try type conversion. */
if (! (flags & LOOKUP_COMPLAIN))
{
if (expr_as_conversion)
return expr_as_conversion;
if (flags & LOOKUP_NO_CONVERSION)
{
flags = LOOKUP_NORMAL;
goto try_again;
}
}
if (expr_as_conversion)
return expr_as_conversion;
......
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