Makefile.in (C_COMMON_OBJS): Add c-family/c-warn.o.

* Makefile.in (C_COMMON_OBJS): Add c-family/c-warn.o.

	* c-common.c (fold_for_warn): No longer static.
	(bool_promoted_to_int_p): Likewise.
	(c_common_get_narrower): Likewise.
	(constant_expression_warning): Move to c-warn.c.
	(constant_expression_error): Likewise.
	(overflow_warning): Likewise.
	(warn_logical_operator): Likewise.
	(find_array_ref_with_const_idx_r): Likewise.
	(warn_tautological_cmp): Likewise.
	(expr_has_boolean_operands_p): Likewise.
	(warn_logical_not_parentheses): Likewise.
	(warn_if_unused_value): Likewise.
	(strict_aliasing_warning): Likewise.
	(sizeof_pointer_memaccess_warning): Likewise.
	(check_main_parameter_types): Likewise.
	(conversion_warning): Likewise.
	(warnings_for_convert_and_check): Likewise.
	(match_case_to_enum_1): Likewise.
	(match_case_to_enum): Likewise.
	(c_do_switch_warnings): Likewise.
	(warn_for_omitted_condop): Likewise.
	(readonly_error): Likewise.
	(lvalue_error): Likewise.
	(invalid_indirection_error): Likewise.
	(warn_array_subscript_with_type_char): Likewise.
	(warn_about_parentheses): Likewise.
	(warn_for_unused_label): Likewise.
	(warn_for_div_by_zero): Likewise.
	(warn_for_memset): Likewise.
	(warn_for_sign_compare): Likewise.
	(do_warn_double_promotion): Likewise.
	(do_warn_unused_parameter): Likewise.
	(record_locally_defined_typedef): Likewise.
	(maybe_record_typedef_use): Likewise.
	(maybe_warn_unused_local_typedefs): Likewise.
	(maybe_warn_bool_compare): Likewise.
	(maybe_warn_shift_overflow): Likewise.
	(warn_duplicated_cond_add_or_warn): Likewise.
	(diagnose_mismatched_attributes): Likewise.
	* c-common.h: Move the declarations from c-warn.c to its own section.
	* c-warn.c: New file.

From-SVN: r240963
This commit is contained in:
Marek Polacek 2016-10-11 07:02:40 +00:00 committed by Marek Polacek
parent 07f5170726
commit 038b5cc0d5
6 changed files with 2275 additions and 2192 deletions

View file

@ -1,3 +1,7 @@
2016-10-11 Marek Polacek <polacek@redhat.com>
* Makefile.in (C_COMMON_OBJS): Add c-family/c-warn.o.
2016-10-11 Kugan Vivekanandarajah <kuganv@linaro.org>
* tree-vrp.c (evrp_dom_walker::try_add_new_range): New.

View file

@ -1187,7 +1187,8 @@ C_COMMON_OBJS = c-family/c-common.o c-family/c-cppbuiltin.o c-family/c-dump.o \
c-family/c-ppoutput.o c-family/c-pragma.o c-family/c-pretty-print.o \
c-family/c-semantics.o c-family/c-ada-spec.o \
c-family/c-cilkplus.o \
c-family/array-notation-common.o c-family/cilk.o c-family/c-ubsan.o
c-family/array-notation-common.o c-family/cilk.o c-family/c-ubsan.o \
c-family/c-warn.o
# Language-independent object files.
# We put the *-match.o and insn-*.o files first so that a parallel make

View file

@ -1,3 +1,47 @@
2016-10-11 Marek Polacek <polacek@redhat.com>
* c-common.c (fold_for_warn): No longer static.
(bool_promoted_to_int_p): Likewise.
(c_common_get_narrower): Likewise.
(constant_expression_warning): Move to c-warn.c.
(constant_expression_error): Likewise.
(overflow_warning): Likewise.
(warn_logical_operator): Likewise.
(find_array_ref_with_const_idx_r): Likewise.
(warn_tautological_cmp): Likewise.
(expr_has_boolean_operands_p): Likewise.
(warn_logical_not_parentheses): Likewise.
(warn_if_unused_value): Likewise.
(strict_aliasing_warning): Likewise.
(sizeof_pointer_memaccess_warning): Likewise.
(check_main_parameter_types): Likewise.
(conversion_warning): Likewise.
(warnings_for_convert_and_check): Likewise.
(match_case_to_enum_1): Likewise.
(match_case_to_enum): Likewise.
(c_do_switch_warnings): Likewise.
(warn_for_omitted_condop): Likewise.
(readonly_error): Likewise.
(lvalue_error): Likewise.
(invalid_indirection_error): Likewise.
(warn_array_subscript_with_type_char): Likewise.
(warn_about_parentheses): Likewise.
(warn_for_unused_label): Likewise.
(warn_for_div_by_zero): Likewise.
(warn_for_memset): Likewise.
(warn_for_sign_compare): Likewise.
(do_warn_double_promotion): Likewise.
(do_warn_unused_parameter): Likewise.
(record_locally_defined_typedef): Likewise.
(maybe_record_typedef_use): Likewise.
(maybe_warn_unused_local_typedefs): Likewise.
(maybe_warn_bool_compare): Likewise.
(maybe_warn_shift_overflow): Likewise.
(warn_duplicated_cond_add_or_warn): Likewise.
(diagnose_mismatched_attributes): Likewise.
* c-common.h: Move the declarations from c-warn.c to its own section.
* c-warn.c: New file.
2016-10-08 Jason Merrill <jason@redhat.com>
* c-common.c (c_common_truthvalue_conversion): Don't distribute

File diff suppressed because it is too large Load diff

View file

@ -838,22 +838,7 @@ extern tree c_alignof_expr (location_t, tree);
NOP_EXPR is used as a special case (see truthvalue_conversion). */
extern void binary_op_error (rich_location *, enum tree_code, tree, tree);
extern tree fix_string_type (tree);
extern void constant_expression_warning (tree);
extern void constant_expression_error (tree);
extern bool strict_aliasing_warning (tree, tree, tree);
extern void sizeof_pointer_memaccess_warning (location_t *, tree,
vec<tree, va_gc> *, tree *,
bool (*) (tree, tree));
extern void warnings_for_convert_and_check (location_t, tree, tree, tree);
extern tree convert_and_check (location_t, tree, tree);
extern void overflow_warning (location_t, tree);
extern bool warn_if_unused_value (const_tree, location_t);
extern void warn_logical_operator (location_t, enum tree_code, tree,
enum tree_code, tree, enum tree_code, tree);
extern void warn_logical_not_parentheses (location_t, enum tree_code, tree,
tree);
extern void warn_tautological_cmp (location_t, enum tree_code, tree, tree);
extern void check_main_parameter_types (tree decl);
extern bool c_determine_visibility (tree);
extern bool vector_types_compatible_elements_p (tree, tree);
extern void mark_valid_location_for_stdc_pragma (bool);
@ -869,7 +854,9 @@ extern bool keyword_is_decl_specifier (enum rid);
extern unsigned max_align_t_align (void);
extern bool cxx_fundamental_alignment_p (unsigned);
extern bool pointer_to_zero_sized_aggr_p (tree);
extern bool diagnose_mismatched_attributes (tree, tree);
extern bool bool_promoted_to_int_p (tree);
extern tree fold_for_warn (tree);
extern tree c_common_get_narrower (tree, int *);
#define c_sizeof(LOC, T) c_sizeof_or_alignof_type (LOC, T, true, false, 1)
#define c_alignof(LOC, T) c_sizeof_or_alignof_type (LOC, T, false, false, 1)
@ -923,9 +910,6 @@ extern void c_parse_file (void);
extern void c_parse_final_cleanups (void);
extern void warn_for_omitted_condop (location_t, tree);
extern void warn_for_memset (location_t, tree, tree, int);
/* These macros provide convenient access to the various _STMT nodes. */
/* Nonzero if a given STATEMENT_LIST represents the outermost binding
@ -991,9 +975,6 @@ extern int case_compare (splay_tree_key, splay_tree_key);
extern tree c_add_case_label (location_t, splay_tree, tree, tree, tree, tree,
bool *);
extern void c_do_switch_warnings (splay_tree, location_t, tree, tree, bool,
bool);
extern tree build_function_call (location_t, tree, tree);
extern tree build_function_call_vec (location_t, vec<location_t>, tree,
@ -1066,49 +1047,14 @@ extern void verify_sequence_points (tree);
extern tree fold_offsetof_1 (tree, tree_code ctx = ERROR_MARK);
extern tree fold_offsetof (tree);
/* Places where an lvalue, or modifiable lvalue, may be required.
Used to select diagnostic messages in lvalue_error and
readonly_error. */
enum lvalue_use {
lv_assign,
lv_increment,
lv_decrement,
lv_addressof,
lv_asm
};
extern void readonly_error (location_t, tree, enum lvalue_use);
extern void lvalue_error (location_t, enum lvalue_use);
extern void invalid_indirection_error (location_t, tree, ref_operator);
extern int complete_array_type (tree *, tree, bool);
extern tree builtin_type_for_size (int, bool);
extern void c_common_mark_addressable_vec (tree);
extern void warn_array_subscript_with_type_char (location_t, tree);
extern void warn_about_parentheses (location_t,
enum tree_code,
enum tree_code, tree,
enum tree_code, tree);
extern void warn_for_unused_label (tree label);
extern void warn_for_div_by_zero (location_t, tree divisor);
extern void warn_for_sign_compare (location_t,
tree orig_op0, tree orig_op1,
tree op0, tree op1,
tree result_type,
enum tree_code resultcode);
extern void do_warn_unused_parameter (tree);
extern void do_warn_double_promotion (tree, tree, tree, const char *,
location_t);
extern void set_underlying_type (tree);
extern void record_types_used_by_current_var_decl (tree);
extern void record_locally_defined_typedef (tree);
extern void maybe_record_typedef_use (tree);
extern void maybe_warn_unused_local_typedefs (void);
extern void maybe_warn_bool_compare (location_t, enum tree_code, tree, tree);
extern bool maybe_warn_shift_overflow (location_t, tree, tree);
extern vec<tree, va_gc> *make_tree_vector (void);
extern void release_tree_vector (vec<tree, va_gc> *);
extern vec<tree, va_gc> *make_tree_vector_single (tree);
@ -1529,12 +1475,69 @@ extern tree cilk_for_number_of_iterations (tree);
extern bool check_no_cilk (tree, const char *, const char *,
location_t loc = UNKNOWN_LOCATION);
extern bool reject_gcc_builtin (const_tree, location_t = UNKNOWN_LOCATION);
extern void warn_duplicated_cond_add_or_warn (location_t, tree, vec<tree> **);
extern bool valid_array_size_p (location_t, tree, tree);
extern bool cilk_ignorable_spawn_rhs_op (tree);
extern bool cilk_recognize_spawn (tree, tree *);
/* In c-warn.c. */
extern void constant_expression_warning (tree);
extern void constant_expression_error (tree);
extern void overflow_warning (location_t, tree);
extern void warn_logical_operator (location_t, enum tree_code, tree,
enum tree_code, tree, enum tree_code, tree);
extern void warn_tautological_cmp (location_t, enum tree_code, tree, tree);
extern void warn_logical_not_parentheses (location_t, enum tree_code, tree,
tree);
extern bool warn_if_unused_value (const_tree, location_t);
extern bool strict_aliasing_warning (tree, tree, tree);
extern void sizeof_pointer_memaccess_warning (location_t *, tree,
vec<tree, va_gc> *, tree *,
bool (*) (tree, tree));
extern void check_main_parameter_types (tree decl);
extern void warnings_for_convert_and_check (location_t, tree, tree, tree);
extern void c_do_switch_warnings (splay_tree, location_t, tree, tree, bool,
bool);
extern void warn_for_omitted_condop (location_t, tree);
/* Places where an lvalue, or modifiable lvalue, may be required.
Used to select diagnostic messages in lvalue_error and
readonly_error. */
enum lvalue_use {
lv_assign,
lv_increment,
lv_decrement,
lv_addressof,
lv_asm
};
extern void lvalue_error (location_t, enum lvalue_use);
extern void invalid_indirection_error (location_t, tree, ref_operator);
extern void readonly_error (location_t, tree, enum lvalue_use);
extern void warn_array_subscript_with_type_char (location_t, tree);
extern void warn_about_parentheses (location_t,
enum tree_code,
enum tree_code, tree,
enum tree_code, tree);
extern void warn_for_unused_label (tree label);
extern void warn_for_div_by_zero (location_t, tree divisor);
extern void warn_for_memset (location_t, tree, tree, int);
extern void warn_for_sign_compare (location_t,
tree orig_op0, tree orig_op1,
tree op0, tree op1,
tree result_type,
enum tree_code resultcode);
extern void do_warn_double_promotion (tree, tree, tree, const char *,
location_t);
extern void do_warn_unused_parameter (tree);
extern void record_locally_defined_typedef (tree);
extern void maybe_record_typedef_use (tree);
extern void maybe_warn_unused_local_typedefs (void);
extern void maybe_warn_bool_compare (location_t, enum tree_code, tree, tree);
extern bool maybe_warn_shift_overflow (location_t, tree, tree);
extern void warn_duplicated_cond_add_or_warn (location_t, tree, vec<tree> **);
extern bool diagnose_mismatched_attributes (tree, tree);
#if CHECKING_P
namespace selftest {
extern void c_format_c_tests (void);

2160
gcc/c-family/c-warn.c Normal file

File diff suppressed because it is too large Load diff