From 193f458c30106b114b81cb7b2d21de41099f5191 Mon Sep 17 00:00:00 2001 From: Louis Dionne Date: Fri, 13 May 2022 16:13:54 -0400 Subject: [PATCH] [libc++] Remove overly conservative error in As mentionned in D97044, it is fine if users include and then include -- we don't need to error out for that case. Differential Revision: https://reviews.llvm.org/D125579 --- libcxx/include/stdatomic.h | 7 ------- .../incompatible_with_stdatomic.verify.cpp | 6 +++--- .../incompatible_with_atomic.verify.cpp | 22 ---------------------- 3 files changed, 3 insertions(+), 32 deletions(-) delete mode 100644 libcxx/test/libcxx/atomics/stdatomic.h.syn/incompatible_with_atomic.verify.cpp diff --git a/libcxx/include/stdatomic.h b/libcxx/include/stdatomic.h index 8495504..d9550c4 100644 --- a/libcxx/include/stdatomic.h +++ b/libcxx/include/stdatomic.h @@ -226,14 +226,7 @@ using std::atomic_thread_fence _LIBCPP_USING_IF_EXISTS; // the header. We do this because Clang has historically shipped a // header that would be available in all Standard modes, and we don't want to // break that use case. -// -// However, if the user has already used before, the two headers are -// incompatible before C++23, so we issue a clear error here to avoid obscure -// issues down the line. # if __has_include_next() -# ifdef _LIBCPP_ATOMIC -# error is incompatible with before C++23. Please compile with -std=c++23. -# endif # include_next # endif diff --git a/libcxx/test/libcxx/atomics/atomics.syn/incompatible_with_stdatomic.verify.cpp b/libcxx/test/libcxx/atomics/atomics.syn/incompatible_with_stdatomic.verify.cpp index 49bc2dcc..a8d56c5 100644 --- a/libcxx/test/libcxx/atomics/atomics.syn/incompatible_with_stdatomic.verify.cpp +++ b/libcxx/test/libcxx/atomics/atomics.syn/incompatible_with_stdatomic.verify.cpp @@ -9,9 +9,9 @@ // UNSUPPORTED: libcpp-has-no-threads // REQUIRES: c++03 || c++11 || c++14 || c++17 || c++20 -// This test ensures that we issue a reasonable diagnostic when using while -// is in use too. Before C++23, this otherwise leads to obscure errors because may try -// to redefine things defined by . +// This test ensures that we issue a reasonable diagnostic when including after +// has been included. Before C++23, this otherwise leads to obscure errors +// because may try to redefine things defined by . // Ignore additional weird errors that happen when the two headers are mixed. // ADDITIONAL_COMPILE_FLAGS: -Xclang -verify-ignore-unexpected=error -Xclang -verify-ignore-unexpected=warning diff --git a/libcxx/test/libcxx/atomics/stdatomic.h.syn/incompatible_with_atomic.verify.cpp b/libcxx/test/libcxx/atomics/stdatomic.h.syn/incompatible_with_atomic.verify.cpp deleted file mode 100644 index ff4124a..0000000 --- a/libcxx/test/libcxx/atomics/stdatomic.h.syn/incompatible_with_atomic.verify.cpp +++ /dev/null @@ -1,22 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: libcpp-has-no-threads -// REQUIRES: c++03 || c++11 || c++14 || c++17 || c++20 - -// This test ensures that we issue a reasonable diagnostic when using while -// is in use too. Before C++23, this otherwise leads to obscure errors because tries -// to redefine things defined by . - -// Ignore additional weird errors that happen when the two headers are mixed. -// ADDITIONAL_COMPILE_FLAGS: -Xclang -verify-ignore-unexpected=error -Xclang -verify-ignore-unexpected=warning - -#include -#include - -// expected-error@*:* {{ is incompatible with before C++23}} -- 2.7.4