return false;
for (tree fld = TYPE_FIELDS (type); fld; fld = TREE_CHAIN (fld))
- if (TREE_CODE (fld) == VAR_DECL && DECL_NAME (fld))
+ if (VAR_P (fld) && DECL_NAME (fld))
return true;
return false;
if (need_indent)
INDENT (spc);
- if ((TREE_CODE (t) == FIELD_DECL || TREE_CODE (t) == VAR_DECL)
+ if ((TREE_CODE (t) == FIELD_DECL || VAR_P (t))
&& DECL_NAME (t))
check_type_name_conflict (buffer, t);
/* Print the static fields of the structure, if any. */
for (tree tmp = TYPE_FIELDS (node); tmp; tmp = TREE_CHAIN (tmp))
{
- if (TREE_CODE (tmp) == VAR_DECL && DECL_NAME (tmp))
+ if (VAR_P (tmp) && DECL_NAME (tmp))
{
if (need_semicolon)
{
/* 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)))
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)
}
/* 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);
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;
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);
}
/* 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;
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;
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;
}
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
/* 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,
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
}
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)))
{
inline bool
gnu_vector_type_p (const_tree type)
{
- return TREE_CODE (type) == VECTOR_TYPE && !TYPE_INDIVISIBLE_P (type);
+ return VECTOR_TYPE_P (type) && !TYPE_INDIVISIBLE_P (type);
}
struct visibility_flags
&& ((TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
? DECL_NAME (TYPE_NAME (type)) : TYPE_NAME (type))
== get_identifier ("omp_depend_t"))
- && (!TYPE_CONTEXT (type)
- || TREE_CODE (TYPE_CONTEXT (type)) == TRANSLATION_UNIT_DECL)
+ && TYPE_FILE_SCOPE_P (type)
&& COMPLETE_TYPE_P (type)
&& TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST
&& !compare_tree_int (TYPE_SIZE (type),
if (TREE_CODE (t) == POINTER_PLUS_EXPR)
t = TREE_OPERAND (t, 0);
if (TREE_CODE (t) == ADDR_EXPR
- || TREE_CODE (t) == INDIRECT_REF)
+ || INDIRECT_REF_P (t))
t = TREE_OPERAND (t, 0);
if (DECL_P (t))
bitmap_clear_bit (&allocate_head, DECL_UID (t));
&& sanitize_flags_p (SANITIZE_DIVIDE))
t = fold_build2 (EQ_EXPR, boolean_type_node,
op1, build_int_cst (type, 0));
- else if (TREE_CODE (type) == REAL_TYPE
+ else if (SCALAR_FLOAT_TYPE_P (type)
&& sanitize_flags_p (SANITIZE_FLOAT_DIVIDE))
{
t = fold_build2 (EQ_EXPR, boolean_type_node,
{
bool cstresult
= (result
- && TREE_CODE_CLASS (TREE_CODE (result)) == tcc_constant);
+ && CONSTANT_CLASS_P (result));
if (TYPE_UNSIGNED (type))
{
if (cstresult)
expr_type, type, expr);
}
}
- else if (TREE_CODE_CLASS (TREE_CODE (result)) == tcc_constant)
+ else if (CONSTANT_CLASS_P (result))
warning_at (loc, warnopt,
"conversion from %qT to %qT changes value from %qE to %qE",
expr_type, type, expr, result);
while (TREE_CODE (result) == COMPOUND_EXPR)
result = TREE_OPERAND (result, 1);
- bool cst = TREE_CODE_CLASS (TREE_CODE (result)) == tcc_constant;
+ bool cst = CONSTANT_CLASS_P (result);
tree exprtype = TREE_TYPE (expr);
tree result_diag;
/* We're interested in the actual numerical value here, not its ASCII
return fold_convert_loc (loc, type, expr);
if (TREE_CODE (TREE_TYPE (expr)) == ERROR_MARK)
return error_mark_node;
- if (TREE_CODE (TREE_TYPE (expr)) == VOID_TYPE)
+ if (VOID_TYPE_P (TREE_TYPE (expr)))
{
error ("void value not ignored as it ought to be");
return error_mark_node;
case INTEGER_TYPE:
if (sanitize_flags_p (SANITIZE_FLOAT_CAST)
&& current_function_decl != NULL_TREE
- && TREE_CODE (TREE_TYPE (expr)) == REAL_TYPE
+ && SCALAR_FLOAT_TYPE_P (TREE_TYPE (expr))
&& COMPLETE_TYPE_P (type))
{
expr = save_expr (expr);
system header. Otherwise, keep source location of definition rather than
declaration and of prototype rather than non-prototype unless that
prototype is built-in. */
- if (CODE_CONTAINS_STRUCT (TREE_CODE (olddecl), TS_DECL_WITH_VIS)
+ if (HAS_DECL_ASSEMBLER_NAME_P (olddecl)
&& DECL_IN_SYSTEM_HEADER (olddecl)
&& !DECL_IN_SYSTEM_HEADER (newdecl) )
DECL_SOURCE_LOCATION (newdecl) = DECL_SOURCE_LOCATION (olddecl);
- else if (CODE_CONTAINS_STRUCT (TREE_CODE (olddecl), TS_DECL_WITH_VIS)
+ else if (HAS_DECL_ASSEMBLER_NAME_P (olddecl)
&& DECL_IN_SYSTEM_HEADER (newdecl)
&& !DECL_IN_SYSTEM_HEADER (olddecl))
DECL_SOURCE_LOCATION (olddecl) = DECL_SOURCE_LOCATION (newdecl);
if (VAR_P (olddecl) && C_DECL_THREADPRIVATE_P (olddecl))
C_DECL_THREADPRIVATE_P (newdecl) = 1;
- if (CODE_CONTAINS_STRUCT (TREE_CODE (olddecl), TS_DECL_WITH_VIS))
+ if (HAS_DECL_ASSEMBLER_NAME_P (olddecl))
{
/* Copy the assembler name.
Currently, it can only be defined in the prototype. */
OMP_CLAUSE_REDUCTION_INSCAN (c) = 1;
if (code == ERROR_MARK
|| !(INTEGRAL_TYPE_P (type)
- || TREE_CODE (type) == REAL_TYPE
+ || SCALAR_FLOAT_TYPE_P (type)
|| TREE_CODE (type) == COMPLEX_TYPE))
OMP_CLAUSE_REDUCTION_PLACEHOLDER (c)
= c_omp_reduction_lookup (reduc_id,
if (type == error_mark_node)
;
else if ((INTEGRAL_TYPE_P (type)
- || TREE_CODE (type) == REAL_TYPE
+ || SCALAR_FLOAT_TYPE_P (type)
|| TREE_CODE (type) == COMPLEX_TYPE)
&& orig_reduc_id == NULL_TREE)
error_at (loc, "predeclared arithmetic type in "
/* Special-case the error message for "ptr.field" for the case
where the user has confused "." vs "->". */
rich_location richloc (line_table, loc);
- if (TREE_CODE (datum) == INDIRECT_REF && arrow_loc != UNKNOWN_LOCATION)
+ if (INDIRECT_REF_P (datum) && arrow_loc != UNKNOWN_LOCATION)
{
richloc.add_fixit_insert_before (arrow_loc, "(*");
richloc.add_fixit_insert_after (arrow_loc, ")");
unsigned int formal_prec = TYPE_PRECISION (type);
if (INTEGRAL_TYPE_P (type)
- && TREE_CODE (valtype) == REAL_TYPE)
+ && SCALAR_FLOAT_TYPE_P (valtype))
warning_at (ploc, OPT_Wtraditional_conversion,
"passing argument %d of %qE as integer rather "
"than floating due to prototype",
"than complex due to prototype",
argnum, rname);
else if (TREE_CODE (type) == COMPLEX_TYPE
- && TREE_CODE (valtype) == REAL_TYPE)
+ && SCALAR_FLOAT_TYPE_P (valtype))
warning_at (ploc, OPT_Wtraditional_conversion,
"passing argument %d of %qE as complex rather "
"than floating due to prototype",
argnum, rname);
- else if (TREE_CODE (type) == REAL_TYPE
+ else if (SCALAR_FLOAT_TYPE_P (type)
&& INTEGRAL_TYPE_P (valtype))
warning_at (ploc, OPT_Wtraditional_conversion,
"passing argument %d of %qE as floating rather "
"passing argument %d of %qE as complex rather "
"than integer due to prototype",
argnum, rname);
- else if (TREE_CODE (type) == REAL_TYPE
+ else if (SCALAR_FLOAT_TYPE_P (type)
&& TREE_CODE (valtype) == COMPLEX_TYPE)
warning_at (ploc, OPT_Wtraditional_conversion,
"passing argument %d of %qE as floating rather "
/* ??? 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)
+ else if (SCALAR_FLOAT_TYPE_P (type)
+ && SCALAR_FLOAT_TYPE_P (valtype))
{
/* Warn if any argument is passed as `float',
since without a prototype it would be `double'. */
else
inttype = restype;
- if (TREE_CODE (target_type) == VOID_TYPE)
+ if (VOID_TYPE_P (target_type))
pedwarn (loc, OPT_Wpointer_arith,
"pointer of type %<void *%> used in subtraction");
if (TREE_CODE (target_type) == FUNCTION_TYPE)
TREE_TYPE (argtype));
}
else if (TREE_CODE (TREE_TYPE (argtype)) == FUNCTION_TYPE
- || TREE_CODE (TREE_TYPE (argtype)) == VOID_TYPE)
+ || VOID_TYPE_P (TREE_TYPE (argtype)))
{
if (code == PREINCREMENT_EXPR || code == POSTINCREMENT_EXPR)
pedwarn (location, OPT_Wpointer_arith,
/* 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_P (ovalue))
{
if (!TREE_OVERFLOW (value))
{
if (TREE_CODE (lhs) == COMPONENT_REF
&& (TREE_CODE (lhstype) == INTEGER_TYPE
|| TREE_CODE (lhstype) == BOOLEAN_TYPE
- || TREE_CODE (lhstype) == REAL_TYPE
+ || SCALAR_FLOAT_TYPE_P (lhstype)
|| TREE_CODE (lhstype) == ENUMERAL_TYPE))
lhstype = TREE_TYPE (get_unwidened (lhs, 0));
/* Not fully determined before folding. */
arith_const_expr = true;
}
- bool constexpr_p = (TREE_CODE (decl) == VAR_DECL
+ bool constexpr_p = (VAR_P (decl)
&& C_DECL_DECLARED_CONSTEXPR (decl));
value = digest_init (init_loc, type, init, origtype, npc, int_const_expr,
arith_const_expr, true,
static bool
constexpr_init_fits_real_type (tree type, tree init)
{
- gcc_assert (TREE_CODE (type) == REAL_TYPE);
+ gcc_assert (SCALAR_FLOAT_TYPE_P (type));
gcc_assert (TREE_CODE (init) == INTEGER_CST || TREE_CODE (init) == REAL_CST);
if (TREE_CODE (init) == REAL_CST
&& TYPE_MODE (TREE_TYPE (init)) == TYPE_MODE (type))
compatible (not just the same mode); all quiet NaN and infinity
initializations are considered to preserve the value. */
if (TREE_CODE (TREE_TYPE (init)) == COMPLEX_TYPE
- && TREE_CODE (type) == REAL_TYPE)
+ && SCALAR_FLOAT_TYPE_P (type))
{
error_at (loc, "%<constexpr%> initializer for a real type is of "
"complex type");
return;
}
- if (TREE_CODE (type) == REAL_TYPE
- && TREE_CODE (TREE_TYPE (init)) == REAL_TYPE
+ if (SCALAR_FLOAT_TYPE_P (type)
+ && SCALAR_FLOAT_TYPE_P (TREE_TYPE (init))
&& DECIMAL_FLOAT_TYPE_P (TREE_TYPE (init))
&& !DECIMAL_FLOAT_TYPE_P (type))
{
"declared here");
}
}
- else if (valtype == NULL_TREE || TREE_CODE (valtype) == VOID_TYPE)
+ else if (valtype == NULL_TREE || VOID_TYPE_P (valtype))
{
current_function_returns_null = 1;
bool warned_here;
save = in_late_binary_op;
if (C_BOOLEAN_TYPE_P (TREE_TYPE (res))
|| TREE_CODE (TREE_TYPE (res)) == COMPLEX_TYPE
- || (TREE_CODE (TREE_TYPE (t)) == REAL_TYPE
+ || (SCALAR_FLOAT_TYPE_P (TREE_TYPE (t))
&& (TREE_CODE (TREE_TYPE (res)) == INTEGER_TYPE
|| TREE_CODE (TREE_TYPE (res)) == ENUMERAL_TYPE)
&& sanitize_flags_p (SANITIZE_FLOAT_CAST)))
t, omp_clause_code_name[OMP_CLAUSE_CODE (c)]);
return error_mark_node;
}
- while (TREE_CODE (t) == INDIRECT_REF)
+ while (INDIRECT_REF_P (t))
{
t = TREE_OPERAND (t, 0);
STRIP_NOPS (t);
}
t = TREE_OPERAND (t, 0);
while (TREE_CODE (t) == MEM_REF
- || TREE_CODE (t) == INDIRECT_REF
+ || INDIRECT_REF_P (t)
|| TREE_CODE (t) == ARRAY_REF)
{
t = TREE_OPERAND (t, 0);
{
t = TREE_OPERAND (t, 0);
if (TREE_CODE (t) == MEM_REF
- || TREE_CODE (t) == INDIRECT_REF)
+ || INDIRECT_REF_P (t))
{
t = TREE_OPERAND (t, 0);
STRIP_NOPS (t);
bias) to zero here, so it is not set erroneously to the pointer
size later on in gimplify.cc. */
OMP_CLAUSE_SIZE (c) = size_zero_node;
- while (TREE_CODE (t) == INDIRECT_REF
+ while (INDIRECT_REF_P (t)
|| TREE_CODE (t) == ARRAY_REF)
{
t = TREE_OPERAND (t, 0);
indir_component_ref_p = false;
if (TREE_CODE (t) == COMPONENT_REF
&& (TREE_CODE (TREE_OPERAND (t, 0)) == MEM_REF
- || TREE_CODE (TREE_OPERAND (t, 0)) == INDIRECT_REF
+ || INDIRECT_REF_P (TREE_OPERAND (t, 0))
|| TREE_CODE (TREE_OPERAND (t, 0)) == ARRAY_REF))
{
t = TREE_OPERAND (TREE_OPERAND (t, 0), 0);
t = TREE_OPERAND (t, 0);
}
while (TREE_CODE (t) == MEM_REF
- || TREE_CODE (t) == INDIRECT_REF
+ || INDIRECT_REF_P (t)
|| TREE_CODE (t) == ARRAY_REF)
{
t = TREE_OPERAND (t, 0);
if (TREE_CODE (t) == POINTER_PLUS_EXPR)
t = TREE_OPERAND (t, 0);
if (TREE_CODE (t) == ADDR_EXPR
- || TREE_CODE (t) == INDIRECT_REF)
+ || INDIRECT_REF_P (t))
t = TREE_OPERAND (t, 0);
if (DECL_P (t))
bitmap_clear_bit (&aligned_head, DECL_UID (t));
{
tree t = OMP_CLAUSE_DECL (c);
while (handled_component_p (t)
- || TREE_CODE (t) == INDIRECT_REF
+ || INDIRECT_REF_P (t)
|| TREE_CODE (t) == ADDR_EXPR
|| TREE_CODE (t) == MEM_REF
|| TREE_CODE (t) == NON_LVALUE_EXPR)
if (! retval)
current_function_returns_null = 1;
- else if (valtype == 0 || TREE_CODE (valtype) == VOID_TYPE)
+ else if (valtype == 0 || VOID_TYPE_P (valtype))
{
current_function_returns_null = 1;
if (TREE_CODE (TREE_TYPE (retval)) != VOID_TYPE)
if (!result)
return convert_out (error_mark_node);
- gcc_assert (TREE_CODE (result) == REAL_TYPE);
+ gcc_assert (SCALAR_FLOAT_TYPE_P (result));
gcc_assert (BITS_PER_UNIT * size_in_bytes == TYPE_PRECISION (result));
return convert_out (result);
{
tree decl = convert_in (decl_in);
tree scope = convert_in (scope_in);
- gcc_assert (TREE_CODE (decl) == VAR_DECL
+ gcc_assert (VAR_P (decl)
|| TREE_CODE (decl) == FUNCTION_DECL
|| TREE_CODE (decl) == TYPE_DECL);
cp_binding_level *b;
if (!result)
return convert_out (error_mark_node);
- gcc_assert (TREE_CODE (result) == REAL_TYPE);
+ gcc_assert (SCALAR_FLOAT_TYPE_P (result));
gcc_assert (BITS_PER_UNIT * size_in_bytes == TYPE_PRECISION (result));
return convert_out (result);