summaryrefslogtreecommitdiff
path: root/tests/test-stdint.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2024-03-03 19:11:45 +0100
committerJörg Frings-Fürst <debian@jff.email>2024-03-03 19:11:45 +0100
commit7cf710f6587e71a193a55d84dd6d8ae1a8a69ce0 (patch)
treedb628840acea83dbccaf5676b89579a80e02ef51 /tests/test-stdint.c
parentd83e85a2e6064c36f6ad3c848e39d8b8c101c4f7 (diff)
parent00893e79fc62966067af1a106567db96bd170338 (diff)
Update upstream source from tag 'upstream/1.2'
Update to upstream version '1.2' with Debian dir 16dafe941db3036235f48227f29c6a73587c376d
Diffstat (limited to 'tests/test-stdint.c')
-rw-r--r--tests/test-stdint.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/tests/test-stdint.c b/tests/test-stdint.c
index 7d71f687..47bedc89 100644
--- a/tests/test-stdint.c
+++ b/tests/test-stdint.c
@@ -1,5 +1,5 @@
/* Test of <stdint.h> substitute.
- Copyright (C) 2006-2022 Free Software Foundation, Inc.
+ Copyright (C) 2006-2024 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -216,22 +216,24 @@ err or;
/* 7.18.1.4. Integer types capable of holding object pointers */
/* 7.18.2.4. Limits of integer types capable of holding object pointers */
+#ifdef INTPTR_MAX
intptr_t g[3] = { 17, INTPTR_MIN, INTPTR_MAX };
verify (sizeof (void *) <= sizeof (intptr_t));
+# ifndef __CHERI_PURE_CAPABILITY__
verify (TYPE_MINIMUM (intptr_t) == INTPTR_MIN);
verify (TYPE_MAXIMUM (intptr_t) == INTPTR_MAX);
+# endif
verify_same_types (INTPTR_MIN, (intptr_t) 0 + 0);
verify_same_types (INTPTR_MAX, (intptr_t) 0 + 0);
+#endif
+#ifdef UINTPTR_MAX
uintptr_t h[2] = { 17, UINTPTR_MAX };
verify (sizeof (void *) <= sizeof (uintptr_t));
+# ifndef __CHERI_PURE_CAPABILITY__
verify (TYPE_MAXIMUM (uintptr_t) == UINTPTR_MAX);
+# endif
verify_same_types (UINTPTR_MAX, (uintptr_t) 0 + 0);
-
-#if INTPTR_MIN && INTPTR_MAX && UINTPTR_MAX
-/* ok */
-#else
-err or;
#endif
/* 7.18.1.5. Greatest-width integer types */
@@ -408,8 +410,14 @@ verify_width (INT_FAST32_WIDTH, INT_FAST32_MIN, INT_FAST32_MAX);
verify_width (UINT_FAST32_WIDTH, 0, UINT_FAST32_MAX);
verify_width (INT_FAST64_WIDTH, INT_FAST64_MIN, INT_FAST64_MAX);
verify_width (UINT_FAST64_WIDTH, 0, UINT_FAST64_MAX);
+#ifndef __CHERI_PURE_CAPABILITY__
+# ifdef INTPTR_WIDTH
verify_width (INTPTR_WIDTH, INTPTR_MIN, INTPTR_MAX);
+# endif
+# ifdef UINTPTR_WIDTH
verify_width (UINTPTR_WIDTH, 0, UINTPTR_MAX);
+# endif
+#endif
verify_width (INTMAX_WIDTH, INTMAX_MIN, INTMAX_MAX);
verify_width (UINTMAX_WIDTH, 0, UINTMAX_MAX);
verify_width (PTRDIFF_WIDTH, PTRDIFF_MIN, PTRDIFF_MAX);