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:32 +0100
committerJörg Frings-Fürst <debian@jff.email>2024-03-03 19:11:32 +0100
commit00893e79fc62966067af1a106567db96bd170338 (patch)
tree52b35cd0b42ca28e62a2ffbecade2e13dd8332cf /tests/test-stdint.c
parent26112352a774737e1ce5580c93654a26c1e82b39 (diff)
New upstream version 1.2upstream/1.2
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);