Skip to content
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

Fixed MODE_NOLOG not compiling with c++11 #21

Merged
merged 2 commits into from
Dec 22, 2023
Merged
Changes from 1 commit
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
Prev Previous commit
Fixed compile error when using C++11 in async_tests.h
4c3y committed Dec 21, 2023
commit 20782d313454e4f590abaa62063bb314eabd1f36
11 changes: 10 additions & 1 deletion test/common/async_tests.h
Original file line number Diff line number Diff line change
@@ -5,8 +5,12 @@
#ifndef LOG_TEST_COMMON_ASYNC_TESTS_H_
#define LOG_TEST_COMMON_ASYNC_TESTS_H_

#include <thread>
#if __cplusplus >= 201703L
#include <mutex>
#endif

#include <test_utils.h>
#include <thread>

#define GET_CLASS_NAME(class_ptr, status) abi::__cxa_demangle(typeid(class_ptr).name(), nullptr, nullptr, status)

@@ -44,7 +48,12 @@ class TestResult {
* @return true on success otherwise false
*/
inline bool get(const std::string &test_name) {
#if __cplusplus >= 201703L
std::scoped_lock<std::mutex> lock(test_result_mutex_);
#elif __cplusplus >= 201103L
std::lock_guard<std::mutex> lock(test_result_mutex_);
#endif

LOG_INIT(*test_argv);
if (!started_) {
started_ = true;