On Wed, 10 Dec 2014, Marek Polacek wrote:
@@ -482,6 +487,15 @@ extern void omp_clause_range_check_failed (const_tree,
const char *, int,
|| TREE_CODE (TYPE) == BOOLEAN_TYPE \
|| TREE_CODE (TYPE) == INTEGER_TYPE)
+/* Nonzero if TYPE represents an integral type, including complex
+ and vector integer types. */
+
+#define ANY_INTEGRAL_TYPE_P(TYPE) \
+ (INTEGRAL_TYPE_P (TYPE) \
+ || ((TREE_CODE (TYPE) == COMPLEX_TYPE \
+ || VECTOR_TYPE_P (TYPE)) \
+ && INTEGRAL_TYPE_P (TREE_TYPE (TYPE))))
+
/* Nonzero if TYPE represents a non-saturating fixed-point type. */
#define NON_SAT_FIXED_POINT_TYPE_P(TYPE) \
@@ -771,7 +785,7 @@ extern void omp_clause_range_check_failed (const_tree,
const char *, int,
/* True if overflow wraps around for the given integral type. That
is, TYPE_MAX + 1 == TYPE_MIN. */
#define TYPE_OVERFLOW_WRAPS(TYPE) \
- (TYPE_UNSIGNED (TYPE) || flag_wrapv)
+ (ANY_INTEGRAL_TYPE_CHECK(TYPE)->base.u.bits.unsigned_flag || flag_wrapv)
/* True if overflow is undefined for the given integral type. We may
optimize on the assumption that values in the type never overflow.
@@ -781,13 +795,14 @@ extern void omp_clause_range_check_failed (const_tree,
const char *, int,
it will be appropriate to issue the warning immediately, and in
other cases it will be appropriate to simply set a flag and let the
caller decide whether a warning is appropriate or not. */
-#define TYPE_OVERFLOW_UNDEFINED(TYPE) \
- (!TYPE_UNSIGNED (TYPE) && !flag_wrapv && !flag_trapv && flag_strict_overflow)
+#define TYPE_OVERFLOW_UNDEFINED(TYPE) \
+ (!ANY_INTEGRAL_TYPE_CHECK(TYPE)->base.u.bits.unsigned_flag \
+ && !flag_wrapv && !flag_trapv && flag_strict_overflow)
/* True if overflow for the given integral type should issue a
trap. */
#define TYPE_OVERFLOW_TRAPS(TYPE) \
- (!TYPE_UNSIGNED (TYPE) && flag_trapv)
+ (!ANY_INTEGRAL_TYPE_CHECK(TYPE)->base.u.bits.unsigned_flag && flag_trapv)
/* True if an overflow is to be preserved for sanitization. */
#define TYPE_OVERFLOW_SANITIZED(TYPE) \
@@ -2990,6 +3005,20 @@ omp_clause_elt_check (tree __t, int __i,
return &__t->omp_clause.ops[__i];
}
+/* These checks have to be special cased. */
+
+inline tree
+any_integral_type_check (tree __t, const char *__f, int __l, const char *__g)
+{
+ if (!(INTEGRAL_TYPE_P (__t)
+ || ((TREE_CODE (__t) == COMPLEX_TYPE
+ || VECTOR_TYPE_P (__t))
+ && INTEGRAL_TYPE_P (TREE_TYPE (__t)))))
+ tree_check_failed (__t, __f, __l, __g, BOOLEAN_TYPE, ENUMERAL_TYPE,
+ INTEGER_TYPE, 0);
+ return __t;
+}
Is there a particular reason why you are avoiding ANY_INTEGRAL_TYPE_P in
any_integral_type_check?
--
Marc Glisse