Skip to content

Commit

Permalink
[libc++] Remove obsolete header restrictions for _LIBCPP_HAS_NO_THREADS
Browse files Browse the repository at this point in the history
The _LIBCPP_HAS_NO_THREADS carve-out does not result in hard errors
anymore, but the patch that changed that forgot to update the header
restrictions we use to auto-generate several files.

We can also remove the restrictions for the no-localization build and
no-wide-characters, but doing it is less straightforward so I'm leaving
it out of this patch.
  • Loading branch information
ldionne committed Sep 10, 2024
1 parent 33f1235 commit c660cf0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 64 deletions.
36 changes: 9 additions & 27 deletions libcxx/include/__std_clang_module
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,8 @@
#include <algorithm>
#include <any>
#include <array>
#if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER)
# include <atomic>
#endif
#if !defined(_LIBCPP_HAS_NO_THREADS)
# include <barrier>
#endif
#include <atomic>
#include <barrier>
#include <bit>
#include <bitset>
#include <cassert>
Expand Down Expand Up @@ -101,9 +97,7 @@
# include <fstream>
#endif
#include <functional>
#if !defined(_LIBCPP_HAS_NO_THREADS)
# include <future>
#endif
#include <future>
#include <initializer_list>
#include <inttypes.h>
#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
Expand All @@ -120,9 +114,7 @@
# include <istream>
#endif
#include <iterator>
#if !defined(_LIBCPP_HAS_NO_THREADS)
# include <latch>
#endif
#include <latch>
#include <limits>
#include <list>
#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
Expand Down Expand Up @@ -153,31 +145,23 @@
# include <regex>
#endif
#include <scoped_allocator>
#if !defined(_LIBCPP_HAS_NO_THREADS)
# include <semaphore>
#endif
#include <semaphore>
#include <set>
#if !defined(_LIBCPP_HAS_NO_THREADS)
# include <shared_mutex>
#endif
#include <shared_mutex>
#include <source_location>
#include <span>
#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
# include <sstream>
#endif
#include <stack>
#if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER)
# include <stdatomic.h>
#endif
#include <stdatomic.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdexcept>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#if !defined(_LIBCPP_HAS_NO_THREADS)
# include <stop_token>
#endif
#include <stop_token>
#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
# include <streambuf>
#endif
Expand All @@ -192,9 +176,7 @@
#endif
#include <system_error>
#include <tgmath.h>
#if !defined(_LIBCPP_HAS_NO_THREADS)
# include <thread>
#endif
#include <thread>
#include <tuple>
#include <type_traits>
#include <typeindex>
Expand Down
32 changes: 8 additions & 24 deletions libcxx/modules/std.cppm.in
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,8 @@ module;
#include <algorithm>
#include <any>
#include <array>
#if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER)
# include <atomic>
#endif
#if !defined(_LIBCPP_HAS_NO_THREADS)
# include <barrier>
#endif
#include <atomic>
#include <barrier>
#include <bit>
#include <bitset>
#include <cassert>
Expand Down Expand Up @@ -76,9 +72,7 @@ module;
# include <fstream>
#endif
#include <functional>
#if !defined(_LIBCPP_HAS_NO_THREADS)
# include <future>
#endif
#include <future>
#include <initializer_list>
#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
# include <iomanip>
Expand All @@ -94,9 +88,7 @@ module;
# include <istream>
#endif
#include <iterator>
#if !defined(_LIBCPP_HAS_NO_THREADS)
# include <latch>
#endif
#include <latch>
#include <limits>
#include <list>
#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
Expand All @@ -123,23 +115,17 @@ module;
# include <regex>
#endif
#include <scoped_allocator>
#if !defined(_LIBCPP_HAS_NO_THREADS)
# include <semaphore>
#endif
#include <semaphore>
#include <set>
#if !defined(_LIBCPP_HAS_NO_THREADS)
# include <shared_mutex>
#endif
#include <shared_mutex>
#include <source_location>
#include <span>
#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
# include <sstream>
#endif
#include <stack>
#include <stdexcept>
#if !defined(_LIBCPP_HAS_NO_THREADS)
# include <stop_token>
#endif
#include <stop_token>
#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
# include <streambuf>
#endif
Expand All @@ -152,9 +138,7 @@ module;
# include <syncstream>
#endif
#include <system_error>
#if !defined(_LIBCPP_HAS_NO_THREADS)
# include <thread>
#endif
#include <thread>
#include <tuple>
#include <type_traits>
#include <typeindex>
Expand Down
13 changes: 0 additions & 13 deletions libcxx/utils/libcxx/header_information.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
import os, pathlib

header_restrictions = {
# headers with #error directives
"atomic": "!defined(_LIBCPP_HAS_NO_ATOMIC_HEADER)",
"stdatomic.h": "!defined(_LIBCPP_HAS_NO_ATOMIC_HEADER)",

# headers with #error directives
"ios": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)",
"locale.h": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)",
Expand All @@ -31,15 +27,6 @@
"strstream": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)",
"syncstream": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)",

# headers with #error directives
"barrier": "!defined(_LIBCPP_HAS_NO_THREADS)",
"future": "!defined(_LIBCPP_HAS_NO_THREADS)",
"latch": "!defined(_LIBCPP_HAS_NO_THREADS)",
"semaphore": "!defined(_LIBCPP_HAS_NO_THREADS)",
"shared_mutex": "!defined(_LIBCPP_HAS_NO_THREADS)",
"stop_token": "!defined(_LIBCPP_HAS_NO_THREADS)",
"thread": "!defined(_LIBCPP_HAS_NO_THREADS)",

# headers with #error directives
"wchar.h": "!defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS)",
"wctype.h": "!defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS)",
Expand Down

0 comments on commit c660cf0

Please sign in to comment.