Mercurial > hg > CbC > CbC_gcc
diff gcc/c-typeck.c @ 70:b81903832de2
merge c-decl.c
author | Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 21 Aug 2011 09:24:16 +0900 |
parents | 1b10fe6932e1 |
children | 20c18990c3e4 |
line wrap: on
line diff
--- a/gcc/c-typeck.c Sun Aug 21 07:53:12 2011 +0900 +++ b/gcc/c-typeck.c Sun Aug 21 09:24:16 2011 +0900 @@ -40,10 +40,6 @@ #include "tree-iterator.h" #include "bitmap.h" #include "gimple.h" -#include "tree-flow.h" -#ifndef noCbC - #include "cbc-tree.h" -#endif #include "c-family/c-objc.h" /* Possible cases of implicit bad conversions. Used to select @@ -81,10 +77,10 @@ static int type_lists_compatible_p (const_tree, const_tree, bool *, bool *); static tree lookup_field (tree, tree); static int convert_arguments (tree, VEC(tree,gc) *, VEC(tree,gc) *, tree, - tree); + tree); static tree pointer_diff (location_t, tree, tree); static tree convert_for_assignment (location_t, tree, tree, tree, - enum impl_conv, bool, tree, tree, int); + enum impl_conv, bool, tree, tree, int); static tree valid_compound_expr_initializer (tree, tree); static void push_string (const char *); static void push_member_name (tree); @@ -115,12 +111,12 @@ yet available everywhere required. */ tree type = TREE_TYPE (expr); return (TREE_CODE (expr) == INTEGER_CST - && !TREE_OVERFLOW (expr) - && integer_zerop (expr) - && (INTEGRAL_TYPE_P (type) - || (TREE_CODE (type) == POINTER_TYPE - && VOID_TYPE_P (TREE_TYPE (type)) - && TYPE_QUALS (TREE_TYPE (type)) == TYPE_UNQUALIFIED))); + && !TREE_OVERFLOW (expr) + && integer_zerop (expr) + && (INTEGRAL_TYPE_P (type) + || (TREE_CODE (type) == POINTER_TYPE + && VOID_TYPE_P (TREE_TYPE (type)) + && TYPE_QUALS (TREE_TYPE (type)) == TYPE_UNQUALIFIED))); } /* EXPR may appear in an unevaluated part of an integer constant @@ -206,7 +202,7 @@ return; if (value != 0 && (TREE_CODE (value) == VAR_DECL - || TREE_CODE (value) == PARM_DECL)) + || TREE_CODE (value) == PARM_DECL)) error ("%qD has an incomplete type", value); else { @@ -214,47 +210,47 @@ /* We must print an error message. Be clever about what it says. */ switch (TREE_CODE (type)) - { - case RECORD_TYPE: - type_code_string = "struct"; - break; - - case UNION_TYPE: - type_code_string = "union"; - break; - - case ENUMERAL_TYPE: - type_code_string = "enum"; - break; - - case VOID_TYPE: - error ("invalid use of void expression"); - return; - - case ARRAY_TYPE: - if (TYPE_DOMAIN (type)) - { - if (TYPE_MAX_VALUE (TYPE_DOMAIN (type)) == NULL) - { - error ("invalid use of flexible array member"); - return; - } - type = TREE_TYPE (type); - goto retry; - } - error ("invalid use of array with unspecified bounds"); - return; - - default: - gcc_unreachable (); - } + { + case RECORD_TYPE: + type_code_string = "struct"; + break; + + case UNION_TYPE: + type_code_string = "union"; + break; + + case ENUMERAL_TYPE: + type_code_string = "enum"; + break; + + case VOID_TYPE: + error ("invalid use of void expression"); + return; + + case ARRAY_TYPE: + if (TYPE_DOMAIN (type)) + { + if (TYPE_MAX_VALUE (TYPE_DOMAIN (type)) == NULL) + { + error ("invalid use of flexible array member"); + return; + } + type = TREE_TYPE (type); + goto retry; + } + error ("invalid use of array with unspecified bounds"); + return; + + default: + gcc_unreachable (); + } if (TREE_CODE (TYPE_NAME (type)) == IDENTIFIER_NODE) - error ("invalid use of undefined type %<%s %E%>", - type_code_string, TYPE_NAME (type)); + error ("invalid use of undefined type %<%s %E%>", + type_code_string, TYPE_NAME (type)); else - /* If this type has a typedef-name, the TYPE_NAME is a TYPE_DECL. */ - error ("invalid use of incomplete typedef %qD", TYPE_NAME (type)); + /* If this type has a typedef-name, the TYPE_NAME is a TYPE_DECL. */ + error ("invalid use of incomplete typedef %qD", TYPE_NAME (type)); } } @@ -271,8 +267,8 @@ { /* Preserve unsignedness if not really getting any wider. */ if (TYPE_UNSIGNED (type) - && (TYPE_PRECISION (type) == TYPE_PRECISION (integer_type_node))) - return unsigned_type_node; + && (TYPE_PRECISION (type) == TYPE_PRECISION (integer_type_node))) + return unsigned_type_node; return integer_type_node; } @@ -321,13 +317,13 @@ { as_common = as_type; error ("%qT and %qT are in disjoint named address spaces", - type, like); + type, like); } return c_build_qualified_type (type, - TYPE_QUALS_NO_ADDR_SPACE (type) - | TYPE_QUALS_NO_ADDR_SPACE (like) - | ENCODE_QUAL_ADDR_SPACE (as_common)); + TYPE_QUALS_NO_ADDR_SPACE (type) + | TYPE_QUALS_NO_ADDR_SPACE (like) + | ENCODE_QUAL_ADDR_SPACE (as_common)); } /* Return true iff the given tree T is a variable length array. */ @@ -387,104 +383,101 @@ case POINTER_TYPE: /* For two pointers, do this recursively on the target type. */ { - tree pointed_to_1 = TREE_TYPE (t1); - tree pointed_to_2 = TREE_TYPE (t2); - tree target = composite_type (pointed_to_1, pointed_to_2); - t1 = build_pointer_type (target); - t1 = build_type_attribute_variant (t1, attributes); - return qualify_type (t1, t2); + tree pointed_to_1 = TREE_TYPE (t1); + tree pointed_to_2 = TREE_TYPE (t2); + tree target = composite_type (pointed_to_1, pointed_to_2); + t1 = build_pointer_type (target); + t1 = build_type_attribute_variant (t1, attributes); + return qualify_type (t1, t2); } case ARRAY_TYPE: { - tree elt = composite_type (TREE_TYPE (t1), TREE_TYPE (t2)); - int quals; - tree unqual_elt; - tree d1 = TYPE_DOMAIN (t1); - tree d2 = TYPE_DOMAIN (t2); - bool d1_variable, d2_variable; - bool d1_zero, d2_zero; - bool t1_complete, t2_complete; - - /* We should not have any type quals on arrays at all. */ - gcc_assert (!TYPE_QUALS_NO_ADDR_SPACE (t1) - && !TYPE_QUALS_NO_ADDR_SPACE (t2)); - - t1_complete = COMPLETE_TYPE_P (t1); - t2_complete = COMPLETE_TYPE_P (t2); - - d1_zero = d1 == 0 || !TYPE_MAX_VALUE (d1); - d2_zero = d2 == 0 || !TYPE_MAX_VALUE (d2); - - d1_variable = (!d1_zero - && (TREE_CODE (TYPE_MIN_VALUE (d1)) != INTEGER_CST - || TREE_CODE (TYPE_MAX_VALUE (d1)) != INTEGER_CST)); - d2_variable = (!d2_zero - && (TREE_CODE (TYPE_MIN_VALUE (d2)) != INTEGER_CST - || TREE_CODE (TYPE_MAX_VALUE (d2)) != INTEGER_CST)); - d1_variable = d1_variable || (d1_zero && c_vla_type_p (t1)); - d2_variable = d2_variable || (d2_zero && c_vla_type_p (t2)); - - /* Save space: see if the result is identical to one of the args. */ - if (elt == TREE_TYPE (t1) && TYPE_DOMAIN (t1) - && (d2_variable || d2_zero || !d1_variable)) - return build_type_attribute_variant (t1, attributes); - if (elt == TREE_TYPE (t2) && TYPE_DOMAIN (t2) - && (d1_variable || d1_zero || !d2_variable)) - return build_type_attribute_variant (t2, attributes); - - if (elt == TREE_TYPE (t1) && !TYPE_DOMAIN (t2) && !TYPE_DOMAIN (t1)) - return build_type_attribute_variant (t1, attributes); - if (elt == TREE_TYPE (t2) && !TYPE_DOMAIN (t2) && !TYPE_DOMAIN (t1)) - return build_type_attribute_variant (t2, attributes); - - /* Merge the element types, and have a size if either arg has - one. We may have qualifiers on the element types. To set - up TYPE_MAIN_VARIANT correctly, we need to form the - composite of the unqualified types and add the qualifiers - back at the end. */ - quals = TYPE_QUALS (strip_array_types (elt)); - unqual_elt = c_build_qualified_type (elt, TYPE_UNQUALIFIED); - t1 = build_array_type (unqual_elt, - TYPE_DOMAIN ((TYPE_DOMAIN (t1) - && (d2_variable - || d2_zero - || !d1_variable)) - ? t1 - : t2)); - /* Ensure a composite type involving a zero-length array type - is a zero-length type not an incomplete type. */ - if (d1_zero && d2_zero - && (t1_complete || t2_complete) - && !COMPLETE_TYPE_P (t1)) - { - TYPE_SIZE (t1) = bitsize_zero_node; - TYPE_SIZE_UNIT (t1) = size_zero_node; - } - t1 = c_build_qualified_type (t1, quals); - return build_type_attribute_variant (t1, attributes); + tree elt = composite_type (TREE_TYPE (t1), TREE_TYPE (t2)); + int quals; + tree unqual_elt; + tree d1 = TYPE_DOMAIN (t1); + tree d2 = TYPE_DOMAIN (t2); + bool d1_variable, d2_variable; + bool d1_zero, d2_zero; + bool t1_complete, t2_complete; + + /* We should not have any type quals on arrays at all. */ + gcc_assert (!TYPE_QUALS_NO_ADDR_SPACE (t1) + && !TYPE_QUALS_NO_ADDR_SPACE (t2)); + + t1_complete = COMPLETE_TYPE_P (t1); + t2_complete = COMPLETE_TYPE_P (t2); + + d1_zero = d1 == 0 || !TYPE_MAX_VALUE (d1); + d2_zero = d2 == 0 || !TYPE_MAX_VALUE (d2); + + d1_variable = (!d1_zero + && (TREE_CODE (TYPE_MIN_VALUE (d1)) != INTEGER_CST + || TREE_CODE (TYPE_MAX_VALUE (d1)) != INTEGER_CST)); + d2_variable = (!d2_zero + && (TREE_CODE (TYPE_MIN_VALUE (d2)) != INTEGER_CST + || TREE_CODE (TYPE_MAX_VALUE (d2)) != INTEGER_CST)); + d1_variable = d1_variable || (d1_zero && c_vla_type_p (t1)); + d2_variable = d2_variable || (d2_zero && c_vla_type_p (t2)); + + /* Save space: see if the result is identical to one of the args. */ + if (elt == TREE_TYPE (t1) && TYPE_DOMAIN (t1) + && (d2_variable || d2_zero || !d1_variable)) + return build_type_attribute_variant (t1, attributes); + if (elt == TREE_TYPE (t2) && TYPE_DOMAIN (t2) + && (d1_variable || d1_zero || !d2_variable)) + return build_type_attribute_variant (t2, attributes); + + if (elt == TREE_TYPE (t1) && !TYPE_DOMAIN (t2) && !TYPE_DOMAIN (t1)) + return build_type_attribute_variant (t1, attributes); + if (elt == TREE_TYPE (t2) && !TYPE_DOMAIN (t2) && !TYPE_DOMAIN (t1)) + return build_type_attribute_variant (t2, attributes); + + /* Merge the element types, and have a size if either arg has + one. We may have qualifiers on the element types. To set + up TYPE_MAIN_VARIANT correctly, we need to form the + composite of the unqualified types and add the qualifiers + back at the end. */ + quals = TYPE_QUALS (strip_array_types (elt)); + unqual_elt = c_build_qualified_type (elt, TYPE_UNQUALIFIED); + t1 = build_array_type (unqual_elt, + TYPE_DOMAIN ((TYPE_DOMAIN (t1) + && (d2_variable + || d2_zero + || !d1_variable)) + ? t1 + : t2)); + /* Ensure a composite type involving a zero-length array type + is a zero-length type not an incomplete type. */ + if (d1_zero && d2_zero + && (t1_complete || t2_complete) + && !COMPLETE_TYPE_P (t1)) + { + TYPE_SIZE (t1) = bitsize_zero_node; + TYPE_SIZE_UNIT (t1) = size_zero_node; + } + t1 = c_build_qualified_type (t1, quals); + return build_type_attribute_variant (t1, attributes); } case ENUMERAL_TYPE: case RECORD_TYPE: case UNION_TYPE: if (attributes != NULL) - { - /* Try harder not to create a new aggregate type. */ - if (attribute_list_equal (TYPE_ATTRIBUTES (t1), attributes)) - return t1; - if (attribute_list_equal (TYPE_ATTRIBUTES (t2), attributes)) - return t2; - } + { + /* Try harder not to create a new aggregate type. */ + if (attribute_list_equal (TYPE_ATTRIBUTES (t1), attributes)) + return t1; + if (attribute_list_equal (TYPE_ATTRIBUTES (t2), attributes)) + return t2; + } return build_type_attribute_variant (t1, attributes); case FUNCTION_TYPE: /* Function types: prefer the one that specified arg types. - If both do, merge the arg types. Also merge the return types. */ + If both do, merge the arg types. Also merge the return types. */ { -#ifndef noCbC - int is_code_segment = CbC_IS_CODE_SEGMENT(t1); -#endif tree valtype = composite_type (TREE_TYPE (t1), TREE_TYPE (t2)); tree p1 = TYPE_ARG_TYPES (t1); tree p2 = TYPE_ARG_TYPES (t2); @@ -501,20 +494,12 @@ /* Simple way if one arg fails to specify argument types. */ if (TYPE_ARG_TYPES (t1) == 0) { -#ifndef noCbC - if (is_code_segment) t1 = build_code_segment_type (valtype, TYPE_ARG_TYPES (t2)); - else -#endif t1 = build_function_type (valtype, TYPE_ARG_TYPES (t2)); t1 = build_type_attribute_variant (t1, attributes); return qualify_type (t1, t2); } if (TYPE_ARG_TYPES (t2) == 0) { -#ifndef noCbC - if (is_code_segment) t1 = build_code_segment_type (valtype, TYPE_ARG_TYPES (t1)); - else -#endif t1 = build_function_type (valtype, TYPE_ARG_TYPES (t1)); t1 = build_type_attribute_variant (t1, attributes); return qualify_type (t1, t2); @@ -608,15 +593,11 @@ } c_override_global_bindings_to_false = false; - -#ifndef noCbC - if (is_code_segment) t1 = build_code_segment_type (valtype, newargs); - else -#endif t1 = build_function_type (valtype, newargs); t1 = qualify_type (t1, t2); /* ... falls through ... */ } + default: return build_type_attribute_variant (t1, attributes); } @@ -651,7 +632,7 @@ return t1; gcc_assert (TREE_CODE (t1) == POINTER_TYPE - && TREE_CODE (t2) == POINTER_TYPE); + && TREE_CODE (t2) == POINTER_TYPE); /* Merge the attributes. */ attributes = targetm.merge_type_attributes (t1, t2); @@ -732,11 +713,11 @@ code2 = TREE_CODE (t2); gcc_assert (code1 == VECTOR_TYPE || code1 == COMPLEX_TYPE - || code1 == FIXED_POINT_TYPE || code1 == REAL_TYPE - || code1 == INTEGER_TYPE); + || code1 == FIXED_POINT_TYPE || code1 == REAL_TYPE + || code1 == INTEGER_TYPE); gcc_assert (code2 == VECTOR_TYPE || code2 == COMPLEX_TYPE - || code2 == FIXED_POINT_TYPE || code2 == REAL_TYPE - || code2 == INTEGER_TYPE); + || code2 == FIXED_POINT_TYPE || code2 == REAL_TYPE + || code2 == INTEGER_TYPE); /* When one operand is a decimal float type, the other operand cannot be a generic float type or a complex type. We also disallow vector types @@ -745,20 +726,20 @@ && !(DECIMAL_FLOAT_TYPE_P (t1) && DECIMAL_FLOAT_TYPE_P (t2))) { if (code1 == VECTOR_TYPE || code2 == VECTOR_TYPE) - { - error ("can%'t mix operands of decimal float and vector types"); - return error_mark_node; - } + { + error ("can%'t mix operands of decimal float and vector types"); + return error_mark_node; + } if (code1 == COMPLEX_TYPE || code2 == COMPLEX_TYPE) - { - error ("can%'t mix operands of decimal float and complex types"); - return error_mark_node; - } + { + error ("can%'t mix operands of decimal float and complex types"); + return error_mark_node; + } if (code1 == REAL_TYPE && code2 == REAL_TYPE) - { - error ("can%'t mix operands of decimal float and other float types"); - return error_mark_node; - } + { + error ("can%'t mix operands of decimal float and other float types"); + return error_mark_node; + } } /* If one type is a vector type, return that type. (How the usual @@ -780,11 +761,11 @@ tree subtype = c_common_type (subtype1, subtype2); if (code1 == COMPLEX_TYPE && TREE_TYPE (t1) == subtype) - return t1; + return t1; else if (code2 == COMPLEX_TYPE && TREE_TYPE (t2) == subtype) - return t2; + return t2; else - return build_complex_type (subtype); + return build_complex_type (subtype); } /* If only one is real, use it as the result. */ @@ -801,14 +782,14 @@ if (code1 == REAL_TYPE && code2 == REAL_TYPE) { if (TYPE_MAIN_VARIANT (t1) == dfloat128_type_node - || TYPE_MAIN_VARIANT (t2) == dfloat128_type_node) - return dfloat128_type_node; + || TYPE_MAIN_VARIANT (t2) == dfloat128_type_node) + return dfloat128_type_node; else if (TYPE_MAIN_VARIANT (t1) == dfloat64_type_node - || TYPE_MAIN_VARIANT (t2) == dfloat64_type_node) - return dfloat64_type_node; + || TYPE_MAIN_VARIANT (t2) == dfloat64_type_node) + return dfloat64_type_node; else if (TYPE_MAIN_VARIANT (t1) == dfloat32_type_node - || TYPE_MAIN_VARIANT (t2) == dfloat32_type_node) - return dfloat32_type_node; + || TYPE_MAIN_VARIANT (t2) == dfloat32_type_node) + return dfloat32_type_node; } /* Deal with fixed-point types. */ @@ -823,77 +804,77 @@ /* If one input type is saturating, the result type is saturating. */ if (TYPE_SATURATING (t1) || TYPE_SATURATING (t2)) - satp = 1; + satp = 1; /* If both fixed-point types are unsigned, the result type is unsigned. - When mixing fixed-point and integer types, follow the sign of the - fixed-point type. - Otherwise, the result type is signed. */ + When mixing fixed-point and integer types, follow the sign of the + fixed-point type. + Otherwise, the result type is signed. */ if ((TYPE_UNSIGNED (t1) && TYPE_UNSIGNED (t2) - && code1 == FIXED_POINT_TYPE && code2 == FIXED_POINT_TYPE) - || (code1 == FIXED_POINT_TYPE && code2 != FIXED_POINT_TYPE - && TYPE_UNSIGNED (t1)) - || (code1 != FIXED_POINT_TYPE && code2 == FIXED_POINT_TYPE - && TYPE_UNSIGNED (t2))) - unsignedp = 1; + && code1 == FIXED_POINT_TYPE && code2 == FIXED_POINT_TYPE) + || (code1 == FIXED_POINT_TYPE && code2 != FIXED_POINT_TYPE + && TYPE_UNSIGNED (t1)) + || (code1 != FIXED_POINT_TYPE && code2 == FIXED_POINT_TYPE + && TYPE_UNSIGNED (t2))) + unsignedp = 1; /* The result type is signed. */ if (unsignedp == 0) - { - /* If the input type is unsigned, we need to convert to the - signed type. */ - if (code1 == FIXED_POINT_TYPE && TYPE_UNSIGNED (t1)) - { - enum mode_class mclass = (enum mode_class) 0; - if (GET_MODE_CLASS (m1) == MODE_UFRACT) - mclass = MODE_FRACT; - else if (GET_MODE_CLASS (m1) == MODE_UACCUM) - mclass = MODE_ACCUM; - else - gcc_unreachable (); - m1 = mode_for_size (GET_MODE_PRECISION (m1), mclass, 0); - } - if (code2 == FIXED_POINT_TYPE && TYPE_UNSIGNED (t2)) - { - enum mode_class mclass = (enum mode_class) 0; - if (GET_MODE_CLASS (m2) == MODE_UFRACT) - mclass = MODE_FRACT; - else if (GET_MODE_CLASS (m2) == MODE_UACCUM) - mclass = MODE_ACCUM; - else - gcc_unreachable (); - m2 = mode_for_size (GET_MODE_PRECISION (m2), mclass, 0); - } - } + { + /* If the input type is unsigned, we need to convert to the + signed type. */ + if (code1 == FIXED_POINT_TYPE && TYPE_UNSIGNED (t1)) + { + enum mode_class mclass = (enum mode_class) 0; + if (GET_MODE_CLASS (m1) == MODE_UFRACT) + mclass = MODE_FRACT; + else if (GET_MODE_CLASS (m1) == MODE_UACCUM) + mclass = MODE_ACCUM; + else + gcc_unreachable (); + m1 = mode_for_size (GET_MODE_PRECISION (m1), mclass, 0); + } + if (code2 == FIXED_POINT_TYPE && TYPE_UNSIGNED (t2)) + { + enum mode_class mclass = (enum mode_class) 0; + if (GET_MODE_CLASS (m2) == MODE_UFRACT) + mclass = MODE_FRACT; + else if (GET_MODE_CLASS (m2) == MODE_UACCUM) + mclass = MODE_ACCUM; + else + gcc_unreachable (); + m2 = mode_for_size (GET_MODE_PRECISION (m2), mclass, 0); + } + } if (code1 == FIXED_POINT_TYPE) - { - fbit1 = GET_MODE_FBIT (m1); - ibit1 = GET_MODE_IBIT (m1); - } + { + fbit1 = GET_MODE_FBIT (m1); + ibit1 = GET_MODE_IBIT (m1); + } else - { - fbit1 = 0; - /* Signed integers need to subtract one sign bit. */ - ibit1 = TYPE_PRECISION (t1) - (!TYPE_UNSIGNED (t1)); - } + { + fbit1 = 0; + /* Signed integers need to subtract one sign bit. */ + ibit1 = TYPE_PRECISION (t1) - (!TYPE_UNSIGNED (t1)); + } if (code2 == FIXED_POINT_TYPE) - { - fbit2 = GET_MODE_FBIT (m2); - ibit2 = GET_MODE_IBIT (m2); - } + { + fbit2 = GET_MODE_FBIT (m2); + ibit2 = GET_MODE_IBIT (m2); + } else - { - fbit2 = 0; - /* Signed integers need to subtract one sign bit. */ - ibit2 = TYPE_PRECISION (t2) - (!TYPE_UNSIGNED (t2)); - } + { + fbit2 = 0; + /* Signed integers need to subtract one sign bit. */ + ibit2 = TYPE_PRECISION (t2) - (!TYPE_UNSIGNED (t2)); + } max_ibit = ibit1 >= ibit2 ? ibit1 : ibit2; max_fbit = fbit1 >= fbit2 ? fbit1 : fbit2; return c_common_fixed_point_type_for_size (max_ibit, max_fbit, unsignedp, - satp); + satp); } /* Both real or both integers; use the one with greater precision. */ @@ -915,9 +896,9 @@ || TYPE_MAIN_VARIANT (t2) == long_long_integer_type_node) { if (TYPE_UNSIGNED (t1) || TYPE_UNSIGNED (t2)) - return long_long_unsigned_type_node; + return long_long_unsigned_type_node; else - return long_long_integer_type_node; + return long_long_integer_type_node; } if (TYPE_MAIN_VARIANT (t1) == long_unsigned_type_node @@ -928,11 +909,11 @@ || TYPE_MAIN_VARIANT (t2) == long_integer_type_node) { /* But preserve unsignedness from the other type, - since long cannot hold all the values of an unsigned int. */ + since long cannot hold all the values of an unsigned int. */ if (TYPE_UNSIGNED (t1) || TYPE_UNSIGNED (t2)) - return long_unsigned_type_node; + return long_unsigned_type_node; else - return long_integer_type_node; + return long_integer_type_node; } /* Likewise, prefer long double to double even if same size. */ @@ -1109,8 +1090,8 @@ case POINTER_TYPE: /* Do not remove mode or aliasing information. */ if (TYPE_MODE (t1) != TYPE_MODE (t2) - || TYPE_REF_CAN_ALIAS_ALL (t1) != TYPE_REF_CAN_ALIAS_ALL (t2)) - break; + || TYPE_REF_CAN_ALIAS_ALL (t1) != TYPE_REF_CAN_ALIAS_ALL (t2)) + break; val = (TREE_TYPE (t1) == TREE_TYPE (t2) ? 1 : comptypes_internal (TREE_TYPE (t1), TREE_TYPE (t2), enum_and_int_p, different_types_p)); @@ -1236,7 +1217,7 @@ if (val == 1 && enum_and_int_p && warn_cxx_compat) warning_at (location, OPT_Wc___compat, - "pointer target types incompatible in C++"); + "pointer target types incompatible in C++"); return val; } @@ -1254,11 +1235,11 @@ switch (TREE_CODE_CLASS (TREE_CODE (t1))) { case tcc_declaration: - t1 = DECL_CONTEXT (t1); break; + t1 = DECL_CONTEXT (t1); break; case tcc_type: - t1 = TYPE_CONTEXT (t1); break; + t1 = TYPE_CONTEXT (t1); break; case tcc_exceptional: - t1 = BLOCK_SUPERCONTEXT (t1); break; /* assume block */ + t1 = BLOCK_SUPERCONTEXT (t1); break; /* assume block */ default: gcc_unreachable (); } @@ -1266,11 +1247,11 @@ switch (TREE_CODE_CLASS (TREE_CODE (t2))) { case tcc_declaration: - t2 = DECL_CONTEXT (t2); break; + t2 = DECL_CONTEXT (t2); break; case tcc_type: - t2 = TYPE_CONTEXT (t2); break; + t2 = TYPE_CONTEXT (t2); break; case tcc_exceptional: - t2 = BLOCK_SUPERCONTEXT (t2); break; /* assume block */ + t2 = BLOCK_SUPERCONTEXT (t2); break; /* assume block */ default: gcc_unreachable (); } @@ -1314,7 +1295,7 @@ while (tu != tu_til) { const struct tagged_tu_seen_cache *const tu1 - = (const struct tagged_tu_seen_cache *) tu; + = (const struct tagged_tu_seen_cache *) tu; tu = tu1->next; free (CONST_CAST (struct tagged_tu_seen_cache *, tu1)); } @@ -1342,13 +1323,13 @@ In the case of compiler-created builtin structs the TYPE_DECL may be a dummy, with no DECL_ORIGINAL_TYPE. Don't fault. */ while (TYPE_NAME (t1) - && TREE_CODE (TYPE_NAME (t1)) == TYPE_DECL - && DECL_ORIGINAL_TYPE (TYPE_NAME (t1))) + && TREE_CODE (TYPE_NAME (t1)) == TYPE_DECL + && DECL_ORIGINAL_TYPE (TYPE_NAME (t1))) t1 = DECL_ORIGINAL_TYPE (TYPE_NAME (t1)); while (TYPE_NAME (t2) - && TREE_CODE (TYPE_NAME (t2)) == TYPE_DECL - && DECL_ORIGINAL_TYPE (TYPE_NAME (t2))) + && TREE_CODE (TYPE_NAME (t2)) == TYPE_DECL + && DECL_ORIGINAL_TYPE (TYPE_NAME (t2))) t2 = DECL_ORIGINAL_TYPE (TYPE_NAME (t2)); /* C90 didn't have the requirement that the two tags be the same. */ @@ -1366,61 +1347,61 @@ const struct tagged_tu_seen_cache * tts_i; for (tts_i = tagged_tu_seen_base; tts_i != NULL; tts_i = tts_i->next) if (tts_i->t1 == t1 && tts_i->t2 == t2) - return tts_i->val; + return tts_i->val; } switch (TREE_CODE (t1)) { case ENUMERAL_TYPE: { - struct tagged_tu_seen_cache *tu = alloc_tagged_tu_seen_cache (t1, t2); - /* Speed up the case where the type values are in the same order. */ - tree tv1 = TYPE_VALUES (t1); - tree tv2 = TYPE_VALUES (t2); - - if (tv1 == tv2) - { - return 1; - } - - for (;tv1 && tv2; tv1 = TREE_CHAIN (tv1), tv2 = TREE_CHAIN (tv2)) - { - if (TREE_PURPOSE (tv1) != TREE_PURPOSE (tv2)) - break; - if (simple_cst_equal (TREE_VALUE (tv1), TREE_VALUE (tv2)) != 1) - { - tu->val = 0; - return 0; - } - } - - if (tv1 == NULL_TREE && tv2 == NULL_TREE) - { - return 1; - } - if (tv1 == NULL_TREE || tv2 == NULL_TREE) - { - tu->val = 0; - return 0; - } - - if (list_length (TYPE_VALUES (t1)) != list_length (TYPE_VALUES (t2))) - { - tu->val = 0; - return 0; - } - - for (s1 = TYPE_VALUES (t1); s1; s1 = TREE_CHAIN (s1)) - { - s2 = purpose_member (TREE_PURPOSE (s1), TYPE_VALUES (t2)); - if (s2 == NULL - || simple_cst_equal (TREE_VALUE (s1), TREE_VALUE (s2)) != 1) - { - tu->val = 0; - return 0; - } - } - return 1; + struct tagged_tu_seen_cache *tu = alloc_tagged_tu_seen_cache (t1, t2); + /* Speed up the case where the type values are in the same order. */ + tree tv1 = TYPE_VALUES (t1); + tree tv2 = TYPE_VALUES (t2); + + if (tv1 == tv2) + { + return 1; + } + + for (;tv1 && tv2; tv1 = TREE_CHAIN (tv1), tv2 = TREE_CHAIN (tv2)) + { + if (TREE_PURPOSE (tv1) != TREE_PURPOSE (tv2)) + break; + if (simple_cst_equal (TREE_VALUE (tv1), TREE_VALUE (tv2)) != 1) + { + tu->val = 0; + return 0; + } + } + + if (tv1 == NULL_TREE && tv2 == NULL_TREE) + { + return 1; + } + if (tv1 == NULL_TREE || tv2 == NULL_TREE) + { + tu->val = 0; + return 0; + } + + if (list_length (TYPE_VALUES (t1)) != list_length (TYPE_VALUES (t2))) + { + tu->val = 0; + return 0; + } + + for (s1 = TYPE_VALUES (t1); s1; s1 = TREE_CHAIN (s1)) + { + s2 = purpose_member (TREE_PURPOSE (s1), TYPE_VALUES (t2)); + if (s2 == NULL + || simple_cst_equal (TREE_VALUE (s1), TREE_VALUE (s2)) != 1) + { + tu->val = 0; + return 0; + } + } + return 1; } case UNION_TYPE: @@ -1526,6 +1507,7 @@ break; if (result == 2) needs_warning = true; + if (TREE_CODE (s1) == FIELD_DECL && simple_cst_equal (DECL_FIELD_BIT_OFFSET (s1), DECL_FIELD_BIT_OFFSET (s2)) != 1) @@ -1570,7 +1552,7 @@ pedwarn (input_location, 0, "function return types not compatible due to %<volatile%>"); if (TYPE_VOLATILE (ret1)) ret1 = build_qualified_type (TYPE_MAIN_VARIANT (ret1), - TYPE_QUALS (ret1) & ~TYPE_QUAL_VOLATILE); + TYPE_QUALS (ret1) & ~TYPE_QUAL_VOLATILE); if (TYPE_VOLATILE (ret2)) ret2 = build_qualified_type (TYPE_MAIN_VARIANT (ret2), TYPE_QUALS (ret2) & ~TYPE_QUAL_VOLATILE); @@ -1591,10 +1573,10 @@ if (args1 == 0) { if (!self_promoting_args_p (args2)) - return 0; + return 0; /* If one of these types comes from a non-prototype fn definition, - compare that with the other type's arglist. - If they don't match, ask for a warning (but no error). */ + compare that with the other type's arglist. + If they don't match, ask for a warning (but no error). */ if (TYPE_ACTUAL_ARG_TYPES (f1) && 1 != type_lists_compatible_p (args2, TYPE_ACTUAL_ARG_TYPES (f1), enum_and_int_p, different_types_p)) @@ -1604,7 +1586,7 @@ if (args2 == 0) { if (!self_promoting_args_p (args1)) - return 0; + return 0; if (TYPE_ACTUAL_ARG_TYPES (f2) && 1 != type_lists_compatible_p (args1, TYPE_ACTUAL_ARG_TYPES (f2), enum_and_int_p, different_types_p)) @@ -1635,17 +1617,17 @@ { tree a1, mv1, a2, mv2; if (args1 == 0 && args2 == 0) - return val; + return val; /* If one list is shorter than the other, - they fail to match. */ + they fail to match. */ if (args1 == 0 || args2 == 0) - return 0; + return 0; mv1 = a1 = TREE_VALUE (args1); mv2 = a2 = TREE_VALUE (args2); if (mv1 && mv1 != error_mark_node && TREE_CODE (mv1) != ARRAY_TYPE) - mv1 = TYPE_MAIN_VARIANT (mv1); + mv1 = TYPE_MAIN_VARIANT (mv1); if (mv2 && mv2 != error_mark_node && TREE_CODE (mv2) != ARRAY_TYPE) - mv2 = TYPE_MAIN_VARIANT (mv2); + mv2 = TYPE_MAIN_VARIANT (mv2); /* A null pointer instead of a type means there is supposed to be an argument but nothing is specified about what type it has. @@ -1654,15 +1636,15 @@ && (a1 == 0) != (a2 == 0)) *different_types_p = true; if (a1 == 0) - { - if (c_type_promotes_to (a2) != a2) - return 0; - } + { + if (c_type_promotes_to (a2) != a2) + return 0; + } else if (a2 == 0) - { - if (c_type_promotes_to (a1) != a1) - return 0; - } + { + if (c_type_promotes_to (a1) != a1) + return 0; + } /* If one of the lists has an error marker, ignore this arg. */ else if (TREE_CODE (a1) == ERROR_MARK || TREE_CODE (a2) == ERROR_MARK) @@ -1724,7 +1706,7 @@ /* comptypes said ok, but record if it said to warn. */ if (newval > val) - val = newval; + val = newval; args1 = TREE_CHAIN (args1); args2 = TREE_CHAIN (args2); @@ -1749,8 +1731,8 @@ /* Convert in case a char is more than one unit. */ return size_binop_loc (input_location, CEIL_DIV_EXPR, TYPE_SIZE_UNIT (type), - size_int (TYPE_PRECISION (char_type_node) - / BITS_PER_UNIT)); + size_int (TYPE_PRECISION (char_type_node) + / BITS_PER_UNIT)); } /* Return either DECL or its known constant value (if it has one). */ @@ -1759,8 +1741,8 @@ decl_constant_value (tree decl) { if (/* Don't change a variable array bound or initial value to a constant - in a place where a variable is invalid. Note that DECL_INITIAL - isn't valid for a PARM_DECL. */ + in a place where a variable is invalid. Note that DECL_INITIAL + isn't valid for a PARM_DECL. */ current_function_decl != 0 && TREE_CODE (decl) != PARM_DECL && !TREE_THIS_VOLATILE (decl) @@ -1768,8 +1750,8 @@ && DECL_INITIAL (decl) != 0 && TREE_CODE (DECL_INITIAL (decl)) != ERROR_MARK /* This is invalid if initial value is not constant. - If it has either a function call, a memory reference, - or a variable, then re-evaluating it could give different results. */ + If it has either a function call, a memory reference, + or a variable, then re-evaluating it could give different results. */ && TREE_CONSTANT (DECL_INITIAL (decl)) /* Check for cases where this is sub-optimal, even though valid. */ && TREE_CODE (DECL_INITIAL (decl)) != CONSTRUCTOR) @@ -1866,32 +1848,32 @@ { case ARRAY_TYPE: { - bool not_lvalue = false; - bool lvalue_array_p; - - while ((TREE_CODE (exp.value) == NON_LVALUE_EXPR - || CONVERT_EXPR_P (exp.value)) - && TREE_TYPE (TREE_OPERAND (exp.value, 0)) == type) - { - if (TREE_CODE (exp.value) == NON_LVALUE_EXPR) - not_lvalue = true; - exp.value = TREE_OPERAND (exp.value, 0); - } - - if (TREE_NO_WARNING (orig_exp)) - TREE_NO_WARNING (exp.value) = 1; - - lvalue_array_p = !not_lvalue && lvalue_p (exp.value); - if (!flag_isoc99 && !lvalue_array_p) - { - /* Before C99, non-lvalue arrays do not decay to pointers. - Normally, using such an array would be invalid; but it can - be used correctly inside sizeof or as a statement expression. - Thus, do not give an error here; an error will result later. */ - return exp; - } - - exp.value = array_to_pointer_conversion (loc, exp.value); + bool not_lvalue = false; + bool lvalue_array_p; + + while ((TREE_CODE (exp.value) == NON_LVALUE_EXPR + || CONVERT_EXPR_P (exp.value)) + && TREE_TYPE (TREE_OPERAND (exp.value, 0)) == type) + { + if (TREE_CODE (exp.value) == NON_LVALUE_EXPR) + not_lvalue = true; + exp.value = TREE_OPERAND (exp.value, 0); + } + + if (TREE_NO_WARNING (orig_exp)) + TREE_NO_WARNING (exp.value) = 1; + + lvalue_array_p = !not_lvalue && lvalue_p (exp.value); + if (!flag_isoc99 && !lvalue_array_p) + { + /* Before C99, non-lvalue arrays do not decay to pointers. + Normally, using such an array would be invalid; but it can + be used correctly inside sizeof or as a statement expression. + Thus, do not give an error here; an error will result later. */ + return exp; + } + + exp.value = array_to_pointer_conversion (loc, exp.value); } break; case FUNCTION_TYPE: @@ -1927,10 +1909,10 @@ if (code == ENUMERAL_TYPE) { type = c_common_type_for_size (MAX (TYPE_PRECISION (type), - TYPE_PRECISION (integer_type_node)), - ((TYPE_PRECISION (type) - >= TYPE_PRECISION (integer_type_node)) - && TYPE_UNSIGNED (type))); + TYPE_PRECISION (integer_type_node)), + ((TYPE_PRECISION (type) + >= TYPE_PRECISION (integer_type_node)) + && TYPE_UNSIGNED (type))); return convert (type, exp); } @@ -1940,17 +1922,17 @@ if (TREE_CODE (exp) == COMPONENT_REF && DECL_C_BIT_FIELD (TREE_OPERAND (exp, 1)) /* If it's thinner than an int, promote it like a - c_promoting_integer_type_p, otherwise leave it alone. */ + c_promoting_integer_type_p, otherwise leave it alone. */ && 0 > compare_tree_int (DECL_SIZE (TREE_OPERAND (exp, 1)), - TYPE_PRECISION (integer_type_node))) + TYPE_PRECISION (integer_type_node))) return convert (integer_type_node, exp); if (c_promoting_integer_type_p (type)) { /* Preserve unsignedness if not really getting any wider. */ if (TYPE_UNSIGNED (type) - && TYPE_PRECISION (type) == TYPE_PRECISION (integer_type_node)) - return convert (unsigned_type_node, exp); + && TYPE_PRECISION (type) == TYPE_PRECISION (integer_type_node)) + return convert (unsigned_type_node, exp); return convert (integer_type_node, exp); } @@ -2085,9 +2067,9 @@ } if (DECL_NAME (field_array[bot]) == component) - field = field_array[bot]; + field = field_array[bot]; else if (DECL_NAME (field) != component) - return NULL_TREE; + return NULL_TREE; } else { @@ -2118,7 +2100,7 @@ } if (field == NULL_TREE) - return NULL_TREE; + return NULL_TREE; } return tree_cons (NULL_TREE, field, NULL_TREE); @@ -2150,71 +2132,71 @@ if (code == RECORD_TYPE || code == UNION_TYPE) { if (!COMPLETE_TYPE_P (type)) - { - c_incomplete_type_error (NULL_TREE, type); - return error_mark_node; - } + { + c_incomplete_type_error (NULL_TREE, type); + return error_mark_node; + } field = lookup_field (type, component); if (!field) - { - error_at (loc, "%qT has no member named %qE", type, component); - return error_mark_node; - } + { + error_at (loc, "%qT has no member named %qE", type, component); + return error_mark_node; + } /* Chain the COMPONENT_REFs if necessary down to the FIELD. - This might be better solved in future the way the C++ front - end does it - by giving the anonymous entities each a - separate name and type, and then have build_component_ref - recursively call itself. We can't do that here. */ + This might be better solved in future the way the C++ front + end does it - by giving the anonymous entities each a + separate name and type, and then have build_component_ref + recursively call itself. We can't do that here. */ do - { - tree subdatum = TREE_VALUE (field); - int quals; - tree subtype; - bool use_datum_quals; - - if (TREE_TYPE (subdatum) == error_mark_node) - return error_mark_node; - - /* If this is an rvalue, it does not have qualifiers in C - standard terms and we must avoid propagating such - qualifiers down to a non-lvalue array that is then - converted to a pointer. */ - use_datum_quals = (datum_lvalue - || TREE_CODE (TREE_TYPE (subdatum)) != ARRAY_TYPE); - - quals = TYPE_QUALS (strip_array_types (TREE_TYPE (subdatum))); - if (use_datum_quals) - quals |= TYPE_QUALS (TREE_TYPE (datum)); - subtype = c_build_qualified_type (TREE_TYPE (subdatum), quals); - - ref = build3 (COMPONENT_REF, subtype, datum, subdatum, - NULL_TREE); - SET_EXPR_LOCATION (ref, loc); - if (TREE_READONLY (subdatum) - || (use_datum_quals && TREE_READONLY (datum))) - TREE_READONLY (ref) = 1; - if (TREE_THIS_VOLATILE (subdatum) - || (use_datum_quals && TREE_THIS_VOLATILE (datum))) - TREE_THIS_VOLATILE (ref) = 1; - - if (TREE_DEPRECATED (subdatum)) - warn_deprecated_use (subdatum, NULL_TREE); - - datum = ref; - - field = TREE_CHAIN (field); - } + { + tree subdatum = TREE_VALUE (field); + int quals; + tree subtype; + bool use_datum_quals; + + if (TREE_TYPE (subdatum) == error_mark_node) + return error_mark_node; + + /* If this is an rvalue, it does not have qualifiers in C + standard terms and we must avoid propagating such + qualifiers down to a non-lvalue array that is then + converted to a pointer. */ + use_datum_quals = (datum_lvalue + || TREE_CODE (TREE_TYPE (subdatum)) != ARRAY_TYPE); + + quals = TYPE_QUALS (strip_array_types (TREE_TYPE (subdatum))); + if (use_datum_quals) + quals |= TYPE_QUALS (TREE_TYPE (datum)); + subtype = c_build_qualified_type (TREE_TYPE (subdatum), quals); + + ref = build3 (COMPONENT_REF, subtype, datum, subdatum, + NULL_TREE); + SET_EXPR_LOCATION (ref, loc); + if (TREE_READONLY (subdatum) + || (use_datum_quals && TREE_READONLY (datum))) + TREE_READONLY (ref) = 1; + if (TREE_THIS_VOLATILE (subdatum) + || (use_datum_quals && TREE_THIS_VOLATILE (datum))) + TREE_THIS_VOLATILE (ref) = 1; + + if (TREE_DEPRECATED (subdatum)) + warn_deprecated_use (subdatum, NULL_TREE); + + datum = ref; + + field = TREE_CHAIN (field); + } while (field); return ref; } else if (code != ERROR_MARK) error_at (loc, - "request for member %qE in something not a structure or union", - component); + "request for member %qE in something not a structure or union", + component); return error_mark_node; } @@ -2236,52 +2218,52 @@ { if (CONVERT_EXPR_P (pointer) || TREE_CODE (pointer) == VIEW_CONVERT_EXPR) - { - /* If a warning is issued, mark it to avoid duplicates from - the backend. This only needs to be done at - warn_strict_aliasing > 2. */ - if (warn_strict_aliasing > 2) - if (strict_aliasing_warning (TREE_TYPE (TREE_OPERAND (pointer, 0)), - type, TREE_OPERAND (pointer, 0))) - TREE_NO_WARNING (pointer) = 1; - } + { + /* If a warning is issued, mark it to avoid duplicates from + the backend. This only needs to be done at + warn_strict_aliasing > 2. */ + if (warn_strict_aliasing > 2) + if (strict_aliasing_warning (TREE_TYPE (TREE_OPERAND (pointer, 0)), + type, TREE_OPERAND (pointer, 0))) + TREE_NO_WARNING (pointer) = 1; + } if (TREE_CODE (pointer) == ADDR_EXPR - && (TREE_TYPE (TREE_OPERAND (pointer, 0)) - == TREE_TYPE (type))) - { - ref = TREE_OPERAND (pointer, 0); - protected_set_expr_location (ref, loc); - return ref; - } + && (TREE_TYPE (TREE_OPERAND (pointer, 0)) + == TREE_TYPE (type))) + { + ref = TREE_OPERAND (pointer, 0); + protected_set_expr_location (ref, loc); + return ref; + } else - { - tree t = TREE_TYPE (type); - - ref = build1 (INDIRECT_REF, t, pointer); - - if (!COMPLETE_OR_VOID_TYPE_P (t) && TREE_CODE (t) != ARRAY_TYPE) - { - error_at (loc, "dereferencing pointer to incomplete type"); - return error_mark_node; - } - if (VOID_TYPE_P (t) && c_inhibit_evaluation_warnings == 0) - warning_at (loc, 0, "dereferencing %<void *%> pointer"); - - /* We *must* set TREE_READONLY when dereferencing a pointer to const, - so that we get the proper error message if the result is used - to assign to. Also, &* is supposed to be a no-op. - And ANSI C seems to specify that the type of the result - should be the const type. */ - /* A de-reference of a pointer to const is not a const. It is valid - to change it via some other pointer. */ - TREE_READONLY (ref) = TYPE_READONLY (t); - TREE_SIDE_EFFECTS (ref) - = TYPE_VOLATILE (t) || TREE_SIDE_EFFECTS (pointer); - TREE_THIS_VOLATILE (ref) = TYPE_VOLATILE (t); - protected_set_expr_location (ref, loc); - return ref; - } + { + tree t = TREE_TYPE (type); + + ref = build1 (INDIRECT_REF, t, pointer); + + if (!COMPLETE_OR_VOID_TYPE_P (t) && TREE_CODE (t) != ARRAY_TYPE) + { + error_at (loc, "dereferencing pointer to incomplete type"); + return error_mark_node; + } + if (VOID_TYPE_P (t) && c_inhibit_evaluation_warnings == 0) + warning_at (loc, 0, "dereferencing %<void *%> pointer"); + + /* We *must* set TREE_READONLY when dereferencing a pointer to const, + so that we get the proper error message if the result is used + to assign to. Also, &* is supposed to be a no-op. + And ANSI C seems to specify that the type of the result + should be the const type. */ + /* A de-reference of a pointer to const is not a const. It is valid + to change it via some other pointer. */ + TREE_READONLY (ref) = TYPE_READONLY (t); + TREE_SIDE_EFFECTS (ref) + = TYPE_VOLATILE (t) || TREE_SIDE_EFFECTS (pointer); + TREE_THIS_VOLATILE (ref) = TYPE_VOLATILE (t); + protected_set_expr_location (ref, loc); + return ref; + } } else if (TREE_CODE (pointer) != ERROR_MARK) invalid_indirection_error (loc, type, errstring); @@ -2380,58 +2362,58 @@ tree rval, type; /* An array that is indexed by a non-constant - cannot be stored in a register; we must be able to do - address arithmetic on its address. - Likewise an array of elements of variable size. */ + cannot be stored in a register; we must be able to do + address arithmetic on its address. + Likewise an array of elements of variable size. */ if (TREE_CODE (index) != INTEGER_CST - || (COMPLETE_TYPE_P (TREE_TYPE (TREE_TYPE (array))) - && TREE_CODE (TYPE_SIZE (TREE_TYPE (TREE_TYPE (array)))) != INTEGER_CST)) - { - if (!c_mark_addressable (array)) - return error_mark_node; - } + || (COMPLETE_TYPE_P (TREE_TYPE (TREE_TYPE (array))) + && TREE_CODE (TYPE_SIZE (TREE_TYPE (TREE_TYPE (array)))) != INTEGER_CST)) + { + if (!c_mark_addressable (array)) + return error_mark_node; + } /* An array that is indexed by a constant value which is not within - the array bounds cannot be stored in a register either; because we - would get a crash in store_bit_field/extract_bit_field when trying - to access a non-existent part of the register. */ + the array bounds cannot be stored in a register either; because we + would get a crash in store_bit_field/extract_bit_field when trying + to access a non-existent part of the register. */ if (TREE_CODE (index) == INTEGER_CST - && TYPE_DOMAIN (TREE_TYPE (array)) - && !int_fits_type_p (index, TYPE_DOMAIN (TREE_TYPE (array)))) - { - if (!c_mark_addressable (array)) - return error_mark_node; - } + && TYPE_DOMAIN (TREE_TYPE (array)) + && !int_fits_type_p (index, TYPE_DOMAIN (TREE_TYPE (array)))) + { + if (!c_mark_addressable (array)) + return error_mark_node; + } if (pedantic) - { - tree foo = array; - while (TREE_CODE (foo) == COMPONENT_REF) - foo = TREE_OPERAND (foo, 0); - if (TREE_CODE (foo) == VAR_DECL && C_DECL_REGISTER (foo)) - pedwarn (loc, OPT_pedantic, - "ISO C forbids subscripting %<register%> array"); - else if (!flag_isoc99 && !lvalue_p (foo)) - pedwarn (loc, OPT_pedantic, - "ISO C90 forbids subscripting non-lvalue array"); - } + { + tree foo = array; + while (TREE_CODE (foo) == COMPONENT_REF) + foo = TREE_OPERAND (foo, 0); + if (TREE_CODE (foo) == VAR_DECL && C_DECL_REGISTER (foo)) + pedwarn (loc, OPT_pedantic, + "ISO C forbids subscripting %<register%> array"); + else if (!flag_isoc99 && !lvalue_p (foo)) + pedwarn (loc, OPT_pedantic, + "ISO C90 forbids subscripting non-lvalue array"); + } type = TREE_TYPE (TREE_TYPE (array)); rval = build4 (ARRAY_REF, type, array, index, NULL_TREE, NULL_TREE); /* Array ref is const/volatile if the array elements are - or if the array is. */ + or if the array is. */ TREE_READONLY (rval) - |= (TYPE_READONLY (TREE_TYPE (TREE_TYPE (array))) - | TREE_READONLY (array)); + |= (TYPE_READONLY (TREE_TYPE (TREE_TYPE (array))) + | TREE_READONLY (array)); TREE_SIDE_EFFECTS (rval) - |= (TYPE_VOLATILE (TREE_TYPE (TREE_TYPE (array))) - | TREE_SIDE_EFFECTS (array)); + |= (TYPE_VOLATILE (TREE_TYPE (TREE_TYPE (array))) + | TREE_SIDE_EFFECTS (array)); TREE_THIS_VOLATILE (rval) - |= (TYPE_VOLATILE (TREE_TYPE (TREE_TYPE (array))) - /* This was added by rms on 16 Nov 91. - It fixes vol struct foo *a; a->elts[1] - in an inline function. - Hope it doesn't break something else. */ - | TREE_THIS_VOLATILE (array)); + |= (TYPE_VOLATILE (TREE_TYPE (TREE_TYPE (array))) + /* This was added by rms on 16 Nov 91. + It fixes vol struct foo *a; a->elts[1] + in an inline function. + Hope it doesn't break something else. */ + | TREE_THIS_VOLATILE (array)); ret = require_complete_type (rval); protected_set_expr_location (ret, loc); return ret; @@ -2441,14 +2423,14 @@ tree ar = default_conversion (array); if (ar == error_mark_node) - return ar; + return ar; gcc_assert (TREE_CODE (TREE_TYPE (ar)) == POINTER_TYPE); gcc_assert (TREE_CODE (TREE_TYPE (TREE_TYPE (ar))) != FUNCTION_TYPE); return build_indirect_ref - (loc, build_binary_op (loc, PLUS_EXPR, ar, index, 0), - RO_ARRAY_INDEXING); + (loc, build_binary_op (loc, PLUS_EXPR, ar, index, 0), + RO_ARRAY_INDEXING); } } @@ -2476,11 +2458,7 @@ } else if (fun) /* Implicit function declaration. */ -#ifndef noCbC - ref = implicitly_declare (loc, id, fun); -#else ref = implicitly_declare (loc, id); -#endif else if (decl == error_mark_node) /* Don't complain about something that's already been complained about. */ @@ -2506,11 +2484,11 @@ if (TREE_CODE (ref) == FUNCTION_DECL && !in_alignof) { if (!in_sizeof && !in_typeof) - C_DECL_USED (ref) = 1; + C_DECL_USED (ref) = 1; else if (DECL_INITIAL (ref) == 0 - && DECL_EXTERNAL (ref) - && !TREE_PUBLIC (ref)) - record_maybe_used_decl (ref); + && DECL_EXTERNAL (ref) + && !TREE_PUBLIC (ref)) + record_maybe_used_decl (ref); } if (TREE_CODE (ref) == CONST_DECL) @@ -2518,41 +2496,41 @@ used_types_insert (TREE_TYPE (ref)); if (warn_cxx_compat - && TREE_CODE (TREE_TYPE (ref)) == ENUMERAL_TYPE - && C_TYPE_DEFINED_IN_STRUCT (TREE_TYPE (ref))) - { - warning_at (loc, OPT_Wc___compat, - ("enum constant defined in struct or union " - "is not visible in C++")); - inform (DECL_SOURCE_LOCATION (ref), "enum constant defined here"); - } + && TREE_CODE (TREE_TYPE (ref)) == ENUMERAL_TYPE + && C_TYPE_DEFINED_IN_STRUCT (TREE_TYPE (ref))) + { + warning_at (loc, OPT_Wc___compat, + ("enum constant defined in struct or union " + "is not visible in C++")); + inform (DECL_SOURCE_LOCATION (ref), "enum constant defined here"); + } ref = DECL_INITIAL (ref); TREE_CONSTANT (ref) = 1; } else if (current_function_decl != 0 - && !DECL_FILE_SCOPE_P (current_function_decl) - && (TREE_CODE (ref) == VAR_DECL - || TREE_CODE (ref) == PARM_DECL - || TREE_CODE (ref) == FUNCTION_DECL)) + && !DECL_FILE_SCOPE_P (current_function_decl) + && (TREE_CODE (ref) == VAR_DECL + || TREE_CODE (ref) == PARM_DECL + || TREE_CODE (ref) == FUNCTION_DECL)) { tree context = decl_function_context (ref); if (context != 0 && context != current_function_decl) - DECL_NONLOCAL (ref) = 1; + DECL_NONLOCAL (ref) = 1; } /* C99 6.7.4p3: An inline definition of a function with external linkage ... shall not contain a reference to an identifier with internal linkage. */ else if (current_function_decl != 0 - && DECL_DECLARED_INLINE_P (current_function_decl) - && DECL_EXTERNAL (current_function_decl) - && VAR_OR_FUNCTION_DECL_P (ref) - && (TREE_CODE (ref) != VAR_DECL || TREE_STATIC (ref)) - && ! TREE_PUBLIC (ref) - && DECL_CONTEXT (ref) != current_function_decl) + && DECL_DECLARED_INLINE_P (current_function_decl) + && DECL_EXTERNAL (current_function_decl) + && VAR_OR_FUNCTION_DECL_P (ref) + && (TREE_CODE (ref) != VAR_DECL || TREE_STATIC (ref)) + && ! TREE_PUBLIC (ref) + && DECL_CONTEXT (ref) != current_function_decl) record_inline_static (loc, current_function_decl, ref, - csi_internal); + csi_internal); return ref; } @@ -2598,12 +2576,12 @@ while (p && p->level > cur_level) { if (used) - { - if (cur_level == 0) - C_DECL_USED (p->decl) = 1; - else - p->level = cur_level; - } + { + if (cur_level == 0) + C_DECL_USED (p->decl) = 1; + else + p->level = cur_level; + } p = p->next; } if (!used || cur_level == 0) @@ -2627,18 +2605,18 @@ { bool expr_const_operands = true; tree folded_expr = c_fully_fold (expr.value, require_constant_value, - &expr_const_operands); + &expr_const_operands); ret.value = c_sizeof (loc, TREE_TYPE (folded_expr)); ret.original_code = ERROR_MARK; ret.original_type = NULL; if (c_vla_type_p (TREE_TYPE (folded_expr))) - { - /* sizeof is evaluated when given a vla (C99 6.5.3.4p2). */ - ret.value = build2 (C_MAYBE_CONST_EXPR, TREE_TYPE (ret.value), - folded_expr, ret.value); - C_MAYBE_CONST_EXPR_NON_CONST (ret.value) = !expr_const_operands; - SET_EXPR_LOCATION (ret.value, loc); - } + { + /* sizeof is evaluated when given a vla (C99 6.5.3.4p2). */ + ret.value = build2 (C_MAYBE_CONST_EXPR, TREE_TYPE (ret.value), + folded_expr, ret.value); + C_MAYBE_CONST_EXPR_NON_CONST (ret.value) = !expr_const_operands; + SET_EXPR_LOCATION (ret.value, loc); + } pop_maybe_used (C_TYPE_VARIABLE_SIZE (TREE_TYPE (folded_expr))); } return ret; @@ -2663,20 +2641,20 @@ && c_vla_type_p (type)) { /* If the type is a [*] array, it is a VLA but is represented as - having a size of zero. In such a case we must ensure that - the result of sizeof does not get folded to a constant by - c_fully_fold, because if the size is evaluated the result is - not constant and so constraints on zero or negative size - arrays must not be applied when this sizeof call is inside - another array declarator. */ + having a size of zero. In such a case we must ensure that + the result of sizeof does not get folded to a constant by + c_fully_fold, because if the size is evaluated the result is + not constant and so constraints on zero or negative size + arrays must not be applied when this sizeof call is inside + another array declarator. */ if (!type_expr) - type_expr = integer_zero_node; + type_expr = integer_zero_node; ret.value = build2 (C_MAYBE_CONST_EXPR, TREE_TYPE (ret.value), - type_expr, ret.value); + type_expr, ret.value); C_MAYBE_CONST_EXPR_NON_CONST (ret.value) = !type_expr_const; } pop_maybe_used (type != error_mark_node - ? C_TYPE_VARIABLE_SIZE (type) : false); + ? C_TYPE_VARIABLE_SIZE (type) : false); return ret; } @@ -2710,7 +2688,7 @@ tree build_function_call_vec (location_t loc, tree function, VEC(tree,gc) *params, - VEC(tree,gc) *origtypes) + VEC(tree,gc) *origtypes) { tree fntype, fundecl = 0; tree name = NULL_TREE, result; @@ -2726,12 +2704,12 @@ if (TREE_CODE (function) == FUNCTION_DECL) { /* Implement type-directed function overloading for builtins. - resolve_overloaded_builtin and targetm.resolve_overloaded_builtin - handle all the type checking. The result is a complete expression - that implements this function call. */ + resolve_overloaded_builtin and targetm.resolve_overloaded_builtin + handle all the type checking. The result is a complete expression + that implements this function call. */ tem = resolve_overloaded_builtin (loc, function, params); if (tem) - return tem; + return tem; name = DECL_NAME (function); fundecl = function; @@ -2743,7 +2721,7 @@ expressions, like those used for ObjC messenger dispatches. */ if (!VEC_empty (tree, params)) function = objc_rewrite_function_call (function, - VEC_index (tree, params, 0)); + VEC_index (tree, params, 0)); function = c_fully_fold (function, false, NULL); @@ -2753,7 +2731,7 @@ return error_mark_node; if (!(TREE_CODE (fntype) == POINTER_TYPE - && TREE_CODE (TREE_TYPE (fntype)) == FUNCTION_TYPE)) + && TREE_CODE (TREE_TYPE (fntype)) == FUNCTION_TYPE)) { error_at (loc, "called object %qE is not a function", function); return error_mark_node; @@ -2769,7 +2747,7 @@ function prototype, or apply default promotions. */ nargs = convert_arguments (TYPE_ARG_TYPES (fntype), params, origtypes, - function, fundecl); + function, fundecl); if (nargs < 0) return error_mark_node; @@ -2785,29 +2763,29 @@ { tree return_type = TREE_TYPE (fntype); tree trap = build_function_call (loc, built_in_decls[BUILT_IN_TRAP], - NULL_TREE); + NULL_TREE); int i; /* This situation leads to run-time undefined behavior. We can't, - therefore, simply error unless we can prove that all possible - executions of the program must execute the code. */ + therefore, simply error unless we can prove that all possible + executions of the program must execute the code. */ if (warning_at (loc, 0, "function called through a non-compatible type")) - /* We can, however, treat "undefined" any way we please. - Call abort to encourage the user to fix the program. */ - inform (loc, "if this code is reached, the program will abort"); + /* We can, however, treat "undefined" any way we please. + Call abort to encourage the user to fix the program. */ + inform (loc, "if this code is reached, the program will abort"); /* Before the abort, allow the function arguments to exit or - call longjmp. */ + call longjmp. */ for (i = 0; i < nargs; i++) - trap = build2 (COMPOUND_EXPR, void_type_node, - VEC_index (tree, params, i), trap); + trap = build2 (COMPOUND_EXPR, void_type_node, + VEC_index (tree, params, i), trap); if (VOID_TYPE_P (return_type)) - { - if (TYPE_QUALS (return_type) != TYPE_UNQUALIFIED) - pedwarn (loc, 0, - "function with qualified void return type called"); - return trap; - } + { + if (TYPE_QUALS (return_type) != TYPE_UNQUALIFIED) + pedwarn (loc, 0, + "function with qualified void return type called"); + return trap; + } else { tree rhs; @@ -2835,31 +2813,31 @@ /* Check that the arguments to the function are valid. */ check_function_arguments (TYPE_ATTRIBUTES (fntype), nargs, argarray, - TYPE_ARG_TYPES (fntype)); + TYPE_ARG_TYPES (fntype)); if (name != NULL_TREE && !strncmp (IDENTIFIER_POINTER (name), "__builtin_", 10)) { if (require_constant_value) - result = - fold_build_call_array_initializer_loc (loc, TREE_TYPE (fntype), - function, nargs, argarray); + result = + fold_build_call_array_initializer_loc (loc, TREE_TYPE (fntype), + function, nargs, argarray); else - result = fold_build_call_array_loc (loc, TREE_TYPE (fntype), - function, nargs, argarray); + result = fold_build_call_array_loc (loc, TREE_TYPE (fntype), + function, nargs, argarray); if (TREE_CODE (result) == NOP_EXPR - && TREE_CODE (TREE_OPERAND (result, 0)) == INTEGER_CST) - STRIP_TYPE_NOPS (result); + && TREE_CODE (TREE_OPERAND (result, 0)) == INTEGER_CST) + STRIP_TYPE_NOPS (result); } else result = build_call_array_loc (loc, TREE_TYPE (fntype), - function, nargs, argarray); + function, nargs, argarray); if (VOID_TYPE_P (TREE_TYPE (result))) { if (TYPE_QUALS (TREE_TYPE (result)) != TYPE_UNQUALIFIED) - pedwarn (loc, 0, - "function with qualified void return type called"); + pedwarn (loc, 0, + "function with qualified void return type called"); return result; } return require_complete_type (result); @@ -2886,7 +2864,7 @@ static int convert_arguments (tree typelist, VEC(tree,gc) *values, - VEC(tree,gc) *origtypes, tree function, tree fundecl) + VEC(tree,gc) *origtypes, tree function, tree fundecl) { tree typetail, val; unsigned int parmnum; @@ -2913,20 +2891,20 @@ && DECL_BUILT_IN_CLASS (fundecl) == BUILT_IN_NORMAL) { switch (DECL_FUNCTION_CODE (fundecl)) - { - case BUILT_IN_ISFINITE: - case BUILT_IN_ISINF: - case BUILT_IN_ISINF_SIGN: - case BUILT_IN_ISNAN: - case BUILT_IN_ISNORMAL: - case BUILT_IN_FPCLASSIFY: - type_generic_remove_excess_precision = true; - break; - - default: - type_generic_remove_excess_precision = false; - break; - } + { + case BUILT_IN_ISFINITE: + case BUILT_IN_ISINF: + case BUILT_IN_ISINF_SIGN: + case BUILT_IN_ISNAN: + case BUILT_IN_ISNORMAL: + case BUILT_IN_FPCLASSIFY: + type_generic_remove_excess_precision = true; + break; + + default: + type_generic_remove_excess_precision = false; + break; + } } /* Scan the given expressions and types, producing individual @@ -2960,188 +2938,188 @@ } if (selector && argnum > 2) - { - rname = selector; - argnum -= 2; - } + { + rname = selector; + argnum -= 2; + } npc = null_pointer_constant_p (val); /* If there is excess precision and a prototype, convert once to - the required type rather than converting via the semantic - type. Likewise without a prototype a float value represented - as long double should be converted once to double. But for - type-generic classification functions excess precision must - be removed here. */ + the required type rather than converting via the semantic + type. Likewise without a prototype a float value represented + as long double should be converted once to double. But for + type-generic classification functions excess precision must + be removed here. */ if (TREE_CODE (val) == EXCESS_PRECISION_EXPR - && (type || !type_generic || !type_generic_remove_excess_precision)) - { - val = TREE_OPERAND (val, 0); - excess_precision = true; - } + && (type || !type_generic || !type_generic_remove_excess_precision)) + { + val = TREE_OPERAND (val, 0); + excess_precision = true; + } val = c_fully_fold (val, false, NULL); STRIP_TYPE_NOPS (val); val = require_complete_type (val); if (type != 0) - { - /* Formal parm type is specified by a function prototype. */ - - if (type == error_mark_node || !COMPLETE_TYPE_P (type)) - { - error ("type of formal parameter %d is incomplete", parmnum + 1); - parmval = val; - } - else - { - tree origtype; - - /* Optionally warn about conversions that - differ from the default conversions. */ - if (warn_traditional_conversion || warn_traditional) - { - unsigned int formal_prec = TYPE_PRECISION (type); - - if (INTEGRAL_TYPE_P (type) - && TREE_CODE (valtype) == REAL_TYPE) - warning (0, "passing argument %d of %qE as integer " - "rather than floating due to prototype", - argnum, rname); - if (INTEGRAL_TYPE_P (type) - && TREE_CODE (valtype) == COMPLEX_TYPE) - warning (0, "passing argument %d of %qE as integer " - "rather than complex due to prototype", - argnum, rname); - else if (TREE_CODE (type) == COMPLEX_TYPE - && TREE_CODE (valtype) == REAL_TYPE) - warning (0, "passing argument %d of %qE as complex " - "rather than floating due to prototype", - argnum, rname); - else if (TREE_CODE (type) == REAL_TYPE - && INTEGRAL_TYPE_P (valtype)) - warning (0, "passing argument %d of %qE as floating " - "rather than integer due to prototype", - argnum, rname); - else if (TREE_CODE (type) == COMPLEX_TYPE - && INTEGRAL_TYPE_P (valtype)) - warning (0, "passing argument %d of %qE as complex " - "rather than integer due to prototype", - argnum, rname); - else if (TREE_CODE (type) == REAL_TYPE - && TREE_CODE (valtype) == COMPLEX_TYPE) - warning (0, "passing argument %d of %qE as floating " - "rather than complex due to prototype", - argnum, rname); - /* ??? At some point, messages should be written about - conversions between complex types, but that's too messy - to do now. */ - else if (TREE_CODE (type) == REAL_TYPE - && TREE_CODE (valtype) == REAL_TYPE) - { - /* Warn if any argument is passed as `float', - since without a prototype it would be `double'. */ - if (formal_prec == TYPE_PRECISION (float_type_node) - && type != dfloat32_type_node) - warning (0, "passing argument %d of %qE as %<float%> " - "rather than %<double%> due to prototype", - argnum, rname); - - /* Warn if mismatch between argument and prototype - for decimal float types. Warn of conversions with - binary float types and of precision narrowing due to - prototype. */ - else if (type != valtype - && (type == dfloat32_type_node - || type == dfloat64_type_node - || type == dfloat128_type_node - || valtype == dfloat32_type_node - || valtype == dfloat64_type_node - || valtype == dfloat128_type_node) - && (formal_prec - <= TYPE_PRECISION (valtype) - || (type == dfloat128_type_node - && (valtype - != dfloat64_type_node - && (valtype - != dfloat32_type_node))) - || (type == dfloat64_type_node - && (valtype - != dfloat32_type_node)))) - warning (0, "passing argument %d of %qE as %qT " - "rather than %qT due to prototype", - argnum, rname, type, valtype); - - } - /* Detect integer changing in width or signedness. - These warnings are only activated with - -Wtraditional-conversion, not with -Wtraditional. */ - else if (warn_traditional_conversion && INTEGRAL_TYPE_P (type) - && INTEGRAL_TYPE_P (valtype)) - { - tree would_have_been = default_conversion (val); - tree type1 = TREE_TYPE (would_have_been); - - if (TREE_CODE (type) == ENUMERAL_TYPE - && (TYPE_MAIN_VARIANT (type) - == TYPE_MAIN_VARIANT (valtype))) - /* No warning if function asks for enum - and the actual arg is that enum type. */ - ; - else if (formal_prec != TYPE_PRECISION (type1)) - warning (OPT_Wtraditional_conversion, - "passing argument %d of %qE " - "with different width due to prototype", - argnum, rname); - else if (TYPE_UNSIGNED (type) == TYPE_UNSIGNED (type1)) - ; - /* Don't complain if the formal parameter type - is an enum, because we can't tell now whether - the value was an enum--even the same enum. */ - else if (TREE_CODE (type) == ENUMERAL_TYPE) - ; - else if (TREE_CODE (val) == INTEGER_CST - && int_fits_type_p (val, type)) - /* Change in signedness doesn't matter - if a constant value is unaffected. */ - ; - /* If the value is extended from a narrower - unsigned type, it doesn't matter whether we - pass it as signed or unsigned; the value - certainly is the same either way. */ - else if (TYPE_PRECISION (valtype) < TYPE_PRECISION (type) - && TYPE_UNSIGNED (valtype)) - ; - else if (TYPE_UNSIGNED (type)) - warning (OPT_Wtraditional_conversion, - "passing argument %d of %qE " - "as unsigned due to prototype", - argnum, rname); - else - warning (OPT_Wtraditional_conversion, - "passing argument %d of %qE " - "as signed due to prototype", argnum, rname); - } - } - - /* Possibly restore an EXCESS_PRECISION_EXPR for the - sake of better warnings from convert_and_check. */ - if (excess_precision) - val = build1 (EXCESS_PRECISION_EXPR, valtype, val); - origtype = (origtypes == NULL - ? NULL_TREE - : VEC_index (tree, origtypes, parmnum)); - parmval = convert_for_assignment (input_location, type, val, - origtype, ic_argpass, npc, - fundecl, function, - parmnum + 1); - - if (targetm.calls.promote_prototypes (fundecl ? TREE_TYPE (fundecl) : 0) - && INTEGRAL_TYPE_P (type) - && (TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node))) - parmval = default_conversion (parmval); - } - } + { + /* Formal parm type is specified by a function prototype. */ + + if (type == error_mark_node || !COMPLETE_TYPE_P (type)) + { + error ("type of formal parameter %d is incomplete", parmnum + 1); + parmval = val; + } + else + { + tree origtype; + + /* Optionally warn about conversions that + differ from the default conversions. */ + if (warn_traditional_conversion || warn_traditional) + { + unsigned int formal_prec = TYPE_PRECISION (type); + + if (INTEGRAL_TYPE_P (type) + && TREE_CODE (valtype) == REAL_TYPE) + warning (0, "passing argument %d of %qE as integer " + "rather than floating due to prototype", + argnum, rname); + if (INTEGRAL_TYPE_P (type) + && TREE_CODE (valtype) == COMPLEX_TYPE) + warning (0, "passing argument %d of %qE as integer " + "rather than complex due to prototype", + argnum, rname); + else if (TREE_CODE (type) == COMPLEX_TYPE + && TREE_CODE (valtype) == REAL_TYPE) + warning (0, "passing argument %d of %qE as complex " + "rather than floating due to prototype", + argnum, rname); + else if (TREE_CODE (type) == REAL_TYPE + && INTEGRAL_TYPE_P (valtype)) + warning (0, "passing argument %d of %qE as floating " + "rather than integer due to prototype", + argnum, rname); + else if (TREE_CODE (type) == COMPLEX_TYPE + && INTEGRAL_TYPE_P (valtype)) + warning (0, "passing argument %d of %qE as complex " + "rather than integer due to prototype", + argnum, rname); + else if (TREE_CODE (type) == REAL_TYPE + && TREE_CODE (valtype) == COMPLEX_TYPE) + warning (0, "passing argument %d of %qE as floating " + "rather than complex due to prototype", + argnum, rname); + /* ??? At some point, messages should be written about + conversions between complex types, but that's too messy + to do now. */ + else if (TREE_CODE (type) == REAL_TYPE + && TREE_CODE (valtype) == REAL_TYPE) + { + /* Warn if any argument is passed as `float', + since without a prototype it would be `double'. */ + if (formal_prec == TYPE_PRECISION (float_type_node) + && type != dfloat32_type_node) + warning (0, "passing argument %d of %qE as %<float%> " + "rather than %<double%> due to prototype", + argnum, rname); + + /* Warn if mismatch between argument and prototype + for decimal float types. Warn of conversions with + binary float types and of precision narrowing due to + prototype. */ + else if (type != valtype + && (type == dfloat32_type_node + || type == dfloat64_type_node + || type == dfloat128_type_node + || valtype == dfloat32_type_node + || valtype == dfloat64_type_node + || valtype == dfloat128_type_node) + && (formal_prec + <= TYPE_PRECISION (valtype) + || (type == dfloat128_type_node + && (valtype + != dfloat64_type_node + && (valtype + != dfloat32_type_node))) + || (type == dfloat64_type_node + && (valtype + != dfloat32_type_node)))) + warning (0, "passing argument %d of %qE as %qT " + "rather than %qT due to prototype", + argnum, rname, type, valtype); + + } + /* Detect integer changing in width or signedness. + These warnings are only activated with + -Wtraditional-conversion, not with -Wtraditional. */ + else if (warn_traditional_conversion && INTEGRAL_TYPE_P (type) + && INTEGRAL_TYPE_P (valtype)) + { + tree would_have_been = default_conversion (val); + tree type1 = TREE_TYPE (would_have_been); + + if (TREE_CODE (type) == ENUMERAL_TYPE + && (TYPE_MAIN_VARIANT (type) + == TYPE_MAIN_VARIANT (valtype))) + /* No warning if function asks for enum + and the actual arg is that enum type. */ + ; + else if (formal_prec != TYPE_PRECISION (type1)) + warning (OPT_Wtraditional_conversion, + "passing argument %d of %qE " + "with different width due to prototype", + argnum, rname); + else if (TYPE_UNSIGNED (type) == TYPE_UNSIGNED (type1)) + ; + /* Don't complain if the formal parameter type + is an enum, because we can't tell now whether + the value was an enum--even the same enum. */ + else if (TREE_CODE (type) == ENUMERAL_TYPE) + ; + else if (TREE_CODE (val) == INTEGER_CST + && int_fits_type_p (val, type)) + /* Change in signedness doesn't matter + if a constant value is unaffected. */ + ; + /* If the value is extended from a narrower + unsigned type, it doesn't matter whether we + pass it as signed or unsigned; the value + certainly is the same either way. */ + else if (TYPE_PRECISION (valtype) < TYPE_PRECISION (type) + && TYPE_UNSIGNED (valtype)) + ; + else if (TYPE_UNSIGNED (type)) + warning (OPT_Wtraditional_conversion, + "passing argument %d of %qE " + "as unsigned due to prototype", + argnum, rname); + else + warning (OPT_Wtraditional_conversion, + "passing argument %d of %qE " + "as signed due to prototype", argnum, rname); + } + } + + /* Possibly restore an EXCESS_PRECISION_EXPR for the + sake of better warnings from convert_and_check. */ + if (excess_precision) + val = build1 (EXCESS_PRECISION_EXPR, valtype, val); + origtype = (origtypes == NULL + ? NULL_TREE + : VEC_index (tree, origtypes, parmnum)); + parmval = convert_for_assignment (input_location, type, val, + origtype, ic_argpass, npc, + fundecl, function, + parmnum + 1); + + if (targetm.calls.promote_prototypes (fundecl ? TREE_TYPE (fundecl) : 0) + && INTEGRAL_TYPE_P (type) + && (TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node))) + parmval = default_conversion (parmval); + } + } else if (TREE_CODE (valtype) == REAL_TYPE && (TYPE_PRECISION (valtype) < TYPE_PRECISION (double_type_node)) @@ -3161,36 +3139,30 @@ } } else if (excess_precision && !type_generic) - /* A "double" argument with excess precision being passed - without a prototype or in variable arguments. */ - parmval = convert (valtype, val); + /* A "double" argument with excess precision being passed + without a prototype or in variable arguments. */ + parmval = convert (valtype, val); else if ((invalid_func_diag = - targetm.calls.invalid_arg_for_unprototyped_fn (typelist, fundecl, val))) - { - error (invalid_func_diag); - return -1; - } + targetm.calls.invalid_arg_for_unprototyped_fn (typelist, fundecl, val))) + { + error (invalid_func_diag); + return -1; + } else - /* Convert `short' and `char' to full-size `int'. */ - parmval = default_conversion (val); + /* Convert `short' and `char' to full-size `int'. */ + parmval = default_conversion (val); VEC_replace (tree, values, parmnum, parmval); if (parmval == error_mark_node) - error_args = true; + error_args = true; if (typetail) - typetail = TREE_CHAIN (typetail); + typetail = TREE_CHAIN (typetail); } gcc_assert (parmnum == VEC_length (tree, values)); -#ifndef noCbC - if (typetail != 0 && TREE_VALUE (typetail) != void_type_node - //&& !CbC_IS_CODE_SEGMENT(TREE_TYPE(fundecl)) ) - && !(fundecl&&CbC_IS_CODE_SEGMENT(fundecl)) ) -#else if (typetail != 0 && TREE_VALUE (typetail) != void_type_node) -#endif { error_at (input_location, "too few arguments to function %qE", function); @@ -3235,7 +3207,7 @@ struct c_expr parser_build_binary_op (location_t location, enum tree_code code, - struct c_expr arg1, struct c_expr arg2) + struct c_expr arg1, struct c_expr arg2) { struct c_expr result; @@ -3249,7 +3221,7 @@ : TREE_TYPE (arg2.value)); result.value = build_binary_op (location, code, - arg1.value, arg2.value, 1); + arg1.value, arg2.value, 1); result.original_code = code; result.original_type = NULL; @@ -3266,21 +3238,21 @@ if (warn_logical_op) warn_logical_operator (input_location, code, TREE_TYPE (result.value), - code1, arg1.value, code2, arg2.value); + code1, arg1.value, code2, arg2.value); /* Warn about comparisons against string literals, with the exception of testing for equality or inequality of a string literal with NULL. */ if (code == EQ_EXPR || code == NE_EXPR) { if ((code1 == STRING_CST && !integer_zerop (arg2.value)) - || (code2 == STRING_CST && !integer_zerop (arg1.value))) - warning_at (location, OPT_Waddress, - "comparison with string literal results in unspecified behavior"); + || (code2 == STRING_CST && !integer_zerop (arg1.value))) + warning_at (location, OPT_Waddress, + "comparison with string literal results in unspecified behavior"); } else if (TREE_CODE_CLASS (code) == tcc_comparison - && (code1 == STRING_CST || code2 == STRING_CST)) + && (code1 == STRING_CST || code2 == STRING_CST)) warning_at (location, OPT_Waddress, - "comparison with string literal results in unspecified behavior"); + "comparison with string literal results in unspecified behavior"); if (TREE_OVERFLOW_P (result.value) && !TREE_OVERFLOW_P (arg1.value) @@ -3294,8 +3266,8 @@ && TREE_CODE (type2) == ENUMERAL_TYPE && TYPE_MAIN_VARIANT (type1) != TYPE_MAIN_VARIANT (type2)) warning_at (location, OPT_Wenum_compare, - "comparison between %qT and %qT", - type1, type2); + "comparison between %qT and %qT", + type1, type2); return result; } @@ -3324,10 +3296,10 @@ tree common_type; /* Determine the common superset address space. This is guaranteed - to exist because the caller verified that comp_target_types - returned non-zero. */ + to exist because the caller verified that comp_target_types + returned non-zero. */ if (!addr_space_superset (as0, as1, &as_common)) - gcc_unreachable (); + gcc_unreachable (); common_type = common_pointer_type (TREE_TYPE (op0), TREE_TYPE (op1)); op0 = convert (common_type, op0); @@ -3339,17 +3311,17 @@ type if pointers for the address space are wider than ptrdiff_t. */ if (TYPE_PRECISION (restype) < TYPE_PRECISION (TREE_TYPE (op0))) inttype = lang_hooks.types.type_for_size - (TYPE_PRECISION (TREE_TYPE (op0)), 0); + (TYPE_PRECISION (TREE_TYPE (op0)), 0); else inttype = restype; if (TREE_CODE (target_type) == VOID_TYPE) pedwarn (loc, pedantic ? OPT_pedantic : OPT_Wpointer_arith, - "pointer of type %<void *%> used in subtraction"); + "pointer of type %<void *%> used in subtraction"); if (TREE_CODE (target_type) == FUNCTION_TYPE) pedwarn (loc, pedantic ? OPT_pedantic : OPT_Wpointer_arith, - "pointer to a function used in subtraction"); + "pointer to a function used in subtraction"); /* If the conversion to ptrdiff_type does anything like widening or converting a partial to an integral mode, we get a convert_expression @@ -3361,13 +3333,13 @@ at least the cases that occur in legal static initializers. */ if (CONVERT_EXPR_P (op0) && (TYPE_PRECISION (TREE_TYPE (op0)) - == TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (op0, 0))))) + == TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (op0, 0))))) con0 = TREE_OPERAND (op0, 0); else con0 = op0; if (CONVERT_EXPR_P (op1) && (TYPE_PRECISION (TREE_TYPE (op1)) - == TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (op1, 0))))) + == TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (op1, 0))))) con1 = TREE_OPERAND (op1, 0); else con1 = op1; @@ -3401,8 +3373,8 @@ in case restype is a short type. */ op0 = build_binary_op (loc, - MINUS_EXPR, convert (inttype, op0), - convert (inttype, op1), 0); + MINUS_EXPR, convert (inttype, op0), + convert (inttype, op1), 0); /* This generates an error if op1 is pointer to incomplete type. */ if (!COMPLETE_OR_VOID_TYPE_P (TREE_TYPE (TREE_TYPE (orig_op1)))) error_at (loc, "arithmetic on pointer to an incomplete type"); @@ -3412,7 +3384,7 @@ /* Divide by the size, in easiest possible way. */ result = fold_build2_loc (loc, EXACT_DIV_EXPR, inttype, - op0, convert (inttype, op1)); + op0, convert (inttype, op1)); /* Convert to final result type if necessary. */ return convert (restype, result); @@ -3431,7 +3403,7 @@ tree build_unary_op (location_t location, - enum tree_code code, tree xarg, int flag) + enum tree_code code, tree xarg, int flag) { /* No default_conversion here. It causes trouble for ADDR_EXPR. */ tree arg = xarg; @@ -3474,92 +3446,92 @@ { case CONVERT_EXPR: /* This is used for unary plus, because a CONVERT_EXPR - is enough to prevent anybody from looking inside for - associativity, but won't generate any code. */ + is enough to prevent anybody from looking inside for + associativity, but won't generate any code. */ if (!(typecode == INTEGER_TYPE || typecode == REAL_TYPE - || typecode == FIXED_POINT_TYPE || typecode == COMPLEX_TYPE - || typecode == VECTOR_TYPE)) - { - error_at (location, "wrong type argument to unary plus"); - return error_mark_node; - } + || typecode == FIXED_POINT_TYPE || typecode == COMPLEX_TYPE + || typecode == VECTOR_TYPE)) + { + error_at (location, "wrong type argument to unary plus"); + return error_mark_node; + } else if (!noconvert) - arg = default_conversion (arg); + arg = default_conversion (arg); arg = non_lvalue_loc (location, arg); break; case NEGATE_EXPR: if (!(typecode == INTEGER_TYPE || typecode == REAL_TYPE - || typecode == FIXED_POINT_TYPE || typecode == COMPLEX_TYPE - || typecode == VECTOR_TYPE)) - { - error_at (location, "wrong type argument to unary minus"); - return error_mark_node; - } + || typecode == FIXED_POINT_TYPE || typecode == COMPLEX_TYPE + || typecode == VECTOR_TYPE)) + { + error_at (location, "wrong type argument to unary minus"); + return error_mark_node; + } else if (!noconvert) - arg = default_conversion (arg); + arg = default_conversion (arg); break; case BIT_NOT_EXPR: /* ~ works on integer types and non float vectors. */ if (typecode == INTEGER_TYPE - || (typecode == VECTOR_TYPE - && !VECTOR_FLOAT_TYPE_P (TREE_TYPE (arg)))) - { - if (!noconvert) - arg = default_conversion (arg); - } + || (typecode == VECTOR_TYPE + && !VECTOR_FLOAT_TYPE_P (TREE_TYPE (arg)))) + { + if (!noconvert) + arg = default_conversion (arg); + } else if (typecode == COMPLEX_TYPE) - { - code = CONJ_EXPR; - pedwarn (location, OPT_pedantic, - "ISO C does not support %<~%> for complex conjugation"); - if (!noconvert) - arg = default_conversion (arg); - } + { + code = CONJ_EXPR; + pedwarn (location, OPT_pedantic, + "ISO C does not support %<~%> for complex conjugation"); + if (!noconvert) + arg = default_conversion (arg); + } else - { - error_at (location, "wrong type argument to bit-complement"); - return error_mark_node; - } + { + error_at (location, "wrong type argument to bit-complement"); + return error_mark_node; + } break; case ABS_EXPR: if (!(typecode == INTEGER_TYPE || typecode == REAL_TYPE)) - { - error_at (location, "wrong type argument to abs"); - return error_mark_node; - } + { + error_at (location, "wrong type argument to abs"); + return error_mark_node; + } else if (!noconvert) - arg = default_conversion (arg); + arg = default_conversion (arg); break; case CONJ_EXPR: /* Conjugating a real value is a no-op, but allow it anyway. */ if (!(typecode == INTEGER_TYPE || typecode == REAL_TYPE - || typecode == COMPLEX_TYPE)) - { - error_at (location, "wrong type argument to conjugation"); - return error_mark_node; - } + || typecode == COMPLEX_TYPE)) + { + error_at (location, "wrong type argument to conjugation"); + return error_mark_node; + } else if (!noconvert) - arg = default_conversion (arg); + arg = default_conversion (arg); break; case TRUTH_NOT_EXPR: if (typecode != INTEGER_TYPE && typecode != FIXED_POINT_TYPE - && typecode != REAL_TYPE && typecode != POINTER_TYPE - && typecode != COMPLEX_TYPE) - { - error_at (location, - "wrong type argument to unary exclamation mark"); - return error_mark_node; - } + && typecode != REAL_TYPE && typecode != POINTER_TYPE + && typecode != COMPLEX_TYPE) + { + error_at (location, + "wrong type argument to unary exclamation mark"); + return error_mark_node; + } arg = c_objc_common_truthvalue_conversion (location, arg); ret = invert_truthvalue_loc (location, arg); /* If the TRUTH_NOT_EXPR has been folded, reset the location. */ if (EXPR_P (ret) && EXPR_HAS_LOCATION (ret)) - location = EXPR_LOCATION (ret); + location = EXPR_LOCATION (ret); goto return_build_unary_op; case REALPART_EXPR: @@ -3568,7 +3540,7 @@ if (ret == error_mark_node) return error_mark_node; if (eptype && TREE_CODE (eptype) == COMPLEX_TYPE) - eptype = TREE_TYPE (eptype); + eptype = TREE_TYPE (eptype); goto return_build_unary_op; case PREINCREMENT_EXPR: @@ -3577,17 +3549,17 @@ case POSTDECREMENT_EXPR: if (TREE_CODE (arg) == C_MAYBE_CONST_EXPR) - { - tree inner = build_unary_op (location, code, - C_MAYBE_CONST_EXPR_EXPR (arg), flag); - if (inner == error_mark_node) - return error_mark_node; - ret = build2 (C_MAYBE_CONST_EXPR, TREE_TYPE (inner), - C_MAYBE_CONST_EXPR_PRE (arg), inner); - gcc_assert (!C_MAYBE_CONST_EXPR_INT_OPERANDS (arg)); - C_MAYBE_CONST_EXPR_NON_CONST (ret) = 1; - goto return_build_unary_op; - } + { + tree inner = build_unary_op (location, code, + C_MAYBE_CONST_EXPR_EXPR (arg), flag); + if (inner == error_mark_node) + return error_mark_node; + ret = build2 (C_MAYBE_CONST_EXPR, TREE_TYPE (inner), + C_MAYBE_CONST_EXPR_PRE (arg), inner); + gcc_assert (!C_MAYBE_CONST_EXPR_INT_OPERANDS (arg)); + C_MAYBE_CONST_EXPR_NON_CONST (ret) = 1; + goto return_build_unary_op; + } /* Complain about anything that is not a true lvalue. In Objective-C, skip this check for property_refs. */ @@ -3600,50 +3572,50 @@ return error_mark_node; if (warn_cxx_compat && TREE_CODE (TREE_TYPE (arg)) == ENUMERAL_TYPE) - { - if (code == PREINCREMENT_EXPR || code == POSTINCREMENT_EXPR) - warning_at (location, OPT_Wc___compat, - "increment of enumeration value is invalid in C++"); - else - warning_at (location, OPT_Wc___compat, - "decrement of enumeration value is invalid in C++"); - } + { + if (code == PREINCREMENT_EXPR || code == POSTINCREMENT_EXPR) + warning_at (location, OPT_Wc___compat, + "increment of enumeration value is invalid in C++"); + else + warning_at (location, OPT_Wc___compat, + "decrement of enumeration value is invalid in C++"); + } /* Ensure the argument is fully folded inside any SAVE_EXPR. */ arg = c_fully_fold (arg, false, NULL); /* Increment or decrement the real part of the value, - and don't change the imaginary part. */ + and don't change the imaginary part. */ if (typecode == COMPLEX_TYPE) - { - tree real, imag; - - pedwarn (location, OPT_pedantic, - "ISO C does not support %<++%> and %<--%> on complex types"); - - arg = stabilize_reference (arg); - real = build_unary_op (EXPR_LOCATION (arg), REALPART_EXPR, arg, 1); - imag = build_unary_op (EXPR_LOCATION (arg), IMAGPART_EXPR, arg, 1); - real = build_unary_op (EXPR_LOCATION (arg), code, real, 1); - if (real == error_mark_node || imag == error_mark_node) - return error_mark_node; - ret = build2 (COMPLEX_EXPR, TREE_TYPE (arg), - real, imag); - goto return_build_unary_op; - } + { + tree real, imag; + + pedwarn (location, OPT_pedantic, + "ISO C does not support %<++%> and %<--%> on complex types"); + + arg = stabilize_reference (arg); + real = build_unary_op (EXPR_LOCATION (arg), REALPART_EXPR, arg, 1); + imag = build_unary_op (EXPR_LOCATION (arg), IMAGPART_EXPR, arg, 1); + real = build_unary_op (EXPR_LOCATION (arg), code, real, 1); + if (real == error_mark_node || imag == error_mark_node) + return error_mark_node; + ret = build2 (COMPLEX_EXPR, TREE_TYPE (arg), + real, imag); + goto return_build_unary_op; + } /* Report invalid types. */ if (typecode != POINTER_TYPE && typecode != FIXED_POINT_TYPE - && typecode != INTEGER_TYPE && typecode != REAL_TYPE) - { - if (code == PREINCREMENT_EXPR || code == POSTINCREMENT_EXPR) - error_at (location, "wrong type argument to increment"); - else - error_at (location, "wrong type argument to decrement"); - - return error_mark_node; - } + && typecode != INTEGER_TYPE && typecode != REAL_TYPE) + { + if (code == PREINCREMENT_EXPR || code == POSTINCREMENT_EXPR) + error_at (location, "wrong type argument to increment"); + else + error_at (location, "wrong type argument to decrement"); + + return error_mark_node; + } { tree inc; @@ -3741,57 +3713,57 @@ /* Note that this operation never does default_conversion. */ /* The operand of unary '&' must be an lvalue (which excludes - expressions of type void), or, in C99, the result of a [] or - unary '*' operator. */ + expressions of type void), or, in C99, the result of a [] or + unary '*' operator. */ if (VOID_TYPE_P (TREE_TYPE (arg)) - && TYPE_QUALS (TREE_TYPE (arg)) == TYPE_UNQUALIFIED - && (TREE_CODE (arg) != INDIRECT_REF - || !flag_isoc99)) - pedwarn (location, 0, "taking address of expression of type %<void%>"); + && TYPE_QUALS (TREE_TYPE (arg)) == TYPE_UNQUALIFIED + && (TREE_CODE (arg) != INDIRECT_REF + || !flag_isoc99)) + pedwarn (location, 0, "taking address of expression of type %<void%>"); /* Let &* cancel out to simplify resulting code. */ if (TREE_CODE (arg) == INDIRECT_REF) - { - /* Don't let this be an lvalue. */ - if (lvalue_p (TREE_OPERAND (arg, 0))) - return non_lvalue_loc (location, TREE_OPERAND (arg, 0)); - ret = TREE_OPERAND (arg, 0); - goto return_build_unary_op; - } + { + /* Don't let this be an lvalue. */ + if (lvalue_p (TREE_OPERAND (arg, 0))) + return non_lvalue_loc (location, TREE_OPERAND (arg, 0)); + ret = TREE_OPERAND (arg, 0); + goto return_build_unary_op; + } /* For &x[y], return x+y */ if (TREE_CODE (arg) == ARRAY_REF) - { - tree op0 = TREE_OPERAND (arg, 0); - if (!c_mark_addressable (op0)) - return error_mark_node; - return build_binary_op (location, PLUS_EXPR, - (TREE_CODE (TREE_TYPE (op0)) == ARRAY_TYPE - ? array_to_pointer_conversion (location, - op0) - : op0), - TREE_OPERAND (arg, 1), 1); - } + { + tree op0 = TREE_OPERAND (arg, 0); + if (!c_mark_addressable (op0)) + return error_mark_node; + return build_binary_op (location, PLUS_EXPR, + (TREE_CODE (TREE_TYPE (op0)) == ARRAY_TYPE + ? array_to_pointer_conversion (location, + op0) + : op0), + TREE_OPERAND (arg, 1), 1); + } /* Anything not already handled and not a true memory reference - or a non-lvalue array is an error. */ + or a non-lvalue array is an error. */ else if (typecode != FUNCTION_TYPE && !flag && !lvalue_or_else (location, arg, lv_addressof)) return error_mark_node; /* Move address operations inside C_MAYBE_CONST_EXPR to simplify - folding later. */ + folding later. */ if (TREE_CODE (arg) == C_MAYBE_CONST_EXPR) - { - tree inner = build_unary_op (location, code, - C_MAYBE_CONST_EXPR_EXPR (arg), flag); - ret = build2 (C_MAYBE_CONST_EXPR, TREE_TYPE (inner), - C_MAYBE_CONST_EXPR_PRE (arg), inner); - gcc_assert (!C_MAYBE_CONST_EXPR_INT_OPERANDS (arg)); - C_MAYBE_CONST_EXPR_NON_CONST (ret) - = C_MAYBE_CONST_EXPR_NON_CONST (arg); - goto return_build_unary_op; - } + { + tree inner = build_unary_op (location, code, + C_MAYBE_CONST_EXPR_EXPR (arg), flag); + ret = build2 (C_MAYBE_CONST_EXPR, TREE_TYPE (inner), + C_MAYBE_CONST_EXPR_PRE (arg), inner); + gcc_assert (!C_MAYBE_CONST_EXPR_INT_OPERANDS (arg)); + C_MAYBE_CONST_EXPR_NON_CONST (ret) + = C_MAYBE_CONST_EXPR_NON_CONST (arg); + goto return_build_unary_op; + } /* Ordinary case; arg is a COMPONENT_REF or a decl. */ argtype = TREE_TYPE (arg); @@ -3817,26 +3789,26 @@ } if (!c_mark_addressable (arg)) - return error_mark_node; + return error_mark_node; gcc_assert (TREE_CODE (arg) != COMPONENT_REF - || !DECL_C_BIT_FIELD (TREE_OPERAND (arg, 1))); + || !DECL_C_BIT_FIELD (TREE_OPERAND (arg, 1))); argtype = build_pointer_type (argtype); /* ??? Cope with user tricks that amount to offsetof. Delete this - when we have proper support for integer constant expressions. */ + when we have proper support for integer constant expressions. */ val = get_base_address (arg); if (val && TREE_CODE (val) == INDIRECT_REF && TREE_CONSTANT (TREE_OPERAND (val, 0))) - { - tree op0 = fold_convert_loc (location, sizetype, - fold_offsetof (arg, val)), op1; - - op1 = fold_convert_loc (location, argtype, TREE_OPERAND (val, 0)); - ret = fold_build2_loc (location, POINTER_PLUS_EXPR, argtype, op1, op0); - goto return_build_unary_op; - } + { + tree op0 = fold_convert_loc (location, sizetype, + fold_offsetof (arg, val)), op1; + + op1 = fold_convert_loc (location, argtype, TREE_OPERAND (val, 0)); + ret = fold_build2_loc (location, POINTER_PLUS_EXPR, argtype, op1, op0); + goto return_build_unary_op; + } val = build1 (ADDR_EXPR, argtype, arg); @@ -3851,8 +3823,8 @@ argtype = TREE_TYPE (arg); if (TREE_CODE (arg) == INTEGER_CST) ret = (require_constant_value - ? fold_build1_initializer_loc (location, code, argtype, arg) - : fold_build1_loc (location, code, argtype, arg)); + ? fold_build1_initializer_loc (location, code, argtype, arg) + : fold_build1_loc (location, code, argtype, arg)); else ret = build1 (code, argtype, arg); return_build_unary_op: @@ -3898,7 +3870,7 @@ case RESULT_DECL: case ERROR_MARK: return (TREE_CODE (TREE_TYPE (ref)) != FUNCTION_TYPE - && TREE_CODE (TREE_TYPE (ref)) != METHOD_TYPE); + && TREE_CODE (TREE_TYPE (ref)) != METHOD_TYPE); case BIND_EXPR: return TREE_CODE (TREE_TYPE (ref)) == ARRAY_TYPE; @@ -3907,7 +3879,7 @@ return 0; } } - + /* Give a warning for storing in something that is read-only in GCC terms but not const in ISO C terms. */ @@ -3961,57 +3933,57 @@ switch (TREE_CODE (x)) { case COMPONENT_REF: - if (DECL_C_BIT_FIELD (TREE_OPERAND (x, 1))) - { - error - ("cannot take address of bit-field %qD", TREE_OPERAND (x, 1)); - return false; - } - - /* ... fall through ... */ + if (DECL_C_BIT_FIELD (TREE_OPERAND (x, 1))) + { + error + ("cannot take address of bit-field %qD", TREE_OPERAND (x, 1)); + return false; + } + + /* ... fall through ... */ case ADDR_EXPR: case ARRAY_REF: case REALPART_EXPR: case IMAGPART_EXPR: - x = TREE_OPERAND (x, 0); - break; + x = TREE_OPERAND (x, 0); + break; case COMPOUND_LITERAL_EXPR: case CONSTRUCTOR: - TREE_ADDRESSABLE (x) = 1; - return true; + TREE_ADDRESSABLE (x) = 1; + return true; case VAR_DECL: case CONST_DECL: case PARM_DECL: case RESULT_DECL: - if (C_DECL_REGISTER (x) - && DECL_NONLOCAL (x)) - { - if (TREE_PUBLIC (x) || TREE_STATIC (x) || DECL_EXTERNAL (x)) - { - error - ("global register variable %qD used in nested function", x); - return false; - } - pedwarn (input_location, 0, "register variable %qD used in nested function", x); - } - else if (C_DECL_REGISTER (x)) - { - if (TREE_PUBLIC (x) || TREE_STATIC (x) || DECL_EXTERNAL (x)) - error ("address of global register variable %qD requested", x); - else - error ("address of register variable %qD requested", x); - return false; - } - - /* drops in */ + if (C_DECL_REGISTER (x) + && DECL_NONLOCAL (x)) + { + if (TREE_PUBLIC (x) || TREE_STATIC (x) || DECL_EXTERNAL (x)) + { + error + ("global register variable %qD used in nested function", x); + return false; + } + pedwarn (input_location, 0, "register variable %qD used in nested function", x); + } + else if (C_DECL_REGISTER (x)) + { + if (TREE_PUBLIC (x) || TREE_STATIC (x) || DECL_EXTERNAL (x)) + error ("address of global register variable %qD requested", x); + else + error ("address of register variable %qD requested", x); + return false; + } + + /* drops in */ case FUNCTION_DECL: - TREE_ADDRESSABLE (x) = 1; - /* drops out */ + TREE_ADDRESSABLE (x) = 1; + /* drops out */ default: - return true; + return true; } } @@ -4051,8 +4023,8 @@ tree build_conditional_expr (location_t colon_loc, tree ifexp, bool ifexp_bcp, - tree op1, tree op1_original_type, tree op2, - tree op2_original_type) + tree op1, tree op1_original_type, tree op2, + tree op2_original_type) { tree type1; tree type2; @@ -4103,23 +4075,23 @@ if ((TREE_CODE (op1) == EXCESS_PRECISION_EXPR || TREE_CODE (op2) == EXCESS_PRECISION_EXPR) && (code1 == INTEGER_TYPE || code1 == REAL_TYPE - || code1 == COMPLEX_TYPE) + || code1 == COMPLEX_TYPE) && (code2 == INTEGER_TYPE || code2 == REAL_TYPE - || code2 == COMPLEX_TYPE)) + || code2 == COMPLEX_TYPE)) { semantic_result_type = c_common_type (type1, type2); if (TREE_CODE (op1) == EXCESS_PRECISION_EXPR) - { - op1 = TREE_OPERAND (op1, 0); - type1 = TREE_TYPE (op1); - gcc_assert (TREE_CODE (type1) == code1); - } + { + op1 = TREE_OPERAND (op1, 0); + type1 = TREE_TYPE (op1); + gcc_assert (TREE_CODE (type1) == code1); + } if (TREE_CODE (op2) == EXCESS_PRECISION_EXPR) - { - op2 = TREE_OPERAND (op2, 0); - type2 = TREE_TYPE (op2); - gcc_assert (TREE_CODE (type2) == code2); - } + { + op2 = TREE_OPERAND (op2, 0); + type2 = TREE_TYPE (op2); + gcc_assert (TREE_CODE (type2) == code2); + } } if (warn_cxx_compat) @@ -4128,12 +4100,12 @@ tree t2 = op2_original_type ? op2_original_type : TREE_TYPE (orig_op2); if (TREE_CODE (t1) == ENUMERAL_TYPE - && TREE_CODE (t2) == ENUMERAL_TYPE - && TYPE_MAIN_VARIANT (t1) != TYPE_MAIN_VARIANT (t2)) - warning_at (colon_loc, OPT_Wc___compat, - ("different enum types in conditional is " - "invalid in C++: %qT vs %qT"), - t1, t2); + && TREE_CODE (t2) == ENUMERAL_TYPE + && TYPE_MAIN_VARIANT (t1) != TYPE_MAIN_VARIANT (t2)) + warning_at (colon_loc, OPT_Wc___compat, + ("different enum types in conditional is " + "invalid in C++: %qT vs %qT"), + t1, t2); } /* Quickly detect the usual case where op1 and op2 have the same type @@ -4141,14 +4113,14 @@ if (TYPE_MAIN_VARIANT (type1) == TYPE_MAIN_VARIANT (type2)) { if (type1 == type2) - result_type = type1; + result_type = type1; else - result_type = TYPE_MAIN_VARIANT (type1); + result_type = TYPE_MAIN_VARIANT (type1); } else if ((code1 == INTEGER_TYPE || code1 == REAL_TYPE - || code1 == COMPLEX_TYPE) - && (code2 == INTEGER_TYPE || code2 == REAL_TYPE - || code2 == COMPLEX_TYPE)) + || code1 == COMPLEX_TYPE) + && (code2 == INTEGER_TYPE || code2 == REAL_TYPE + || code2 == COMPLEX_TYPE)) { result_type = c_common_type (type1, type2); do_warn_double_promotion (result_type, type1, type2, @@ -4157,76 +4129,76 @@ colon_loc); /* If -Wsign-compare, warn here if type1 and type2 have - different signedness. We'll promote the signed to unsigned - and later code won't know it used to be different. - Do this check on the original types, so that explicit casts - will be considered, but default promotions won't. */ + different signedness. We'll promote the signed to unsigned + and later code won't know it used to be different. + Do this check on the original types, so that explicit casts + will be considered, but default promotions won't. */ if (c_inhibit_evaluation_warnings == 0) - { - int unsigned_op1 = TYPE_UNSIGNED (TREE_TYPE (orig_op1)); - int unsigned_op2 = TYPE_UNSIGNED (TREE_TYPE (orig_op2)); - - if (unsigned_op1 ^ unsigned_op2) - { - bool ovf; - - /* Do not warn if the result type is signed, since the - signed type will only be chosen if it can represent - all the values of the unsigned type. */ - if (!TYPE_UNSIGNED (result_type)) - /* OK */; - else - { - bool op1_maybe_const = true; - bool op2_maybe_const = true; - - /* Do not warn if the signed quantity is an - unsuffixed integer literal (or some static - constant expression involving such literals) and - it is non-negative. This warning requires the - operands to be folded for best results, so do - that folding in this case even without - warn_sign_compare to avoid warning options - possibly affecting code generation. */ - c_inhibit_evaluation_warnings - += (ifexp == truthvalue_false_node); - op1 = c_fully_fold (op1, require_constant_value, - &op1_maybe_const); - c_inhibit_evaluation_warnings - -= (ifexp == truthvalue_false_node); - - c_inhibit_evaluation_warnings - += (ifexp == truthvalue_true_node); - op2 = c_fully_fold (op2, require_constant_value, - &op2_maybe_const); - c_inhibit_evaluation_warnings - -= (ifexp == truthvalue_true_node); - - if (warn_sign_compare) - { - if ((unsigned_op2 - && tree_expr_nonnegative_warnv_p (op1, &ovf)) - || (unsigned_op1 - && tree_expr_nonnegative_warnv_p (op2, &ovf))) - /* OK */; - else - warning_at (colon_loc, OPT_Wsign_compare, - ("signed and unsigned type in " - "conditional expression")); - } - if (!op1_maybe_const || TREE_CODE (op1) != INTEGER_CST) - op1 = c_wrap_maybe_const (op1, !op1_maybe_const); - if (!op2_maybe_const || TREE_CODE (op2) != INTEGER_CST) - op2 = c_wrap_maybe_const (op2, !op2_maybe_const); - } - } - } + { + int unsigned_op1 = TYPE_UNSIGNED (TREE_TYPE (orig_op1)); + int unsigned_op2 = TYPE_UNSIGNED (TREE_TYPE (orig_op2)); + + if (unsigned_op1 ^ unsigned_op2) + { + bool ovf; + + /* Do not warn if the result type is signed, since the + signed type will only be chosen if it can represent + all the values of the unsigned type. */ + if (!TYPE_UNSIGNED (result_type)) + /* OK */; + else + { + bool op1_maybe_const = true; + bool op2_maybe_const = true; + + /* Do not warn if the signed quantity is an + unsuffixed integer literal (or some static + constant expression involving such literals) and + it is non-negative. This warning requires the + operands to be folded for best results, so do + that folding in this case even without + warn_sign_compare to avoid warning options + possibly affecting code generation. */ + c_inhibit_evaluation_warnings + += (ifexp == truthvalue_false_node); + op1 = c_fully_fold (op1, require_constant_value, + &op1_maybe_const); + c_inhibit_evaluation_warnings + -= (ifexp == truthvalue_false_node); + + c_inhibit_evaluation_warnings + += (ifexp == truthvalue_true_node); + op2 = c_fully_fold (op2, require_constant_value, + &op2_maybe_const); + c_inhibit_evaluation_warnings + -= (ifexp == truthvalue_true_node); + + if (warn_sign_compare) + { + if ((unsigned_op2 + && tree_expr_nonnegative_warnv_p (op1, &ovf)) + || (unsigned_op1 + && tree_expr_nonnegative_warnv_p (op2, &ovf))) + /* OK */; + else + warning_at (colon_loc, OPT_Wsign_compare, + ("signed and unsigned type in " + "conditional expression")); + } + if (!op1_maybe_const || TREE_CODE (op1) != INTEGER_CST) + op1 = c_wrap_maybe_const (op1, !op1_maybe_const); + if (!op2_maybe_const || TREE_CODE (op2) != INTEGER_CST) + op2 = c_wrap_maybe_const (op2, !op2_maybe_const); + } + } + } } else if (code1 == VOID_TYPE || code2 == VOID_TYPE) { if (code1 != VOID_TYPE || code2 != VOID_TYPE) - pedwarn (colon_loc, OPT_pedantic, - "ISO C forbids conditional expr with only one void side"); + pedwarn (colon_loc, OPT_pedantic, + "ISO C forbids conditional expr with only one void side"); result_type = void_type_node; } else if (code1 == POINTER_TYPE && code2 == POINTER_TYPE) @@ -4236,26 +4208,26 @@ addr_space_t as_common; if (comp_target_types (colon_loc, type1, type2)) - result_type = common_pointer_type (type1, type2); + result_type = common_pointer_type (type1, type2); else if (null_pointer_constant_p (orig_op1)) - result_type = type2; + result_type = type2; else if (null_pointer_constant_p (orig_op2)) - result_type = type1; + result_type = type1; else if (!addr_space_superset (as1, as2, &as_common)) - { - error_at (colon_loc, "pointers to disjoint address spaces " - "used in conditional expression"); - return error_mark_node; - } + { + error_at (colon_loc, "pointers to disjoint address spaces " + "used in conditional expression"); + return error_mark_node; + } else if (VOID_TYPE_P (TREE_TYPE (type1))) - { - if (TREE_CODE (TREE_TYPE (type2)) == FUNCTION_TYPE) - pedwarn (colon_loc, OPT_pedantic, - "ISO C forbids conditional expr between " - "%<void *%> and function pointer"); - result_type = build_pointer_type (qualify_type (TREE_TYPE (type1), - TREE_TYPE (type2))); - } + { + if (TREE_CODE (TREE_TYPE (type2)) == FUNCTION_TYPE) + pedwarn (colon_loc, OPT_pedantic, + "ISO C forbids conditional expr between " + "%<void *%> and function pointer"); + result_type = build_pointer_type (qualify_type (TREE_TYPE (type1), + TREE_TYPE (type2))); + } else if (VOID_TYPE_P (TREE_TYPE (type2))) { if (TREE_CODE (TREE_TYPE (type1)) == FUNCTION_TYPE) @@ -4281,42 +4253,42 @@ else if (code1 == POINTER_TYPE && code2 == INTEGER_TYPE) { if (!null_pointer_constant_p (orig_op2)) - pedwarn (colon_loc, 0, - "pointer/integer type mismatch in conditional expression"); + pedwarn (colon_loc, 0, + "pointer/integer type mismatch in conditional expression"); else - { - op2 = null_pointer_node; - } + { + op2 = null_pointer_node; + } result_type = type1; } else if (code2 == POINTER_TYPE && code1 == INTEGER_TYPE) { if (!null_pointer_constant_p (orig_op1)) - pedwarn (colon_loc, 0, - "pointer/integer type mismatch in conditional expression"); + pedwarn (colon_loc, 0, + "pointer/integer type mismatch in conditional expression"); else - { - op1 = null_pointer_node; - } + { + op1 = null_pointer_node; + } result_type = type2; } if (!result_type) { if (flag_cond_mismatch) - result_type = void_type_node; + result_type = void_type_node; else - { - error_at (colon_loc, "type mismatch in conditional expression"); - return error_mark_node; - } + { + error_at (colon_loc, "type mismatch in conditional expression"); + return error_mark_node; + } } /* Merge const and volatile flags of the incoming types. */ result_type = build_type_variant (result_type, - TYPE_READONLY (type1) || TYPE_READONLY (type2), - TYPE_VOLATILE (type1) || TYPE_VOLATILE (type2)); + TYPE_READONLY (type1) || TYPE_READONLY (type2), + TYPE_VOLATILE (type1) || TYPE_VOLATILE (type2)); op1 = ep_convert_and_check (result_type, op1, semantic_result_type); op2 = ep_convert_and_check (result_type, op2, semantic_result_type); @@ -4332,16 +4304,16 @@ op2 = c_fully_fold (op2, require_constant_value, NULL); } int_const = int_operands = (ifexp_int_operands - && op1_int_operands - && op2_int_operands); + && op1_int_operands + && op2_int_operands); if (int_operands) { int_const = ((ifexp == truthvalue_true_node - && TREE_CODE (orig_op1) == INTEGER_CST - && !TREE_OVERFLOW (orig_op1)) - || (ifexp == truthvalue_false_node - && TREE_CODE (orig_op2) == INTEGER_CST - && !TREE_OVERFLOW (orig_op2))); + && TREE_CODE (orig_op1) == INTEGER_CST + && !TREE_OVERFLOW (orig_op1)) + || (ifexp == truthvalue_false_node + && TREE_CODE (orig_op2) == INTEGER_CST + && !TREE_OVERFLOW (orig_op2))); } if (int_const || (ifexp_bcp && TREE_CODE (ifexp) == INTEGER_CST)) ret = fold_build3_loc (colon_loc, COND_EXPR, result_type, ifexp, op1, op2); @@ -4349,7 +4321,7 @@ { ret = build3 (COND_EXPR, result_type, ifexp, op1, op2); if (int_operands) - ret = note_integer_operands (ret); + ret = note_integer_operands (ret); } if (semantic_result_type) ret = build1 (EXCESS_PRECISION_EXPR, semantic_result_type, ret); @@ -4388,21 +4360,21 @@ if (!TREE_SIDE_EFFECTS (expr1)) { /* The left-hand operand of a comma expression is like an expression - statement: with -Wunused, we should warn if it doesn't have - any side-effects, unless it was explicitly cast to (void). */ + statement: with -Wunused, we should warn if it doesn't have + any side-effects, unless it was explicitly cast to (void). */ if (warn_unused_value) - { - if (VOID_TYPE_P (TREE_TYPE (expr1)) - && CONVERT_EXPR_P (expr1)) - ; /* (void) a, b */ - else if (VOID_TYPE_P (TREE_TYPE (expr1)) - && TREE_CODE (expr1) == COMPOUND_EXPR - && CONVERT_EXPR_P (TREE_OPERAND (expr1, 1))) - ; /* (void) a, (void) b, c */ - else - warning_at (loc, OPT_Wunused_value, - "left-hand operand of comma expression has no effect"); - } + { + if (VOID_TYPE_P (TREE_TYPE (expr1)) + && CONVERT_EXPR_P (expr1)) + ; /* (void) a, b */ + else if (VOID_TYPE_P (TREE_TYPE (expr1)) + && TREE_CODE (expr1) == COMPOUND_EXPR + && CONVERT_EXPR_P (TREE_OPERAND (expr1, 1))) + ; /* (void) a, (void) b, c */ + else + warning_at (loc, OPT_Wunused_value, + "left-hand operand of comma expression has no effect"); + } } /* With -Wunused, we should also warn if the left-hand operand does have @@ -4455,19 +4427,19 @@ in_type = TREE_TYPE (in_type); /* GNU C allows cv-qualified function types. 'const' means the - function is very pure, 'volatile' means it can't return. We - need to warn when such qualifiers are added, not when they're - taken away. */ + function is very pure, 'volatile' means it can't return. We + need to warn when such qualifiers are added, not when they're + taken away. */ if (TREE_CODE (in_otype) == FUNCTION_TYPE - && TREE_CODE (in_type) == FUNCTION_TYPE) - added |= (TYPE_QUALS_NO_ADDR_SPACE (in_type) - & ~TYPE_QUALS_NO_ADDR_SPACE (in_otype)); + && TREE_CODE (in_type) == FUNCTION_TYPE) + added |= (TYPE_QUALS_NO_ADDR_SPACE (in_type) + & ~TYPE_QUALS_NO_ADDR_SPACE (in_otype)); else - discarded |= (TYPE_QUALS_NO_ADDR_SPACE (in_otype) - & ~TYPE_QUALS_NO_ADDR_SPACE (in_type)); + discarded |= (TYPE_QUALS_NO_ADDR_SPACE (in_otype) + & ~TYPE_QUALS_NO_ADDR_SPACE (in_type)); } while (TREE_CODE (in_type) == POINTER_TYPE - && TREE_CODE (in_otype) == POINTER_TYPE); + && TREE_CODE (in_otype) == POINTER_TYPE); if (added) warning_at (loc, OPT_Wcast_qual, @@ -4518,7 +4490,7 @@ break; } if (is_const) - is_const = TYPE_READONLY (in_type); + is_const = TYPE_READONLY (in_type); } while (TREE_CODE (in_type) == POINTER_TYPE); } @@ -4563,15 +4535,15 @@ { value = require_complete_type (value); if (value == error_mark_node) - return error_mark_node; + return error_mark_node; } if (type == TYPE_MAIN_VARIANT (TREE_TYPE (value))) { if (TREE_CODE (type) == RECORD_TYPE - || TREE_CODE (type) == UNION_TYPE) - pedwarn (loc, OPT_pedantic, - "ISO C forbids casting nonscalar to the same type"); + || TREE_CODE (type) == UNION_TYPE) + pedwarn (loc, OPT_pedantic, + "ISO C forbids casting nonscalar to the same type"); } else if (TREE_CODE (type) == UNION_TYPE) { @@ -4606,11 +4578,11 @@ tree otype, ovalue; if (type == void_type_node) - { - tree t = build1 (CONVERT_EXPR, type, value); - SET_EXPR_LOCATION (t, loc); - return t; - } + { + tree t = build1 (CONVERT_EXPR, type, value); + SET_EXPR_LOCATION (t, loc); + return t; + } otype = TREE_TYPE (value); @@ -4621,120 +4593,120 @@ handle_warn_cast_qual (loc, type, otype); /* Warn about conversions between pointers to disjoint - address spaces. */ + address spaces. */ if (TREE_CODE (type) == POINTER_TYPE - && TREE_CODE (otype) == POINTER_TYPE - && !null_pointer_constant_p (value)) - { - addr_space_t as_to = TYPE_ADDR_SPACE (TREE_TYPE (type)); - addr_space_t as_from = TYPE_ADDR_SPACE (TREE_TYPE (otype)); - addr_space_t as_common; - - if (!addr_space_superset (as_to, as_from, &as_common)) - { - if (ADDR_SPACE_GENERIC_P (as_from)) - warning_at (loc, 0, "cast to %s address space pointer " - "from disjoint generic address space pointer", - c_addr_space_name (as_to)); - - else if (ADDR_SPACE_GENERIC_P (as_to)) - warning_at (loc, 0, "cast to generic address space pointer " - "from disjoint %s address space pointer", - c_addr_space_name (as_from)); - - else - warning_at (loc, 0, "cast to %s address space pointer " - "from disjoint %s address space pointer", - c_addr_space_name (as_to), - c_addr_space_name (as_from)); - } - } + && TREE_CODE (otype) == POINTER_TYPE + && !null_pointer_constant_p (value)) + { + addr_space_t as_to = TYPE_ADDR_SPACE (TREE_TYPE (type)); + addr_space_t as_from = TYPE_ADDR_SPACE (TREE_TYPE (otype)); + addr_space_t as_common; + + if (!addr_space_superset (as_to, as_from, &as_common)) + { + if (ADDR_SPACE_GENERIC_P (as_from)) + warning_at (loc, 0, "cast to %s address space pointer " + "from disjoint generic address space pointer", + c_addr_space_name (as_to)); + + else if (ADDR_SPACE_GENERIC_P (as_to)) + warning_at (loc, 0, "cast to generic address space pointer " + "from disjoint %s address space pointer", + c_addr_space_name (as_from)); + + else + warning_at (loc, 0, "cast to %s address space pointer " + "from disjoint %s address space pointer", + c_addr_space_name (as_to), + c_addr_space_name (as_from)); + } + } /* Warn about possible alignment problems. */ if (STRICT_ALIGNMENT - && TREE_CODE (type) == POINTER_TYPE - && TREE_CODE (otype) == POINTER_TYPE - && TREE_CODE (TREE_TYPE (otype)) != VOID_TYPE - && TREE_CODE (TREE_TYPE (otype)) != FUNCTION_TYPE - /* Don't warn about opaque types, where the actual alignment - restriction is unknown. */ - && !((TREE_CODE (TREE_TYPE (otype)) == UNION_TYPE - || TREE_CODE (TREE_TYPE (otype)) == RECORD_TYPE) - && TYPE_MODE (TREE_TYPE (otype)) == VOIDmode) - && TYPE_ALIGN (TREE_TYPE (type)) > TYPE_ALIGN (TREE_TYPE (otype))) - warning_at (loc, OPT_Wcast_align, - "cast increases required alignment of target type"); + && TREE_CODE (type) == POINTER_TYPE + && TREE_CODE (otype) == POINTER_TYPE + && TREE_CODE (TREE_TYPE (otype)) != VOID_TYPE + && TREE_CODE (TREE_TYPE (otype)) != FUNCTION_TYPE + /* Don't warn about opaque types, where the actual alignment + restriction is unknown. */ + && !((TREE_CODE (TREE_TYPE (otype)) == UNION_TYPE + || TREE_CODE (TREE_TYPE (otype)) == RECORD_TYPE) + && TYPE_MODE (TREE_TYPE (otype)) == VOIDmode) + && TYPE_ALIGN (TREE_TYPE (type)) > TYPE_ALIGN (TREE_TYPE (otype))) + warning_at (loc, OPT_Wcast_align, + "cast increases required alignment of target type"); if (TREE_CODE (type) == INTEGER_TYPE - && TREE_CODE (otype) == POINTER_TYPE - && TYPE_PRECISION (type) != TYPE_PRECISION (otype)) + && TREE_CODE (otype) == POINTER_TYPE + && TYPE_PRECISION (type) != TYPE_PRECISION (otype)) /* Unlike conversion of integers to pointers, where the warning is disabled for converting constants because of cases such as SIG_*, warn about converting constant pointers to integers. In some cases it may cause unwanted sign extension, and a warning is appropriate. */ - warning_at (loc, OPT_Wpointer_to_int_cast, - "cast from pointer to integer of different size"); + warning_at (loc, OPT_Wpointer_to_int_cast, + "cast from pointer to integer of different size"); if (TREE_CODE (value) == CALL_EXPR - && TREE_CODE (type) != TREE_CODE (otype)) - warning_at (loc, OPT_Wbad_function_cast, - "cast from function call of type %qT " - "to non-matching type %qT", otype, type); + && TREE_CODE (type) != TREE_CODE (otype)) + warning_at (loc, OPT_Wbad_function_cast, + "cast from function call of type %qT " + "to non-matching type %qT", otype, type); if (TREE_CODE (type) == POINTER_TYPE - && TREE_CODE (otype) == INTEGER_TYPE - && TYPE_PRECISION (type) != TYPE_PRECISION (otype) - /* Don't warn about converting any constant. */ - && !TREE_CONSTANT (value)) - warning_at (loc, - OPT_Wint_to_pointer_cast, "cast to pointer from integer " - "of different size"); + && TREE_CODE (otype) == INTEGER_TYPE + && TYPE_PRECISION (type) != TYPE_PRECISION (otype) + /* Don't warn about converting any constant. */ + && !TREE_CONSTANT (value)) + warning_at (loc, + OPT_Wint_to_pointer_cast, "cast to pointer from integer " + "of different size"); if (warn_strict_aliasing <= 2) strict_aliasing_warning (otype, type, expr); /* If pedantic, warn for conversions between function and object - pointer types, except for converting a null pointer constant - to function pointer type. */ + pointer types, except for converting a null pointer constant + to function pointer type. */ if (pedantic - && TREE_CODE (type) == POINTER_TYPE - && TREE_CODE (otype) == POINTER_TYPE - && TREE_CODE (TREE_TYPE (otype)) == FUNCTION_TYPE - && TREE_CODE (TREE_TYPE (type)) != FUNCTION_TYPE) - pedwarn (loc, OPT_pedantic, "ISO C forbids " - "conversion of function pointer to object pointer type"); + && TREE_CODE (type) == POINTER_TYPE + && TREE_CODE (otype) == POINTER_TYPE + && TREE_CODE (TREE_TYPE (otype)) == FUNCTION_TYPE + && TREE_CODE (TREE_TYPE (type)) != FUNCTION_TYPE) + pedwarn (loc, OPT_pedantic, "ISO C forbids " + "conversion of function pointer to object pointer type"); if (pedantic - && TREE_CODE (type) == POINTER_TYPE - && TREE_CODE (otype) == POINTER_TYPE - && TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE - && TREE_CODE (TREE_TYPE (otype)) != FUNCTION_TYPE - && !null_pointer_constant_p (value)) - pedwarn (loc, OPT_pedantic, "ISO C forbids " - "conversion of object pointer to function pointer type"); + && TREE_CODE (type) == POINTER_TYPE + && TREE_CODE (otype) == POINTER_TYPE + && TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE + && TREE_CODE (TREE_TYPE (otype)) != FUNCTION_TYPE + && !null_pointer_constant_p (value)) + pedwarn (loc, OPT_pedantic, "ISO C forbids " + "conversion of object pointer to function pointer type"); ovalue = value; value = convert (type, value); /* Ignore any integer overflow caused by the cast. */ if (TREE_CODE (value) == INTEGER_CST && !FLOAT_TYPE_P (otype)) - { - if (CONSTANT_CLASS_P (ovalue) && TREE_OVERFLOW (ovalue)) - { - if (!TREE_OVERFLOW (value)) - { - /* Avoid clobbering a shared constant. */ - value = copy_node (value); - TREE_OVERFLOW (value) = TREE_OVERFLOW (ovalue); - } - } - else if (TREE_OVERFLOW (value)) - /* Reset VALUE's overflow flags, ensuring constant sharing. */ - value = build_int_cst_wide (TREE_TYPE (value), - TREE_INT_CST_LOW (value), - TREE_INT_CST_HIGH (value)); - } + { + if (CONSTANT_CLASS_P (ovalue) && TREE_OVERFLOW (ovalue)) + { + if (!TREE_OVERFLOW (value)) + { + /* Avoid clobbering a shared constant. */ + value = copy_node (value); + TREE_OVERFLOW (value) = TREE_OVERFLOW (ovalue); + } + } + else if (TREE_OVERFLOW (value)) + /* Reset VALUE's overflow flags, ensuring constant sharing. */ + value = build_int_cst_wide (TREE_TYPE (value), + TREE_INT_CST_LOW (value), + TREE_INT_CST_HIGH (value)); + } } /* Don't let a cast be an lvalue. */ @@ -4749,10 +4721,10 @@ if (TREE_CODE (value) == REAL_CST || TREE_CODE (value) == COMPLEX_CST || (TREE_CODE (value) == INTEGER_CST - && !((TREE_CODE (expr) == INTEGER_CST - && INTEGRAL_TYPE_P (TREE_TYPE (expr))) - || TREE_CODE (expr) == REAL_CST - || TREE_CODE (expr) == COMPLEX_CST))) + && !((TREE_CODE (expr) == INTEGER_CST + && INTEGRAL_TYPE_P (TREE_TYPE (expr))) + || TREE_CODE (expr) == REAL_CST + || TREE_CODE (expr) == COMPLEX_CST))) value = build1 (NOP_EXPR, type, value); if (CAN_HAVE_LOCATION_P (value)) @@ -4794,7 +4766,7 @@ allows references to incomplete types. */ if (warn_cxx_compat && type_name->specs->typespec_kind == ctsk_tagdef) warning_at (loc, OPT_Wc___compat, - "defining a type in a cast is invalid in C++"); + "defining a type in a cast is invalid in C++"); return ret; } @@ -4813,8 +4785,8 @@ tree build_modify_expr (location_t location, tree lhs, tree lhs_origtype, - enum tree_code modifycode, - location_t rhs_loc, tree rhs, tree rhs_origtype) + enum tree_code modifycode, + location_t rhs_loc, tree rhs, tree rhs_origtype) { tree result; tree newrhs; @@ -4845,12 +4817,12 @@ if (TREE_CODE (lhs) == C_MAYBE_CONST_EXPR) { tree inner = build_modify_expr (location, C_MAYBE_CONST_EXPR_EXPR (lhs), - lhs_origtype, modifycode, rhs_loc, rhs, - rhs_origtype); + lhs_origtype, modifycode, rhs_loc, rhs, + rhs_origtype); if (inner == error_mark_node) - return error_mark_node; + return error_mark_node; result = build2 (C_MAYBE_CONST_EXPR, TREE_TYPE (inner), - C_MAYBE_CONST_EXPR_PRE (lhs), inner); + C_MAYBE_CONST_EXPR_PRE (lhs), inner); gcc_assert (!C_MAYBE_CONST_EXPR_INT_OPERANDS (lhs)); C_MAYBE_CONST_EXPR_NON_CONST (result) = 1; protected_set_expr_location (result, location); @@ -4865,10 +4837,10 @@ lhs = c_fully_fold (lhs, false, NULL); lhs = stabilize_reference (lhs); newrhs = build_binary_op (location, - modifycode, lhs, rhs, 1); + modifycode, lhs, rhs, 1); /* The original type of the right hand side is no longer - meaningful. */ + meaningful. */ rhs_origtype = NULL_TREE; } @@ -4889,8 +4861,8 @@ if (TYPE_READONLY (lhstype) || ((TREE_CODE (lhstype) == RECORD_TYPE - || TREE_CODE (lhstype) == UNION_TYPE) - && C_TYPE_FIELDS_READONLY (lhstype))) + || TREE_CODE (lhstype) == UNION_TYPE) + && C_TYPE_FIELDS_READONLY (lhstype))) { readonly_error (lhs, lv_assign); return error_mark_node; @@ -4905,9 +4877,9 @@ if (TREE_CODE (lhs) == COMPONENT_REF && (TREE_CODE (lhstype) == INTEGER_TYPE - || TREE_CODE (lhstype) == BOOLEAN_TYPE - || TREE_CODE (lhstype) == REAL_TYPE - || TREE_CODE (lhstype) == ENUMERAL_TYPE)) + || TREE_CODE (lhstype) == BOOLEAN_TYPE + || TREE_CODE (lhstype) == REAL_TYPE + || TREE_CODE (lhstype) == ENUMERAL_TYPE)) lhstype = TREE_TYPE (get_unwidened (lhs, 0)); /* If storing in a field that is in actuality a short or narrower than one, @@ -4928,12 +4900,12 @@ && TREE_CODE (lhs_origtype) == ENUMERAL_TYPE) { tree checktype = (rhs_origtype != NULL_TREE - ? rhs_origtype - : TREE_TYPE (rhs)); + ? rhs_origtype + : TREE_TYPE (rhs)); if (checktype != error_mark_node - && TYPE_MAIN_VARIANT (checktype) != TYPE_MAIN_VARIANT (lhs_origtype)) - warning_at (location, OPT_Wc___compat, - "enum conversion in assignment is invalid in C++"); + && TYPE_MAIN_VARIANT (checktype) != TYPE_MAIN_VARIANT (lhs_origtype)) + warning_at (location, OPT_Wc___compat, + "enum conversion in assignment is invalid in C++"); } /* Convert new value to destination type. Fold it first, then @@ -4945,7 +4917,7 @@ if (rhs_semantic_type) newrhs = build1 (EXCESS_PRECISION_EXPR, rhs_semantic_type, newrhs); newrhs = convert_for_assignment (location, lhstype, newrhs, rhs_origtype, - ic_assign, npc, NULL_TREE, NULL_TREE, 0); + ic_assign, npc, NULL_TREE, NULL_TREE, 0); if (TREE_CODE (newrhs) == ERROR_MARK) return error_mark_node; @@ -4954,10 +4926,10 @@ { result = objc_generate_write_barrier (lhs, modifycode, newrhs); if (result) - { - protected_set_expr_location (result, location); - return result; - } + { + protected_set_expr_location (result, location); + return result; + } } /* Scan operands. */ @@ -4975,7 +4947,7 @@ return result; result = convert_for_assignment (location, olhstype, result, rhs_origtype, - ic_assign, false, NULL_TREE, NULL_TREE, 0); + ic_assign, false, NULL_TREE, NULL_TREE, 0); protected_set_expr_location (result, location); return result; } @@ -5097,9 +5069,9 @@ static tree convert_for_assignment (location_t location, tree type, tree rhs, - tree origtype, enum impl_conv errtype, - bool null_pointer_constant, tree fundecl, - tree function, int parmnum) + tree origtype, enum impl_conv errtype, + bool null_pointer_constant, tree fundecl, + tree function, int parmnum) { enum tree_code codel = TREE_CODE (type); tree orig_rhs = rhs; @@ -5112,32 +5084,32 @@ { tree selector; /* Change pointer to function to the function itself for - diagnostics. */ + diagnostics. */ if (TREE_CODE (function) == ADDR_EXPR - && TREE_CODE (TREE_OPERAND (function, 0)) == FUNCTION_DECL) - function = TREE_OPERAND (function, 0); + && TREE_CODE (TREE_OPERAND (function, 0)) == FUNCTION_DECL) + function = TREE_OPERAND (function, 0); /* Handle an ObjC selector specially for diagnostics. */ selector = objc_message_selector (); rname = function; if (selector && parmnum > 2) - { - rname = selector; - parmnum -= 2; - } + { + rname = selector; + parmnum -= 2; + } } /* This macro is used to emit diagnostics to ensure that all format strings are complete sentences, visible to gettext and checked at compile time. */ -#define WARN_FOR_ASSIGNMENT(LOCATION, OPT, AR, AS, IN, RE) \ +#define WARN_FOR_ASSIGNMENT(LOCATION, OPT, AR, AS, IN, RE) \ do { \ switch (errtype) \ { \ case ic_argpass: \ if (pedwarn (LOCATION, OPT, AR, parmnum, rname)) \ - inform ((fundecl && !DECL_IS_BUILTIN (fundecl)) \ - ? DECL_SOURCE_LOCATION (fundecl) : LOCATION, \ + inform ((fundecl && !DECL_IS_BUILTIN (fundecl)) \ + ? DECL_SOURCE_LOCATION (fundecl) : LOCATION, \ "expected %qT but argument is of type %qT", \ type, rhstype); \ break; \ @@ -5148,7 +5120,7 @@ pedwarn_init (LOCATION, OPT, IN); \ break; \ case ic_return: \ - pedwarn (LOCATION, OPT, RE); \ + pedwarn (LOCATION, OPT, RE); \ break; \ default: \ gcc_unreachable (); \ @@ -5199,23 +5171,23 @@ int parmno; switch (errtype) - { - case ic_return: - parmno = 0; - break; - - case ic_assign: - parmno = -1; - break; - - case ic_init: - parmno = -2; - break; - - default: - parmno = parmnum; - break; - } + { + case ic_return: + parmno = 0; + break; + + case ic_assign: + parmno = -1; + break; + + case ic_init: + parmno = -2; + break; + + default: + parmno = parmnum; + break; + } objc_ok = objc_compare_types (type, rhstype, parmno, rname); } @@ -5224,19 +5196,19 @@ { tree checktype = origtype != NULL_TREE ? origtype : rhstype; if (checktype != error_mark_node - && TREE_CODE (type) == ENUMERAL_TYPE - && TYPE_MAIN_VARIANT (checktype) != TYPE_MAIN_VARIANT (type)) - { - WARN_FOR_ASSIGNMENT (input_location, OPT_Wc___compat, - G_("enum conversion when passing argument " - "%d of %qE is invalid in C++"), - G_("enum conversion in assignment is " - "invalid in C++"), - G_("enum conversion in initialization is " - "invalid in C++"), - G_("enum conversion in return is " - "invalid in C++")); - } + && TREE_CODE (type) == ENUMERAL_TYPE + && TYPE_MAIN_VARIANT (checktype) != TYPE_MAIN_VARIANT (type)) + { + WARN_FOR_ASSIGNMENT (input_location, OPT_Wc___compat, + G_("enum conversion when passing argument " + "%d of %qE is invalid in C++"), + G_("enum conversion in assignment is " + "invalid in C++"), + G_("enum conversion in initialization is " + "invalid in C++"), + G_("enum conversion in return is " + "invalid in C++")); + } } if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (rhstype)) @@ -5245,10 +5217,10 @@ if (coder == VOID_TYPE) { /* Except for passing an argument to an unprototyped function, - this is a constraint violation. When passing an argument to - an unprototyped function, it is compile-time undefined; - making it a constraint in that case was rejected in - DR#252. */ + this is a constraint violation. When passing an argument to + an unprototyped function, it is compile-time undefined; + making it a constraint in that case was rejected in + DR#252. */ error_at (location, "void value not ignored as it ought to be"); return error_mark_node; } @@ -5262,25 +5234,25 @@ && comptypes (TREE_TYPE (type), TREE_TYPE (rhs)) == 1) { if (!lvalue_p (rhs)) - { - error_at (location, "cannot pass rvalue to reference parameter"); - return error_mark_node; - } + { + error_at (location, "cannot pass rvalue to reference parameter"); + return error_mark_node; + } if (!c_mark_addressable (rhs)) - return error_mark_node; + return error_mark_node; rhs = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (rhs)), rhs); SET_EXPR_LOCATION (rhs, location); /* We already know that these two types are compatible, but they - may not be exactly identical. In fact, `TREE_TYPE (type)' is - likely to be __builtin_va_list and `TREE_TYPE (rhs)' is - likely to be va_list, a typedef to __builtin_va_list, which - is different enough that it will cause problems later. */ + may not be exactly identical. In fact, `TREE_TYPE (type)' is + likely to be __builtin_va_list and `TREE_TYPE (rhs)' is + likely to be va_list, a typedef to __builtin_va_list, which + is different enough that it will cause problems later. */ if (TREE_TYPE (TREE_TYPE (rhs)) != TREE_TYPE (type)) - { - rhs = build1 (NOP_EXPR, build_pointer_type (TREE_TYPE (type)), rhs); - SET_EXPR_LOCATION (rhs, location); - } + { + rhs = build1 (NOP_EXPR, build_pointer_type (TREE_TYPE (type)), rhs); + SET_EXPR_LOCATION (rhs, location); + } rhs = build1 (NOP_EXPR, type, rhs); SET_EXPR_LOCATION (rhs, location); @@ -5288,17 +5260,17 @@ } /* Some types can interconvert without explicit casts. */ else if (codel == VECTOR_TYPE && coder == VECTOR_TYPE - && vector_types_convertible_p (type, TREE_TYPE (rhs), true)) + && vector_types_convertible_p (type, TREE_TYPE (rhs), true)) return convert (type, rhs); /* Arithmetic types all interconvert, and enum is treated like int. */ else if ((codel == INTEGER_TYPE || codel == REAL_TYPE - || codel == FIXED_POINT_TYPE - || codel == ENUMERAL_TYPE || codel == COMPLEX_TYPE - || codel == BOOLEAN_TYPE) - && (coder == INTEGER_TYPE || coder == REAL_TYPE - || coder == FIXED_POINT_TYPE - || coder == ENUMERAL_TYPE || coder == COMPLEX_TYPE - || coder == BOOLEAN_TYPE)) + || codel == FIXED_POINT_TYPE + || codel == ENUMERAL_TYPE || codel == COMPLEX_TYPE + || codel == BOOLEAN_TYPE) + && (coder == INTEGER_TYPE || coder == REAL_TYPE + || coder == FIXED_POINT_TYPE + || coder == ENUMERAL_TYPE || coder == COMPLEX_TYPE + || coder == BOOLEAN_TYPE)) { tree ret; bool save = in_late_binary_op; @@ -5418,6 +5390,7 @@ G_("return discards %qv qualifier from " "pointer target type"), TYPE_QUALS (ttr) & ~TYPE_QUALS (ttl)); + memb = marginal_memb; } @@ -5432,7 +5405,7 @@ /* Conversions among pointers */ else if ((codel == POINTER_TYPE || codel == REFERENCE_TYPE) - && (coder == codel)) + && (coder == codel)) { tree ttl = TREE_TYPE (type); tree ttr = TREE_TYPE (rhstype); @@ -5444,9 +5417,9 @@ addr_space_t asr; if (TREE_CODE (mvl) != ARRAY_TYPE) - mvl = TYPE_MAIN_VARIANT (mvl); + mvl = TYPE_MAIN_VARIANT (mvl); if (TREE_CODE (mvr) != ARRAY_TYPE) - mvr = TYPE_MAIN_VARIANT (mvr); + mvr = TYPE_MAIN_VARIANT (mvr); /* Opaque pointers are treated like void pointers. */ is_opaque_pointer = vector_targets_convertible_p (ttl, ttr); @@ -5470,83 +5443,83 @@ } /* C++ does not allow the implicit conversion void* -> T*. However, - for the purpose of reducing the number of false positives, we - tolerate the special case of - - int *p = NULL; - - where NULL is typically defined in C to be '(void *) 0'. */ + for the purpose of reducing the number of false positives, we + tolerate the special case of + + int *p = NULL; + + where NULL is typically defined in C to be '(void *) 0'. */ if (VOID_TYPE_P (ttr) && rhs != null_pointer_node && !VOID_TYPE_P (ttl)) - warning_at (location, OPT_Wc___compat, - "request for implicit conversion " - "from %qT to %qT not permitted in C++", rhstype, type); + warning_at (location, OPT_Wc___compat, + "request for implicit conversion " + "from %qT to %qT not permitted in C++", rhstype, type); /* See if the pointers point to incompatible address spaces. */ asl = TYPE_ADDR_SPACE (ttl); asr = TYPE_ADDR_SPACE (ttr); if (!null_pointer_constant_p (rhs) - && asr != asl && !targetm.addr_space.subset_p (asr, asl)) - { - switch (errtype) - { - case ic_argpass: - error_at (location, "passing argument %d of %qE from pointer to " - "non-enclosed address space", parmnum, rname); - break; - case ic_assign: - error_at (location, "assignment from pointer to " - "non-enclosed address space"); - break; - case ic_init: - error_at (location, "initialization from pointer to " - "non-enclosed address space"); - break; - case ic_return: - error_at (location, "return from pointer to " - "non-enclosed address space"); - break; - default: - gcc_unreachable (); - } - return error_mark_node; - } + && asr != asl && !targetm.addr_space.subset_p (asr, asl)) + { + switch (errtype) + { + case ic_argpass: + error_at (location, "passing argument %d of %qE from pointer to " + "non-enclosed address space", parmnum, rname); + break; + case ic_assign: + error_at (location, "assignment from pointer to " + "non-enclosed address space"); + break; + case ic_init: + error_at (location, "initialization from pointer to " + "non-enclosed address space"); + break; + case ic_return: + error_at (location, "return from pointer to " + "non-enclosed address space"); + break; + default: + gcc_unreachable (); + } + return error_mark_node; + } /* Check if the right-hand side has a format attribute but the - left-hand side doesn't. */ + left-hand side doesn't. */ if (warn_missing_format_attribute - && check_missing_format_attribute (type, rhstype)) - { - switch (errtype) - { - case ic_argpass: - warning_at (location, OPT_Wmissing_format_attribute, - "argument %d of %qE might be " - "a candidate for a format attribute", - parmnum, rname); - break; - case ic_assign: - warning_at (location, OPT_Wmissing_format_attribute, - "assignment left-hand side might be " - "a candidate for a format attribute"); - break; - case ic_init: - warning_at (location, OPT_Wmissing_format_attribute, - "initialization left-hand side might be " - "a candidate for a format attribute"); - break; - case ic_return: - warning_at (location, OPT_Wmissing_format_attribute, - "return type might be " - "a candidate for a format attribute"); - break; - default: - gcc_unreachable (); - } - } + && check_missing_format_attribute (type, rhstype)) + { + switch (errtype) + { + case ic_argpass: + warning_at (location, OPT_Wmissing_format_attribute, + "argument %d of %qE might be " + "a candidate for a format attribute", + parmnum, rname); + break; + case ic_assign: + warning_at (location, OPT_Wmissing_format_attribute, + "assignment left-hand side might be " + "a candidate for a format attribute"); + break; + case ic_init: + warning_at (location, OPT_Wmissing_format_attribute, + "initialization left-hand side might be " + "a candidate for a format attribute"); + break; + case ic_return: + warning_at (location, OPT_Wmissing_format_attribute, + "return type might be " + "a candidate for a format attribute"); + break; + default: + gcc_unreachable (); + } + } /* Any non-function converts to a [const][volatile] void * - and vice versa; otherwise, targets must be the same. - Meanwhile, the lhs target must have all the qualifiers of the rhs. */ + and vice versa; otherwise, targets must be the same. + Meanwhile, the lhs target must have all the qualifiers of the rhs. */ if (VOID_TYPE_P (ttl) || VOID_TYPE_P (ttr) || (target_cmp = comp_target_types (location, type, rhstype)) || is_opaque_pointer @@ -5628,54 +5601,54 @@ } } else - /* Avoid warning about the volatile ObjC EH puts on decls. */ - if (!objc_ok) - WARN_FOR_ASSIGNMENT (location, 0, - G_("passing argument %d of %qE from " - "incompatible pointer type"), - G_("assignment from incompatible pointer type"), - G_("initialization from incompatible " - "pointer type"), - G_("return from incompatible pointer type")); + /* Avoid warning about the volatile ObjC EH puts on decls. */ + if (!objc_ok) + WARN_FOR_ASSIGNMENT (location, 0, + G_("passing argument %d of %qE from " + "incompatible pointer type"), + G_("assignment from incompatible pointer type"), + G_("initialization from incompatible " + "pointer type"), + G_("return from incompatible pointer type")); return convert (type, rhs); } else if (codel == POINTER_TYPE && coder == ARRAY_TYPE) { /* ??? This should not be an error when inlining calls to - unprototyped functions. */ + unprototyped functions. */ error_at (location, "invalid use of non-lvalue array"); return error_mark_node; } else if (codel == POINTER_TYPE && coder == INTEGER_TYPE) { /* An explicit constant 0 can convert to a pointer, - or one that results from arithmetic, even including - a cast to integer type. */ + or one that results from arithmetic, even including + a cast to integer type. */ if (!null_pointer_constant) - WARN_FOR_ASSIGNMENT (location, 0, - G_("passing argument %d of %qE makes " - "pointer from integer without a cast"), - G_("assignment makes pointer from integer " - "without a cast"), - G_("initialization makes pointer from " - "integer without a cast"), - G_("return makes pointer from integer " - "without a cast")); + WARN_FOR_ASSIGNMENT (location, 0, + G_("passing argument %d of %qE makes " + "pointer from integer without a cast"), + G_("assignment makes pointer from integer " + "without a cast"), + G_("initialization makes pointer from " + "integer without a cast"), + G_("return makes pointer from integer " + "without a cast")); return convert (type, rhs); } else if (codel == INTEGER_TYPE && coder == POINTER_TYPE) { WARN_FOR_ASSIGNMENT (location, 0, - G_("passing argument %d of %qE makes integer " - "from pointer without a cast"), - G_("assignment makes integer from pointer " - "without a cast"), - G_("initialization makes integer from pointer " - "without a cast"), - G_("return makes integer from pointer " - "without a cast")); + G_("passing argument %d of %qE makes integer " + "from pointer without a cast"), + G_("assignment makes integer from pointer " + "without a cast"), + G_("initialization makes integer from pointer " + "without a cast"), + G_("return makes integer from pointer " + "without a cast")); return convert (type, rhs); } else if (codel == BOOLEAN_TYPE && coder == POINTER_TYPE) @@ -5693,22 +5666,22 @@ case ic_argpass: error_at (location, "incompatible type for argument %d of %qE", parmnum, rname); inform ((fundecl && !DECL_IS_BUILTIN (fundecl)) - ? DECL_SOURCE_LOCATION (fundecl) : input_location, - "expected %qT but argument is of type %qT", type, rhstype); + ? DECL_SOURCE_LOCATION (fundecl) : input_location, + "expected %qT but argument is of type %qT", type, rhstype); break; case ic_assign: error_at (location, "incompatible types when assigning to type %qT from " - "type %qT", type, rhstype); + "type %qT", type, rhstype); break; case ic_init: error_at (location, - "incompatible types when initializing type %qT using type %qT", - type, rhstype); + "incompatible types when initializing type %qT using type %qT", + type, rhstype); break; case ic_return: error_at (location, - "incompatible types when returning type %qT but %qT was " - "expected", rhstype, type); + "incompatible types when returning type %qT but %qT was " + "expected", rhstype, type); break; default: gcc_unreachable (); @@ -5729,10 +5702,10 @@ if (TREE_CODE (value) == COMPOUND_EXPR) { if (valid_compound_expr_initializer (TREE_OPERAND (value, 0), endtype) - == error_mark_node) - return error_mark_node; + == error_mark_node) + return error_mark_node; return valid_compound_expr_initializer (TREE_OPERAND (value, 1), - endtype); + endtype); } else if (!initializer_constant_valid_p (value, endtype)) return error_mark_node; @@ -5765,14 +5738,14 @@ if (init) npc = null_pointer_constant_p (init); value = digest_init (init_loc, type, init, origtype, npc, - true, TREE_STATIC (decl)); + true, TREE_STATIC (decl)); /* Store the expression if valid; else report error. */ if (!in_system_header && AGGREGATE_TYPE_P (TREE_TYPE (decl)) && !TREE_STATIC (decl)) warning (OPT_Wtraditional, "traditional C rejects automatic " - "aggregate initialization"); + "aggregate initialization"); DECL_INITIAL (decl) = value; @@ -5792,21 +5765,21 @@ inside_init = fold (inside_init); if (TREE_CODE (inside_init) == COMPOUND_LITERAL_EXPR) - { - tree cldecl = COMPOUND_LITERAL_EXPR_DECL (inside_init); - - if (TYPE_DOMAIN (TREE_TYPE (cldecl))) - { - /* For int foo[] = (int [3]){1}; we need to set array size - now since later on array initializer will be just the - brace enclosed list of the compound literal. */ - type = build_distinct_type_copy (TYPE_MAIN_VARIANT (type)); - TREE_TYPE (decl) = type; - TYPE_DOMAIN (type) = TYPE_DOMAIN (TREE_TYPE (cldecl)); - layout_type (type); - layout_decl (cldecl, 0); - } - } + { + tree cldecl = COMPOUND_LITERAL_EXPR_DECL (inside_init); + + if (TYPE_DOMAIN (TREE_TYPE (cldecl))) + { + /* For int foo[] = (int [3]){1}; we need to set array size + now since later on array initializer will be just the + brace enclosed list of the compound literal. */ + type = build_distinct_type_copy (TYPE_MAIN_VARIANT (type)); + TREE_TYPE (decl) = type; + TYPE_DOMAIN (type) = TYPE_DOMAIN (TREE_TYPE (cldecl)); + layout_type (type); + layout_decl (cldecl, 0); + } + } } } @@ -5829,9 +5802,9 @@ #define SPELLING_MEMBER 2 #define SPELLING_BOUNDS 3 -static struct spelling *spelling; /* Next stack element (unused). */ -static struct spelling *spelling_base; /* Spelling stack base. */ -static int spelling_size; /* Size of the spelling stack. */ +static struct spelling *spelling; /* Next stack element (unused). */ +static struct spelling *spelling_base; /* Spelling stack base. */ +static int spelling_size; /* Size of the spelling stack. */ /* Macros to save and restore the spelling stack around push_... functions. Alternative to SAVE_SPELLING_STACK. */ @@ -5842,21 +5815,21 @@ /* Push an element on the spelling stack with type KIND and assign VALUE to MEMBER. */ -#define PUSH_SPELLING(KIND, VALUE, MEMBER) \ -{ \ - int depth = SPELLING_DEPTH (); \ - \ - if (depth >= spelling_size) \ - { \ - spelling_size += 10; \ - spelling_base = XRESIZEVEC (struct spelling, spelling_base, \ - spelling_size); \ - RESTORE_SPELLING_DEPTH (depth); \ - } \ - \ - spelling->kind = (KIND); \ - spelling->MEMBER = (VALUE); \ - spelling++; \ +#define PUSH_SPELLING(KIND, VALUE, MEMBER) \ +{ \ + int depth = SPELLING_DEPTH (); \ + \ + if (depth >= spelling_size) \ + { \ + spelling_size += 10; \ + spelling_base = XRESIZEVEC (struct spelling, spelling_base, \ + spelling_size); \ + RESTORE_SPELLING_DEPTH (depth); \ + } \ + \ + spelling->kind = (KIND); \ + spelling->MEMBER = (VALUE); \ + spelling++; \ } /* Push STRING on the stack. Printed literally. */ @@ -5898,9 +5871,9 @@ for (p = spelling_base; p < spelling; p++) { if (p->kind == SPELLING_BOUNDS) - size += 25; + size += 25; else - size += strlen (p->u.s) + 1; + size += strlen (p->u.s) + 1; } return size; @@ -5917,16 +5890,16 @@ for (p = spelling_base; p < spelling; p++) if (p->kind == SPELLING_BOUNDS) { - sprintf (d, "[" HOST_WIDE_INT_PRINT_UNSIGNED "]", p->u.i); - d += strlen (d); + sprintf (d, "[" HOST_WIDE_INT_PRINT_UNSIGNED "]", p->u.i); + d += strlen (d); } else { - const char *s; - if (p->kind == SPELLING_MEMBER) - *d++ = '.'; - for (s = p->u.s; (*d = *s++); d++) - ; + const char *s; + if (p->kind == SPELLING_MEMBER) + *d++ = '.'; + for (s = p->u.s; (*d = *s++); d++) + ; } *d++ = '\0'; return buffer; @@ -5995,7 +5968,7 @@ && TREE_CODE (expr.value) == STRING_CST && expr.original_code != STRING_CST) pedwarn_init (input_location, OPT_pedantic, - "array initialized from parenthesized string constant"); + "array initialized from parenthesized string constant"); } /* Digest the parser output INIT as an initializer for type TYPE. @@ -6016,8 +5989,8 @@ static tree digest_init (location_t init_loc, tree type, tree init, tree origtype, - bool null_pointer_constant, bool strict_string, - int require_constant) + bool null_pointer_constant, bool strict_string, + int require_constant) { enum tree_code code = TREE_CODE (type); tree inside_init = init; @@ -6048,88 +6021,88 @@ { tree typ1 = TYPE_MAIN_VARIANT (TREE_TYPE (type)); /* Note that an array could be both an array of character type - and an array of wchar_t if wchar_t is signed char or unsigned - char. */ + and an array of wchar_t if wchar_t is signed char or unsigned + char. */ bool char_array = (typ1 == char_type_node - || typ1 == signed_char_type_node - || typ1 == unsigned_char_type_node); + || typ1 == signed_char_type_node + || typ1 == unsigned_char_type_node); bool wchar_array = !!comptypes (typ1, wchar_type_node); bool char16_array = !!comptypes (typ1, char16_type_node); bool char32_array = !!comptypes (typ1, char32_type_node); if (char_array || wchar_array || char16_array || char32_array) - { - struct c_expr expr; - tree typ2 = TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (inside_init))); - expr.value = inside_init; - expr.original_code = (strict_string ? STRING_CST : ERROR_MARK); - expr.original_type = NULL; - maybe_warn_string_init (type, expr); - - if (TYPE_DOMAIN (type) && !TYPE_MAX_VALUE (TYPE_DOMAIN (type))) - pedwarn_init (init_loc, OPT_pedantic, - "initialization of a flexible array member"); - - if (comptypes (TYPE_MAIN_VARIANT (TREE_TYPE (inside_init)), - TYPE_MAIN_VARIANT (type))) - return inside_init; - - if (char_array) - { - if (typ2 != char_type_node) - { - error_init ("char-array initialized from wide string"); - return error_mark_node; - } - } - else - { - if (typ2 == char_type_node) - { - error_init ("wide character array initialized from non-wide " - "string"); - return error_mark_node; - } - else if (!comptypes(typ1, typ2)) - { - error_init ("wide character array initialized from " - "incompatible wide string"); - return error_mark_node; - } - } - - TREE_TYPE (inside_init) = type; - if (TYPE_DOMAIN (type) != 0 - && TYPE_SIZE (type) != 0 - && TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST) - { - unsigned HOST_WIDE_INT len = TREE_STRING_LENGTH (inside_init); - - /* Subtract the size of a single (possibly wide) character - because it's ok to ignore the terminating null char - that is counted in the length of the constant. */ - if (0 > compare_tree_int (TYPE_SIZE_UNIT (type), - (len - - (TYPE_PRECISION (typ1) - / BITS_PER_UNIT)))) - pedwarn_init (init_loc, 0, - ("initializer-string for array of chars " - "is too long")); - else if (warn_cxx_compat - && 0 > compare_tree_int (TYPE_SIZE_UNIT (type), len)) - warning_at (init_loc, OPT_Wc___compat, - ("initializer-string for array chars " - "is too long for C++")); - } - - return inside_init; - } + { + struct c_expr expr; + tree typ2 = TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (inside_init))); + expr.value = inside_init; + expr.original_code = (strict_string ? STRING_CST : ERROR_MARK); + expr.original_type = NULL; + maybe_warn_string_init (type, expr); + + if (TYPE_DOMAIN (type) && !TYPE_MAX_VALUE (TYPE_DOMAIN (type))) + pedwarn_init (init_loc, OPT_pedantic, + "initialization of a flexible array member"); + + if (comptypes (TYPE_MAIN_VARIANT (TREE_TYPE (inside_init)), + TYPE_MAIN_VARIANT (type))) + return inside_init; + + if (char_array) + { + if (typ2 != char_type_node) + { + error_init ("char-array initialized from wide string"); + return error_mark_node; + } + } + else + { + if (typ2 == char_type_node) + { + error_init ("wide character array initialized from non-wide " + "string"); + return error_mark_node; + } + else if (!comptypes(typ1, typ2)) + { + error_init ("wide character array initialized from " + "incompatible wide string"); + return error_mark_node; + } + } + + TREE_TYPE (inside_init) = type; + if (TYPE_DOMAIN (type) != 0 + && TYPE_SIZE (type) != 0 + && TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST) + { + unsigned HOST_WIDE_INT len = TREE_STRING_LENGTH (inside_init); + + /* Subtract the size of a single (possibly wide) character + because it's ok to ignore the terminating null char + that is counted in the length of the constant. */ + if (0 > compare_tree_int (TYPE_SIZE_UNIT (type), + (len + - (TYPE_PRECISION (typ1) + / BITS_PER_UNIT)))) + pedwarn_init (init_loc, 0, + ("initializer-string for array of chars " + "is too long")); + else if (warn_cxx_compat + && 0 > compare_tree_int (TYPE_SIZE_UNIT (type), len)) + warning_at (init_loc, OPT_Wc___compat, + ("initializer-string for array chars " + "is too long for C++")); + } + + return inside_init; + } else if (INTEGRAL_TYPE_P (typ1)) - { - error_init ("array of inappropriate type initialized " - "from string constant"); - return error_mark_node; - } + { + error_init ("array of inappropriate type initialized " + "from string constant"); + return error_mark_node; + } } /* Build a VECTOR_CST from a *constant* vector constructor. If the @@ -6141,29 +6114,29 @@ && TREE_CONSTANT (inside_init)) { if (TREE_CODE (inside_init) == VECTOR_CST - && comptypes (TYPE_MAIN_VARIANT (TREE_TYPE (inside_init)), - TYPE_MAIN_VARIANT (type))) - return inside_init; + && comptypes (TYPE_MAIN_VARIANT (TREE_TYPE (inside_init)), + TYPE_MAIN_VARIANT (type))) + return inside_init; if (TREE_CODE (inside_init) == CONSTRUCTOR) - { - unsigned HOST_WIDE_INT ix; - tree value; - bool constant_p = true; - - /* Iterate through elements and check if all constructor - elements are *_CSTs. */ - FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (inside_init), ix, value) - if (!CONSTANT_CLASS_P (value)) - { - constant_p = false; - break; - } - - if (constant_p) - return build_vector_from_ctor (type, - CONSTRUCTOR_ELTS (inside_init)); - } + { + unsigned HOST_WIDE_INT ix; + tree value; + bool constant_p = true; + + /* Iterate through elements and check if all constructor + elements are *_CSTs. */ + FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (inside_init), ix, value) + if (!CONSTANT_CLASS_P (value)) + { + constant_p = false; + break; + } + + if (constant_p) + return build_vector_from_ctor (type, + CONSTRUCTOR_ELTS (inside_init)); + } } if (warn_sequence_point) @@ -6174,90 +6147,90 @@ if (inside_init && TREE_TYPE (inside_init) != 0 && (comptypes (TYPE_MAIN_VARIANT (TREE_TYPE (inside_init)), - TYPE_MAIN_VARIANT (type)) - || (code == ARRAY_TYPE - && comptypes (TREE_TYPE (inside_init), type)) - || (code == VECTOR_TYPE - && comptypes (TREE_TYPE (inside_init), type)) - || (code == POINTER_TYPE - && TREE_CODE (TREE_TYPE (inside_init)) == ARRAY_TYPE - && comptypes (TREE_TYPE (TREE_TYPE (inside_init)), - TREE_TYPE (type))))) + TYPE_MAIN_VARIANT (type)) + || (code == ARRAY_TYPE + && comptypes (TREE_TYPE (inside_init), type)) + || (code == VECTOR_TYPE + && comptypes (TREE_TYPE (inside_init), type)) + || (code == POINTER_TYPE + && TREE_CODE (TREE_TYPE (inside_init)) == ARRAY_TYPE + && comptypes (TREE_TYPE (TREE_TYPE (inside_init)), + TREE_TYPE (type))))) { if (code == POINTER_TYPE) - { - if (TREE_CODE (TREE_TYPE (inside_init)) == ARRAY_TYPE) - { - if (TREE_CODE (inside_init) == STRING_CST - || TREE_CODE (inside_init) == COMPOUND_LITERAL_EXPR) - inside_init = array_to_pointer_conversion - (init_loc, inside_init); - else - { - error_init ("invalid use of non-lvalue array"); - return error_mark_node; - } - } - } + { + if (TREE_CODE (TREE_TYPE (inside_init)) == ARRAY_TYPE) + { + if (TREE_CODE (inside_init) == STRING_CST + || TREE_CODE (inside_init) == COMPOUND_LITERAL_EXPR) + inside_init = array_to_pointer_conversion + (init_loc, inside_init); + else + { + error_init ("invalid use of non-lvalue array"); + return error_mark_node; + } + } + } if (code == VECTOR_TYPE) - /* Although the types are compatible, we may require a - conversion. */ - inside_init = convert (type, inside_init); + /* Although the types are compatible, we may require a + conversion. */ + inside_init = convert (type, inside_init); if (require_constant - && (code == VECTOR_TYPE || !flag_isoc99) - && TREE_CODE (inside_init) == COMPOUND_LITERAL_EXPR) - { - /* As an extension, allow initializing objects with static storage - duration with compound literals (which are then treated just as - the brace enclosed list they contain). Also allow this for - vectors, as we can only assign them with compound literals. */ - tree decl = COMPOUND_LITERAL_EXPR_DECL (inside_init); - inside_init = DECL_INITIAL (decl); - } + && (code == VECTOR_TYPE || !flag_isoc99) + && TREE_CODE (inside_init) == COMPOUND_LITERAL_EXPR) + { + /* As an extension, allow initializing objects with static storage + duration with compound literals (which are then treated just as + the brace enclosed list they contain). Also allow this for + vectors, as we can only assign them with compound literals. */ + tree decl = COMPOUND_LITERAL_EXPR_DECL (inside_init); + inside_init = DECL_INITIAL (decl); + } if (code == ARRAY_TYPE && TREE_CODE (inside_init) != STRING_CST - && TREE_CODE (inside_init) != CONSTRUCTOR) - { - error_init ("array initialized from non-constant array expression"); - return error_mark_node; - } + && TREE_CODE (inside_init) != CONSTRUCTOR) + { + error_init ("array initialized from non-constant array expression"); + return error_mark_node; + } /* Compound expressions can only occur here if -pedantic or - -pedantic-errors is specified. In the later case, we always want - an error. In the former case, we simply want a warning. */ + -pedantic-errors is specified. In the later case, we always want + an error. In the former case, we simply want a warning. */ if (require_constant && pedantic - && TREE_CODE (inside_init) == COMPOUND_EXPR) - { - inside_init - = valid_compound_expr_initializer (inside_init, - TREE_TYPE (inside_init)); - if (inside_init == error_mark_node) - error_init ("initializer element is not constant"); - else - pedwarn_init (init_loc, OPT_pedantic, - "initializer element is not constant"); - if (flag_pedantic_errors) - inside_init = error_mark_node; - } + && TREE_CODE (inside_init) == COMPOUND_EXPR) + { + inside_init + = valid_compound_expr_initializer (inside_init, + TREE_TYPE (inside_init)); + if (inside_init == error_mark_node) + error_init ("initializer element is not constant"); + else + pedwarn_init (init_loc, OPT_pedantic, + "initializer element is not constant"); + if (flag_pedantic_errors) + inside_init = error_mark_node; + } else if (require_constant - && !initializer_constant_valid_p (inside_init, - TREE_TYPE (inside_init))) - { - error_init ("initializer element is not constant"); - inside_init = error_mark_node; - } + && !initializer_constant_valid_p (inside_init, + TREE_TYPE (inside_init))) + { + error_init ("initializer element is not constant"); + inside_init = error_mark_node; + } else if (require_constant && !maybe_const) - pedwarn_init (init_loc, 0, - "initializer element is not a constant expression"); + pedwarn_init (init_loc, 0, + "initializer element is not a constant expression"); /* Added to enable additional -Wmissing-format-attribute warnings. */ if (TREE_CODE (TREE_TYPE (inside_init)) == POINTER_TYPE) - inside_init = convert_for_assignment (init_loc, type, inside_init, - origtype, - ic_init, null_pointer_constant, - NULL_TREE, NULL_TREE, 0); + inside_init = convert_for_assignment (init_loc, type, inside_init, + origtype, + ic_init, null_pointer_constant, + NULL_TREE, NULL_TREE, 0); return inside_init; } @@ -6268,35 +6241,35 @@ || code == COMPLEX_TYPE || code == VECTOR_TYPE) { if (TREE_CODE (TREE_TYPE (init)) == ARRAY_TYPE - && (TREE_CODE (init) == STRING_CST - || TREE_CODE (init) == COMPOUND_LITERAL_EXPR)) - inside_init = init = array_to_pointer_conversion (init_loc, init); + && (TREE_CODE (init) == STRING_CST + || TREE_CODE (init) == COMPOUND_LITERAL_EXPR)) + inside_init = init = array_to_pointer_conversion (init_loc, init); if (semantic_type) - inside_init = build1 (EXCESS_PRECISION_EXPR, semantic_type, - inside_init); + inside_init = build1 (EXCESS_PRECISION_EXPR, semantic_type, + inside_init); inside_init - = convert_for_assignment (init_loc, type, inside_init, origtype, - ic_init, null_pointer_constant, - NULL_TREE, NULL_TREE, 0); + = convert_for_assignment (init_loc, type, inside_init, origtype, + ic_init, null_pointer_constant, + NULL_TREE, NULL_TREE, 0); /* Check to see if we have already given an error message. */ if (inside_init == error_mark_node) - ; + ; else if (require_constant && !TREE_CONSTANT (inside_init)) - { - error_init ("initializer element is not constant"); - inside_init = error_mark_node; - } + { + error_init ("initializer element is not constant"); + inside_init = error_mark_node; + } else if (require_constant - && !initializer_constant_valid_p (inside_init, - TREE_TYPE (inside_init))) - { - error_init ("initializer element is not computable at load time"); - inside_init = error_mark_node; - } + && !initializer_constant_valid_p (inside_init, + TREE_TYPE (inside_init))) + { + error_init ("initializer element is not computable at load time"); + inside_init = error_mark_node; + } else if (require_constant && !maybe_const) - pedwarn_init (init_loc, 0, - "initializer element is not a constant expression"); + pedwarn_init (init_loc, 0, + "initializer element is not a constant expression"); return inside_init; } @@ -6505,13 +6478,13 @@ { require_constant_value = TREE_STATIC (decl); require_constant_elements - = ((TREE_STATIC (decl) || (pedantic && !flag_isoc99)) - /* For a scalar, you can always use any value to initialize, - even within braces. */ - && (TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE - || TREE_CODE (TREE_TYPE (decl)) == RECORD_TYPE - || TREE_CODE (TREE_TYPE (decl)) == UNION_TYPE - || TREE_CODE (TREE_TYPE (decl)) == QUAL_UNION_TYPE)); + = ((TREE_STATIC (decl) || (pedantic && !flag_isoc99)) + /* For a scalar, you can always use any value to initialize, + even within braces. */ + && (TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE + || TREE_CODE (TREE_TYPE (decl)) == RECORD_TYPE + || TREE_CODE (TREE_TYPE (decl)) == UNION_TYPE + || TREE_CODE (TREE_TYPE (decl)) == QUAL_UNION_TYPE)); locus = identifier_to_locale (IDENTIFIER_POINTER (DECL_NAME (decl))); } else @@ -6658,10 +6631,10 @@ TYPE_MIN_VALUE (TYPE_DOMAIN (constructor_type))); } else - { - constructor_index = bitsize_zero_node; - constructor_max_index = NULL_TREE; - } + { + constructor_index = bitsize_zero_node; + constructor_max_index = NULL_TREE; + } constructor_unfilled_index = constructor_index; } @@ -6669,7 +6642,7 @@ { /* Vectors are like simple fixed-size arrays. */ constructor_max_index = - build_int_cst (NULL_TREE, TYPE_VECTOR_SUBPARTS (constructor_type) - 1); + build_int_cst (NULL_TREE, TYPE_VECTOR_SUBPARTS (constructor_type) - 1); constructor_index = bitsize_zero_node; constructor_unfilled_index = constructor_index; } @@ -6777,17 +6750,17 @@ if (constructor_type == 0) ; else if (TREE_CODE (constructor_type) == RECORD_TYPE - || TREE_CODE (constructor_type) == UNION_TYPE) + || TREE_CODE (constructor_type) == UNION_TYPE) { /* Don't die if there are extra init elts at the end. */ if (constructor_fields == 0) - constructor_type = 0; + constructor_type = 0; else - { - constructor_type = TREE_TYPE (constructor_fields); - push_member_name (constructor_fields); - constructor_depth++; - } + { + constructor_type = TREE_TYPE (constructor_fields); + push_member_name (constructor_fields); + constructor_depth++; + } } else if (TREE_CODE (constructor_type) == ARRAY_TYPE) { @@ -6823,7 +6796,7 @@ } if (TREE_CODE (constructor_type) == RECORD_TYPE - || TREE_CODE (constructor_type) == UNION_TYPE) + || TREE_CODE (constructor_type) == UNION_TYPE) { constructor_fields = TYPE_FIELDS (constructor_type); /* Skip any nameless bit fields at the beginning. */ @@ -6838,7 +6811,7 @@ { /* Vectors are like simple fixed-size arrays. */ constructor_max_index = - build_int_cst (NULL_TREE, TYPE_VECTOR_SUBPARTS (constructor_type) - 1); + build_int_cst (NULL_TREE, TYPE_VECTOR_SUBPARTS (constructor_type) - 1); constructor_index = convert (bitsizetype, integer_zero_node); constructor_unfilled_index = constructor_index; } @@ -6866,7 +6839,7 @@ TYPE_MIN_VALUE (TYPE_DOMAIN (constructor_type))); } else - constructor_index = bitsize_zero_node; + constructor_index = bitsize_zero_node; constructor_unfilled_index = constructor_index; if (value && TREE_CODE (value) == STRING_CST) @@ -6880,7 +6853,7 @@ else { if (constructor_type != error_mark_node) - warning_init (0, "braces around scalar initializer"); + warning_init (0, "braces around scalar initializer"); constructor_fields = constructor_type; constructor_unfilled_fields = constructor_type; } @@ -6909,7 +6882,7 @@ if (implicit == 0) { /* When we come to an explicit close brace, - pop any inner levels that didn't have explicit braces. */ + pop any inner levels that didn't have explicit braces. */ while (constructor_stack->implicit) { process_init_element (pop_init_level (1, braced_init_obstack), @@ -6932,9 +6905,9 @@ && !TYPE_MAX_VALUE (TYPE_DOMAIN (constructor_type))) { /* Silently discard empty initializations. The parser will - already have pedwarned for empty brackets. */ + already have pedwarned for empty brackets. */ if (integer_zerop (constructor_unfilled_index)) - constructor_type = NULL_TREE; + constructor_type = NULL_TREE; else { gcc_assert (!TYPE_SIZE (constructor_type)); @@ -6945,7 +6918,6 @@ pedwarn_init (input_location, OPT_pedantic, "initialization of a flexible array member"); - /* We have already issued an error message for the existence of a flexible array member not at the end of the structure. Discard the initializer so that we do not die later. */ @@ -6973,8 +6945,8 @@ push_member_name (constructor_unfilled_fields); warning_init (OPT_Wmissing_field_initializers, "missing initializer"); - RESTORE_SPELLING_DEPTH (constructor_depth); - } + RESTORE_SPELLING_DEPTH (constructor_depth); + } } /* Pad out the end of the structure. */ @@ -6985,49 +6957,49 @@ else if (constructor_type == 0) ; else if (TREE_CODE (constructor_type) != RECORD_TYPE - && TREE_CODE (constructor_type) != UNION_TYPE - && TREE_CODE (constructor_type) != ARRAY_TYPE - && TREE_CODE (constructor_type) != VECTOR_TYPE) + && TREE_CODE (constructor_type) != UNION_TYPE + && TREE_CODE (constructor_type) != ARRAY_TYPE + && TREE_CODE (constructor_type) != VECTOR_TYPE) { /* A nonincremental scalar initializer--just return - the element, after verifying there is just one. */ + the element, after verifying there is just one. */ if (VEC_empty (constructor_elt,constructor_elements)) - { - if (!constructor_erroneous) - error_init ("empty scalar initializer"); - ret.value = error_mark_node; - } + { + if (!constructor_erroneous) + error_init ("empty scalar initializer"); + ret.value = error_mark_node; + } else if (VEC_length (constructor_elt,constructor_elements) != 1) - { - error_init ("extra elements in scalar initializer"); - ret.value = VEC_index (constructor_elt,constructor_elements,0)->value; - } + { + error_init ("extra elements in scalar initializer"); + ret.value = VEC_index (constructor_elt,constructor_elements,0)->value; + } else - ret.value = VEC_index (constructor_elt,constructor_elements,0)->value; + ret.value = VEC_index (constructor_elt,constructor_elements,0)->value; } else { if (constructor_erroneous) - ret.value = error_mark_node; + ret.value = error_mark_node; else - { - ret.value = build_constructor (constructor_type, - constructor_elements); - if (constructor_constant) - TREE_CONSTANT (ret.value) = 1; - if (constructor_constant && constructor_simple) - TREE_STATIC (ret.value) = 1; - if (constructor_nonconst) - CONSTRUCTOR_NON_CONST (ret.value) = 1; - } + { + ret.value = build_constructor (constructor_type, + constructor_elements); + if (constructor_constant) + TREE_CONSTANT (ret.value) = 1; + if (constructor_constant && constructor_simple) + TREE_STATIC (ret.value) = 1; + if (constructor_nonconst) + CONSTRUCTOR_NON_CONST (ret.value) = 1; + } } if (ret.value && TREE_CODE (ret.value) != CONSTRUCTOR) { if (constructor_nonconst) - ret.original_code = C_MAYBE_CONST_EXPR; + ret.original_code = C_MAYBE_CONST_EXPR; else if (ret.original_code == C_MAYBE_CONST_EXPR) - ret.original_code = ERROR_MARK; + ret.original_code = ERROR_MARK; } constructor_type = p->type; @@ -7082,7 +7054,7 @@ gcc_assert (!constructor_range_stack); /* Designator list starts at the level of closest explicit - braces. */ + braces. */ while (constructor_stack->implicit) { process_init_element (pop_init_level (1, braced_init_obstack), @@ -7098,7 +7070,7 @@ case UNION_TYPE: subtype = TREE_TYPE (constructor_fields); if (subtype != error_mark_node) - subtype = TYPE_MAIN_VARIANT (subtype); + subtype = TYPE_MAIN_VARIANT (subtype); break; case ARRAY_TYPE: subtype = TYPE_MAIN_VARIANT (TREE_TYPE (constructor_type)); @@ -7172,18 +7144,18 @@ { first = c_fully_fold (first, false, NULL); if (TREE_CODE (first) == INTEGER_CST) - pedwarn_init (input_location, OPT_pedantic, - "array index in initializer is not " - "an integer constant expression"); + pedwarn_init (input_location, OPT_pedantic, + "array index in initializer is not " + "an integer constant expression"); } if (last && TREE_CODE (last) != INTEGER_CST) { last = c_fully_fold (last, false, NULL); if (TREE_CODE (last) == INTEGER_CST) - pedwarn_init (input_location, OPT_pedantic, - "array index in initializer is not " - "an integer constant expression"); + pedwarn_init (input_location, OPT_pedantic, + "array index in initializer is not " + "an integer constant expression"); } if (TREE_CODE (first) != INTEGER_CST) @@ -7195,35 +7167,35 @@ else if (tree_int_cst_sgn (first) == -1) error_init ("array index in initializer exceeds array bounds"); else if (constructor_max_index - && tree_int_cst_lt (constructor_max_index, first)) + && tree_int_cst_lt (constructor_max_index, first)) error_init ("array index in initializer exceeds array bounds"); else { constant_expression_warning (first); if (last) - constant_expression_warning (last); + constant_expression_warning (last); constructor_index = convert (bitsizetype, first); if (last) - { - if (tree_int_cst_equal (first, last)) - last = 0; - else if (tree_int_cst_lt (last, first)) - { - error_init ("empty index range in initializer"); - last = 0; - } - else - { - last = convert (bitsizetype, last); - if (constructor_max_index != 0 - && tree_int_cst_lt (constructor_max_index, last)) - { - error_init ("array index range in initializer exceeds array bounds"); - last = 0; - } - } - } + { + if (tree_int_cst_equal (first, last)) + last = 0; + else if (tree_int_cst_lt (last, first)) + { + error_init ("empty index range in initializer"); + last = 0; + } + else + { + last = convert (bitsizetype, last); + if (constructor_max_index != 0 + && tree_int_cst_lt (constructor_max_index, last)) + { + error_init ("array index range in initializer exceeds array bounds"); + last = 0; + } + } + } designator_depth++; designator_erroneous = 0; @@ -7255,7 +7227,7 @@ if (field == 0) error ("unknown field %qE specified in initializer", fieldname); - else + else do { constructor_fields = TREE_VALUE (field); @@ -7271,9 +7243,8 @@ } } while (field != NULL_TREE); - -} - +} + /* Add a new initializer to the tree of pending initializers. PURPOSE identifies the initializer, either array index or field in a structure. VALUE is the value of that index or field. If ORIGTYPE is not @@ -7296,26 +7267,26 @@ if (TREE_CODE (constructor_type) == ARRAY_TYPE) { while (*q != 0) - { - p = *q; - if (tree_int_cst_lt (purpose, p->purpose)) - q = &p->left; - else if (tree_int_cst_lt (p->purpose, purpose)) - q = &p->right; - else - { - if (!implicit) - { - if (TREE_SIDE_EFFECTS (p->value)) - warning_init (0, "initialized field with side-effects overwritten"); - else if (warn_override_init) - warning_init (OPT_Woverride_init, "initialized field overwritten"); - } - p->value = value; - p->origtype = origtype; - return; - } - } + { + p = *q; + if (tree_int_cst_lt (purpose, p->purpose)) + q = &p->left; + else if (tree_int_cst_lt (p->purpose, purpose)) + q = &p->right; + else + { + if (!implicit) + { + if (TREE_SIDE_EFFECTS (p->value)) + warning_init (0, "initialized field with side-effects overwritten"); + else if (warn_override_init) + warning_init (OPT_Woverride_init, "initialized field overwritten"); + } + p->value = value; + p->origtype = origtype; + return; + } + } } else { @@ -7323,26 +7294,26 @@ bitpos = bit_position (purpose); while (*q != NULL) - { - p = *q; - if (tree_int_cst_lt (bitpos, bit_position (p->purpose))) - q = &p->left; - else if (p->purpose != purpose) - q = &p->right; - else - { - if (!implicit) - { - if (TREE_SIDE_EFFECTS (p->value)) - warning_init (0, "initialized field with side-effects overwritten"); - else if (warn_override_init) - warning_init (OPT_Woverride_init, "initialized field overwritten"); - } - p->value = value; - p->origtype = origtype; - return; - } - } + { + p = *q; + if (tree_int_cst_lt (bitpos, bit_position (p->purpose))) + q = &p->left; + else if (p->purpose != purpose) + q = &p->right; + else + { + if (!implicit) + { + if (TREE_SIDE_EFFECTS (p->value)) + warning_init (0, "initialized field with side-effects overwritten"); + else if (warn_override_init) + warning_init (OPT_Woverride_init, "initialized field overwritten"); + } + p->value = value; + p->origtype = origtype; + return; + } + } } r = (struct init_node *) obstack_alloc (braced_init_obstack, @@ -7362,150 +7333,150 @@ struct init_node *s; if (r == p->left) - { - if (p->balance == 0) - p->balance = -1; - else if (p->balance < 0) - { - if (r->balance < 0) - { - /* L rotation. */ - p->left = r->right; - if (p->left) - p->left->parent = p; - r->right = p; - - p->balance = 0; - r->balance = 0; - - s = p->parent; - p->parent = r; - r->parent = s; - if (s) - { - if (s->left == p) - s->left = r; - else - s->right = r; - } - else - constructor_pending_elts = r; - } - else - { - /* LR rotation. */ - struct init_node *t = r->right; - - r->right = t->left; - if (r->right) - r->right->parent = r; - t->left = r; - - p->left = t->right; - if (p->left) - p->left->parent = p; - t->right = p; - - p->balance = t->balance < 0; - r->balance = -(t->balance > 0); - t->balance = 0; - - s = p->parent; - p->parent = t; - r->parent = t; - t->parent = s; - if (s) - { - if (s->left == p) - s->left = t; - else - s->right = t; - } - else - constructor_pending_elts = t; - } - break; - } - else - { - /* p->balance == +1; growth of left side balances the node. */ - p->balance = 0; - break; - } - } + { + if (p->balance == 0) + p->balance = -1; + else if (p->balance < 0) + { + if (r->balance < 0) + { + /* L rotation. */ + p->left = r->right; + if (p->left) + p->left->parent = p; + r->right = p; + + p->balance = 0; + r->balance = 0; + + s = p->parent; + p->parent = r; + r->parent = s; + if (s) + { + if (s->left == p) + s->left = r; + else + s->right = r; + } + else + constructor_pending_elts = r; + } + else + { + /* LR rotation. */ + struct init_node *t = r->right; + + r->right = t->left; + if (r->right) + r->right->parent = r; + t->left = r; + + p->left = t->right; + if (p->left) + p->left->parent = p; + t->right = p; + + p->balance = t->balance < 0; + r->balance = -(t->balance > 0); + t->balance = 0; + + s = p->parent; + p->parent = t; + r->parent = t; + t->parent = s; + if (s) + { + if (s->left == p) + s->left = t; + else + s->right = t; + } + else + constructor_pending_elts = t; + } + break; + } + else + { + /* p->balance == +1; growth of left side balances the node. */ + p->balance = 0; + break; + } + } else /* r == p->right */ - { - if (p->balance == 0) - /* Growth propagation from right side. */ - p->balance++; - else if (p->balance > 0) - { - if (r->balance > 0) - { - /* R rotation. */ - p->right = r->left; - if (p->right) - p->right->parent = p; - r->left = p; - - p->balance = 0; - r->balance = 0; - - s = p->parent; - p->parent = r; - r->parent = s; - if (s) - { - if (s->left == p) - s->left = r; - else - s->right = r; - } - else - constructor_pending_elts = r; - } - else /* r->balance == -1 */ - { - /* RL rotation */ - struct init_node *t = r->left; - - r->left = t->right; - if (r->left) - r->left->parent = r; - t->right = r; - - p->right = t->left; - if (p->right) - p->right->parent = p; - t->left = p; - - r->balance = (t->balance < 0); - p->balance = -(t->balance > 0); - t->balance = 0; - - s = p->parent; - p->parent = t; - r->parent = t; - t->parent = s; - if (s) - { - if (s->left == p) - s->left = t; - else - s->right = t; - } - else - constructor_pending_elts = t; - } - break; - } - else - { - /* p->balance == -1; growth of right side balances the node. */ - p->balance = 0; - break; - } - } + { + if (p->balance == 0) + /* Growth propagation from right side. */ + p->balance++; + else if (p->balance > 0) + { + if (r->balance > 0) + { + /* R rotation. */ + p->right = r->left; + if (p->right) + p->right->parent = p; + r->left = p; + + p->balance = 0; + r->balance = 0; + + s = p->parent; + p->parent = r; + r->parent = s; + if (s) + { + if (s->left == p) + s->left = r; + else + s->right = r; + } + else + constructor_pending_elts = r; + } + else /* r->balance == -1 */ + { + /* RL rotation */ + struct init_node *t = r->left; + + r->left = t->right; + if (r->left) + r->left->parent = r; + t->right = r; + + p->right = t->left; + if (p->right) + p->right->parent = p; + t->left = p; + + r->balance = (t->balance < 0); + p->balance = -(t->balance > 0); + t->balance = 0; + + s = p->parent; + p->parent = t; + r->parent = t; + t->parent = s; + if (s) + { + if (s->left == p) + s->left = t; + else + s->right = t; + } + else + constructor_pending_elts = t; + } + break; + } + else + { + /* p->balance == -1; growth of right side balances the node. */ + p->balance = 0; + break; + } + } r = p; p = p->parent; @@ -7535,19 +7506,19 @@ constructor_unfilled_fields = TYPE_FIELDS (constructor_type); /* Skip any nameless bit fields at the beginning. */ while (constructor_unfilled_fields != 0 - && DECL_C_BIT_FIELD (constructor_unfilled_fields) - && DECL_NAME (constructor_unfilled_fields) == 0) - constructor_unfilled_fields = TREE_CHAIN (constructor_unfilled_fields); + && DECL_C_BIT_FIELD (constructor_unfilled_fields) + && DECL_NAME (constructor_unfilled_fields) == 0) + constructor_unfilled_fields = TREE_CHAIN (constructor_unfilled_fields); } else if (TREE_CODE (constructor_type) == ARRAY_TYPE) { if (TYPE_DOMAIN (constructor_type)) - constructor_unfilled_index - = convert (bitsizetype, - TYPE_MIN_VALUE (TYPE_DOMAIN (constructor_type))); + constructor_unfilled_index + = convert (bitsizetype, + TYPE_MIN_VALUE (TYPE_DOMAIN (constructor_type))); else - constructor_unfilled_index = bitsize_zero_node; + constructor_unfilled_index = bitsize_zero_node; } constructor_incremental = 0; } @@ -7576,47 +7547,47 @@ purpose = size_binop (PLUS_EXPR, purpose, bitsize_one_node)) { if (wchar_bytes == 1) - { - val[1] = (unsigned char) *p++; - val[0] = 0; - } + { + val[1] = (unsigned char) *p++; + val[0] = 0; + } else - { - val[0] = 0; - val[1] = 0; - for (byte = 0; byte < wchar_bytes; byte++) - { - if (BYTES_BIG_ENDIAN) - bitpos = (wchar_bytes - byte - 1) * charwidth; - else - bitpos = byte * charwidth; - val[bitpos < HOST_BITS_PER_WIDE_INT] - |= ((unsigned HOST_WIDE_INT) ((unsigned char) *p++)) - << (bitpos % HOST_BITS_PER_WIDE_INT); - } - } + { + val[0] = 0; + val[1] = 0; + for (byte = 0; byte < wchar_bytes; byte++) + { + if (BYTES_BIG_ENDIAN) + bitpos = (wchar_bytes - byte - 1) * charwidth; + else + bitpos = byte * charwidth; + val[bitpos < HOST_BITS_PER_WIDE_INT] + |= ((unsigned HOST_WIDE_INT) ((unsigned char) *p++)) + << (bitpos % HOST_BITS_PER_WIDE_INT); + } + } if (!TYPE_UNSIGNED (type)) - { - bitpos = ((wchar_bytes - 1) * charwidth) + HOST_BITS_PER_CHAR; - if (bitpos < HOST_BITS_PER_WIDE_INT) - { - if (val[1] & (((HOST_WIDE_INT) 1) << (bitpos - 1))) - { - val[1] |= ((HOST_WIDE_INT) -1) << bitpos; - val[0] = -1; - } - } - else if (bitpos == HOST_BITS_PER_WIDE_INT) - { - if (val[1] < 0) - val[0] = -1; - } - else if (val[0] & (((HOST_WIDE_INT) 1) - << (bitpos - 1 - HOST_BITS_PER_WIDE_INT))) - val[0] |= ((HOST_WIDE_INT) -1) - << (bitpos - HOST_BITS_PER_WIDE_INT); - } + { + bitpos = ((wchar_bytes - 1) * charwidth) + HOST_BITS_PER_CHAR; + if (bitpos < HOST_BITS_PER_WIDE_INT) + { + if (val[1] & (((HOST_WIDE_INT) 1) << (bitpos - 1))) + { + val[1] |= ((HOST_WIDE_INT) -1) << bitpos; + val[0] = -1; + } + } + else if (bitpos == HOST_BITS_PER_WIDE_INT) + { + if (val[1] < 0) + val[0] = -1; + } + else if (val[0] & (((HOST_WIDE_INT) 1) + << (bitpos - 1 - HOST_BITS_PER_WIDE_INT))) + val[0] |= ((HOST_WIDE_INT) -1) + << (bitpos - HOST_BITS_PER_WIDE_INT); + } value = build_int_cst_wide (type, val[1], val[0]); add_pending_init (purpose, value, NULL_TREE, false, @@ -7642,14 +7613,14 @@ p = constructor_pending_elts; while (p) - { - if (tree_int_cst_lt (field, p->purpose)) - p = p->left; - else if (tree_int_cst_lt (p->purpose, field)) - p = p->right; - else - return p->value; - } + { + if (tree_int_cst_lt (field, p->purpose)) + p = p->left; + else if (tree_int_cst_lt (p->purpose, field)) + p = p->right; + else + return p->value; + } } else if (TREE_CODE (constructor_type) == RECORD_TYPE) { @@ -7663,21 +7634,21 @@ p = constructor_pending_elts; while (p) - { - if (field == p->purpose) - return p->value; - else if (tree_int_cst_lt (bitpos, bit_position (p->purpose))) - p = p->left; - else - p = p->right; - } + { + if (field == p->purpose) + return p->value; + else if (tree_int_cst_lt (bitpos, bit_position (p->purpose))) + p = p->left; + else + p = p->right; + } } else if (TREE_CODE (constructor_type) == UNION_TYPE) { if (!VEC_empty (constructor_elt, constructor_elements) - && (VEC_last (constructor_elt, constructor_elements)->index - == field)) - return VEC_last (constructor_elt, constructor_elements)->value; + && (VEC_last (constructor_elt, constructor_elements)->index + == field)) + return VEC_last (constructor_elt, constructor_elements)->value; } return 0; } @@ -7718,20 +7689,20 @@ } if (TREE_CODE (TREE_TYPE (value)) == ARRAY_TYPE && (TREE_CODE (value) == STRING_CST - || TREE_CODE (value) == COMPOUND_LITERAL_EXPR) + || TREE_CODE (value) == COMPOUND_LITERAL_EXPR) && !(TREE_CODE (value) == STRING_CST - && TREE_CODE (type) == ARRAY_TYPE - && INTEGRAL_TYPE_P (TREE_TYPE (type))) + && TREE_CODE (type) == ARRAY_TYPE + && INTEGRAL_TYPE_P (TREE_TYPE (type))) && !comptypes (TYPE_MAIN_VARIANT (TREE_TYPE (value)), - TYPE_MAIN_VARIANT (type))) + TYPE_MAIN_VARIANT (type))) value = array_to_pointer_conversion (input_location, value); if (TREE_CODE (value) == COMPOUND_LITERAL_EXPR && require_constant_value && !flag_isoc99 && pending) { /* As an extension, allow initializing objects with static storage - duration with compound literals (which are then treated just as - the brace enclosed list they contain). */ + duration with compound literals (which are then treated just as + the brace enclosed list they contain). */ tree decl = COMPOUND_LITERAL_EXPR_DECL (value); value = DECL_INITIAL (decl); } @@ -7749,10 +7720,10 @@ else if (!TREE_CONSTANT (value)) constructor_constant = 0; else if (!initializer_constant_valid_p (value, TREE_TYPE (value)) - || ((TREE_CODE (constructor_type) == RECORD_TYPE - || TREE_CODE (constructor_type) == UNION_TYPE) - && DECL_C_BIT_FIELD (field) - && TREE_CODE (value) != INTEGER_CST)) + || ((TREE_CODE (constructor_type) == RECORD_TYPE + || TREE_CODE (constructor_type) == UNION_TYPE) + && DECL_C_BIT_FIELD (field) + && TREE_CODE (value) != INTEGER_CST)) constructor_simple = 0; if (!maybe_const) constructor_nonconst = 1; @@ -7760,18 +7731,18 @@ if (!initializer_constant_valid_p (value, TREE_TYPE (value))) { if (require_constant_value) - { - error_init ("initializer element is not constant"); - value = error_mark_node; - } + { + error_init ("initializer element is not constant"); + value = error_mark_node; + } else if (require_constant_elements) - pedwarn (input_location, 0, - "initializer element is not computable at load time"); + pedwarn (input_location, 0, + "initializer element is not computable at load time"); } else if (!maybe_const - && (require_constant_value || require_constant_elements)) + && (require_constant_value || require_constant_elements)) pedwarn_init (input_location, 0, - "initializer element is not a constant expression"); + "initializer element is not a constant expression"); /* Issue -Wc++-compat warnings about initializing a bitfield with enum type. */ @@ -7780,15 +7751,15 @@ && TREE_CODE (field) == FIELD_DECL && DECL_BIT_FIELD_TYPE (field) != NULL_TREE && (TYPE_MAIN_VARIANT (DECL_BIT_FIELD_TYPE (field)) - != TYPE_MAIN_VARIANT (type)) + != TYPE_MAIN_VARIANT (type)) && TREE_CODE (DECL_BIT_FIELD_TYPE (field)) == ENUMERAL_TYPE) { tree checktype = origtype != NULL_TREE ? origtype : TREE_TYPE (value); if (checktype != error_mark_node - && (TYPE_MAIN_VARIANT (checktype) - != TYPE_MAIN_VARIANT (DECL_BIT_FIELD_TYPE (field)))) - warning_init (OPT_Wc___compat, - "enum conversion in initialization is invalid in C++"); + && (TYPE_MAIN_VARIANT (checktype) + != TYPE_MAIN_VARIANT (DECL_BIT_FIELD_TYPE (field)))) + warning_init (OPT_Wc___compat, + "enum conversion in initialization is invalid in C++"); } /* If this field is empty (and not at the end of structure), @@ -7804,7 +7775,7 @@ if (semantic_type) value = build1 (EXCESS_PRECISION_EXPR, semantic_type, value); value = digest_init (input_location, type, value, origtype, npc, - strict_string, require_constant_value); + strict_string, require_constant_value); if (value == error_mark_node) { constructor_erroneous = 1; @@ -7817,7 +7788,7 @@ put it on constructor_pending_elts. */ if (TREE_CODE (constructor_type) == ARRAY_TYPE && (!constructor_incremental - || !tree_int_cst_equal (field, constructor_unfilled_index))) + || !tree_int_cst_equal (field, constructor_unfilled_index))) { if (constructor_incremental && tree_int_cst_lt (field, constructor_unfilled_index)) @@ -7828,12 +7799,12 @@ return; } else if (TREE_CODE (constructor_type) == RECORD_TYPE - && (!constructor_incremental - || field != constructor_unfilled_fields)) + && (!constructor_incremental + || field != constructor_unfilled_fields)) { /* We do this for records but not for unions. In a union, - no matter which field is specified, it can be initialized - right away since it starts at the beginning of the union. */ + no matter which field is specified, it can be initialized + right away since it starts at the beginning of the union. */ if (constructor_incremental) { if (!constructor_unfilled_fields) @@ -7855,17 +7826,17 @@ return; } else if (TREE_CODE (constructor_type) == UNION_TYPE - && !VEC_empty (constructor_elt, constructor_elements)) + && !VEC_empty (constructor_elt, constructor_elements)) { if (!implicit) - { - if (TREE_SIDE_EFFECTS (VEC_last (constructor_elt, - constructor_elements)->value)) - warning_init (0, - "initialized field with side-effects overwritten"); - else if (warn_override_init) - warning_init (OPT_Woverride_init, "initialized field overwritten"); - } + { + if (TREE_SIDE_EFFECTS (VEC_last (constructor_elt, + constructor_elements)->value)) + warning_init (0, + "initialized field with side-effects overwritten"); + else if (warn_override_init) + warning_init (OPT_Woverride_init, "initialized field overwritten"); + } /* We can have just one union field set. */ constructor_elements = 0; @@ -7882,7 +7853,7 @@ if (TREE_CODE (constructor_type) == ARRAY_TYPE) constructor_unfilled_index = size_binop_loc (input_location, PLUS_EXPR, constructor_unfilled_index, - bitsize_one_node); + bitsize_one_node); else if (TREE_CODE (constructor_type) == RECORD_TYPE) { constructor_unfilled_fields @@ -8081,7 +8052,7 @@ && integer_zerop (constructor_unfilled_index)) { if (constructor_stack->replacement_value.value) - error_init ("excess elements in char array initializer"); + error_init ("excess elements in char array initializer"); constructor_stack->replacement_value = value; return; } @@ -8114,29 +8085,29 @@ process_init_element (pop_init_level (1, braced_init_obstack), true, braced_init_obstack); else - break; + break; } /* In the case of [LO ... HI] = VALUE, only evaluate VALUE once. */ if (constructor_range_stack) { /* If value is a compound literal and we'll be just using its - content, don't put it into a SAVE_EXPR. */ + content, don't put it into a SAVE_EXPR. */ if (TREE_CODE (value.value) != COMPOUND_LITERAL_EXPR - || !require_constant_value - || flag_isoc99) - { - tree semantic_type = NULL_TREE; - if (TREE_CODE (value.value) == EXCESS_PRECISION_EXPR) - { - semantic_type = TREE_TYPE (value.value); - value.value = TREE_OPERAND (value.value, 0); - } - value.value = c_save_expr (value.value); - if (semantic_type) - value.value = build1 (EXCESS_PRECISION_EXPR, semantic_type, - value.value); - } + || !require_constant_value + || flag_isoc99) + { + tree semantic_type = NULL_TREE; + if (TREE_CODE (value.value) == EXCESS_PRECISION_EXPR) + { + semantic_type = TREE_TYPE (value.value); + value.value = TREE_OPERAND (value.value, 0); + } + value.value = c_save_expr (value.value); + if (semantic_type) + value.value = build1 (EXCESS_PRECISION_EXPR, semantic_type, + value.value); + } } while (1) @@ -8386,14 +8357,14 @@ } /* Handle the sole element allowed in a braced initializer - for a scalar variable. */ + for a scalar variable. */ else if (constructor_type != error_mark_node - && constructor_fields == 0) - { - pedwarn_init (input_location, 0, - "excess elements in scalar initializer"); - break; - } + && constructor_fields == 0) + { + pedwarn_init (input_location, 0, + "excess elements in scalar initializer"); + break; + } else { if (value.value) @@ -8405,7 +8376,7 @@ } /* Handle range initializers either at this level or anywhere higher - in the designator stack. */ + in the designator stack. */ if (constructor_range_stack) { struct constructor_range_stack *p, *range_stack; @@ -8481,7 +8452,7 @@ are subtly different. We use a ASM_EXPR node to represent this. */ tree build_asm_expr (location_t loc, tree string, tree outputs, tree inputs, - tree clobbers, tree labels, bool simple) + tree clobbers, tree labels, bool simple) { tree tail; tree args; @@ -8503,37 +8474,37 @@ tree output = TREE_VALUE (tail); /* ??? Really, this should not be here. Users should be using a - proper lvalue, dammit. But there's a long history of using casts - in the output operands. In cases like longlong.h, this becomes a - primitive form of typechecking -- if the cast can be removed, then - the output operand had a type of the proper width; otherwise we'll - get an error. Gross, but ... */ + proper lvalue, dammit. But there's a long history of using casts + in the output operands. In cases like longlong.h, this becomes a + primitive form of typechecking -- if the cast can be removed, then + the output operand had a type of the proper width; otherwise we'll + get an error. Gross, but ... */ STRIP_NOPS (output); if (!lvalue_or_else (loc, output, lv_asm)) output = error_mark_node; if (output != error_mark_node - && (TREE_READONLY (output) - || TYPE_READONLY (TREE_TYPE (output)) - || ((TREE_CODE (TREE_TYPE (output)) == RECORD_TYPE - || TREE_CODE (TREE_TYPE (output)) == UNION_TYPE) - && C_TYPE_FIELDS_READONLY (TREE_TYPE (output))))) - readonly_error (output, lv_asm); + && (TREE_READONLY (output) + || TYPE_READONLY (TREE_TYPE (output)) + || ((TREE_CODE (TREE_TYPE (output)) == RECORD_TYPE + || TREE_CODE (TREE_TYPE (output)) == UNION_TYPE) + && C_TYPE_FIELDS_READONLY (TREE_TYPE (output))))) + readonly_error (output, lv_asm); constraint = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (tail))); oconstraints[i] = constraint; if (parse_output_constraint (&constraint, i, ninputs, noutputs, - &allows_mem, &allows_reg, &is_inout)) - { - /* If the operand is going to end up in memory, - mark it addressable. */ - if (!allows_reg && !c_mark_addressable (output)) - output = error_mark_node; - } + &allows_mem, &allows_reg, &is_inout)) + { + /* If the operand is going to end up in memory, + mark it addressable. */ + if (!allows_reg && !c_mark_addressable (output)) + output = error_mark_node; + } else - output = error_mark_node; + output = error_mark_node; TREE_VALUE (tail) = output; } @@ -8546,21 +8517,21 @@ input = TREE_VALUE (tail); if (parse_input_constraint (&constraint, i, ninputs, noutputs, 0, - oconstraints, &allows_mem, &allows_reg)) - { - /* If the operand is going to end up in memory, - mark it addressable. */ - if (!allows_reg && allows_mem) - { - /* Strip the nops as we allow this case. FIXME, this really - should be rejected or made deprecated. */ - STRIP_NOPS (input); - if (!c_mark_addressable (input)) - input = error_mark_node; - } - } + oconstraints, &allows_mem, &allows_reg)) + { + /* If the operand is going to end up in memory, + mark it addressable. */ + if (!allows_reg && allows_mem) + { + /* Strip the nops as we allow this case. FIXME, this really + should be rejected or made deprecated. */ + STRIP_NOPS (input); + if (!c_mark_addressable (input)) + input = error_mark_node; + } + } else - input = error_mark_node; + input = error_mark_node; TREE_VALUE (tail) = input; } @@ -8625,117 +8596,117 @@ if (TREE_THIS_VOLATILE (current_function_decl)) warning_at (loc, 0, - "function declared %<noreturn%> has a %<return%> statement"); + "function declared %<noreturn%> has a %<return%> statement"); if (retval) { tree semantic_type = NULL_TREE; npc = null_pointer_constant_p (retval); if (TREE_CODE (retval) == EXCESS_PRECISION_EXPR) - { - semantic_type = TREE_TYPE (retval); - retval = TREE_OPERAND (retval, 0); - } + { + semantic_type = TREE_TYPE (retval); + retval = TREE_OPERAND (retval, 0); + } retval = c_fully_fold (retval, false, NULL); if (semantic_type) - retval = build1 (EXCESS_PRECISION_EXPR, semantic_type, retval); + retval = build1 (EXCESS_PRECISION_EXPR, semantic_type, retval); } if (!retval) { current_function_returns_null = 1; if ((warn_return_type || flag_isoc99) - && valtype != 0 && TREE_CODE (valtype) != VOID_TYPE) - { - pedwarn_c99 (loc, flag_isoc99 ? 0 : OPT_Wreturn_type, - "%<return%> with no value, in " - "function returning non-void"); - no_warning = true; - } + && valtype != 0 && TREE_CODE (valtype) != VOID_TYPE) + { + pedwarn_c99 (loc, flag_isoc99 ? 0 : OPT_Wreturn_type, + "%<return%> with no value, in " + "function returning non-void"); + no_warning = true; + } } else if (valtype == 0 || TREE_CODE (valtype) == VOID_TYPE) { current_function_returns_null = 1; if (TREE_CODE (TREE_TYPE (retval)) != VOID_TYPE) - pedwarn (loc, 0, - "%<return%> with a value, in function returning void"); + pedwarn (loc, 0, + "%<return%> with a value, in function returning void"); else - pedwarn (loc, OPT_pedantic, "ISO C forbids " - "%<return%> with expression, in function returning void"); + pedwarn (loc, OPT_pedantic, "ISO C forbids " + "%<return%> with expression, in function returning void"); } else { tree t = convert_for_assignment (loc, valtype, retval, origtype, - ic_return, - npc, NULL_TREE, NULL_TREE, 0); + ic_return, + npc, NULL_TREE, NULL_TREE, 0); tree res = DECL_RESULT (current_function_decl); tree inner; current_function_returns_value = 1; if (t == error_mark_node) - return NULL_TREE; + return NULL_TREE; inner = t = convert (TREE_TYPE (res), t); /* Strip any conversions, additions, and subtractions, and see if - we are returning the address of a local variable. Warn if so. */ + we are returning the address of a local variable. Warn if so. */ while (1) - { - switch (TREE_CODE (inner)) - { - CASE_CONVERT: - case NON_LVALUE_EXPR: - case PLUS_EXPR: - case POINTER_PLUS_EXPR: - inner = TREE_OPERAND (inner, 0); - continue; - - case MINUS_EXPR: - /* If the second operand of the MINUS_EXPR has a pointer - type (or is converted from it), this may be valid, so - don't give a warning. */ - { - tree op1 = TREE_OPERAND (inner, 1); - - while (!POINTER_TYPE_P (TREE_TYPE (op1)) - && (CONVERT_EXPR_P (op1) - || TREE_CODE (op1) == NON_LVALUE_EXPR)) - op1 = TREE_OPERAND (op1, 0); - - if (POINTER_TYPE_P (TREE_TYPE (op1))) - break; - - inner = TREE_OPERAND (inner, 0); - continue; - } - - case ADDR_EXPR: - inner = TREE_OPERAND (inner, 0); - - while (REFERENCE_CLASS_P (inner) - && TREE_CODE (inner) != INDIRECT_REF) - inner = TREE_OPERAND (inner, 0); - - if (DECL_P (inner) - && !DECL_EXTERNAL (inner) - && !TREE_STATIC (inner) - && DECL_CONTEXT (inner) == current_function_decl) - warning_at (loc, - 0, "function returns address of local variable"); - break; - - default: - break; - } - - break; - } + { + switch (TREE_CODE (inner)) + { + CASE_CONVERT: + case NON_LVALUE_EXPR: + case PLUS_EXPR: + case POINTER_PLUS_EXPR: + inner = TREE_OPERAND (inner, 0); + continue; + + case MINUS_EXPR: + /* If the second operand of the MINUS_EXPR has a pointer + type (or is converted from it), this may be valid, so + don't give a warning. */ + { + tree op1 = TREE_OPERAND (inner, 1); + + while (!POINTER_TYPE_P (TREE_TYPE (op1)) + && (CONVERT_EXPR_P (op1) + || TREE_CODE (op1) == NON_LVALUE_EXPR)) + op1 = TREE_OPERAND (op1, 0); + + if (POINTER_TYPE_P (TREE_TYPE (op1))) + break; + + inner = TREE_OPERAND (inner, 0); + continue; + } + + case ADDR_EXPR: + inner = TREE_OPERAND (inner, 0); + + while (REFERENCE_CLASS_P (inner) + && TREE_CODE (inner) != INDIRECT_REF) + inner = TREE_OPERAND (inner, 0); + + if (DECL_P (inner) + && !DECL_EXTERNAL (inner) + && !TREE_STATIC (inner) + && DECL_CONTEXT (inner) == current_function_decl) + warning_at (loc, + 0, "function returns address of local variable"); + break; + + default: + break; + } + + break; + } retval = build2 (MODIFY_EXPR, TREE_TYPE (res), res, t); SET_EXPR_LOCATION (retval, loc); if (warn_sequence_point) - verify_sequence_points (retval); + verify_sequence_points (retval); } ret_stmt = build_stmt (loc, RETURN_EXPR, retval); @@ -8780,8 +8751,8 @@ tree c_start_case (location_t switch_loc, - location_t switch_cond_loc, - tree exp) + location_t switch_cond_loc, + tree exp) { tree orig_type = error_mark_node; struct c_switch *cs; @@ -8791,31 +8762,31 @@ orig_type = TREE_TYPE (exp); if (!INTEGRAL_TYPE_P (orig_type)) - { - if (orig_type != error_mark_node) - { - error_at (switch_cond_loc, "switch quantity not an integer"); - orig_type = error_mark_node; - } - exp = integer_zero_node; - } + { + if (orig_type != error_mark_node) + { + error_at (switch_cond_loc, "switch quantity not an integer"); + orig_type = error_mark_node; + } + exp = integer_zero_node; + } else - { - tree type = TYPE_MAIN_VARIANT (orig_type); - - if (!in_system_header - && (type == long_integer_type_node - || type == long_unsigned_type_node)) - warning_at (switch_cond_loc, - OPT_Wtraditional, "%<long%> switch expression not " - "converted to %<int%> in ISO C"); - - exp = c_fully_fold (exp, false, NULL); - exp = default_conversion (exp); - - if (warn_sequence_point) - verify_sequence_points (exp); - } + { + tree type = TYPE_MAIN_VARIANT (orig_type); + + if (!in_system_header + && (type == long_integer_type_node + || type == long_unsigned_type_node)) + warning_at (switch_cond_loc, + OPT_Wtraditional, "%<long%> switch expression not " + "converted to %<int%> in ISO C"); + + exp = c_fully_fold (exp, false, NULL); + exp = default_conversion (exp); + + if (warn_sequence_point) + verify_sequence_points (exp); + } } /* Add this new SWITCH_EXPR to the stack. */ @@ -8842,36 +8813,36 @@ { low_value = c_fully_fold (low_value, false, NULL); if (TREE_CODE (low_value) == INTEGER_CST) - pedwarn (input_location, OPT_pedantic, - "case label is not an integer constant expression"); + pedwarn (input_location, OPT_pedantic, + "case label is not an integer constant expression"); } if (high_value && TREE_CODE (high_value) != INTEGER_CST) { high_value = c_fully_fold (high_value, false, NULL); if (TREE_CODE (high_value) == INTEGER_CST) - pedwarn (input_location, OPT_pedantic, - "case label is not an integer constant expression"); + pedwarn (input_location, OPT_pedantic, + "case label is not an integer constant expression"); } if (c_switch_stack == NULL) { if (low_value) - error_at (loc, "case label not within a switch statement"); + error_at (loc, "case label not within a switch statement"); else - error_at (loc, "%<default%> label not within a switch statement"); + error_at (loc, "%<default%> label not within a switch statement"); return NULL_TREE; } if (c_check_switch_jump_warnings (c_switch_stack->bindings, - EXPR_LOCATION (c_switch_stack->switch_expr), - loc)) + EXPR_LOCATION (c_switch_stack->switch_expr), + loc)) return NULL_TREE; label = c_add_case_label (loc, c_switch_stack->cases, - SWITCH_COND (c_switch_stack->switch_expr), - c_switch_stack->orig_type, - low_value, high_value); + SWITCH_COND (c_switch_stack->switch_expr), + c_switch_stack->orig_type, + low_value, high_value); if (label == error_mark_node) label = NULL_TREE; return label; @@ -8890,8 +8861,8 @@ /* Emit warnings as needed. */ switch_location = EXPR_LOCATION (cs->switch_expr); c_do_switch_warnings (cs->cases, switch_location, - TREE_TYPE (cs->switch_expr), - SWITCH_COND (cs->switch_expr)); + TREE_TYPE (cs->switch_expr), + SWITCH_COND (cs->switch_expr)); /* Pop the stack. */ c_switch_stack = cs->next; @@ -8907,7 +8878,7 @@ void c_finish_if_stmt (location_t if_locus, tree cond, tree then_block, - tree else_block, bool nested_if) + tree else_block, bool nested_if) { tree stmt; @@ -8917,32 +8888,32 @@ tree inner_if = then_block; /* We know from the grammar productions that there is an IF nested - within THEN_BLOCK. Due to labels and c99 conditional declarations, - it might not be exactly THEN_BLOCK, but should be the last - non-container statement within. */ + within THEN_BLOCK. Due to labels and c99 conditional declarations, + it might not be exactly THEN_BLOCK, but should be the last + non-container statement within. */ while (1) - switch (TREE_CODE (inner_if)) - { - case COND_EXPR: - goto found; - case BIND_EXPR: - inner_if = BIND_EXPR_BODY (inner_if); - break; - case STATEMENT_LIST: - inner_if = expr_last (then_block); - break; - case TRY_FINALLY_EXPR: - case TRY_CATCH_EXPR: - inner_if = TREE_OPERAND (inner_if, 0); - break; - default: - gcc_unreachable (); - } + switch (TREE_CODE (inner_if)) + { + case COND_EXPR: + goto found; + case BIND_EXPR: + inner_if = BIND_EXPR_BODY (inner_if); + break; + case STATEMENT_LIST: + inner_if = expr_last (then_block); + break; + case TRY_FINALLY_EXPR: + case TRY_CATCH_EXPR: + inner_if = TREE_OPERAND (inner_if, 0); + break; + default: + gcc_unreachable (); + } found: if (COND_EXPR_ELSE (inner_if)) - warning_at (if_locus, OPT_Wparentheses, - "suggest explicit braces to avoid ambiguous %<else%>"); + warning_at (if_locus, OPT_Wparentheses, + "suggest explicit braces to avoid ambiguous %<else%>"); } stmt = build3 (COND_EXPR, void_type_node, cond, then_block, else_block); @@ -8958,7 +8929,7 @@ void c_finish_loop (location_t start_locus, tree cond, tree incr, tree body, - tree blab, tree clab, bool cond_is_first) + tree blab, tree clab, bool cond_is_first) { tree entry = NULL, exit = NULL, t; @@ -8966,47 +8937,47 @@ if (cond && integer_zerop (cond)) { if (cond_is_first) - { - t = build_and_jump (&blab); - SET_EXPR_LOCATION (t, start_locus); - add_stmt (t); - } + { + t = build_and_jump (&blab); + SET_EXPR_LOCATION (t, start_locus); + add_stmt (t); + } } else { tree top = build1 (LABEL_EXPR, void_type_node, NULL_TREE); /* If we have an exit condition, then we build an IF with gotos either - out of the loop, or to the top of it. If there's no exit condition, - then we just build a jump back to the top. */ + out of the loop, or to the top of it. If there's no exit condition, + then we just build a jump back to the top. */ exit = build_and_jump (&LABEL_EXPR_LABEL (top)); if (cond && !integer_nonzerop (cond)) - { - /* Canonicalize the loop condition to the end. This means - generating a branch to the loop condition. Reuse the - continue label, if possible. */ - if (cond_is_first) - { - if (incr || !clab) - { - entry = build1 (LABEL_EXPR, void_type_node, NULL_TREE); - t = build_and_jump (&LABEL_EXPR_LABEL (entry)); - } - else - t = build1 (GOTO_EXPR, void_type_node, clab); - SET_EXPR_LOCATION (t, start_locus); - add_stmt (t); - } - - t = build_and_jump (&blab); - if (cond_is_first) - exit = fold_build3_loc (start_locus, - COND_EXPR, void_type_node, cond, exit, t); - else - exit = fold_build3_loc (input_location, - COND_EXPR, void_type_node, cond, exit, t); - } + { + /* Canonicalize the loop condition to the end. This means + generating a branch to the loop condition. Reuse the + continue label, if possible. */ + if (cond_is_first) + { + if (incr || !clab) + { + entry = build1 (LABEL_EXPR, void_type_node, NULL_TREE); + t = build_and_jump (&LABEL_EXPR_LABEL (entry)); + } + else + t = build1 (GOTO_EXPR, void_type_node, clab); + SET_EXPR_LOCATION (t, start_locus); + add_stmt (t); + } + + t = build_and_jump (&blab); + if (cond_is_first) + exit = fold_build3_loc (start_locus, + COND_EXPR, void_type_node, cond, exit, t); + else + exit = fold_build3_loc (input_location, + COND_EXPR, void_type_node, cond, exit, t); + } add_stmt (top); } @@ -9043,7 +9014,7 @@ if (!label) { if (!skip) - *label_p = label = create_artificial_label (loc); + *label_p = label = create_artificial_label (loc); } else if (TREE_CODE (label) == LABEL_DECL) ; @@ -9051,9 +9022,9 @@ { case 0: if (is_break) - error_at (loc, "break statement not within loop or switch"); + error_at (loc, "break statement not within loop or switch"); else - error_at (loc, "continue statement not within a loop"); + error_at (loc, "continue statement not within a loop"); return NULL_TREE; case 1: @@ -9084,7 +9055,7 @@ else if (!TREE_SIDE_EFFECTS (expr)) { if (!VOID_TYPE_P (TREE_TYPE (expr)) && !TREE_NO_WARNING (expr)) - warning_at (loc, OPT_Wunused_value, "statement with no effect"); + warning_at (loc, OPT_Wunused_value, "statement with no effect"); } else warn_if_unused_value (expr, loc); @@ -9163,8 +9134,8 @@ ret = c_begin_compound_stmt (true); c_bindings_start_stmt_expr (c_switch_stack == NULL - ? NULL - : c_switch_stack->bindings); + ? NULL + : c_switch_stack->bindings); /* Mark the current statement list as belonging to a statement list. */ STATEMENT_LIST_STMT_EXPR (ret) = 1; @@ -9184,8 +9155,8 @@ body = c_end_compound_stmt (loc, body, true); c_bindings_end_stmt_expr (c_switch_stack == NULL - ? NULL - : c_switch_stack->bindings); + ? NULL + : c_switch_stack->bindings); /* Locate the last statement in BODY. See c_end_compound_stmt about always returning a BIND_EXPR. */ @@ -9199,23 +9170,23 @@ /* This can happen with degenerate cases like ({ }). No value. */ if (!TREE_SIDE_EFFECTS (last)) - return body; + return body; /* If we're supposed to generate side effects warnings, process - all of the statements except the last. */ + all of the statements except the last. */ if (warn_unused_value) - { - for (i = tsi_start (last); !tsi_one_before_end_p (i); tsi_next (&i)) - { - location_t tloc; - tree t = tsi_stmt (i); - - tloc = EXPR_HAS_LOCATION (t) ? EXPR_LOCATION (t) : loc; - emit_side_effect_warnings (tloc, t); - } - } + { + for (i = tsi_start (last); !tsi_one_before_end_p (i); tsi_next (&i)) + { + location_t tloc; + tree t = tsi_stmt (i); + + tloc = EXPR_HAS_LOCATION (t) ? EXPR_LOCATION (t) : loc; + emit_side_effect_warnings (tloc, t); + } + } else - i = tsi_last (last); + i = tsi_last (last); last_p = tsi_stmt_ptr (i); last = *last_p; } @@ -9239,10 +9210,10 @@ && BIND_EXPR_VARS (body) == NULL) { /* Even if this looks constant, do not allow it in a constant - expression. */ + expression. */ last = c_wrap_maybe_const (last, true); /* Do not warn if the return value of a statement expression is - unused. */ + unused. */ TREE_NO_WARNING (last) = 1; return last; } @@ -9301,7 +9272,7 @@ if (do_scope) { if (c_dialect_objc ()) - objc_clear_super_receiver (); + objc_clear_super_receiver (); block = pop_scope (); } @@ -9363,7 +9334,7 @@ tree build_binary_op (location_t location, enum tree_code code, - tree orig_op0, tree orig_op1, int convert_p) + tree orig_op0, tree orig_op1, int convert_p) { tree type0, type1, orig_type0, orig_type1; tree eptype; @@ -9447,10 +9418,10 @@ if (int_operands) { int_const_or_overflow = (TREE_CODE (orig_op0) == INTEGER_CST - && TREE_CODE (orig_op1) == INTEGER_CST); + && TREE_CODE (orig_op1) == INTEGER_CST); int_const = (int_const_or_overflow - && !TREE_OVERFLOW (orig_op0) - && !TREE_OVERFLOW (orig_op1)); + && !TREE_OVERFLOW (orig_op0) + && !TREE_OVERFLOW (orig_op1)); } else int_const = int_const_or_overflow = false; @@ -9508,7 +9479,7 @@ type0 = TREE_TYPE (op0); } else if (may_need_excess_precision - && (eptype = excess_precision_type (type0)) != NULL_TREE) + && (eptype = excess_precision_type (type0)) != NULL_TREE) { type0 = eptype; op0 = convert (eptype, op0); @@ -9519,7 +9490,7 @@ type1 = TREE_TYPE (op1); } else if (may_need_excess_precision - && (eptype = excess_precision_type (type1)) != NULL_TREE) + && (eptype = excess_precision_type (type1)) != NULL_TREE) { type1 = eptype; op1 = convert (eptype, op1); @@ -9532,36 +9503,36 @@ case PLUS_EXPR: /* Handle the pointer + int case. */ if (code0 == POINTER_TYPE && code1 == INTEGER_TYPE) - { - ret = pointer_int_sum (location, PLUS_EXPR, op0, op1); - goto return_build_binary_op; - } + { + ret = pointer_int_sum (location, PLUS_EXPR, op0, op1); + goto return_build_binary_op; + } else if (code1 == POINTER_TYPE && code0 == INTEGER_TYPE) - { - ret = pointer_int_sum (location, PLUS_EXPR, op1, op0); - goto return_build_binary_op; - } + { + ret = pointer_int_sum (location, PLUS_EXPR, op1, op0); + goto return_build_binary_op; + } else - common = 1; + common = 1; break; case MINUS_EXPR: /* Subtraction of two similar pointers. - We must subtract them as integers, then divide by object size. */ + We must subtract them as integers, then divide by object size. */ if (code0 == POINTER_TYPE && code1 == POINTER_TYPE - && comp_target_types (location, type0, type1)) - { - ret = pointer_diff (location, op0, op1); - goto return_build_binary_op; - } + && comp_target_types (location, type0, type1)) + { + ret = pointer_diff (location, op0, op1); + goto return_build_binary_op; + } /* Handle pointer minus int. Just like pointer plus int. */ else if (code0 == POINTER_TYPE && code1 == INTEGER_TYPE) - { - ret = pointer_int_sum (location, MINUS_EXPR, op0, op1); - goto return_build_binary_op; - } + { + ret = pointer_int_sum (location, MINUS_EXPR, op0, op1); + goto return_build_binary_op; + } else - common = 1; + common = 1; break; case MULT_EXPR: @@ -9576,46 +9547,46 @@ warn_for_div_by_zero (location, op1); if ((code0 == INTEGER_TYPE || code0 == REAL_TYPE - || code0 == FIXED_POINT_TYPE - || code0 == COMPLEX_TYPE || code0 == VECTOR_TYPE) - && (code1 == INTEGER_TYPE || code1 == REAL_TYPE - || code1 == FIXED_POINT_TYPE - || code1 == COMPLEX_TYPE || code1 == VECTOR_TYPE)) - { - enum tree_code tcode0 = code0, tcode1 = code1; - - if (code0 == COMPLEX_TYPE || code0 == VECTOR_TYPE) - tcode0 = TREE_CODE (TREE_TYPE (TREE_TYPE (op0))); - if (code1 == COMPLEX_TYPE || code1 == VECTOR_TYPE) - tcode1 = TREE_CODE (TREE_TYPE (TREE_TYPE (op1))); - - if (!((tcode0 == INTEGER_TYPE && tcode1 == INTEGER_TYPE) - || (tcode0 == FIXED_POINT_TYPE && tcode1 == FIXED_POINT_TYPE))) - resultcode = RDIV_EXPR; - else - /* Although it would be tempting to shorten always here, that - loses on some targets, since the modulo instruction is - undefined if the quotient can't be represented in the - computation mode. We shorten only if unsigned or if - dividing by something we know != -1. */ - shorten = (TYPE_UNSIGNED (TREE_TYPE (orig_op0)) - || (TREE_CODE (op1) == INTEGER_CST - && !integer_all_onesp (op1))); - common = 1; - } + || code0 == FIXED_POINT_TYPE + || code0 == COMPLEX_TYPE || code0 == VECTOR_TYPE) + && (code1 == INTEGER_TYPE || code1 == REAL_TYPE + || code1 == FIXED_POINT_TYPE + || code1 == COMPLEX_TYPE || code1 == VECTOR_TYPE)) + { + enum tree_code tcode0 = code0, tcode1 = code1; + + if (code0 == COMPLEX_TYPE || code0 == VECTOR_TYPE) + tcode0 = TREE_CODE (TREE_TYPE (TREE_TYPE (op0))); + if (code1 == COMPLEX_TYPE || code1 == VECTOR_TYPE) + tcode1 = TREE_CODE (TREE_TYPE (TREE_TYPE (op1))); + + if (!((tcode0 == INTEGER_TYPE && tcode1 == INTEGER_TYPE) + || (tcode0 == FIXED_POINT_TYPE && tcode1 == FIXED_POINT_TYPE))) + resultcode = RDIV_EXPR; + else + /* Although it would be tempting to shorten always here, that + loses on some targets, since the modulo instruction is + undefined if the quotient can't be represented in the + computation mode. We shorten only if unsigned or if + dividing by something we know != -1. */ + shorten = (TYPE_UNSIGNED (TREE_TYPE (orig_op0)) + || (TREE_CODE (op1) == INTEGER_CST + && !integer_all_onesp (op1))); + common = 1; + } break; case BIT_AND_EXPR: case BIT_IOR_EXPR: case BIT_XOR_EXPR: if (code0 == INTEGER_TYPE && code1 == INTEGER_TYPE) - shorten = -1; + shorten = -1; /* Allow vector types which are not floating point types. */ else if (code0 == VECTOR_TYPE - && code1 == VECTOR_TYPE - && !VECTOR_FLOAT_TYPE_P (type0) - && !VECTOR_FLOAT_TYPE_P (type1)) - common = 1; + && code1 == VECTOR_TYPE + && !VECTOR_FLOAT_TYPE_P (type0) + && !VECTOR_FLOAT_TYPE_P (type1)) + common = 1; break; case TRUNC_MOD_EXPR: @@ -9623,20 +9594,20 @@ warn_for_div_by_zero (location, op1); if (code0 == VECTOR_TYPE && code1 == VECTOR_TYPE - && TREE_CODE (TREE_TYPE (type0)) == INTEGER_TYPE - && TREE_CODE (TREE_TYPE (type1)) == INTEGER_TYPE) - common = 1; + && TREE_CODE (TREE_TYPE (type0)) == INTEGER_TYPE + && TREE_CODE (TREE_TYPE (type1)) == INTEGER_TYPE) + common = 1; else if (code0 == INTEGER_TYPE && code1 == INTEGER_TYPE) - { - /* Although it would be tempting to shorten always here, that loses - on some targets, since the modulo instruction is undefined if the - quotient can't be represented in the computation mode. We shorten - only if unsigned or if dividing by something we know != -1. */ - shorten = (TYPE_UNSIGNED (TREE_TYPE (orig_op0)) - || (TREE_CODE (op1) == INTEGER_CST - && !integer_all_onesp (op1))); - common = 1; - } + { + /* Although it would be tempting to shorten always here, that loses + on some targets, since the modulo instruction is undefined if the + quotient can't be represented in the computation mode. We shorten + only if unsigned or if dividing by something we know != -1. */ + shorten = (TYPE_UNSIGNED (TREE_TYPE (orig_op0)) + || (TREE_CODE (op1) == INTEGER_CST + && !integer_all_onesp (op1))); + common = 1; + } break; case TRUTH_ANDIF_EXPR: @@ -9661,32 +9632,32 @@ boolean_op = true; } if (code == TRUTH_ANDIF_EXPR) - { - int_const_or_overflow = (int_operands - && TREE_CODE (orig_op0) == INTEGER_CST - && (op0 == truthvalue_false_node - || TREE_CODE (orig_op1) == INTEGER_CST)); - int_const = (int_const_or_overflow - && !TREE_OVERFLOW (orig_op0) - && (op0 == truthvalue_false_node - || !TREE_OVERFLOW (orig_op1))); - } + { + int_const_or_overflow = (int_operands + && TREE_CODE (orig_op0) == INTEGER_CST + && (op0 == truthvalue_false_node + || TREE_CODE (orig_op1) == INTEGER_CST)); + int_const = (int_const_or_overflow + && !TREE_OVERFLOW (orig_op0) + && (op0 == truthvalue_false_node + || !TREE_OVERFLOW (orig_op1))); + } else if (code == TRUTH_ORIF_EXPR) - { - int_const_or_overflow = (int_operands - && TREE_CODE (orig_op0) == INTEGER_CST - && (op0 == truthvalue_true_node - || TREE_CODE (orig_op1) == INTEGER_CST)); - int_const = (int_const_or_overflow - && !TREE_OVERFLOW (orig_op0) - && (op0 == truthvalue_true_node - || !TREE_OVERFLOW (orig_op1))); - } + { + int_const_or_overflow = (int_operands + && TREE_CODE (orig_op0) == INTEGER_CST + && (op0 == truthvalue_true_node + || TREE_CODE (orig_op1) == INTEGER_CST)); + int_const = (int_const_or_overflow + && !TREE_OVERFLOW (orig_op0) + && (op0 == truthvalue_true_node + || !TREE_OVERFLOW (orig_op1))); + } break; /* Shift operations: result has same type as first operand; - always convert second operand to int. - Also set SHORT_SHIFT if shifting rightward. */ + always convert second operand to int. + Also set SHORT_SHIFT if shifting rightward. */ case RSHIFT_EXPR: if (code0 == VECTOR_TYPE && code1 == INTEGER_TYPE @@ -9790,11 +9761,11 @@ case EQ_EXPR: case NE_EXPR: if (FLOAT_TYPE_P (type0) || FLOAT_TYPE_P (type1)) - warning_at (location, - OPT_Wfloat_equal, - "comparing floating point with == or != is unsafe"); + warning_at (location, + OPT_Wfloat_equal, + "comparing floating point with == or != is unsafe"); /* Result of comparison is always int, - but don't convert the args to int! */ + but don't convert the args to int! */ build_type = integer_type_node; if ((code0 == INTEGER_TYPE || code0 == REAL_TYPE || code0 == FIXED_POINT_TYPE || code0 == COMPLEX_TYPE) @@ -9886,15 +9857,15 @@ } } else if (code0 == POINTER_TYPE && code1 == INTEGER_TYPE) - { - result_type = type0; - pedwarn (location, 0, "comparison between pointer and integer"); - } + { + result_type = type0; + pedwarn (location, 0, "comparison between pointer and integer"); + } else if (code0 == INTEGER_TYPE && code1 == POINTER_TYPE) - { - result_type = type1; - pedwarn (location, 0, "comparison between pointer and integer"); - } + { + result_type = type1; + pedwarn (location, 0, "comparison between pointer and integer"); + } break; case LE_EXPR: @@ -9903,10 +9874,10 @@ case GT_EXPR: build_type = integer_type_node; if ((code0 == INTEGER_TYPE || code0 == REAL_TYPE - || code0 == FIXED_POINT_TYPE) - && (code1 == INTEGER_TYPE || code1 == REAL_TYPE - || code1 == FIXED_POINT_TYPE)) - short_compare = 1; + || code0 == FIXED_POINT_TYPE) + && (code1 == INTEGER_TYPE || code1 == REAL_TYPE + || code1 == FIXED_POINT_TYPE)) + short_compare = 1; else if (code0 == POINTER_TYPE && code1 == POINTER_TYPE) { addr_space_t as0 = TYPE_ADDR_SPACE (TREE_TYPE (type0)); @@ -9965,15 +9936,15 @@ "ordered comparison of pointer with integer zero"); } else if (code0 == POINTER_TYPE && code1 == INTEGER_TYPE) - { - result_type = type0; - pedwarn (location, 0, "comparison between pointer and integer"); - } + { + result_type = type0; + pedwarn (location, 0, "comparison between pointer and integer"); + } else if (code0 == INTEGER_TYPE && code1 == POINTER_TYPE) - { - result_type = type1; - pedwarn (location, 0, "comparison between pointer and integer"); - } + { + result_type = type1; + pedwarn (location, 0, "comparison between pointer and integer"); + } break; default: @@ -9985,8 +9956,8 @@ if (code0 == VECTOR_TYPE && code1 == VECTOR_TYPE && (!tree_int_cst_equal (TYPE_SIZE (type0), TYPE_SIZE (type1)) - || !same_scalar_type_ignoring_signedness (TREE_TYPE (type0), - TREE_TYPE (type1)))) + || !same_scalar_type_ignoring_signedness (TREE_TYPE (type0), + TREE_TYPE (type1)))) { binary_op_error (location, code, type0, type1); return error_mark_node; @@ -10098,122 +10069,122 @@ } /* For certain operations (which identify themselves by shorten != 0) - if both args were extended from the same smaller type, - do the arithmetic in that type and then extend. - - shorten !=0 and !=1 indicates a bitwise operation. - For them, this optimization is safe only if - both args are zero-extended or both are sign-extended. - Otherwise, we might change the result. - Eg, (short)-1 | (unsigned short)-1 is (int)-1 - but calculated in (unsigned short) it would be (unsigned short)-1. */ + if both args were extended from the same smaller type, + do the arithmetic in that type and then extend. + + shorten !=0 and !=1 indicates a bitwise operation. + For them, this optimization is safe only if + both args are zero-extended or both are sign-extended. + Otherwise, we might change the result. + Eg, (short)-1 | (unsigned short)-1 is (int)-1 + but calculated in (unsigned short) it would be (unsigned short)-1. */ if (shorten && none_complex) - { - final_type = result_type; - result_type = shorten_binary_op (result_type, op0, op1, - shorten == -1); - } + { + final_type = result_type; + result_type = shorten_binary_op (result_type, op0, op1, + shorten == -1); + } /* Shifts can be shortened if shifting right. */ if (short_shift) - { - int unsigned_arg; - tree arg0 = get_narrower (op0, &unsigned_arg); - - final_type = result_type; - - if (arg0 == op0 && final_type == TREE_TYPE (op0)) - unsigned_arg = TYPE_UNSIGNED (TREE_TYPE (op0)); - - if (TYPE_PRECISION (TREE_TYPE (arg0)) < TYPE_PRECISION (result_type) - && tree_int_cst_sgn (op1) > 0 - /* We can shorten only if the shift count is less than the - number of bits in the smaller type size. */ - && compare_tree_int (op1, TYPE_PRECISION (TREE_TYPE (arg0))) < 0 - /* We cannot drop an unsigned shift after sign-extension. */ - && (!TYPE_UNSIGNED (final_type) || unsigned_arg)) - { - /* Do an unsigned shift if the operand was zero-extended. */ - result_type - = c_common_signed_or_unsigned_type (unsigned_arg, - TREE_TYPE (arg0)); - /* Convert value-to-be-shifted to that type. */ - if (TREE_TYPE (op0) != result_type) - op0 = convert (result_type, op0); - converted = 1; - } - } + { + int unsigned_arg; + tree arg0 = get_narrower (op0, &unsigned_arg); + + final_type = result_type; + + if (arg0 == op0 && final_type == TREE_TYPE (op0)) + unsigned_arg = TYPE_UNSIGNED (TREE_TYPE (op0)); + + if (TYPE_PRECISION (TREE_TYPE (arg0)) < TYPE_PRECISION (result_type) + && tree_int_cst_sgn (op1) > 0 + /* We can shorten only if the shift count is less than the + number of bits in the smaller type size. */ + && compare_tree_int (op1, TYPE_PRECISION (TREE_TYPE (arg0))) < 0 + /* We cannot drop an unsigned shift after sign-extension. */ + && (!TYPE_UNSIGNED (final_type) || unsigned_arg)) + { + /* Do an unsigned shift if the operand was zero-extended. */ + result_type + = c_common_signed_or_unsigned_type (unsigned_arg, + TREE_TYPE (arg0)); + /* Convert value-to-be-shifted to that type. */ + if (TREE_TYPE (op0) != result_type) + op0 = convert (result_type, op0); + converted = 1; + } + } /* Comparison operations are shortened too but differently. - They identify themselves by setting short_compare = 1. */ + They identify themselves by setting short_compare = 1. */ if (short_compare) - { - /* Don't write &op0, etc., because that would prevent op0 - from being kept in a register. - Instead, make copies of the our local variables and - pass the copies by reference, then copy them back afterward. */ - tree xop0 = op0, xop1 = op1, xresult_type = result_type; - enum tree_code xresultcode = resultcode; - tree val - = shorten_compare (&xop0, &xop1, &xresult_type, &xresultcode); - - if (val != 0) - { - ret = val; - goto return_build_binary_op; - } - - op0 = xop0, op1 = xop1; - converted = 1; - resultcode = xresultcode; - - if (c_inhibit_evaluation_warnings == 0) - { - bool op0_maybe_const = true; - bool op1_maybe_const = true; - tree orig_op0_folded, orig_op1_folded; - - if (in_late_binary_op) - { - orig_op0_folded = orig_op0; - orig_op1_folded = orig_op1; - } - else - { - /* Fold for the sake of possible warnings, as in - build_conditional_expr. This requires the - "original" values to be folded, not just op0 and - op1. */ - c_inhibit_evaluation_warnings++; - op0 = c_fully_fold (op0, require_constant_value, - &op0_maybe_const); - op1 = c_fully_fold (op1, require_constant_value, - &op1_maybe_const); - c_inhibit_evaluation_warnings--; - orig_op0_folded = c_fully_fold (orig_op0, - require_constant_value, - NULL); - orig_op1_folded = c_fully_fold (orig_op1, - require_constant_value, - NULL); - } - - if (warn_sign_compare) - warn_for_sign_compare (location, orig_op0_folded, - orig_op1_folded, op0, op1, - result_type, resultcode); - if (!in_late_binary_op) - { - if (!op0_maybe_const || TREE_CODE (op0) != INTEGER_CST) - op0 = c_wrap_maybe_const (op0, !op0_maybe_const); - if (!op1_maybe_const || TREE_CODE (op1) != INTEGER_CST) - op1 = c_wrap_maybe_const (op1, !op1_maybe_const); - } - } - } + { + /* Don't write &op0, etc., because that would prevent op0 + from being kept in a register. + Instead, make copies of the our local variables and + pass the copies by reference, then copy them back afterward. */ + tree xop0 = op0, xop1 = op1, xresult_type = result_type; + enum tree_code xresultcode = resultcode; + tree val + = shorten_compare (&xop0, &xop1, &xresult_type, &xresultcode); + + if (val != 0) + { + ret = val; + goto return_build_binary_op; + } + + op0 = xop0, op1 = xop1; + converted = 1; + resultcode = xresultcode; + + if (c_inhibit_evaluation_warnings == 0) + { + bool op0_maybe_const = true; + bool op1_maybe_const = true; + tree orig_op0_folded, orig_op1_folded; + + if (in_late_binary_op) + { + orig_op0_folded = orig_op0; + orig_op1_folded = orig_op1; + } + else + { + /* Fold for the sake of possible warnings, as in + build_conditional_expr. This requires the + "original" values to be folded, not just op0 and + op1. */ + c_inhibit_evaluation_warnings++; + op0 = c_fully_fold (op0, require_constant_value, + &op0_maybe_const); + op1 = c_fully_fold (op1, require_constant_value, + &op1_maybe_const); + c_inhibit_evaluation_warnings--; + orig_op0_folded = c_fully_fold (orig_op0, + require_constant_value, + NULL); + orig_op1_folded = c_fully_fold (orig_op1, + require_constant_value, + NULL); + } + + if (warn_sign_compare) + warn_for_sign_compare (location, orig_op0_folded, + orig_op1_folded, op0, op1, + result_type, resultcode); + if (!in_late_binary_op) + { + if (!op0_maybe_const || TREE_CODE (op0) != INTEGER_CST) + op0 = c_wrap_maybe_const (op0, !op0_maybe_const); + if (!op1_maybe_const || TREE_CODE (op1) != INTEGER_CST) + op1 = c_wrap_maybe_const (op1, !op1_maybe_const); + } + } + } } /* At this point, RESULT_TYPE must be nonzero to avoid an error message. @@ -10245,17 +10216,17 @@ op1 = ep_convert_and_check (result_type, op1, semantic_result_type); /* This can happen if one operand has a vector type, and the other - has a different type. */ + has a different type. */ if (TREE_CODE (op0) == ERROR_MARK || TREE_CODE (op1) == ERROR_MARK) - return error_mark_node; + return error_mark_node; } /* Treat expressions in initializers specially as they can't trap. */ if (int_const_or_overflow) ret = (require_constant_value - ? fold_build2_initializer_loc (location, resultcode, build_type, - op0, op1) - : fold_build2_loc (location, resultcode, build_type, op0, op1)); + ? fold_build2_initializer_loc (location, resultcode, build_type, + op0, op1) + : fold_build2_loc (location, resultcode, build_type, op0, op1)); else ret = build2 (resultcode, build_type, op0, op1); if (final_type != 0) @@ -10265,10 +10236,10 @@ gcc_assert (ret != error_mark_node); if (TREE_CODE (ret) == INTEGER_CST && !TREE_OVERFLOW (ret) && !int_const) ret = (int_operands - ? note_integer_operands (ret) - : build1 (NOP_EXPR, TREE_TYPE (ret), ret)); + ? note_integer_operands (ret) + : build1 (NOP_EXPR, TREE_TYPE (ret), ret)); else if (TREE_CODE (ret) != INTEGER_CST && int_operands - && !in_late_binary_op) + && !in_late_binary_op) ret = note_integer_operands (ret); if (semantic_result_type) ret = build1 (EXCESS_PRECISION_EXPR, semantic_result_type, ret); @@ -10322,9 +10293,9 @@ if (TREE_CODE (expr) == INTEGER_CST && int_operands && !int_const) { if (TREE_OVERFLOW (expr)) - return expr; + return expr; else - return note_integer_operands (expr); + return note_integer_operands (expr); } if (TREE_CODE (expr) == INTEGER_CST && !int_const) return build1 (NOP_EXPR, TREE_TYPE (expr), expr); @@ -10342,9 +10313,9 @@ { tree decl = COMPOUND_LITERAL_EXPR_DECL (expr); /* Executing a compound literal inside a function reinitializes - it. */ + it. */ if (!TREE_STATIC (decl)) - *se = true; + *se = true; return decl; } else @@ -10437,206 +10408,206 @@ bool need_implicitly_determined = false; switch (OMP_CLAUSE_CODE (c)) - { - case OMP_CLAUSE_SHARED: - name = "shared"; - need_implicitly_determined = true; - goto check_dup_generic; - - case OMP_CLAUSE_PRIVATE: - name = "private"; - need_complete = true; - need_implicitly_determined = true; - goto check_dup_generic; - - case OMP_CLAUSE_REDUCTION: - name = "reduction"; - need_implicitly_determined = true; - t = OMP_CLAUSE_DECL (c); - if (AGGREGATE_TYPE_P (TREE_TYPE (t)) - || POINTER_TYPE_P (TREE_TYPE (t))) - { - error_at (OMP_CLAUSE_LOCATION (c), - "%qE has invalid type for %<reduction%>", t); - remove = true; - } - else if (FLOAT_TYPE_P (TREE_TYPE (t))) - { - enum tree_code r_code = OMP_CLAUSE_REDUCTION_CODE (c); - const char *r_name = NULL; - - switch (r_code) - { - case PLUS_EXPR: - case MULT_EXPR: - case MINUS_EXPR: - break; - case BIT_AND_EXPR: - r_name = "&"; - break; - case BIT_XOR_EXPR: - r_name = "^"; - break; - case BIT_IOR_EXPR: - r_name = "|"; - break; - case TRUTH_ANDIF_EXPR: - r_name = "&&"; - break; - case TRUTH_ORIF_EXPR: - r_name = "||"; - break; - default: - gcc_unreachable (); - } - if (r_name) - { - error_at (OMP_CLAUSE_LOCATION (c), - "%qE has invalid type for %<reduction(%s)%>", - t, r_name); - remove = true; - } - } - goto check_dup_generic; - - case OMP_CLAUSE_COPYPRIVATE: - name = "copyprivate"; - goto check_dup_generic; - - case OMP_CLAUSE_COPYIN: - name = "copyin"; - t = OMP_CLAUSE_DECL (c); - if (TREE_CODE (t) != VAR_DECL || !DECL_THREAD_LOCAL_P (t)) - { - error_at (OMP_CLAUSE_LOCATION (c), - "%qE must be %<threadprivate%> for %<copyin%>", t); - remove = true; - } - goto check_dup_generic; - - check_dup_generic: - t = OMP_CLAUSE_DECL (c); - if (TREE_CODE (t) != VAR_DECL && TREE_CODE (t) != PARM_DECL) - { - error_at (OMP_CLAUSE_LOCATION (c), - "%qE is not a variable in clause %qs", t, name); - remove = true; - } - else if (bitmap_bit_p (&generic_head, DECL_UID (t)) - || bitmap_bit_p (&firstprivate_head, DECL_UID (t)) - || bitmap_bit_p (&lastprivate_head, DECL_UID (t))) - { - error_at (OMP_CLAUSE_LOCATION (c), - "%qE appears more than once in data clauses", t); - remove = true; - } - else - bitmap_set_bit (&generic_head, DECL_UID (t)); - break; - - case OMP_CLAUSE_FIRSTPRIVATE: - name = "firstprivate"; - t = OMP_CLAUSE_DECL (c); - need_complete = true; - need_implicitly_determined = true; - if (TREE_CODE (t) != VAR_DECL && TREE_CODE (t) != PARM_DECL) - { - error_at (OMP_CLAUSE_LOCATION (c), - "%qE is not a variable in clause %<firstprivate%>", t); - remove = true; - } - else if (bitmap_bit_p (&generic_head, DECL_UID (t)) - || bitmap_bit_p (&firstprivate_head, DECL_UID (t))) - { - error_at (OMP_CLAUSE_LOCATION (c), - "%qE appears more than once in data clauses", t); - remove = true; - } - else - bitmap_set_bit (&firstprivate_head, DECL_UID (t)); - break; - - case OMP_CLAUSE_LASTPRIVATE: - name = "lastprivate"; - t = OMP_CLAUSE_DECL (c); - need_complete = true; - need_implicitly_determined = true; - if (TREE_CODE (t) != VAR_DECL && TREE_CODE (t) != PARM_DECL) - { - error_at (OMP_CLAUSE_LOCATION (c), - "%qE is not a variable in clause %<lastprivate%>", t); - remove = true; - } - else if (bitmap_bit_p (&generic_head, DECL_UID (t)) - || bitmap_bit_p (&lastprivate_head, DECL_UID (t))) - { - error_at (OMP_CLAUSE_LOCATION (c), - "%qE appears more than once in data clauses", t); - remove = true; - } - else - bitmap_set_bit (&lastprivate_head, DECL_UID (t)); - break; - - case OMP_CLAUSE_IF: - case OMP_CLAUSE_NUM_THREADS: - case OMP_CLAUSE_SCHEDULE: - case OMP_CLAUSE_NOWAIT: - case OMP_CLAUSE_ORDERED: - case OMP_CLAUSE_DEFAULT: - case OMP_CLAUSE_UNTIED: - case OMP_CLAUSE_COLLAPSE: - pc = &OMP_CLAUSE_CHAIN (c); - continue; - - default: - gcc_unreachable (); - } + { + case OMP_CLAUSE_SHARED: + name = "shared"; + need_implicitly_determined = true; + goto check_dup_generic; + + case OMP_CLAUSE_PRIVATE: + name = "private"; + need_complete = true; + need_implicitly_determined = true; + goto check_dup_generic; + + case OMP_CLAUSE_REDUCTION: + name = "reduction"; + need_implicitly_determined = true; + t = OMP_CLAUSE_DECL (c); + if (AGGREGATE_TYPE_P (TREE_TYPE (t)) + || POINTER_TYPE_P (TREE_TYPE (t))) + { + error_at (OMP_CLAUSE_LOCATION (c), + "%qE has invalid type for %<reduction%>", t); + remove = true; + } + else if (FLOAT_TYPE_P (TREE_TYPE (t))) + { + enum tree_code r_code = OMP_CLAUSE_REDUCTION_CODE (c); + const char *r_name = NULL; + + switch (r_code) + { + case PLUS_EXPR: + case MULT_EXPR: + case MINUS_EXPR: + break; + case BIT_AND_EXPR: + r_name = "&"; + break; + case BIT_XOR_EXPR: + r_name = "^"; + break; + case BIT_IOR_EXPR: + r_name = "|"; + break; + case TRUTH_ANDIF_EXPR: + r_name = "&&"; + break; + case TRUTH_ORIF_EXPR: + r_name = "||"; + break; + default: + gcc_unreachable (); + } + if (r_name) + { + error_at (OMP_CLAUSE_LOCATION (c), + "%qE has invalid type for %<reduction(%s)%>", + t, r_name); + remove = true; + } + } + goto check_dup_generic; + + case OMP_CLAUSE_COPYPRIVATE: + name = "copyprivate"; + goto check_dup_generic; + + case OMP_CLAUSE_COPYIN: + name = "copyin"; + t = OMP_CLAUSE_DECL (c); + if (TREE_CODE (t) != VAR_DECL || !DECL_THREAD_LOCAL_P (t)) + { + error_at (OMP_CLAUSE_LOCATION (c), + "%qE must be %<threadprivate%> for %<copyin%>", t); + remove = true; + } + goto check_dup_generic; + + check_dup_generic: + t = OMP_CLAUSE_DECL (c); + if (TREE_CODE (t) != VAR_DECL && TREE_CODE (t) != PARM_DECL) + { + error_at (OMP_CLAUSE_LOCATION (c), + "%qE is not a variable in clause %qs", t, name); + remove = true; + } + else if (bitmap_bit_p (&generic_head, DECL_UID (t)) + || bitmap_bit_p (&firstprivate_head, DECL_UID (t)) + || bitmap_bit_p (&lastprivate_head, DECL_UID (t))) + { + error_at (OMP_CLAUSE_LOCATION (c), + "%qE appears more than once in data clauses", t); + remove = true; + } + else + bitmap_set_bit (&generic_head, DECL_UID (t)); + break; + + case OMP_CLAUSE_FIRSTPRIVATE: + name = "firstprivate"; + t = OMP_CLAUSE_DECL (c); + need_complete = true; + need_implicitly_determined = true; + if (TREE_CODE (t) != VAR_DECL && TREE_CODE (t) != PARM_DECL) + { + error_at (OMP_CLAUSE_LOCATION (c), + "%qE is not a variable in clause %<firstprivate%>", t); + remove = true; + } + else if (bitmap_bit_p (&generic_head, DECL_UID (t)) + || bitmap_bit_p (&firstprivate_head, DECL_UID (t))) + { + error_at (OMP_CLAUSE_LOCATION (c), + "%qE appears more than once in data clauses", t); + remove = true; + } + else + bitmap_set_bit (&firstprivate_head, DECL_UID (t)); + break; + + case OMP_CLAUSE_LASTPRIVATE: + name = "lastprivate"; + t = OMP_CLAUSE_DECL (c); + need_complete = true; + need_implicitly_determined = true; + if (TREE_CODE (t) != VAR_DECL && TREE_CODE (t) != PARM_DECL) + { + error_at (OMP_CLAUSE_LOCATION (c), + "%qE is not a variable in clause %<lastprivate%>", t); + remove = true; + } + else if (bitmap_bit_p (&generic_head, DECL_UID (t)) + || bitmap_bit_p (&lastprivate_head, DECL_UID (t))) + { + error_at (OMP_CLAUSE_LOCATION (c), + "%qE appears more than once in data clauses", t); + remove = true; + } + else + bitmap_set_bit (&lastprivate_head, DECL_UID (t)); + break; + + case OMP_CLAUSE_IF: + case OMP_CLAUSE_NUM_THREADS: + case OMP_CLAUSE_SCHEDULE: + case OMP_CLAUSE_NOWAIT: + case OMP_CLAUSE_ORDERED: + case OMP_CLAUSE_DEFAULT: + case OMP_CLAUSE_UNTIED: + case OMP_CLAUSE_COLLAPSE: + pc = &OMP_CLAUSE_CHAIN (c); + continue; + + default: + gcc_unreachable (); + } if (!remove) - { - t = OMP_CLAUSE_DECL (c); - - if (need_complete) - { - t = require_complete_type (t); - if (t == error_mark_node) - remove = true; - } - - if (need_implicitly_determined) - { - const char *share_name = NULL; - - if (TREE_CODE (t) == VAR_DECL && DECL_THREAD_LOCAL_P (t)) - share_name = "threadprivate"; - else switch (c_omp_predetermined_sharing (t)) - { - case OMP_CLAUSE_DEFAULT_UNSPECIFIED: - break; - case OMP_CLAUSE_DEFAULT_SHARED: - share_name = "shared"; - break; - case OMP_CLAUSE_DEFAULT_PRIVATE: - share_name = "private"; - break; - default: - gcc_unreachable (); - } - if (share_name) - { - error_at (OMP_CLAUSE_LOCATION (c), - "%qE is predetermined %qs for %qs", - t, share_name, name); - remove = true; - } - } - } + { + t = OMP_CLAUSE_DECL (c); + + if (need_complete) + { + t = require_complete_type (t); + if (t == error_mark_node) + remove = true; + } + + if (need_implicitly_determined) + { + const char *share_name = NULL; + + if (TREE_CODE (t) == VAR_DECL && DECL_THREAD_LOCAL_P (t)) + share_name = "threadprivate"; + else switch (c_omp_predetermined_sharing (t)) + { + case OMP_CLAUSE_DEFAULT_UNSPECIFIED: + break; + case OMP_CLAUSE_DEFAULT_SHARED: + share_name = "shared"; + break; + case OMP_CLAUSE_DEFAULT_PRIVATE: + share_name = "private"; + break; + default: + gcc_unreachable (); + } + if (share_name) + { + error_at (OMP_CLAUSE_LOCATION (c), + "%qE is predetermined %qs for %qs", + t, share_name, name); + remove = true; + } + } + } if (remove) - *pc = OMP_CLAUSE_CHAIN (c); + *pc = OMP_CLAUSE_CHAIN (c); else - pc = &OMP_CLAUSE_CHAIN (c); + pc = &OMP_CLAUSE_CHAIN (c); } bitmap_obstack_release (NULL); @@ -10656,24 +10627,24 @@ { tree t; tree element_type = c_build_qualified_type (TREE_TYPE (type), - type_quals); + type_quals); /* See if we already have an identically qualified type. */ for (t = TYPE_MAIN_VARIANT (type); t; t = TYPE_NEXT_VARIANT (t)) - { - if (TYPE_QUALS (strip_array_types (t)) == type_quals - && TYPE_NAME (t) == TYPE_NAME (type) - && TYPE_CONTEXT (t) == TYPE_CONTEXT (type) - && attribute_list_equal (TYPE_ATTRIBUTES (t), - TYPE_ATTRIBUTES (type))) - break; - } + { + if (TYPE_QUALS (strip_array_types (t)) == type_quals + && TYPE_NAME (t) == TYPE_NAME (type) + && TYPE_CONTEXT (t) == TYPE_CONTEXT (type) + && attribute_list_equal (TYPE_ATTRIBUTES (t), + TYPE_ATTRIBUTES (type))) + break; + } if (!t) - { + { tree domain = TYPE_DOMAIN (type); - t = build_variant_type_copy (type); - TREE_TYPE (t) = element_type; + t = build_variant_type_copy (type); + TREE_TYPE (t) = element_type; if (TYPE_STRUCTURAL_EQUALITY_P (element_type) || (domain && TYPE_STRUCTURAL_EQUALITY_P (domain))) @@ -10690,7 +10661,7 @@ } else TYPE_CANONICAL (t) = t; - } + } return t; } @@ -10699,7 +10670,7 @@ REFERENCE_TYPEs, which is appropriate for C++. */ if ((type_quals & TYPE_QUAL_RESTRICT) && (!POINTER_TYPE_P (type) - || !C_TYPE_OBJECT_OR_INCOMPLETE_P (TREE_TYPE (type)))) + || !C_TYPE_OBJECT_OR_INCOMPLETE_P (TREE_TYPE (type)))) { error ("invalid use of %<restrict%>"); type_quals &= ~TYPE_QUAL_RESTRICT; @@ -10715,6 +10686,6 @@ { if (warn_cxx_compat && TREE_CODE (type) == ENUMERAL_TYPE) warning_at (loc, OPT_Wc___compat, - "C++ requires promoted type, not enum type, in %<va_arg%>"); + "C++ requires promoted type, not enum type, in %<va_arg%>"); return build_va_arg (loc, expr, type); }