[libcxx] [libunwind] [libc++] Harden the test suite for running against older libc++ versions (PR #214820)

Louis Dionne via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 10 05:46:51 PDT 2026


ldionne wrote:

> Why do we care to run the test suite against older versions which have parts disabled?

I feel like that's the wrong question to ask. We care that the test suite configures itself properly against older versions of the library. On some platforms, libc++ is configured with these carve-outs enabled, so ideally we would support that gracefully. That's actually already the case for the frozen C++03 headers, which had similar needs and are simplified by this patch.

Concretely, this patch was prompted by one very specific failure at (old lines) `libcxx/utils/libcxx/test/dsl.py:310` where we did:

```
#if defined(_LIBCPP_VERSION) && !_LIBCPP_HAS_LOCALIZATION
```

With a library before the switch to 0-1 macros, this fails due to `-Wundef` and hence causes the test suite configuration to fail entirely. I could have fixed that by using something like this:

```
#if defined(_LIBCPP_VERSION) && defined(_LIBCPP_HAS_LOCALIZATION) && !_LIBCPP_HAS_LOCALIZATION
```

However, while investigating the fix, I realized that a more consistent way of detecting Lit features was to align them with what we already have to do inside `test_macros.h`. Instead of duplicating the checks (and them being subtly different), we can reuse the detection we already do inside `test_macros.h`, that way everything is consistent by construction.

https://github.com/llvm/llvm-project/pull/214820


More information about the cfe-commits mailing list