Skip to content

[libc++] Remove outdated _LIBCPP_CLANG_VER check #71759

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 9, 2023

Conversation

ldionne
Copy link
Member

@ldionne ldionne commented Nov 9, 2023

We always use Clang >= 16 now, so the check for Clang >= 14 is tautological. As a drive-by, clang-format the header.

We always use Clang >= 16 now, so the check for Clang >= 14 is tautological.
As a drive-by, clang-format the header.
@ldionne ldionne requested a review from a team as a code owner November 9, 2023 02:37
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Nov 9, 2023
@ldionne
Copy link
Member Author

ldionne commented Nov 9, 2023

CC @AdvenamTacet

@llvmbot
Copy link
Member

llvmbot commented Nov 9, 2023

@llvm/pr-subscribers-libcxx

Author: Louis Dionne (ldionne)

Changes

We always use Clang >= 16 now, so the check for Clang >= 14 is tautological. As a drive-by, clang-format the header.


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

2 Files Affected:

  • (modified) libcxx/include/__atomic/atomic_init.h (+4-4)
  • (modified) libcxx/utils/data/ignore_format.txt (-1)
diff --git a/libcxx/include/__atomic/atomic_init.h b/libcxx/include/__atomic/atomic_init.h
index 14310aee10c11db..c5e3e714a3a2a91 100644
--- a/libcxx/include/__atomic/atomic_init.h
+++ b/libcxx/include/__atomic/atomic_init.h
@@ -15,13 +15,13 @@
 #  pragma GCC system_header
 #endif
 
-#define ATOMIC_FLAG_INIT {false}
-#define ATOMIC_VAR_INIT(__v) {__v}
+#define ATOMIC_FLAG_INIT                                                                                               \
+  { false }
+#define ATOMIC_VAR_INIT(__v)                                                                                           \
+  { __v }
 
 #if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_DISABLE_DEPRECATION_WARNINGS)
-# if defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER >= 1400
 #  pragma clang deprecated(ATOMIC_VAR_INIT)
-# endif
 #endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_DISABLE_DEPRECATION_WARNINGS)
 
 #endif // _LIBCPP___ATOMIC_ATOMIC_INIT_H
diff --git a/libcxx/utils/data/ignore_format.txt b/libcxx/utils/data/ignore_format.txt
index 123d06d56e29a5b..48b3c04adb54238 100644
--- a/libcxx/utils/data/ignore_format.txt
+++ b/libcxx/utils/data/ignore_format.txt
@@ -89,7 +89,6 @@ libcxx/include/array
 libcxx/include/__atomic/atomic_base.h
 libcxx/include/__atomic/atomic_flag.h
 libcxx/include/__atomic/atomic.h
-libcxx/include/__atomic/atomic_init.h
 libcxx/include/__atomic/atomic_lock_free.h
 libcxx/include/__atomic/atomic_sync.h
 libcxx/include/__atomic/check_memory_order.h

Copy link
Member

@AdvenamTacet AdvenamTacet left a comment

Choose a reason for hiding this comment

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

LGTM, but I would also remove the comment after one line #if.

We can already update _LIBCPP_CLANG_VER in one more place to already warn about incompatibility when someone is using something unsupported.

# if _LIBCPP_CLANG_VER < 1500
# warning "Libc++ only supports Clang 15 and later"
# endif
# elif defined(_LIBCPP_APPLE_CLANG_VER)
# if _LIBCPP_APPLE_CLANG_VER < 1500
# warning "Libc++ only supports AppleClang 15 and later"
# endif

I'm unsure how _LIBCPP_APPLE_CLANG_VER works, so I don't know if it can be already updated, but I guess so.

@ldionne
Copy link
Member Author

ldionne commented Nov 9, 2023

LGTM, but I would also remove the comment after one line #if.

We can already update _LIBCPP_CLANG_VER in one more place to already warn about incompatibility when someone is using something unsupported.

# if _LIBCPP_CLANG_VER < 1500
# warning "Libc++ only supports Clang 15 and later"
# endif
# elif defined(_LIBCPP_APPLE_CLANG_VER)
# if _LIBCPP_APPLE_CLANG_VER < 1500
# warning "Libc++ only supports AppleClang 15 and later"
# endif

I'm unsure how _LIBCPP_APPLE_CLANG_VER works, so I don't know if it can be already updated, but I guess so.

I'll do that in a separate patch, good catch though.

@ldionne ldionne merged commit 553ae2f into llvm:main Nov 9, 2023
@ldionne ldionne deleted the review/atomic_init_clang_ver branch November 9, 2023 19:09
zahiraam pushed a commit to zahiraam/llvm-project that referenced this pull request Nov 20, 2023
We always use Clang >= 16 now, so the check for Clang >= 14 is
tautological. As a drive-by, clang-format the header.
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants