Skip to content

[libc++] Make the __availability header a sub-header of __config #93083

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 1 commit into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libcxx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ option(LIBCXX_ENABLE_VENDOR_AVAILABILITY_ANNOTATIONS
on definitions in a shared library. By default, we assume that we're not building
libc++ for any specific vendor, and we disable those annotations. Vendors wishing
to provide compile-time errors when using features unavailable on some version of
the shared library they shipped should turn this on and see `include/__availability`
the shared library they shipped should turn this on and see `include/__configuration/availability.h`
for more details." OFF)

if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
Expand Down
3 changes: 2 additions & 1 deletion libcxx/include/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,6 @@ set(files
__atomic/kill_dependency.h
__atomic/memory_order.h
__atomic/to_gcc_order.h
__availability
__bit/bit_cast.h
__bit/bit_ceil.h
__bit/bit_floor.h
Expand Down Expand Up @@ -315,7 +314,9 @@ set(files
__condition_variable/condition_variable.h
__config
__configuration/abi.h
__configuration/availability.h
__configuration/compiler.h
__configuration/language.h
__configuration/platform.h
__coroutine/coroutine_handle.h
__coroutine/coroutine_traits.h
Expand Down
1 change: 0 additions & 1 deletion libcxx/include/__atomic/atomic_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include <__atomic/cxx_atomic_impl.h>
#include <__atomic/is_always_lock_free.h>
#include <__atomic/memory_order.h>
#include <__availability>
#include <__config>
#include <__memory/addressof.h>
#include <__type_traits/is_integral.h>
Expand Down
1 change: 0 additions & 1 deletion libcxx/include/__atomic/atomic_flag.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include <__atomic/contention_t.h>
#include <__atomic/cxx_atomic_impl.h>
#include <__atomic/memory_order.h>
#include <__availability>
#include <__chrono/duration.h>
#include <__config>
#include <__memory/addressof.h>
Expand Down
1 change: 0 additions & 1 deletion libcxx/include/__atomic/atomic_sync.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include <__atomic/cxx_atomic_impl.h>
#include <__atomic/memory_order.h>
#include <__atomic/to_gcc_order.h>
#include <__availability>
#include <__chrono/duration.h>
#include <__config>
#include <__memory/addressof.h>
Expand Down
1 change: 0 additions & 1 deletion libcxx/include/__charconv/to_chars_floating_point.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#ifndef _LIBCPP___CHARCONV_TO_CHARS_FLOATING_POINT_H
#define _LIBCPP___CHARCONV_TO_CHARS_FLOATING_POINT_H

#include <__availability>
#include <__charconv/chars_format.h>
#include <__charconv/to_chars_result.h>
#include <__config>
Expand Down
1 change: 0 additions & 1 deletion libcxx/include/__chrono/file_clock.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#ifndef _LIBCPP___CHRONO_FILE_CLOCK_H
#define _LIBCPP___CHRONO_FILE_CLOCK_H

#include <__availability>
#include <__chrono/duration.h>
#include <__chrono/system_clock.h>
#include <__chrono/time_point.h>
Expand Down
1 change: 0 additions & 1 deletion libcxx/include/__chrono/tzdb_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
// Enable the contents of the header only when libc++ was built with experimental features enabled.
#if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)

# include <__availability>
# include <__chrono/time_zone.h>
# include <__chrono/tzdb.h>
# include <__config>
Expand Down
29 changes: 1 addition & 28 deletions libcxx/include/__config
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

#include <__config_site>
#include <__configuration/abi.h>
#include <__configuration/availability.h>
#include <__configuration/compiler.h>
#include <__configuration/platform.h>

Expand All @@ -35,25 +36,6 @@
# define _LIBCPP_FREESTANDING
# endif

// NOLINTBEGIN(libcpp-cpp-version-check)
# ifndef _LIBCPP_STD_VER
# if __cplusplus <= 201103L
# define _LIBCPP_STD_VER 11
# elif __cplusplus <= 201402L
# define _LIBCPP_STD_VER 14
# elif __cplusplus <= 201703L
# define _LIBCPP_STD_VER 17
# elif __cplusplus <= 202002L
# define _LIBCPP_STD_VER 20
# elif __cplusplus <= 202302L
# define _LIBCPP_STD_VER 23
# else
// Expected release year of the next C++ standard
# define _LIBCPP_STD_VER 26
# endif
# endif // _LIBCPP_STD_VER
// NOLINTEND(libcpp-cpp-version-check)

// HARDENING {

// TODO(hardening): deprecate this in LLVM 19.
Expand Down Expand Up @@ -364,10 +346,6 @@ typedef __char32_t char32_t;

# endif

# if !defined(__cpp_exceptions) || __cpp_exceptions < 199711L
# define _LIBCPP_HAS_NO_EXCEPTIONS
# endif

# define _LIBCPP_PREFERRED_ALIGNOF(_Tp) __alignof(_Tp)

# if defined(_LIBCPP_COMPILER_CLANG_BASED)
Expand Down Expand Up @@ -840,11 +818,6 @@ typedef __char32_t char32_t;
# define _LIBCPP_CONSTEXPR_SINCE_CXX23
# endif

// Try to find out if RTTI is disabled.
# if !defined(__cpp_rtti) || __cpp_rtti < 199711L
# define _LIBCPP_HAS_NO_RTTI
# endif

# ifndef _LIBCPP_WEAK
# define _LIBCPP_WEAK __attribute__((__weak__))
# endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
//
//===----------------------------------------------------------------------===//

#ifndef _LIBCPP___AVAILABILITY
#define _LIBCPP___AVAILABILITY
#ifndef _LIBCPP___CONFIGURATION_AVAILABILITY_H
#define _LIBCPP___CONFIGURATION_AVAILABILITY_H

#include <__config>
#include <__configuration/compiler.h>
#include <__configuration/language.h>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
Expand Down Expand Up @@ -374,4 +375,4 @@
# define _LIBCPP_AVAILABILITY_INIT_PRIMARY_EXCEPTION
#endif

#endif // _LIBCPP___AVAILABILITY
#endif // _LIBCPP___CONFIGURATION_AVAILABILITY_H
46 changes: 46 additions & 0 deletions libcxx/include/__configuration/language.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// -*- C++ -*-
//===----------------------------------------------------------------------===//
//
// 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 _LIBCPP___CONFIGURATION_LANGUAGE_H
#define _LIBCPP___CONFIGURATION_LANGUAGE_H

#include <__config_site>

#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
# pragma GCC system_header
#endif

// NOLINTBEGIN(libcpp-cpp-version-check)
#ifdef __cplusplus
# if __cplusplus <= 201103L
# define _LIBCPP_STD_VER 11
# elif __cplusplus <= 201402L
# define _LIBCPP_STD_VER 14
# elif __cplusplus <= 201703L
# define _LIBCPP_STD_VER 17
# elif __cplusplus <= 202002L
# define _LIBCPP_STD_VER 20
# elif __cplusplus <= 202302L
# define _LIBCPP_STD_VER 23
# else
// Expected release year of the next C++ standard
# define _LIBCPP_STD_VER 26
# endif
#endif // __cplusplus
// NOLINTEND(libcpp-cpp-version-check)

#if !defined(__cpp_rtti) || __cpp_rtti < 199711L
# define _LIBCPP_HAS_NO_RTTI
#endif

#if !defined(__cpp_exceptions) || __cpp_exceptions < 199711L
# define _LIBCPP_HAS_NO_EXCEPTIONS
#endif

#endif // _LIBCPP___CONFIGURATION_LANGUAGE_H
1 change: 0 additions & 1 deletion libcxx/include/__exception/exception_ptr.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#ifndef _LIBCPP___EXCEPTION_EXCEPTION_PTR_H
#define _LIBCPP___EXCEPTION_EXCEPTION_PTR_H

#include <__availability>
#include <__config>
#include <__exception/operations.h>
#include <__memory/addressof.h>
Expand Down
1 change: 0 additions & 1 deletion libcxx/include/__expected/bad_expected_access.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#ifndef _LIBCPP___EXPECTED_BAD_EXPECTED_ACCESS_H
#define _LIBCPP___EXPECTED_BAD_EXPECTED_ACCESS_H

#include <__availability>
#include <__config>
#include <__exception/exception.h>
#include <__utility/move.h>
Expand Down
1 change: 0 additions & 1 deletion libcxx/include/__filesystem/directory_entry.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#ifndef _LIBCPP___FILESYSTEM_DIRECTORY_ENTRY_H
#define _LIBCPP___FILESYSTEM_DIRECTORY_ENTRY_H

#include <__availability>
#include <__chrono/time_point.h>
#include <__compare/ordering.h>
#include <__config>
Expand Down
1 change: 0 additions & 1 deletion libcxx/include/__filesystem/directory_iterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#define _LIBCPP___FILESYSTEM_DIRECTORY_ITERATOR_H

#include <__assert>
#include <__availability>
#include <__config>
#include <__filesystem/directory_entry.h>
#include <__filesystem/directory_options.h>
Expand Down
1 change: 0 additions & 1 deletion libcxx/include/__filesystem/filesystem_error.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#ifndef _LIBCPP___FILESYSTEM_FILESYSTEM_ERROR_H
#define _LIBCPP___FILESYSTEM_FILESYSTEM_ERROR_H

#include <__availability>
#include <__config>
#include <__filesystem/path.h>
#include <__memory/shared_ptr.h>
Expand Down
1 change: 0 additions & 1 deletion libcxx/include/__filesystem/operations.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#ifndef _LIBCPP___FILESYSTEM_OPERATIONS_H
#define _LIBCPP___FILESYSTEM_OPERATIONS_H

#include <__availability>
#include <__chrono/time_point.h>
#include <__config>
#include <__filesystem/copy_options.h>
Expand Down
1 change: 0 additions & 1 deletion libcxx/include/__filesystem/path.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

#include <__algorithm/replace.h>
#include <__algorithm/replace_copy.h>
#include <__availability>
#include <__config>
#include <__functional/unary_function.h>
#include <__fwd/functional.h>
Expand Down
1 change: 0 additions & 1 deletion libcxx/include/__filesystem/path_iterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#define _LIBCPP___FILESYSTEM_PATH_ITERATOR_H

#include <__assert>
#include <__availability>
#include <__config>
#include <__filesystem/path.h>
#include <__iterator/iterator_traits.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#ifndef _LIBCPP___FILESYSTEM_RECURSIVE_DIRECTORY_ITERATOR_H
#define _LIBCPP___FILESYSTEM_RECURSIVE_DIRECTORY_ITERATOR_H

#include <__availability>
#include <__config>
#include <__filesystem/directory_entry.h>
#include <__filesystem/directory_options.h>
Expand Down
1 change: 0 additions & 1 deletion libcxx/include/__filesystem/u8path.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#define _LIBCPP___FILESYSTEM_U8PATH_H

#include <__algorithm/unwrap_iter.h>
#include <__availability>
#include <__config>
#include <__filesystem/path.h>
#include <string>
Expand Down
1 change: 0 additions & 1 deletion libcxx/include/__functional/function.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#define _LIBCPP___FUNCTIONAL_FUNCTION_H

#include <__assert>
#include <__availability>
#include <__config>
#include <__exception/exception.h>
#include <__functional/binary_function.h>
Expand Down
1 change: 0 additions & 1 deletion libcxx/include/__fwd/memory_resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#ifndef _LIBCPP___FWD_MEMORY_RESOURCE_H
#define _LIBCPP___FWD_MEMORY_RESOURCE_H

#include <__availability>
#include <__config>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
Expand Down
1 change: 0 additions & 1 deletion libcxx/include/__fwd/string.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#ifndef _LIBCPP___FWD_STRING_H
#define _LIBCPP___FWD_STRING_H

#include <__availability>
#include <__config>
#include <__fwd/memory.h>
#include <__fwd/memory_resource.h>
Expand Down
1 change: 0 additions & 1 deletion libcxx/include/__memory_resource/memory_resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#ifndef _LIBCPP___MEMORY_RESOURCE_MEMORY_RESOURCE_H
#define _LIBCPP___MEMORY_RESOURCE_MEMORY_RESOURCE_H

#include <__availability>
#include <__config>
#include <__fwd/memory_resource.h>
#include <cstddef>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#ifndef _LIBCPP___MEMORY_RESOURCE_MONOTONIC_BUFFER_RESOURCE_H
#define _LIBCPP___MEMORY_RESOURCE_MONOTONIC_BUFFER_RESOURCE_H

#include <__availability>
#include <__config>
#include <__memory/addressof.h>
#include <__memory_resource/memory_resource.h>
Expand Down
1 change: 0 additions & 1 deletion libcxx/include/__memory_resource/polymorphic_allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#define _LIBCPP___MEMORY_RESOURCE_POLYMORPHIC_ALLOCATOR_H

#include <__assert>
#include <__availability>
#include <__config>
#include <__fwd/pair.h>
#include <__memory_resource/memory_resource.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#ifndef _LIBCPP___MEMORY_RESOURCE_SYNCHRONIZED_POOL_RESOURCE_H
#define _LIBCPP___MEMORY_RESOURCE_SYNCHRONIZED_POOL_RESOURCE_H

#include <__availability>
#include <__config>
#include <__memory_resource/memory_resource.h>
#include <__memory_resource/pool_options.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#ifndef _LIBCPP___MEMORY_RESOURCE_UNSYNCHRONIZED_POOL_RESOURCE_H
#define _LIBCPP___MEMORY_RESOURCE_UNSYNCHRONIZED_POOL_RESOURCE_H

#include <__availability>
#include <__config>
#include <__memory_resource/memory_resource.h>
#include <__memory_resource/pool_options.h>
Expand Down
1 change: 0 additions & 1 deletion libcxx/include/__ostream/print.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#ifndef _LIBCPP___OSTREAM_PRINT_H
#define _LIBCPP___OSTREAM_PRINT_H

#include <__availability>
#include <__config>
#include <__fwd/ostream.h>
#include <__iterator/ostreambuf_iterator.h>
Expand Down
1 change: 0 additions & 1 deletion libcxx/include/__stop_token/stop_callback.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#ifndef _LIBCPP___STOP_TOKEN_STOP_CALLBACK_H
#define _LIBCPP___STOP_TOKEN_STOP_CALLBACK_H

#include <__availability>
#include <__concepts/constructible.h>
#include <__concepts/destructible.h>
#include <__concepts/invocable.h>
Expand Down
1 change: 0 additions & 1 deletion libcxx/include/__stop_token/stop_source.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#ifndef _LIBCPP___STOP_TOKEN_STOP_SOURCE_H
#define _LIBCPP___STOP_TOKEN_STOP_SOURCE_H

#include <__availability>
#include <__config>
#include <__stop_token/intrusive_shared_ptr.h>
#include <__stop_token/stop_state.h>
Expand Down
1 change: 0 additions & 1 deletion libcxx/include/__stop_token/stop_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#define _LIBCPP___STOP_TOKEN_STOP_STATE_H

#include <__assert>
#include <__availability>
#include <__config>
#include <__stop_token/atomic_unique_lock.h>
#include <__stop_token/intrusive_list_view.h>
Expand Down
1 change: 0 additions & 1 deletion libcxx/include/__stop_token/stop_token.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#ifndef _LIBCPP___STOP_TOKEN_STOP_TOKEN_H
#define _LIBCPP___STOP_TOKEN_STOP_TOKEN_H

#include <__availability>
#include <__config>
#include <__stop_token/intrusive_shared_ptr.h>
#include <__stop_token/stop_state.h>
Expand Down
1 change: 0 additions & 1 deletion libcxx/include/__thread/jthread.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#ifndef _LIBCPP___THREAD_JTHREAD_H
#define _LIBCPP___THREAD_JTHREAD_H

#include <__availability>
#include <__config>
#include <__functional/invoke.h>
#include <__stop_token/stop_source.h>
Expand Down
1 change: 0 additions & 1 deletion libcxx/include/__thread/poll_with_backoff.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#ifndef _LIBCPP___THREAD_POLL_WITH_BACKOFF_H
#define _LIBCPP___THREAD_POLL_WITH_BACKOFF_H

#include <__availability>
#include <__chrono/duration.h>
#include <__chrono/high_resolution_clock.h>
#include <__config>
Expand Down
Loading
Loading