Commit Graph

91 Commits

Author SHA1 Message Date
Rafael Avila de Espindola ca5ba2a3ea c-common.c (warnings_for_convert_and_check): Use unsigned_type_for instead of c_common_unsigned_type.
gcc/
       * c-common.c (warnings_for_convert_and_check): Use unsigned_type_for
       instead of c_common_unsigned_type.
       (c_common_unsigned_type): Remove.
       (shorten_compare): Use c_common_signed_or_unsigned_type instead of
       c_common_unsigned_type.
       (c_common_nodes_and_builtins): Use unsigned_type_for instead of
       c_common_unsigned_type.
       * c-common.h (c_common_unsigned_type): Remove.
       * c-decl.c (grokdeclarator): Use unsigned_type_for instead of
       c_common_unsigned_type.
       * c-format.c (check_format_types): Use unsigned_type_for instead of
       c_common_unsigned_type.
       * c-objc-common.h (LANG_HOOKS_UNSIGNED_TYPE): Remove.
       * c-typeck.c (convert_for_assignment): Use unsigned_type_for instead of
       c_common_unsigned_type.
       * convert.c (convert_to_integer): Use unsigned_type_for instead of
       lang_hooks.types.unsigned_type.
       * expmed.c (make_tree): Use unsigned_type_for instead of
       lang_hooks.types.unsigned_type.
       * fold-const.c (fold_negate_expr): Use unsigned_type_for instead of
       lang_hooks.types.unsigned_type.
       (build_range_check): Likewise.
       (fold_unary): Likewise.
       (fold_binary): Likewise.
       (fold_ternary): Likewise.
       * langhooks-def.h (LANG_HOOKS_UNSIGNED_TYPE): Remove.
       * langhooks.h (lang_hooks_for_types): Remove unsigned_type.
       * tree.c (get_unsigned_type): New.
       (unsigned_type_for): Use get_unsigned_type instead of
       lang_hooks.types.unsigned_type

gcc/ada
       * misc.c (LANG_HOOKS_UNSIGNED_TYPE): Remove.

gcc/cp
       * cp-objcp-common.h (LANG_HOOKS_UNSIGNED_TYPE): Remove.
       * decl.c (grokdeclarator): Use unsigned_type_for instead of
       c_common_unsigned_type.

gcc/fortran
       * f95-lang.c (LANG_HOOKS_UNSIGNED_TYPE): Remove.
       * trans-intrinsic.c (gfc_conv_intrinsic_ishft): Use unsigned_type_for
       instead of gfc_unsigned_type.
       * trans-stmt.c (gfc_trans_do): Use unsigned_type_for instead of
       gfc_unsigned_type.
       * trans-types.c (gfc_unsigned_type): Remove.
       * trans-types.h (gfc_unsigned_type): Remove.

gcc/java
       * expr.c (build_java_binop): Use unsigned_type_for instead of
       java_unsigned_type.
       * java-tree.h (java_unsigned_type): Remove.
       * lang.c (LANG_HOOKS_UNSIGNED_TYPE): Remove.
       * typeck.c (java_unsigned_type): Remove.

gcc/treelang
       * treetree.c (tree_lang_unsigned_type): Remove.
       (LANG_HOOKS_UNSIGNED_TYPE): Remove.

From-SVN: r124715
2007-05-14 14:37:17 +00:00
Bruce Korb ca178f85a6 Separate NUL byte detection from rest of -Wformat warnings
From-SVN: r123640
2007-04-07 17:55:07 +00:00
Sandra Loosemore 94a0dd7b59 builtins.c (fold_builtin_call_list, [...]): Delete, and replace with...
2007-02-28  Sandra Loosemore  <sandra@codesourcery.com>

	* gcc/builtins.c (fold_builtin_call_list, fold_builtin_call_valist):
	Delete, and replace with...
	(fold_builtin_call_array): This.  Update callers to use it.
	* gcc/fold-const.c (fold_build_call_list): Delete, and replace with...
	(fold_build_call_array): This.
	(fold_build_call_list_initializer): Delete, and replace with...
	(fold_build_call_array_initializer): This.
	* gcc/tree.h: Update declarations to reflect above changes.

	* gcc/c-typeck.c (build_function_call): Store converted arguments
	in a stack-allocated array instead of building a list.
	(convert_arguments): Store arguments in the array passed in as an
	argument, and return the actual number of arguments.
	* gcc/c-format.c: (check_function_format): Pass arguments in an
	array instead of a list.
	* gcc/c-common.c (check_function_nonnull): Likewise.
	(check_function_sentinel): Likewise.
	(check_function_arguments): Likewise.
	* gcc/c-common.h: Update declarations to reflect above changes.

	* gcc/cp/typeck.c (build_function_call): Store converted arguments
	in a stack-allocated array instead of building a list.
	(convert_arguments): Store arguments in the array passed in as an
	argument, and return the actual number of arguments.
	* gcc/cp/call.c (build_call): Delete, and replace with...
	(build_call_n, build_call_a): New.
	(build_op_delete_call): Rewrite to avoid constructing argument lists.
	(build_over_call): Store converted arguments in a stack-allocated
	array instead of building a list.
	(build_cxx_call): Pass arguments in an array instead of as a list.
	(build_java_interface_fn_ref): Rewrite to avoid constructing
	argument lists.
	* gcc/cp/tree.h: Update declarations to reflect above changes.
	* gcc/cp/method.c (use_thunk): Use a stack-allocated array to hold
	the arguments instead of a list.
	* gcc/cp/rtti.c (throw_bad_cast): Update call to cxx_call.
	(throw_bad_typeid): Likewise.
	(build_dynamic_cast_1): Likewise.
	* gcc/cp/init.c (build_builtin_delete_call): Use build_call_n.
	* gcc/cp/decl.c (expand_static_init): Likewise.
	* gcc/cp/except.c (cp_protect_cleanup_actions): Likewise.
	* gcc/cp/cp-gimplify.c (genericize_eh_spec_block): Likewise.
	(gimplify_must_not_throw_expr): Likewise.
	(cxx_omp_apply_fn): Use build_call_a.

From-SVN: r122411
2007-02-28 14:21:20 -05:00
Mike Stump c22cacf346 Whitespace fixups
From-SVN: r113893
2006-05-18 22:16:23 +00:00
Gabriel Dos Reis cceb18855e tree-inline.c (copy_body_r): Use explicit cast when converting from void *.
* tree-inline.c (copy_body_r): Use explicit cast when
          converting
        from void *.
        (copy_bb): Likewise.
        (copy_edges_for_bb): Likewise.
        (remap_decl_1): Likewise.
        (estimate_num_insns_1): Likewise.
        * cgraph.c (hash_node): Use explicit cast when converting from
        void *.
        (eq_node): Likewise.
        (cgraph_create_node): Use GGC_CNEW.
        (cgraph_create_edge): Use GGC_NEW.
        (cgraph_remove_node): Use explicit cast when converting from
          void *.
        (hash_varpool_node): Likewise.
        (eq_varpool_node): Likewise.
        (cgraph_varpool_node): Use GGC_CNEW.
        * lambda.h (lambda_vector_new): Use GGC_CNEWVEC.
        * tree-scalar-evolution.c (new_scev_info_str): Use XNEW.
        (eq_scev_info): Use explicit cast when converting from void *.
        (find_var_scev_info): Likewise.
        (set_instantiated_value): Likewise.
        (gather_stats_on_scev_database_1): Likewise.
        * cfgloop.h (simple_loop_desc): Use explicit cast when
          converting
        from void *.
        * c-pch.c (c_common_write_pch): Use XNEWVEC.
        (c_common_read_pch): Likewise.
        * prefix.c (save_string): Use XNEWVEC.
        (translate_name): Use explicit cast when converting from void
          *.
        * c-ppoutput.c (print_line): Use explicit cast when converting
        from void *.
        (pp_dir_change): Likewise.
        * c-cppbuiltin.c (builtin_define_std): Likewise.
        (builtin_define_with_value): Likewise.
        (builtin_define_with_value_n): Likewise.
        (builtin_define_with_int_value): Likewise.
        (builtin_define_type_max): Likewise.
        * c-incpath.c (add_env_var_paths): Use XNEWVEC.
        (add_path): Use XNEW.
        * c-format.c (check_format_info_main): Use GGC_NEW.
        (format_type_warning): Use explicit cast when converting from
          void *.
        * c-typeck.c (alloc_tagged_tu_seen_cache): Use XNEW instead of
        xmalloc. 
        (start_init): Likewise.
        * tree-flow-inline.h (first_referenced_var): Use explicit cast
        when converting from void *.
        (next_referenced_var): Likewise.
        * c-pragma.c (push_alignment): Use GGC_NEW instead of
          ggc_alloc.
        * gensupport.c (lookup_predicate): Use explicit cast to
          convert
        from void *.
        (init_predicate_table): Use XCNEW instead of xcalloc.
        * genpreds.c (process_define_predicate): Likewise.

From-SVN: r108723
2005-12-17 20:45:46 +00:00
Jon Grimm 9a8ce21f3b target-def.h (TARGET_DECIMAL_FLOAT_SUPPORTED_P): New.
2005-12-16  Jon Grimm  <jgrimm2@us.ibm.com>
	    Janis Johnson  <janis187@us.ibm.com>
	    Ben Elliston  <bje@au.ibm.com>

	* target-def.h (TARGET_DECIMAL_FLOAT_SUPPORTED_P): New.
	(TARGET_INITIALIZER): Add TARGET_DECIMAL_FLOAT_P.
	* target.h (struct gcc_target): Add decimal_float_supported_p.
	* targhooks.c (default_scalar_mode_supported_p): Handle
	MODE_DECIMAL_FLOAT.
	* builtins.def: Add new builtins for 32, 64 and 128 bit variants
	of inf, nan, finite, isinf and isnan.
	* builtin-types.def (BT_DFLOAT32, BT_DFLOAT64, BT_DFLOAT128,
	BT_DFLOAT32_PTR, BT_DFLOAT64_PTR, BT_DFLOAT128_PTR,
	BT_FN_DFLOAT32, BT_FN_DFLOAT64, BT_FN_DFLOAT128,
	BT_FN_INT_DFLOAT32, BT_FN_INT_DFLOAT64, BT_FN_INT_DFLOAT128,
	BT_FN_DFLOAT32_CONST_STRING, BT_FN_DFLOAT64_CONST_STRING,
	BT_FN_DFLOAT32_CONST_STRING, BT_FN_DFLOAT32_DFLOAT32,
	BT_FN_DFLOAT64_DFLOAT64, BT_FN_DFLOAT128_DFLOAT128): New.
	* c-decl.c (declspecs_add_type): Verify combos on type qualifiers.
	Pedwarn if decimal floating point types are used.  Error if
	decimal floating point is not supported by the target.
	(finish_declspecs): Return type from DFP typespec_word.
	* c-typeck.c (c_common_type): Choose the decimal floating point
	type with the greater precision when determining a common type.
	(convert_arguments): Warn if there is a mismatch between argument
	and prototype for decimal float types.  Warn of conversions with
	binary float types and of precision narrowing due to prototype.
	* c-parser.c (reswords): Add _Decimal32, _Decimal64, _Decimal128.
	(c_token_starts_typename): Handle RID_DFLOAT32/64/128.
	(c_token_starts_declspecs): Likewise.
	(c_parser_attributes): Likewise.
	* c-common.h (enum rid): Add new enumeration values RID_DFLOAT32,
	RID_DFLOAT64, RID_DFLOAT128.
	(T_D32, TEX_D32, T_D64, TEX_D64, T_D128, TEX_D128): New macros.
	* c-common.c (c_common_type_for_mode): Handle decimal float modes.
	(shorten_compare): Convert DFP/BFP operands to a common type.
	(c_common_modes_and_builtins): Register built-in decimal float
	types if the target supports them.
	(handle_mode_addtribute): Handle MODE_DECIMAL_FLOAT.
	* builtins.c (fold_builtin_1): Handle 32, 64 and 128 bit cases of
	inf, nan, finite, isinf and isnan builtins.
	* c-cppbuiltin.c (builtin_define_decimal_float_constants): New.
	(builtin_define_float_constants): Assert non-decimal radix.
	(c_cpp_builtins): Register built-in __DEC_EVAL_METHOD__ define.
	Call builtin_define_decimal_float_constants for each type.
	* c-lex.c (interpret_float): Decode decimal float types from CPP_N
	flags.  Use real_from_string3, which can handle binary or decimal
	floats.
	* c-tree.h (enum c_typespec_keyword): Add cts_dfloat32,
	cts_dfloat64, cts_dfloat128.
	* tree.c (build_common_tree_nodes_2): Add decimal float types.
	* tree.h (enum tree_index): Add new enumeration values
	TI_DFLOAT32_TYPE, TI_DFLOAT64_TYPE, TI_DFLOAT128_TYPE,
	TI_DFLOAT32_PTR_TYPE, TI_DFLOAT64_PTR_TYPE, TI_DFLOAT128_PTR_TYPE.
	(dfloat32_type_node): New macro.
	(dfloat64_type_node, dfloat128_type_node): Likewise.
	(dfloat32_ptr_type_node, dfloat64_ptr_type_node): Likewise.
	(dfloat128_ptr_type_node): Likewise.
	* c-pretty-print.c (pp_c_floating_constant): Append 32, 64 and 128
	bit decimal floating point types with "df", "dd" and "dl".
	* c-format.h (enum format_lengths): Add new enumeration values
	FMT_LEN_H, FMT_LEN_D and FMT_LEN_DD.
	* c-format.c (printf_length_specs, scanf_length_specs): Add
	entries for H, D, DD.
	(print_char_table, scan_char_table): Use new entries.
	(asm_fprintf_char_table, gcc_diag_char_table,
	gcc_cdiag_char_table, gcc_cxxdiag_char_table): Adjust for longer
	length arrays.
	* defaults.h (DECIMAL32_TYPE_SIZE): Define.
	(DECIMAL64_TYPE_SIZE): Likewise.
	(DECIMAL128_TYPE_SIZE): Likewise.
	(TARGET_DEC_EVAL_METHOD): Likewise.
	* doc/extend.texi (Decimal Float): New node.
	(Constructing Calls): Document decimal float built-ins.
	* doc/tm.texi: Document TARGET_DECIMAL_FLOAT_SUPPORTED_P hook.
	* Makefile.in (USER_H): Add $(srcdir)/ginclude/decfloat.h.
	* ginclude/decfloat.h: New file.

Co-Authored-By: Ben Elliston <bje@au.ibm.com>
Co-Authored-By: Janis Johnson <janis187@us.ibm.com>

From-SVN: r108629
2005-12-16 17:38:26 +11:00
Andrew Pinski 02f8406bd0 re PR c/23103 (gcc_diag does not work with -combine)
2005-10-24  Andrew Pinski  <pinskia@physics.uc.edu>

        PR c/23103
        * c-format.c (check_format_types): Use lang_hooks.types_compatible_p
        instead of pointer equality when comparing types.

From-SVN: r105911
2005-10-25 19:15:02 -07:00
DJ Delorie 1a8d0d41ac c-format.c (check_function_format): Change warning control option from OPT_Wattribute to OPT_Wmissing_format_attribute.
* c-format.c (check_function_format): Change warning control
option from OPT_Wattribute to OPT_Wmissing_format_attribute.

From-SVN: r102286
2005-07-22 13:10:34 -04:00
Kaveh R. Ghazi 7876a41423 re PR c++/22476 (-Wmissing-format-attribute should pick out function pointer candidates also)
PR c/22476
	* c-common.c (check_function_arguments): Call
	'check_function_format' if either -Wformat or
	-Wmissing-format-attribute are specified.
	* c-format.c (check_function_format): Check -Wformat before
	calling 'check_format_info'.
	* c-opts.c (c_common_post_options): Don't warn for
	-Wmissing-format-attribute without -Wformat.
	* c-typeck.c (convert_for_assignment): Detect additional cases for
	-Wmissing-format-attribute.
	* doc/invoke.texi (-Wmissing-format-attribute): Document new
	behavior.

testsuite:
	* gcc.dg/format/miss-1.c, gcc.dg/format/miss-2.c: Don't
	specify -Wformat for these tests.
	* gcc.dg/format/miss-3.c, gcc.dg/format/miss-4.c,
	gcc.dg/format/miss-5.c, gcc.dg/format/miss-6.c: New.
	* gcc.dg/format/opt-6.c: Delete.

From-SVN: r102155
2005-07-19 12:09:49 +00:00
Kaveh R. Ghazi 0ce0154c40 c-format.c (gcc_gfc_format_type, [...]): New.
* c-format.c (gcc_gfc_format_type, gcc_gfc_flag_pairs,
	gcc_gfc_char_table, init_dynamic_gfc_info): New.
	(format_types_orig, handle_format_attribute): Add support for
	format "gcc_gfc".

fortran:
	* error.c (error_printf, error_print): Use ATTRIBUTE_GCC_GFC.
	* gfortran.h (ATTRIBUTE_GCC_GFC): New.
	(gfc_warning, gfc_warning_now, gfc_error, gfc_error_now,
	gfc_fatal_error, gfc_internal_error, gfc_notify_std): Use
	ATTRIBUTE_GCC_GFC.

testsuite:
	* gcc.dg/format/gcc_gfc-1.c: New.

From-SVN: r101552
2005-07-03 14:28:03 +00:00
Joseph Myers ea40ba9c04 c-common.h (GCC_DIAG_STYLE): Define.
* c-common.h (GCC_DIAG_STYLE): Define.
	* c-tree.h (GCC_DIAG_STYLE): Do not define.  Change minimum GCC
	version for format checking to 4.1.
	* c-format.c: Include toplev.h after c-common.h.
	(enum format_type): Add gcc_tdiag_format_type.
	(gcc_tdiag_length_specs, gcc_tdiag_flag_pairs,
	gcc_tdiag_flag_specs, gcc_tdiag_char_table): New.
	(format_types_orig): Add gcc_tdiag.
	(init_dynamic_diag_info): Support gcc_tdiag formats.
	(handle_format_attribute): Likewise.
	* toplev.h (NO_FRONT_END_DIAG, ATTRIBUTE_GCC_FE_DIAG): Remove.
	(GCC_DIAG_STYLE): Default to __gcc_tdiag__.  Change minimum GCC
	version for format checking to 4.1.
	(warning0, warning, error, pedwarn, sorry): Use
	ATTRIBUTE_GCC_DIAG.
	* config/rs6000/rs6000.c (altivec_expand_builtin), varasm.c
	(finish_aliases_1): Do not use %qE.
	* config/arm/arm.c, config/i386/i386.c, config/mmix/mmix.c,
	config/pdp11/pdp11.c, stor-layout.c, tree-eh.c, tree-ssa.c:
	Correct format bugs.
	* config/v850/v850-protos.h (v850_output_aligned_bss): Change size
	parameter to unsigned HOST_WIDE_INT.
	* config/v850/v850.c (v850_output_aligned_bss): Likewise.

cp:
	* cp-tree.h (GCC_DIAG_STYLE): #undef before defining.  Change
	minimum GCC version for format checking to 4.1.

testsuite:
	* gcc.dg/format/gcc_diag-1.c: Update.

From-SVN: r101543
2005-07-03 01:38:49 +01:00
Joseph Myers dee158440e toplev.c (default_tree_printer): Handle setting location with '+' flag.
2005-07-02  Zack Weinberg  <zack@codesourcery.com>
            Joseph S. Myers  <joseph@codesourcery.com>

	* toplev.c (default_tree_printer): Handle setting location with
	'+' flag.
	* c-objc.common.c (c_tree_printer): Likewise.
	* c-format.c (gcc_diag_flag_specs): Add '+'.
	(gcc_cdiag_char_table): Allow '+' flag for tree formats.
	(format_types_orig): Allow '+' flag for gcc_diag and gcc_cdiag
	formats.
	* c-common.c, c-decl.c, c-objc-common.c, c-pragma.c,
	config/arm/pe.c, config/i386/winnt.c, config/ia64/ia64.c,
	config/mcore/mcore.c, config/sh/symbian.c, config/sol2.c,
	config/v850/v850.c, function.c, stor-layout.c, toplev.c,
	tree-inline.c, tree-optimize.c, tree.c, varasm.c: Use '+' flag
	instead of %J or %H.  Use 'q' flag for quoting.  Avoid '.' at end
	of diagnostics.  Use %q+D not %s for a decl.  Do not pass excess
	format arguments where %J is used without %D.

cp:
	* error.c (location_of): Add comment.
	(locate_error, cp_error_at, cp_warning_at, cp_pedwarn_at): Remove.
	* cp-tree.h (cp_error_at, cp_warning_at, cp_pedwarn_at): Remove.
	* call.c, class.c, decl.c, decl2.c, friend.c, init.c,
	name-lookup.c, parser.c, pt.c, search.c, semantics.c, typeck.c,
	typeck2.c: Use '+' flag instead of %J, cp_error_at, cp_warning_at
	or cp_pedwarn_at.  Mark up some diagnostic strings with N_.

java:
	* class.c, decl.c, expr.c: Use '+' flag instead of %J.  Use 'q'
	flag for quoting.

objc:
	* objc-act.c: Use '+' flag instead of %J.  Use 'q' flag for
	quoting.

testsuite:
	* gcc.dg/format/gcc_diag-1.c: Update.

From-SVN: r101532
2005-07-02 11:55:32 +01:00
DJ Delorie 3176a0c28f c-decl.c (pop_scope): Move warning control into warning call.
* 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-28 15:33:23 -04:00
Kelley Cook 366ccddb2b Update FSF address.
From-SVN: r101317
2005-06-25 02:02:01 +00:00
DJ Delorie 5c498b10af common.opt (-Wattributes): New.
* common.opt (-Wattributes): New.  Default true.
* doc/invoke.texi (-Wno-attributes): Document.

* attribs.c (decl_attributes): Move warning control from if() to
warning(OPT_*).
* c-common.c (handle_packed_attribute): Likewise.
(handle_nocommon_attribute): Likewise.
(handle_common_attribute): Likewise.
(handle_noreturn_attribute): Likewise.
(handle_noinline_attribute): Likewise.
(handle_always_inline_attribute): Likewise.
(handle_used_attribute): Likewise.
(handle_unused_attribute): Likewise.
(handle_const_attribute): Likewise.
(handle_transparent_union_attribute): Likewise.
(handle_constructor_attribute): Likewise.
(handle_destructor_attribute): Likewise.
(handle_mode_attribute): Likewise.
(handle_alias_attribute): Likewise.
(handle_visibility_attribute): Likewise.
(handle_tls_model_attribute): Likewise.
(handle_malloc_attribute): Likewise.
(handle_returns_twice_attribute): Likewise.
(handle_pure_attribute): Likewise.
(handle_deprecated_attribute): Likewise.
(handle_vector_size_attribute): Likewise.
(handle_nothrow_attribute): Likewise.
(handle_cleanup_attribute): Likewise.
(handle_warn_unused_result_attribute): Likewise.
(handle_sentinel_attribute): Likewise.
* c-decl.c (diagnose_mismatched_decls): Likewise.
(start_decl): Likewise.
(grokdeclarator): Likewise.
(start_function): Likewise.
* c-format.c (check_function_format): Likewise.
* stor-layout.c (place_field): Likewise.
(finalize_record_size): Likewise.
* tree.c (handle_dll_attribute)): Likewise.
* varasm.c (default_assemble_visibility): Likewise.
* config/darwin.c (darwin_handle_weak_import_attribute): Likewise.
(darwin_assemble_visibility): Likewise.
* config/arc/arc.c (arc_handle_interrupt_attribute): Likewise.
* config/arm/arm.c (arm_handle_fndecl_attribute): Likewise.
(arm_handle_isr_attribute): Likewise.
* config/avr/avr.c (avr_handle_progmem_attribute): Likewise.
(avr_handle_fndecl_attribute): Likewise.
* config/bfin/bfin.c (handle_int_attribute): Likewise.
* config/c4x/c4x.c (c4x_handle_fntype_attribute): Likewise.
* config/h8300/h8300.c (h8300_handle_fndecl_attribute): Likewise.
(h8300_handle_eightbit_data_attribute): Likewise.
(h8300_handle_tiny_data_attribute): Likewise.
* config/i386/i386.c (ix86_handle_cdecl_attribute): Likewise.
(ix86_handle_regparm_attribute): Likewise.
(ix86_handle_struct_attribute): Likewise.
* config/i386/winnt.c (ix86_handle_shared_attribute): Likewise.
(i386_pe_encode_section_info): Likewise.
* config/ia64/ia64.c (ia64_handle_model_attribute): Likewise.
* config/ip2k/ip2k.c (ip2k_handle_progmem_attribute): Likewise.
(ip2k_handle_fndecl_attribute): Likewise.
* config/m32r/m32r.c (m32r_handle_model_attribute): Likewise.
* config/m68hc11/m68hc11 (m68hc11_handle_page0_attribute): Likewise.
(m68hc11_handle_fntype_attribute): Likewise.
(m68hc11_encode_section_info): Likewise.
* config/m68k/m68k.c (m68k_handle_fndecl_attribute): Likewise.
* config/mcore/mcore.c (mcore_handle_naked_attribute): Likewise.
* config/ns32k/ns32k.c (ns32k_handle_fntype_attribute): Likewise.
* config/rs6000/rs6000.c (rs6000_handle_longcall_attribute): Likewise.
* config/sh/sh.c (sh_handle_interrupt_handler_attribute): Likewise.
(sh_handle_sp_switch_attribute): Likewise.
(sh_handle_trap_exit_attribute): Likewise.
* config/sh/symbian.c (sh_symbian_dllimport_p): Likewise.
(sh_symbian_handle_dll_attribute): Likewise.
* config/stormy16/stormy16.c (xstormy16_handle_interrupt_attribute): Likewise.
(xstormy16_handle_below100_attribute): Likewise.
* config/v850/v850.c (v850_handle_interrupt_attribute): Likewise.

[testsuite]

* gcc.dg/Wattributes-1.c: New.
* gcc.dg/Wattributes-2.c: New.
* gcc.dg/Wattributes-3.c: New.

[cp]

* decl.c (duplicate_decls): Move warning control from if() to
warning(OPT_*).
* name-lookup.c (parse_using_directive): Likewise.
* parser.c (cp_parser_elaborated_type_specifier): Likewise.
(cp_parser_init_declarator): Likewise.
* tree.c (handle_com_interface_attribute): Likewise.

[java]

* class.c (set_constant_value): Move warning control from if() to
warning(OPT_*).

From-SVN: r100136
2005-05-25 00:18:19 -04:00
DJ Delorie 44c21c7f03 c-common.c (unsigned_conversion_warning): Move warning control from if() to 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-24 23:59:00 -04:00
Richard Guenther f5c9a09777 c-format.c (check_format_arg): Handle string literals of the form &"string"[offset].
2005-05-14  Richard Guenther  <rguenth@gcc.gnu.org>

	* c-format.c (check_format_arg): Handle string literals of
	the form &"string"[offset].

	* g++.dg/warn/format4.C: New testcase.

From-SVN: r99652
2005-05-13 09:48:12 +00:00
Joseph Myers 5e49f16b80 re PR c/20740 (cc1 segfaults)
PR c/20740
	* c-format.c (init_dynamic_asm_fprintf_info): Give errors, not
	assertion failures, if __gcc_host_wide_int__ is not properly
	defined.
	(init_dynamic_diag_info): Give errors, not assertion failures, if
	location_t, tree or __gcc_host_wide_int__ are not properly
	defined.

testsuite:
	* gcc.dg/format/asm_fprintf-2.c, gcc.dg/format/asm_fprintf-3.c,
	gcc.dg/format/asm_fprintf-4.c, gcc.dg/format/asm_fprintf-5.c,
	gcc.dg/format/gcc_diag-2.c, gcc.dg/format/gcc_diag-3.c,
	gcc.dg/format/gcc_diag-4.c, gcc.dg/format/gcc_diag-5.c,
	gcc.dg/format/gcc_diag-6.c, gcc.dg/format/gcc_diag-7.c ,
	gcc.dg/format/gcc_diag-8.c, gcc.dg/format/gcc_diag-9.c: New tests.

From-SVN: r98800
2005-04-27 00:58:04 +01:00
DJ Delorie d4ee4d2525 diagnostic.c (warning): Accept parameter to classify warning option.
* 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-23 17:29:07 -04:00
Nathan Sidwell 535a42b116 builtins.c (gimplify_va_arg_expr): Reword comments to avoid 'abort'.
* 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-22 16:14:55 +00:00
Kazu Hirata 5f99662735 builtin-types.def, [...]: Update copyright.
* builtin-types.def, c-convert.c, c-format.c, ddg.c, debug.c,
	debug.h, et-forest.c, et-forest.h, gcov.c, rtl-profile.c,
	rtlhooks-def.h, rtlhooks.c, sdbout.c, tree-inline.h,
	tree-profile.c, tsystem.h, value-prof.h: Update copyright.

From-SVN: r97209
2005-03-29 22:15:53 +00:00
Joseph Myers f6d1c3a69b c-common.c (handle_aligned_attribute, [...]): Do not strip NOPS from 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-20 15:23:50 +00:00
Joseph Myers c51a1ba9d9 c-common.c, [...]: Use %D for declarations in diagnostics and %E for 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-18 20:47:27 +00:00
Joseph Myers 40b97a2e29 builtins.c, [...]: Say "argument" instead of "arg" in diagnostics.
* builtins.c, c-common.c, c-decl.c, c-format.c: Say "argument"
	instead of "arg" in diagnostics.

testsuite:
	* gcc.dg/builtin-prefetch-1.c: Update expected diagnostic.

From-SVN: r90338
2004-11-09 10:20:12 +00:00
Joseph Myers 9e637a2679 builtins.c, [...]: Avoid "`" as left quote, using "'" or %q, %< and %> as appropriate.
* builtins.c, c-common.c, c-decl.c, c-format.c, c-format.h,
	c-parse.in, c-pch.c, c-pragma.c, collect2.c, final.c, gcc.c,
	gcov.c, opts.c, pretty-print.h, protoize.c, reg-stack.c, rtl.c,
	tlink.c, config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c,
	config/avr/avr.c, config/c4x/c4x.c, config/darwin.c,
	config/frv/frv.c, config/h8300/h8300.c, config/i386/i386.c,
	config/i386/winnt.c, config/ia64/ia64.c, config/ip2k/ip2k.c,
	config/iq2000/iq2000.c, config/m32r/m32r.c,
	config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/m68k/m68k.h,
	config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c,
	config/ns32k/ns32k.c, config/rs6000/host-darwin.c,
	config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c,
	config/sh/symbian.c, config/stormy16/stormy16.c,
	config/v850/v850.c: Avoid "`" as left quote, using "'" or %q, %<
	and %> as appropriate.  Use %' as apostrophe in diagnostics where
	applicable.  Use %< and %> in place of '' quotes where applicable.
	Use %qs in place of %<%s%>.  Consistently quote __builtin function
	names.

ada:
	* misc.c (gnat_handle_option): Use %< and %> for quoting in
	warning message.

cp:
	* call.c, class.c, decl.c, decl2.c, error.c, mangle.c, parser.c,
	pt.c, search.c, semantics.c, typeck.c: Use %q, %< and %> for
	quoting in diagnostics.
	* parser.c (cp_parser_sizeof_operand): Use '' instead of `' for
	quoting in printf format.
	* decl.c (duplicate_decls, start_decl): Use %qD instead of
	unquoted %D.

objc:
	* objc-act.c: Use %q, %< and %> for quoting in diagnostics.

testsuite:
	* gcc.dg/builtin-prefetch-1.c: Adjust expected messages.

From-SVN: r90337
2004-11-09 10:13:30 +00:00
Joseph Myers 3f75a25471 c-aux-info.c, [...]: Follow code formatting conventions.
* c-aux-info.c, c-common.c, c-common.h, c-cppbuiltin.c, c-decl.c,
	c-format.c, c-incpath.c, c-lex.c, c-objc-common.c, c-opts.c,
	c-parse.in, c-pch.c, c-ppoutput.c, c-pragma.c, c-typeck.c: Follow
	code formatting conventions.

From-SVN: r88462
2004-10-03 21:53:05 +01:00
Jeffrey D. Oldham 6615c44615 alias.c (find_base_decl): Remove unreachable case '3' block.
2004-09-17  Jeffrey D. Oldham  <oldham@codesourcery.com>
	    Zack Weinberg  <zack@codesourcery.com>

	* alias.c (find_base_decl): Remove unreachable case '3' block.
	* expr.c (safe_from_p): Abort if passed a type.
	* tree-gimple.c (recalculate_side_effects): Abort if passed
	anything other than an expression.
	* tree-ssa-pre.c (phi_translate): Return expr immediately if
	is_gimple_min_invariant is true for it.  Reorder cases for clarity.
	Abort on un-handled tree classes.
	(valid_in_set): Likewise.
	* tree.c (tree_code_class_strings): New static data.

	* tree.h (enum tree_code_class): New.
	(tree_code_class_strings): Declare.
	(TREE_CODE_CLASS_STRING, EXCEPTIONAL_CLASS_P, CONSTANT_CLASS_P)
	(REFERENCE_CLASS_P, COMPARISON_CLASS_P, UNARY_CLASS_P, BINARY_CLASS_P)
	(STATEMENT_CLASS_P, EXPRESSION_CLASS_P, IS_TYPE_OR_DECL_P): New macros.
	(TYPE_P, DECL_P, IS_NON_TYPE_CODE_CLASS, IS_EXPR_CODE_CLASS)
	(checking macros, EXPR_LOCATION, SET_EXPR_LOCATION, EXPR_LOCUS): Update.

	* tree.def, c-common.def, objc/objc-tree.def: Use
	tree_code_class enumeration constants instead of code letters.

	* alias.c, builtins.c, c-common.c, c-format.c, c-lang.c, c-pragma.c
	* c-typeck.c, cgraphunit.c, convert.c, dbxout.c, dwarf2out.c
	* emit-rtl.c expr.c, fold-const.c, gimplify.c, lambda-code.c
	* langhooks.c, langhooks.h, predict.c, print-tree.c, reload1.c, stmt.c
	* tree-browser.c, tree-cfg.c, tree-chrec.c, tree-complex.c, tree-dfa.c
	* tree-dump.c, tree-eh.c, tree-gimple.c, tree-inline.c, tree-nested.c
	* tree-outof-ssa.c, tree-pretty-print.c, tree-sra.c, tree-ssa-ccp.c
	* tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-forwprop.c, tree-ssa-live.c
	* tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c, tree-ssa-operands.c
	* tree-ssa-phiopt.c, tree-ssa-pre.c, tree-ssa-propagate.c
	* tree-ssa.c, tree-ssanames.c, tree-tailcall.c, tree.c, varasm.c
	* config/sol2-c.c, config/arm/arm.c, config/i386/winnt.c
	* config/pa/pa.c, config/pa/pa.h, config/sh/sh.c, objc/objc-lang.c
	Update to match.

	* LANGUAGES: Add note about change.

ada:
	* ada-tree.def: Use tree_code_class enumeration constants
	instead of code letters.
	* ada-tree.h, decl.c, misc.c, trans.c, utils.c, utils2.c:
	Update for new tree-class enumeration constants.

cp:
	* cp-tree.def: Use tree_code_class enumeration constants
	instead of code letters.
	* call.c, class.c, cp-gimplify.c, cp-lang.c, cxx-pretty-print.c
	* mangle.c, pt.c, semantics.c, tree.c, typeck.c:
	Update for new tree-class enumeration constants.

fortran:
	* f95-lang.c, trans-expr.c, trans.c: Update for new tree-class
	enumeration constants.

java:
	* java-tree.def: Use tree_code_class enumeration constants
	instead of code letters.
	* java-gimplify.c, jcf-write.c, lang.c, parse.y: Update for
	new tree-class enumeration constants.

treelang:
	* treetree.c: Update for new tree-class enumeration constants.

From-SVN: r87675
2004-09-17 21:55:02 +00:00
Joseph Myers 971801fff6 attribs.c, [...]: Use %<, %> and %q for quoting in diagnostics going through pretty-print.c.
gcc:
	* attribs.c, builtins.c, c-format.c, c-pch.c, coverage.c,
	except.c, fold-const.c, function.c, langhooks.c, params.c,
	reload.c, reload1.c, stmt.c, stor-layout.c, toplev.c, tree-cfg.c,
	tree-dump.c, tree-mudflap.c, tree.c, varasm.c: Use %<, %> and %q
	for quoting in diagnostics going through pretty-print.c.  Use ''
	for quoting in other diagnostic text.
	* langhooks.c: Include intl.h.  Mark text locating diagnostics for
	translation.
	* Makefile.in (langhooks.o): Update dependencies.
	* pretty-print.h (pp_printf): Mark as accepting GCC diagnostic
	formats.

gcc/testsuite:
	* g++.dg/ext/member-attr.C, g++.dg/warn/deprecated.C,
	gcc.dg/deprecated.c, gcc.dg/noreturn-1.c, gcc.dg/noreturn-4.c:
	Update expected messages.

libmudflap:
	* testsuite/libmudflap.c/pass35-frag.c: Update expected message.

From-SVN: r87563
2004-09-15 21:48:10 +01:00
Nathan Sidwell 366de0ce7d c-aux-info.c (gen_type): Use gcc_assert or gcc_unreachable.
* c-aux-info.c (gen_type): Use gcc_assert or gcc_unreachable.
	* c-common.c (c_type_hash, c_common_nodes_and_builtins,
	c_expand_expr, boolean_increment, nonnull_check_p,
	check_function_arguments_recurse, fold_offsetof_1): Likewise.
	* c-cppbuiltin.c (define__GNUC__, builtin_define_stdint_macros,
	builtin_define_type_max): Likewise.
	* c-decl.c (bind, pop_scope, merge_decls, pushdecl_top_level,
	implicit_decl_warning, builtin_function, build_compound_literal,
	complete_array_type, grokdeclarator, get_parm_info,
	start_function, store_parm_decls_oldstyle,
	c_write_global_declarations): Likewise.
	* c-format.c (get_constant, decode_format_attr,
	maybe_read_dollar_number, get_flag_spec, check_format_arg,
	check_format_types, format_type_warning,
	find_char_info_specifier_index, init_dynamic_asm_fprintf_info,
	init_dynamic_diag_info, handle_format_attribute): Likewise.
	* c-gimplify.c (push_context, pop_context, finish_bc_block):
	* c-lex.c (c_lex_with_flags, lex_string): Likewise.
	* c-objc-common.c (c_tree_printer): Likewise.
	* c-pch.c (pch_init): Likewise.
	* c-pragma.c (maybe_apply_pragma_weak): Likewise.
	* c-pretty-print.c (pp_c_tree_decl_identifier): Likewise.
	* c-typeck.c (c_incomplete_type_error, composite_type,
	common_pointer_type, common_type, same_translation_unit_p,
	tagged_types_tu_compatible_p, finish_init, pop_init_level,
	set_designator, set_nonincremental_init_from_string,
	process_init_element, c_finish_if_stmt): Likewise.
	* caller-save.c (init_caller_save, save_call_clobbered_regs,
	insert_restore, insert_save, insert_one_insn): Likewise.
	* calls.c (emit_call_1, compute_argument_block_size,
	precompute_arguments, expand_call, emit_library_call_value_1,
	store_one_arg): Likewise.

From-SVN: r87140
2004-09-07 10:19:00 +00:00
Bernardo Innocenti 28dab13236 basic-block.h (reorder_block_def): Rename to reorder_block_def_p.
* basic-block.h (reorder_block_def): Rename to reorder_block_def_p.
	* c-common.c: Add missing casts from void * to other types.
	* c-decl.c: Likewise.
	* c-format.c: Likewise.
	* c-lex.c: Likewise.
	* c-pragma.c: Likewise.
	* c-typeck.c: Likewise.
	* defaults.h: Likewise.
	* genconstants.c: Likewise.
	* gengtype-lex.l: Likewise.
	* genmodes.c: Likewise.
	* read-rtl.c: Likewise.
	* rtl.c: Likewise.

From-SVN: r85166
2004-07-26 00:17:02 +02:00
Bernardo Innocenti e18476eb94 c-common.c: Convert ATTRIBUTE_UNUSED to ARG_UNUSED in parameter lists.
* c-common.c: Convert ATTRIBUTE_UNUSED to ARG_UNUSED in parameter
	lists.
	* c-decl.c: Likewise.
	* c-format.c: Likewise.
	* c-lex.c: Likewise.
	* c-opts.c: Likewise.
	* c-pragma.c: Likewise.
	* c-typeck.c: Likewise.
	* gencheck.c: Likewise.
	* genconditions.c: Likewise.
	* genconfig.c: Likewise.
	* genflags.c: Likewise.
	* gengtype.c: Likewise.
	* gensupport.c: Likewise.
	* ggc-none.c: Likewise.
	* langhooks.c: Likewise.
	* statistics.h: Likewise.
	* stub-objc.c: Likewise.
	* java/decl.c: Likewise.

From-SVN: r85128
2004-07-25 02:13:01 +02:00
Daniel Jacobowitz a2bec81863 Makefile.in (c-format.o): Depend on c-format.h.
gcc/
	* Makefile.in (c-format.o): Depend on c-format.h.
	* c-format.h: New file.
	(struct format_char_info): Add CHAIN member.
	* c-format.c: Move some types and constants to c-format.h.
	(format_type_error): Set to -1.
	(struct function_format_info): Use an int for format_type.
	(decode_format_type): Return an int.  Return format_type_error
	on error.
	(print_char_table, asm_fprintf_char_table, gcc_diag_char_table)
	(gcc_diag_char_table, gcc_cdiag_char_table, gcc_cxxdiag_char_table)
	(scan_char_table, time_char_table, monetary_char_table): Initialize
	CHAIN to NULL.
	(n_format_types): New variable.
	(check_format_info_main): Handle CHAIN in format_char_info.
	(handle_format_attribute): Handle TARGET_FORMAT_TYPES and
	TARGET_N_FORMAT_TYPES.
	* config.gcc (i[34567]86-*-solaris2*, sparc64-*-solaris2*)
	(sparc-*-solaris2*): Include config/t-sol2 and config/sol2-c.c.
	* config/sol2-c.c: New file.
	* config/t-sol2: New file.
	* config/sol2.h (TARGET_N_FORMAT_TYPES, TARGET_FORMAT_TYPES): Define.
	* config/sparc/elf.h, config/sparc/sp64-elf.h: Undefine
	TARGET_N_FORMAT_TYPES and TARGET_FORMAT_TYPES.

	* doc/extend.texi (Target Format Checks): New section.
	(Function Attributes): Mention it.
	* doc/invoke.texi: Mention target format checks.
	* doc/sourcebuild.texi: Mention target format checks.
	* dc/tm.texi (Misc): Document TARGET_N_FORMAT_TYPES and
	TARGET_FORMAT_TYPES.
testsuite/
	* gcc.dg/format/cmn-err-1.c: New test.

From-SVN: r84920
2004-07-19 14:48:09 +00:00
Joseph Myers ede1a38729 re PR c/1027 (slightly misleading printf format warning)
PR c/1027
	* c-lang.c (c_initialize_diagnostics): Move from here ...
	* c-objc-common.c: ... to here.  Include "c-pretty-print.h".
	(c_tree_printer): Use pretty-printer to format %T.
	* c-pretty-print.c (pp_c_specifier_qualifier_list): Include space
	before '*' if not C++.
	(pp_c_direct_abstract_declarator): Don't try to print array upper
	bound for flexible array members.
	* c-tree.h: Include "diagnostic.h".
	(c_initialize_diagnostics): Declare.
	* objc/objc-lang.c (LANG_HOOKS_INITIALIZE_DIAGNOSTICS): Define.
	* c-format.c (format_type_warning): New function.  Improve
	diagnostics for incorrect format argument types.
	(check_format_types): Use it.  Add two parameters.  Use the
	TYPE_MAIN_VARIANT of wanted_type.
	(check_format_info_main): Pass new parameters to
	check_format_types.
	(struct format_wanted_type): Update comment.

testsuite:
	* gcc.dg/Wswitch-enum.c, gcc.dg/Wswitch.c,
	gcc.dg/format/branch-1.c, gcc.dg/format/diag-1.c,
	gcc.dg/format/multattr-3.c, gcc.dg/format/xopen-1.c: Update
	expected warning text.
	* gcc.dg/format/diag-2.c: New test.

From-SVN: r83965
2004-07-01 09:52:33 +01:00
Joseph Myers 9980154889 c-common.h (check_function_format): Remove first parameter.
* c-common.h (check_function_format): Remove first parameter.
	* c-format.c (format_check_context): Remove status.
	(check_format_info, check_format_info_main,
	maybe_read_dollar_number, avoid_dollar_number,
	finish_dollar_format_checking, check_format_types,
	check_function_format): Remove first parameter.  Don't use
	status_warning.
	(check_format_arg): Don't use status_warning.
	(status_warning): Remove.
	* c-common.c (check_function_arguments): Update call to
	check_function_format.

cp:
	* call.c (build_over_call), typeck.c (build_function_call): Update
	calls to check_function_format.

From-SVN: r83935
2004-06-30 23:28:02 +01:00
Joseph Myers ca09cd34f1 pretty-print.c (pp_base_format_text): Support %< instead of %` and %> as well as %'.
* pretty-print.c (pp_base_format_text): Support %< instead of %`
	and %> as well as %'.
	* c-format.c: Use %< and %>.
	(gcc_diag_char_table, gcc_cdiag_char_table,
	gcc_cxxdiag_char_table): Update.

From-SVN: r82428
2004-05-29 21:10:10 +01:00
Joseph Myers a668adb2f3 intl.h (open_quote, [...]): New.
* intl.h (open_quote, close_quote): New.
	* intl.c (open_quote, close_quote): New.
	(gcc_init_libintl): Set them.
	* pretty-print.c: Include "intl.h".
	(pp_base_format_text): Support 'q' format flag and %` and %'
	formats.  Use ' instead of ` in comments.
	* c-format.c (gcc_diag_flag_specs, gcc_cxxdiag_flag_specs,
	gcc_diag_char_table, gcc_cdiag_char_table, gcc_cxxdiag_char_table,
	foramt_types_orig): Describe these new formats.
	(decode_format_attr, check_function_format,
	check_format_info_main): Use these new formats.
	(status_warning): Use ATTRIBUTE_GCC_DIAG.
	* toplev.c (ATTRIBUTE_GCC_DIAG): Increase required GCC version to
	check these formats to 3.5.

From-SVN: r82215
2004-05-24 20:28:20 +01:00
Joseph Myers e9a757769b re PR c/15444 (Bad warning message in printf format checking)
PR c/15444
	* c-format.c (avoid_dollar_number): New function.
	(check_format_info_main): Call avoid_dollar_number when operand
	numbers might occur but has_operand_number == 0.

testsuite:
	* gcc.dg/format/xopen-1.c: Adjust expected message.
	* gcc.dg/format/xopen-3.c: New test.

From-SVN: r81871
2004-05-15 01:44:02 +01:00
Diego Novillo 6de9cd9a88 Merge tree-ssa-20020619-branch into mainline.
From-SVN: r81764
2004-05-13 02:41:07 -04:00
Richard Kenner 8df83eae1e builtins.c, [...]: Change most occurrences of TREE_UNSIGNED to TYPE_UNSIGNED.
* builtins.c, c-aux-info.c, c-common.c, c-cppbuiltin.c, c-decl.c:
	Change most occurrences of TREE_UNSIGNED to TYPE_UNSIGNED.
	* c-format.c, c-opts.c, c-pretty-print.c, c-typeck.c: Likewise.
	* calls.c, convert.c, dbxout.c, dojump.c, dwarf2out.c: Likewise.
	* expmed.c, expr.c, fold-const.c, function.c, integrate.c: Likewise.
	* optabs.c, sdbout.c, stmt.c, stor-layout.c, tree-dump.c: Likewise.
	* tree.c, config/iq2000/iq2000.c, config/m32r/m32r.c: Likewise.
	* config/mips/mips.c, config/rs6000/rs6000.c: Likewise.
	* config/s390/s390.c, config/sparc/sparc.c, objc/objc-act.c: Likewise.
	* stor-layout.c (layout_type, case COMPLEX_TYPE): Test for
	REAL_TYPE, not INTEGER_TYPE.
	(layout_type, case VECTOR_TYPE): Simplify code.
	* tree.c (build_vector_type_for_mode): Remove dup unsigned setting.
	* tree.h: Update comments.
	(STRIP_NOPS): Use TYPE_UNSIGNED.
	(TYPE_UNSIGNED): New macro.
	(TYPE_TRAP_SIGNED): Remove now redundant check.
	(SAVE_EXPR_NOPLACEHOLDER): Don't use TREE_UNSIGNED.

	* cp/call.c (joust): Use TYPE_UNSIGNED, not TREE_UNSIGNED.
	* cp/class.c (check_bitfield_decl): Likewise.
	* cp/cvt.c (type_promotes_to): Likewise.
	* cp/decl.c (finish_enum): Likewise.
	* cp/mangle.c (write_builtin_type): Likewise.
	* cp/semantics.c (finish_switch_cond, finish_unary_op_expr): Likewise.
	* cp/typeck.c (type_after_usual_arithmetic_conversions): Likewise.
	(build_binary_op): Likewise.

	* f/com.c (ffecom_arrayref_): Use TYPE_UNSIGNED, not TREE_UNSIGNED.
	(ffecom_expr_): Likewise.

	* java/jcf-write.c (generate_bytecode_insns): Use TYPE_UNSIGNED.

	* treelang/treetree.c (tree_lang_signed_or_unsigned_type):
	Use TYPE_UNSIGNED, not TREE_UNSIGNED.

	* ada/decl.c (gnat_to_gnu_entity, make_type_from_size):
	Use TYPE_UNSIGNED, not TREE_UNSIGNED.
	* ada/trans.c (tree_transform, convert_with_check): Likewise.
	* ada/utils.c (gnat_signed_or_unsigned_type): Likewise.
	(build_vms_descriptor, unchecked_convert): Likewise.
	* ada/utils2.c (nonbinary_modular_operation): Likewise.

From-SVN: r80287
2004-03-31 22:50:43 -05:00
Roger Sayle ae2bcd98fa alias.c (get_alias_set): Replace calls via (*lang_hooks.foo) () with lang_hooks.foo ().
* alias.c (get_alias_set): Replace calls via (*lang_hooks.foo) ()
	with lang_hooks.foo ().
	* builtins.c (expand_builtin_va_arg): Likewise.
	* c-common.c (fname_as_string, c_common_truthvalue_conversion,
	c_common_type_for_mode, c_common_nodes_and_builtins,
	handle_mode_attribute, handle_vector_size_attribute): Likewise.
	* c-convert.c (convert): Likewise.
	* c-format.c (check_format_types): Likewise.
	* c-objc-common.c (c_tree_printer): Likewise.
	* c-typeck.c (build_unary_op, build_conditional_expr,
	build_binary_op): Likewise.
	* calls.c (try_to_integrate, expand_call,
	emit_library_call_value_1): Likewise.
	* cgraph.c (cgraph_node_name, cgraph_function_possibly_inlined_p):
	Likewise.
	* cgraphunit.c (record_call_1, cgraph_analyze_function,
	cgraph_expand_function): Likewise.
	* convert.c (convert_to_pointer, convert_to_integer): Likewise.
	* coverage.c (build_fn_info_type, build_ctr_info_type,
	build_gcov_info, create_coverage): Likewise.
	* dbxout.c (dbxout_init): Likewise.
	* diagnostic.c (diagnostic_report_current_function): Likewise.
	* dojump.c (do_jump): Likewise.
	* dwarf2out.c (dwarf2_name): Likewise.
	* except.c (init_eh): Likewise.
	* explow.c (expr_size, int_expr_size): Likewise.
	* expmed.c (make_tree, const_mult_add_overflow_p, expand_mult_add):
	Likewise.
	* expr.c (store_expr, store_constructor, safe_from_p,
	expand_expr_real, do_store_flag, try_casesi): Likewise.
	* function.c (push_function_context_to, pop_function_context_from,
	free_after_parsing, assign_stack_local_1, assign_stack_temp_for_type,
	put_var_into_stack, allocate_struct_function, current_function_name):
	Likewise.
	* integrate.c (copy_decl_for_inlining, expand_inline_function):
	Likewise.
	* langhooks.c (lhd_clear_binding_stack, write_global_declarations,
	lhd_print_error_function): Likewise.
	* opts.c (handle_option, decode_options): Likewise.
	* passes.c (open_dump_file): Likewise.
	* print-tree.c (print_node): Likewise.
	* stmt.c (expand_fixup, fixup_gotos, expand_asm_operands,
	expand_decl_cleanup, emit_case_nodes): Likewise.
	* stor-layout.c (variable_size): Likewise.
	* toplev.c (announce_function, wrapup_global_declarations,
	check_global_declarations, compile_file, default_tree_printer,
	process_options, lang_dependent_init, finalize): Likewise.
	* tree-dump.c (dequeue_and_dump): Likewise.
	* tree-inline.c (remap_decl, remap_block, copy_body_r,
	initialize_inlined_parameters, declare_return_variable,
	inlinable_function_p, expand_call_inline, optimize_inline_calls,
	walk_tree, copy_tree_r): Likewise.
	* tree-optimize.c (tree_rest_of_compilation): Likewise.
	* tree.c (decl_assembler_name, tree_size, size_in_bytes, staticp,
	unsafe_for_reeval, get_unwidened, get_narrower, get_callee_fndecl,
	variably_modified_type_p, dump_tree_statistics): Likewise.
	* varasm.c (assemble_variable, compare_constant, copy_constant,
	force_const_mem, compute_reloc_for_constant, output_constant,
	output_addressed_constants, initializer_constant_valid_p): Likewise.

From-SVN: r79481
2004-03-14 22:26:14 +00:00
Joseph Myers be7ac47149 c-format.c (print_char_table): Allow 'I' flag on floating point decimal formats.
* c-format.c (print_char_table): Allow 'I' flag on floating point
	decimal formats.

testsuite:
	* gcc.dg/format/ext-1.c: Allow 'I' flag on floating point decimal
	formats.

From-SVN: r74860
2003-12-20 00:00:39 +00:00
Joseph Myers c76f4e8ef4 re PR c/3190 (-Wformat-y2k doesn't belong to -Wall - it's hard to avoid)
PR c/3190
	PR c/8714
	* c-format.c (set_Wformat): Do not enable -Wformat-y2k by default.
	* invoke.texi: Update.

testsuite:
	PR c/3190
	PR c/8714
	* gcc.dg/format/c90-strftime-1.c, gcc.dg/format/c90-strftime-2.c,
	gcc.dg/format/c99-strftime-1.c, gcc.dg/format/ext3.c,
	gcc.dg/format/no-y2k-1.c: Update.

From-SVN: r73378
2003-11-08 22:42:00 +00:00
Richard Henderson ddd2d57e72 c-format.c (gcc_diag_char_table): Add %J.
* c-format.c (gcc_diag_char_table): Add %J.
        (gcc_cdiag_char_table, gcc_cxxdiag_char_table): Likewise.
        (check_format_types): Fix wanted_type name lookup.
        (init_dynamic_diag_info): Setup %J.
        * diagnostic.c (text_specifies_location): Implement %J.
        * c-common.c, c-decl.c, c-objc-common.c, c-pragma.c, calls.c,
        dwarfout.c, expr.c, function.c, stmt.c, stor-layout.c, toplev.c,
        tree-inline.c, tree-optimize.c, varasm.c, config/arm/pe.c,
        config/i386/winnt.c, config/ia64/ia64.c, config/mcore/mcore.c,
        config/v850/v850.c, objc/objc-act.c: Use %J in diagnostics.

        * tree-inline.c: Include intl.h
        (inline_forbidden_p_1): Fix i18n of inline_forbidden_reason.
        * Makefile.in (tree-inline.o): Update.
cp/
        * decl.c, decl2.c, pt.c: Use %J in diagnostics.
java/
        * check-init.c, class.c, decl.c, expr.c: Use %J in diagnostics.
testsuite/
        * gcc.dg/format/gcc_diag-1.c: Add tests for %J.

From-SVN: r71619
2003-09-20 22:07:20 -07:00
Gabriel Dos Reis eb8221eaf2 c-common.c: Don't undefine GCC_DIAG_STYLE.
* c-common.c: Don't undefine GCC_DIAG_STYLE.
	(fname_decl): Don't use xxx_with_decl.
	(c_add_case_label): Likewise.
	(handle_section_attribute): Likewise.
	(handle_alias_attribute): Likewise.
	(handle_no_instrument_function_attribute): Likewise.
	(handle_no_limit_stack_attribute): Likewise.
	* c-objc-common.c (c_tree_printer): Print IDENTIFIER_NODEs.
	* c-format.c (gcc_cdiag_char_table): Add '%E' format-specifier.

From-SVN: r69573
2003-07-18 23:05:53 +00:00
Kazu Hirata 4ed432168c c-format.c: Fix comment formatting.
* c-format.c: Fix comment formatting.
	* c-typeck.c: Likewise.
	* coverage.c: Likewise.
	* cppcharset.c: Likewise.
	* cpplib.c: Likewise.
	* dbxout.c: Likewise.
	* gcov-io.h: Likewise.
	* toplev.c: Likewise.

From-SVN: r69276
2003-07-12 22:49:48 +00:00
Kazu Hirata e0bb17a83f basic-block.h: Fix comment typos.
* basic-block.h: Fix comment typos.
	* bb-reorder.c: Likewise.
	* c-format.c: Likewise.
	* cfgcleanup.c: Likewise.
	* cfghooks.h: Likewise.
	* cfgloop.c: Likewise.
	* cfgloopmanip.c: Likewise.
	* cfgrtl.c: Likewise.
	* cgraph.h: Likewise.
	* cgraphunit.c: Likewise.
	* combine.c: Likewise.
	* convert.c: Likewise.
	* dbxout.c: Likewise.
	* df.c: Likewise.
	* df.h: Likewise.
	* diagnostic.c: Likewise.
	* dwarf2out.c: Likewise.
	* et-forest.h: Likewise.
	* flow.c: Likewise.
	* fold-const.c: Likewise.
	* function.h: Likewise.
	* gcov-io.h: Likewise.
	* gcov.c: Likewise.
	* gcse.c: Likewise.
	* genautomata.c: Likewise.
	* ggc-common.c: Likewise.
	* ggc-page.c: Likewise.
	* loop-unroll.c: Likewise.
	* loop-unswitch.c: Likewise.
	* loop.c: Likewise.
	* mips-tfile.c: Likewise.
	* optabs.c: Likewise.
	* ra-build.c: Likewise.
	* ra-colorize.c: Likewise.
	* ra-rewrite.c: Likewise.
	* ra.h: Likewise.
	* regmove.c: Likewise.
	* reload.c: Likewise.
	* rtlanal.c: Likewise.
	* sched-ebb.c: Likewise.
	* sched-int.h: Likewise.
	* sched-vis.c: Likewise.
	* sreal.c: Likewise.
	* ssa-ccp.c: Likewise.
	* ssa.c: Likewise.
	* toplev.c: Likewise.
	* tree-inline.c: Likewise.
	* value-prof.c: Likewise.
	* value-prof.h: Likewise.

From-SVN: r68770
2003-07-01 12:18:01 +00:00
Neil Booth 37fa72e9d3 c-common.c (enum c_language_kind, flag_objc): Remove.
* c-common.c (enum c_language_kind, flag_objc): Remove.
	(fix_string_type, check_case_value, c_common_nodes_and_builtins,
	c_add_case_label, finish_label_addr_expr, boolean_increment):
	Use c_dialect_ macros.
	* c-common.h (enum c_language_kind): Extend.
	(c_dialect_cxx, c_dialect_objc): New.
	(flag_objc): Remove.
	(c_common_init_options): Update prototype.
	* c-cppbuiltin.c (define__GNUC__, c_cpp_builtins): Use c_dialect_
	macros.
	* c-decl.c (finsih_decl, grokfield, finish_struct): Use c_dialect_
	macros.
	* c-format.c (C_STD_VER, C_STD_NAME): Similarly.
	* c-lang.c (c_init_options): Remove.
	(c_language): Define.
	(LANG_HOOKS_INIT_OPTIONS): Use common hook.
	* c-lex.c (lex_charconst): Use c_dialect_cxx().
	* c-opts.c (lang_flags): Make function-local.
	(c_common_init_options): Use c_dialect_ macros.  Handle
	C++ diagnostic requirements.
	(c_common_handle_option, c_common_post_options): Use flag_cxx.
	* c-parse.in (init_reswords): Use c_dialect_objc ().
	* c-pch.c (get_ident): Use c_language.
	* c-pretty-print.c (pp_c_bool_literal): Use c_dialect_ macros.
	* c-typeck.c (comptypes, build_c_cast): Similarly.
	* objc/objc-lang.c (c_language): Define.
	(LANG_HOOKS_INIT_OPTIONS): Use common hook.
	(objc_init_options): Remove.
cp:
	* Make-lang.in: Update.
	* cp-lang.c (c_language): Define.
	(LANG_HOOKS_INIT_OPTIONS): Use common hook.
	* cp-tree.h (cxx_init_options): Remove.
	* lex.c: Don't include diagnostic.h.
	(cxx_init_options): Remove.

From-SVN: r68734
2003-06-30 19:36:25 +00:00
Kaveh R. Ghazi 280c1e0d23 builtin-attrs.def (gcc_diag, [...]): New format attributes.
gcc:
	* builtin-attrs.def (gcc_diag, gcc_cdiag, gcc_cxxdiag): New
	format attributes.
	* c-format.c (enum format_type): Add gcc_diag_format_type,
	gcc_cdiag_format_type, and gcc_cxxdiag_format_type.
	(gcc_diag_length_specs, gcc_cdiag_length_specs,
	gcc_cxxdiag_length_specs, gcc_diag_flag_pairs,
	gcc_cdiag_flag_pairs, gcc_cxxdiag_flag_pairs, gcc_diag_flag_specs,
	gcc_cdiag_flag_specs, gcc_cxxdiag_flag_specs, gcc_diag_char_table,
	gcc_cdiag_char_table, gcc_cxxdiag_char_table): New.
	(format_types_orig): Add new data.
	(find_char_info_specifier_index, init_dynamic_diag_info): New
	functions.
	(handle_format_attribute): Update to handle new format attributes.

testsuite:
	* gcc.dg/format/gcc_diag-1.c: New test.

From-SVN: r68689
2003-06-30 00:31:21 +00:00
Nathan Sidwell 9a472a4224 diagnostic.h (diagnostic_set_info): Replace file and lineno parameters with a location_t.
* diagnostic.h (diagnostic_set_info): Replace file and lineno
	parameters with a location_t.
	* diagnostic.c (diagnostic_set_info): Replace file and lineno
	parameters with a location_t.
	(inform, warning, pedwarn, error, sorry, fatal_error,
	internal_error, warning_with_decl, pedwarn_with_decl,
	error_with_decl): Adjust.
	* c-error.c (pedwarn_c99): Adjust.
	* c-format.c (status_warning): Adjust.
	* rtl-error.c (file_and_line_for_asm): Rename to ...
	(location_for_asm): Return a location_t.
	(diagnostic_for_asm): Adjust.

	* cp/cp-tree.h (cp_line_of, cp_file_of): Remove.
	* cp/error.c (cp_line_of, cp_file_of): Merge into ...
	(location_of): ... here. Make static, return a location_t.
	(cp_error_at, cp_warning_at, cp_pedwarn_at): Adjust.

	* testsuite/g++.old-deja/g++.robertl/eb133.C: Set expected line
	number.
	* testsuite/g++.old-deja/g++.robertl/eb133a.C: Likewise.
	* testsuite/g++.old-deja/g++.robertl/eb133b.C: Likewise.

From-SVN: r68643
2003-06-28 16:23:29 +00:00
Zack Weinberg 8ce332308c * c-format.c (check_format_string, get_constant)
* cfgrtl.c (rtl_split_edge):
	Mark the definition static, matching the forward declaration.
cp:
	* decl.c (build_typename_type)
	* mangle.c (write_template_template_arg)
	* parser.c (cp_parser_scope_through_which_access_occurs)
	* pt.c (push_access_scope_real, push_access_scope, pop_access_scope)
	* repo.c (get_base_filename)
	* semantics.c (maybe_convert_cond):
	Mark the definition static, matching the forward declaration.
java:
	* class.c (build_method_symbols_entry)
	* expr.c (get_offset_table_index)
	* jcf-parse.c (jcf_parse):
	Mark the definition static, matching the forward declaration.

From-SVN: r68622
2003-06-28 00:30:31 +00:00