From 8458f4cac305c696018037b6ed87ea8e30b7473d Mon Sep 17 00:00:00 2001 From: ian Date: Fri, 24 Apr 2009 15:31:38 +0000 Subject: [PATCH] gcc/: * combine.c (record_value_for_reg): Change 0 to VOIDmode, twice. (record_dead_and_set_regs): Likewise. * df.h (struct df_mw_hardreg): Change flags field to int. (struct df_base_ref): Likewise. (struct df): Change changeable_flags field to int. * df-scan.c (df_defs_record): Change clobber_flags to int. * dwarf2.h (enum dwarf_tag): Make lo_user and hi_user values enum constants rather than #define macros. (enum dwarf_attribute, enum dwarf_location_atom): Likewise. (enum dwarf_type, enum dwarf_endianity_encoding): Likewise. (enum dwarf_calling_convention): Likewise. (enum dwarf_line_number_x_ops): Likewise. (enum dwarf_call_frame_info): Likewise. (enum dwarf_source_language): Likewise. * dwarf2out.c (int_loc_descriptor): Add cast to enum type. (add_calling_convention_attribute): Likewise. * fold-const.c (fold_undefer_overflow_warnings): Add cast to enum type. (combine_comparisons): Change compcode to int. Add cast to enum type. * genrecog.c (maybe_both_true_2): Change c to int. (write_switch): Likewise. Add cast to enum type. * gimplify.c (gimplify_omp_for): Handle return values from gimplify_expr using MIN rather than bitwise or. (gimplify_expr): Add cast to enum type. * ipa-prop.c (update_jump_functions_after_inlining): Change IPA_BOTTOM to IPA_JF_UNKNOWN. * ira.c (setup_class_subset_and_memory_move_costs): Change mode to int. Add casts to enum type. (setup_cover_and_important_classes): Change cl to int. Add casts to enum type. (setup_class_translate): Change cl and mode to int. (ira_init_once): Change mode to int. (free_register_move_costs): Likewise. (setup_prohibited_mode_move_regs): Add casts to enum type. * langhooks.c (add_builtin_function_common): Rework assertion that value fits bitfield. * mcf.c (add_fixup_edge): Change type parameter to edge_type. * omega.c (omega_do_elimination): Avoid math on enum types. * optabs.c (expand_vec_shift_expr): Remove casts to int. * opts.c (set_debug_level): Change 2 to enum constant. Use new int local to handle integral_argment value. * regmove.c (try_auto_increment): Change PUT_MODE to PUT_REG_NOTE_KIND. * reload.c (push_secondary_reload): Add casts to enum type. (secondary_reload_class, find_valid_class): Likewise. * reload1.c (emit_input_reload_insns): Likewise. * rtl.h (NOTE_VAR_LOCATION_STATUS): Likewise. * sel-sched.c (init_hard_regs_data): Change cur_mode to int. * sel-sched-ir.c (hash_with_unspec_callback): Change 0 to enum constant. * tree.c (build_common_builtin_nodes): Add casts to enum type. * tree-complex.c (complex_lattice_t): Typedef to int rather than enum type. (expand_complex_libcall): Add casts to enum type. * tree-into-ssa.c (get_ssa_name_ann): Change 0 to enum constant. * tree-vect-loop.c (vect_model_reduction_cost): Compare reduc_code with ERROR_MARK, not NUM_TREE_CODES. (vect_create_epilog_for_reduction): Likewise. (vectorizable_reduction): Don't initialize epiloc_reduc_code. When not using it, set it to ERROR_MARK rather than NUM_TREE_CODES. * tree-vect-patterns.c (vect_pattern_recog_1): Change vec_mode to enum machine_mode. * tree-vect-stmts.c (new_stmt_vec_info): Change 0 to vect_unused_in_loop. Change 0 to loop_vect. * tree-vectorizer.c (vect_set_verbosity_level): Add casts to enum type. * var-tracking.c (get_init_value): Change return type to enum var_init_status. * vec.h (DEF_VEC_FUNC_P) [iterate]: Cast 0 to type T. * config/arm/arm.c (fp_model_for_fpu): Change to array to enum arm_fp_model. (arm_override_options): Add casts to enum type. (arm_emit_tls_decoration): Likewise. * config/i386/i386.c (ix86_function_specific_restore): Add casts to enum type. * config/i386/i386-c.c (ix86_pragma_target_parse): Likewise. * config/ia64/ia64.c (ia64_expand_compare): Change magic to int. * config/rs6000/rs6000.c (rs6000_override_options): Add casts to enum type. * config/s390/s390.c (code_for_builtin_64): Change to array of enum insn_code. (code_for_builtin_31): Likewise. (s390_expand_builtin): Change code_for_builtin to enum insn_code const *. * config/sparc/sparc.c (sparc_override_options): Change value field in struct code_model to enum cmodel. In initializer change 0 to NULL and add cast to enum type. * c-typeck.c (build_modify_expr): Add lhs_origtype parameter. Change all callers. Issue a -Wc++-compat warning using lhs_origtype if necessary. (convert_for_assignment): Issue -Wc++-compat warnings about invalid conversions to enum type on assignment. * c-common.h (build_modify_expr): Update declaration. gcc/cp/: * call.c (build_temp): Change 0 to enum constant. * cp-tree.h (cp_lvalue_kind): Typedef to int rather than enum type. * cp-gimplify.c (cp_gimplify_expr): Add cast to enum type. * decl2.c (constrain_visibility): Likewise. * parser.c (cp_lexer_get_preprocessor_token): Likewise. (cp_parser_flags): Typedef to int rather than enum type. (cp_parser_expression_stack_entry): Change prec field to enum cp_parser_prec. * typeck.c (build_modify_expr): Add lhs_origtype parameter. Change all callers. gcc/fortran/: * gfortran.h (enum gfc_symbol_type): New named enum type, broken out of struct gfc_symbol. (struct gfc_symbol): Use enum gfc_symbol_type. (enum gfc_array_ref_dimen_type): New named enum type, broken out of struct gfc_array_ref). (struct gfc_array_ref): Use enum gfc_array_ref_dimen_type. (mod_pointee_as): Update declaration. * decl.c (add_global_entry): Change type to enum gfc_symbol_type. (gfc_mod_pointee_as): Change return type to "match". * module.c (mio_array_ref): Add cast to enum type. (mio_symbol): Likewise. * resolve.c (resolve_global_procedure): Change type to enum gfc_symbol_type. * trans-io.c (gfc_build_st_parameter): Change type to unsigned int. gcc/java/: * jcf-parse.c (handle_constant): Add cast to enum type. gcc/objc/: * objc-act.c (get_super_receiver): Update calls to build_modify_expr to pass new argument. gcc/testsuite/: * gcc.dg/Wcxx-compat-4.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@146735 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 99 ++++++++++++++++++++++++++++++++++++ gcc/c-common.h | 3 +- gcc/c-omp.c | 5 +- gcc/c-parser.c | 12 +++-- gcc/c-typeck.c | 33 +++++++++--- gcc/combine.c | 8 +-- gcc/config/arm/arm.c | 8 +-- gcc/config/i386/i386-c.c | 8 +-- gcc/config/i386/i386.c | 8 +-- gcc/config/ia64/ia64.c | 3 +- gcc/config/rs6000/rs6000.c | 6 ++- gcc/config/s390/s390.c | 6 +-- gcc/config/sparc/sparc.c | 4 +- gcc/cp/ChangeLog | 15 ++++++ gcc/cp/call.c | 2 +- gcc/cp/cp-gimplify.c | 2 +- gcc/cp/cp-tree.h | 8 ++- gcc/cp/decl2.c | 2 +- gcc/cp/parser.c | 13 +++-- gcc/cp/semantics.c | 3 +- gcc/cp/typeck.c | 3 +- gcc/df-scan.c | 2 +- gcc/df.h | 11 ++-- gcc/dwarf2.h | 66 +++++++++++++----------- gcc/dwarf2out.c | 5 +- gcc/fold-const.c | 12 +++-- gcc/fortran/ChangeLog | 18 +++++++ gcc/fortran/decl.c | 6 +-- gcc/fortran/gfortran.h | 21 +++++--- gcc/fortran/module.c | 4 +- gcc/fortran/resolve.c | 2 +- gcc/fortran/trans-io.c | 5 +- gcc/genrecog.c | 7 +-- gcc/gimplify.c | 15 ++++-- gcc/ipa-prop.c | 4 +- gcc/ira.c | 39 +++++++------- gcc/java/ChangeLog | 4 ++ gcc/java/jcf-parse.c | 4 +- gcc/langhooks.c | 7 +-- gcc/mcf.c | 7 +-- gcc/objc/ChangeLog | 5 ++ gcc/objc/objc-act.c | 11 ++-- gcc/omega.c | 5 +- gcc/optabs.c | 6 +-- gcc/opts.c | 10 ++-- gcc/regmove.c | 2 +- gcc/reload.c | 6 +-- gcc/reload1.c | 41 +++++++++++---- gcc/rtl.h | 4 +- gcc/sel-sched-ir.c | 4 +- gcc/sel-sched.c | 2 +- gcc/testsuite/ChangeLog | 4 ++ gcc/testsuite/gcc.dg/Wcxx-compat-4.c | 49 ++++++++++++++++++ gcc/tree-complex.c | 14 +++-- gcc/tree-into-ssa.c | 2 +- gcc/tree-vect-loop.c | 13 ++--- gcc/tree-vect-patterns.c | 2 +- gcc/tree-vect-stmts.c | 6 +-- gcc/tree-vectorizer.c | 4 +- gcc/tree.c | 8 +-- gcc/var-tracking.c | 7 ++- gcc/vec.h | 4 +- 62 files changed, 493 insertions(+), 206 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/Wcxx-compat-4.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 30ad268..b0ed4ff 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,102 @@ +2009-04-24 Ian Lance Taylor + + * combine.c (record_value_for_reg): Change 0 to VOIDmode, twice. + (record_dead_and_set_regs): Likewise. + * df.h (struct df_mw_hardreg): Change flags field to int. + (struct df_base_ref): Likewise. + (struct df): Change changeable_flags field to int. + * df-scan.c (df_defs_record): Change clobber_flags to int. + * dwarf2.h (enum dwarf_tag): Make lo_user and hi_user values enum + constants rather than #define macros. + (enum dwarf_attribute, enum dwarf_location_atom): Likewise. + (enum dwarf_type, enum dwarf_endianity_encoding): Likewise. + (enum dwarf_calling_convention): Likewise. + (enum dwarf_line_number_x_ops): Likewise. + (enum dwarf_call_frame_info): Likewise. + (enum dwarf_source_language): Likewise. + * dwarf2out.c (int_loc_descriptor): Add cast to enum type. + (add_calling_convention_attribute): Likewise. + * fold-const.c (fold_undefer_overflow_warnings): Add cast to enum + type. + (combine_comparisons): Change compcode to int. Add cast to enum + type. + * genrecog.c (maybe_both_true_2): Change c to int. + (write_switch): Likewise. Add cast to enum type. + * gimplify.c (gimplify_omp_for): Handle return values from + gimplify_expr using MIN rather than bitwise or. + (gimplify_expr): Add cast to enum type. + * ipa-prop.c (update_jump_functions_after_inlining): Change + IPA_BOTTOM to IPA_JF_UNKNOWN. + * ira.c (setup_class_subset_and_memory_move_costs): Change mode to + int. Add casts to enum type. + (setup_cover_and_important_classes): Change cl to int. Add casts + to enum type. + (setup_class_translate): Change cl and mode to int. + (ira_init_once): Change mode to int. + (free_register_move_costs): Likewise. + (setup_prohibited_mode_move_regs): Add casts to enum type. + * langhooks.c (add_builtin_function_common): Rework assertion that + value fits bitfield. + * mcf.c (add_fixup_edge): Change type parameter to edge_type. + * omega.c (omega_do_elimination): Avoid math on enum types. + * optabs.c (expand_vec_shift_expr): Remove casts to int. + * opts.c (set_debug_level): Change 2 to enum constant. Use new + int local to handle integral_argment value. + * regmove.c (try_auto_increment): Change PUT_MODE to + PUT_REG_NOTE_KIND. + * reload.c (push_secondary_reload): Add casts to enum type. + (secondary_reload_class, find_valid_class): Likewise. + * reload1.c (emit_input_reload_insns): Likewise. + * rtl.h (NOTE_VAR_LOCATION_STATUS): Likewise. + * sel-sched.c (init_hard_regs_data): Change cur_mode to int. + * sel-sched-ir.c (hash_with_unspec_callback): Change 0 to enum + constant. + * tree.c (build_common_builtin_nodes): Add casts to enum type. + * tree-complex.c (complex_lattice_t): Typedef to int rather than + enum type. + (expand_complex_libcall): Add casts to enum type. + * tree-into-ssa.c (get_ssa_name_ann): Change 0 to enum constant. + * tree-vect-loop.c (vect_model_reduction_cost): Compare reduc_code + with ERROR_MARK, not NUM_TREE_CODES. + (vect_create_epilog_for_reduction): Likewise. + (vectorizable_reduction): Don't initialize epiloc_reduc_code. + When not using it, set it to ERROR_MARK rather than + NUM_TREE_CODES. + * tree-vect-patterns.c (vect_pattern_recog_1): Change vec_mode to + enum machine_mode. + * tree-vect-stmts.c (new_stmt_vec_info): Change 0 to + vect_unused_in_loop. Change 0 to loop_vect. + * tree-vectorizer.c (vect_set_verbosity_level): Add casts to enum + type. + * var-tracking.c (get_init_value): Change return type to enum + var_init_status. + * vec.h (DEF_VEC_FUNC_P) [iterate]: Cast 0 to type T. + * config/arm/arm.c (fp_model_for_fpu): Change to array to enum + arm_fp_model. + (arm_override_options): Add casts to enum type. + (arm_emit_tls_decoration): Likewise. + * config/i386/i386.c (ix86_function_specific_restore): Add casts + to enum type. + * config/i386/i386-c.c (ix86_pragma_target_parse): Likewise. + * config/ia64/ia64.c (ia64_expand_compare): Change magic to int. + * config/rs6000/rs6000.c (rs6000_override_options): Add casts to + enum type. + * config/s390/s390.c (code_for_builtin_64): Change to array of + enum insn_code. + (code_for_builtin_31): Likewise. + (s390_expand_builtin): Change code_for_builtin to enum insn_code + const *. + * config/sparc/sparc.c (sparc_override_options): Change value + field in struct code_model to enum cmodel. In initializer change + 0 to NULL and add cast to enum type. + + * c-typeck.c (build_modify_expr): Add lhs_origtype parameter. + Change all callers. Issue a -Wc++-compat warning using + lhs_origtype if necessary. + (convert_for_assignment): Issue -Wc++-compat warnings about + invalid conversions to enum type on assignment. + * c-common.h (build_modify_expr): Update declaration. + 2009-04-24 Nick Clifton * config/iq2000/iq2000.c (function_arg): Handle TImode values. diff --git a/gcc/c-common.h b/gcc/c-common.h index e697488..1e313cf 100644 --- a/gcc/c-common.h +++ b/gcc/c-common.h @@ -413,7 +413,8 @@ extern tree add_stmt (tree); extern void push_cleanup (tree, tree, bool); extern tree pushdecl_top_level (tree); extern tree pushdecl (tree); -extern tree build_modify_expr (location_t, tree, enum tree_code, tree, tree); +extern tree build_modify_expr (location_t, tree, tree, enum tree_code, + tree, tree); extern tree build_indirect_ref (location_t, tree, const char *); extern int c_expand_decl (tree); diff --git a/gcc/c-omp.c b/gcc/c-omp.c index b574559..d31fb07 100644 --- a/gcc/c-omp.c +++ b/gcc/c-omp.c @@ -142,7 +142,7 @@ c_finish_omp_atomic (enum tree_code code, tree lhs, tree rhs) /* There are lots of warnings, errors, and conversions that need to happen in the course of interpreting a statement. Use the normal mechanisms to do this, and then take it apart again. */ - x = build_modify_expr (input_location, lhs, code, rhs, NULL_TREE); + x = build_modify_expr (input_location, lhs, NULL_TREE, code, rhs, NULL_TREE); if (x == error_mark_node) return error_mark_node; gcc_assert (TREE_CODE (x) == MODIFY_EXPR); @@ -260,7 +260,8 @@ c_finish_omp_for (location_t locus, tree declv, tree initv, tree condv, fail = true; } - init = build_modify_expr (elocus, decl, NOP_EXPR, init, NULL_TREE); + init = build_modify_expr (elocus, decl, NULL_TREE, NOP_EXPR, init, + NULL_TREE); } gcc_assert (TREE_CODE (init) == MODIFY_EXPR); gcc_assert (TREE_OPERAND (init, 0) == decl); diff --git a/gcc/c-parser.c b/gcc/c-parser.c index 8e74faf..7fe7fae 100644 --- a/gcc/c-parser.c +++ b/gcc/c-parser.c @@ -4443,8 +4443,8 @@ c_parser_expr_no_commas (c_parser *parser, struct c_expr *after) c_parser_consume_token (parser); rhs = c_parser_expr_no_commas (parser, NULL); rhs = default_function_array_conversion (rhs); - ret.value = build_modify_expr (op_location, lhs.value, code, rhs.value, - rhs.original_type); + ret.value = build_modify_expr (op_location, lhs.value, lhs.original_type, + code, rhs.value, rhs.original_type); if (code == NOP_EXPR) ret.original_code = MODIFY_EXPR; else @@ -7823,18 +7823,20 @@ c_parser_omp_for_loop (c_parser *parser, tree clauses, tree *par_clauses) else if (c_parser_next_token_is (parser, CPP_NAME) && c_parser_peek_2nd_token (parser)->type == CPP_EQ) { + struct c_expr decl_exp; struct c_expr init_exp; location_t init_loc; - decl = c_parser_postfix_expression (parser).value; + decl_exp = c_parser_postfix_expression (parser); + decl = decl_exp.value; c_parser_require (parser, CPP_EQ, "expected %<=%>"); init_loc = c_parser_peek_token (parser)->location; init_exp = c_parser_expr_no_commas (parser, NULL); init_exp = default_function_array_conversion (init_exp); - init = build_modify_expr (init_loc, - decl, NOP_EXPR, init_exp.value, + init = build_modify_expr (init_loc, decl, decl_exp.original_type, + NOP_EXPR, init_exp.value, init_exp.original_type); init = c_process_expr_stmt (init); diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index 34960a0..c7ea328 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -4292,6 +4292,8 @@ c_cast_expr (struct c_type_name *type_name, tree expr) } /* Build an assignment expression of lvalue LHS from value RHS. + If LHS_ORIGTYPE is not NULL, it is the original type of LHS, which + may differ from TREE_TYPE (LHS) for an enum bitfield. MODIFYCODE is the code for a binary operator that we use to combine the old value of LHS with RHS to get the new value. Or else MODIFYCODE is NOP_EXPR meaning do a simple assignment. @@ -4301,9 +4303,8 @@ c_cast_expr (struct c_type_name *type_name, tree expr) LOCATION is the location of the MODIFYCODE operator. */ tree -build_modify_expr (location_t location, - tree lhs, enum tree_code modifycode, tree rhs, - tree rhs_origtype) +build_modify_expr (location_t location, tree lhs, tree lhs_origtype, + enum tree_code modifycode, tree rhs, tree rhs_origtype) { tree result; tree newrhs; @@ -4333,7 +4334,8 @@ build_modify_expr (location_t location, if (TREE_CODE (lhs) == C_MAYBE_CONST_EXPR) { tree inner = build_modify_expr (location, C_MAYBE_CONST_EXPR_EXPR (lhs), - modifycode, rhs, rhs_origtype); + lhs_origtype, modifycode, rhs, + rhs_origtype); if (inner == error_mark_node) return error_mark_node; result = build2 (C_MAYBE_CONST_EXPR, TREE_TYPE (inner), @@ -4393,6 +4395,23 @@ build_modify_expr (location_t location, TREE_TYPE (lhs) = lhstype; } + /* Issue -Wc++-compat warnings about an assignment to an enum type + when LHS does not have its original type. This happens for, + e.g., an enum bitfield in a struct. */ + if (warn_cxx_compat + && lhs_origtype != NULL_TREE + && lhs_origtype != lhstype + && TREE_CODE (lhs_origtype) == ENUMERAL_TYPE) + { + tree checktype = (rhs_origtype != NULL_TREE + ? rhs_origtype + : TREE_TYPE (rhs)); + if (checktype != error_mark_node + && TYPE_MAIN_VARIANT (checktype) != TYPE_MAIN_VARIANT (lhs_origtype)) + warning_at (location, OPT_Wc___compat, + "enum conversion in assignment is invalid in C++"); + } + /* Convert new value to destination type. Fold it first, then restore any excess precision information, for the sake of conversion warnings. */ @@ -4553,9 +4572,9 @@ convert_for_assignment (tree type, tree rhs, tree origtype, && TYPE_MAIN_VARIANT (checktype) != TYPE_MAIN_VARIANT (type)) { /* FIXME: Until the gcc source code is converted, we only - warn about parameter passing. We will add the other - cases when bootstrap succeeds with them. */ - if (errtype == ic_argpass) + warn about assignment and parameter passing. We will add + the other cases when bootstrap succeeds with them. */ + if (errtype == ic_argpass || errtype == ic_assign) { WARN_FOR_ASSIGNMENT (input_location, OPT_Wc___compat, G_("enum conversion when passing argument " diff --git a/gcc/combine.c b/gcc/combine.c index b070ee1..11046b5 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -11389,11 +11389,11 @@ record_value_for_reg (rtx reg, rtx insn, rtx value) rsp->last_set = insn; rsp->last_set_value = 0; - rsp->last_set_mode = 0; + rsp->last_set_mode = VOIDmode; rsp->last_set_nonzero_bits = 0; rsp->last_set_sign_bit_copies = 0; rsp->last_death = 0; - rsp->truncated_to_mode = 0; + rsp->truncated_to_mode = VOIDmode; } /* Mark registers that are being referenced in this value. */ @@ -11540,11 +11540,11 @@ record_dead_and_set_regs (rtx insn) rsp->last_set_invalid = 1; rsp->last_set = insn; rsp->last_set_value = 0; - rsp->last_set_mode = 0; + rsp->last_set_mode = VOIDmode; rsp->last_set_nonzero_bits = 0; rsp->last_set_sign_bit_copies = 0; rsp->last_death = 0; - rsp->truncated_to_mode = 0; + rsp->truncated_to_mode = VOIDmode; } last_call_luid = mem_last_set = DF_INSN_LUID (insn); diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 38ab142..13f209a 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -729,7 +729,7 @@ static const struct fpu_desc all_fpus[] = /* Floating point models used by the different hardware. See fputype in arm.h. */ -static const enum fputype fp_model_for_fpu[] = +static const enum arm_fp_model fp_model_for_fpu[] = { /* No FP hardware. */ ARM_FP_MODEL_UNKNOWN, /* FPUTYPE_NONE */ @@ -1199,13 +1199,13 @@ arm_override_options (void) const struct processors * sel; unsigned int sought; - selected_cpu = TARGET_CPU_DEFAULT; + selected_cpu = (enum processor_type) TARGET_CPU_DEFAULT; if (selected_cpu == arm_none) { #ifdef SUBTARGET_CPU_DEFAULT /* Use the subtarget default CPU if none was specified by configure. */ - selected_cpu = SUBTARGET_CPU_DEFAULT; + selected_cpu = (enum processor_type) SUBTARGET_CPU_DEFAULT; #endif /* Default to ARM6. */ if (selected_cpu == arm_none) @@ -19398,7 +19398,7 @@ arm_emit_tls_decoration (FILE *fp, rtx x) rtx val; val = XVECEXP (x, 0, 0); - reloc = INTVAL (XVECEXP (x, 0, 1)); + reloc = (enum tls_reloc) INTVAL (XVECEXP (x, 0, 1)); output_addr_const (fp, val); diff --git a/gcc/config/i386/i386-c.c b/gcc/config/i386/i386-c.c index d35ea76..e11ddc2 100644 --- a/gcc/config/i386/i386-c.c +++ b/gcc/config/i386/i386-c.c @@ -280,10 +280,10 @@ ix86_pragma_target_parse (tree args, tree pop_target) prev_isa = prev_opt->ix86_isa_flags; cur_isa = cur_opt->ix86_isa_flags; diff_isa = (prev_isa ^ cur_isa); - prev_arch = prev_opt->arch; - prev_tune = prev_opt->tune; - cur_arch = cur_opt->arch; - cur_tune = cur_opt->tune; + prev_arch = (enum processor_type) prev_opt->arch; + prev_tune = (enum processor_type) prev_opt->tune; + cur_arch = (enum processor_type) cur_opt->arch; + cur_tune = (enum processor_type) cur_opt->tune; /* If the same processor is used for both previous and current options, don't change the macros. */ diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 51a2f71a..ab851dc 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -3415,10 +3415,10 @@ ix86_function_specific_restore (struct cl_target_option *ptr) unsigned int ix86_arch_mask, ix86_tune_mask; int i; - ix86_arch = ptr->arch; - ix86_schedule = ptr->schedule; - ix86_tune = ptr->tune; - ix86_fpmath = ptr->fpmath; + ix86_arch = (enum processor_type) ptr->arch; + ix86_schedule = (enum attr_cpu) ptr->schedule; + ix86_tune = (enum processor_type) ptr->tune; + ix86_fpmath = (enum fpmath_unit) ptr->fpmath; ix86_branch_cost = ptr->branch_cost; ix86_tune_defaulted = ptr->tune_defaulted; ix86_arch_specified = ptr->arch_specified; diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c index 7cccb6b..54bf0d5 100644 --- a/gcc/config/ia64/ia64.c +++ b/gcc/config/ia64/ia64.c @@ -1521,7 +1521,8 @@ ia64_expand_compare (enum rtx_code code, enum machine_mode mode) QCMP_EQ = 4, QCMP_LT = 8, QCMP_GT = 16 - } magic; + }; + int magic; enum rtx_code ncode; rtx ret, insns; diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index c785bf83..91b44af 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -1771,7 +1771,8 @@ rs6000_override_options (const char *default_cpu) else if (! strcmp (rs6000_sched_costly_dep_str, "store_to_load")) rs6000_sched_costly_dep = store_to_load_dep_costly; else - rs6000_sched_costly_dep = atoi (rs6000_sched_costly_dep_str); + rs6000_sched_costly_dep = ((enum rs6000_dependence_cost) + atoi (rs6000_sched_costly_dep_str)); } /* Handle -minsert-sched-nops option. */ @@ -1787,7 +1788,8 @@ rs6000_override_options (const char *default_cpu) else if (! strcmp (rs6000_sched_insert_nops_str, "regroup_exact")) rs6000_sched_insert_nops = sched_finish_regroup_exact; else - rs6000_sched_insert_nops = atoi (rs6000_sched_insert_nops_str); + rs6000_sched_insert_nops = ((enum rs6000_nop_insertion) + atoi (rs6000_sched_insert_nops_str)); } #ifdef TARGET_REGNAMES diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index 7c485fd..10fdb4e 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -8660,12 +8660,12 @@ enum s390_builtin S390_BUILTIN_max }; -static unsigned int const code_for_builtin_64[S390_BUILTIN_max] = { +static enum insn_code const code_for_builtin_64[S390_BUILTIN_max] = { CODE_FOR_get_tp_64, CODE_FOR_set_tp_64 }; -static unsigned int const code_for_builtin_31[S390_BUILTIN_max] = { +static enum insn_code const code_for_builtin_31[S390_BUILTIN_max] = { CODE_FOR_get_tp_31, CODE_FOR_set_tp_31 }; @@ -8699,7 +8699,7 @@ s390_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED, { #define MAX_ARGS 2 - unsigned int const *code_for_builtin = + enum insn_code const *code_for_builtin = TARGET_64BIT ? code_for_builtin_64 : code_for_builtin_31; tree fndecl = TREE_OPERAND (CALL_EXPR_FN (exp), 0); diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c index 88d786b..c3b5a69 100644 --- a/gcc/config/sparc/sparc.c +++ b/gcc/config/sparc/sparc.c @@ -623,14 +623,14 @@ sparc_override_options (void) { static struct code_model { const char *const name; - const int value; + const enum cmodel value; } const cmodels[] = { { "32", CM_32 }, { "medlow", CM_MEDLOW }, { "medmid", CM_MEDMID }, { "medany", CM_MEDANY }, { "embmedany", CM_EMBMEDANY }, - { 0, 0 } + { NULL, (enum cmodel) 0 } }; const struct code_model *cmodel; /* Map TARGET_CPU_DEFAULT to value for -m{arch,tune}=. */ diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 9f0db7b..e15834d 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,18 @@ +2009-04-24 Ian Lance Taylor + + * call.c (build_temp): Change 0 to enum constant. + * cp-tree.h (cp_lvalue_kind): Typedef to int rather than enum + type. + * cp-gimplify.c (cp_gimplify_expr): Add cast to enum type. + * decl2.c (constrain_visibility): Likewise. + * parser.c (cp_lexer_get_preprocessor_token): Likewise. + (cp_parser_flags): Typedef to int rather than enum type. + (cp_parser_expression_stack_entry): Change prec field to enum + cp_parser_prec. + + * typeck.c (build_modify_expr): Add lhs_origtype parameter. + Change all callers. + 2009-04-22 Dodji Seketeli PR c++/39639 diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 4eae733..ca45bee 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -4484,7 +4484,7 @@ build_temp (tree expr, tree type, int flags, else if (errorcount > savee) *diagnostic_kind = DK_ERROR; else - *diagnostic_kind = 0; + *diagnostic_kind = DK_UNSPECIFIED; return expr; } diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c index bb12988..4664157 100644 --- a/gcc/cp/cp-gimplify.c +++ b/gcc/cp/cp-gimplify.c @@ -653,7 +653,7 @@ cp_gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p) break; default: - ret = c_gimplify_expr (expr_p, pre_p, post_p); + ret = (enum gimplify_status) c_gimplify_expr (expr_p, pre_p, post_p); break; } diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index a4fc7c0..1f3d0c1 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -3466,13 +3466,17 @@ enum tag_types { }; /* The various kinds of lvalues we distinguish. */ -typedef enum cp_lvalue_kind { +enum cp_lvalue_kind { clk_none = 0, /* Things that are not an lvalue. */ clk_ordinary = 1, /* An ordinary lvalue. */ clk_class = 2, /* An rvalue of class-type. */ clk_bitfield = 4, /* An lvalue for a bit-field. */ clk_packed = 8 /* An lvalue for a packed field. */ -} cp_lvalue_kind; +}; + +/* This type is used for parameters and variables which hold + combinations of the flags in enum cp_lvalue_kind. */ +typedef int cp_lvalue_kind; /* Various kinds of template specialization, instantiation, etc. */ typedef enum tmpl_spec_kind { diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 12876ad..8196b54 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -1848,7 +1848,7 @@ constrain_visibility (tree decl, int visibility) else if (visibility > DECL_VISIBILITY (decl) && !DECL_VISIBILITY_SPECIFIED (decl)) { - DECL_VISIBILITY (decl) = visibility; + DECL_VISIBILITY (decl) = (enum symbol_visibility) visibility; return true; } return false; diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index d98cfdd..9829275 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -465,7 +465,8 @@ cp_lexer_get_preprocessor_token (cp_lexer *lexer, cp_token *token) else if (token->type == CPP_PRAGMA) { /* We smuggled the cpp_token->u.pragma value in an INTEGER_CST. */ - token->pragma_kind = TREE_INT_CST_LOW (token->u.value); + token->pragma_kind = ((enum pragma_kind) + TREE_INT_CST_LOW (token->u.value)); token->u.value = NULL_TREE; } } @@ -1187,7 +1188,7 @@ function_declarator_p (const cp_declarator *declarator) /* Flags that are passed to some parsing functions. These values can be bitwise-ored together. */ -typedef enum cp_parser_flags +enum cp_parser_flags { /* No flags. */ CP_PARSER_FLAGS_NONE = 0x0, @@ -1196,7 +1197,11 @@ typedef enum cp_parser_flags CP_PARSER_FLAGS_OPTIONAL = 0x1, /* When parsing a type-specifier, do not allow user-defined types. */ CP_PARSER_FLAGS_NO_USER_DEFINED_TYPES = 0x2 -} cp_parser_flags; +}; + +/* This type is used for parameters and variables which hold + combinations of the flags in enum cp_parser_flags. */ +typedef int cp_parser_flags; /* The different kinds of declarators we want to parse. */ @@ -1268,7 +1273,7 @@ typedef struct cp_parser_expression_stack_entry /* Tree code for the binary operation we are parsing. */ enum tree_code tree_type; /* Precedence of the binary operation we are parsing. */ - int prec; + enum cp_parser_prec prec; } cp_parser_expression_stack_entry; /* The stack for storing partial expressions. We only need NUM_PREC_VALUES diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 47d9a24..50e036d 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -4128,7 +4128,8 @@ handle_omp_for_class_iterator (int i, location_t locus, tree declv, tree initv, cond = cp_build_binary_op (elocus, TREE_CODE (cond), decl, diff, tf_warning_or_error); - incr = build_modify_expr (elocus, decl, PLUS_EXPR, incr, NULL_TREE); + incr = build_modify_expr (elocus, decl, NULL_TREE, PLUS_EXPR, + incr, NULL_TREE); orig_body = *body; *body = push_stmt_list (); diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index d9222dc..69d5529 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -5870,7 +5870,8 @@ cp_build_c_cast (tree type, tree expr, tsubst_flags_t complain) /* For use from the C common bits. */ tree build_modify_expr (location_t location ATTRIBUTE_UNUSED, - tree lhs, enum tree_code modifycode, tree rhs, + tree lhs, tree lhs_origtype ATTRIBUTE_UNUSED, + enum tree_code modifycode, tree rhs, tree rhs_origtype ATTRIBUTE_UNUSED) { return cp_build_modify_expr (lhs, modifycode, rhs, tf_warning_or_error); diff --git a/gcc/df-scan.c b/gcc/df-scan.c index fe00af2..181994d 100644 --- a/gcc/df-scan.c +++ b/gcc/df-scan.c @@ -2978,7 +2978,7 @@ df_defs_record (struct df_collection_rec *collection_rec, if (code == SET || code == CLOBBER) { /* Mark the single def within the pattern. */ - enum df_ref_flags clobber_flags = flags; + int clobber_flags = flags; clobber_flags |= (code == CLOBBER) ? DF_REF_MUST_CLOBBER : 0; df_def_record_1 (collection_rec, x, bb, insn_info, clobber_flags); } diff --git a/gcc/df.h b/gcc/df.h index 3462b45..10b5e78d 100644 --- a/gcc/df.h +++ b/gcc/df.h @@ -342,8 +342,7 @@ struct df_mw_hardreg accesses to 16-bit fields will usually be quicker. */ ENUM_BITFIELD(df_ref_type) type : 16; /* Used to see if the ref is read or write. */ - ENUM_BITFIELD(df_ref_flags) flags : 16; - /* Various flags. */ + int flags : 16; /* Various df_ref_flags. */ unsigned int start_regno; /* First word of the multi word subreg. */ unsigned int end_regno; /* Last word of the multi word subreg. */ unsigned int mw_order; /* Same as df_ref.ref_order. */ @@ -361,8 +360,7 @@ struct df_base_ref ENUM_BITFIELD(df_ref_type) type : 8; /* Type of ref. */ - ENUM_BITFIELD(df_ref_flags) flags : 16; - /* Various flags. */ + int flags : 16; /* Various df_ref_flags. */ rtx reg; /* The register referenced. */ struct df_link *chain; /* Head of def-use, use-def. */ /* Pointer to the insn info of the containing instruction. FIXME! @@ -603,8 +601,9 @@ struct df addresses. It is incremented whenever a ref is created. */ unsigned int ref_order; - /* Problem specific control information. */ - ENUM_BITFIELD (df_changeable_flags) changeable_flags : 8; + /* Problem specific control information. This is a combination of + enum df_changeable_flags values. */ + int changeable_flags : 8; /* If this is true, then only a subset of the blocks of the program is considered to compute the solutions of dataflow problems. */ diff --git a/gcc/dwarf2.h b/gcc/dwarf2.h index a0a97ee..d0777a0 100644 --- a/gcc/dwarf2.h +++ b/gcc/dwarf2.h @@ -1,7 +1,7 @@ /* Declarations and definitions of codes relating to the DWARF2 and DWARF3 symbolic debugging information formats. Copyright (C) 1992, 1993, 1995, 1996, 1997, 1999, 2000, 2001, 2002, - 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. + 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. Written by Gary Funck (gary@intrepid.com) The Ada Joint Program Office (AJPO), Florida State University and Silicon Graphics Inc. @@ -193,6 +193,10 @@ enum dwarf_tag DW_TAG_imported_unit = 0x3d, DW_TAG_condition = 0x3f, DW_TAG_shared_type = 0x40, + + DW_TAG_lo_user = 0x4080, + DW_TAG_hi_user = 0xffff, + /* SGI/MIPS Extensions. */ DW_TAG_MIPS_loop = 0x4081, /* HP extensions. See: ftp://ftp.hp.com/pub/lang/tools/WDB/wdb-4.0.tar.gz . */ @@ -212,9 +216,6 @@ enum dwarf_tag DW_TAG_PGI_interface_block = 0xA020 }; -#define DW_TAG_lo_user 0x4080 -#define DW_TAG_hi_user 0xffff - /* Flag that tells whether entry has a child or not. */ #define DW_children_no 0 #define DW_children_yes 1 @@ -340,6 +341,10 @@ enum dwarf_attribute DW_AT_elemental = 0x66, DW_AT_pure = 0x67, DW_AT_recursive = 0x68, + + DW_AT_lo_user = 0x2000, /* Implementation-defined range start. */ + DW_AT_hi_user = 0x3ff0, /* Implementation-defined range end. */ + /* SGI/MIPS extensions. */ DW_AT_MIPS_fde = 0x2001, DW_AT_MIPS_loop_begin = 0x2002, @@ -385,9 +390,6 @@ enum dwarf_attribute DW_AT_PGI_lstride = 0x3a02 }; -#define DW_AT_lo_user 0x2000 /* Implementation-defined range start. */ -#define DW_AT_hi_user 0x3ff0 /* Implementation-defined range end. */ - /* Location atom names and codes. */ enum dwarf_location_atom { @@ -544,6 +546,10 @@ enum dwarf_location_atom DW_OP_form_tls_address = 0x9b, DW_OP_call_frame_cfa = 0x9c, DW_OP_bit_piece = 0x9d, + + DW_OP_lo_user = 0xe0, /* Implementation-defined range start. */ + DW_OP_hi_user = 0xff, /* Implementation-defined range end. */ + /* GNU extensions. */ DW_OP_GNU_push_tls_address = 0xe0, /* The following is for marking variables that are uninitialized. */ @@ -559,9 +565,6 @@ enum dwarf_location_atom DW_OP_HP_tls = 0xe6 }; -#define DW_OP_lo_user 0xe0 /* Implementation-defined range start. */ -#define DW_OP_hi_user 0xff /* Implementation-defined range end. */ - /* Type encodings. */ enum dwarf_type { @@ -582,6 +585,10 @@ enum dwarf_type DW_ATE_signed_fixed = 0xd, DW_ATE_unsigned_fixed = 0xe, DW_ATE_decimal_float = 0xf, + + DW_ATE_lo_user = 0x80, + DW_ATE_hi_user = 0xff, + /* HP extensions. */ DW_ATE_HP_float80 = 0x80, /* Floating-point (80 bit). */ DW_ATE_HP_complex_float80 = 0x81, /* Complex floating-point (80 bit). */ @@ -592,9 +599,6 @@ enum dwarf_type DW_ATE_HP_imaginary_float128 = 0x86 }; -#define DW_ATE_lo_user 0x80 -#define DW_ATE_hi_user 0xff - /* Decimal sign encodings. */ enum dwarf_decimal_sign_encoding { @@ -612,11 +616,11 @@ enum dwarf_endianity_encoding /* DWARF 3. */ DW_END_default = 0x00, DW_END_big = 0x01, - DW_END_little = 0x02 - }; + DW_END_little = 0x02, -#define DW_END_lo_user 0x40 -#define DW_END_hi_user 0xff + DW_END_lo_user = 0x40, + DW_END_hi_user = 0xff + }; /* Array ordering names and codes. */ enum dwarf_array_dim_ordering @@ -664,12 +668,13 @@ enum dwarf_calling_convention DW_CC_normal = 0x1, DW_CC_program = 0x2, DW_CC_nocall = 0x3, + + DW_CC_lo_user = 0x40, + DW_CC_hi_user = 0xff, + DW_CC_GNU_renesas_sh = 0x40 }; -#define DW_CC_lo_user 0x40 -#define DW_CC_hi_user 0xff - /* Inline attribute. */ enum dwarf_inline_attribute { @@ -721,11 +726,11 @@ enum dwarf_line_number_x_ops DW_LNE_HP_negate_post_semantics = 0x17, DW_LNE_HP_negate_function_exit = 0x18, DW_LNE_HP_negate_front_end_logical = 0x19, - DW_LNE_HP_define_proc = 0x20 - }; + DW_LNE_HP_define_proc = 0x20, -#define DW_LNE_lo_user 0x80 -#define DW_LNE_hi_user 0xff + DW_LNE_lo_user = 0x80, + DW_LNE_hi_user = 0xff + }; /* Call frame information. */ enum dwarf_call_frame_info @@ -757,6 +762,10 @@ enum dwarf_call_frame_info DW_CFA_val_offset = 0x14, DW_CFA_val_offset_sf = 0x15, DW_CFA_val_expression = 0x16, + + DW_CFA_lo_user = 0x1c, + DW_CFA_hi_user = 0x3f, + /* SGI/MIPS specific. */ DW_CFA_MIPS_advance_loc8 = 0x1d, /* GNU extensions. */ @@ -770,8 +779,6 @@ enum dwarf_call_frame_info #define DW_CIE_VERSION 1 #define DW_CFA_extended 0 -#define DW_CFA_lo_user 0x1c -#define DW_CFA_hi_user 0x3f #define DW_CHILDREN_no 0x00 #define DW_CHILDREN_yes 0x01 @@ -801,15 +808,16 @@ enum dwarf_source_language DW_LANG_ObjC_plus_plus = 0x0011, DW_LANG_UPC = 0x0012, DW_LANG_D = 0x0013, + + DW_LANG_lo_user = 0x8000, /* Implementation-defined range start. */ + DW_LANG_hi_user = 0xffff, /* Implementation-defined range start. */ + /* MIPS. */ DW_LANG_Mips_Assembler = 0x8001, /* UPC. */ DW_LANG_Upc = 0x8765 }; -#define DW_LANG_lo_user 0x8000 /* Implementation-defined range start. */ -#define DW_LANG_hi_user 0xffff /* Implementation-defined range start. */ - /* Names and codes for macro information. */ enum dwarf_macinfo_record_type { diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index b55d5ff..69cdb03 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -9752,7 +9752,7 @@ int_loc_descriptor (HOST_WIDE_INT i) if (i >= 0) { if (i <= 31) - op = DW_OP_lit0 + i; + op = (enum dwarf_location_atom) (DW_OP_lit0 + i); else if (i <= 0xff) op = DW_OP_const1u; else if (i <= 0xffff) @@ -12736,7 +12736,8 @@ add_calling_convention_attribute (dw_die_ref subr_die, tree decl) { enum dwarf_calling_convention value = DW_CC_normal; - value = targetm.dwarf_calling_convention (TREE_TYPE (decl)); + value = ((enum dwarf_calling_convention) + targetm.dwarf_calling_convention (TREE_TYPE (decl))); /* DWARF doesn't provide a way to identify a program's source-level entry point. DW_AT_calling_convention attributes are only meant diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 9a2687a..2b8f733 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -963,7 +963,7 @@ fold_undefer_overflow_warnings (bool issue, const_gimple stmt, int code) if (fold_deferred_overflow_warning != NULL && code != 0 && code < (int) fold_deferred_overflow_code) - fold_deferred_overflow_code = code; + fold_deferred_overflow_code = (enum warn_strict_overflow_code) code; return; } @@ -2935,7 +2935,7 @@ combine_comparisons (enum tree_code code, enum tree_code lcode, bool honor_nans = HONOR_NANS (TYPE_MODE (TREE_TYPE (ll_arg))); enum comparison_code lcompcode = comparison_to_compcode (lcode); enum comparison_code rcompcode = comparison_to_compcode (rcode); - enum comparison_code compcode; + int compcode; switch (code) { @@ -3001,8 +3001,12 @@ combine_comparisons (enum tree_code code, enum tree_code lcode, else if (compcode == COMPCODE_FALSE) return constant_boolean_node (false, truth_type); else - return fold_build2 (compcode_to_comparison (compcode), - truth_type, ll_arg, lr_arg); + { + enum tree_code tcode; + + tcode = compcode_to_comparison ((enum comparison_code) compcode); + return fold_build2 (tcode, truth_type, ll_arg, lr_arg); + } } /* Return nonzero if two operands (typically of the same tree node) diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 769f3c4..9957579 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,21 @@ +2009-04-24 Ian Lance Taylor + + * gfortran.h (enum gfc_symbol_type): New named enum type, broken + out of struct gfc_symbol. + (struct gfc_symbol): Use enum gfc_symbol_type. + (enum gfc_array_ref_dimen_type): New named enum type, broken out + of struct gfc_array_ref). + (struct gfc_array_ref): Use enum gfc_array_ref_dimen_type. + (mod_pointee_as): Update declaration. + * decl.c (add_global_entry): Change type to enum gfc_symbol_type. + (gfc_mod_pointee_as): Change return type to "match". + * module.c (mio_array_ref): Add cast to enum type. + (mio_symbol): Likewise. + * resolve.c (resolve_global_procedure): Change type to enum + gfc_symbol_type. + * trans-io.c (gfc_build_st_parameter): Change type to unsigned + int. + 2009-04-24 Daniel Kraft * gfortran.h (gfc_get_typebound_proc): Removed as macro, now a function. diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index 1a2e845..1a8d6dc 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -1,5 +1,5 @@ /* Declaration statement matcher - Copyright (C) 2002, 2004, 2005, 2006, 2007, 2008 + Copyright (C) 2002, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. Contributed by Andy Vaught @@ -4610,7 +4610,7 @@ static bool add_global_entry (const char *name, int sub) { gfc_gsymbol *s; - unsigned int type; + enum gfc_symbol_type type; s = gfc_get_gsymbol(name); type = sub ? GSYM_SUBROUTINE : GSYM_FUNCTION; @@ -6629,7 +6629,7 @@ gfc_match_derived_decl (void) is the case. Since there is no bounds-checking for Cray Pointees, this will be okay. */ -gfc_try +match gfc_mod_pointee_as (gfc_array_spec *as) { as->cray_pointee = true; /* This will be useful to know later. */ diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h index 875be95..c404954 100644 --- a/gcc/fortran/gfortran.h +++ b/gcc/fortran/gfortran.h @@ -1322,6 +1322,12 @@ extern gfc_namespace *gfc_global_ns_list; this to detect collisions already when parsing. TODO: Extend to verify procedure calls. */ +enum gfc_symbol_type +{ + GSYM_UNKNOWN=1, GSYM_PROGRAM, GSYM_FUNCTION, GSYM_SUBROUTINE, + GSYM_MODULE, GSYM_COMMON, GSYM_BLOCK_DATA +}; + typedef struct gfc_gsymbol { BBT_HEADER(gfc_gsymbol); @@ -1330,8 +1336,7 @@ typedef struct gfc_gsymbol const char *sym_name; const char *mod_name; const char *binding_label; - enum { GSYM_UNKNOWN=1, GSYM_PROGRAM, GSYM_FUNCTION, GSYM_SUBROUTINE, - GSYM_MODULE, GSYM_COMMON, GSYM_BLOCK_DATA } type; + enum gfc_symbol_type type; int defined, used; locus where; @@ -1356,6 +1361,12 @@ extern gfc_interface_info current_interface; /* Array reference. */ + +enum gfc_array_ref_dimen_type +{ + DIMEN_ELEMENT = 1, DIMEN_RANGE, DIMEN_VECTOR, DIMEN_UNKNOWN +}; + typedef struct gfc_array_ref { ar_type type; @@ -1367,9 +1378,7 @@ typedef struct gfc_array_ref struct gfc_expr *start[GFC_MAX_DIMENSIONS], *end[GFC_MAX_DIMENSIONS], *stride[GFC_MAX_DIMENSIONS]; - enum - { DIMEN_ELEMENT = 1, DIMEN_RANGE, DIMEN_VECTOR, DIMEN_UNKNOWN } - dimen_type[GFC_MAX_DIMENSIONS]; + enum gfc_array_ref_dimen_type dimen_type[GFC_MAX_DIMENSIONS]; struct gfc_expr *offset; } @@ -2270,7 +2279,7 @@ gfc_try gfc_add_optional (symbol_attribute *, locus *); gfc_try gfc_add_pointer (symbol_attribute *, locus *); gfc_try gfc_add_cray_pointer (symbol_attribute *, locus *); gfc_try gfc_add_cray_pointee (symbol_attribute *, locus *); -gfc_try gfc_mod_pointee_as (gfc_array_spec *); +match gfc_mod_pointee_as (gfc_array_spec *); gfc_try gfc_add_protected (symbol_attribute *, const char *, locus *); gfc_try gfc_add_result (symbol_attribute *, const char *, locus *); gfc_try gfc_add_save (symbol_attribute *, const char *, locus *); diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c index 12ac966..86db7aa 100644 --- a/gcc/fortran/module.c +++ b/gcc/fortran/module.c @@ -2162,7 +2162,7 @@ mio_array_ref (gfc_array_ref *ar) for (i = 0; i < ar->dimen; i++) { require_atom (ATOM_INTEGER); - ar->dimen_type[i] = atom_int; + ar->dimen_type[i] = (enum gfc_array_ref_dimen_type) atom_int; } } @@ -3462,7 +3462,7 @@ mio_symbol (gfc_symbol *sym) else { mio_integer (&intmod); - sym->from_intmod = intmod; + sym->from_intmod = (intmod_id) intmod; } mio_integer (&(sym->intmod_sym_id)); diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 3277475..7507869 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -1642,7 +1642,7 @@ resolve_global_procedure (gfc_symbol *sym, locus *where, { gfc_gsymbol * gsym; gfc_namespace *ns; - unsigned int type; + enum gfc_symbol_type type; type = sub ? GSYM_SUBROUTINE : GSYM_FUNCTION; diff --git a/gcc/fortran/trans-io.c b/gcc/fortran/trans-io.c index b8ff5f3..d2b47a4 100644 --- a/gcc/fortran/trans-io.c +++ b/gcc/fortran/trans-io.c @@ -1,5 +1,5 @@ /* IO Code translation/library interface - Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 + Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. Contributed by Paul Brook @@ -153,7 +153,7 @@ static stmtblock_t *dt_post_end_block; static void gfc_build_st_parameter (enum ioparam_type ptype, tree *types) { - enum iofield type; + unsigned int type; gfc_st_parameter_field *p; char name[64]; size_t len; @@ -2245,4 +2245,3 @@ gfc_trans_transfer (gfc_code * code) } #include "gt-fortran-trans-io.h" - diff --git a/gcc/genrecog.c b/gcc/genrecog.c index 004fbf8..02006e2 100644 --- a/gcc/genrecog.c +++ b/gcc/genrecog.c @@ -1243,7 +1243,7 @@ maybe_both_true_2 (struct decision_test *d1, struct decision_test *d2) else if (d2->type == DT_pred && d2->u.pred.data) { bool common = false; - enum rtx_code c; + int c; for (c = 0; c < NUM_RTX_CODE; c++) if (d1->u.pred.data->codes[c] && d2->u.pred.data->codes[c]) @@ -1921,7 +1921,8 @@ write_switch (struct decision *start, int depth) while (p && p->tests->type == DT_pred && p->tests->u.pred.data) { const struct pred_data *data = p->tests->u.pred.data; - RTX_CODE c; + int c; + for (c = 0; c < NUM_RTX_CODE; c++) if (codemap[c] && data->codes[c]) goto pred_done; @@ -1930,7 +1931,7 @@ write_switch (struct decision *start, int depth) if (data->codes[c]) { fputs (" case ", stdout); - print_code (c); + print_code ((enum rtx_code) c); fputs (":\n", stdout); codemap[c] = 1; } diff --git a/gcc/gimplify.c b/gcc/gimplify.c index e491a85..870cd1b 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -5902,7 +5902,8 @@ static enum gimplify_status gimplify_omp_for (tree *expr_p, gimple_seq *pre_p) { tree for_stmt, decl, var, t; - enum gimplify_status ret = GS_OK; + enum gimplify_status ret = GS_ALL_DONE; + enum gimplify_status tret; gimple gfor; gimple_seq for_body, for_pre_body; int i; @@ -5952,8 +5953,9 @@ gimplify_omp_for (tree *expr_p, gimple_seq *pre_p) else var = decl; - ret |= gimplify_expr (&TREE_OPERAND (t, 1), &for_pre_body, NULL, + tret = gimplify_expr (&TREE_OPERAND (t, 1), &for_pre_body, NULL, is_gimple_val, fb_rvalue); + ret = MIN (ret, tret); if (ret == GS_ERROR) return ret; @@ -5962,8 +5964,9 @@ gimplify_omp_for (tree *expr_p, gimple_seq *pre_p) gcc_assert (COMPARISON_CLASS_P (t)); gcc_assert (TREE_OPERAND (t, 0) == decl); - ret |= gimplify_expr (&TREE_OPERAND (t, 1), &for_pre_body, NULL, + tret = gimplify_expr (&TREE_OPERAND (t, 1), &for_pre_body, NULL, is_gimple_val, fb_rvalue); + ret = MIN (ret, tret); /* Handle OMP_FOR_INCR. */ t = TREE_VEC_ELT (OMP_FOR_INCR (for_stmt), i); @@ -6010,8 +6013,9 @@ gimplify_omp_for (tree *expr_p, gimple_seq *pre_p) gcc_unreachable (); } - ret |= gimplify_expr (&TREE_OPERAND (t, 1), &for_pre_body, NULL, + tret = gimplify_expr (&TREE_OPERAND (t, 1), &for_pre_body, NULL, is_gimple_val, fb_rvalue); + ret = MIN (ret, tret); break; default: @@ -6396,7 +6400,8 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, } /* Do any language-specific gimplification. */ - ret = lang_hooks.gimplify_expr (expr_p, pre_p, post_p); + ret = ((enum gimplify_status) + lang_hooks.gimplify_expr (expr_p, pre_p, post_p)); if (ret == GS_OK) { if (*expr_p == NULL_TREE) diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c index eab3aa7..88047e4 100644 --- a/gcc/ipa-prop.c +++ b/gcc/ipa-prop.c @@ -1,5 +1,5 @@ /* Interprocedural analyses. - Copyright (C) 2005, 2007, 2008 Free Software Foundation, Inc. + Copyright (C) 2005, 2007, 2008, 2009 Free Software Foundation, Inc. This file is part of GCC. @@ -891,7 +891,7 @@ update_jump_functions_after_inlining (struct cgraph_edge *cs, /* We must check range due to calls with variable number of arguments: */ if (dst->value.formal_id >= (unsigned) ipa_get_cs_argument_count (top)) { - dst->type = IPA_BOTTOM; + dst->type = IPA_JF_UNKNOWN; continue; } diff --git a/gcc/ira.c b/gcc/ira.c index df5e795..1b8c84b 100644 --- a/gcc/ira.c +++ b/gcc/ira.c @@ -503,8 +503,7 @@ setup_alloc_regs (bool use_hard_frame_p) static void setup_class_subset_and_memory_move_costs (void) { - int cl, cl2; - enum machine_mode mode; + int cl, cl2, mode; HARD_REG_SET temp_hard_regset2; for (mode = 0; mode < MAX_MACHINE_MODE; mode++) @@ -516,9 +515,11 @@ setup_class_subset_and_memory_move_costs (void) for (mode = 0; mode < MAX_MACHINE_MODE; mode++) { ira_memory_move_cost[mode][cl][0] = - MEMORY_MOVE_COST (mode, (enum reg_class) cl, 0); + MEMORY_MOVE_COST ((enum machine_mode) mode, + (enum reg_class) cl, 0); ira_memory_move_cost[mode][cl][1] = - MEMORY_MOVE_COST (mode, (enum reg_class) cl, 1); + MEMORY_MOVE_COST ((enum machine_mode) mode, + (enum reg_class) cl, 1); /* Costs for NO_REGS are used in cost calculation on the 1st pass when the preferred register classes are not known yet. In this case we take the best scenario. */ @@ -727,9 +728,8 @@ int ira_important_class_nums[N_REG_CLASSES]; static void setup_cover_and_important_classes (void) { - int i, j, n; + int i, j, n, cl; bool set_p, eq_p; - enum reg_class cl; const enum reg_class *cover_classes; HARD_REG_SET temp_hard_regset2; static enum reg_class classes[LIM_REG_CLASSES + 1]; @@ -743,7 +743,7 @@ setup_cover_and_important_classes (void) else { for (i = 0; (cl = cover_classes[i]) != LIM_REG_CLASSES; i++) - classes[i] = cl; + classes[i] = (enum reg_class) cl; classes[i] = LIM_REG_CLASSES; } @@ -756,7 +756,7 @@ setup_cover_and_important_classes (void) continue; #ifdef CONSTRAINT__LIMIT for (j = 0; j < CONSTRAINT__LIMIT; j++) - if ((int) regclass_for_constraint (j) == i) + if ((int) regclass_for_constraint ((enum constraint_num) j) == i) break; if (j < CONSTRAINT__LIMIT) { @@ -778,7 +778,7 @@ setup_cover_and_important_classes (void) break; } if (j >= i) - classes[n++] = i; + classes[n++] = (enum reg_class) i; } classes[n] = LIM_REG_CLASSES; } @@ -788,12 +788,12 @@ setup_cover_and_important_classes (void) { for (j = 0; j < i; j++) if (flag_ira_algorithm != IRA_ALGORITHM_PRIORITY - && reg_classes_intersect_p (cl, classes[j])) + && reg_classes_intersect_p ((enum reg_class) cl, classes[j])) gcc_unreachable (); COPY_HARD_REG_SET (temp_hard_regset, reg_class_contents[cl]); AND_COMPL_HARD_REG_SET (temp_hard_regset, no_unit_alloc_regs); if (! hard_reg_set_empty_p (temp_hard_regset)) - ira_reg_class_cover[ira_reg_class_cover_size++] = cl; + ira_reg_class_cover[ira_reg_class_cover_size++] = (enum reg_class) cl; } ira_important_classes_num = 0; for (cl = 0; cl < N_REG_CLASSES; cl++) @@ -810,7 +810,7 @@ setup_cover_and_important_classes (void) COPY_HARD_REG_SET (temp_hard_regset2, reg_class_contents[ira_reg_class_cover[j]]); AND_COMPL_HARD_REG_SET (temp_hard_regset2, no_unit_alloc_regs); - if (cl == ira_reg_class_cover[j]) + if ((enum reg_class) cl == ira_reg_class_cover[j]) { eq_p = false; set_p = true; @@ -826,7 +826,8 @@ setup_cover_and_important_classes (void) if (set_p && ! eq_p) { ira_important_class_nums[cl] = ira_important_classes_num; - ira_important_classes[ira_important_classes_num++] = cl; + ira_important_classes[ira_important_classes_num++] = + (enum reg_class) cl; } } } @@ -841,8 +842,8 @@ enum reg_class ira_class_translate[N_REG_CLASSES]; static void setup_class_translate (void) { - enum reg_class cl, cover_class, best_class, *cl_ptr; - enum machine_mode mode; + int cl, mode; + enum reg_class cover_class, best_class, *cl_ptr; int i, cost, min_cost, best_cost; for (cl = 0; cl < N_REG_CLASSES; cl++) @@ -1225,7 +1226,7 @@ ira_init_register_move_cost (enum machine_mode mode) void ira_init_once (void) { - enum machine_mode mode; + int mode; for (mode = 0; mode < MAX_MACHINE_MODE; mode++) { @@ -1241,7 +1242,7 @@ ira_init_once (void) static void free_register_move_costs (void) { - enum machine_mode mode; + int mode; for (mode = 0; mode < MAX_MACHINE_MODE; mode++) { @@ -1311,9 +1312,9 @@ setup_prohibited_mode_move_regs (void) if (! HARD_REGNO_MODE_OK (j, (enum machine_mode) i)) continue; SET_REGNO (test_reg1, j); - PUT_MODE (test_reg1, i); + PUT_MODE (test_reg1, (enum machine_mode) i); SET_REGNO (test_reg2, j); - PUT_MODE (test_reg2, i); + PUT_MODE (test_reg2, (enum machine_mode) i); INSN_CODE (move_insn) = -1; recog_memoized (move_insn); if (INSN_CODE (move_insn) < 0) diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 364ddb3..f4f8a2a 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,7 @@ +2009-04-24 Ian Lance Taylor + + * jcf-parse.c (handle_constant): Add cast to enum type. + 2009-04-21 Taras Glek * builtins.c: Update GTY annotations to new syntax diff --git a/gcc/java/jcf-parse.c b/gcc/java/jcf-parse.c index 42b53c8..e3b9331 100644 --- a/gcc/java/jcf-parse.c +++ b/gcc/java/jcf-parse.c @@ -1,6 +1,6 @@ /* Parser for Java(TM) .class files. Copyright (C) 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, - 2005, 2006, 2007, 2008 Free Software Foundation, Inc. + 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. This file is part of GCC. @@ -507,7 +507,7 @@ handle_constant (JCF *jcf, int index, enum cpool_tag purpose) if (! CPOOL_INDEX_IN_RANGE (&jcf->cpool, index)) error ("", index); - kind = JPOOL_TAG (jcf, index); + kind = (enum cpool_tag) JPOOL_TAG (jcf, index); if ((kind & ~CONSTANT_ResolvedFlag) != purpose) { diff --git a/gcc/langhooks.c b/gcc/langhooks.c index 1964137..fa9b8dd 100644 --- a/gcc/langhooks.c +++ b/gcc/langhooks.c @@ -530,9 +530,10 @@ add_builtin_function_common (const char *name, DECL_EXTERNAL (decl) = 1; DECL_BUILT_IN_CLASS (decl) = cl; - DECL_FUNCTION_CODE (decl) = -1; - gcc_assert (DECL_FUNCTION_CODE (decl) >= function_code); - DECL_FUNCTION_CODE (decl) = function_code; + DECL_FUNCTION_CODE (decl) = (enum built_in_function) function_code; + + /* DECL_FUNCTION_CODE is a bitfield; verify that the value fits. */ + gcc_assert (DECL_FUNCTION_CODE (decl) == function_code); if (library_name) { diff --git a/gcc/mcf.c b/gcc/mcf.c index 9d3d769..30f3070 100644 --- a/gcc/mcf.c +++ b/gcc/mcf.c @@ -1,6 +1,6 @@ /* Routines to implement minimum-cost maximal flow algorithm used to smooth basic block and edge frequency counts. - Copyright (C) 2008 + Copyright (C) 2008, 2009 Free Software Foundation, Inc. Contributed by Paul Yuan (yingbo.com@gmail.com) and Vinodha Ramasamy (vinodha@google.com). @@ -388,8 +388,9 @@ add_edge (fixup_graph_type *fixup_graph, int src, int dest, gcov_type cost) MAX_CAPACITY to the edge_list in the fixup graph. */ static void -add_fixup_edge (fixup_graph_type *fixup_graph, int src, int dest, int type, - gcov_type weight, gcov_type cost, gcov_type max_capacity) +add_fixup_edge (fixup_graph_type *fixup_graph, int src, int dest, + edge_type type, gcov_type weight, gcov_type cost, + gcov_type max_capacity) { fixup_edge_p curr_edge = add_edge(fixup_graph, src, dest, cost); curr_edge->type = type; diff --git a/gcc/objc/ChangeLog b/gcc/objc/ChangeLog index 9a9c875..1dea528 100644 --- a/gcc/objc/ChangeLog +++ b/gcc/objc/ChangeLog @@ -1,3 +1,8 @@ +2009-04-24 Ian Lance Taylor + + * objc-act.c (get_super_receiver): Update calls to + build_modify_expr to pass new argument. + 2009-04-21 Taras Glek * objc-act.c: Update GTY annotations to new syntax diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c index d3c5a19..89048e0 100644 --- a/gcc/objc/objc-act.c +++ b/gcc/objc/objc-act.c @@ -8740,9 +8740,8 @@ get_super_receiver (void) /* Set receiver to self. */ super_expr = objc_build_component_ref (UOBJC_SUPER_decl, self_id); - super_expr = build_modify_expr (input_location, - super_expr, NOP_EXPR, self_decl, - NULL_TREE); + super_expr = build_modify_expr (input_location, super_expr, NULL_TREE, + NOP_EXPR, self_decl, NULL_TREE); super_expr_list = super_expr; /* Set class to begin searching. */ @@ -8754,7 +8753,8 @@ get_super_receiver (void) /* [_cls, __cls]Super are "pre-built" in synth_forward_declarations. */ - super_expr = build_modify_expr (input_location, super_expr, NOP_EXPR, + super_expr = build_modify_expr (input_location, super_expr, + NULL_TREE, NOP_EXPR, ((TREE_CODE (objc_method_context) == INSTANCE_METHOD_DECL) ? ucls_super_ref @@ -8807,7 +8807,8 @@ get_super_receiver (void) } super_expr - = build_modify_expr (input_location, super_expr, NOP_EXPR, + = build_modify_expr (input_location, super_expr, NULL_TREE, + NOP_EXPR, build_c_cast (TREE_TYPE (super_expr), super_class), NULL_TREE); diff --git a/gcc/omega.c b/gcc/omega.c index 1a8b37f..af3bd84 100644 --- a/gcc/omega.c +++ b/gcc/omega.c @@ -5,7 +5,7 @@ This code has no license restrictions, and is considered public domain. - Changes copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, + Changes copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. Contributed by Sebastian Pop @@ -3048,7 +3048,8 @@ omega_do_elimination (omega_pb pb, int e, int i) eqn->coef[j] *= a; k = eqn->coef[i]; eqn->coef[i] = 0; - eqn->color |= sub->color; + if (sub->color == omega_red) + eqn->color = omega_red; for (j = n_vars; j >= 0; j--) eqn->coef[j] -= sub->coef[j] * k / c; } diff --git a/gcc/optabs.c b/gcc/optabs.c index a8a6f48..8bf8fa7 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -822,7 +822,7 @@ expand_vec_shift_expr (tree vec_shift_expr, rtx target) gcc_unreachable (); } - icode = (int) optab_handler (shift_optab, mode)->insn_code; + icode = optab_handler (shift_optab, mode)->insn_code; gcc_assert (icode != CODE_FOR_nothing); mode1 = insn_data[icode].operand[1].mode; @@ -4253,7 +4253,7 @@ emit_cmp_and_jump_insn_1 (rtx x, rtx y, enum machine_mode mode, } /* Handle some compares against zero. */ - icode = (int) optab_handler (tst_optab, optab_mode)->insn_code; + icode = optab_handler (tst_optab, optab_mode)->insn_code; if (y == CONST0_RTX (mode) && icode != CODE_FOR_nothing) { x = prepare_operand (icode, x, 0, mode, wider_mode, unsignedp); @@ -4265,7 +4265,7 @@ emit_cmp_and_jump_insn_1 (rtx x, rtx y, enum machine_mode mode, /* Handle compares for which there is a directly suitable insn. */ - icode = (int) optab_handler (cmp_optab, optab_mode)->insn_code; + icode = optab_handler (cmp_optab, optab_mode)->insn_code; if (icode != CODE_FOR_nothing) { x = prepare_operand (icode, x, 0, mode, wider_mode, unsignedp); diff --git a/gcc/opts.c b/gcc/opts.c index f047fc3..8e382d5 100644 --- a/gcc/opts.c +++ b/gcc/opts.c @@ -2229,15 +2229,17 @@ set_debug_level (enum debug_info_type type, int extended, const char *arg) if (*arg == '\0') { if (!debug_info_level) - debug_info_level = 2; + debug_info_level = DINFO_LEVEL_NORMAL; } else { - debug_info_level = integral_argument (arg); - if (debug_info_level == (unsigned int) -1) + int argval = integral_argument (arg); + if (argval == -1) error ("unrecognised debug output level \"%s\"", arg); - else if (debug_info_level > 3) + else if (argval > 3) error ("debug output level %s is too high", arg); + else + debug_info_level = (enum debug_info_level) argval; } } diff --git a/gcc/regmove.c b/gcc/regmove.c index 53618b2..52ce833 100644 --- a/gcc/regmove.c +++ b/gcc/regmove.c @@ -188,7 +188,7 @@ try_auto_increment (rtx insn, rtx inc_insn, rtx inc_insn_set, rtx reg, changed. */ rtx note = find_reg_note (insn, REG_DEAD, reg); if (note) - PUT_MODE (note, REG_UNUSED); + PUT_REG_NOTE_KIND (note, REG_UNUSED); add_reg_note (insn, REG_INC, reg); diff --git a/gcc/reload.c b/gcc/reload.c index 6181224..fb87a158 100644 --- a/gcc/reload.c +++ b/gcc/reload.c @@ -363,7 +363,7 @@ push_secondary_reload (int in_p, rtx x, int opnum, int optional, sri.icode = CODE_FOR_nothing; sri.prev_sri = prev_sri; rclass = targetm.secondary_reload (in_p, x, reload_class, reload_mode, &sri); - icode = sri.icode; + icode = (enum insn_code) sri.icode; /* If we don't need any secondary registers, done. */ if (rclass == NO_REGS && icode == CODE_FOR_nothing) @@ -525,7 +525,7 @@ secondary_reload_class (bool in_p, enum reg_class rclass, sri.icode = CODE_FOR_nothing; sri.prev_sri = NULL; rclass = targetm.secondary_reload (in_p, x, rclass, mode, &sri); - icode = sri.icode; + icode = (enum insn_code) sri.icode; /* If there are no secondary reloads at all, we return NO_REGS. If an intermediate register is needed, we return its class. */ @@ -691,7 +691,7 @@ find_valid_class (enum machine_mode outer ATTRIBUTE_UNUSED, && (best_cost < 0 || best_cost >= cost)) || best_cost > cost) { - best_class = rclass; + best_class = (enum reg_class) rclass; best_size = reg_class_size[rclass]; best_cost = REGISTER_MOVE_COST (outer, (enum reg_class) rclass, dest_class); diff --git a/gcc/reload1.c b/gcc/reload1.c index d31578d..e3ca42e 100644 --- a/gcc/reload1.c +++ b/gcc/reload1.c @@ -7090,9 +7090,15 @@ emit_input_reload_insns (struct insn_chain *chain, struct reload *rl, if (reload_adjust_reg_for_icode (&second_reload_reg, third_reload_reg, (enum insn_code) sri.icode)) - icode = sri.icode, third_reload_reg = 0; + { + icode = (enum insn_code) sri.icode; + third_reload_reg = 0; + } else - oldequiv = old, real_oldequiv = real_old; + { + oldequiv = old; + real_oldequiv = real_old; + } } else if (sri.icode != CODE_FOR_nothing) /* We currently lack a way to express this in reloads. */ @@ -7108,9 +7114,15 @@ emit_input_reload_insns (struct insn_chain *chain, struct reload *rl, if (reload_adjust_reg_for_temp (&second_reload_reg, third_reload_reg, new_class, mode)) - third_reload_reg = 0, tertiary_icode = sri2.icode; + { + third_reload_reg = 0; + tertiary_icode = (enum insn_code) sri2.icode; + } else - oldequiv = old, real_oldequiv = real_old; + { + oldequiv = old; + real_oldequiv = real_old; + } } else if (new_t_class == NO_REGS && sri2.icode != CODE_FOR_nothing) { @@ -7123,10 +7135,13 @@ emit_input_reload_insns (struct insn_chain *chain, struct reload *rl, sri2.icode))) { second_reload_reg = intermediate; - tertiary_icode = sri2.icode; + tertiary_icode = (enum insn_code) sri2.icode; } else - oldequiv = old, real_oldequiv = real_old; + { + oldequiv = old; + real_oldequiv = real_old; + } } else if (new_t_class != NO_REGS && sri2.icode == CODE_FOR_nothing) { @@ -7138,14 +7153,20 @@ emit_input_reload_insns (struct insn_chain *chain, struct reload *rl, new_t_class, mode)) { second_reload_reg = intermediate; - tertiary_icode = sri2.icode; + tertiary_icode = (enum insn_code) sri2.icode; } else - oldequiv = old, real_oldequiv = real_old; + { + oldequiv = old; + real_oldequiv = real_old; + } } else - /* This could be handled more intelligently too. */ - oldequiv = old, real_oldequiv = real_old; + { + /* This could be handled more intelligently too. */ + oldequiv = old; + real_oldequiv = real_old; + } } } diff --git a/gcc/rtl.h b/gcc/rtl.h index b93c129..98fb290 100644 --- a/gcc/rtl.h +++ b/gcc/rtl.h @@ -880,8 +880,8 @@ extern const char * const reg_note_name[]; /* Initialization status of the variable in the location. Status can be unknown, uninitialized or initialized. See enumeration type below. */ -#define NOTE_VAR_LOCATION_STATUS(INSN) (XCINT (XCEXP (INSN, 4, NOTE), \ - 2, VAR_LOCATION)) +#define NOTE_VAR_LOCATION_STATUS(INSN) \ + ((enum var_init_status) (XCINT (XCEXP (INSN, 4, NOTE), 2, VAR_LOCATION))) /* Possible initialization status of a variable. When requested by the user, this information is tracked and recorded in the DWARF diff --git a/gcc/sel-sched-ir.c b/gcc/sel-sched-ir.c index 45a50d9..168b01f 100644 --- a/gcc/sel-sched-ir.c +++ b/gcc/sel-sched-ir.c @@ -1,5 +1,5 @@ /* Instruction scheduling pass. Selective scheduler and pipeliner. - Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc. + Copyright (C) 2006, 2007, 2008, 2009 Free Software Foundation, Inc. This file is part of GCC. @@ -1108,7 +1108,7 @@ hash_with_unspec_callback (const_rtx x, enum machine_mode mode ATTRIBUTE_UNUSED, && targetm.sched.skip_rtx_p (x)) { *nx = XVECEXP (x, 0 ,0); - *nmode = 0; + *nmode = VOIDmode; return 1; } diff --git a/gcc/sel-sched.c b/gcc/sel-sched.c index a75ed04..e524d02 100644 --- a/gcc/sel-sched.c +++ b/gcc/sel-sched.c @@ -1169,7 +1169,7 @@ static void init_hard_regs_data (void) { int cur_reg = 0; - enum machine_mode cur_mode = 0; + int cur_mode = 0; CLEAR_HARD_REG_SET (sel_hrd.regs_ever_used); for (cur_reg = 0; cur_reg < FIRST_PSEUDO_REGISTER; cur_reg++) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index bbe7fba..b4ec0dd 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2009-04-24 Ian Lance Taylor + + * gcc.dg/Wcxx-compat-4.c: New testcase. + 2009-04-24 Daniel Kraft * gfortran.dg/typebound_generic_1.f03: Change so that no error is diff --git a/gcc/testsuite/gcc.dg/Wcxx-compat-4.c b/gcc/testsuite/gcc.dg/Wcxx-compat-4.c new file mode 100644 index 0000000..a294ffe --- /dev/null +++ b/gcc/testsuite/gcc.dg/Wcxx-compat-4.c @@ -0,0 +1,49 @@ +/* { dg-do compile } */ +/* { dg-options "-Wc++-compat" } */ +enum E1 { A, B, C }; +enum E2 { D, E, F }; + +enum E1 g1; +enum E2 g2; + +void +f1 () +{ + int a; + int d; + enum E1 e1; + enum E2 e2; + a = A; + a = !B; + d = E; + e1 = A; + e1 = D; /* { dg-warning "invalid in C\[+\]\[+\]" } */ + e1 = 0; /* { dg-warning "invalid in C\[+\]\[+\]" } */ + e1 = (enum E1) 0; + e1 = (enum E2) 0; /* { dg-warning "invalid in C\[+\]\[+\]" } */ + e1 = e2; /* { dg-warning "invalid in C\[+\]\[+\]" } */ + e1 = g1; + e1 = g2; /* { dg-warning "invalid in C\[+\]\[+\]" } */ + e2 = A; /* { dg-warning "invalid in C\[+\]\[+\]" } */ + e2 = D; +} + +struct s { enum E1 e1 : 3; }; + +void +f2 (struct s sv) +{ + sv.e1 = A; + sv.e1 = D; /* { dg-warning "invalid in C\[+\]\[+\]" } */ + g1 = sv.e1; + g2 = sv.e1; /* { dg-warning "invalid in C\[+\]\[+\]" } */ +} + +void +f3 (struct s *pv) +{ + pv->e1 = A; + pv->e1 = D; /* { dg-warning "invalid in C\[+\]\[+\]" } */ + g1 = pv->e1; + g2 = pv->e1; /* { dg-warning "invalid in C\[+\]\[+\]" } */ +} diff --git a/gcc/tree-complex.c b/gcc/tree-complex.c index 931d030..7dbc63a 100644 --- a/gcc/tree-complex.c +++ b/gcc/tree-complex.c @@ -38,13 +38,17 @@ along with GCC; see the file COPYING3. If not see out whether a complex number is degenerate in some way, having only real or only complex parts. */ -typedef enum +enum { UNINITIALIZED = 0, ONLY_REAL = 1, ONLY_IMAG = 2, VARYING = 3 -} complex_lattice_t; +}; + +/* The type complex_lattice_t holds combinations of the above + constants. */ +typedef int complex_lattice_t; #define PAIR(a, b) ((a) << 2 | (b)) @@ -945,9 +949,11 @@ expand_complex_libcall (gimple_stmt_iterator *gsi, tree ar, tree ai, gcc_assert (GET_MODE_CLASS (mode) == MODE_COMPLEX_FLOAT); if (code == MULT_EXPR) - bcode = BUILT_IN_COMPLEX_MUL_MIN + mode - MIN_MODE_COMPLEX_FLOAT; + bcode = ((enum built_in_function) + (BUILT_IN_COMPLEX_MUL_MIN + mode - MIN_MODE_COMPLEX_FLOAT)); else if (code == RDIV_EXPR) - bcode = BUILT_IN_COMPLEX_DIV_MIN + mode - MIN_MODE_COMPLEX_FLOAT; + bcode = ((enum built_in_function) + (BUILT_IN_COMPLEX_DIV_MIN + mode - MIN_MODE_COMPLEX_FLOAT)); else gcc_unreachable (); fn = built_in_decls[bcode]; diff --git a/gcc/tree-into-ssa.c b/gcc/tree-into-ssa.c index db1af2b..938eefc 100644 --- a/gcc/tree-into-ssa.c +++ b/gcc/tree-into-ssa.c @@ -318,7 +318,7 @@ get_ssa_name_ann (tree name) info = VEC_index (ssa_name_info_p, info_for_ssa_name, ver); if (info->age < current_info_for_ssa_name_age) { - info->need_phi_state = 0; + info->need_phi_state = NEED_PHI_STATE_UNKNOWN; info->current_def = NULL_TREE; info->age = current_info_for_ssa_name_age; } diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index ee54cac..efcaaaf 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -1890,7 +1890,7 @@ vect_model_reduction_cost (stmt_vec_info stmt_info, enum tree_code reduc_code, if (!nested_in_vect_loop_p (loop, orig_stmt)) { - if (reduc_code < NUM_TREE_CODES) + if (reduc_code != ERROR_MARK) outer_cost += TARG_VEC_STMT_COST + TARG_VEC_TO_SCALAR_COST; else { @@ -2563,7 +2563,7 @@ vect_create_epilog_for_reduction (tree vect_def, gimple stmt, /* 2.3 Create the reduction code, using one of the three schemes described above. */ - if (reduc_code < NUM_TREE_CODES) + if (reduc_code != ERROR_MARK) { tree tmp; @@ -2852,7 +2852,7 @@ vectorizable_reduction (gimple stmt, gimple_stmt_iterator *gsi, tree vectype = STMT_VINFO_VECTYPE (stmt_info); loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_info); struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo); - enum tree_code code, orig_code, epilog_reduc_code = 0; + enum tree_code code, orig_code, epilog_reduc_code; enum machine_mode vec_mode; int op_type; optab optab, reduc_optab; @@ -3088,13 +3088,13 @@ vectorizable_reduction (gimple stmt, gimple_stmt_iterator *gsi, { if (vect_print_dump_info (REPORT_DETAILS)) fprintf (vect_dump, "no optab for reduction."); - epilog_reduc_code = NUM_TREE_CODES; + epilog_reduc_code = ERROR_MARK; } if (optab_handler (reduc_optab, vec_mode)->insn_code == CODE_FOR_nothing) { if (vect_print_dump_info (REPORT_DETAILS)) fprintf (vect_dump, "reduc op not supported by target."); - epilog_reduc_code = NUM_TREE_CODES; + epilog_reduc_code = ERROR_MARK; } if (!vec_stmt) /* transformation not required. */ @@ -3582,6 +3582,3 @@ vect_transform_loop (loop_vec_info loop_vinfo) if (loop->inner && vect_print_dump_info (REPORT_VECTORIZED_LOOPS)) fprintf (vect_dump, "OUTER LOOP VECTORIZED."); } - - - diff --git a/gcc/tree-vect-patterns.c b/gcc/tree-vect-patterns.c index 372f836..e9dd0a9 100644 --- a/gcc/tree-vect-patterns.c +++ b/gcc/tree-vect-patterns.c @@ -695,7 +695,7 @@ vect_pattern_recog_1 ( } else { - enum tree_code vec_mode; + enum machine_mode vec_mode; enum insn_code icode; optab optab; diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index 26748c9..ec4ba06 100644 --- a/gcc/tree-vect-stmts.c +++ b/gcc/tree-vect-stmts.c @@ -4343,7 +4343,7 @@ new_stmt_vec_info (gimple stmt, loop_vec_info loop_vinfo) STMT_VINFO_TYPE (res) = undef_vec_info_type; STMT_VINFO_STMT (res) = stmt; STMT_VINFO_LOOP_VINFO (res) = loop_vinfo; - STMT_VINFO_RELEVANT (res) = 0; + STMT_VINFO_RELEVANT (res) = vect_unused_in_loop; STMT_VINFO_LIVE_P (res) = false; STMT_VINFO_VECTYPE (res) = NULL; STMT_VINFO_VEC_STMT (res) = NULL; @@ -4365,7 +4365,7 @@ new_stmt_vec_info (gimple stmt, loop_vec_info loop_vinfo) STMT_VINFO_SAME_ALIGN_REFS (res) = VEC_alloc (dr_p, heap, 5); STMT_VINFO_INSIDE_OF_LOOP_COST (res) = 0; STMT_VINFO_OUTSIDE_OF_LOOP_COST (res) = 0; - STMT_SLP_TYPE (res) = 0; + STMT_SLP_TYPE (res) = loop_vect; DR_GROUP_FIRST_DR (res) = NULL; DR_GROUP_NEXT_DR (res) = NULL; DR_GROUP_SIZE (res) = 0; @@ -4910,5 +4910,3 @@ supportable_narrowing_operation (enum tree_code code, *code1 = c1; return true; } - - diff --git a/gcc/tree-vectorizer.c b/gcc/tree-vectorizer.c index 2ac6a8b..7f2768e 100644 --- a/gcc/tree-vectorizer.c +++ b/gcc/tree-vectorizer.c @@ -99,9 +99,9 @@ vect_set_verbosity_level (const char *val) vl = atoi (val); if (vl < MAX_VERBOSITY_LEVEL) - vect_verbosity_level = vl; + vect_verbosity_level = (enum verbosity_levels) vl; else - vect_verbosity_level = MAX_VERBOSITY_LEVEL - 1; + vect_verbosity_level = (enum verbosity_levels) (MAX_VERBOSITY_LEVEL - 1); } diff --git a/gcc/tree.c b/gcc/tree.c index bcb8a0c..0b02377 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -1,6 +1,6 @@ /* Language-independent node constructors for parse phase of GNU compiler. Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 + 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. This file is part of GCC. @@ -7850,8 +7850,10 @@ build_common_builtin_nodes (void) tmp = tree_cons (NULL_TREE, inner_type, tmp); ftype = build_function_type (type, tmp); - mcode = BUILT_IN_COMPLEX_MUL_MIN + mode - MIN_MODE_COMPLEX_FLOAT; - dcode = BUILT_IN_COMPLEX_DIV_MIN + mode - MIN_MODE_COMPLEX_FLOAT; + mcode = ((enum built_in_function) + (BUILT_IN_COMPLEX_MUL_MIN + mode - MIN_MODE_COMPLEX_FLOAT)); + dcode = ((enum built_in_function) + (BUILT_IN_COMPLEX_DIV_MIN + mode - MIN_MODE_COMPLEX_FLOAT)); for (p = GET_MODE_NAME (mode), q = mode_name_buf; *p; p++, q++) *q = TOLOWER (*p); diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c index b9ff8c5..c4c3f3e 100644 --- a/gcc/var-tracking.c +++ b/gcc/var-tracking.c @@ -1,5 +1,5 @@ /* Variable tracking routines for the GNU compiler. - Copyright (C) 2002, 2003, 2004, 2005, 2007, 2008 + Copyright (C) 2002, 2003, 2004, 2005, 2007, 2008, 2009 Free Software Foundation, Inc. This file is part of GCC. @@ -871,13 +871,13 @@ var_reg_set (dataflow_set *set, rtx loc, enum var_init_status initialized, set_variable_part (set, loc, decl, offset, initialized, set_src); } -static int +static enum var_init_status get_init_value (dataflow_set *set, rtx loc, tree decl) { void **slot; variable var; int i; - int ret_val = VAR_INIT_STATUS_UNKNOWN; + enum var_init_status ret_val = VAR_INIT_STATUS_UNKNOWN; if (! flag_var_tracking_uninit) return VAR_INIT_STATUS_INITIALIZED; @@ -3445,4 +3445,3 @@ struct rtl_opt_pass pass_variable_tracking = TODO_dump_func | TODO_verify_rtl_sharing/* todo_flags_finish */ } }; - diff --git a/gcc/vec.h b/gcc/vec.h index e242baa..6c79df0 100644 --- a/gcc/vec.h +++ b/gcc/vec.h @@ -1,5 +1,5 @@ /* Vector API for GNU compiler. - Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. + Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation, Inc. Contributed by Nathan Sidwell This file is part of GCC. @@ -558,7 +558,7 @@ static inline int VEC_OP (T,base,iterate) \ } \ else \ { \ - *ptr = 0; \ + *ptr = (T) 0; \ return 0; \ } \ } \ -- 2.7.4