Skip to content

Conversation

frederick-vs-ja
Copy link
Contributor

TEST_CLANG_VER is not defined for Apple Clang, so it's better to detect whether the macro is defined to get rid of warnings due to -Wundef. This also corresponds to the guard in <mutex>.

`TEST_CLANG_VER` is not defined for Apple Clang, so it's better to
detect whether the macro is defined to get rid of warnings due to
`-Wundef`. This also corresponds to the guard in `<mutex>`.
@frederick-vs-ja frederick-vs-ja added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Sep 4, 2025
@frederick-vs-ja frederick-vs-ja requested a review from a team as a code owner September 4, 2025 01:42
@llvmbot
Copy link
Member

llvmbot commented Sep 4, 2025

@llvm/pr-subscribers-libcxx

Author: A. Jiang (frederick-vs-ja)

Changes

TEST_CLANG_VER is not defined for Apple Clang, so it's better to detect whether the macro is defined to get rid of warnings due to -Wundef. This also corresponds to the guard in &lt;mutex&gt;.


Full diff: https://github.com/llvm/llvm-project/pull/156785.diff

1 Files Affected:

  • (modified) libcxx/test/extensions/clang/thread/thread.mutex/lock.verify.cpp (+1-1)
diff --git a/libcxx/test/extensions/clang/thread/thread.mutex/lock.verify.cpp b/libcxx/test/extensions/clang/thread/thread.mutex/lock.verify.cpp
index c83a87d4901c3..51ffa6962ac83 100644
--- a/libcxx/test/extensions/clang/thread/thread.mutex/lock.verify.cpp
+++ b/libcxx/test/extensions/clang/thread/thread.mutex/lock.verify.cpp
@@ -31,7 +31,7 @@ void f1() {
 } // expected-warning {{mutex 'm0' is still held at the end of function}} \
      expected-warning {{mutex 'm1' is still held at the end of function}}
 
-#if TEST_STD_VER >= 11 && TEST_CLANG_VER >= 2101
+#if TEST_STD_VER >= 11 && defined(TEST_CLANG_VER) && TEST_CLANG_VER >= 2101
 void f2() {
   std::lock(m0, m1, m2);
 } // expected-warning {{mutex 'm0' is still held at the end of function}} \

Copy link
Contributor

@philnik777 philnik777 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@philnik777 philnik777 merged commit cd44260 into llvm:main Sep 4, 2025
71 of 72 checks passed
@frederick-vs-ja frederick-vs-ja deleted the libcxx-test-apple-no-extra-warning branch September 4, 2025 07:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. test-suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants