Various fixes for -Wall problems from Kaveh. See ChangeLog for details.

From-SVN: r17586
This commit is contained in:
Kaveh R. Ghazi 1998-02-02 00:04:13 +00:00 committed by Jeff Law
parent ceb6edf249
commit a703fb388b
22 changed files with 389 additions and 228 deletions

View File

@ -1,3 +1,127 @@
Mon Feb 2 00:57:38 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* call.c (user_harshness): Initialize `code' to 0.
(build_method_call): Initialize `candidates', `cp' and `len' to 0.
(null_ptr_cst_p): Add parentheses around && within ||.
(standard_conversion): Likewise.
(z_candidate): Likewise.
(build_user_type_conversion_1): Initialize `args' to NULL_TREE.
(build_object_call): Likewise for `mem_args'.
(build_new_op): Likewise for `mem_arglist'. Add `return' from
default case in enumeration switch.
* class.c (build_vtable_entry): Add explicit braces to avoid
ambiguous `else'.
(build_class_init_list): Likewise.
(finish_struct_1): Initialize `width' to 0.
(instantiate_type): Initialize `name' to NULL_TREE. Add
explicit braces to avoid ambiguous `else'.
* cvt.c (convert_to_aggr): Add explicit braces to avoid ambiguous
`else'.
* decl.c (grok_reference_init): Eliminate unused parameter, all
callers changed.
(record_builtin_type): Initialize `tdecl' to NULL_TREE.
(init_decl_processing): Initialize `vb_off_identifier' to NULL_TREE.
(cp_finish_decl): Initialize `ttype' to NULL_TREE.
(grokdeclarator): Add parentheses around && within ||. Add
explicit braces to avoid ambiguous `else'.
(grokparms): Initialize `type' to NULL_TREE.
(xref_tag): Remove unused label `just_return'.
(finish_enum): Initialize `minnode' and `maxnode' to NULL_TREE.
(finish_function): Initialize `cond' and `thenclause' to NULL_TREE.
(hack_incomplete_structures): Add parentheses around assignment
used as truth value.
* decl2.c (coerce_delete_type): Hide definition of `e3'.
* error.c: Include <stdlib.h>.
(dump_expr): Change the type of `i' to size_t. Remove unused
label `error'.
* except.c (init_exception_processing): Remove unused variable `d'.
(expand_throw): Likewise for `label'.
* friend.c (add_friends): Add explicit braces to avoid ambiguous
`else'.
* init.c (sort_member_init): Initialize `last_field' to NULL_TREE.
(sort_base_init): Likewise for `binfo'.
(expand_member_init): Likewise for `rval'.
(build_member_call): Add parentheses around assignment used as
truth value.
(build_offset_ref): Add explicit braces to avoid ambiguous `else'.
(build_new): Initialize `nelts' to NULL_TREE. Initialize
`old_immediate_size_expand' to 0.
(build_new_1): Initialize `nelts' and `alloc_node' to NULL_TREE.
(build_vec_delete_1): Remove unused variable `block'.
(expand_vec_init): Initialize `itype' to NULL_TREE.
* lex.c: Include <strings.h> if we don't have <string.h>. Protect
declaration of `index' and `rindex' with autoconf macros.
(reinit_parse_for_expr): Remove unused variables
`look_for_semicolon' and `look_for_lbrac'.
(cons_up_default_function): Initialize `args' to NULL_TREE.
(readescape): Initialize `firstdig' to 0.
(real_yylex): Add parentheses around assignment used as truth value.
* method.c: Include <strings.h> if we don't have <string.h>.
Protect declaration of `index' with autoconf macro.
* parse.y (primary): Add explicit braces to avoid ambiguous `else'.
Initialize `type' to NULL_TREE.
(structsp): Remove unused variable `id'.
* pt.c (coerce_template_parms): Add explicit braces to avoid
ambiguous `else'.
(lookup_template_class): Initialize `template' to NULL_TREE.
(instantiate_class_template): Remove unused variable `name' and `e'.
(tsubst): Likewise for `i'. Initialize `last' to NULL_TREE.
(do_poplevel): Initialize `saved_warn_unused' to 0.
(type_unification): Remove unused varable `parm'.
(unify): Likewise for `j'.
* repo.c (init_repo): Add parentheses around assignment used as
truth value.
(finish_repo): Remove unused varable `p'.
* search.c (get_binfo): Initiize `type' to NULL_TREE.
(get_base_distance): Likewise.
(lookup_field): Initialize `rval_binfo_h', `type', `basetype_path'
and `new_v' to NULL_TREE.
(lookup_fnfields): Likewise for `rval_binfo_h'.
(breadth_first_search): Add parentheses around assignment used as
truth value.
(get_template_base): Initialize `type' to NULL_TREE.
* sig.c (append_signature_fields): Initialize `last_mfptr' to
NULL_TREE.
(build_signature_table_constructor): Likewise for
`last_rhs_field', `pfn' and `vt_off'.
(build_sigtable): Likewise for `init'.
* tree.c (break_out_calls): Initialize `t2' to NULL_TREE.
(propagate_binfo_offsets): Likewise for `delta'.
(hash_tree_cons): Initialize hashcode to 0.
(can_free): Likewise for `size'.
(cp_tree_equal): Add explicit braces to avoid ambiguous `else'.
* typeck.c (convert_sequence): Hide prototype.
(common_type): Add explicit braces to avoid ambiguous `else'.
(comp_target_types): Likewise.
(build_x_function_call): Initialize `ctypeptr' to NULL_TREE.
(build_function_call_real): Add explicit braces to avoid ambiguous
`else'.
(convert_arguments): Initialize `called_thing' to 0.
(convert_for_initialization): Initialize `savew' and `savee' to 0.
* typeck2.c (incomplete_type_error): Initialize `errmsg' to 0.
(digest_init): Initialize `old_tail_contents' to NULL_TREE.
(build_x_arrow): Likewise for `last_rval'.
* xref.c (GNU_xref_decl): Initialize `cls' to 0.
Sun Feb 1 12:45:34 1998 J"orn Rennecke <amylaar@cygnus.co.uk>
* decl.c (init_decl_processing): Use set_sizetype.

View File

@ -692,7 +692,7 @@ user_harshness (type, parmtype)
{
tree conv;
tree winner = NULL_TREE;
int code;
int code = 0;
{
tree typename = build_typename_overload (type);
@ -2195,9 +2195,9 @@ build_method_call (instance, name, parms, basetype_path, flags)
for (pass = 0; pass < 2; pass++)
{
struct candidate *candidates;
struct candidate *cp;
int len;
struct candidate *candidates = 0;
struct candidate *cp = 0;
int len = 0;
unsigned best = 1;
baselink = result;
@ -3000,7 +3000,7 @@ null_ptr_cst_p (t)
tree t;
{
if (t == null_node
|| integer_zerop (t) && TREE_CODE (TREE_TYPE (t)) == INTEGER_TYPE)
|| (integer_zerop (t) && TREE_CODE (TREE_TYPE (t)) == INTEGER_TYPE))
return 1;
return 0;
}
@ -3192,8 +3192,8 @@ standard_conversion (to, from, expr)
return 0;
conv = build_conv (STD_CONV, to, conv);
if (fcode == POINTER_TYPE || TYPE_PTRMEMFUNC_P (from)
&& ICS_STD_RANK (conv) < PBOOL_RANK)
if (fcode == POINTER_TYPE
|| (TYPE_PTRMEMFUNC_P (from) && ICS_STD_RANK (conv) < PBOOL_RANK))
ICS_STD_RANK (conv) = PBOOL_RANK;
}
/* We don't check for ENUMERAL_TYPE here because there are no standard
@ -3768,8 +3768,8 @@ add_builtin_candidate (candidates, code, code2, fnname, type1, type2,
case EQ_EXPR:
case NE_EXPR:
if (TYPE_PTRMEMFUNC_P (type1) && TYPE_PTRMEMFUNC_P (type2)
|| TYPE_PTRMEM_P (type1) && TYPE_PTRMEM_P (type2))
if ((TYPE_PTRMEMFUNC_P (type1) && TYPE_PTRMEMFUNC_P (type2))
|| (TYPE_PTRMEM_P (type1) && TYPE_PTRMEM_P (type2)))
break;
if ((TYPE_PTRMEMFUNC_P (type1) || TYPE_PTRMEM_P (type1))
&& null_ptr_cst_p (args[1]))
@ -3789,8 +3789,8 @@ add_builtin_candidate (candidates, code, code2, fnname, type1, type2,
case GE_EXPR:
case MAX_EXPR:
case MIN_EXPR:
if (ARITHMETIC_TYPE_P (type1) && ARITHMETIC_TYPE_P (type2)
|| TYPE_PTR_P (type1) && TYPE_PTR_P (type2))
if ((ARITHMETIC_TYPE_P (type1) && ARITHMETIC_TYPE_P (type2))
|| (TYPE_PTR_P (type1) && TYPE_PTR_P (type2)))
break;
if (TYPE_PTR_P (type1) && null_ptr_cst_p (args[1]))
{
@ -4322,7 +4322,7 @@ build_user_type_conversion_1 (totype, expr, flags)
struct z_candidate *candidates, *cand;
tree fromtype = TREE_TYPE (expr);
tree ctors = NULL_TREE, convs = NULL_TREE, *p;
tree args;
tree args = NULL_TREE;
tree templates = NULL_TREE;
if (IS_AGGR_TYPE (totype))
@ -4597,7 +4597,7 @@ build_object_call (obj, args)
tree obj, args;
{
struct z_candidate *candidates = 0, *cand;
tree fns, convs, mem_args;
tree fns, convs, mem_args = NULL_TREE;
tree type = TREE_TYPE (obj);
tree templates = NULL_TREE;
@ -4725,7 +4725,7 @@ build_new_op (code, flags, arg1, arg2, arg3)
tree arg1, arg2, arg3;
{
struct z_candidate *candidates = 0, *cand;
tree fns, mem_arglist, arglist, fnname;
tree fns, mem_arglist = NULL_TREE, arglist, fnname;
enum tree_code code2 = NOP_EXPR;
tree templates = NULL_TREE;
tree conv;
@ -5117,6 +5117,7 @@ builtin:
default:
my_friendly_abort (367);
return NULL_TREE;
}
}
@ -5665,7 +5666,7 @@ build_new_method_call (instance, name, args, basetype_path, flags)
{
struct z_candidate *candidates = 0, *cand;
tree explicit_targs = NULL_TREE;
tree basetype, mem_args, fns, instance_ptr;
tree basetype, mem_args = NULL_TREE, fns, instance_ptr;
tree pretty_name;
tree user_args = args;
tree templates = NULL_TREE;

View File

@ -458,11 +458,13 @@ build_vtable_entry (delta, pfn)
< TREE_INT_CST_LOW (delta))
|| (TREE_INT_CST_LOW (delta)
< TREE_INT_CST_LOW (TYPE_MIN_VALUE (delta_type_node))))
if (flag_huge_objects)
sorry ("object size exceeds built-in limit for virtual function table implementation");
else
sorry ("object size exceeds normal limit for virtual function table implementation, recompile all source and use -fhuge-objects");
{
if (flag_huge_objects)
sorry ("object size exceeds built-in limit for virtual function table implementation");
else
sorry ("object size exceeds normal limit for virtual function table implementation, recompile all source and use -fhuge-objects");
}
TREE_CONSTANT (entry) = 1;
TREE_STATIC (entry) = 1;
TREE_READONLY (entry) = 1;
@ -1493,10 +1495,13 @@ build_class_init_list (type)
}
if (base_init_list)
if (member_init_list)
CLASSTYPE_BASE_INIT_LIST (type) = build_tree_list (base_init_list, member_init_list);
else
CLASSTYPE_BASE_INIT_LIST (type) = base_init_list;
{
if (member_init_list)
CLASSTYPE_BASE_INIT_LIST (type) =
build_tree_list (base_init_list, member_init_list);
else
CLASSTYPE_BASE_INIT_LIST (type) = base_init_list;
}
else if (member_init_list)
CLASSTYPE_BASE_INIT_LIST (type) = member_init_list;
}
@ -3461,7 +3466,7 @@ finish_struct_1 (t, warn_anon)
if (DECL_INITIAL (x))
{
tree w = DECL_INITIAL (x);
register int width;
register int width = 0;
/* Avoid the non_lvalue wrapper added by fold for PLUS_EXPRs. */
STRIP_NOPS (w);
@ -5102,7 +5107,7 @@ instantiate_type (lhstype, rhs, complain)
case TREE_LIST:
{
tree elem, baselink, name;
tree elem, baselink, name = NULL_TREE;
int globals = overloaded_globals_p (rhs);
/* First look for an exact match. Search either overloaded
@ -5113,15 +5118,17 @@ instantiate_type (lhstype, rhs, complain)
lhstype = TYPE_PTRMEMFUNC_FN_TYPE (lhstype);
if (TREE_CODE (lhstype) == POINTER_TYPE)
if (TREE_CODE (TREE_TYPE (lhstype)) == FUNCTION_TYPE
|| TREE_CODE (TREE_TYPE (lhstype)) == METHOD_TYPE)
lhstype = TREE_TYPE (lhstype);
else
{
if (complain)
error ("invalid type combination for overload");
return error_mark_node;
}
{
if (TREE_CODE (TREE_TYPE (lhstype)) == FUNCTION_TYPE
|| TREE_CODE (TREE_TYPE (lhstype)) == METHOD_TYPE)
lhstype = TREE_TYPE (lhstype);
else
{
if (complain)
error ("invalid type combination for overload");
return error_mark_node;
}
}
if (TREE_CODE (lhstype) != FUNCTION_TYPE && globals > 0)
{
@ -5138,13 +5145,15 @@ instantiate_type (lhstype, rhs, complain)
can match. */
if (explicit_targs == NULL_TREE)
while (elem)
if (! comptypes (lhstype, TREE_TYPE (elem), 1))
elem = DECL_CHAIN (elem);
else
{
mark_used (elem);
return elem;
}
{
if (! comptypes (lhstype, TREE_TYPE (elem), 1))
elem = DECL_CHAIN (elem);
else
{
mark_used (elem);
return elem;
}
}
/* No exact match found, look for a compatible template. */
{

View File

@ -818,10 +818,12 @@ convert_to_aggr (type, expr, msgp, protect)
else if (msgp)
{
if (saw_private)
if (saw_protected)
*msgp = "only private and protected conversions apply";
else
*msgp = "only private conversions apply";
{
if (saw_protected)
*msgp = "only private and protected conversions apply";
else
*msgp = "only private conversions apply";
}
else if (saw_protected)
*msgp = "only protected conversions apply";
else

View File

@ -164,7 +164,7 @@ static tree obscure_complex_init PROTO((tree, tree));
static tree maybe_build_cleanup_1 PROTO((tree, tree));
static tree lookup_name_real PROTO((tree, int, int));
static void warn_extern_redeclared_static PROTO((tree, tree));
static void grok_reference_init PROTO((tree, tree, tree, tree *));
static void grok_reference_init PROTO((tree, tree, tree));
static tree grokfndecl PROTO((tree, tree, tree, tree, int,
enum overload_flags,
tree, tree, tree, int, int, int, int, int, int));
@ -4798,7 +4798,7 @@ record_builtin_type (rid_index, name, type)
tree type;
{
tree rname = NULL_TREE, tname = NULL_TREE;
tree tdecl;
tree tdecl = NULL_TREE;
if ((int) rid_index < (int) RID_MAX)
rname = ridpointers[(int) rid_index];
@ -4870,7 +4870,7 @@ init_decl_processing ()
tree temp;
tree array_domain_type;
extern int flag_strict_prototype;
tree vb_off_identifier;
tree vb_off_identifier = NULL_TREE;
/* Function type `char *(char *, char *)' and similar ones */
tree string_ftype_ptr_ptr, int_ftype_string_string;
tree sizetype_endlink;
@ -6299,9 +6299,8 @@ start_decl_1 (decl)
Quotes on semantics can be found in ARM 8.4.3. */
static void
grok_reference_init (decl, type, init, cleanupp)
grok_reference_init (decl, type, init)
tree decl, type, init;
tree *cleanupp;
{
tree tmp;
@ -6442,7 +6441,7 @@ cp_finish_decl (decl, init, asmspec_tree, need_pop, flags)
int flags;
{
register tree type;
tree cleanup = NULL_TREE, ttype;
tree cleanup = NULL_TREE, ttype = NULL_TREE;
int was_incomplete;
int temporary = allocation_temporary_p ();
char *asmspec = NULL;
@ -6569,7 +6568,7 @@ cp_finish_decl (decl, init, asmspec_tree, need_pop, flags)
make_decl_rtl (decl, NULL_PTR,
toplevel_bindings_p ()
|| pseudo_global_level_p ());
grok_reference_init (decl, type, init, &cleanup);
grok_reference_init (decl, type, init);
init = NULL_TREE;
}
@ -7976,7 +7975,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
}
if (! IDENTIFIER_OPNAME_P (dname)
/* GNU/Linux headers use '__op'. Arrgh. */
|| IDENTIFIER_TYPENAME_P (dname) && ! TREE_TYPE (dname))
|| (IDENTIFIER_TYPENAME_P (dname) && ! TREE_TYPE (dname)))
name = IDENTIFIER_POINTER (dname);
else
{
@ -9521,10 +9520,12 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
/* Note that the grammar rejects storage classes
in typenames, fields or parameters. */
if (constp || volatilep)
if (IS_SIGNATURE (type))
error ("`const' or `volatile' specified with signature type");
else
type = cp_build_type_variant (type, constp, volatilep);
{
if (IS_SIGNATURE (type))
error ("`const' or `volatile' specified with signature type");
else
type = cp_build_type_variant (type, constp, volatilep);
}
/* Special case: "friend class foo" looks like a TYPENAME context. */
if (friendp)
@ -10204,7 +10205,7 @@ grokparms (first_parm, funcdef_flag)
for (parm = first_parm; parm != NULL_TREE; parm = chain)
{
tree type, list_node = parm;
tree type = NULL_TREE, list_node = parm;
register tree decl = TREE_VALUE (parm);
tree init = TREE_PURPOSE (parm);
@ -10951,8 +10952,6 @@ xref_tag (code_type_node, name, binfo, globalize)
if (binfo)
xref_basetypes (code_type_node, name, ref, binfo);
just_return:
/* Until the type is defined, tentatively accept whatever
structure tag the user hands us. */
if (TYPE_SIZE (ref) == NULL_TREE
@ -11182,7 +11181,7 @@ tree
finish_enum (enumtype, values)
register tree enumtype, values;
{
register tree minnode, maxnode;
register tree minnode = NULL_TREE, maxnode = NULL_TREE;
/* Calculate the maximum value of any enumerator in this type. */
if (values)
@ -12328,7 +12327,7 @@ finish_function (lineno, call_poplevel, nested)
}
else if (DECL_CONSTRUCTOR_P (fndecl))
{
tree cond, thenclause;
tree cond = NULL_TREE, thenclause = NULL_TREE;
/* Allow constructor for a type to get a new instance of the object
using `build_new'. */
tree abstract_virtuals = CLASSTYPE_ABSTRACT_VIRTUALS (current_class_type);
@ -12816,7 +12815,7 @@ hack_incomplete_structures (type)
for (list = &current_binding_level->incomplete; *list; )
{
tree decl = TREE_VALUE (*list);
if (decl && TREE_TYPE (decl) == type
if ((decl && TREE_TYPE (decl) == type)
|| (TREE_TYPE (decl)
&& TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE
&& TREE_TYPE (TREE_TYPE (decl)) == type))

View File

@ -2399,7 +2399,10 @@ tree
coerce_delete_type (type)
tree type;
{
int e1 = 0, e2 = 0, e3 = 0;
int e1 = 0, e2 = 0;
#if 0
e3 = 0;
#endif
tree arg_types = TYPE_ARG_TYPES (type);
if (TREE_CODE (type) == METHOD_TYPE)

View File

@ -21,6 +21,9 @@ Boston, MA 02111-1307, USA. */
#include "config.h"
#include <stdio.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#include "tree.h"
#include "cp-tree.h"
#include "obstack.h"
@ -1221,7 +1224,7 @@ dump_expr (t, nop)
#else
{
unsigned char *p = (unsigned char *) &TREE_REAL_CST (t);
int i;
size_t i;
strcpy (digit_buffer, "0x");
for (i = 0; i < sizeof TREE_REAL_CST (t); i++)
sprintf (digit_buffer + 2 + 2*i, "%02x", *p++);
@ -1629,7 +1632,6 @@ dump_expr (t, nop)
/* fall through to ERROR_MARK... */
case ERROR_MARK:
error:
OB_PUTCP ("{error}");
break;
}

View File

@ -215,8 +215,6 @@ do_function_call (func, params, return_type)
void
init_exception_processing ()
{
tree d;
/* void vtype () */
tree vtype = build_function_type (void_type_node, void_list_node);
@ -972,7 +970,6 @@ void
expand_throw (exp)
tree exp;
{
rtx label;
tree fn;
static tree cleanup_type;

View File

@ -195,14 +195,16 @@ add_friends (type, name, friend_type)
while (friends && TREE_PURPOSE (friends) != friend_type)
friends = TREE_CHAIN (friends);
if (friends)
if (friend_type)
warning ("method `%s::%s' is already a friend of class",
TYPE_NAME_STRING (friend_type),
IDENTIFIER_POINTER (name));
else
warning ("function `%s' is already a friend of class `%s'",
IDENTIFIER_POINTER (name),
IDENTIFIER_POINTER (DECL_NAME (typedecl)));
{
if (friend_type)
warning ("method `%s::%s' is already a friend of class",
TYPE_NAME_STRING (friend_type),
IDENTIFIER_POINTER (name));
else
warning ("function `%s' is already a friend of class `%s'",
IDENTIFIER_POINTER (name),
IDENTIFIER_POINTER (DECL_NAME (typedecl)));
}
else
TREE_VALUE (list) = tree_cons (friend_type, NULL_TREE,
TREE_VALUE (list));

View File

@ -259,7 +259,7 @@ sort_member_init (t)
tree x, member, name, field;
tree init_list = NULL_TREE;
int last_pos = 0;
tree last_field;
tree last_field = NULL_TREE;
for (member = TYPE_FIELDS (t); member ; member = TREE_CHAIN (member))
{
@ -369,7 +369,7 @@ sort_base_init (t, rbase_ptr, vbase_ptr)
for (x = TREE_CHAIN (last); x; x = TREE_CHAIN (x))
{
tree basetype = TREE_PURPOSE (x);
tree binfo;
tree binfo = NULL_TREE;
if (basetype == NULL_TREE)
{
@ -925,7 +925,7 @@ expand_member_init (exp, name, init)
tree basetype = NULL_TREE, field;
tree parm;
tree rval, type;
tree rval = NULL_TREE, type;
if (exp == NULL_TREE)
return; /* complain about this later */
@ -1776,7 +1776,7 @@ build_member_call (type, name, parmlist)
if (method_name == constructor_name (type)
|| method_name == constructor_name_full (type))
return build_functional_cast (type, parmlist);
if (t = lookup_fnfields (basetype_path, method_name, 0))
if ((t = lookup_fnfields (basetype_path, method_name, 0)))
return build_method_call (decl,
TREE_CODE (name) == TEMPLATE_ID_EXPR
? name : method_name,
@ -1906,10 +1906,12 @@ build_offset_ref (type, name)
decl = current_class_ref;
if (constructor_name (BINFO_TYPE (basebinfo)) == name)
if (dtor)
name = dtor_identifier;
else
name = ctor_identifier;
{
if (dtor)
name = dtor_identifier;
else
name = ctor_identifier;
}
else
if (dtor)
my_friendly_abort (999);
@ -2250,7 +2252,7 @@ build_new (placement, decl, init, use_global_new)
int use_global_new;
{
tree type, rval;
tree nelts, t;
tree nelts = NULL_TREE, t;
int has_array = 0;
tree pending_sizes = NULL_TREE;
@ -2262,7 +2264,7 @@ build_new (placement, decl, init, use_global_new)
{
tree absdcl = TREE_VALUE (decl);
tree last_absdcl = NULL_TREE;
int old_immediate_size_expand;
int old_immediate_size_expand = 0;
if (current_function_decl
&& DECL_CONSTRUCTOR_P (current_function_decl))
@ -2434,8 +2436,8 @@ build_new_1 (exp)
{
tree placement, init, t;
tree type, true_type, size, rval;
tree nelts;
tree alloc_expr, alloc_node;
tree nelts = NULL_TREE;
tree alloc_expr, alloc_node = NULL_TREE;
int has_array = 0;
enum tree_code code = NEW_EXPR;
int use_cookie, nothrow, check_new;
@ -2806,9 +2808,6 @@ build_vec_delete_1 (base, maxindex, type, auto_delete_vec, auto_delete,
This is also the containing expression returned by this function. */
tree controller = NULL_TREE;
/* This is the BLOCK to record the symbol binding for debugging. */
tree block;
if (! IS_AGGR_TYPE (type) || ! TYPE_NEEDS_DESTRUCTOR (type))
{
loop = integer_zero_node;
@ -3049,6 +3048,7 @@ expand_vec_init (decl, base, maxindex, init, from_array)
iterator = get_temp_regvar (ptrdiff_type_node, maxindex);
init_by_default:
itype = NULL_TREE;
/* If initializing one array from another,
initialize element by element. */

View File

@ -62,7 +62,16 @@ extern double atof ();
#ifdef HAVE_STRING_H
#include <string.h>
#else
#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif
#endif
#ifdef NEED_DECLARATION_INDEX
extern char *index ();
#endif
#ifdef NEED_DECLARATION_RINDEX
extern char *rindex ();
#endif
@ -1675,8 +1684,6 @@ reinit_parse_for_expr (obstackp)
int starting_lineno = lineno;
char *starting_filename = input_filename;
int len;
int look_for_semicolon = 0;
int look_for_lbrac = 0;
int plev = 0;
if (nextchar != EOF)
@ -1936,7 +1943,7 @@ cons_up_default_function (type, full_name, kind)
{
extern tree void_list_node;
tree declspecs = NULL_TREE;
tree fn, args;
tree fn, args = NULL_TREE;
tree argtype;
int retref = 0;
tree name = constructor_name (full_name);
@ -2612,7 +2619,7 @@ readescape (ignore_ptr)
register int c = getch ();
register int code;
register unsigned count;
unsigned firstdig;
unsigned firstdig = 0;
int nonnull;
switch (c)
@ -3218,7 +3225,7 @@ real_yylex ()
{
register struct resword *ptr;
if (ptr = is_reserved_word (token_buffer, p - token_buffer))
if ((ptr = is_reserved_word (token_buffer, p - token_buffer)))
{
if (ptr->rid)
{

View File

@ -42,6 +42,12 @@ Boston, MA 02111-1307, USA. */
#ifdef HAVE_STRING_H
#include <string.h>
#else
#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif
#endif
#ifdef NEED_DECLARATION_INDEX
extern char *index ();
#endif

View File

@ -5192,21 +5192,23 @@ case 281:
if (TREE_CODE (yyval.ttype) == BIT_NOT_EXPR)
yyval.ttype = build_x_unary_op (BIT_NOT_EXPR, TREE_OPERAND (yyval.ttype, 0));
else if (TREE_CODE (yyval.ttype) != TEMPLATE_ID_EXPR)
if (processing_template_arg)
{
tree id;
arg_looking_for_template = processing_template_arg;
id = lookup_name (yyval.ttype, 0);
arg_looking_for_template = 0;
{
if (processing_template_arg)
{
tree id;
arg_looking_for_template = processing_template_arg;
id = lookup_name (yyval.ttype, 0);
arg_looking_for_template = 0;
if (!id || id == error_mark_node
|| (TREE_CODE (id) != TEMPLATE_DECL
&& TREE_CODE (id) != TEMPLATE_TEMPLATE_PARM))
id = do_identifier (yyval.ttype, 1);
yyval.ttype = id;
}
else
yyval.ttype = do_identifier (yyval.ttype, 1);
if (!id || id == error_mark_node
|| (TREE_CODE (id) != TEMPLATE_DECL
&& TREE_CODE (id) != TEMPLATE_TEMPLATE_PARM))
id = do_identifier (yyval.ttype, 1);
yyval.ttype = id;
}
else
yyval.ttype = do_identifier (yyval.ttype, 1);
}
;
break;}
case 284:
@ -5343,7 +5345,7 @@ case 295:
case 296:
#line 1511 "parse.y"
{
tree type;
tree type = NULL_TREE;
tree id = yyval.ttype;
/* This is a C cast in C++'s `functional' notation. */
@ -6178,7 +6180,6 @@ case 453:
#line 2307 "parse.y"
{
int semi;
tree id;
yyval.ttype = yyvsp[-4].ttype;
#if 0

View File

@ -1381,21 +1381,23 @@ primary:
if (TREE_CODE ($$) == BIT_NOT_EXPR)
$$ = build_x_unary_op (BIT_NOT_EXPR, TREE_OPERAND ($$, 0));
else if (TREE_CODE ($$) != TEMPLATE_ID_EXPR)
if (processing_template_arg)
{
tree id;
arg_looking_for_template = processing_template_arg;
id = lookup_name ($$, 0);
arg_looking_for_template = 0;
{
if (processing_template_arg)
{
tree id;
arg_looking_for_template = processing_template_arg;
id = lookup_name ($$, 0);
arg_looking_for_template = 0;
if (!id || id == error_mark_node
|| (TREE_CODE (id) != TEMPLATE_DECL
&& TREE_CODE (id) != TEMPLATE_TEMPLATE_PARM))
id = do_identifier ($$, 1);
$$ = id;
}
else
$$ = do_identifier ($$, 1);
if (!id || id == error_mark_node
|| (TREE_CODE (id) != TEMPLATE_DECL
&& TREE_CODE (id) != TEMPLATE_TEMPLATE_PARM))
id = do_identifier ($$, 1);
$$ = id;
}
else
$$ = do_identifier ($$, 1);
}
}
| CONSTANT
| boolean.literal
@ -1509,7 +1511,7 @@ primary:
}
| CV_QUALIFIER '(' nonnull_exprlist ')'
{
tree type;
tree type = NULL_TREE;
tree id = $$;
/* This is a C cast in C++'s `functional' notation. */
@ -2306,7 +2308,6 @@ structsp:
opt.component_decl_list '}' maybe_attribute
{
int semi;
tree id;
$<ttype>$ = $1;
#if 0

View File

@ -1742,31 +1742,33 @@ coerce_template_parms (parms, arglist, in_decl,
}
if (arglist && TREE_CODE (arglist) == TREE_VEC)
if (nargs == nparms)
vec = copy_node (arglist);
else
{
/* We arrive here when a template with some default arguments
is used as template template argument. */
is_tmpl_parm = 1;
vec = make_tree_vec (nparms);
for (i = 0; i < nparms; i++)
{
tree arg;
if (i < nargs)
{
if (nargs == nparms)
vec = copy_node (arglist);
else
{
/* We arrive here when a template with some default arguments
is used as template template argument. */
is_tmpl_parm = 1;
vec = make_tree_vec (nparms);
for (i = 0; i < nparms; i++)
{
tree arg;
if (i < nargs)
arg = TREE_VEC_ELT (arglist, i);
else if (TREE_CODE (TREE_VALUE (TREE_VEC_ELT (parms, i)))
== TYPE_DECL)
arg = tsubst (TREE_PURPOSE (TREE_VEC_ELT (parms, i)),
vec, i, in_decl);
else
arg = tsubst_expr (TREE_PURPOSE (TREE_VEC_ELT (parms, i)),
vec, i, in_decl);
TREE_VEC_ELT (vec, i) = arg;
}
}
else if (TREE_CODE (TREE_VALUE (TREE_VEC_ELT (parms, i)))
== TYPE_DECL)
arg = tsubst (TREE_PURPOSE (TREE_VEC_ELT (parms, i)),
vec, i, in_decl);
else
arg = tsubst_expr (TREE_PURPOSE (TREE_VEC_ELT (parms, i)),
vec, i, in_decl);
TREE_VEC_ELT (vec, i) = arg;
}
}
}
else
{
vec = make_tree_vec (nparms);
@ -2213,7 +2215,7 @@ lookup_template_class (d1, arglist, in_decl, context)
tree in_decl;
tree context;
{
tree template, parmlist;
tree template = NULL_TREE, parmlist;
char *mangled_name;
tree id, t;
@ -2819,14 +2821,13 @@ instantiate_class_template (type)
for (t = CLASSTYPE_TAGS (pattern); t; t = TREE_CHAIN (t))
{
tree name = TREE_PURPOSE (t);
tree tag = TREE_VALUE (t);
/* These will add themselves to CLASSTYPE_TAGS for the new type. */
if (TREE_CODE (tag) == ENUMERAL_TYPE)
{
tree e, newtag = tsubst_enum (tag, args,
TREE_VEC_LENGTH (args), field_chain);
tree newtag =
tsubst_enum (tag, args, TREE_VEC_LENGTH (args), field_chain);
while (*field_chain)
{
@ -3190,7 +3191,6 @@ tsubst (t, args, nargs, in_decl)
tree new_decl;
tree parms;
tree spec;
int i;
/* We might already have an instance of this template. */
spec = retrieve_specialization (t, args);
@ -3785,7 +3785,7 @@ tsubst (t, args, nargs, in_decl)
/* This should probably be rewritten to use hash_tree_cons for
the memory savings. */
tree first = NULL_TREE;
tree last;
tree last = NULL_TREE;
for (; values && values != void_list_node;
values = TREE_CHAIN (values))
@ -3934,7 +3934,7 @@ tree
do_poplevel ()
{
tree t;
int saved_warn_unused;
int saved_warn_unused = 0;
if (processing_template_decl)
{
@ -4652,7 +4652,6 @@ type_unification (tparms, targs, parms, args, targs_in, nsubsts,
{
int ntparms = TREE_VEC_LENGTH (tparms);
tree arg;
tree parm;
int i;
int r;
@ -4937,7 +4936,7 @@ unify (tparms, targs, ntparms, parm, arg, nsubsts, strict)
tree argvec = CLASSTYPE_TI_ARGS (arg);
tree argtmplvec
= DECL_INNERMOST_TEMPLATE_PARMS (CLASSTYPE_TI_TEMPLATE (arg));
int i, j;
int i;
/* The parameter and argument roles have to be switched here
in order to handle default arguments properly. For example,

View File

@ -336,7 +336,7 @@ init_repo (filename)
if (repo_file == 0)
return;
while (buf = afgets (repo_file))
while ((buf = afgets (repo_file)))
{
switch (buf[0])
{
@ -396,7 +396,6 @@ void
finish_repo ()
{
tree t;
char *p;
int repo_changed = 0;
char *dir, *args;

View File

@ -545,7 +545,7 @@ get_binfo (parent, binfo, protect)
register tree parent, binfo;
int protect;
{
tree type;
tree type = NULL_TREE;
int dist;
tree rval = NULL_TREE;
@ -716,7 +716,7 @@ get_base_distance (parent, binfo, protect, path_ptr)
{
int rval;
int rval_private = 0;
tree type;
tree type = NULL_TREE;
tree new_binfo = NULL_TREE;
int via_virtual;
int watch_access = protect;
@ -1154,8 +1154,8 @@ lookup_field (xbasetype, name, protect, want_type)
int protect, want_type;
{
int head = 0, tail = 0;
tree rval, rval_binfo = NULL_TREE, rval_binfo_h;
tree type, basetype_chain, basetype_path;
tree rval, rval_binfo = NULL_TREE, rval_binfo_h = NULL_TREE;
tree type = NULL_TREE, basetype_chain, basetype_path = NULL_TREE;
tree this_v = access_default_node;
tree entry, binfo, binfo_h;
tree own_access = access_default_node;
@ -1470,7 +1470,7 @@ lookup_field (xbasetype, name, protect, want_type)
/* If is possible for one of the derived types on the path to
have defined special access for this field. Look for such
declarations and report an error if a conflict is found. */
tree new_v;
tree new_v = NULL_TREE;
if (this_v != access_default_node)
new_v = compute_access (TREE_VALUE (TREE_CHAIN (*tp)), rval);
@ -1689,8 +1689,8 @@ lookup_fnfields (basetype_path, name, complain)
int complain;
{
int head = 0, tail = 0;
tree type, rval, rval_binfo = NULL_TREE, rvals = NULL_TREE, rval_binfo_h;
tree entry, binfo, basetype_chain, binfo_h;
tree type, rval, rval_binfo = NULL_TREE, rvals = NULL_TREE;
tree rval_binfo_h = NULL_TREE, entry, binfo, basetype_chain, binfo_h;
int find_all = 0;
/* rval_binfo is the binfo associated with the found member, note,
@ -2034,7 +2034,7 @@ breadth_first_search (binfo, testfn, qfn)
binfo = search_stack->first[head++];
i = (HOST_WIDE_INT) search_stack->first[head++];
if (rval = (*testfn) (binfo, i))
if ((rval = (*testfn) (binfo, i)))
break;
binfo = BINFO_BASETYPE (binfo, i);
}
@ -3768,7 +3768,7 @@ tree
get_template_base (template, binfo)
register tree template, binfo;
{
tree type, rval;
tree type = NULL_TREE, rval;
if (TREE_CODE (binfo) == TREE_VEC)
type = BINFO_TYPE (binfo);

View File

@ -350,7 +350,7 @@ append_signature_fields (list_of_fieldlists)
tree l, x;
tree last_x = NULL_TREE;
tree mfptr;
tree last_mfptr;
tree last_mfptr = NULL_TREE;
tree mfptr_list = NULL_TREE;
/* For signatures it should actually be only a list with one element. */
@ -461,7 +461,7 @@ build_signature_table_constructor (sig_ty, rhs)
tree sig_field = TYPE_FIELDS (sig_ty);
tree result = NULL_TREE;
tree first_rhs_field = NULL_TREE;
tree last_rhs_field;
tree last_rhs_field = NULL_TREE;
int sig_ptr_p = IS_SIGNATURE (rhstype);
int offset_p = sig_ptr_p;
@ -574,7 +574,7 @@ build_signature_table_constructor (sig_ty, rhs)
}
else
{
tree tag, vb_off, delta, idx, pfn, vt_off;
tree tag, vb_off, delta, idx, pfn = NULL_TREE, vt_off = NULL_TREE;
tree tag_decl, vb_off_decl, delta_decl, index_decl;
tree pfn_decl, vt_off_decl;
@ -724,7 +724,7 @@ build_sigtable (sig_type, rhs_type, init_from)
}
if (decl == NULL_TREE)
{
tree init;
tree init = NULL_TREE;
/* We allow only one signature table to be generated for signatures
with opaque types. Otherwise we create a loophole in the type

View File

@ -323,7 +323,7 @@ tree
break_out_calls (exp)
tree exp;
{
register tree t1, t2;
register tree t1, t2 = NULL_TREE;
register enum tree_code code;
register int changed = 0;
register int i;
@ -574,7 +574,7 @@ propagate_binfo_offsets (binfo, offset)
{
int j;
tree base_binfos = BINFO_BASETYPES (base_binfo);
tree delta;
tree delta = NULL_TREE;
for (j = i+1; j < n_baselinks; j++)
if (! TREE_VIA_VIRTUAL (TREE_VEC_ELT (binfos, j)))
@ -1046,7 +1046,7 @@ hash_tree_cons (via_public, via_virtual, via_protected, purpose, value, chain)
{
struct obstack *ambient_obstack = current_obstack;
tree t;
int hashcode;
int hashcode = 0;
if (! debug_no_list_hash)
{
@ -1928,7 +1928,7 @@ can_free (obstack, t)
struct obstack *obstack;
tree t;
{
int size;
int size = 0;
if (TREE_CODE (t) == TREE_VEC)
size = (TREE_VEC_LENGTH (t)-1) * sizeof (tree) + sizeof (struct tree_vec);
@ -1997,10 +1997,12 @@ cp_tree_equal (t1, t2)
code2 = TREE_CODE (t2);
if (code1 == NOP_EXPR || code1 == CONVERT_EXPR || code1 == NON_LVALUE_EXPR)
if (code2 == NOP_EXPR || code2 == CONVERT_EXPR || code2 == NON_LVALUE_EXPR)
return cp_tree_equal (TREE_OPERAND (t1, 0), TREE_OPERAND (t2, 0));
else
return cp_tree_equal (TREE_OPERAND (t1, 0), t2);
{
if (code2 == NOP_EXPR || code2 == CONVERT_EXPR || code2 == NON_LVALUE_EXPR)
return cp_tree_equal (TREE_OPERAND (t1, 0), TREE_OPERAND (t2, 0));
else
return cp_tree_equal (TREE_OPERAND (t1, 0), t2);
}
else if (code2 == NOP_EXPR || code2 == CONVERT_EXPR
|| code2 == NON_LVALUE_EXPR)
return cp_tree_equal (t1, TREE_OPERAND (t2, 0));

View File

@ -56,7 +56,9 @@ static int comp_array_types PROTO((int (*) (tree, tree, int), tree,
tree, int));
static tree build_ptrmemfunc1 PROTO((tree, tree, tree, tree, tree));
static tree common_base_type PROTO((tree, tree));
#if 0
static tree convert_sequence PROTO((tree, tree));
#endif
static tree lookup_anon_field PROTO((tree, tree));
static tree pointer_diff PROTO((tree, tree, tree));
static tree qualify_type PROTO((tree, tree));
@ -327,25 +329,27 @@ common_type (t1, t2)
/* One that completely contains the other? Take it. */
else if (a2 && !attribute_list_contained (a1, a2))
if (attribute_list_contained (a2, a1))
{
if (attribute_list_contained (a2, a1))
attributes = a2;
else
{
/* Pick the longest list, and hang on the other list. */
/* ??? For the moment we punt on the issue of attrs with args. */
else
{
/* Pick the longest list, and hang on the other list. */
/* ??? For the moment we punt on the issue of attrs with args. */
if (list_length (a1) < list_length (a2))
attributes = a2, a2 = a1;
if (list_length (a1) < list_length (a2))
attributes = a2, a2 = a1;
for (; a2; a2 = TREE_CHAIN (a2))
if (lookup_attribute (IDENTIFIER_POINTER (TREE_PURPOSE (a2)),
attributes) == NULL_TREE)
{
a1 = copy_node (a2);
TREE_CHAIN (a1) = attributes;
attributes = a1;
}
}
for (; a2; a2 = TREE_CHAIN (a2))
if (lookup_attribute (IDENTIFIER_POINTER (TREE_PURPOSE (a2)),
attributes) == NULL_TREE)
{
a1 = copy_node (a2);
TREE_CHAIN (a1) = attributes;
attributes = a1;
}
}
}
}
/* Treat an enum type as the unsigned integer type of the same width. */
@ -966,21 +970,22 @@ comp_target_types (ttl, ttr, nptrs)
if (TREE_CODE (ttr) == ARRAY_TYPE)
return comp_array_types (comp_target_types, ttl, ttr, 0);
else if (TREE_CODE (ttr) == FUNCTION_TYPE || TREE_CODE (ttr) == METHOD_TYPE)
if (comp_target_types (TREE_TYPE (ttl), TREE_TYPE (ttr), -1))
switch (comp_target_parms (TYPE_ARG_TYPES (ttl), TYPE_ARG_TYPES (ttr), 1))
{
case 0:
return 0;
case 1:
return 1;
case 2:
return -1;
default:
my_friendly_abort (112);
}
else
return 0;
{
if (comp_target_types (TREE_TYPE (ttl), TREE_TYPE (ttr), -1))
switch (comp_target_parms (TYPE_ARG_TYPES (ttl), TYPE_ARG_TYPES (ttr), 1))
{
case 0:
return 0;
case 1:
return 1;
case 2:
return -1;
default:
my_friendly_abort (112);
}
else
return 0;
}
/* for C++ */
else if (TREE_CODE (ttr) == OFFSET_TYPE)
{
@ -2521,7 +2526,7 @@ build_x_function_call (function, params, decl)
if (is_method)
{
tree fntype = TREE_TYPE (function);
tree ctypeptr;
tree ctypeptr = NULL_TREE;
/* Explicitly named method? */
if (TREE_CODE (function) == FUNCTION_DECL)
@ -2746,10 +2751,12 @@ build_function_call_real (function, params, require_complete, flags)
params, fndecl, 0);
if (coerced_params == error_mark_node)
if (flags & LOOKUP_SPECULATIVELY)
return NULL_TREE;
else
return error_mark_node;
{
if (flags & LOOKUP_SPECULATIVELY)
return NULL_TREE;
else
return error_mark_node;
}
/* Check for errors in format strings. */
@ -2831,7 +2838,7 @@ convert_arguments (return_loc, typelist, values, fndecl, flags)
{
register tree typetail, valtail;
register tree result = NULL_TREE;
char *called_thing;
char *called_thing = 0;
int i = 0;
if (! flag_elide_constructors)
@ -7048,7 +7055,7 @@ convert_for_initialization (exp, type, rhs, flags, errtype, fndecl, parmnum)
{
/* This should eventually happen in convert_arguments. */
extern int warningcount, errorcount;
int savew, savee;
int savew = 0, savee = 0;
if (fndecl)
savew = warningcount, savee = errorcount;

View File

@ -208,7 +208,7 @@ incomplete_type_error (value, type)
tree value;
tree type;
{
char *errmsg;
char *errmsg = 0;
/* Avoid duplicate error message. */
if (TREE_CODE (type) == ERROR_MARK)
@ -685,7 +685,7 @@ digest_init (type, init, tail)
{
enum tree_code code = TREE_CODE (type);
tree element = NULL_TREE;
tree old_tail_contents;
tree old_tail_contents = NULL_TREE;
/* Nonzero if INIT is a braced grouping, which comes in as a CONSTRUCTOR
tree node which has no TREE_TYPE. */
int raw_constructor;
@ -1265,7 +1265,7 @@ build_x_arrow (datum)
tree types_memoized = NULL_TREE;
register tree rval = datum;
tree type = TREE_TYPE (rval);
tree last_rval;
tree last_rval = NULL_TREE;
if (type == error_mark_node)
return error_mark_node;

View File

@ -337,7 +337,7 @@ GNU_xref_decl (fndecl,decl)
tree decl;
{
XREF_FILE xf,xf1;
char *cls;
char *cls = 0;
char *name;
char buf[10240];
int uselin;