summaryrefslogtreecommitdiff
path: root/gcc/c-cppbuiltin.c
diff options
context:
space:
mode:
authorjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2004-08-05 00:38:31 +0000
committerjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2004-08-05 00:38:31 +0000
commit36bccbfc1deca48f3531123585ce40ae74fc7a9b (patch)
tree06690c205a19e52eb65cb0ac2b6391e8c47bc57c /gcc/c-cppbuiltin.c
parenta2329fded9193e51ecd545282dad5270fc6e9852 (diff)
downloadgcc-36bccbfc1deca48f3531123585ce40ae74fc7a9b.tar.gz
* c-common.c (c_stddef_cpp_builtins): Define __INTMAX_TYPE__ and
__UINTMAX_TYPE__. * c-cppbuiltin.c (builtin_define_stdint_macros): New. Define __INTMAX_MAX__. (c_cpp_builtins): Call it. * doc/cpp.texi: Update. testsuite: * gcc.c-torture/execute/builtins/abs-2.c, gcc.c-torture/execute/builtins/abs-3.c, gcc.c-torture/execute/builtins/lib/abs.c, gcc.dg/format/format.h, gcc.dg/torture/builtin-attr-1.c: Use predefined macros for intmax_t, uintmax_t and their limits. * gcc.dg/intmax_t-1.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@85588 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-cppbuiltin.c')
-rw-r--r--gcc/c-cppbuiltin.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc/c-cppbuiltin.c b/gcc/c-cppbuiltin.c
index 441a38e3b8c..f6a1805f0b8 100644
--- a/gcc/c-cppbuiltin.c
+++ b/gcc/c-cppbuiltin.c
@@ -54,6 +54,7 @@ static void builtin_define_with_int_value (const char *, HOST_WIDE_INT);
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 *,
@@ -293,6 +294,23 @@ define__GNUC__ (void)
abort ();
}
+/* 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
+ abort ();
+ builtin_define_type_max ("__INTMAX_MAX__", intmax_type_node, intmax_long);
+}
+
/* Hook that registers front end and target-specific built-ins. */
void
c_cpp_builtins (cpp_reader *pfile)
@@ -354,6 +372,9 @@ c_cpp_builtins (cpp_reader *pfile)
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__",