From 7d77577ea3b757ac9c5914074cd000eaf21099b3 Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Tue, 30 Jun 2020 14:15:41 +0100 Subject: [PATCH] Add (u)intcap_t to stdint.h when CHERI is supported This allows using the non-underscore versions in hybrid CHERI code (purecap should be using (u)intptr_t) in environments that use the compiler-provided stdint.h instead of reimplementing it in their own headers (as is the case for FreeBSD/CheriBSD). --- clang/lib/Headers/stdint.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/clang/lib/Headers/stdint.h b/clang/lib/Headers/stdint.h index 192f653e95a1..66c411259a8e 100644 --- a/clang/lib/Headers/stdint.h +++ b/clang/lib/Headers/stdint.h @@ -257,6 +257,12 @@ typedef __UINTPTR_TYPE__ uintptr_t; #define _UINTPTR_T #endif +/* uintcap_t/intcap_t typedefs for hybrid CHERI code: */ +#if __has_feature(capabilities) +typedef __intcap_t intcap_t; +typedef __uintcap_t uintcap_t; +#endif + /* C99 7.18.1.5 Greatest-width integer types. */ typedef __INTMAX_TYPE__ intmax_t;