Skip to content

Commit 559eeb0

Browse files
brooksdavisresistor
authored andcommitted
Use __has_feature(cheri) in tests
Migrate tests that aren't explicitly about __has_feature(capabilities) to __has_feature(cheri).
1 parent 247823a commit 559eeb0

File tree

8 files changed

+34
-32
lines changed

8 files changed

+34
-32
lines changed

clang/test/CodeGen/builtin-align.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
#error MISSING TYPE
4141
#endif
4242

43-
#if !__has_feature(capabilities)
43+
#if !__has_feature(cheri)
4444
#define __capability
4545
#endif
4646

clang/test/CodeGen/cheri/warn-ctoptr-functions.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ typedef __sighandler_t * __kerncap sig_t; /* type of pointer to a signal functio
2222
typedef long sigset_t;
2323
struct __siginfo;
2424

25-
#if __has_feature(capabilities)
25+
#if __has_feature(cheri)
2626
struct sigaction_c {
2727
union {
2828
void (* __capability __sa_handler)(int);
@@ -42,7 +42,7 @@ struct sigaction_native {
4242
sigset_t sa_mask; /* signal mask to apply */
4343
};
4444

45-
#if __has_feature(capabilities)
45+
#if __has_feature(cheri)
4646
typedef struct sigaction_c ksigaction_t;
4747
#else
4848
typedef struct sigaction_native ksigaction_t;

clang/test/CodeGenCXX/cheri/constinit-zero-to-pointer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const AttributeData kBarcodeAttributeData{
2424
AttributeData test() { return kBarcodeAttributeData; }
2525

2626
/// Also check enums with underlying type __intcap for CHERI targets:
27-
#if __has_feature(capabilities)
27+
#if __has_feature(cheri)
2828
enum class IntCapEnum : __intcap { Zero };
2929

3030
void *intcapEnumToPtrConstant = (void *)IntCapEnum::Zero;

clang/test/SemaCXX/cheri/cheri-pointer-cast.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ typedef unsigned long ulong;
99

1010
int foo;
1111

12-
#if __has_feature(capabilities)
12+
#if __has_feature(cheri)
1313
#define CAP __capability
1414
#else
1515
#define CAP
@@ -68,7 +68,7 @@ int main() {
6868
}
6969

7070
// Check that we don't warn on dependent types
71-
#if __has_feature(capabilities)
71+
#if __has_feature(cheri)
7272
template <typename T>
7373
long offset_get(T x) {
7474
return __builtin_cheri_offset_get(reinterpret_cast<void * __capability>(x));

clang/test/SemaCXX/cheri/dependent-cast-crash.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: %clang_cc1 -fsyntax-only %s -verify
22
// RUN: %cheri_cc1 -fsyntax-only %s -verify
33
// RUN: %cheri_purecap_cc1 -fsyntax-only %s -verify
4-
#if !__has_feature(capabilities)
4+
#if !__has_feature(cheri)
55
#define __capability
66
#endif
77

clang/test/SemaCXX/cheri/implicit-cap-conversion-return-value.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// RUN: %cheri_cc1 -Wall -Wcheri-pointer-conversion -verify=c,expected,hybrid,hybrid-c -x c -fsyntax-only %s
88
// RUN: %cheri_purecap_cc1 -Wall -Wcheri-pointer-conversion -verify=c,expected,purecap,purecap-c -x c -fsyntax-only %s
99

10-
#if __has_feature(capabilities)
10+
#if __has_feature(cheri)
1111
typedef unsigned __intcap uintcap_t;
1212
#else
1313
typedef unsigned long uintcap_t;

clang/test/SemaCXX/cheri/overloaded-function-template-arg.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ void instantiate() {
3232
c<void(char), a>::function(1); // expected-error{{address of overloaded function 'a' does not match required type 'void (char)'}}
3333
}
3434

35-
#if __has_feature(capabilities)
35+
#if __has_feature(cheri)
3636
template <class T, T *__capability Func>
3737
// hybrid-note@-1 3 {{template parameter is declared here}}
3838
struct c_cap {

libcxx/test/support/charconv_test_helpers.h

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -292,35 +292,37 @@ constexpr auto concat(L1, L2) -> concat_t<L1, L2>
292292
return {};
293293
}
294294

295-
auto all_signed = type_list<
296-
char,
297-
signed char,
298-
short,
299-
int,
300-
long,
301-
long long
295+
auto all_signed =
296+
type_list< char,
297+
signed char,
298+
short,
299+
int,
300+
long,
301+
long long
302302
#ifndef TEST_HAS_NO_INT128
303-
,
304-
__int128_t
303+
,
304+
__int128_t
305305
#endif
306-
#if __has_feature(capabilities)
307-
, __intcap
306+
#if __has_feature(cheri)
307+
,
308+
__intcap
308309
#endif
309-
>();
310-
auto all_unsigned = type_list<
311-
unsigned char,
312-
unsigned short,
313-
unsigned int,
314-
unsigned long,
315-
unsigned long long
310+
>();
311+
auto all_unsigned =
312+
type_list< unsigned char,
313+
unsigned short,
314+
unsigned int,
315+
unsigned long,
316+
unsigned long long
316317
#ifndef TEST_HAS_NO_INT128
317-
,
318-
__uint128_t
318+
,
319+
__uint128_t
319320
#endif
320-
#if __has_feature(capabilities)
321-
, unsigned __intcap
321+
#if __has_feature(cheri)
322+
,
323+
unsigned __intcap
322324
#endif
323-
>();
325+
>();
324326
auto integrals = concat(all_signed, all_unsigned);
325327

326328
auto all_floats = type_list< float, double >(); //TODO: Add long double

0 commit comments

Comments
 (0)