Skip to content

Commit

Permalink
Make modules' support to be conformed with acc13
Browse files Browse the repository at this point in the history
As the title suggested.
  • Loading branch information
ChuanqiXu9 committed Aug 23, 2024
1 parent 4f55052 commit c409576
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 23 deletions.
24 changes: 24 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,30 @@ if(${ASYNC_SIMPLE_BUILD_MODULES})
endif()
endif()

if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "16.0.0")
string(CONCAT CMAKE_CXX_SCANDEP_SOURCE
"\"${CMAKE_CXX_COMPILER_CLANG_SCAN_DEPS}\""
" -format=p1689"
" --"
" <CMAKE_CXX_COMPILER> <DEFINES> <INCLUDES> <FLAGS>"
" -x c++ <SOURCE> -c -o <OBJECT>"
" -MT <DYNDEP_FILE>"
" -MD -MF <DEP_FILE>"
# Write to a temporary file. If the scan fails, we do not want to update
# the actual output file as `ninja` (at least) assumes that failed
# commands either delete or leave output files alone. See Issue#25419.
" > <DYNDEP_FILE>.tmp"
# We cannot use `copy_if_different` as the rule does not have a feature
# analogous to `ninja`'s `restat = 1`. It would also leave behind the
# `.tmp` file.
" && mv <DYNDEP_FILE>.tmp <DYNDEP_FILE>")
set(CMAKE_CXX_MODULE_MAP_FORMAT "clang")
set(CMAKE_CXX_MODULE_MAP_FLAG "@<MODULE_MAP_FILE>")
set(CMAKE_CXX_MODULE_BMI_ONLY_FLAG "--precompile")
endif()
endif()

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
endif()
Expand Down
2 changes: 1 addition & 1 deletion async_simple/Executor.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ class Executor::TimeAwaitable {

Executor::TimeAwaitable inline Executor::after(Executor::Duration dur) {
return Executor::TimeAwaitable(this, dur);
};
}

} // namespace async_simple

Expand Down
5 changes: 4 additions & 1 deletion async_simple/async_simple.cppm
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ export extern "C++" {
#include "IOExecutor.h"
#include "coro/SharedMutex.h"
#include "uthread/Collect.h"
#include "coro/PromiseAllocator.h"
#include "executors/SimpleIOExecutor.h"
#include "coro/Mutex.h"
#include "Collect.h"
Expand All @@ -70,5 +69,9 @@ export extern "C++" {
#include "coro/SyncAwait.h"
#include "executors/SimpleExecutor.h"
#include "coro/Semaphore.h"
// There are some bugs in clang lower versions.
#if defined(__clang_major__) && __clang_major__ >= 17
#include "coro/PromiseAllocator.h"
#include "coro/Generator.h"
#endif
}
20 changes: 1 addition & 19 deletions async_simple/std.mock.cppm
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ module;
#include <vector>
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunknown-warning-option"
#pragma clang diagnostic ignored "-Wreserved-module-identifier"
#endif

Expand Down Expand Up @@ -416,7 +417,6 @@ using std::ranges::destroy_n;
} // namespace ranges
using std::default_delete;
using std::make_unique;
using std::make_unique_for_overwrite;
using std::unique_ptr;
using std::operator<;
using std::operator>;
Expand All @@ -425,7 +425,6 @@ using std::operator>=;
using std::operator<=>;
using std::operator<<;
using std::allocate_shared;
using std::allocate_shared_for_overwrite;
using std::atomic_compare_exchange_strong;
using std::atomic_compare_exchange_strong_explicit;
using std::atomic_compare_exchange_weak;
Expand All @@ -444,7 +443,6 @@ using std::enable_shared_from_this;
using std::get_deleter;
using std::hash;
using std::make_shared;
using std::make_shared_for_overwrite;
using std::owner_less;
using std::reinterpret_pointer_cast;
using std::shared_ptr;
Expand Down Expand Up @@ -892,14 +890,8 @@ using std::atomic_fetch_xor_explicit;
using std::atomic_flag;
using std::atomic_flag_clear;
using std::atomic_flag_clear_explicit;
using std::atomic_flag_notify_all;
using std::atomic_flag_notify_one;
using std::atomic_flag_test;
using std::atomic_flag_test_and_set;
using std::atomic_flag_test_and_set_explicit;
using std::atomic_flag_test_explicit;
using std::atomic_flag_wait;
using std::atomic_flag_wait_explicit;
using std::atomic_init;
using std::atomic_int;
using std::atomic_int16_t;
Expand Down Expand Up @@ -928,7 +920,6 @@ using std::atomic_ref;
using std::atomic_schar;
using std::atomic_short;
using std::atomic_signal_fence;
using std::atomic_signed_lock_free;
using std::atomic_size_t;
using std::atomic_store;
using std::atomic_store_explicit;
Expand All @@ -951,7 +942,6 @@ using std::atomic_uintmax_t;
using std::atomic_uintptr_t;
using std::atomic_ullong;
using std::atomic_ulong;
using std::atomic_unsigned_lock_free;
using std::atomic_ushort;
using std::atomic_wait;
using std::atomic_wait_explicit;
Expand Down Expand Up @@ -1091,7 +1081,6 @@ using std::ranges::iterator_t;
using std::ranges::output_range;
using std::ranges::random_access_range;
using std::ranges::range;
using std::ranges::range_common_reference_t;
using std::ranges::range_difference_t;
using std::ranges::range_reference_t;
using std::ranges::range_rvalue_reference_t;
Expand Down Expand Up @@ -1129,16 +1118,11 @@ using std::ranges::views::iota;
}
using std::ranges::basic_istream_view;
using std::ranges::istream_view;
using std::ranges::wistream_view;
namespace views {
using std::ranges::views::istream;
}
namespace views {
using std::ranges::views::all;
using std::ranges::views::all_t;
} // namespace views
using std::ranges::filter_view;
using std::ranges::owning_view;
using std::ranges::ref_view;
namespace views {
using std::ranges::views::filter;
Expand Down Expand Up @@ -1328,7 +1312,6 @@ using std::chrono::ceil;
using std::chrono::duration_cast;
using std::chrono::floor;
using std::chrono::round;
using std::chrono::operator<<;
using std::chrono::abs;
using std::chrono::day;
using std::chrono::days;
Expand Down Expand Up @@ -1375,7 +1358,6 @@ using std::chrono::year_month_weekday;
using std::chrono::year_month_weekday_last;
using std::chrono::years;
} // namespace chrono
using std::formatter;
namespace chrono {
using std::chrono::April;
using std::chrono::August;
Expand Down
2 changes: 1 addition & 1 deletion async_simple/uthread/internal/thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace async_simple {
namespace uthread {
namespace internal {

static constexpr size_t default_base_stack_size = 512 * 1024;
inline constexpr size_t default_base_stack_size = 512 * 1024;
size_t get_base_stack_size();

class thread_context {
Expand Down
2 changes: 1 addition & 1 deletion async_simple/util/ThreadPool.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class ThreadPool {
};

#ifdef __linux__
static void getCurrentCpus(std::vector<uint32_t> &ids) {
inline void getCurrentCpus(std::vector<uint32_t> &ids) {
cpu_set_t set;
ids.clear();
if (sched_getaffinity(0, sizeof(set), &set) == 0)
Expand Down

0 comments on commit c409576

Please sign in to comment.