diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/c-family/c-common.h | 2 | ||||
-rw-r--r-- | gcc/c-family/c-warn.cc | 32 | ||||
-rw-r--r-- | gcc/c/c-typeck.cc | 4 | ||||
-rw-r--r-- | gcc/cp/call.cc | 2 | ||||
-rw-r--r-- | gcc/cp/typeck.cc | 2 |
5 files changed, 19 insertions, 23 deletions
diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h index 6e7fc1b..b8bd56c 100644 --- a/gcc/c-family/c-common.h +++ b/gcc/c-family/c-common.h @@ -1572,7 +1572,7 @@ 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); extern void warn_for_omitted_condop (location_t, tree); extern bool warn_for_restrict (unsigned, tree *, unsigned); -extern void warn_for_address_or_pointer_of_packed_member (tree, tree); +extern void warn_for_address_of_packed_member (tree, tree); extern void warn_parm_array_mismatch (location_t, tree, tree); extern void maybe_warn_sizeof_array_div (location_t, tree, tree, tree, tree); extern void do_warn_array_compare (location_t, tree_code, tree, tree); diff --git a/gcc/c-family/c-warn.cc b/gcc/c-family/c-warn.cc index 2a399ba..abe66dd 100644 --- a/gcc/c-family/c-warn.cc +++ b/gcc/c-family/c-warn.cc @@ -2991,13 +2991,13 @@ check_alignment_of_packed_member (tree type, tree field, bool rvalue) return NULL_TREE; } -/* Return struct or union type if the right hand value, RHS +/* Return struct or union type if the right hand value, RHS, is an address which takes the unaligned address of packed member of struct or union when assigning to TYPE. Otherwise, return NULL_TREE. */ static tree -check_address_or_pointer_of_packed_member (tree type, tree rhs) +check_address_of_packed_member (tree type, tree rhs) { bool rvalue = true; bool indirect = false; @@ -3042,14 +3042,12 @@ check_address_or_pointer_of_packed_member (tree type, tree rhs) return context; } -/* Check and warn if the right hand value, RHS: - 1. Is a pointer value which isn't aligned to a pointer type TYPE. - 2. Is an address which takes the unaligned address of packed member - of struct or union when assigning to TYPE. - */ +/* Check and warn if the right hand value, RHS, + is an address which takes the unaligned address of packed member + of struct or union when assigning to TYPE. */ static void -check_and_warn_address_or_pointer_of_packed_member (tree type, tree rhs) +check_and_warn_address_of_packed_member (tree type, tree rhs) { bool nop_p = false; tree orig_rhs; @@ -3067,11 +3065,11 @@ check_and_warn_address_or_pointer_of_packed_member (tree type, tree rhs) if (TREE_CODE (rhs) == COND_EXPR) { /* Check the THEN path. */ - check_and_warn_address_or_pointer_of_packed_member + check_and_warn_address_of_packed_member (type, TREE_OPERAND (rhs, 1)); /* Check the ELSE path. */ - check_and_warn_address_or_pointer_of_packed_member + check_and_warn_address_of_packed_member (type, TREE_OPERAND (rhs, 2)); } else @@ -3095,7 +3093,7 @@ check_and_warn_address_or_pointer_of_packed_member (tree type, tree rhs) } tree context - = check_address_or_pointer_of_packed_member (type, rhs); + = check_address_of_packed_member (type, rhs); if (context) { location_t loc = EXPR_LOC_OR_LOC (rhs, input_location); @@ -3107,14 +3105,12 @@ check_and_warn_address_or_pointer_of_packed_member (tree type, tree rhs) } } -/* Warn if the right hand value, RHS: - 1. Is a pointer value which isn't aligned to a pointer type TYPE. - 2. Is an address which takes the unaligned address of packed member - of struct or union when assigning to TYPE. -*/ +/* Warn if the right hand value, RHS, + is an address which takes the unaligned address of packed member + of struct or union when assigning to TYPE. */ void -warn_for_address_or_pointer_of_packed_member (tree type, tree rhs) +warn_for_address_of_packed_member (tree type, tree rhs) { if (!warn_address_of_packed_member) return; @@ -3123,7 +3119,7 @@ warn_for_address_or_pointer_of_packed_member (tree type, tree rhs) if (!POINTER_TYPE_P (type)) return; - check_and_warn_address_or_pointer_of_packed_member (type, rhs); + check_and_warn_address_of_packed_member (type, rhs); } /* Return EXPR + 1. Convenience helper used below. */ diff --git a/gcc/c/c-typeck.cc b/gcc/c/c-typeck.cc index 18860c2..022e3c63 100644 --- a/gcc/c/c-typeck.cc +++ b/gcc/c/c-typeck.cc @@ -7000,7 +7000,7 @@ convert_for_assignment (location_t location, location_t expr_loc, tree type, if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (rhstype)) { - warn_for_address_or_pointer_of_packed_member (type, orig_rhs); + warn_for_address_of_packed_member (type, orig_rhs); return rhs; } @@ -7658,7 +7658,7 @@ convert_for_assignment (location_t location, location_t expr_loc, tree type, /* If RHS isn't an address, check pointer or array of packed struct or union. */ - warn_for_address_or_pointer_of_packed_member (type, orig_rhs); + warn_for_address_of_packed_member (type, orig_rhs); return convert (type, rhs); } diff --git a/gcc/cp/call.cc b/gcc/cp/call.cc index aaee34f..13ca951 100644 --- a/gcc/cp/call.cc +++ b/gcc/cp/call.cc @@ -9304,7 +9304,7 @@ convert_for_arg_passing (tree type, tree val, tsubst_flags_t complain) } if (complain & tf_warning) - warn_for_address_or_pointer_of_packed_member (type, val); + warn_for_address_of_packed_member (type, val); return val; } diff --git a/gcc/cp/typeck.cc b/gcc/cp/typeck.cc index 258cfd4..a6e2f4e 100644 --- a/gcc/cp/typeck.cc +++ b/gcc/cp/typeck.cc @@ -10384,7 +10384,7 @@ convert_for_assignment (tree type, tree rhs, maybe_warn_unparenthesized_assignment (rhs, complain); if (complain & tf_warning) - warn_for_address_or_pointer_of_packed_member (type, rhs); + warn_for_address_of_packed_member (type, rhs); return perform_implicit_conversion_flags (strip_top_quals (type), rhs, complain, flags); |