diff options
author | Christopher Di Bella <cjdb@google.com> | 2022-02-25 21:59:32 +0300 |
---|---|---|
committer | Christopher Di Bella <cjdb@google.com> | 2022-02-26 12:00:25 +0300 |
commit | 5aaefa510ef055e8f044ca89e352d4313f3aba49 (patch) | |
tree | 802d47ed42f359ebc4ff566f7d4859de94bd3651 /libcxxabi | |
parent | 274ec425dcc3e3f637dd006c5e9ae33bd0e2e917 (diff) |
[libcxx][modules] protects users from relying on detail headers
libc++ has started splicing standard library headers into much more
fine-grained content for maintainability. It's very likely that outdated
and naive tooling (some of which is outside of LLVM's scope) will
suggest users include things such as <__ranges/access.h> instead of
<ranges>, and Hyrum's law suggests that users will eventually begin to
rely on this without the help of tooling. As such, this commit
intends to protect users from themselves, by making it a hard error for
anyone outside of the standard library to include libc++ detail headers.
Differential Revision: https://reviews.llvm.org/D106124
Diffstat (limited to 'libcxxabi')
-rw-r--r-- | libcxxabi/include/threading_support.h | 14 | ||||
-rw-r--r-- | libcxxabi/src/cxa_exception_storage.cpp | 2 | ||||
-rw-r--r-- | libcxxabi/src/cxa_guard_impl.h | 2 | ||||
-rw-r--r-- | libcxxabi/src/cxa_thread_atexit.cpp | 2 | ||||
-rw-r--r-- | libcxxabi/src/fallback_malloc.cpp | 2 | ||||
-rw-r--r-- | libcxxabi/test/test_exception_storage.pass.cpp | 2 | ||||
-rw-r--r-- | libcxxabi/test/test_fallback_malloc.pass.cpp | 2 |
7 files changed, 20 insertions, 6 deletions
diff --git a/libcxxabi/include/threading_support.h b/libcxxabi/include/threading_support.h new file mode 100644 index 000000000000..3e533f91ee7f --- /dev/null +++ b/libcxxabi/include/threading_support.h @@ -0,0 +1,14 @@ +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// +#ifndef _LIBCXXABI_THREADING_SUPPORT_H +#define _LIBCXXABI_THREADING_SUPPORT_H + +#pragma GCC system_header +#include <__threading_support> + +#endif // _LIBCXXABI_THREADING_SUPPORT_H diff --git a/libcxxabi/src/cxa_exception_storage.cpp b/libcxxabi/src/cxa_exception_storage.cpp index 3a3233a1b927..ce44c3a176a4 100644 --- a/libcxxabi/src/cxa_exception_storage.cpp +++ b/libcxxabi/src/cxa_exception_storage.cpp @@ -12,7 +12,7 @@ #include "cxa_exception.h" -#include <__threading_support> +#include "threading_support.h" #if defined(_LIBCXXABI_HAS_NO_THREADS) diff --git a/libcxxabi/src/cxa_guard_impl.h b/libcxxabi/src/cxa_guard_impl.h index 72940cc7e869..b3c32028dc5a 100644 --- a/libcxxabi/src/cxa_guard_impl.h +++ b/libcxxabi/src/cxa_guard_impl.h @@ -56,7 +56,7 @@ #include <limits.h> #include <stdlib.h> -#include <__threading_support> +#include "threading_support.h" #ifndef _LIBCXXABI_HAS_NO_THREADS # if defined(__ELF__) && defined(_LIBCXXABI_LINK_PTHREAD_LIB) # pragma comment(lib, "pthread") diff --git a/libcxxabi/src/cxa_thread_atexit.cpp b/libcxxabi/src/cxa_thread_atexit.cpp index 665f9e55694a..1a04dddb34be 100644 --- a/libcxxabi/src/cxa_thread_atexit.cpp +++ b/libcxxabi/src/cxa_thread_atexit.cpp @@ -8,7 +8,7 @@ #include "abort_message.h" #include "cxxabi.h" -#include <__threading_support> +#include "threading_support.h" #ifndef _LIBCXXABI_HAS_NO_THREADS #if defined(__ELF__) && defined(_LIBCXXABI_LINK_PTHREAD_LIB) #pragma comment(lib, "pthread") diff --git a/libcxxabi/src/fallback_malloc.cpp b/libcxxabi/src/fallback_malloc.cpp index 1d6c3808b217..9db431ee8297 100644 --- a/libcxxabi/src/fallback_malloc.cpp +++ b/libcxxabi/src/fallback_malloc.cpp @@ -8,7 +8,7 @@ #include "fallback_malloc.h" -#include <__threading_support> +#include "threading_support.h" #ifndef _LIBCXXABI_HAS_NO_THREADS #if defined(__ELF__) && defined(_LIBCXXABI_LINK_PTHREAD_LIB) #pragma comment(lib, "pthread") diff --git a/libcxxabi/test/test_exception_storage.pass.cpp b/libcxxabi/test/test_exception_storage.pass.cpp index 934cc4b6a7cb..4f1121bc7f39 100644 --- a/libcxxabi/test/test_exception_storage.pass.cpp +++ b/libcxxabi/test/test_exception_storage.pass.cpp @@ -9,7 +9,7 @@ #include <algorithm> #include <cstdio> #include <cstdlib> -#include <__threading_support> +#include "threading_support.h" #include <unistd.h> #include "../src/cxa_exception.h" diff --git a/libcxxabi/test/test_fallback_malloc.pass.cpp b/libcxxabi/test/test_fallback_malloc.pass.cpp index cc59129bf660..886b9a5f895a 100644 --- a/libcxxabi/test/test_fallback_malloc.pass.cpp +++ b/libcxxabi/test/test_fallback_malloc.pass.cpp @@ -9,7 +9,7 @@ #include <cstdio> #include <deque> -#include <__threading_support> +#include "threading_support.h" typedef std::deque<void *> container; |