Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Cleanup] Remove Lock APIs#217

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
coder137 merged 4 commits intomainfromremove_lock_apis
Oct 16, 2022
Merged
Show file tree
Hide file tree
Changes fromall 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
1 change: 0 additions & 1 deletionbuildcc/lib/target/include/target/api/target_getter.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -38,7 +38,6 @@ template <typename T> class TargetGetter {
// Target State
const TargetState &GetState() const;
bool IsBuilt() const;
bool IsLocked() const;

// Target Config
const TargetConfig &GetConfig() const;
Expand Down
1 change: 0 additions & 1 deletionbuildcc/lib/target/include/target/target_info.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -86,7 +86,6 @@ class TargetInfo : public internal::SourceApi<TargetInfo>,
TargetEnv env_;

//
FunctionLock lock_;
UserTargetSchema user_;

private:
Expand Down
2 changes: 0 additions & 2 deletionsbuildcc/lib/target/src/api/deps_api.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -24,14 +24,12 @@ template <typename T>
void DepsApi<T>::AddCompileDependencyAbsolute(const fs::path &absolute_path) {
T &t = static_cast<T &>(*this);

t.lock_.ExpectsUnlock(__FUNCTION__);
t.user_.compile_dependencies.insert(absolute_path);
}
template <typename T>
void DepsApi<T>::AddLinkDependencyAbsolute(const fs::path &absolute_path) {
T &t = static_cast<T &>(*this);

t.lock_.ExpectsUnlock(__FUNCTION__);
t.user_.link_dependencies.insert(absolute_path);
}

Expand Down
8 changes: 0 additions & 8 deletionsbuildcc/lib/target/src/api/flag_api.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -24,55 +24,47 @@ template <typename T>
void FlagApi<T>::AddPreprocessorFlag(const std::string &flag) {
T &t = static_cast<T &>(*this);

t.lock_.ExpectsUnlock(__FUNCTION__);
t.user_.preprocessor_flags.insert(flag);
}
template <typename T>
void FlagApi<T>::AddCommonCompileFlag(const std::string &flag) {
T &t = static_cast<T &>(*this);

t.lock_.ExpectsUnlock(__FUNCTION__);
t.user_.common_compile_flags.insert(flag);
}
template <typename T>
void FlagApi<T>::AddPchCompileFlag(const std::string &flag) {
T &t = static_cast<T &>(*this);

t.lock_.ExpectsUnlock(__FUNCTION__);
t.user_.pch_compile_flags.insert(flag);
}
template <typename T>
void FlagApi<T>::AddPchObjectFlag(const std::string &flag) {
T &t = static_cast<T &>(*this);

t.lock_.ExpectsUnlock(__FUNCTION__);
t.user_.pch_object_flags.insert(flag);
}
template <typename T>
void FlagApi<T>::AddAsmCompileFlag(const std::string &flag) {
T &t = static_cast<T &>(*this);

t.lock_.ExpectsUnlock(__FUNCTION__);
t.user_.asm_compile_flags.insert(flag);
}
template <typename T>
void FlagApi<T>::AddCCompileFlag(const std::string &flag) {
T &t = static_cast<T &>(*this);

t.lock_.ExpectsUnlock(__FUNCTION__);
t.user_.c_compile_flags.insert(flag);
}
template <typename T>
void FlagApi<T>::AddCppCompileFlag(const std::string &flag) {
T &t = static_cast<T &>(*this);

t.lock_.ExpectsUnlock(__FUNCTION__);
t.user_.cpp_compile_flags.insert(flag);
}
template <typename T> void FlagApi<T>::AddLinkFlag(const std::string &flag) {
T &t = static_cast<T &>(*this);

t.lock_.ExpectsUnlock(__FUNCTION__);
t.user_.link_flags.insert(flag);
}

Expand Down
2 changes: 0 additions & 2 deletionsbuildcc/lib/target/src/api/include_api.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -24,7 +24,6 @@ template <typename T>
void IncludeApi<T>::AddHeaderAbsolute(const fs::path &absolute_filepath) {
T &t = static_cast<T &>(*this);

t.lock_.ExpectsUnlock(__FUNCTION__);
t.toolchain_.GetConfig().ExpectsValidHeader(absolute_filepath);
t.user_.headers.insert(absolute_filepath);
}
Expand DownExpand Up@@ -74,7 +73,6 @@ void IncludeApi<T>::AddIncludeDirAbsolute(const fs::path &absolute_include_dir,
bool glob_headers) {
T &t = static_cast<T &>(*this);

t.lock_.ExpectsUnlock(__FUNCTION__);
t.user_.include_dirs.insert(absolute_include_dir);

if (glob_headers) {
Expand Down
3 changes: 0 additions & 3 deletionsbuildcc/lib/target/src/api/lib_api.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,7 +25,6 @@ template <typename T>
void LibApi<T>::AddLibDirAbsolute(const fs::path &absolute_lib_dir) {
T &t = static_cast<T &>(*this);

t.lock_.ExpectsUnlock(__FUNCTION__);
t.user_.lib_dirs.insert(absolute_lib_dir);
}

Expand All@@ -40,14 +39,12 @@ void LibApi<T>::AddLibDir(const fs::path &relative_lib_dir) {
template <typename T> void LibApi<T>::AddLibDep(const BaseTarget &lib_dep) {
T &t = static_cast<T &>(*this);

t.lock_.ExpectsUnlock(__FUNCTION__);
t.user_.libs.push_back(lib_dep.GetTargetPath());
}

template <typename T> void LibApi<T>::AddLibDep(const std::string &lib_dep) {
T &t = static_cast<T &>(*this);

t.lock_.ExpectsUnlock(__FUNCTION__);
t.user_.external_libs.push_back(lib_dep);
}

Expand Down
1 change: 0 additions & 1 deletionbuildcc/lib/target/src/api/pch_api.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -24,7 +24,6 @@ template <typename T>
void PchApi<T>::AddPchAbsolute(const fs::path &absolute_filepath) {
T &t = static_cast<T &>(*this);

t.lock_.ExpectsUnlock(__FUNCTION__);
t.toolchain_.GetConfig().ExpectsValidHeader(absolute_filepath);

const fs::path absolute_pch = fs::path(absolute_filepath).make_preferred();
Expand Down
1 change: 0 additions & 1 deletionbuildcc/lib/target/src/api/source_api.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -24,7 +24,6 @@ template <typename T>
void SourceApi<T>::AddSourceAbsolute(const fs::path &absolute_source) {
T &t = static_cast<T &>(*this);

t.lock_.ExpectsUnlock(__FUNCTION__);
t.toolchain_.GetConfig().ExpectsValidSource(absolute_source);
t.user_.sources.emplace(fs::path(absolute_source).make_preferred());
}
Expand Down
2 changes: 0 additions & 2 deletionsbuildcc/lib/target/src/api/sync_api.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -41,7 +41,6 @@ template <typename TargetType>
void SyncApi<T>::SpecializedCopy(TargetType target,
std::initializer_list<SyncOption> options) {
T &t = static_cast<T &>(*this);
t.lock_.ExpectsUnlock(__FUNCTION__);
for (const SyncOption o : options) {
switch (o) {
case SyncOption::PreprocessorFlags:
Expand DownExpand Up@@ -122,7 +121,6 @@ template <typename TargetType>
void SyncApi<T>::SpecializedInsert(TargetType target,
std::initializer_list<SyncOption> options) {
T &t = static_cast<T &>(*this);
t.lock_.ExpectsUnlock(__FUNCTION__);
for (const SyncOption o : options) {
switch (o) {
case SyncOption::PreprocessorFlags:
Expand Down
9 changes: 0 additions & 9 deletionsbuildcc/lib/target/src/api/target_getter.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -40,12 +40,6 @@ template <typename T> const TargetConfig &TargetGetter<T>::GetConfig() const {
return t.config_;
}

template <typename T> bool TargetGetter<T>::IsLocked() const {
const T &t = static_cast<const T &>(*this);

return t.lock_.IsLocked();
}

template <typename T> const fs::path &TargetGetter<T>::GetBinaryPath() const {
const T &t = static_cast<const T &>(*this);

Expand DownExpand Up@@ -95,22 +89,19 @@ const std::string &
TargetGetter<T>::GetCompileCommand(const fs::path &source) const {
const T &t = static_cast<const T &>(*this);

t.lock_.ExpectsLock(__FUNCTION__);
return t.compile_object_.GetObjectData(source).command;
}

template <typename T>
const std::string &TargetGetter<T>::GetLinkCommand() const {
const T &t = static_cast<const T &>(*this);

t.lock_.ExpectsLock(__FUNCTION__);
return t.link_target_.GetCommand();
}

template <typename T> tf::Taskflow &TargetGetter<T>::GetTaskflow() {
T &t = static_cast<T &>(*this);

t.lock_.ExpectsLock(__FUNCTION__);
return t.tf_;
}

Expand Down
3 changes: 0 additions & 3 deletionsbuildcc/lib/target/src/target/build.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -54,9 +54,6 @@ namespace buildcc {
void Target::Build() {
env::log_trace(name_, __FUNCTION__);

lock_.ExpectsUnlock("Target::Build");
lock_.Lock();

// PCH state
if (!user_.pchs.empty()) {
state_.PchDetected();
Expand Down
4 changes: 0 additions & 4 deletionsbuildcc/lib/target/src/target_info/target_info.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -21,10 +21,6 @@ namespace buildcc {
// PRIVATE

void TargetInfo::Initialize() {
// TODO, Update this later
// toolchain_.GetLockInfo().ExpectsLock(
// "Toolchain should be locked before usage through `Toolchain::Lock`");

std::for_each(toolchain_.GetPreprocessorFlags().begin(),
toolchain_.GetPreprocessorFlags().end(),
[&](const std::string &flag) { AddPreprocessorFlag(flag); });
Expand Down
6 changes: 0 additions & 6 deletionsbuildcc/lib/target/test/target/CMakeLists.txt
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -136,11 +136,6 @@ add_executable(test_target_user_deps
)
target_link_libraries(test_target_user_deps PRIVATE target_interface)

add_executable(test_target_lock
test_target_lock.cpp
)
target_link_libraries(test_target_lock PRIVATE target_interface)

add_executable(test_target_sync
test_target_sync.cpp
)
Expand All@@ -162,7 +157,6 @@ add_test(NAME test_target_external_lib COMMAND test_target_external_lib)

add_test(NAME test_target_flags COMMAND test_target_flags)
add_test(NAME test_target_user_deps COMMAND test_target_user_deps)
add_test(NAME test_target_lock COMMAND test_target_lock)

add_test(NAME test_target_sync COMMAND test_target_sync)

Expand Down
2 changes: 0 additions & 2 deletionsbuildcc/lib/target/test/target/constants.h.in
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -17,8 +17,6 @@ inline constexpr char const * BUILD_TARGET_FLAG_INTERMEDIATE_DIR = "@CMAKE_CURRE

inline constexpr char const * BUILD_TARGET_USER_DEPS_INTERMEDIATE_DIR = "@CMAKE_CURRENT_SOURCE_DIR@/intermediate/target_user_deps";

inline constexpr char const * BUILD_TARGET_LOCK_INTERMEDIATE_DIR = "@CMAKE_CURRENT_SOURCE_DIR@/intermediate/target_lock";

inline constexpr char const * BUILD_TARGET_SYNC_INTERMEDIATE_DIR = "@CMAKE_CURRENT_SOURCE_DIR@/intermediate/target_sync";

inline constexpr char const * BUILD_TARGET_FAILURE_STATES_BUILD_DIR = "@CMAKE_CURRENT_SOURCE_DIR@/intermediate/target_failure_states";
126 changes: 0 additions & 126 deletionsbuildcc/lib/target/test/target/test_target_lock.cpp
View file
Open in desktop

This file was deleted.

2 changes: 2 additions & 0 deletionsbuildcc/lib/target/test/target/test_target_source.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -243,6 +243,8 @@ TEST(TargetTestSourceGroup, Target_CompileCommand_Throws) {

// Throws when you call CompileCommand before Build
CHECK_THROWS(std::exception, simple.GetCompileCommand(p));
// Link Command will be empty before Build
STRCMP_EQUAL(simple.GetLinkCommand().c_str(), "");
}
}

Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp