aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-family/c-common.cc
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <aldot@gcc.gnu.org>2023-05-14 00:54:54 +0200
committerBernhard Reutner-Fischer <aldot@gcc.gnu.org>2023-05-18 21:50:46 +0200
commit9157b213f560fc7539a429075a3f1b6826e45523 (patch)
treef1584c6504642888aac43c32b5b196a6dd311d72 /gcc/c-family/c-common.cc
parent22ab4ed58b343cd911c52177e6f7713420bc3aa9 (diff)
downloadgcc-9157b213f560fc7539a429075a3f1b6826e45523.zip
gcc-9157b213f560fc7539a429075a3f1b6826e45523.tar.gz
gcc-9157b213f560fc7539a429075a3f1b6826e45523.tar.bz2
c: use _P() defines from tree.h
gcc/c-family/ChangeLog: * c-ada-spec.cc (has_static_fields): Use _P() defines from tree.h. (dump_ada_declaration): Ditto. (dump_ada_structure): Ditto. * c-common.cc (unsafe_conversion_p): Ditto. (shorten_compare): Ditto. (pointer_int_sum): Ditto. (c_common_truthvalue_conversion): Ditto. (scalar_to_vector): Ditto. * c-common.h (gnu_vector_type_p): Ditto. * c-omp.cc (c_omp_depend_t_p): Ditto. (c_omp_split_clauses): Ditto. * c-ubsan.cc (ubsan_instrument_division): Ditto. * c-warn.cc (conversion_warning): Ditto. (warnings_for_convert_and_check): Ditto. gcc/c/ChangeLog: * c-convert.cc (c_convert): Ditto. * c-decl.cc (merge_decls): Ditto. * c-parser.cc (c_parser_omp_clause_reduction): Ditto. (c_parser_omp_declare_reduction): Ditto. * c-typeck.cc (build_component_ref): Ditto. (convert_argument): Ditto. (pointer_diff): Ditto. (build_unary_op): Ditto. (build_c_cast): Ditto. (build_modify_expr): Ditto. (store_init_value): Ditto. (constexpr_init_fits_real_type): Ditto. (check_constexpr_init): Ditto. (c_finish_return): Ditto. (handle_omp_array_sections_1): Ditto. (c_finish_omp_clauses): Ditto. * gimple-parser.cc (c_finish_gimple_return): Ditto. libcc1/ChangeLog: * libcc1plugin.cc (plugin_float_type): Ditto. * libcp1plugin.cc (plugin_reactivate_decl): Ditto. (plugin_get_float_type): Ditto.
Diffstat (limited to 'gcc/c-family/c-common.cc')
-rw-r--r--gcc/c-family/c-common.cc32
1 files changed, 16 insertions, 16 deletions
diff --git a/gcc/c-family/c-common.cc b/gcc/c-family/c-common.cc
index 2b4c82f..9c8eed5 100644
--- a/gcc/c-family/c-common.cc
+++ b/gcc/c-family/c-common.cc
@@ -1483,7 +1483,7 @@ unsafe_conversion_p (tree type, tree expr, tree result, bool check_sign)
/* Warn for real constant that is not an exact integer converted
to integer type. */
- if (TREE_CODE (expr_type) == REAL_TYPE
+ if (SCALAR_FLOAT_TYPE_P (expr_type)
&& TREE_CODE (type) == INTEGER_TYPE)
{
if (!real_isinteger (TREE_REAL_CST_PTR (expr), TYPE_MODE (expr_type)))
@@ -1508,7 +1508,7 @@ unsafe_conversion_p (tree type, tree expr, tree result, bool check_sign)
else
give_warning = UNSAFE_OTHER;
}
- else if (TREE_CODE (type) == REAL_TYPE)
+ else if (SCALAR_FLOAT_TYPE_P (type))
{
/* Warn for an integer constant that does not fit into real type. */
if (TREE_CODE (expr_type) == INTEGER_TYPE)
@@ -1519,7 +1519,7 @@ unsafe_conversion_p (tree type, tree expr, tree result, bool check_sign)
}
/* Warn for a real constant that does not fit into a smaller
real type. */
- else if (TREE_CODE (expr_type) == REAL_TYPE
+ else if (SCALAR_FLOAT_TYPE_P (expr_type)
&& TYPE_PRECISION (type) < TYPE_PRECISION (expr_type))
{
REAL_VALUE_TYPE a = TREE_REAL_CST (expr);
@@ -1579,7 +1579,7 @@ unsafe_conversion_p (tree type, tree expr, tree result, bool check_sign)
else
{
/* Warn for real types converted to integer types. */
- if (TREE_CODE (expr_type) == REAL_TYPE
+ if (SCALAR_FLOAT_TYPE_P (expr_type)
&& TREE_CODE (type) == INTEGER_TYPE)
give_warning = UNSAFE_REAL;
@@ -1651,7 +1651,7 @@ unsafe_conversion_p (tree type, tree expr, tree result, bool check_sign)
all the range of values of the integer type cannot be
represented by the real type. */
else if (TREE_CODE (expr_type) == INTEGER_TYPE
- && TREE_CODE (type) == REAL_TYPE)
+ && SCALAR_FLOAT_TYPE_P (type))
{
/* Don't warn about char y = 0xff; float x = (int) y; */
expr = get_unwidened (expr, 0);
@@ -1662,8 +1662,8 @@ unsafe_conversion_p (tree type, tree expr, tree result, bool check_sign)
}
/* Warn for real types converted to smaller real types. */
- else if (TREE_CODE (expr_type) == REAL_TYPE
- && TREE_CODE (type) == REAL_TYPE
+ else if (SCALAR_FLOAT_TYPE_P (expr_type)
+ && SCALAR_FLOAT_TYPE_P (type)
&& TYPE_PRECISION (type) < TYPE_PRECISION (expr_type))
give_warning = UNSAFE_REAL;
@@ -1677,13 +1677,13 @@ unsafe_conversion_p (tree type, tree expr, tree result, bool check_sign)
tree to_type = TREE_TYPE (type);
/* Warn for real types converted to integer types. */
- if (TREE_CODE (from_type) == REAL_TYPE
+ if (SCALAR_FLOAT_TYPE_P (from_type)
&& TREE_CODE (to_type) == INTEGER_TYPE)
give_warning = UNSAFE_REAL;
/* Warn for real types converted to smaller real types. */
- else if (TREE_CODE (from_type) == REAL_TYPE
- && TREE_CODE (to_type) == REAL_TYPE
+ else if (SCALAR_FLOAT_TYPE_P (from_type)
+ && SCALAR_FLOAT_TYPE_P (to_type)
&& TYPE_PRECISION (to_type) < TYPE_PRECISION (from_type))
give_warning = UNSAFE_REAL;
@@ -1706,7 +1706,7 @@ unsafe_conversion_p (tree type, tree expr, tree result, bool check_sign)
give_warning = UNSAFE_SIGN;
}
else if (TREE_CODE (from_type) == INTEGER_TYPE
- && TREE_CODE (to_type) == REAL_TYPE
+ && SCALAR_FLOAT_TYPE_P (to_type)
&& !int_safely_convertible_to_real_p (from_type, to_type))
give_warning = UNSAFE_OTHER;
}
@@ -2951,8 +2951,8 @@ shorten_compare (location_t loc, tree *op0_ptr, tree *op1_ptr,
unsignedp1 = TYPE_UNSIGNED (TREE_TYPE (op1));
/* If one of the operands must be floated, we cannot optimize. */
- real1 = TREE_CODE (TREE_TYPE (primop0)) == REAL_TYPE;
- real2 = TREE_CODE (TREE_TYPE (primop1)) == REAL_TYPE;
+ real1 = SCALAR_FLOAT_TYPE_P (TREE_TYPE (primop0));
+ real2 = SCALAR_FLOAT_TYPE_P (TREE_TYPE (primop1));
/* If first arg is constant, swap the args (changing operation
so value is preserved), for canonicalization. Don't do this if
@@ -3283,7 +3283,7 @@ pointer_int_sum (location_t loc, enum tree_code resultcode,
/* The result is a pointer of the same type that is being added. */
tree result_type = TREE_TYPE (ptrop);
- if (TREE_CODE (TREE_TYPE (result_type)) == VOID_TYPE)
+ if (VOID_TYPE_P (TREE_TYPE (result_type)))
{
if (complain && warn_pointer_arith)
pedwarn (loc, OPT_Wpointer_arith,
@@ -3730,7 +3730,7 @@ c_common_truthvalue_conversion (location_t location, tree expr)
goto ret;
}
- if (TREE_CODE (TREE_TYPE (expr)) == FIXED_POINT_TYPE)
+ if (FIXED_POINT_TYPE_P (TREE_TYPE (expr)))
{
tree fixed_zero_node = build_fixed (TREE_TYPE (expr),
FCONST0 (TYPE_MODE
@@ -8649,7 +8649,7 @@ scalar_to_vector (location_t loc, enum tree_code code, tree op0, tree op1,
}
else if (!integer_only_op
/* Allow integer --> real conversion if safe. */
- && (TREE_CODE (type0) == REAL_TYPE
+ && (SCALAR_FLOAT_TYPE_P (type0)
|| TREE_CODE (type0) == INTEGER_TYPE)
&& SCALAR_FLOAT_TYPE_P (TREE_TYPE (type1)))
{