aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-typeck.c
AgeCommit message (Collapse)AuthorFilesLines
2005-06-29c-tree.h (default_function_array_conversion): Take and return struct c_expr.Joseph Myers1-94/+113
* c-tree.h (default_function_array_conversion): Take and return struct c_expr. * c-typeck.c (default_function_array_conversion): Split into array_to_pointer_conversion and function_to_pointer_conversion. Take and return struct c_expr. (array_to_pointer_conversion): Do not handle type qualifiers or COMPOUND_EXPRs specially. (build_function_call): Call function_to_pointer_conversion for function designators. (build_unary_op): Call array_to_pointer_conversion, not default_function_array_conversion. (digest_init, output_init_element): Likewise. * c-parser.c: All callers of default_function_array_conversion changed. From-SVN: r101440
2005-06-28target.h (invalid_conversion, [...]): New hooks.Joseph Myers1-0/+16
* target.h (invalid_conversion, invalid_unary_op, invalid_binary_op): New hooks. * target-def.h (TARGET_INVALID_CONVERSION, TARGET_INVALID_UNARY_OP, TARGET_INVALID_BINARY_OP, TARGET_INITIALIZER): Likewise. * hooks.h (hook_constcharptr_tree_tree_null, hook_constcharptr_int_tree_null, hook_constcharptr_int_tree_tree_null): New. * hooks.c (hook_constcharptr_tree_tree_null, hook_constcharptr_int_tree_null, hook_constcharptr_int_tree_tree_null): Likewise. * gcc/doc/tm.texi (TARGET_INVALID_CONVERSION, TARGET_INVALID_UNARY_OP, TARGET_INVALID_BINARY_OP): Document. * c-convert.c (convert): Use invalid_conversion hook. * c-typeck.c (build_unary_op): Use invalid_unary_op hook. (build_binary_op): Use invalid_binary_op hook. * config/ia64/ia64-modes.def: Define RFmode. * config/ia64/ia64-protos.h (spill_xfmode_operand): Remove. (ia64_expand_movxf_movrf): New. * config/ia64/ia64.md (movxf): Move code to ia64_expand_movxf_movrf. (movrf, movrf_internal): New. * ia64.c (ia64_invalid_conversion, ia64_invalid_unary_op, ia64_invalid_binary_op, TARGET_INVALID_CONVERSION, TARGET_INVALID_UNARY_OP, TARGET_INVALID_BINARY_OP): New. (spill_xfmode_operand): Rename to spill_xfmode_rfmode_operand. Add mode parameter. Make static. (ia64_expand_movxf_movrf): New, moved from ia64.md. Handle RFmode as well as XFmode. (ia64_function_arg, ia64_function_value, ia64_register_move_cost, ia64_scalar_mode_supported_p): Handle RFmode as well as XFmode. (ia64_init_builtins): Set up __fpreg as RFmode. (ia64_mangle_fundamental_type): Mangle __fpreg as u7__fpreg. cp: * cvt.c (ocp_convert): Use invalid_conversion hook. * typeck.c (build_binary_op): Use invalid_binary_op hook. (build_unary_op): Use invalid_unary_op hook. testsuite: * g++.dg/ext/fpreg1.C, gcc.target/ia64/fpreg-1.c, gcc.target/ia64/fpreg-2.c: New tests. From-SVN: r101391
2005-06-28c-decl.c (pop_scope): Move warning control into warning call.DJ Delorie1-31/+38
* c-decl.c (pop_scope): Move warning control into warning call. (diagnose_mismatched_decls): Likewise. (pushdecl): Likewise. (start_decl): Likewise. (grokparms): Likewise. (start_function): Likewise. (store_parm_decls_newstyle): Likewise. (store_parm_decls_oldstyle): Likewise. (finish_function): Likewise. (declspecs_add_scspec): Likewise. * c-format.c (decode_format_attr): Likewise. (maybe_read_dollar_number): Likewise. (avoid_dollar_number): Likewise. (finish_dollar_format_checking): Likewise. (check_format_info): Likewise. (check_format_info_main): Likewise. (check_format_types): Likewise. (format_type_warning): Likewise. * c-typeck.c (function_types_compatible_p): Likewise. (build_array_ref): Likewise. (convert_arguments): Likewise. (build_c_cast): Likewise. (store_init_value): Likewise. (process_init_element): Likewise. (c_start_case): Likewise. * stor-layout.c (finalize_record_size): Likewise. * tree-cfg.c (execute_warn_function_noreturn): Likewise. * tree-inline.c (expand_call_inline): Likewise. From-SVN: r101384
2005-06-26re PR c/21911 (named parameter mistakenly identified as sentinel)Kaveh R. Ghazi1-1/+2
PR c/21911 * c-common.c (check_function_sentinel): Pass in named argument list, skip over named arguments before looking for a sentinel. (check_function_arguments): Pass in named argument list. * c-common.h (check_function_arguments): Likewise. * c-typeck.c (build_function_call): Likewise. cp: * call.c (build_over_call): Pass in named argument list to `check_function_arguments'. * typeck.c (build_function_call): Likewise. testsuite: PR c/21911 * gcc.dg/format/sentinel-1.c: Update. Fix execl* calls. From-SVN: r101341
2005-06-26builtins.c, [...]: Use fold_buildN instead of fold (buildN (...)).Kazu Hirata1-4/+4
* builtins.c, c-common.c, c-convert.c, c-decl.c, c-typeck.c, convert.c, lambda-code.c, predict.c, tree-cfg.c, tree-complex.c, tree-data-ref.c, tree-if-conv.c, tree-mudflap.c, tree-scalar-evolution.c, tree-ssa-ccp.c, tree-ssa-loop-ivcanon.c, tree-ssa-loop-ivopts.c, tree-ssa-loop-manip.c, tree-ssa-phiopt.c, tree-ssa-pre.c, tree-vect-analyze.c, tree-vect-transform.c, tree-vectorizer.c, tree.c: Use fold_buildN instead of fold (buildN (...)). From-SVN: r101338
2005-06-25Update FSF address.Kelley Cook1-2/+2
From-SVN: r101317
2005-06-21c-typeck.c (build_function_call): Set fundecl = function again.Daniel Berlin1-0/+1
2005-06-20 Daniel Berlin <dberlin@dberlin.org> * c-typeck.c (build_function_call): Set fundecl = function again. * tree-ssa-alias.c (find_used_portions): Address taking causes the entire variable to be used. * tree-ssa-structalias.c (do_structure_copy): Fix handling of unknown size variables, and structure copies from addressof operations. Simplify how we do *a = *b type structure copies. (init_base_vars): Add ANYTHING = &ANYTHING constraint the right way. READONLY's address is not taken by default. INTEGER dereference should point to anything. (create_variable_info_for): It's okay for the first field to not start at 0. From-SVN: r101227
2005-06-19c-decl.c (grokdeclarator): Only check TREE_OVERFLOW on INTEGER_CST nodes.Roger Sayle1-9/+8
* c-decl.c (grokdeclarator): Only check TREE_OVERFLOW on INTEGER_CST nodes. * c-typeck.c (build_c_cast): Only preserve TREE_OVERFLOW on CONSTANT_CLASS_P nodes. From-SVN: r101187
2005-06-15c-tree.h (default_function_array_conversion): Declare.Joseph Myers1-69/+33
* c-tree.h (default_function_array_conversion): Declare. * c-typeck.c (default_function_array_conversion): Export. Correct comment. (default_conversion): Do not call default_function_array_conversion. Do not allow FUNCTION_TYPE. (build_function_call): Call default_function_array_conversion on the function. (convert_arguments): Do not call it on the function arguments. (build_unary_op): Do not allow ARRAY_TYPE or FUNCTION_TYPE for TRUTH_NOT_EXPR. Call default_function_array_conversion for taking address of ARRAY_REF. (build_compound_expr): Do not call default_function_array_conversion. (build_c_cast): Do not call default_function_array_conversion. (convert_for_assignment): Do not call default_conversion. (digest_init): Call default_function_array_conversion to convert string constants and compound literals to pointers, but not otherwise. (output_init_element): Likewise. (build_asm_expr): Do not call default_function_array_conversion. (c_process_expr_stmt): Likewise. (c_objc_common_truthvalue_conversion): Likewise. Do not allow FUNCTION_TYPE. * c-parser.c (c_parser_expression_conv): New. (c_parser_asm_operands, c_parser_expr_list): Add convert_p argument. All callers changed. Call default_function_array_conversion if convert_p. (c_parser_initializer, c_parser_initval): Call default_function_array_conversion except for string constants and compound literals. (c_parser_initelt): Call default_function_array_conversion for ObjC expression received. (c_parser_statement_after_labels): Call c_parser_expression_conv for return and expression statements. (c_parser_paren_condition, c_parser_for_statement, c_parser_conditional_expression): Call c_parser_expression_conv. (c_parser_expr_no_commas, c_parser_conditional_expression, c_parser_binary_expression, c_parser_cast_expression, c_parser_unary_expression): Call default_function_array_conversion. objc: * objc-act.c (my_build_string_pointer): New. (objc_get_class_reference, get_super_receiver): Call my_build_string_pointer instead of my_build_string when building function arguments. testsuite: * gcc.dg/noncompile/20040203-3.c: Update expected message. From-SVN: r100984
2005-06-15c-common.h (same_scalar_type_ignoring_signedness): Protoize.Aldy Hernandez1-3/+14
* c-common.h (same_scalar_type_ignoring_signedness): Protoize. * c-common.c (same_scalar_type_ignoring_signedness): New. * c-typeck.c (build_binary_op): Check compatability of vector types. Move error report after switch. Do not clobber code[01] on *_DIV_EXPR case. * testsuite/gcc.dg/simd-1.c: Update error messages. * testsuite/gcc.dg/simd-1b.c: Re-enable tests. Update error messages. * testsuite/gcc.dg/simd-2.c: Update error messages. * testsuite/gcc.dg/simd-4.c: New. From-SVN: r100976
2005-06-11c-typeck.c (convert_for_assignment): Avoid cheking OPT_Wc___compat, as it is ↵Gabriel Dos Reis1-2/+1
always true. * c-typeck.c (convert_for_assignment): Avoid cheking OPT_Wc___compat, as it is always true. From-SVN: r100843
2005-06-09re PR c/21759 (Implement warning for codes at the intersection of C and C++)Gabriel Dos Reis1-0/+12
PR c/21759 * c.opt (Wc++-compat): New. * doc/invoke.texi (-Wc++-compat): Document. * c-typeck.c (convert_for_assignment): Check for implicit conversion void* -> T*. testsuite/ * gcc.dg/Wcxx-compat-1.c: New. From-SVN: r100806
2005-06-09c-typeck.c (build_c_cast): Check type punning on COMPONENT_REF too.Nathan Sidwell1-4/+5
/: * c-typeck.c (build_c_cast): Check type punning on COMPONENT_REF too. testsuite: * gcc.dg/alias-8.c: New. From-SVN: r100799
2005-06-07c-typeck.c (c_finish_if_stmt): Use void_type_node as type for COND_EXPR.Richard Guenther1-1/+1
2005-06-07 Richard Guenther <rguenth@gcc.gnu.org> * c-typeck.c (c_finish_if_stmt): Use void_type_node as type for COND_EXPR. * gimplify.c (gimplify_cond_expr): No need to fix up the type of COND_EXPRs. From-SVN: r100705
2005-06-06exgettext: Handle gmsgid and cmsgid arguments specially, as ↵Jakub Jelinek1-45/+45
gcc-internal-format and c-format. gcc/po/ * exgettext: Handle gmsgid and cmsgid arguments specially, as gcc-internal-format and c-format. Because of xgettext bug, invoke xgettext once with --language=c, once with --language=GCC-source and then merge together. Fail if xgettext is not 0.14.5 or later. gcc/ * intl.h (G_): New macro. * rtl-error.c (error_for_asm, warning_for_asm): Use gmsgid instead of msgid for argument name. * tree-ssa.c (warn_uninit): Likewise. * c-parser.c (c_parser_error): Likewise. * config/rs6000/rs6000-c.c (SYNTAX_ERROR): Likewise. * config/darwin-c.c (BAD): Likewise. * config/c4x/c4x-c.c (BAD): Likewise. * c-pragma.c (GCC_BAD, GCC_BAD2): Likewise. * c-errors.c (pedwarn_c99, pedwarn_c90): Likewise. * c-common.c (c_parse_error): Likewise. * diagnostic.c (diagnostic_set_info, verbatim, inform, warning, warning0, pedwarn, error, sorry, fatal_error, internal_error): Likewise. (fnotice): Use cmsgid instead of msgid for argument name. * gcov.c (fnotice): Likewise. * protoize.c (notice): Likewise. * final.c (output_operand_lossage): Likewise. * gcc.c (fatal, notice): Likewise. (error): Use gmsgid instead of msgid for argument name. * collect2.c (notice, fatal_perror, fatal): Use cmsgid instead of msgid for argument name. (error): Use gmsgid instead of msgid for argument name. * c-decl.c (locate_old_decl, implicit_decl_warning): Use G_() instead of N_(). * c-typeck.c (readonly_error, convert_for_assignment): Likewise. * tree-inline.c (inline_forbidden_p_1): Likewise. * ABOUT-GCC-NLS: Require gettext 0.14.5 or later. Mention the new conventions for marking translations. * doc/install.texi: Mention gettext 0.14.5 or later requirement. gcc/cp/ * error.c (locate_error): Use gmsgid instead of msgid for argument name. (cp_error_at, cp_warning_at, cp_pedwarn_at): Likewise. gcc/java/ * jv-scan.c (fatal_error, warning, warning0): Use gmsgid instead of msgid for argument name. * gjavah.c (error): Likewise. * java-tree.h (parse_error_context): Likewise. * parse.y (parse_error_context, parse_warning_context, issue_warning_error_from_context): Likewise. From-SVN: r100676
2005-06-04re PR c/21873 (infinite warning loop on bad array initializer)Joseph Myers1-12/+20
PR c/21873 * c-typeck.c (push_init_level): Don't pop levels without braces if implicit == 1. testsuite: * gcc.dg/init-excess-1.c: New test. From-SVN: r100571
2005-06-02c-typeck.c (build_indirect_ref): Build INDIRECT_REF with correct type.Richard Guenther1-4/+1
2005-06-02 Richard Guenther <rguenth@gcc.gnu.org> * c-typeck.c (build_indirect_ref): Build INDIRECT_REF with correct type. * gcc.dg/wtypequal.c: New testcase. From-SVN: r100512
2005-05-24c-common.c (unsigned_conversion_warning): Move warning control from if() to ↵DJ Delorie1-6/+7
warning(OPT_*). * c-common.c (unsigned_conversion_warning): Move warning control from if() to warning(OPT_*). (c_common_truthvalue_conversion): Likewise. (c_do_switch_warnings): Likewise. * c-decl.c (diagnose_mismatched_decls): Likewise. (diagnose_mismatched_decls): Likewise. (define_label): Likewise. (grokdeclarator): Likewise. * c-format.c (check_format_info): Likewise. * c-lex.c (interpret_integer): Likwise. (lex_string): Likewise. * c-opts.c (c_common_post_options): Likewise. * c-parser.c (c_parser_unary_expression): Likewise. * c-pragma.c (handle_pragma_redefine_extname): Likewise. (handle_pragma_extern_prefix): Likewise. * c-typeck.c (build_binary_op): Likewise. * gcse.c (is_too_expensive): Likewise. * opts.c (decode_options): Likewise. * stor-layout.c (place_field): Likewise. * tree-cfg.c (remove_bb): Likewise. * c.opt (-Wreturn-type): Add Var(warn_return_type). * flags.h (warn_return_type): Remove. * toplev.c (warn_return_type): Likewise. From-SVN: r100135
2005-05-24c-common.h (objc_comptypes): Remove prototype.Ziemowit Laski1-54/+70
* c-common.h (objc_comptypes): Remove prototype. (objc_compare_types): New prototype. (objc_volatilized_decl): Likewise. (objc_type_quals_match): Likewise. * c-decl.c (objc_mark_locals_volatile): Streamline by calling objc_volatilize_decl(). * c-typeck.c (comp_target_types): Remove third parameter; do not call objc_comptypes(). (comptypes): Remove calls to objc_comptypes(). (build_function_call): Extend compatible prototype check to ObjC. (build_conditional_expr): Adjust call to comp_target_types(). (convert_for_assignment): Call objc_compare_types() instead of objc_comptypes(); adjust calls to comp_target_types(); call objc_type_quals_match() before issuing qualifier mismatch warnings. (build_binary_op): Call objc_compare_types() before issuing pointer mismatch warnings; adjust calls to comp_target_types(). * stub-objc.c (objc_comptypes): Remove stub. (objc_compare_types): New stub. (objc_volatilized_decl): Likewise. (objc_type_quals_match): Likewise. From-SVN: r100126
2005-05-17Yet more Objective-C++...Ziemowit Laski1-0/+12
* c-common.h (objc_finish_try_stmt): Add. (objc_build_synchronized): Add. (objc_generate_write_barrier): Add. * stub-objc.c (objc_build_synchronized): Add return value. (objc_finish_try_stmt): Likewise. (objc_generate_write_barrier): Add. * c-common.h (objc_rewrite_function_call): Add. * c-typeck.c (build_function_call): Allow objc to rewrite FUNCTION_DECLs. (build_modify_expr): Allow objc to generate write barriers. * c.opt (Wassign-intercept): Add. (Wstrict-selector-match): Add. (fobjc-call-cxx-cdtors): Add. (fobjc-direct-dispatch): Add. (fobjc-gc): Add. * dbxout.c (get_lang_number): Add Objective-C++ support. * doc/invoke.texi (-fobjc-call-cxx-cdtors): Likewise. (-Wstrict-selector-match): Likewise. (-fobjc-direct-dispatch): Likewise. (-Wassign-intercept): Likewise. (Overall Options): Likewise. * gengtype.c (get_output_file_with_visibility): Likewise. * stub-objc.c (objc_rewrite_function_call): Add. * config/darwin.h (ASM_OUTPUT_LABELREF): Improved quoting support. * c-common.c (flag_objc_exceptions): Remove. (flag_objc_sjlj_exceptions): Remove. * c-decl.c (objc_mark_locals_volatile): Don't change decls that are already ok. * c-opts.c (c_common_handle_option, case OPT_fobjc_exceptions): Remove. (case OPT_fobjc_sjlj_exceptions): Remove * c.opt (fobjc-call-cxx-cdtors): Have opt create the flag. (fobjc-exceptions): Likewise. (fobjc-sjlj-exceptions): Likewise. * config/rs6000/darwin.h (OFFS_MSGSEND_FAST): Add. (OFFS_ASSIGNIVAR_FAST): Add. From-SVN: r99858
2005-05-17* c-typeck.c (common_type): Also handle BOOLEAN_TYPEs.Roger Sayle1-1/+15
From-SVN: r99843
2005-05-17re PR tree-optimization/21610 (ICE in make_decl_rtl)Jakub Jelinek1-2/+10
PR tree-optimization/21610 * c-typeck.c (decl_constant_value_for_broken_optimization): If not returning DECL, call unshare_expr. * gcc.c-torture/compile/20050516-1.c: New test. From-SVN: r99815
2005-05-10re PR c++/17913 (ICE jumping into statement expression)Gabor Loki1-4/+1
2005-05-10 Gabor Loki <loki@gcc.gnu.org> PR c/17913 * c-typeck.c (build_conditional_expr): Remove reducing cond_expr. * fold-const.c (fold): Expand the condition of reducing cond_expr. (contains_label_1, contains_label_p): New functions for checking labels in a sub-tree. testsuite: 2005-05-10 Gabor Loki <loki@gcc.gnu.org> PR c/17913 * gcc.c-torture/compile/pr17913.c: Computed jump test for PR17913 From-SVN: r99514
2005-05-09c-tree.h (parser_build_unary_op): New prototype.Roger Sayle1-5/+21
* c-tree.h (parser_build_unary_op): New prototype. * c-typeck.c (parser_build_unary_op): New function to construct a unary operation in the C parser. * c-parser.c (c_parser_unary_expression): Use the new function parser_build_unary_op when appropriate. From-SVN: r99471
2005-05-02c-common.c (resolve_overloaded_builtin): Forward to target hook for ↵Paolo Bonzini1-6/+7
BUILT_IN_MD built-ins. 2005-05-02 Paolo Bonzini <bonzini@gnu.org> * c-common.c (resolve_overloaded_builtin): Forward to target hook for BUILT_IN_MD built-ins. * c-typeck.c (finish_call_expr): Call resolve_overloaded_builtin for all types of built-in. * target-def.h (TARGET_RESOLVE_OVERLOADED_BUILTIN): New. Use it in the definition of the target hooks struct. * target.h (struct gcc_target): Add resolve_overloaded_builtin. * config/rs6000/altivec.h: Rewritten. * config/rs6000/rs6000-c.c (struct altivec_builtin_types, altivec_resolve_overloaded_builtin, altivec_build_resolved_builtin, rs6000_builtin_type, rs6000_builtin_type_compatible, altivec_overloaded_builtins, rs6000_builtin_type, rs6000_builtin_type_compatible): New. * config/rs6000/rs6000.c (rs6000_builtin_types, rs6000_builtin_decls): New. (def_builtin): Turn into a function. Check for duplicates and store the builtin into rs6000_builtin_decls. (bdesc_3arg, bdesc_dst, bdesc_altivec_preds, bdesc_2arg, bdesc_1arg): Add overloaded builtins. (altivec_expand_builtin): Check for unresolved overloaded builtins, do not support ALTIVEC_COMPILETIME_ERROR. (rs6000_init_builtins): Add opaque 128-bit vector, and internal nodes to represent front-end types. (altivec_init_builtins, rs6000_common_init_builtins): Create builtins with opaque arguments and/or return values. * config/rs6000/rs6000.h (enum rs6000_builtins): Remove ALTIVEC_COMPILETIME_ERROR and add Altivec overloaded builtins. (rs6000_builtin_type_index): New. (is_ev64_opaque_type): Rename to... (rs6000_is_opaque_type): ... this. (rs6000_cpu_cpp_builtins): Install the resolve_overloaded_builtin target hook. cp: 2005-05-02 Paolo Bonzini <bonzini@gnu.org> * semantics.c (finish_call_expr): Call resolve_overloaded_builtin for BUILT_IN_MD built-ins. testsuite: 2005-05-02 Paolo Bonzini <bonzini@gnu.org> * gcc.dg/altivec-3.c (vec_store): Do not use the old __builtin_altivec_st_internal_4si built-in. From-SVN: r99103
2005-04-28c-typeck.c (build_compound_expr): Correct logic in last change.Joseph Myers1-4/+5
* c-typeck.c (build_compound_expr): Correct logic in last change. testsuite: * gcc.dg/void-cast-2.c: New test. From-SVN: r98901
2005-04-27re PR c/21159 ("no effect" warning despite cast to void*)Joseph Myers1-3/+10
PR c/21159 * c-typeck.c (build_compound_expr): Don't warn for left-hand side being a compound expression whose right-hand side is cast to void. testsuite: * gcc.dg/void-cast-1.c: New test. From-SVN: r98886
2005-04-23diagnostic.c (warning): Accept parameter to classify warning option.DJ Delorie1-56/+56
* diagnostic.c (warning): Accept parameter to classify warning option. (warning0): New, for when a pointer to an error() like function is needed. * errors.c (warning): Likewise. * errors.h (warning, warning0): Adjust prototypes. * toplev.h (warning, warning0): Likewise. * attribs.c, builtins.c, c-common.c, c-decl.c, c-format.c, c-gimplify.c, c-lex.c, c-objc-common.c, c-opts.c, c-parser.c, c-pragma.c, c-typeck.c, calls.c, cgraph.c, coverage.c, emit-rtl.c, fold-const.c, fortran/trans-decl.c, function.c, gcse.c, genautomata.c, haifa-sched.c, opts.c, passes.c, regclass.c, reload1.c, stmt.c, stor-layout.c, toplev.c, tree-cfg.c, tree-dump.c, tree-inline.c, tree-mudflap.c, tree-optimize.c, tree-ssa.c, tree.c, varasm.c: Adjust warning() callers. * config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/bfin/bfin.c, config/c4x/c4x-c.c, config/c4x/c4x.c, config/cris/cris.c, config/darwin-c.c, config/darwin.c, config/darwin.h, config/h8300/h8300.c, config/i386/cygming.h, config/i386/djgpp.h, config/i386/i386.c, config/i386/winnt.c, config/ia64/ia64-c.c, config/ia64/ia64.c, config/ip2k/ip2k.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c, config/ns32k/ns32k.c, config/pa/pa-hpux11.h, config/pa/pa.c, config/rs6000/aix43.h, config/rs6000/aix51.h, config/rs6000/aix52.h, config/rs6000/darwin.h, config/rs6000/rs6000-c.c, config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c, config/sh/sh.h, config/sh/symbian.c, config/sol2-c.c, config/sol2.c, config/stormy16/stormy16.c, config/v850/v850-c.c, config/v850/v850.c, config/xtensa/xtensa.c: Adjust warning() callers. * ada/misc.c: Adjust warning() callers. * cp/call.c, cp/class.c, cp/cvt.c, cp/decl.c, cp/decl2.c, cp/except.c, cp/friend.c, cp/init.c, cp/lex.c, cp/mangle.c, cp/method.c, cp/name-lookup.c, cp/parser.c, cp/repo.c, cp/rtti.c, cp/tree.c, cp/typeck.c, cp/typeck2.c: Adjust warning() callers. * fortran/trans-decl.c: Adjust warning() callers. * java/class.c, java/decl.c, java/expr.c, java/jcf-io.c, java/jcf-parse.c, java/jv-scan.c, java/parse.y: Adjust warning() callers. * objc/objc-act.c: Adjust warning() callers. * treelang/parse.y: Adjust warning() callers. From-SVN: r98633
2005-04-22builtins.c (gimplify_va_arg_expr): Reword comments to avoid 'abort'.Nathan Sidwell1-2/+2
* builtins.c (gimplify_va_arg_expr): Reword comments to avoid 'abort'. Use gcc_assert and gcc_unreachable as appropriate. * c-format.c (get_constant, decode_format_attr, get_flag_spec, find_char_info_specifier_index, find_length_info_modifier_index): Likewise. * c-typeck.c (composite_type, pop_init_level): Likewise. * combine.c (cant_combine_insn_p, try_combine): Likewise. * cse.c (cse_insn): Likewise * dominance.c (calc_dfs_tree): Likewise dwarf2out.c (loc_descriptor_from_tree_1, add_abstract_origin_attribute, force_decl_die, force_type_die): Likewise emit-rtl.c (operand_subword_force): Likewise explow.c (hard_function_value): Likewise expmed.c (store_bit_field, expand_divmod, emit_store_flag_force): Likewise expr.c (emit_move_multi_word, store_expr, expand_expr_real_1): Likewise final.c (this_is_asm_operands, shorten_branches, final_scan_insn, output_operand): Likewise flow.c (recompute_reg_usage): Likewise * function.c (assign_stack_temp_for_type, assign_temp, handle_epilogue_set): Likewise * genextract.c (main): Likewise * gimplify.c (mostly_copy_tree_r, gimplify_return_expr, gimplify_modify_expr_rhs, gimplify_expr): Likewise * haifa-sched.c (ready_lastpos, ready_remove_first, ready_element, ready_remove, rm_line_notes, rm_other_notes, schedule_block): Likewise mips-tfile.c (copy_object, out_of_bounds): Likewise From-SVN: r98567
2005-04-20re PR c/12913 (Jumps into variable length array scope not rejected)Joseph Myers1-14/+122
PR c/12913 * c-tree.h (struct c_label_list): Update comment. (struct c_label_context): Rename to struct c_label_context_se. (label_context_stack): Rename to label_context_stack_se. (C_DECL_UNJUMPABLE_VM, C_DECL_UNDEFINABLE_VM, struct c_label_context_vm, label_context_stack_vm, c_begin_vm_scope, c_end_vm_scope): New. (C_DECL_DECLARED_BUILTIN, C_DECL_USED): Use FUNCTION_DECL_CHECK. * c-decl.c (pop_scope): Call c_end_vm_scope. (pushdecl): Call c_begin_vm_scope for variably modified declarations. (define_label): Check for jumping into scope of identifier with variably modified type. Push label on stack for those defined at current context of identifiers with variably modified type. (start_function): Create stack level for context of identifiers with variably modified type. (finish_function): Pop stack level for context of identifiers with variably modified type. * c-typeck.c (label_context_stack): Rename to label_context_stack_se. (label_context_stack_vm, c_begin_vm_scope, c_end_vm_scope): New. (c_finish_goto_label): Check for jumping into scope of identifier with variably modified type. Push label on stack for those jumped to from current context of identifiers with variably modified type. (struct c_switch): Add blocked_vm. (c_start_case): Initialize blocked_vm. (do_case): Check blocked_vm. (c_finish_case): Add comment. (c_begin_stmt_expr, c_finish_stmt_expr): Update for renamed variable label_context_stack. objc: * objc-act.c (objc_start_function): Create stack level for context of identifiers with variably modified type. testsuite: * gcc.dg/c99-vla-jump-1.c, gcc.dg/c99-vla-jump-2.c, gcc.dg/c99-vla-jump-3.c, gcc.dg/c99-vla-jump-4.c, gcc.dg/c99-vla-jump-5.c: New tests. From-SVN: r98464
2005-04-20c.opt (Wint-to-pointer-cast, [...]): New options.Joseph Myers1-2/+4
2005-04-20 Michael Pogue <michael.pogue@sun.com> Joseph S. Myers <joseph@codesourcery.com> * c.opt (Wint-to-pointer-cast, Wpointer-to-int-cast): New options. * c-typeck.c (build_c_cast): Check these options. * doc/invoke.texi: Document these options. testsuite: * gcc.dg/Wint-to-pointer-cast-1.c, gcc.dg/Wint-to-pointer-cast-2.c, gcc.dg/Wint-to-pointer-cast-3.c, gcc.dg/Wpointer-to-int-cast-1.c, gcc.dg/Wpointer-to-int-cast-2.c, gcc.dg/Wpointer-to-int-cast-3.c: New tests. From-SVN: r98429
2005-04-14re PR middle-end/14311 (builtins for atomic operations needed)Richard Henderson1-0/+7
PR middle-end/14311 * builtin-types.def (BT_BOOL, BT_VOLATILE_PTR, BT_I1, BT_I2, BT_I4, BT_I8, BT_FN_VOID_VPTR, BT_FN_I1_VPTR_I1, BT_FN_I2_VPTR_I2, BT_FN_I4_VPTR_I4, BT_FN_I8_VPTR_I8, BT_FN_BOOL_VPTR_I1_I1, BT_FN_BOOL_VPTR_I2_I2, BT_FN_BOOL_VPTR_I4_I4, BT_FN_BOOL_VPTR_I8_I8, BT_FN_I1_VPTR_I1_I1, BT_FN_I2_VPTR_I2_I2, BT_FN_I4_VPTR_I4_I4, BT_FN_I8_VPTR_I8_I8): New. * builtins.def (DEF_SYNC_BUILTIN): New. (BUILT_IN_FETCH_AND_ADD_N, BUILT_IN_FETCH_AND_ADD_1, BUILT_IN_FETCH_AND_ADD_2, BUILT_IN_FETCH_AND_ADD_4, BUILT_IN_FETCH_AND_ADD_8, BUILT_IN_FETCH_AND_SUB_N, BUILT_IN_FETCH_AND_SUB_1, BUILT_IN_FETCH_AND_SUB_2, BUILT_IN_FETCH_AND_SUB_4, BUILT_IN_FETCH_AND_SUB_8, BUILT_IN_FETCH_AND_OR_N, BUILT_IN_FETCH_AND_OR_1, BUILT_IN_FETCH_AND_OR_2, BUILT_IN_FETCH_AND_OR_4, BUILT_IN_FETCH_AND_OR_8, BUILT_IN_FETCH_AND_AND_N, BUILT_IN_FETCH_AND_AND_1, BUILT_IN_FETCH_AND_AND_2, BUILT_IN_FETCH_AND_AND_4, BUILT_IN_FETCH_AND_AND_8, BUILT_IN_FETCH_AND_XOR_N, BUILT_IN_FETCH_AND_XOR_1, BUILT_IN_FETCH_AND_XOR_2, BUILT_IN_FETCH_AND_XOR_4, BUILT_IN_FETCH_AND_XOR_8, BUILT_IN_FETCH_AND_NAND_N, BUILT_IN_FETCH_AND_NAND_1, BUILT_IN_FETCH_AND_NAND_2, BUILT_IN_FETCH_AND_NAND_4, BUILT_IN_FETCH_AND_NAND_8, BUILT_IN_ADD_AND_FETCH_N, BUILT_IN_ADD_AND_FETCH_1, BUILT_IN_ADD_AND_FETCH_2, BUILT_IN_ADD_AND_FETCH_4, BUILT_IN_ADD_AND_FETCH_8, BUILT_IN_SUB_AND_FETCH_N, BUILT_IN_SUB_AND_FETCH_1, BUILT_IN_SUB_AND_FETCH_2, BUILT_IN_SUB_AND_FETCH_4, BUILT_IN_SUB_AND_FETCH_8, BUILT_IN_OR_AND_FETCH_N, BUILT_IN_OR_AND_FETCH_1, BUILT_IN_OR_AND_FETCH_2, BUILT_IN_OR_AND_FETCH_4, BUILT_IN_OR_AND_FETCH_8, BUILT_IN_AND_AND_FETCH_N, BUILT_IN_AND_AND_FETCH_1, BUILT_IN_AND_AND_FETCH_2, BUILT_IN_AND_AND_FETCH_4, BUILT_IN_AND_AND_FETCH_8, BUILT_IN_XOR_AND_FETCH_N, BUILT_IN_XOR_AND_FETCH_1, BUILT_IN_XOR_AND_FETCH_2, BUILT_IN_XOR_AND_FETCH_4, BUILT_IN_XOR_AND_FETCH_8, BUILT_IN_NAND_AND_FETCH_N, BUILT_IN_NAND_AND_FETCH_1, BUILT_IN_NAND_AND_FETCH_2, BUILT_IN_NAND_AND_FETCH_4, BUILT_IN_NAND_AND_FETCH_8, BUILT_IN_BOOL_COMPARE_AND_SWAP_N, BUILT_IN_BOOL_COMPARE_AND_SWAP_1, BUILT_IN_BOOL_COMPARE_AND_SWAP_2, BUILT_IN_BOOL_COMPARE_AND_SWAP_4, BUILT_IN_BOOL_COMPARE_AND_SWAP_8, BUILT_IN_VAL_COMPARE_AND_SWAP_N, BUILT_IN_VAL_COMPARE_AND_SWAP_1, BUILT_IN_VAL_COMPARE_AND_SWAP_2, BUILT_IN_VAL_COMPARE_AND_SWAP_4, BUILT_IN_VAL_COMPARE_AND_SWAP_8, BUILT_IN_LOCK_TEST_AND_SET_N, BUILT_IN_LOCK_TEST_AND_SET_1, BUILT_IN_LOCK_TEST_AND_SET_2, BUILT_IN_LOCK_TEST_AND_SET_4, BUILT_IN_LOCK_TEST_AND_SET_8, BUILT_IN_LOCK_RELEASE_N, BUILT_IN_LOCK_RELEASE_1, BUILT_IN_LOCK_RELEASE_2, BUILT_IN_LOCK_RELEASE_4, BUILT_IN_LOCK_RELEASE_8, BUILT_IN_SYNCHRONIZE: New. * builtins.c (called_as_built_in): Rewrite from CALLED_AS_BUILT_IN as a function. Accept __sync_ as a prefix as well. (expand_builtin_sync_operation, expand_builtin_compare_and_swap, expand_builtin_lock_test_and_set, expand_builtin_synchronize, expand_builtin_lock_release): New. (expand_builtin): Call them. * c-common.c (DEF_BUILTIN): Don't require __builtin_ prefix if neither BOTH_P nor FALLBACK_P are defined. (builtin_type_for_size): New. (sync_resolve_size, sync_resolve_params, sync_resolve_return): New. (resolve_overloaded_builtin): New. * c-common.h (resolve_overloaded_builtin): Declare. (builtin_type_for_size): Declare. * c-typeck.c (build_function_call): Invoke resolve_overloaded_builtin. * expr.c (sync_add_optab, sync_sub_optab, sync_ior_optab, sync_and_optab, sync_xor_optab, sync_nand_optab, sync_old_add_optab, sync_old_sub_optab, sync_old_ior_optab, sync_old_and_optab, sync_old_xor_optab, sync_old_nand_optab, sync_new_add_optab, sync_new_sub_optab, sync_new_ior_optab, sync_new_and_optab, sync_new_xor_optab, sync_new_nand_optab, sync_compare_and_swap, sync_compare_and_swap_cc, sync_lock_test_and_set, sync_lock_release): New. * optabs.h: Declare them. * expr.h (expand_val_compare_and_swap, expand_bool_compare_and_swap, expand_sync_operation, expand_sync_fetch_operation, expand_sync_lock_test_and_set): Declare. * genopinit.c (optabs): Add sync optabs. * optabs.c (init_optabs): Initialize sync optabs. (expand_val_compare_and_swap_1, expand_val_compare_and_swap, expand_bool_compare_and_swap, expand_compare_and_swap_loop, expand_sync_operation, expand_sync_fetch_operation, expand_sync_lock_test_and_set): New. * doc/extend.texi (Atomic Builtins): New section * doc/md.texi (Standard Names): Add sync patterns. From-SVN: r98154
2005-04-09c-common.def: Move FOR_STMT...Ian Lance Taylor1-1/+8
./ * c-common.def: Move FOR_STMT, WHILE_STMT, DO_STMT, BREAK_STMT, CONTINUE_STMT, and SWITCH_STMT to cp/cp-tree.def. * c-common.h (WHILE_COND, WHILE_BODY): Move to cp/cp-tree.h. (DO_COND, DO_BODY): Likewise. (FOR_INIT_STMT, FOR_COND, FOR_EXPR, FOR_BODY): Likewise. (SWITCH_STMT_COND, SWITCH_STMT_BODY, SWITCH_STMT_TYPE): Likewise. (c_common_stmt_codes): Remove FOR_STMT, WHILE_STMT, DO_STMT, BREAK_STMT, CONTINUE_STMT, and SWITCH_STMT. (build_continue_stmt, build_break_stmt): Don't declare. (c_do_switch_warnings): Update declaration. * c-gimplify.c (enum bc_t): Remove. (struct c_gimplify_ctx, ctxp): Remove. (push_context, pop_context): Remove static functions. (c_genericize): Don't call push_context or pop_context. (begin_bc_block, finish_bc_block): Remove static functions. (build_bc_goto): Likewise. (gimplify_c_loop): Likewise. (gimplify_for_stmt, gimplify_while_stmt): Likewise. (gimplify_do_stmt, gimplify_switch_stmt): Likewise. (c_gimplify_expr): Remove handling of FOR_STMT, WHILE_STMT, DO_STMT, SWITCH_STMT, CONTINUE_STMT, BREAK_STMT. * c-common.c (c_do_switch_warnings): Rename from c_do_switch_warnings_1. (c_do_switch_warnings) [old version]: Remove. (c_do_switch_expr_warnings): Remove. * c-typeck.c (c_finish_case): Call new c_do_switch_warnings function instead of c_do_switch_expr_warnings. * c-dump.c (c_dump_tree): Remove handling of BREAK_STMT, CONTINUE_STMT, DO_STMT, FOR_STMT, SWITCH_STMT, and WHILE_STMT. * c-pretty-print.c (pp_c_statement): Likewise. * c-semantics.c (build_break_stmt, build_continue_stmt): Remove. cp/ * cp-tree.def: Define FOR_STMT, WHILE_STMT, DO_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT. * cp-tree.h (cp_stmt_codes): Add FOR_STMT, WHILE_STMT, DO_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT. (WHILE_COND, WHILE_BODY): Define. (DO_COND, DO_BODY): Define. (FOR_INIT_STMT, FOR_COND, FOR_EXPR, FOR_BODY): Define. (SWITCH_STMT_COND, SWITCH_STMT_BODY, SWITCH_STMT_TYPE): Define. * cp-gimplify.c (enum bc_t): Define. (struct cp_gimplify_ctx, ctxp): Define. (push_context, pop_context): New static functions. (begin_bc_block, finish_bc_block): New static functions. (build_bc_goto): New static function. (gimplify_cp_loop, gimplify_for_stmt): New static functions. (gimplify_while_stmt, gimplify_do_stmt): Likewise. (gimplify_switch_stmt): Likewise. (cp_gimplify_expr): Handle FOR_STMT, WHILE_STMT, DO_STMT, SWITCH_STMT, CONTINUE_STMT, BREAK_STMT. (cp_genericize): Call push_context and pop_context. * semantics.c (finish_break_stmt): Just call build_stmt (BREAK_STMT) rather than build_break_stmt. (finish_continue_stmt): Corresponding change. * decl.c (pop_switch): Update call to c_do_switch_warnings for new parameters. * cxx-pretty-print.c (pp_cxx_statement): Handle SWITCH_STMT, WHILE_STMT, DO_STMT, FOR_STMT, BREAK_STMT, CONTINUE_STMT. * dump.c (cp_dump_tree): Likewise. From-SVN: r97885
2005-04-05c-typeck.c (struct c_switch): Rename switch_stmt field to switch_expr.Ian Lance Taylor1-9/+9
* c-typeck.c (struct c_switch): Rename switch_stmt field to switch_expr. (c_start_case): Build SWITCH_EXPR, not SWITCH_STMT. (do_case): Use SWITCH_COND rather than SWITCH_STMT_COND. (c_finish_case): Use SWITCH_BODY rather than SWITCH_STMT_BODY. Call c_do_switch_expr_warnings rather than c_do_switch_warnings. * c-common.c (c_do_switch_warnings_1): New static function broken out of c_do_switch_warnings. (c_do_switch_warnings): Call c_do_switch_warnings_1. (c_do_switch_expr_warnings): New function. * c-common.h (c_do_switch_expr_warnings): Declare. From-SVN: r97593
2005-03-30re PR c++/772 (Statement expressions issues)Joseph Myers1-1/+83
PR c/772 PR c/17913 * c-tree.h (C_DECL_UNJUMPABLE_STMT_EXPR, C_DECL_UNDEFINABLE_STMT_EXPR, struct c_label_list, struct c_label_context, label_context_stack): New. * c-decl.c (define_label): Check for jumps into statement expressions. Add label to list of defined labels. (start_function): Push context on label_context_stack. (finish_function): Pop context from label_context_stack. * c-typeck.c (label_context_stack): New. (c_finish_goto_label): Check for jumps into statement expressions. Add label to list of jumped to labels. (struct c_switch): Add blocked_stmt_expr. (c_start_case): Initialize it. (do_case): Check it. (c_finish_case): Verify !blocked_stmt_expr. (c_begin_stmt_expr): Push context on label_context_stack. Increment blocked_stmt_expr. Mark labels jumped to from outside as undefinable. (c_finish_stmt_expr): December blocked_stmt_expr. Mark labels defined in the statement expression and no longer jumpable to. Mark labels jumped to from just outside the statement expression as again definable. Pop context from label_context_stack. * doc/extend.texi (Statement Exprs): Update. objc: * objc-act.c (objc_start_function): Push context on label_context_stack. testsuite: * gcc.dg/stmt-expr-label-1.c, gcc.dg/stmt-expr-label-2.c, gcc.dg/stmt-expr-label-3.c : New tests. * gcc.c-torture/execute/medce-2.c: Remove. From-SVN: r97273
2005-03-23c-common.c (c_common_truthvalue_conversion): Adjust comment.Joseph Myers1-5/+36
* c-common.c (c_common_truthvalue_conversion): Adjust comment. Call c_common_truthvalue_conversion rather than lang_hooks.truthvalue_conversion. * c-convert.c (convert): Call c_objc_common_truthvalue_conversion. * c-objc-common.c (c_objc_common_truthvalue_conversion): Move to c-typeck.c. * c-objc-common.h (LANG_HOOKS_TRUTHVALUE_CONVERSION): Change to c_common_truthvalue_conversion. * c-parser.c (c_parser_paren_condition, c_parser_for_statement, c_parser_conditional_expression, c_parser_binary_expression): Call c_objc_common_truthvalue_conversion. * c-typeck.c (build_unary_op): Call c_objc_common_truthvalue_conversion. (build_conditional_expr): Do not call lang_hooks.truthvalue_conversion. (build_binary_op): Call c_common_truthvalue_conversion. (c_objc_common_truthvalue_conversion): Moved from c-objc-common.c. Call default_function_array_conversion instead of default_conversion. objc: * objc-act.c (next_sjlj_build_enter_and_setjmp, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally): Call c_common_truthvalue_conversion. From-SVN: r96917
2005-03-23c-common.h (default_conversion): Remove.Joseph Myers1-28/+49
* c-common.h (default_conversion): Remove. (perform_integral_promotions): Add. * c-tree.h (default_conversion): Add. * c-typeck.c (perform_integral_promotions): New, split out from default_conversion. * c-common.c (check_case_value): Use perform_integral_promotions, not default_conversion. (c_add_case_label): Don't continue processing case label after found to be pointer. cp: * cp-tree.h (perform_integral_promotions): Remove. (default_conversion): Add. From-SVN: r96916
2005-03-21c-common.c (lvalue_or_else): Replace by lvalue_error; only give diagnostic ↵Joseph Myers1-1/+19
without checking whether an lvalue. * c-common.c (lvalue_or_else): Replace by lvalue_error; only give diagnostic without checking whether an lvalue. * c-common.h (lvalue_p): Remove. (enum lvalue_use): Update comment. (lvalue_or_else): Replace by lvalue_error. * c-typeck.c (lvalue_p): Make static. (lvalue_or_else): New. Call lvalue_error. cp: * cp-tree.h (lvalue_or_else, lvalue_p): New. * typeck.c (lvalue_or_else): New. Call lvalue_error. From-SVN: r96776
2005-03-20c-common.c (check_case_value): Adjust comment about stripping NOPs.Joseph Myers1-31/+7
* c-common.c (check_case_value): Adjust comment about stripping NOPs. (handle_vector_size_attribute): Don't strip NON_LVALUE_EXPR. * c-typeck.c (default_conversion, convert_arguments, build_modify_expr, convert_for_assignment, store_init_value, digest_init): Use STRIP_TYPE_NOPS instead of stripping nops manually. Remove inaccurate comments. From-SVN: r96770
2005-03-20c-common.c (handle_aligned_attribute, [...]): Do not strip NOPS from ↵Joseph Myers1-20/+0
INTEGER_CSTs. * c-common.c (handle_aligned_attribute, check_function_sentinel, get_nonnull_operand, handle_sentinel_attribute, check_function_arguments_recurse): Do not strip NOPS from INTEGER_CSTs. * c-decl.c (check_bitfield_type_and_width, build_enumerator): Likewise. * c-format.c (get_constant): Likewise. * c-parser.c (c_parser_postfix_expression): Likewise. * c-typeck.c (set_init_index): Likewise. (convert_arguments): Don't check for NOP_EXPR containing integer constant. From-SVN: r96760
2005-03-18c-common.c, [...]: Use %D for declarations in diagnostics and %E for ↵Joseph Myers1-20/+16
identifiers, not %s. * c-common.c, c-decl.c, c-format.c, c-typeck.c: Use %D for declarations in diagnostics and %E for identifiers, not %s. From-SVN: r96701
2005-03-08Target Hook to issue diagnostics for AltiVec argument to funtion with ↵Fariborz Jahanian1-0/+7
unknown prototype. Target Hook to issue diagnostics for AltiVec argument to funtion with unknown prototype. OKed by Mark Mitchel. From-SVN: r96124
2005-03-08c-typeck.c (constructor_stack, [...]): Make them static.Kazu Hirata1-3/+3
* c-typeck.c (constructor_stack, constructor_range_stack, initializer_stack): Make them static. From-SVN: r96108
2005-03-02re PR c/8927 (Gcc give error for wrong line of C code.)Joseph Myers1-3/+4
PR c/8927 * c-tree.h (undeclared_variable, build_external_ref): Add extra argument. * c-decl.c (undeclared_variable): Take location as argument. * c-typeck.c (build_external_ref): Likewise. * c-parser.c (c_parser_postfix_expression): Pass location of identifier to build_external_ref. testsuite: * gcc.dg/pr8927-1.c: New test. From-SVN: r95773
2005-02-19re PR c/20043 (transparent_union doesn't allow restrict qualifier removal)Jakub Jelinek1-18/+52
PR c/20043 * c-typeck.c (composite_type): Handle quals in transparent unions. (type_lists_compatible_p): Likewise. * gcc.dg/transparent-union-1.c: New test. * gcc.dg/transparent-union-2.c: New test. From-SVN: r95255
2005-02-10re PR c/19342 (ICE in common_type, at c-typeck.c:490)Jakub Jelinek1-6/+18
PR c/19342 * c-typeck.c (common_type): New routine. Old common_type renamed to... (c_common_type): ...this. (build_conditional_expr, build_binary_op): Use c_common_type instead of common_type. * gcc.c-torture/execute/20050119-1.c: New test. From-SVN: r94803
2005-02-02re PR c/19435 (spurious warnings with nested array constructors)Joseph Myers1-1/+4
PR c/19435 * c-typeck.c (really_start_incremental_init): Reset constructor_max_index for arrays of incomplete type. testsuite: * gcc.dg/c99-init-4.c: New test. From-SVN: r94595
2005-02-01re PR c/19333 (C front end accepts arrays of incomplete types)Steven Bosscher1-2/+4
gcc/ PR c/19333 * c-decl.c (start_decl): Do not warn about arrays of elements with an incomplete type here. (grokdeclarator): Do it here by making a pedwarn an error. * c-typeck.c (push_init_level): If there were previous errors with the constructor type, do not warn about braces for initializers. (process_init_element): Likewise for excess initializer elements. testsuite/ PR c/19333 * testsuite/gcc.c-torture/compile/20011130-1.c: Reorder to make the test case valid. * testsuite/gcc.dg/20030815-1.c: Remove invalid tests. * testsuite/gcc.dg/array-7.c: Adjust expected result. * testsuite/gcc.dg/pr18596-3.c: Likewise. * testsuite/gcc.dg/noncompile/20000901-1.c: Likewise. * testsuite/gcc.dg/noncompile/init-2.c: Likewise. * testsuite/gcc.dg/noncompile/init-4.c: Likewise. From-SVN: r94505
2005-01-29c-common.c (fix_string_type): Just use c_build_qualified_type to build ↵Joseph Myers1-41/+83
string type. * c-common.c (fix_string_type): Just use c_build_qualified_type to build string type. (c_build_qualified_type): Build qualified array types with TYPE_MAIN_VARIANT pointing to corresponding unqualified type. * c-decl.c (c_make_fname_decl): Build unqualified array type before qualified type. (grokdeclarator): Use TYPE_MAIN_VARIANT of typedef type if element type is qualified, not just if type itself is. Don't apply qualifiers to array type when declarator is processed. Apply qualifiers to field type whether or not it is an array type. Don't handle array types specially for applying qualifiers to variables. * c-typeck.c (composite_type): Build unqualified element type and array type when forming composite of array types. (common_pointer_type, comptypes, comp_target_types, type_lists_compatible_p, build_indirect_ref, build_array_ref, convert_for_assignment): Don't apply TYPE_MAIN_VARIANT to array types. (type_lists_compatible_p): Cache TREE_VALUE (args1) and TREE_VALUE (args2) in variables a1 and a2. testsuite: * gcc.dg/Wwrite-strings-1.c, gcc.dg/array-quals-2.c, gcc.dg/lvalue-3.c: New tests. * gcc.dg/concat.c: Update expected messages. From-SVN: r94411
2005-01-27tree.h (SWITCH_COND, [...]): Add tree checks.Steven Bosscher1-4/+3
* tree.h (SWITCH_COND, SWITCH_BODY, SWITCH_LABELS, CASE_LOW, CASE_HIGH, CASE_LABEL, ASM_STRING, ASM_OUTPUTS, ASM_INPUTS, ASM_CLOBBERS): Add tree checks. * c-common.h (SWITCH_TYPE): Rename to SWITCH_STMT_TYPE. (SWITCH_STMT_COND, SWITCH_STMT_BODY): New. * c-common.def (SWITCH_STMT): Update to match. * c-common.c (c_do_switch_warnings): Use SWITCH_STMT accessor macros instead of SWITCH_EXPR ones. * c-dump.c (c_dump_tree): Likewise. * c-gimplify.c (gimplify_switch_stmt): Likewise. * c-typeck.c (c_start_case, do_case, c_finish_case): Likewise. cp/ * decl.c (finish_case_label): Use SWITCH_STMT accessor macros instead of SWITCH_EXPR ones. * pt.c (tsubst_expr): Likewise. * semantics.c (begin_switch_stmt, finish_switch_cond, finish_switch_stmt): Likewise. doc/ * c-tree.texi (SWITCH_STMT): Update accessor macro names. From-SVN: r94315