From 6a44e72ebbef5694c92fee4508de9e16d424e31b Mon Sep 17 00:00:00 2001 From: ghazi Date: Fri, 25 Sep 1998 09:00:04 +0000 Subject: [PATCH] Warning fixes: * cp-tree.h (define_case_label): Remove unused parameter. (check_java_method): Likewise. (grokclassfn): Likewise. (expand_aggr_init): Likewise. (build_x_delete): Likewise. (maybe_end_member_template_processing): Likewise. (unshare_base_binfos): Add prototype. (string_conv_p): Likewise. (my_friendly_abort): Mark with ATTRIBUTE_NORETURN. * cvt.c (build_up_reference): Remove unused parameter `checkconst', all callers changed. (build_type_conversion): Mark parameter `code' with ATTRIBUTE_UNUSED. (build_expr_type_conversion): Initialize variable `conv'. * decl.c (push_namespace): Initialize variable `d'. (define_case_label): Remove unused parameter `decl', all callers changed. * decl2.c (lang_decode_option): If !USE_CPPLIB, mark parameter `argc' with ATTRIBUTE_UNUSED. (grokclassfn): Remove unused parameter `cname', all callers changed. (check_java_method): Likewise for parameter `ctype'. (copy_assignment_arg_p): Mark parameter `virtualp' with ATTRIBUTE_UNUSED. (finish_prevtable_vardecl): Likewise for parameter `prev'. * expr.c (extract_init): Likewise for parameters `decl' and `init'. * init.c (expand_aggr_init_1): Remove unused parameter `alias_this', all callers changed. (expand_aggr_init): Likewise. (expand_default_init): Likewise. (build_new_1): Initialize variable `susp'. (build_x_delete): Remove unused parameter `type', all callers changed. * lex.c (set_typedecl_interface_info): Mark parameter `prev' with ATTRIBUTE_UNUSED. (readescape): Use (unsigned) value in shift. (real_yylex): Likewise. Likewise. Also cast `sizeof' to int when comparing to a signed quantity. * pt.c (maybe_end_member_template_processing): Remove unused parameter `decl', all callers changed. (check_explicit_specialization): Add braces around empty body in an else-statement. (current_template_args): Initialize variable `args'. (lookup_template_class): Likewise for variable `prev_local_enum'. (tsubst_decl): Likewise for variable `r'. (set_mangled_name_for_template_decl): Initialize variable `context'. * spew.c (scan_tokens): Change type of parameter `n' to unsigned. Likewise for variable `i'. (yylex): Initialize variable `trrr'. * typeck.c (compparms): Mark variable `strict' with ATTRIBUTE_UNUSED. * xref.c (simplify_type): Cast argument of ctype function to `unsigned char'. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@22587 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ gcc/cp/cp-tree.h | 17 ++++++++------ gcc/cp/cvt.c | 15 ++++++------- gcc/cp/decl.c | 17 +++++++------- gcc/cp/decl2.c | 20 ++++++++++------- gcc/cp/expr.c | 9 +++----- gcc/cp/friend.c | 2 +- gcc/cp/init.c | 41 +++++++++++++++------------------- gcc/cp/lex.c | 15 +++++++------ gcc/cp/pt.c | 31 +++++++++++++------------- gcc/cp/spew.c | 8 +++---- gcc/cp/typeck.c | 2 +- gcc/cp/xref.c | 2 +- 13 files changed, 156 insertions(+), 90 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 548bed8dd71..a2cb2fc636e 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,70 @@ +Fri Sep 25 11:45:38 1998 Kaveh R. Ghazi + + * cp-tree.h (define_case_label): Remove unused parameter. + (check_java_method): Likewise. + (grokclassfn): Likewise. + (expand_aggr_init): Likewise. + (build_x_delete): Likewise. + (maybe_end_member_template_processing): Likewise. + (unshare_base_binfos): Add prototype. + (string_conv_p): Likewise. + (my_friendly_abort): Mark with ATTRIBUTE_NORETURN. + + * cvt.c (build_up_reference): Remove unused parameter + `checkconst', all callers changed. + (build_type_conversion): Mark parameter `code' with + ATTRIBUTE_UNUSED. + (build_expr_type_conversion): Initialize variable `conv'. + + * decl.c (push_namespace): Initialize variable `d'. + (define_case_label): Remove unused parameter `decl', all callers + changed. + + * decl2.c (lang_decode_option): If !USE_CPPLIB, mark parameter + `argc' with ATTRIBUTE_UNUSED. + (grokclassfn): Remove unused parameter `cname', all callers + changed. + (check_java_method): Likewise for parameter `ctype'. + (copy_assignment_arg_p): Mark parameter `virtualp' with + ATTRIBUTE_UNUSED. + (finish_prevtable_vardecl): Likewise for parameter `prev'. + + * expr.c (extract_init): Likewise for parameters `decl' and `init'. + + * init.c (expand_aggr_init_1): Remove unused parameter + `alias_this', all callers changed. + (expand_aggr_init): Likewise. + (expand_default_init): Likewise. + (build_new_1): Initialize variable `susp'. + (build_x_delete): Remove unused parameter `type', all callers + changed. + + * lex.c (set_typedecl_interface_info): Mark parameter `prev' with + ATTRIBUTE_UNUSED. + (readescape): Use (unsigned) value in shift. + (real_yylex): Likewise. Likewise. Also cast `sizeof' to int when + comparing to a signed quantity. + + * pt.c (maybe_end_member_template_processing): Remove unused + parameter `decl', all callers changed. + (check_explicit_specialization): Add braces around empty body in + an else-statement. + (current_template_args): Initialize variable `args'. + (lookup_template_class): Likewise for variable `prev_local_enum'. + (tsubst_decl): Likewise for variable `r'. + (set_mangled_name_for_template_decl): Initialize variable + `context'. + + * spew.c (scan_tokens): Change type of parameter `n' to unsigned. + Likewise for variable `i'. + (yylex): Initialize variable `trrr'. + + * typeck.c (compparms): Mark variable `strict' with + ATTRIBUTE_UNUSED. + + * xref.c (simplify_type): Cast argument of ctype function to + `unsigned char'. + 1998-09-24 Mark Mitchell * cp-tree.h (language_lvalue_valid): Remove. diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index d77bb82c381..8d1247e7192 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -2496,7 +2496,7 @@ extern tree shadow_label PROTO((tree)); extern tree define_label PROTO((char *, int, tree)); extern void push_switch PROTO((void)); extern void pop_switch PROTO((void)); -extern void define_case_label PROTO((tree)); +extern void define_case_label PROTO((void)); extern tree getdecls PROTO((void)); extern tree gettags PROTO((void)); #if 0 @@ -2567,14 +2567,14 @@ extern void revert_static_member_fn PROTO((tree*, tree*, tree*)); extern void cat_namespace_levels PROTO((void)); /* in decl2.c */ -extern int check_java_method PROTO((tree, tree)); +extern int check_java_method PROTO((tree)); extern int lang_decode_option PROTO((int, char **)); extern tree grok_method_quals PROTO((tree, tree, tree)); extern void warn_if_unknown_interface PROTO((tree)); extern tree grok_x_components PROTO((tree, tree)); extern void maybe_retrofit_in_chrg PROTO((tree)); extern void maybe_make_one_only PROTO((tree)); -extern void grokclassfn PROTO((tree, tree, tree, enum overload_flags, tree)); +extern void grokclassfn PROTO((tree, tree, enum overload_flags, tree)); extern tree grok_alignof PROTO((tree)); extern tree grok_array_decl PROTO((tree, tree)); extern tree delete_sanity PROTO((tree, tree, int, int)); @@ -2687,7 +2687,7 @@ extern void expand_direct_vtbls_init PROTO((tree, tree, int, int, tree)); extern void emit_base_init PROTO((tree, int)); extern void check_base_init PROTO((tree)); extern void expand_member_init PROTO((tree, tree, tree)); -extern void expand_aggr_init PROTO((tree, tree, int, int)); +extern void expand_aggr_init PROTO((tree, tree, int)); extern int is_aggr_typedef PROTO((tree, int)); extern int is_aggr_type PROTO((tree, int)); extern tree get_aggr_from_typedef PROTO((tree, int)); @@ -2699,7 +2699,7 @@ extern tree decl_constant_value PROTO((tree)); extern tree build_new PROTO((tree, tree, tree, int)); extern tree build_new_1 PROTO((tree)); extern tree expand_vec_init PROTO((tree, tree, tree, tree, int)); -extern tree build_x_delete PROTO((tree, tree, int, tree)); +extern tree build_x_delete PROTO((tree, int, tree)); extern tree build_delete PROTO((tree, tree, tree, int, int)); extern tree build_vbase_delete PROTO((tree, tree)); extern tree build_vec_delete PROTO((tree, tree, tree, tree, int)); @@ -2782,7 +2782,7 @@ extern tree tsubst_expr PROTO ((tree, tree, tree)); extern tree tsubst_copy PROTO ((tree, tree, tree)); extern tree tsubst_chain PROTO((tree, tree)); extern void maybe_begin_member_template_processing PROTO((tree)); -extern void maybe_end_member_template_processing PROTO((tree)); +extern void maybe_end_member_template_processing PROTO((void)); extern tree finish_member_template_decl PROTO((tree, tree)); extern void begin_template_parm_list PROTO((void)); extern void begin_specialization PROTO((void)); @@ -2967,6 +2967,7 @@ extern int yylex PROTO((void)); extern tree arbitrate_lookup PROTO((tree, tree, tree)); /* in tree.c */ +extern void unshare_base_binfos PROTO((tree)); extern int member_p PROTO((tree)); extern int real_lvalue_p PROTO((tree)); extern tree build_min PVPROTO((enum tree_code, tree, ...)); @@ -3041,6 +3042,7 @@ extern void push_expression_obstack PROTO((void)); hash_tree_cons (0, 0, 0, (PURPOSE), (VALUE), (CHAIN)) /* in typeck.c */ +extern int string_conv_p PROTO((tree, tree, int)); extern tree condition_conversion PROTO((tree)); extern tree target_type PROTO((tree)); extern tree require_complete_type PROTO((tree)); @@ -3117,7 +3119,8 @@ extern void readonly_error PROTO((tree, char *, int)); extern void abstract_virtuals_error PROTO((tree, tree)); extern void signature_error PROTO((tree, tree)); extern void incomplete_type_error PROTO((tree, tree)); -extern void my_friendly_abort PROTO((int)); +extern void my_friendly_abort PROTO((int)) + ATTRIBUTE_NORETURN; extern void my_friendly_assert PROTO((int, int)); extern tree store_init_value PROTO((tree, tree)); extern tree digest_init PROTO((tree, tree, tree *)); diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c index edb2d5b22ad..c76b743dc25 100644 --- a/gcc/cp/cvt.c +++ b/gcc/cp/cvt.c @@ -36,7 +36,7 @@ extern tree static_aggregates; static tree cp_convert_to_pointer PROTO((tree, tree)); static tree convert_to_pointer_force PROTO((tree, tree)); -static tree build_up_reference PROTO((tree, tree, int, int)); +static tree build_up_reference PROTO((tree, tree, int)); /* Change of width--truncation and extension of integers or reals-- is represented with NOP_EXPR. Proper functioning of many things @@ -343,9 +343,9 @@ convert_to_pointer_force (type, expr) DIRECT_BIND in FLAGS controls how any temporaries are generated. */ static tree -build_up_reference (type, arg, flags, checkconst) +build_up_reference (type, arg, flags) tree type, arg; - int flags, checkconst; + int flags; { tree rval; tree argtype = TREE_TYPE (arg); @@ -471,8 +471,7 @@ convert_to_reference (reftype, expr, convtype, flags, decl) } } - return build_up_reference (reftype, expr, flags, - ! (convtype & CONV_CONST)); + return build_up_reference (reftype, expr, flags); } else if ((convtype & CONV_REINTERPRET) && lvalue_p (expr)) { @@ -501,7 +500,7 @@ convert_to_reference (reftype, expr, convtype, flags, decl) "converting", 0, 0); if (rval == error_mark_node) return error_mark_node; - rval = build_up_reference (reftype, rval, flags, 1); + rval = build_up_reference (reftype, rval, flags); if (rval && ! TYPE_READONLY (TREE_TYPE (reftype))) cp_pedwarn ("initializing non-const `%T' with `%T' will use a temporary", @@ -920,7 +919,7 @@ convert_force (type, expr, convtype) tree build_type_conversion (code, xtype, expr, for_sure) - enum tree_code code; + enum tree_code code ATTRIBUTE_UNUSED; tree xtype, expr; int for_sure; { @@ -942,7 +941,7 @@ build_expr_type_conversion (desires, expr, complain) int complain; { tree basetype = TREE_TYPE (expr); - tree conv; + tree conv = NULL_TREE; tree winner = NULL_TREE; if (expr == null_node diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 87a391f0350..48d25d94be9 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -1773,7 +1773,7 @@ void push_namespace (name) tree name; { - tree d; + tree d = NULL_TREE; int need_new = 1; int implicit_use = 0; int global = 0; @@ -4409,8 +4409,7 @@ pop_switch () /* XXX Note decl is never actually used. (bpk) */ void -define_case_label (decl) - tree decl; +define_case_label () { tree cleanup = last_cleanup_this_contour (); struct binding_level *b = current_binding_level; @@ -7537,7 +7536,7 @@ cp_finish_decl (decl, init, asmspec_tree, need_pop, flags) { emit_line_note (DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl)); - expand_aggr_init (decl, init, 0, flags); + expand_aggr_init (decl, init, flags); } /* Set this to 0 so we can tell whether an aggregate which @@ -7668,7 +7667,7 @@ expand_static_init (decl, init) if (TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (decl)) || (init && TREE_CODE (init) == TREE_LIST)) { - expand_aggr_init (decl, init, 0, 0); + expand_aggr_init (decl, init, 0); do_pending_stack_adjust (); } else if (init) @@ -8026,7 +8025,7 @@ grokfndecl (ctype, type, declarator, orig_declarator, virtualp, flags, quals, the following calls is supposed to do. */ DECL_CONSTRUCTOR_P (decl) = 1; - grokclassfn (ctype, declarator, decl, flags, quals); + grokclassfn (ctype, decl, flags, quals); decl = check_explicit_specialization (orig_declarator, decl, template_count, @@ -8035,7 +8034,7 @@ grokfndecl (ctype, type, declarator, orig_declarator, virtualp, flags, quals, if (decl == error_mark_node) return error_mark_node; - if ((! TYPE_FOR_JAVA (ctype) || check_java_method (ctype, decl)) + if ((! TYPE_FOR_JAVA (ctype) || check_java_method (decl)) && check) { tmp = check_classfn (ctype, decl); @@ -8075,7 +8074,7 @@ grokfndecl (ctype, type, declarator, orig_declarator, virtualp, flags, quals, This call may change the type of the function (because of default parameters)! */ if (ctype != NULL_TREE) - grokclassfn (ctype, cname, decl, flags, quals); + grokclassfn (ctype, decl, flags, quals); decl = check_explicit_specialization (orig_declarator, decl, template_count, @@ -8085,7 +8084,7 @@ grokfndecl (ctype, type, declarator, orig_declarator, virtualp, flags, quals, return error_mark_node; if (ctype != NULL_TREE - && (! TYPE_FOR_JAVA (ctype) || check_java_method (ctype, decl)) + && (! TYPE_FOR_JAVA (ctype) || check_java_method (decl)) && check) { tmp = check_classfn (ctype, decl); diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 9d9e7ad623e..76abe6801b4 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -496,7 +496,11 @@ static struct { char *string; int *variable; int on_value;} lang_f_options[] = int lang_decode_option (argc, argv) - int argc; + int argc +#if !USE_CPPLIB + ATTRIBUTE_UNUSED +#endif + ; char **argv; { @@ -1040,8 +1044,8 @@ maybe_retrofit_in_chrg (fn) QUALS are the qualifiers for the this pointer. */ void -grokclassfn (ctype, cname, function, flags, quals) - tree ctype, cname, function; +grokclassfn (ctype, function, flags, quals) + tree ctype, function; enum overload_flags flags; tree quals; { @@ -1395,8 +1399,8 @@ acceptable_java_type (type) Otherwise, print appropriate error messages, and return 0. */ int -check_java_method (ctype, method) - tree ctype, method; +check_java_method (method) + tree method; { int jerr = 0; tree arg_types = TYPE_ARG_TYPES (TREE_TYPE (method)); @@ -1937,7 +1941,7 @@ grokoptypename (declspecs, declarator) int copy_assignment_arg_p (parmtype, virtualp) tree parmtype; - int virtualp; + int virtualp ATTRIBUTE_UNUSED; { if (current_class_type == NULL_TREE) return 0; @@ -2656,7 +2660,7 @@ import_export_class (ctype) int finish_prevtable_vardecl (prev, vars) - tree prev, vars; + tree prev ATTRIBUTE_UNUSED, vars; { tree ctype = DECL_CONTEXT (vars); import_export_class (ctype); @@ -3292,7 +3296,7 @@ do_ctors (start) if (IS_AGGR_TYPE (TREE_TYPE (decl)) || TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE) - expand_aggr_init (decl, init, 0, 0); + expand_aggr_init (decl, init, 0); else if (TREE_CODE (init) == TREE_VEC) { expand_expr (expand_vec_init (decl, TREE_VEC_ELT (init, 0), diff --git a/gcc/cp/expr.c b/gcc/cp/expr.c index 4c3d8b602ce..ae8a374f86a 100644 --- a/gcc/cp/expr.c +++ b/gcc/cp/expr.c @@ -148,7 +148,7 @@ cplus_expand_expr (exp, target, tmode, modifier) init = convert_from_reference (init); flag_access_control = 0; - expand_aggr_init (slot, init, 0, LOOKUP_ONLYCONVERTING); + expand_aggr_init (slot, init, LOOKUP_ONLYCONVERTING); flag_access_control = old_ac; if (TYPE_NEEDS_DESTRUCTOR (type)) @@ -304,7 +304,7 @@ extract_scalar_init (decl, init) int extract_init (decl, init) - tree decl, init; + tree decl ATTRIBUTE_UNUSED, init ATTRIBUTE_UNUSED; { return 0; @@ -405,8 +405,5 @@ do_case (start, end) cp_error ("case label `%E' within scope of cleanup or variable array", start); } } - if (start) - define_case_label (label); - else - define_case_label (NULL_TREE); + define_case_label (); } diff --git a/gcc/cp/friend.c b/gcc/cp/friend.c index 89c79282d32..91c3d34acc5 100644 --- a/gcc/cp/friend.c +++ b/gcc/cp/friend.c @@ -367,7 +367,7 @@ do_friend (ctype, declarator, decl, parmdecls, flags, quals, funcdef_flag) DECL_CONSTRUCTOR_P (decl) = 1; /* This will set up DECL_ARGUMENTS for us. */ - grokclassfn (ctype, cname, decl, flags, quals); + grokclassfn (ctype, decl, flags, quals); if (is_friend_template) decl = DECL_TI_TEMPLATE (push_template_decl (decl)); diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 0c15675c736..c5ba2c4d233 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -47,10 +47,8 @@ tree current_base_init_list, current_member_init_list; static void expand_aggr_vbase_init_1 PROTO((tree, tree, tree, tree)); static void expand_aggr_vbase_init PROTO((tree, tree, tree, tree)); -static void expand_aggr_init_1 PROTO((tree, tree, tree, tree, int, - int)); -static void expand_default_init PROTO((tree, tree, tree, tree, int, - int)); +static void expand_aggr_init_1 PROTO((tree, tree, tree, tree, int)); +static void expand_default_init PROTO((tree, tree, tree, tree, int)); static tree build_vec_delete_1 PROTO((tree, tree, tree, tree, tree, int)); static void perform_member_init PROTO((tree, tree, tree, int)); @@ -177,7 +175,7 @@ perform_member_init (member, name, init, explicit) array_type_nelts (type), TREE_VALUE (init), 1); } else - expand_aggr_init (decl, init, 0, 0); + expand_aggr_init (decl, init, 0); } else { @@ -589,7 +587,7 @@ emit_base_init (t, immediately) member = convert_pointer_to_real (base_binfo, current_class_ptr); expand_aggr_init_1 (base_binfo, NULL_TREE, build_indirect_ref (member, NULL_PTR), init, - BINFO_OFFSET_ZEROP (base_binfo), LOOKUP_NORMAL); + LOOKUP_NORMAL); expand_end_target_temps (); free_temp_slots (); @@ -784,7 +782,7 @@ expand_aggr_vbase_init_1 (binfo, exp, addr, init_list) if (init) init = TREE_VALUE (init); /* Call constructors, but don't set up vtables. */ - expand_aggr_init_1 (binfo, exp, ref, init, 0, LOOKUP_COMPLAIN); + expand_aggr_init_1 (binfo, exp, ref, init, LOOKUP_COMPLAIN); expand_end_target_temps (); free_temp_slots (); @@ -1037,9 +1035,8 @@ expand_member_init (exp, name, init) perform the initialization, but not both, as it would be ambiguous. */ void -expand_aggr_init (exp, init, alias_this, flags) +expand_aggr_init (exp, init, flags) tree exp, init; - int alias_this; int flags; { tree type = TREE_TYPE (exp); @@ -1108,18 +1105,17 @@ expand_aggr_init (exp, init, alias_this, flags) TREE_TYPE (exp) = TYPE_MAIN_VARIANT (type); expand_aggr_init_1 (TYPE_BINFO (type), exp, exp, - init, alias_this, LOOKUP_NORMAL|flags); + init, LOOKUP_NORMAL|flags); TREE_TYPE (exp) = type; TREE_READONLY (exp) = was_const; TREE_THIS_VOLATILE (exp) = was_volatile; } static void -expand_default_init (binfo, true_exp, exp, init, alias_this, flags) +expand_default_init (binfo, true_exp, exp, init, flags) tree binfo; tree true_exp, exp; tree init; - int alias_this; int flags; { tree type = TREE_TYPE (exp); @@ -1212,11 +1208,10 @@ expand_default_init (binfo, true_exp, exp, init, alias_this, flags) its description. */ static void -expand_aggr_init_1 (binfo, true_exp, exp, init, alias_this, flags) +expand_aggr_init_1 (binfo, true_exp, exp, init, flags) tree binfo; tree true_exp, exp; tree init; - int alias_this; int flags; { tree type = TREE_TYPE (exp); @@ -1247,7 +1242,7 @@ expand_aggr_init_1 (binfo, true_exp, exp, init, alias_this, flags) /* We know that expand_default_init can handle everything we want at this point. */ - expand_default_init (binfo, true_exp, exp, init, alias_this, flags); + expand_default_init (binfo, true_exp, exp, init, flags); } /* Report an error if NAME is not the name of a user-defined, @@ -2311,7 +2306,7 @@ build_new_1 (exp) } else { - int susp; + int susp = 0; if (flag_exceptions) /* We will use RVAL when generating an exception handler for @@ -2622,7 +2617,7 @@ build_vec_delete_1 (base, maxindex, type, auto_delete_vec, auto_delete, /* This is the real size */ virtual_size = size_binop (PLUS_EXPR, virtual_size, BI_header_size); body = build_expr_list (NULL_TREE, - build_x_delete (ptype, base_tbd, + build_x_delete (base_tbd, 2 | use_global_delete, virtual_size)); body = build (COND_EXPR, void_type_node, @@ -2679,7 +2674,7 @@ build_vec_delete_1 (base, maxindex, type, auto_delete_vec, auto_delete, /* True size with header. */ virtual_size = size_binop (PLUS_EXPR, virtual_size, BI_header_size); } - deallocate_expr = build_x_delete (ptype, base_tbd, + deallocate_expr = build_x_delete (base_tbd, 2 | use_global_delete, virtual_size); if (auto_delete_vec != integer_one_node) @@ -2793,7 +2788,7 @@ expand_vec_init (decl, base, maxindex, init, from_array) while (elts) { host_i -= 1; - expand_aggr_init (baseref, TREE_VALUE (elts), 0, 0); + expand_aggr_init (baseref, TREE_VALUE (elts), 0); expand_assignment (base, baseinc, 0, 0); elts = TREE_CHAIN (elts); @@ -2883,7 +2878,7 @@ expand_vec_init (decl, base, maxindex, init, from_array) if (from_array == 2) expand_expr_stmt (build_modify_expr (to, NOP_EXPR, from)); else if (TYPE_NEEDS_CONSTRUCTING (type)) - expand_aggr_init (to, from, 0, 0); + expand_aggr_init (to, from, 0); else if (from) expand_assignment (to, from, 0, 0); else @@ -2897,7 +2892,7 @@ expand_vec_init (decl, base, maxindex, init, from_array) array_type_nelts (type), 0, 0); } else - expand_aggr_init (build1 (INDIRECT_REF, type, base), init, 0, 0); + expand_aggr_init (build1 (INDIRECT_REF, type, base), init, 0); expand_assignment (base, build (PLUS_EXPR, build_pointer_type (type), base, size), @@ -2975,8 +2970,8 @@ expand_vec_init (decl, base, maxindex, init, from_array) This does not call any destructors. */ tree -build_x_delete (type, addr, which_delete, virtual_size) - tree type, addr; +build_x_delete (addr, which_delete, virtual_size) + tree addr; int which_delete; tree virtual_size; { diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c index a40c2e005a2..20e47008265 100644 --- a/gcc/cp/lex.c +++ b/gcc/cp/lex.c @@ -1178,7 +1178,7 @@ interface_strcmp (s) static void set_typedecl_interface_info (prev, vars) - tree prev, vars; + tree prev ATTRIBUTE_UNUSED, vars; { tree id = get_time_identifier (DECL_SOURCE_FILE (vars)); tree fileinfo = IDENTIFIER_CLASS_VALUE (id); @@ -1284,7 +1284,7 @@ process_next_inline (t) tree context; struct pending_inline *i = (struct pending_inline *) TREE_PURPOSE (t); context = hack_decl_function_context (i->fndecl); - maybe_end_member_template_processing (i->fndecl); + maybe_end_member_template_processing (); if (context) pop_cp_function_context (context); i = i->next; @@ -1935,7 +1935,7 @@ do_pending_defargs () if (TREE_CODE (defarg_fn) == FUNCTION_DECL) { - maybe_end_member_template_processing (defarg_fn); + maybe_end_member_template_processing (); check_default_args (defarg_fn); } @@ -2703,7 +2703,8 @@ readescape (ignore_ptr) ; else if ((count - 1) * 4 >= TYPE_PRECISION (integer_type_node) || (count > 1 - && ((1 << (TYPE_PRECISION (integer_type_node) - (count - 1) * 4)) + && (((unsigned)1 << + (TYPE_PRECISION (integer_type_node) - (count - 1) * 4)) <= firstdig))) pedwarn ("hex escape out of range"); return code; @@ -4016,7 +4017,7 @@ real_yylex () if (ignore) goto tryagain; if (width < HOST_BITS_PER_INT - && (unsigned) c >= (1 << width)) + && (unsigned) c >= ((unsigned)1 << width)) pedwarn ("escape sequence out of range for character"); #ifdef MAP_CHARACTER if (ISPRINT (c)) @@ -4177,7 +4178,7 @@ real_yylex () if (ignore) goto skipnewline; if (width < HOST_BITS_PER_INT - && (unsigned) c >= (1 << width)) + && (unsigned) c >= ((unsigned)1 << width)) warning ("escape sequence out of range for character"); } else if (c == '\n') @@ -4237,7 +4238,7 @@ real_yylex () for (byte = 0; byte < WCHAR_BYTES; ++byte) { int value; - if (byte >= sizeof (c)) + if (byte >= (int) sizeof(c)) value = 0; else value = (c >> (byte * width)) & bytemask; diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 47cb0c34ec8..e08eaff3e8c 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -396,8 +396,7 @@ maybe_begin_member_template_processing (decl) /* Undo the effects of begin_member_template_processing. */ void -maybe_end_member_template_processing (decl) - tree decl; +maybe_end_member_template_processing () { if (! processing_template_decl) return; @@ -1242,19 +1241,21 @@ check_explicit_specialization (declarator, decl, template_count, flags) check_specialization_scope. */ return error_mark_node; else - /* It's not legal to write an explicit instantiation in - class scope, e.g.: + { + /* It's not legal to write an explicit instantiation in + class scope, e.g.: - class C { template void f(); } + class C { template void f(); } - This case is caught by the parser. However, on - something like: + This case is caught by the parser. However, on + something like: - template class C { void f(); }; + template class C { void f(); }; - (which is illegal) we can get here. The error will be - issued later. */ - ; + (which is illegal) we can get here. The error will be + issued later. */ + ; + } return decl; } @@ -1712,7 +1713,7 @@ tree current_template_args () { tree header; - tree args; + tree args = NULL_TREE; int length = TMPL_PARMS_DEPTH (current_template_parms); int l = length; @@ -3388,7 +3389,7 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope) int arg_depth; int parm_depth; int is_partial_instantiation; - tree prev_local_enum; + tree prev_local_enum = NULL_TREE; template = most_general_template (template); parmlist = DECL_TEMPLATE_PARMS (template); @@ -4860,7 +4861,7 @@ tsubst_decl (t, args, type, in_decl) { int saved_lineno; char* saved_filename; - tree r; + tree r = NULL_TREE; /* Set the filename and linenumber to improve error-reporting. */ saved_lineno = lineno; @@ -8362,7 +8363,7 @@ set_mangled_name_for_template_decl (decl) tree decl; { tree saved_namespace; - tree context; + tree context = NULL_TREE; tree fn_type; tree ret_type; tree parm_types; diff --git a/gcc/cp/spew.c b/gcc/cp/spew.c index 554ee4c76ca..17c68d34b40 100644 --- a/gcc/cp/spew.c +++ b/gcc/cp/spew.c @@ -47,7 +47,7 @@ struct token { static int do_aggr PROTO((void)); static int probe_obstack PROTO((struct obstack *, tree, unsigned int)); -static void scan_tokens PROTO((int)); +static void scan_tokens PROTO((unsigned int)); #ifdef SPEW_DEBUG static int num_tokens PROTO((void)); @@ -155,9 +155,9 @@ consume_token () static void scan_tokens (n) - int n; + unsigned int n; { - int i; + unsigned int i; struct token *tmp; /* We cannot read past certain tokens, so make sure we don't. */ @@ -244,7 +244,7 @@ int yylex () { struct token tmp_token; - tree trrr; + tree trrr = NULL_TREE; int old_looking_for_typename = 0; retry: diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 72481750d76..a3c75d94337 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -1222,7 +1222,7 @@ common_base_type (tt1, tt2) int compparms (parms1, parms2, strict) tree parms1, parms2; - int strict; + int strict ATTRIBUTE_UNUSED; { register tree t1 = parms1, t2 = parms2; diff --git a/gcc/cp/xref.c b/gcc/cp/xref.c index 14915d6a862..e38546e0367 100644 --- a/gcc/cp/xref.c +++ b/gcc/cp/xref.c @@ -731,7 +731,7 @@ simplify_type(typ) int lvl, i; i = strlen(typ); - while (i > 0 && ISSPACE(typ[i-1])) typ[--i] = 0; + while (i > 0 && ISSPACE((unsigned char) typ[i-1])) typ[--i] = 0; if (i > 7 && STREQL(&typ[i-5], "const")) { -- 2.11.0