Skip to content

Commit 96fd110

Browse files
committed
Use C spelling instead of #ifdef
1 parent 10b86b9 commit 96fd110

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

libc/test/src/compiler/stack_chk_guard_test.cpp

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,12 @@ TEST(LlvmLibcStackChkFail, Death) {
1818
EXPECT_DEATH([] { __stack_chk_fail(); }, WITH_SIGNAL(SIGABRT));
1919
}
2020

21-
// When https://github.com/llvm/llvm-project/issues/125760 is fixed,
22-
// this can use the `gnu::` spelling unconditionally.
23-
#ifdef __clang__
24-
#define SANITIZER_ATTR_NS clang
25-
#else
26-
#define SANITIZER_ATTR_NS gnu
27-
#endif
28-
2921
// Disable sanitizers such as asan and hwasan that would catch the buffer
3022
// overrun before it clobbered the stack canary word. Function attributes
31-
// can't be applied to lambdas before C++23, so this has to be separate.
32-
[[SANITIZER_ATTR_NS::no_sanitize("all")]] void smash_stack() {
23+
// can't be applied to lambdas before C++23, so this has to be separate. When
24+
// https://github.com/llvm/llvm-project/issues/125760 is fixed, this can use
25+
// the modern spelling [[gnu::no_sanitize(...)]] without conditionalization.
26+
__attribute__((no_sanitize("all"))) void smash_stack() {
3327
int arr[20];
3428
LIBC_NAMESPACE::memset(arr, 0xAA, 2001);
3529
}

0 commit comments

Comments
 (0)