Skip to content

Commit 297003a

Browse files
committed
fix(test): use __SANITIZE_ADDRESS__ alone for sanitizer detection (gcc-portable)
GCC's preprocessor doesn't short-circuit 'defined(__has_feature) && __has_feature(...)' — it tries to parse the call syntax of the undefined token and errors with 'missing binary operator before token "("'. Modern GCC and Clang both define __SANITIZE_ADDRESS__ under -fsanitize=address, so use that single check.
1 parent d5211f6 commit 297003a

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

tests/test_cs_lsp_bench.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ TEST(cslsp_bench_resolution_ratio) {
242242
/* Time budget. ASan+UBSan instrumentation slows the parse ~5-10×, so
243243
* scale the budget when a sanitizer is active. Native: 200 ms for a
244244
* ~260-line fixture; sanitized: 2000 ms. */
245-
#if defined(__SANITIZE_ADDRESS__) || (defined(__has_feature) && __has_feature(address_sanitizer))
245+
#ifdef __SANITIZE_ADDRESS__
246246
ASSERT(ms < 2000.0);
247247
#else
248248
ASSERT(ms < 200.0);

tests/test_py_lsp_bench.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ TEST(pylsp_bench_resolution_ratio) {
262262
/* Time budget. ASan+UBSan instrumentation slows the parse ~5-10×, so
263263
* scale the budget when a sanitizer is active. Native: 150 ms for a
264264
* ~200-line fixture; sanitized: 1500 ms. */
265-
#if defined(__SANITIZE_ADDRESS__) || (defined(__has_feature) && __has_feature(address_sanitizer))
265+
#ifdef __SANITIZE_ADDRESS__
266266
ASSERT(ms < 1500.0);
267267
#else
268268
ASSERT(ms < 150.0);

0 commit comments

Comments
 (0)