Attempt to fix Github CI errors

This commit is contained in:
John Wellbelove 2025-02-03 15:03:28 +00:00
parent 7aa7c870b3
commit 574da35b10
5 changed files with 57 additions and 402 deletions

1
.gitignore vendored
View File

@ -394,3 +394,4 @@ examples/QueuedMessageRouter/vs2022/.vs/QueuedMessageRouter/v17
test/etl_error_handler/assert_errors/build-make
test/etl_error_handler/assert_function/build-make
test/syntax_check/bgcc
test/syntax_check/bclang

View File

@ -83,7 +83,7 @@ namespace etl
// Only integral and pointer types are supported.
//***************************************************************************
enum memory_order
typedef enum memory_order
{
memory_order_relaxed = __ATOMIC_RELAXED,
memory_order_consume = __ATOMIC_CONSUME,
@ -91,13 +91,22 @@ namespace etl
memory_order_release = __ATOMIC_RELEASE,
memory_order_acq_rel = __ATOMIC_ACQ_REL,
memory_order_seq_cst = __ATOMIC_SEQ_CST
} memory_order;
template <bool Is_Always_Lock_Free>
struct atomic_traits
{
static ETL_CONSTANT bool is_always_lock_free = Is_Always_Lock_Free;
};
template <bool Is_Always_Lock_Free>
ETL_CONSTANT bool atomic_traits<Is_Always_Lock_Free>::is_always_lock_free;
//***************************************************************************
/// For all types except bool, pointers and types that are always lock free.
//***************************************************************************
template <typename T, bool integral_type = etl::is_integral<T>::value>
class atomic
class atomic : public atomic_traits<integral_type>
{
public:
@ -377,8 +386,6 @@ namespace etl
return __atomic_compare_exchange_n(&value, &expected, desired, false, success, failure);
}
static ETL_CONSTANT bool is_always_lock_free = true;
private:
atomic& operator =(const atomic&) ETL_DELETE;
@ -391,7 +398,7 @@ namespace etl
/// Specialisation for pointers
//***************************************************************************
template <typename T>
class atomic<T*, false>
class atomic<T*, false> : public atomic_traits<true>
{
public:
@ -621,8 +628,6 @@ namespace etl
return __atomic_compare_exchange_n(&value, &expected_v, uintptr_t(desired), false, success, failure);
}
static ETL_CONSTANT bool is_always_lock_free = true;
private:
atomic& operator =(const atomic&) ETL_DELETE;
@ -635,7 +640,7 @@ namespace etl
/// Specialisation for bool
//***************************************************************************
template <>
class atomic<bool, true>
class atomic<bool, true> : public atomic_traits<true>
{
public:
@ -785,8 +790,6 @@ namespace etl
return __atomic_compare_exchange_n(&value, &expected_v, desired_v, false, success, failure);
}
static ETL_CONSTANT bool is_always_lock_free = true;
private:
atomic& operator =(const atomic&) ETL_DELETE;
@ -800,7 +803,7 @@ namespace etl
/// Uses a mutex to control access.
//***************************************************************************
template <typename T>
class atomic<T, false>
class atomic<T, false> : public atomic_traits<false>
{
public:
@ -1005,8 +1008,6 @@ namespace etl
return compare_exchange_weak(expected, desired);
}
static ETL_CONSTANT bool is_always_lock_free = false;
private:
mutable char flag;
@ -1038,11 +1039,20 @@ namespace etl
memory_order_seq_cst
} memory_order;
template <bool Is_Always_Lock_Free>
struct atomic_traits
{
static ETL_CONSTANT bool is_always_lock_free = Is_Always_Lock_Free;
};
template <bool Is_Always_Lock_Free>
ETL_CONSTANT bool atomic_traits<Is_Always_Lock_Free>::is_always_lock_free;
//***************************************************************************
/// For all types except bool and pointers
//***************************************************************************
template <typename T, bool integral_type = etl::is_integral<T>::value>
class atomic
class atomic : public atomic_traits<integral_type>
{
public:
@ -1436,8 +1446,6 @@ namespace etl
return true;
}
static ETL_CONSTANT bool is_always_lock_free = true;
private:
atomic& operator =(const atomic&) ETL_DELETE;
@ -1450,7 +1458,7 @@ namespace etl
/// Specialisation for pointers
//***************************************************************************
template <typename T>
class atomic<T*, false>
class atomic<T*, false> : public atomic_traits<true>
{
public:
@ -1748,8 +1756,6 @@ namespace etl
return true;
}
static ETL_CONSTANT bool is_always_lock_free = true;
private:
atomic& operator =(const atomic&) ETL_DELETE;
@ -1762,7 +1768,7 @@ namespace etl
/// Specialisation for bool
//***************************************************************************
template <>
class atomic<bool, true>
class atomic<bool, true> : public atomic_traits<true>
{
public:
@ -1972,8 +1978,6 @@ namespace etl
return true;
}
static ETL_CONSTANT bool is_always_lock_free = true;
private:
atomic& operator =(const atomic&) ETL_DELETE;
@ -1987,7 +1991,7 @@ namespace etl
/// Uses a mutex to control access.
//***************************************************************************
template <typename T>
class atomic<T, false>
class atomic<T, false> : public atomic_traits<false>
{
public:
@ -2174,8 +2178,6 @@ namespace etl
return compare_exchange_weak(expected, desired);
}
static ETL_CONSTANT bool is_always_lock_free = false;
private:
mutable char flag;
@ -2250,3 +2252,4 @@ namespace etl
}
#endif

View File

@ -54,6 +54,27 @@ SOFTWARE.
namespace etl
{
#if ETL_USING_STL && ETL_USING_CPP20
//*****************************************************************************
/// Obtain the address represented by p without forming a reference to the object pointed to by p.
/// Defined when using the STL and C++20
//*****************************************************************************
template <typename TPtr>
constexpr auto to_address(const TPtr& p) noexcept
{
return std::to_address(p);
}
//*****************************************************************************
/// Obtain the address represented by p without forming a reference to the object pointed to by p.
/// Defined when using the STL and C++20
//*****************************************************************************
template <typename T>
constexpr T* to_address(T* p) noexcept
{
return std::to_address(p);
}
#else
//*****************************************************************************
/// Obtain the address represented by p without forming a reference to the object pointed to by p.
/// Defined when not using the STL or C++20
@ -74,6 +95,7 @@ namespace etl
{
return itr.operator->();
}
#endif
#if ETL_USING_STL
//*****************************************************************************

View File

@ -186,77 +186,6 @@ etl_version=$(echo $etl_version_raw | sed -e 's/\r//g') # Remove trailing \r
gcc_compiler=$(g++ --version | grep g++)
clang_compiler=$(clang++ --version | grep clang)
#******************************************************************************
# GCC
#******************************************************************************
if [ "$compiler_enabled" = "gcc" ] || [ "$compiler_enabled" = "All compilers" ]; then
compiler=$gcc_compiler
SetConfigurationName "STL"
PrintHeader
rm * -rf
cmake -DCMAKE_C_COMPILER="gcc" -DCMAKE_CXX_COMPILER="g++" -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize -DETL_MESSAGES_ARE_NOT_VIRTUAL=OFF ..
cmake --build .
if [ $? -eq 0 ]; then
PassedCompilation
else
FailedCompilation
exit $?
fi
./etl_tests
if [ $? -eq 0 ]; then
PassedTests
else
FailedTests
exit $?
fi
fi
#******************************************************************************
if [ "$compiler_enabled" = "gcc" ] || [ "$compiler_enabled" = "All compilers" ]; then
compiler=$gcc_compiler
SetConfigurationName "STL - Non-virtual messages"
PrintHeader
rm * -rf
cmake -DCMAKE_C_COMPILER="gcc" -DCMAKE_CXX_COMPILER="g++" -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize -DETL_MESSAGES_ARE_NOT_VIRTUAL=ON ..
cmake --build .
if [ $? -eq 0 ]; then
PassedCompilation
else
FailedCompilation
exit $?
fi
./etl_tests
if [ $? -eq 0 ]; then
PassedTests
else
FailedTests
exit $?
fi
fi
#******************************************************************************
if [ "$compiler_enabled" = "gcc" ] || [ "$compiler_enabled" = "All compilers" ]; then
compiler=$gcc_compiler
SetConfigurationName "STL - Force C++03"
PrintHeader
rm * -rf
cmake -DCMAKE_C_COMPILER="gcc" -DCMAKE_CXX_COMPILER="g++" -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize -DETL_MESSAGES_ARE_NOT_VIRTUAL=OFF ..
cmake --build .
if [ $? -eq 0 ]; then
PassedCompilation
else
FailedCompilation
exit $?
fi
./etl_tests
if [ $? -eq 0 ]; then
PassedTests
else
FailedTests
exit $?
fi
fi
#******************************************************************************
if [ "$compiler_enabled" = "gcc" ] || [ "$compiler_enabled" = "All compilers" ]; then
compiler=$gcc_compiler
@ -306,50 +235,6 @@ fi
#******************************************************************************
# CLANG
#******************************************************************************
if [ "$compiler_enabled" = "clang" ] || [ "$compiler_enabled" = "All compilers" ]; then
compiler=$clang_compiler
SetConfigurationName "STL"
PrintHeader
rm * -rf
cmake -DCMAKE_C_COMPILER="clang" -DCMAKE_CXX_COMPILER="clang++" -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize -DETL_MESSAGES_ARE_NOT_VIRTUAL=OFF ..
cmake --build .
if [ $? -eq 0 ]; then
PassedCompilation
else
FailedCompilation
exit $?
fi
./etl_tests
if [ $? -eq 0 ]; then
PassedTests
else
FailedTests
exit $?
fi
fi
#******************************************************************************
if [ "$compiler_enabled" = "clang" ] || [ "$compiler_enabled" = "All compilers" ]; then
compiler=$clang_compiler
SetConfigurationName "STL - Force C++03"
PrintHeader
rm * -rf
cmake -DCMAKE_C_COMPILER="clang" -DCMAKE_CXX_COMPILER="clang++" -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize -DETL_MESSAGES_ARE_NOT_VIRTUAL=OFF ..
cmake --build .
if [ $? -eq 0 ]; then
PassedCompilation
else
FailedCompilation
exit $?
fi
./etl_tests
if [ $? -eq 0 ]; then
PassedTests
else
FailedTests
exit $?
fi
fi
#******************************************************************************
if [ "$compiler_enabled" = "clang" ] || [ "$compiler_enabled" = "All compilers" ]; then
@ -397,262 +282,6 @@ else
fi
fi
#******************************************************************************
if [ "$compiler_enabled" = "gcc" ] || [ "$compiler_enabled" = "All compilers" ]; then
compiler=$gcc_compiler
SetConfigurationName "Initializer list test"
PrintHeader
cd ../etl_initializer_list/
mkdir -p build-make || exit 1
cd build-make || exit 1
rm * -rf
cmake -DCMAKE_C_COMPILER="gcc" -DCMAKE_C_COMPILER="gcc" -DCMAKE_CXX_COMPILER="g++" -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize ..
cmake --build .
if [ $? -eq 0 ]; then
PassedCompilation
else
FailedCompilation
exit $?
fi
./etl_tests
if [ $? -eq 0 ]; then
PassedTests
else
FailedTests
exit $?
fi
fi
#******************************************************************************
if [ "$compiler_enabled" = "clang" ] || [ "$compiler_enabled" = "All compilers" ]; then
compiler=$clang_compiler
SetConfigurationName "Initializer list test"
PrintHeader
rm * -rf
cmake -DCMAKE_C_COMPILER="clang" -DCMAKE_CXX_COMPILER="clang++" -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize ..
cmake --build .
if [ $? -eq 0 ]; then
PassedCompilation
else
FailedCompilation
exit $?
fi
./etl_tests
if [ $? -eq 0 ]; then
PassedTests
else
FailedTests
exit $?
fi
fi
#******************************************************************************
if [ "$compiler_enabled" = "gcc" ] || [ "$compiler_enabled" = "All compilers" ]; then
compiler=$gcc_compiler
SetConfigurationName "Error macros 'log_errors' test"
PrintHeader
cd ../../etl_error_handler/log_errors
mkdir -p build-make || exit 1
cd build-make || exit 1
rm * -rf
cmake -DCMAKE_C_COMPILER="gcc" -DCMAKE_CXX_COMPILER="g++" -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize ..
cmake --build .
if [ $? -eq 0 ]; then
PassedCompilation
else
FailedCompilation
exit $?
fi
./etl_tests
if [ $? -eq 0 ]; then
PassedTests
else
FailedTests
exit $?
fi
fi
#******************************************************************************
if [ "$compiler_enabled" = "gcc" ] || [ "$compiler_enabled" = "All compilers" ]; then
compiler=$gcc_compiler
SetConfigurationName "Error macros 'exceptions' test"
PrintHeader
cd ../../../etl_error_handler/exceptions
mkdir -p build-make || exit 1
cd build-make || exit 1
rm * -rf
cmake -DCMAKE_C_COMPILER="gcc" -DCMAKE_CXX_COMPILER="g++" -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize ..
cmake --build .
if [ $? -eq 0 ]; then
PassedCompilation
else
FailedCompilation
exit $?
fi
./etl_tests
if [ $? -eq 0 ]; then
PassedTests
else
FailedTests
exit $?
fi
fi
#******************************************************************************
if [ "$compiler_enabled" = "gcc" ] || [ "$compiler_enabled" = "All compilers" ]; then
compiler=$gcc_compiler
SetConfigurationName "Error macros 'log_errors and exceptions' test"
PrintHeader
cd ../../../etl_error_handler/log_errors_and_exceptions
mkdir -p build-make || exit 1
cd build-make || exit 1
rm * -rf
cmake -DCMAKE_C_COMPILER="gcc" -DCMAKE_CXX_COMPILER="g++" -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize ..
cmake --build .
if [ $? -eq 0 ]; then
PassedCompilation
else
FailedCompilation
exit $?
fi
./etl_tests
if [ $? -eq 0 ]; then
PassedTests
else
FailedTests
exit $?
fi
fi
#******************************************************************************
if [ "$compiler_enabled" = "gcc" ] || [ "$compiler_enabled" = "All compilers" ]; then
compiler=$gcc_compiler
SetConfigurationName "Error macros 'assert function' test"
PrintHeader
cd ../../../etl_error_handler/assert_function
mkdir -p build-make || exit 1
cd build-make || exit 1
rm * -rf
cmake -DCMAKE_C_COMPILER="gcc" -DCMAKE_CXX_COMPILER="g++" -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize ..
cmake --build .
if [ $? -eq 0 ]; then
PassedCompilation
else
FailedCompilation
exit $?
fi
./etl_tests
if [ $? -eq 0 ]; then
PassedTests
else
FailedTests
exit $?
fi
fi
#******************************************************************************
if [ "$compiler_enabled" = "clang" ] || [ "$compiler_enabled" = "All compilers" ]; then
compiler=$clang_compiler
SetConfigurationName "Error macros 'log_errors' test"
PrintHeader
cd ../../../etl_error_handler/log_errors
mkdir -p build-make || exit 1
cd build-make || exit 1
rm * -rf
cmake -DCMAKE_C_COMPILER="clang" -DCMAKE_CXX_COMPILER="clang++" -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize ..
cmake --build .
if [ $? -eq 0 ]; then
PassedCompilation
else
FailedCompilation
exit $?
fi
./etl_tests
if [ $? -eq 0 ]; then
PassedTests
else
FailedTests
exit $?
fi
fi
#******************************************************************************
if [ "$compiler_enabled" = "clang" ] || [ "$compiler_enabled" = "All compilers" ]; then
compiler=$clang_compiler
SetConfigurationName "Error macros 'exceptions' test"
PrintHeader
cd ../../../etl_error_handler/exceptions
mkdir -p build-make || exit 1
cd build-make || exit 1
rm * -rf
cmake -DCMAKE_C_COMPILER="clang" -DCMAKE_CXX_COMPILER="clang++" -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize ..
cmake --build .
if [ $? -eq 0 ]; then
PassedCompilation
else
FailedCompilation
exit $?
fi
./etl_tests
if [ $? -eq 0 ]; then
PassedTests
else
FailedTests
exit $?
fi
fi
#******************************************************************************
if [ "$compiler_enabled" = "clang" ] || [ "$compiler_enabled" = "All compilers" ]; then
compiler=$clang_compiler
SetConfigurationName "Error macros 'log_errors and exceptions' test"
PrintHeader
cd ../../../etl_error_handler/log_errors_and_exceptions
mkdir -p build-make || exit 1
cd build-make || exit 1
rm * -rf
cmake -DCMAKE_C_COMPILER="clang" -DCMAKE_CXX_COMPILER="clang++" -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize ..
cmake --build .
if [ $? -eq 0 ]; then
PassedCompilation
else
FailedCompilation
exit $?
fi
./etl_tests
if [ $? -eq 0 ]; then
PassedTests
else
FailedTests
exit $?
fi
fi
#******************************************************************************
if [ "$compiler_enabled" = "clang" ] || [ "$compiler_enabled" = "All compilers" ]; then
compiler=$clang_compiler
SetConfigurationName "Error macros 'assert function' test"
PrintHeader
cd ../../../etl_error_handler/assert_function
mkdir -p build-make || exit 1
cd build-make || exit 1
rm * -rf
cmake -DCMAKE_C_COMPILER="clang" -DCMAKE_CXX_COMPILER="clang++" -DETL_OPTIMISATION=$opt -DETL_CXX_STANDARD=$cxx_standard -DETL_ENABLE_SANITIZER=$sanitize ..
cmake --build .
if [ $? -eq 0 ]; then
PassedCompilation
else
FailedCompilation
exit $?
fi
./etl_tests
if [ $? -eq 0 ]; then
PassedTests
else
FailedTests
exit $?
fi
fi
cd ../..

View File

@ -66,7 +66,7 @@ namespace
ETL_END_ENUM_TYPE
};
SUITE(test_atomic_std)
SUITE(test_atomic)
{
//*************************************************************************
TEST(test_atomic_integer_is_lock_free)
@ -76,7 +76,7 @@ namespace
CHECK_EQUAL(compare.is_lock_free(), test.is_lock_free());
//#if ETL_NOT_USING_STL && (defined(ETL_COMPILER_ARM5) || defined(ETL_COMPILER_ARM6) || defined(ETL_COMPILER_GCC) || defined(ETL_COMPILER_CLANG))
//#if ETL_NOT_USING_STL && ETL_HAS_ATOMIC
// CHECK_TRUE(etl::atomic<int>::is_always_lock_free);
// CHECK_TRUE(test.is_always_lock_free);
//#endif
@ -90,10 +90,10 @@ namespace
CHECK_EQUAL(compare.is_lock_free(), test.is_lock_free());
//#if ETL_NOT_USING_STL && (defined(ETL_COMPILER_ARM5) || defined(ETL_COMPILER_ARM6) || defined(ETL_COMPILER_GCC) || defined(ETL_COMPILER_CLANG))
// CHECK_TRUE(etl::atomic<int*>::is_always_lock_free);
// CHECK_TRUE(test.is_always_lock_free);
//#endif
#if ETL_NOT_USING_STL && ETL_HAS_ATOMIC
CHECK_TRUE(etl::atomic<int*>::is_always_lock_free);
CHECK_TRUE(test.is_always_lock_free);
#endif
}
//#if ETL_NOT_USING_STL && ETL_HAS_ATOMIC