static void builtin_define_with_hex_fp_value (const char *, tree,
int, const char *,
const char *);
+static void builtin_define_stdint_macros (void);
static void builtin_define_type_max (const char *, tree, int);
static void builtin_define_type_precision (const char *, tree);
static void builtin_define_float_constants (const char *, const char *,
([^0-9]*-)?[0-9]+[.][0-9]+([.][0-9]+)?([- ].*)? */
const char *q, *v = version_string;
- while (*v && ! ISDIGIT (*v))
+ while (*v && !ISDIGIT (*v))
v++;
- if (!*v || (v > version_string && v[-1] != '-'))
- abort ();
+ gcc_assert (*v && (v <= version_string || v[-1] == '-'));
q = v;
while (ISDIGIT (*v))
if (c_dialect_cxx ())
builtin_define_with_value_n ("__GNUG__", q, v - q);
- if (*v != '.' || !ISDIGIT (v[1]))
- abort ();
+ gcc_assert (*v == '.' || ISDIGIT (v[1]));
+
q = ++v;
while (ISDIGIT (*v))
v++;
if (*v == '.')
{
- if (!ISDIGIT (v[1]))
- abort ();
+ gcc_assert (ISDIGIT (v[1]));
q = ++v;
while (ISDIGIT (*v))
v++;
else
builtin_define_with_value_n ("__GNUC_PATCHLEVEL__", "0", 1);
- if (*v && *v != ' ' && *v != '-')
- abort ();
+ gcc_assert (!*v || *v == ' ' || *v == '-');
+}
+
+/* Define macros used by <stdint.h>. Currently only defines limits
+ for intmax_t, used by the testsuite. */
+static void
+builtin_define_stdint_macros (void)
+{
+ int intmax_long;
+ if (intmax_type_node == long_long_integer_type_node)
+ intmax_long = 2;
+ else if (intmax_type_node == long_integer_type_node)
+ intmax_long = 1;
+ else if (intmax_type_node == integer_type_node)
+ intmax_long = 0;
+ else
+ gcc_unreachable ();
+ builtin_define_type_max ("__INTMAX_MAX__", intmax_type_node, intmax_long);
}
/* Hook that registers front end and target-specific built-ins. */
builtin_define_type_precision ("__CHAR_BIT__", char_type_node);
+ /* stdint.h (eventually) and the testsuite need to know these. */
+ builtin_define_stdint_macros ();
+
/* float.h needs to know these. */
builtin_define_with_int_value ("__FLT_EVAL_METHOD__",
TARGET_CPU_CPP_BUILTINS ();
TARGET_OS_CPP_BUILTINS ();
TARGET_OBJFMT_CPP_BUILTINS ();
+
+ /* Support the __declspec keyword by turning them into attributes.
+ Note that the current way we do this may result in a collision
+ with predefined attributes later on. This can be solved by using
+ one attribute, say __declspec__, and passing args to it. The
+ problem with that approach is that args are not accumulated: each
+ new appearance would clobber any existing args. */
+ if (TARGET_DECLSPEC)
+ builtin_define ("__declspec(x)=__attribute__((x))");
}
/* Pass an object-like macro. If it doesn't lie in the user's
case 32: idx = 4; break;
case 64: idx = 6; break;
case 128: idx = 8; break;
- default: abort ();
+ default: gcc_unreachable ();
}
value = values[idx + TYPE_UNSIGNED (type)];