|
1 | 1 | Auto generated patch. Do not edit or delete it, even if empty. |
| 2 | +diff -ruN --strip-trailing-cr a/libcxx/include/stdatomic.h b/libcxx/include/stdatomic.h |
| 3 | +--- a/libcxx/include/stdatomic.h |
| 4 | ++++ b/libcxx/include/stdatomic.h |
| 5 | +@@ -231,7 +231,7 @@ |
| 6 | + using std::atomic_signal_fence _LIBCPP_USING_IF_EXISTS; |
| 7 | + using std::atomic_thread_fence _LIBCPP_USING_IF_EXISTS; |
| 8 | + |
| 9 | +-# elif defined(_LIBCPP_COMPILER_CLANG_BASED) |
| 10 | ++# elif !defined(__cplusplus) || defined(_LIBCPP_COMPILER_CLANG_BASED) |
| 11 | + |
| 12 | + // Before C++23, we include the next <stdatomic.h> on the path to avoid hijacking |
| 13 | + // the header. We do this because Clang has historically shipped a <stdatomic.h> |
| 14 | +diff -ruN --strip-trailing-cr a/libcxx/test/extensions/libcxx/depr/depr.c.headers/include_stdatomic_as_c.sh.cpp b/libcxx/test/extensions/libcxx/depr/depr.c.headers/include_stdatomic_as_c.sh.cpp |
| 15 | +--- a/libcxx/test/extensions/libcxx/depr/depr.c.headers/include_stdatomic_as_c.sh.cpp |
| 16 | ++++ b/libcxx/test/extensions/libcxx/depr/depr.c.headers/include_stdatomic_as_c.sh.cpp |
| 17 | +@@ -0,0 +1,30 @@ |
| 18 | ++//===----------------------------------------------------------------------===// |
| 19 | ++// |
| 20 | ++// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 21 | ++// See https://llvm.org/LICENSE.txt for license information. |
| 22 | ++// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 23 | ++// |
| 24 | ++//===----------------------------------------------------------------------===// |
| 25 | ++ |
| 26 | ++// We're building as C, so this test doesn't work when building with modules. |
| 27 | ++// UNSUPPORTED: clang-modules-build |
| 28 | ++ |
| 29 | ++// GCC complains about unrecognized arguments because we're compiling the |
| 30 | ++// file as C, but we're passing C++ flags on the command-line. |
| 31 | ++// UNSUPPORTED: gcc |
| 32 | ++ |
| 33 | ++// Test that stdatomic.h gets the C header with its definitions. |
| 34 | ++ |
| 35 | ++// NOTE: It's not common or recommended to have libc++ in the header search |
| 36 | ++// path when compiling C files, but it does happen often enough. |
| 37 | ++ |
| 38 | ++// RUN: %{cxx} -c -xc %s -fsyntax-only %{flags} %{compile_flags} -std=c99 |
| 39 | ++ |
| 40 | ++#include <stdatomic.h> |
| 41 | ++ |
| 42 | ++int main(int argc, char** argv) { |
| 43 | ++ (void)argc; |
| 44 | ++ (void)argv; |
| 45 | ++ [[maybe_unused]] atomic_bool x; |
| 46 | ++ return 0; |
| 47 | ++} |
0 commit comments