diff --git a/base_c/CMakeLists.txt b/base_c/CMakeLists.txt index 8c3ba96..a05179d 100644 --- a/base_c/CMakeLists.txt +++ b/base_c/CMakeLists.txt @@ -77,14 +77,14 @@ endif() # Check headers and create configure file with preprocessor defines include(CheckIncludeFiles) # Includes module to perform checks include(CheckSymbolExists) # Includes module to perform symbol checks -check_include_files("sys/sysinfo.h" EMBB_HAS_HEADER_SYSINFO) -check_include_files("sys/types.h;sys/sysctl.h" EMBB_HAS_HEADER_SYSCTL) -check_include_files("sys/param.h;sys/cpuset.h" EMBB_HAS_HEADER_CPUSET) +check_include_files("sys/sysinfo.h" EMBB_PLATFORM_HAS_HEADER_SYSINFO) +check_include_files("sys/types.h;sys/sysctl.h" EMBB_PLATFORM_HAS_HEADER_SYSCTL) +check_include_files("sys/param.h;sys/cpuset.h" EMBB_PLATFORM_HAS_HEADER_CPUSET) link_libraries(${link_libraries} ${gnu_libs}) set(CMAKE_EXTRA_INCLUDE_FILES sched.h) - check_type_size(cpu_set_t EMBB_HAS_GLIB_CPU) + check_type_size(cpu_set_t EMBB_PLATFORM_HAS_GLIB_CPU) set(CMAKE_EXTRA_INCLUDE_FILES) -if(DEFINED EMBB_HAS_GLIB_CPU) +if(DEFINED EMBB_PLATFORM_HAS_GLIB_CPU) add_definitions(-D_GNU_SOURCE) # Needed to activate CPU_ macros endif() diff --git a/base_c/include/embb/base/c/atomic.h b/base_c/include/embb/base/c/atomic.h index ebf4f09..1fb7649 100644 --- a/base_c/include/embb/base/c/atomic.h +++ b/base_c/include/embb/base/c/atomic.h @@ -95,7 +95,7 @@ * \ingroup C_BASE_ATOMIC * \waitfree */ -EMBB_INLINE void embb_atomic_and_assign_TYPE( +EMBB_PLATFORM_INLINE void embb_atomic_and_assign_TYPE( embb_atomic_TYPE* variable, /**< [IN,OUT] Pointer to atomic variable which serves as left-hand side for the "and" operation and is used to store the result. */ @@ -120,7 +120,7 @@ EMBB_INLINE void embb_atomic_and_assign_TYPE( * \ingroup C_BASE_ATOMIC * \waitfree */ -EMBB_INLINE int embb_atomic_compare_and_swap_TYPE( +EMBB_PLATFORM_INLINE int embb_atomic_compare_and_swap_TYPE( embb_atomic_TYPE* variable, /**< [IN,OUT] Pointer to atomic variable */ TYPE* expected, @@ -140,7 +140,7 @@ EMBB_INLINE int embb_atomic_compare_and_swap_TYPE( * \ingroup C_BASE_ATOMIC * \waitfree */ -EMBB_INLINE TYPE embb_atomic_fetch_and_add_TYPE( +EMBB_PLATFORM_INLINE TYPE embb_atomic_fetch_and_add_TYPE( embb_atomic_TYPE* variable, /**< [IN,OUT] Pointer to atomic variable*/ TYPE value @@ -158,7 +158,7 @@ EMBB_INLINE TYPE embb_atomic_fetch_and_add_TYPE( * \ingroup C_BASE_ATOMIC * \waitfree */ -EMBB_INLINE TYPE embb_atomic_load_TYPE( +EMBB_PLATFORM_INLINE TYPE embb_atomic_load_TYPE( const embb_atomic_TYPE* variable /**< [IN] Pointer to atomic variable */ ); @@ -169,7 +169,7 @@ EMBB_INLINE TYPE embb_atomic_load_TYPE( * \ingroup C_BASE_ATOMIC * \waitfree */ -EMBB_INLINE void embb_atomic_memory_barrier(); +EMBB_PLATFORM_INLINE void embb_atomic_memory_barrier(); /** * Computes the logical "or" of the value stored in \p variable and \c value. @@ -182,7 +182,7 @@ EMBB_INLINE void embb_atomic_memory_barrier(); * \ingroup C_BASE_ATOMIC * \waitfree */ -EMBB_INLINE void embb_atomic_or_assign_TYPE( +EMBB_PLATFORM_INLINE void embb_atomic_or_assign_TYPE( embb_atomic_TYPE* variable, /**< [IN,OUT] Pointer to atomic variable which serves as left-hand side for the "or" operation and is used to store the result. */ @@ -199,7 +199,7 @@ EMBB_INLINE void embb_atomic_or_assign_TYPE( * \ingroup C_BASE_ATOMIC * \waitfree */ -EMBB_INLINE void embb_atomic_store_TYPE( +EMBB_PLATFORM_INLINE void embb_atomic_store_TYPE( embb_atomic_TYPE* variable, /**< [IN,OUT] Pointer to atomic variable */ int value @@ -217,7 +217,7 @@ EMBB_INLINE void embb_atomic_store_TYPE( * \ingroup C_BASE_ATOMIC * \waitfree */ -EMBB_INLINE TYPE embb_atomic_swap_TYPE( +EMBB_PLATFORM_INLINE TYPE embb_atomic_swap_TYPE( embb_atomic_TYPE* variable, /**< [IN,OUT] Pointer to atomic variable whose value is swapped */ TYPE value @@ -235,7 +235,7 @@ EMBB_INLINE TYPE embb_atomic_swap_TYPE( * \ingroup C_BASE_ATOMIC * \waitfree */ -EMBB_INLINE void embb_atomic_xor_assign_TYPE( +EMBB_PLATFORM_INLINE void embb_atomic_xor_assign_TYPE( embb_atomic_TYPE* variable, /**< [IN,OUT] Pointer to atomic variable which serves as left-hand side for the "xor" operation and is used to store the result. */ diff --git a/base_c/include/embb/base/c/internal/atomic/and_assign.h b/base_c/include/embb/base/c/internal/atomic/and_assign.h index 86a0209..0959376 100644 --- a/base_c/include/embb/base/c/internal/atomic/and_assign.h +++ b/base_c/include/embb/base/c/internal/atomic/and_assign.h @@ -53,21 +53,21 @@ * BYTE_SIZE is the number of bytes passed to the macro. * */ -#ifdef EMBB_ARCH_X86 +#ifdef EMBB_PLATFORM_ARCH_X86 -#ifdef EMBB_COMPILER_MSVC +#ifdef EMBB_PLATFORM_COMPILER_MSVC #define EMBB_DEFINE_AND_ASSIGN(EMBB_PARAMETER_SIZE_BYTE, EMBB_ATOMIC_X86_SIZE_SUFFIX) \ extern void __fastcall EMBB_CAT2(embb_internal__atomic_and_assign_, EMBB_PARAMETER_SIZE_BYTE)_asm( \ EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) volatile* pointer_to_value, EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) value); \ - EMBB_INLINE void __fastcall EMBB_CAT2(embb_internal__atomic_and_assign_, EMBB_PARAMETER_SIZE_BYTE)(EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) volatile* pointer_to_value, \ + EMBB_PLATFORM_INLINE void __fastcall EMBB_CAT2(embb_internal__atomic_and_assign_, EMBB_PARAMETER_SIZE_BYTE)(EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) volatile* pointer_to_value, \ EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) value) { \ _ReadWriteBarrier(); \ EMBB_CAT2(embb_internal__atomic_and_assign_, EMBB_PARAMETER_SIZE_BYTE)_asm(pointer_to_value, value); \ _ReadWriteBarrier(); \ } -#elif defined(EMBB_COMPILER_GNUC) +#elif defined(EMBB_PLATFORM_COMPILER_GNUC) #define EMBB_DEFINE_AND_ASSIGN(EMBB_PARAMETER_SIZE_BYTE, EMBB_ATOMIC_X86_SIZE_SUFFIX)\ - EMBB_INLINE void EMBB_CAT2(embb_internal__atomic_and_assign_, \ + EMBB_PLATFORM_INLINE void EMBB_CAT2(embb_internal__atomic_and_assign_, \ EMBB_PARAMETER_SIZE_BYTE)(EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) volatile* pointer_to_value, EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) value) { \ __asm__ __volatile__("lock and" EMBB_ATOMIC_X86_SIZE_SUFFIX " %1, %0" \ : "+m" (*pointer_to_value), "+q" (value) \ @@ -89,12 +89,12 @@ EMBB_DEFINE_AND_ASSIGN(4, "l") EMBB_DEFINE_AND_ASSIGN(8, "q") #endif -#elif defined(EMBB_ARCH_ARM) +#elif defined(EMBB_PLATFORM_ARCH_ARM) -#if defined(EMBB_COMPILER_GNUC) +#if defined(EMBB_PLATFORM_COMPILER_GNUC) #define EMBB_DEFINE_AND_ASSIGN(EMBB_PARAMETER_SIZE_BYTE, \ EMBB_ATOMIC_ARM_SIZE_SUFFIX) \ - EMBB_INLINE \ + EMBB_PLATFORM_INLINE \ void EMBB_CAT2(embb_internal__atomic_and_assign_, \ EMBB_PARAMETER_SIZE_BYTE)(\ EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) \ @@ -148,7 +148,7 @@ EMBB_DEFINE_AND_ASSIGN(4, "") * This generated function is supposed to be called by the user of the lib. */ #define EMBB_ATOMIC_INTERNAL_DEFINE_AND_ASSIGN_METHOD(EMBB_ATOMIC_PARAMETER_TYPE_NATIVE, EMBB_ATOMIC_PARAMETER_ATOMIC_TYPE_SUFFIX, EMBB_ATOMIC_PARAMETER_TYPE_SIZE) \ - EMBB_INLINE void EMBB_CAT2(embb_atomic_and_assign_, EMBB_ATOMIC_PARAMETER_ATOMIC_TYPE_SUFFIX)(\ + EMBB_PLATFORM_INLINE void EMBB_CAT2(embb_atomic_and_assign_, EMBB_ATOMIC_PARAMETER_ATOMIC_TYPE_SUFFIX)(\ EMBB_CAT2(embb_atomic_, EMBB_ATOMIC_PARAMETER_ATOMIC_TYPE_SUFFIX)* variable, EMBB_ATOMIC_PARAMETER_TYPE_NATIVE value) { \ EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_ATOMIC_PARAMETER_TYPE_SIZE) value_pun;\ memcpy(&value_pun, &value, sizeof(EMBB_ATOMIC_PARAMETER_TYPE_NATIVE));\ diff --git a/base_c/include/embb/base/c/internal/atomic/atomic_variables.h b/base_c/include/embb/base/c/internal/atomic/atomic_variables.h index 57aa9b3..230c6b7 100644 --- a/base_c/include/embb/base/c/internal/atomic/atomic_variables.h +++ b/base_c/include/embb/base/c/internal/atomic/atomic_variables.h @@ -30,7 +30,7 @@ #include #include -#ifdef EMBB_COMPILER_MSVC +#ifdef EMBB_PLATFORM_COMPILER_MSVC #include #endif diff --git a/base_c/include/embb/base/c/internal/atomic/compare_and_swap.h b/base_c/include/embb/base/c/internal/atomic/compare_and_swap.h index 2837589..c6fdcc9 100644 --- a/base_c/include/embb/base/c/internal/atomic/compare_and_swap.h +++ b/base_c/include/embb/base/c/internal/atomic/compare_and_swap.h @@ -39,13 +39,13 @@ * See file and_assign.h for a detailed (and operation independent) description * of the following macro. */ -#ifdef EMBB_ARCH_X86 +#ifdef EMBB_PLATFORM_ARCH_X86 -#ifdef EMBB_COMPILER_MSVC +#ifdef EMBB_PLATFORM_COMPILER_MSVC #define EMBB_DEFINE_COMPARE_AND_SWAP(EMBB_PARAMETER_SIZE_BYTE, EMBB_ATOMIC_X86_SIZE_SUFFIX) \ extern int __fastcall EMBB_CAT2(embb_internal__atomic_compare_and_swap_, EMBB_PARAMETER_SIZE_BYTE)_asm( \ EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) volatile* pointer_to_value, EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) volatile* expected, EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) desired); \ - EMBB_INLINE int __fastcall EMBB_CAT2(embb_internal__atomic_compare_and_swap_, EMBB_PARAMETER_SIZE_BYTE)( \ + EMBB_PLATFORM_INLINE int __fastcall EMBB_CAT2(embb_internal__atomic_compare_and_swap_, EMBB_PARAMETER_SIZE_BYTE)( \ EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) volatile* pointer_to_value, EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) volatile* expected, EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) desired) { \ int result; \ _ReadWriteBarrier(); \ @@ -53,9 +53,9 @@ _ReadWriteBarrier(); \ return result; \ } -#elif defined(EMBB_COMPILER_GNUC) +#elif defined(EMBB_PLATFORM_COMPILER_GNUC) #define EMBB_DEFINE_COMPARE_AND_SWAP(EMBB_PARAMETER_SIZE_BYTE, EMBB_ATOMIC_X86_SIZE_SUFFIX) \ - EMBB_INLINE int EMBB_CAT2(embb_internal__atomic_compare_and_swap_, \ + EMBB_PLATFORM_INLINE int EMBB_CAT2(embb_internal__atomic_compare_and_swap_, \ EMBB_PARAMETER_SIZE_BYTE)(EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) volatile* pointer_to_value, EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) volatile* expected, \ EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) desired) { \ char result; \ @@ -82,12 +82,12 @@ EMBB_DEFINE_COMPARE_AND_SWAP(4, "l") EMBB_DEFINE_COMPARE_AND_SWAP(8, "q") #endif -#elif defined(EMBB_ARCH_ARM) +#elif defined(EMBB_PLATFORM_ARCH_ARM) -#if defined(EMBB_COMPILER_GNUC) +#if defined(EMBB_PLATFORM_COMPILER_GNUC) #define EMBB_DEFINE_COMPARE_AND_SWAP(EMBB_PARAMETER_SIZE_BYTE, \ EMBB_ATOMIC_ARM_SIZE_SUFFIX) \ - EMBB_INLINE \ + EMBB_PLATFORM_INLINE \ int EMBB_CAT2(embb_internal__atomic_compare_and_swap_, \ EMBB_PARAMETER_SIZE_BYTE)(\ EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) \ @@ -134,7 +134,7 @@ EMBB_DEFINE_COMPARE_AND_SWAP(4, "") * of the following macro. */ #define EMBB_ATOMIC_INTERNAL_DEFINE_COMPARE_AND_SWAP_METHOD(EMBB_ATOMIC_PARAMETER_TYPE_NATIVE, EMBB_ATOMIC_PARAMETER_ATOMIC_TYPE_SUFFIX, EMBB_ATOMIC_PARAMETER_TYPE_SIZE) \ - EMBB_INLINE int EMBB_CAT2(embb_atomic_compare_and_swap_, EMBB_ATOMIC_PARAMETER_ATOMIC_TYPE_SUFFIX)(\ + EMBB_PLATFORM_INLINE int EMBB_CAT2(embb_atomic_compare_and_swap_, EMBB_ATOMIC_PARAMETER_ATOMIC_TYPE_SUFFIX)(\ EMBB_CAT2(embb_atomic_, EMBB_ATOMIC_PARAMETER_ATOMIC_TYPE_SUFFIX)* variable, EMBB_ATOMIC_PARAMETER_TYPE_NATIVE* expected, EMBB_ATOMIC_PARAMETER_TYPE_NATIVE desired) {\ EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_ATOMIC_PARAMETER_TYPE_SIZE) desired_pun;\ memcpy(&desired_pun, &desired, sizeof(EMBB_ATOMIC_PARAMETER_TYPE_NATIVE));\ diff --git a/base_c/include/embb/base/c/internal/atomic/fetch_and_add.h b/base_c/include/embb/base/c/internal/atomic/fetch_and_add.h index e5449ac..89964e9 100644 --- a/base_c/include/embb/base/c/internal/atomic/fetch_and_add.h +++ b/base_c/include/embb/base/c/internal/atomic/fetch_and_add.h @@ -38,13 +38,13 @@ * See file and_assign.h for a detailed (and operation independent) description * of the following macro. */ -#ifdef EMBB_ARCH_X86 +#ifdef EMBB_PLATFORM_ARCH_X86 -#ifdef EMBB_COMPILER_MSVC +#ifdef EMBB_PLATFORM_COMPILER_MSVC #define EMBB_DEFINE_FETCH_AND_ADD(EMBB_PARAMETER_SIZE_BYTE, EMBB_ATOMIC_X86_SIZE_SUFFIX) \ extern EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) __fastcall EMBB_CAT2(embb_internal__atomic_fetch_and_add_, EMBB_PARAMETER_SIZE_BYTE)_asm( \ EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) volatile* pointer_to_value, EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) new_value); \ - EMBB_INLINE EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) __fastcall EMBB_CAT2(embb_internal__atomic_fetch_and_add_, EMBB_PARAMETER_SIZE_BYTE) (\ + EMBB_PLATFORM_INLINE EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) __fastcall EMBB_CAT2(embb_internal__atomic_fetch_and_add_, EMBB_PARAMETER_SIZE_BYTE) (\ EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) volatile* pointer_to_value, EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) new_value) {\ EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) result; \ _ReadWriteBarrier(); \ @@ -53,9 +53,9 @@ _ReadWriteBarrier(); \ return result; \ } -#elif defined(EMBB_COMPILER_GNUC) +#elif defined(EMBB_PLATFORM_COMPILER_GNUC) #define EMBB_DEFINE_FETCH_AND_ADD(EMBB_PARAMETER_SIZE_BYTE, EMBB_ATOMIC_X86_SIZE_SUFFIX) \ - EMBB_INLINE EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) EMBB_CAT2(embb_internal__atomic_fetch_and_add_, EMBB_PARAMETER_SIZE_BYTE) \ + EMBB_PLATFORM_INLINE EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) EMBB_CAT2(embb_internal__atomic_fetch_and_add_, EMBB_PARAMETER_SIZE_BYTE) \ (EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) volatile* pointer_to_value, EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) new_value) { \ __asm__ __volatile__ ("lock xadd" EMBB_ATOMIC_X86_SIZE_SUFFIX " %1, %0" \ : "+m" (*pointer_to_value), "+q" (new_value) \ @@ -78,12 +78,12 @@ EMBB_DEFINE_FETCH_AND_ADD(4, "l") EMBB_DEFINE_FETCH_AND_ADD(8, "q") #endif -#elif defined(EMBB_ARCH_ARM) +#elif defined(EMBB_PLATFORM_ARCH_ARM) -#if defined(EMBB_COMPILER_GNUC) +#if defined(EMBB_PLATFORM_COMPILER_GNUC) #define EMBB_DEFINE_FETCH_AND_ADD(EMBB_PARAMETER_SIZE_BYTE, \ EMBB_ATOMIC_ARM_SIZE_SUFFIX) \ - EMBB_INLINE \ + EMBB_PLATFORM_INLINE \ EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) \ EMBB_CAT2(embb_internal__atomic_fetch_and_add_, \ EMBB_PARAMETER_SIZE_BYTE)(\ @@ -127,7 +127,7 @@ EMBB_DEFINE_FETCH_AND_ADD(4, "") * of the following macro. */ #define EMBB_ATOMIC_INTERNAL_DEFINE_FETCH_AND_ADD_METHOD(EMBB_ATOMIC_PARAMETER_TYPE_NATIVE, EMBB_ATOMIC_PARAMETER_ATOMIC_TYPE_SUFFIX, EMBB_ATOMIC_PARAMETER_TYPE_SIZE) \ - EMBB_INLINE EMBB_ATOMIC_PARAMETER_TYPE_NATIVE EMBB_CAT2(embb_atomic_fetch_and_add_, EMBB_ATOMIC_PARAMETER_ATOMIC_TYPE_SUFFIX)(\ + EMBB_PLATFORM_INLINE EMBB_ATOMIC_PARAMETER_TYPE_NATIVE EMBB_CAT2(embb_atomic_fetch_and_add_, EMBB_ATOMIC_PARAMETER_ATOMIC_TYPE_SUFFIX)(\ EMBB_CAT2(embb_atomic_, EMBB_ATOMIC_PARAMETER_ATOMIC_TYPE_SUFFIX)* variable, EMBB_ATOMIC_PARAMETER_TYPE_NATIVE value) { \ EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_ATOMIC_PARAMETER_TYPE_SIZE) value_pun; \ memcpy(&value_pun, &value, sizeof(EMBB_ATOMIC_PARAMETER_TYPE_NATIVE)); \ diff --git a/base_c/include/embb/base/c/internal/atomic/load.h b/base_c/include/embb/base/c/internal/atomic/load.h index eb689d1..f5a3fcb 100644 --- a/base_c/include/embb/base/c/internal/atomic/load.h +++ b/base_c/include/embb/base/c/internal/atomic/load.h @@ -39,13 +39,13 @@ * See file and_assign.h for a detailed (and operation independent) description * of the following macro. */ -#ifdef EMBB_ARCH_X86 +#ifdef EMBB_PLATFORM_ARCH_X86 -#ifdef EMBB_COMPILER_MSVC +#ifdef EMBB_PLATFORM_COMPILER_MSVC #define EMBB_DEFINE_LOAD(EMBB_PARAMETER_SIZE_BYTE, EMBB_ATOMIC_X86_SIZE_SUFFIX) \ extern EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) __fastcall EMBB_CAT2(embb_internal__atomic_load_, EMBB_PARAMETER_SIZE_BYTE)_asm( \ EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) volatile* pointer_to_value); \ - EMBB_INLINE EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) __fastcall EMBB_CAT2(embb_internal__atomic_load_, EMBB_PARAMETER_SIZE_BYTE)(\ + EMBB_PLATFORM_INLINE EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) __fastcall EMBB_CAT2(embb_internal__atomic_load_, EMBB_PARAMETER_SIZE_BYTE)(\ EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) volatile* pointer_to_value) { \ register EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) result; \ _ReadWriteBarrier(); \ @@ -54,9 +54,9 @@ _ReadWriteBarrier(); \ return result; \ } -#elif defined(EMBB_COMPILER_GNUC) +#elif defined(EMBB_PLATFORM_COMPILER_GNUC) #define EMBB_DEFINE_LOAD(EMBB_PARAMETER_SIZE_BYTE, EMBB_ATOMIC_X86_SIZE_SUFFIX) \ - EMBB_INLINE EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) \ + EMBB_PLATFORM_INLINE EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) \ EMBB_CAT2(embb_internal__atomic_load_, EMBB_PARAMETER_SIZE_BYTE)(EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) volatile* pointer_to_value) { \ /* no fence required for loads */ \ EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) result; \ @@ -81,11 +81,11 @@ EMBB_DEFINE_LOAD(4, "l") EMBB_DEFINE_LOAD(8, "q") #endif -#elif defined(EMBB_ARCH_ARM) +#elif defined(EMBB_PLATFORM_ARCH_ARM) -#if defined(EMBB_COMPILER_GNUC) +#if defined(EMBB_PLATFORM_COMPILER_GNUC) #define EMBB_DEFINE_LOAD(EMBB_PARAMETER_SIZE_BYTE, EMBB_ATOMIC_ARM_SIZE_SUFFIX) \ - EMBB_INLINE \ + EMBB_PLATFORM_INLINE \ EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) \ EMBB_CAT2(embb_internal__atomic_load_, EMBB_PARAMETER_SIZE_BYTE)(\ EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) \ @@ -118,7 +118,7 @@ EMBB_DEFINE_LOAD(4, "") * of the following macro. */ #define EMBB_ATOMIC_INTERNAL_DEFINE_LOAD_METHOD(EMBB_ATOMIC_PARAMETER_TYPE_NATIVE, EMBB_ATOMIC_PARAMETER_ATOMIC_TYPE_SUFFIX, EMBB_ATOMIC_PARAMETER_TYPE_SIZE) \ - EMBB_INLINE EMBB_ATOMIC_PARAMETER_TYPE_NATIVE EMBB_CAT2(embb_atomic_load_, EMBB_ATOMIC_PARAMETER_ATOMIC_TYPE_SUFFIX)(\ + EMBB_PLATFORM_INLINE EMBB_ATOMIC_PARAMETER_TYPE_NATIVE EMBB_CAT2(embb_atomic_load_, EMBB_ATOMIC_PARAMETER_ATOMIC_TYPE_SUFFIX)(\ const EMBB_CAT2(embb_atomic_, EMBB_ATOMIC_PARAMETER_ATOMIC_TYPE_SUFFIX)* variable) { \ EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_ATOMIC_PARAMETER_TYPE_SIZE) \ return_val = (EMBB_CAT2(embb_internal__atomic_load_, EMBB_ATOMIC_PARAMETER_TYPE_SIZE)(\ diff --git a/base_c/include/embb/base/c/internal/atomic/memory_barrier.h b/base_c/include/embb/base/c/internal/atomic/memory_barrier.h index 3fc1fb2..e5dfc7b 100644 --- a/base_c/include/embb/base/c/internal/atomic/memory_barrier.h +++ b/base_c/include/embb/base/c/internal/atomic/memory_barrier.h @@ -31,32 +31,32 @@ #ifndef DOXYGEN -#ifdef EMBB_COMPILER_MSVC +#ifdef EMBB_PLATFORM_COMPILER_MSVC #include #endif -#ifdef EMBB_ARCH_X86 +#ifdef EMBB_PLATFORM_ARCH_X86 -#ifdef EMBB_COMPILER_MSVC +#ifdef EMBB_PLATFORM_COMPILER_MSVC extern void __fastcall embb_internal__atomic_memory_barrier_asm(); // Read/write barrier -EMBB_INLINE void __fastcall embb_atomic_memory_barrier() { +EMBB_PLATFORM_INLINE void __fastcall embb_atomic_memory_barrier() { _ReadWriteBarrier(); embb_internal__atomic_memory_barrier_asm(); _ReadWriteBarrier(); } -#elif defined(EMBB_COMPILER_GNUC) +#elif defined(EMBB_PLATFORM_COMPILER_GNUC) // Read/write barrier -EMBB_INLINE void embb_atomic_memory_barrier() { +EMBB_PLATFORM_INLINE void embb_atomic_memory_barrier() { __asm__ __volatile__ ("mfence" : : : "memory"); } #else #error "No atomic fetch and store implementation found" #endif -#elif defined(EMBB_ARCH_ARM) +#elif defined(EMBB_PLATFORM_ARCH_ARM) -EMBB_INLINE void embb_atomic_memory_barrier() { +EMBB_PLATFORM_INLINE void embb_atomic_memory_barrier() { __asm__ __volatile__ ("dmb" : : : "memory"); } diff --git a/base_c/include/embb/base/c/internal/atomic/or_assign.h b/base_c/include/embb/base/c/internal/atomic/or_assign.h index a1f2b12..7e3f8bf 100644 --- a/base_c/include/embb/base/c/internal/atomic/or_assign.h +++ b/base_c/include/embb/base/c/internal/atomic/or_assign.h @@ -39,22 +39,22 @@ * See file and_assign.h for a detailed (and operation independent) description * of the following macro. */ -#ifdef EMBB_ARCH_X86 +#ifdef EMBB_PLATFORM_ARCH_X86 -#ifdef EMBB_COMPILER_MSVC +#ifdef EMBB_PLATFORM_COMPILER_MSVC #define EMBB_DEFINE_OR_ASSIGN(EMBB_PARAMETER_SIZE_BYTE, EMBB_ATOMIC_X86_SIZE_SUFFIX) \ extern void __fastcall EMBB_CAT2(embb_internal__atomic_or_assign_, EMBB_PARAMETER_SIZE_BYTE)_asm(\ EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) volatile* pointer_to_value, EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) value); \ - EMBB_INLINE void __fastcall EMBB_CAT2(embb_internal__atomic_or_assign_, EMBB_PARAMETER_SIZE_BYTE)(\ + EMBB_PLATFORM_INLINE void __fastcall EMBB_CAT2(embb_internal__atomic_or_assign_, EMBB_PARAMETER_SIZE_BYTE)(\ EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) volatile* pointer_to_value, \ EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) value) { \ _ReadWriteBarrier(); \ EMBB_CAT2(embb_internal__atomic_or_assign_, EMBB_PARAMETER_SIZE_BYTE)_asm(pointer_to_value, value); \ _ReadWriteBarrier(); \ } -#elif defined(EMBB_COMPILER_GNUC) +#elif defined(EMBB_PLATFORM_COMPILER_GNUC) #define EMBB_DEFINE_OR_ASSIGN(EMBB_PARAMETER_SIZE_BYTE, EMBB_ATOMIC_X86_SIZE_SUFFIX) \ - EMBB_INLINE void EMBB_CAT2(embb_internal__atomic_or_assign_, EMBB_PARAMETER_SIZE_BYTE)(\ + EMBB_PLATFORM_INLINE void EMBB_CAT2(embb_internal__atomic_or_assign_, EMBB_PARAMETER_SIZE_BYTE)(\ EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) volatile* pointer_to_value, EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) value) { \ __asm__ __volatile__("lock or" EMBB_ATOMIC_X86_SIZE_SUFFIX " %1, %0" \ : "+m" (*pointer_to_value), "+q" (value) \ @@ -77,12 +77,12 @@ EMBB_DEFINE_OR_ASSIGN(4, "l") EMBB_DEFINE_OR_ASSIGN(8, "q") #endif -#elif defined(EMBB_ARCH_ARM) +#elif defined(EMBB_PLATFORM_ARCH_ARM) -#if defined(EMBB_COMPILER_GNUC) +#if defined(EMBB_PLATFORM_COMPILER_GNUC) #define EMBB_DEFINE_OR_ASSIGN(EMBB_PARAMETER_SIZE_BYTE, \ EMBB_ATOMIC_ARM_SIZE_SUFFIX) \ - EMBB_INLINE \ + EMBB_PLATFORM_INLINE \ void EMBB_CAT2(embb_internal__atomic_or_assign_, \ EMBB_PARAMETER_SIZE_BYTE)(\ EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) \ @@ -120,7 +120,7 @@ EMBB_DEFINE_OR_ASSIGN(4, "") * of the following macro. */ #define EMBB_ATOMIC_INTERNAL_DEFINE_OR_ASSIGN_METHOD(EMBB_ATOMIC_PARAMETER_TYPE_NATIVE, EMBB_ATOMIC_PARAMETER_ATOMIC_TYPE_SUFFIX, EMBB_ATOMIC_PARAMETER_TYPE_SIZE) \ - EMBB_INLINE void EMBB_CAT2(embb_atomic_or_assign_, EMBB_ATOMIC_PARAMETER_ATOMIC_TYPE_SUFFIX)(EMBB_CAT2(embb_atomic_, EMBB_ATOMIC_PARAMETER_ATOMIC_TYPE_SUFFIX)* variable, EMBB_ATOMIC_PARAMETER_TYPE_NATIVE value) { \ + EMBB_PLATFORM_INLINE void EMBB_CAT2(embb_atomic_or_assign_, EMBB_ATOMIC_PARAMETER_ATOMIC_TYPE_SUFFIX)(EMBB_CAT2(embb_atomic_, EMBB_ATOMIC_PARAMETER_ATOMIC_TYPE_SUFFIX)* variable, EMBB_ATOMIC_PARAMETER_TYPE_NATIVE value) { \ EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_ATOMIC_PARAMETER_TYPE_SIZE) value_pun;\ memcpy(&value_pun, &value, sizeof(EMBB_ATOMIC_PARAMETER_TYPE_NATIVE));\ EMBB_CAT2(embb_internal__atomic_or_assign_, EMBB_ATOMIC_PARAMETER_TYPE_SIZE)((EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_ATOMIC_PARAMETER_TYPE_SIZE) volatile *)\ diff --git a/base_c/include/embb/base/c/internal/atomic/store.h b/base_c/include/embb/base/c/internal/atomic/store.h index 060385c..b98b14a 100644 --- a/base_c/include/embb/base/c/internal/atomic/store.h +++ b/base_c/include/embb/base/c/internal/atomic/store.h @@ -39,13 +39,13 @@ * See file and_assign.h for a detailed (and operation independent) description * of the following macro. */ -#ifdef EMBB_ARCH_X86 +#ifdef EMBB_PLATFORM_ARCH_X86 -#ifdef EMBB_COMPILER_MSVC +#ifdef EMBB_PLATFORM_COMPILER_MSVC #define EMBB_DEFINE_STORE(EMBB_PARAMETER_SIZE_BYTE, EMBB_ATOMIC_X86_SIZE_SUFFIX)\ extern void __fastcall EMBB_CAT2(embb_internal__atomic_store_, EMBB_PARAMETER_SIZE_BYTE)_asm( \ EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) volatile* pointer_to_value, EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) new_value); \ - EMBB_INLINE void __fastcall EMBB_CAT2(embb_internal__atomic_store_, EMBB_PARAMETER_SIZE_BYTE)(\ + EMBB_PLATFORM_INLINE void __fastcall EMBB_CAT2(embb_internal__atomic_store_, EMBB_PARAMETER_SIZE_BYTE)(\ EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) volatile* pointer_to_value, EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) new_value) \ { \ _ReadWriteBarrier(); \ @@ -53,9 +53,9 @@ EMBB_PARAMETER_SIZE_BYTE)_asm(pointer_to_value, new_value); \ _ReadWriteBarrier(); \ } -#elif defined(EMBB_COMPILER_GNUC) +#elif defined(EMBB_PLATFORM_COMPILER_GNUC) #define EMBB_DEFINE_STORE(EMBB_PARAMETER_SIZE_BYTE, EMBB_ATOMIC_X86_SIZE_SUFFIX)\ - EMBB_INLINE void EMBB_CAT2(embb_internal__atomic_store_, EMBB_PARAMETER_SIZE_BYTE)(EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) volatile* pointer_to_value, \ + EMBB_PLATFORM_INLINE void EMBB_CAT2(embb_internal__atomic_store_, EMBB_PARAMETER_SIZE_BYTE)(EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) volatile* pointer_to_value, \ EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) new_value) {\ /*the lock prefix is implicit for xchg*/ \ __asm__ __volatile__("xchg" EMBB_ATOMIC_X86_SIZE_SUFFIX " %1, %0" \ @@ -78,11 +78,11 @@ EMBB_DEFINE_STORE(4, "l") EMBB_DEFINE_STORE(8, "q") #endif -#elif defined(EMBB_ARCH_ARM) +#elif defined(EMBB_PLATFORM_ARCH_ARM) -#if defined(EMBB_COMPILER_GNUC) +#if defined(EMBB_PLATFORM_COMPILER_GNUC) #define EMBB_DEFINE_STORE(EMBB_PARAMETER_SIZE_BYTE, EMBB_ATOMIC_ARM_SIZE_SUFFIX)\ - EMBB_INLINE \ + EMBB_PLATFORM_INLINE \ void EMBB_CAT2(embb_internal__atomic_store_, EMBB_PARAMETER_SIZE_BYTE)(\ EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) volatile* \ pointer_to_value, \ @@ -115,7 +115,7 @@ EMBB_DEFINE_STORE(4, "") * of the following macro. */ #define EMBB_ATOMIC_INTERNAL_DEFINE_STORE_METHOD(EMBB_ATOMIC_PARAMETER_TYPE_NATIVE, EMBB_ATOMIC_PARAMETER_ATOMIC_TYPE_SUFFIX, EMBB_ATOMIC_PARAMETER_TYPE_SIZE) \ - EMBB_INLINE void EMBB_CAT2(embb_atomic_store_, EMBB_ATOMIC_PARAMETER_ATOMIC_TYPE_SUFFIX)(EMBB_CAT2(embb_atomic_, EMBB_ATOMIC_PARAMETER_ATOMIC_TYPE_SUFFIX)* variable, EMBB_ATOMIC_PARAMETER_TYPE_NATIVE value) { \ + EMBB_PLATFORM_INLINE void EMBB_CAT2(embb_atomic_store_, EMBB_ATOMIC_PARAMETER_ATOMIC_TYPE_SUFFIX)(EMBB_CAT2(embb_atomic_, EMBB_ATOMIC_PARAMETER_ATOMIC_TYPE_SUFFIX)* variable, EMBB_ATOMIC_PARAMETER_TYPE_NATIVE value) { \ EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_ATOMIC_PARAMETER_TYPE_SIZE) value_pun; \ memcpy(&value_pun, &value, sizeof(EMBB_ATOMIC_PARAMETER_TYPE_NATIVE)); \ EMBB_CAT2(embb_internal__atomic_store_, EMBB_ATOMIC_PARAMETER_TYPE_SIZE)((EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_ATOMIC_PARAMETER_TYPE_SIZE) volatile *)\ diff --git a/base_c/include/embb/base/c/internal/atomic/swap.h b/base_c/include/embb/base/c/internal/atomic/swap.h index e0e80ed..a5c3d3c 100644 --- a/base_c/include/embb/base/c/internal/atomic/swap.h +++ b/base_c/include/embb/base/c/internal/atomic/swap.h @@ -39,13 +39,13 @@ * See file and_assign.h for a detailed (and operation independent) description * of the following macro. */ -#ifdef EMBB_ARCH_X86 +#ifdef EMBB_PLATFORM_ARCH_X86 -#ifdef EMBB_COMPILER_MSVC +#ifdef EMBB_PLATFORM_COMPILER_MSVC #define EMBB_DEFINE_SWAP(EMBB_PARAMETER_SIZE_BYTE, EMBB_ATOMIC_X86_SIZE_SUFFIX) \ extern EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) __fastcall EMBB_CAT2 (embb_internal__atomic_swap_, EMBB_PARAMETER_SIZE_BYTE)_asm(\ EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) volatile* pointer_to_value, EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) new_value); \ - EMBB_INLINE EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) __fastcall EMBB_CAT2 (embb_internal__atomic_swap_, EMBB_PARAMETER_SIZE_BYTE)(\ + EMBB_PLATFORM_INLINE EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) __fastcall EMBB_CAT2 (embb_internal__atomic_swap_, EMBB_PARAMETER_SIZE_BYTE)(\ EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) volatile* pointer_to_value, EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) new_value) { \ EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) result; \ _ReadWriteBarrier(); \ @@ -53,9 +53,9 @@ _ReadWriteBarrier(); \ return result; \ } -#elif defined(EMBB_COMPILER_GNUC) +#elif defined(EMBB_PLATFORM_COMPILER_GNUC) #define EMBB_DEFINE_SWAP(EMBB_PARAMETER_SIZE_BYTE, EMBB_ATOMIC_X86_SIZE_SUFFIX) \ - EMBB_INLINE EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) EMBB_CAT2(embb_internal__atomic_swap_, EMBB_PARAMETER_SIZE_BYTE)(\ + EMBB_PLATFORM_INLINE EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) EMBB_CAT2(embb_internal__atomic_swap_, EMBB_PARAMETER_SIZE_BYTE)(\ EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) volatile* pointer_to_value, EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) new_value)\ { \ /*the lock prefix is implicit for xchg*/ \ @@ -80,11 +80,11 @@ EMBB_DEFINE_SWAP(4, "l") EMBB_DEFINE_SWAP(8, "q") #endif -#elif defined(EMBB_ARCH_ARM) +#elif defined(EMBB_PLATFORM_ARCH_ARM) -#if defined(EMBB_COMPILER_GNUC) +#if defined(EMBB_PLATFORM_COMPILER_GNUC) #define EMBB_DEFINE_SWAP(EMBB_PARAMETER_SIZE_BYTE, EMBB_ATOMIC_ARM_SIZE_SUFFIX) \ - EMBB_INLINE \ + EMBB_PLATFORM_INLINE \ EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) EMBB_CAT2 \ (embb_internal__atomic_swap_, EMBB_PARAMETER_SIZE_BYTE)(\ EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) \ @@ -123,7 +123,7 @@ EMBB_DEFINE_SWAP(4, "") * of the following macro. */ #define EMBB_ATOMIC_INTERNAL_DEFINE_SWAP_METHOD(EMBB_ATOMIC_PARAMETER_TYPE_NATIVE, EMBB_ATOMIC_PARAMETER_ATOMIC_TYPE_SUFFIX, EMBB_ATOMIC_PARAMETER_TYPE_SIZE) \ - EMBB_INLINE EMBB_ATOMIC_PARAMETER_TYPE_NATIVE EMBB_CAT2(embb_atomic_swap_, EMBB_ATOMIC_PARAMETER_ATOMIC_TYPE_SUFFIX)(\ + EMBB_PLATFORM_INLINE EMBB_ATOMIC_PARAMETER_TYPE_NATIVE EMBB_CAT2(embb_atomic_swap_, EMBB_ATOMIC_PARAMETER_ATOMIC_TYPE_SUFFIX)(\ EMBB_CAT2(embb_atomic_, EMBB_ATOMIC_PARAMETER_ATOMIC_TYPE_SUFFIX)* variable, EMBB_ATOMIC_PARAMETER_TYPE_NATIVE value) { \ EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_ATOMIC_PARAMETER_TYPE_SIZE) value_pun; \ memcpy(&value_pun, &value, sizeof(EMBB_ATOMIC_PARAMETER_TYPE_NATIVE)); \ diff --git a/base_c/include/embb/base/c/internal/atomic/xor_assign.h b/base_c/include/embb/base/c/internal/atomic/xor_assign.h index 3e2b908..d3ec2af 100644 --- a/base_c/include/embb/base/c/internal/atomic/xor_assign.h +++ b/base_c/include/embb/base/c/internal/atomic/xor_assign.h @@ -39,22 +39,22 @@ * See file and_assign.h for a detailed (and operation independent) description * of the following macro. */ -#ifdef EMBB_ARCH_X86 +#ifdef EMBB_PLATFORM_ARCH_X86 -#ifdef EMBB_COMPILER_MSVC +#ifdef EMBB_PLATFORM_COMPILER_MSVC #define EMBB_DEFINE_XOR_ASSIGN(EMBB_PARAMETER_SIZE_BYTE, EMBB_ATOMIC_X86_SIZE_SUFFIX) \ extern void __fastcall EMBB_CAT2(embb_internal__atomic_xor_assign_, EMBB_PARAMETER_SIZE_BYTE)_asm(\ EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) volatile* pointer_to_value, EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) value); \ - EMBB_INLINE void __fastcall EMBB_CAT2(embb_internal__atomic_xor_assign_, EMBB_PARAMETER_SIZE_BYTE)(\ + EMBB_PLATFORM_INLINE void __fastcall EMBB_CAT2(embb_internal__atomic_xor_assign_, EMBB_PARAMETER_SIZE_BYTE)(\ EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) volatile* pointer_to_value, EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) value) { \ _ReadWriteBarrier(); \ EMBB_CAT2(embb_internal__atomic_xor_assign_, \ EMBB_PARAMETER_SIZE_BYTE)_asm(pointer_to_value, value); \ _ReadWriteBarrier(); \ } -#elif defined(EMBB_COMPILER_GNUC) +#elif defined(EMBB_PLATFORM_COMPILER_GNUC) #define EMBB_DEFINE_XOR_ASSIGN(EMBB_PARAMETER_SIZE_BYTE, EMBB_ATOMIC_X86_SIZE_SUFFIX) \ - EMBB_INLINE void EMBB_CAT2(embb_internal__atomic_xor_assign_, EMBB_PARAMETER_SIZE_BYTE)(\ + EMBB_PLATFORM_INLINE void EMBB_CAT2(embb_internal__atomic_xor_assign_, EMBB_PARAMETER_SIZE_BYTE)(\ EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) volatile* pointer_to_value, \ EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) value) { \ __asm__ __volatile__("lock xor" EMBB_ATOMIC_X86_SIZE_SUFFIX " %1, %0" \ @@ -78,12 +78,12 @@ EMBB_DEFINE_XOR_ASSIGN(4, "l") EMBB_DEFINE_XOR_ASSIGN(8, "q") #endif -#elif defined(EMBB_ARCH_ARM) +#elif defined(EMBB_PLATFORM_ARCH_ARM) -#if defined(EMBB_COMPILER_GNUC) +#if defined(EMBB_PLATFORM_COMPILER_GNUC) #define EMBB_DEFINE_XOR_ASSIGN(EMBB_PARAMETER_SIZE_BYTE, \ EMBB_ATOMIC_ARM_SIZE_SUFFIX) \ - EMBB_INLINE \ + EMBB_PLATFORM_INLINE \ void EMBB_CAT2(embb_internal__atomic_xor_assign_, \ EMBB_PARAMETER_SIZE_BYTE)(\ EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_PARAMETER_SIZE_BYTE) \ @@ -121,7 +121,7 @@ EMBB_DEFINE_XOR_ASSIGN(4, "") * of the following macro. */ #define EMBB_ATOMIC_INTERNAL_DEFINE_XOR_ASSIGN_METHOD(EMBB_ATOMIC_PARAMETER_TYPE_NATIVE, EMBB_ATOMIC_PARAMETER_ATOMIC_TYPE_SUFFIX, EMBB_ATOMIC_PARAMETER_TYPE_SIZE) \ - EMBB_INLINE void EMBB_CAT2(embb_atomic_xor_assign_, EMBB_ATOMIC_PARAMETER_ATOMIC_TYPE_SUFFIX)(\ + EMBB_PLATFORM_INLINE void EMBB_CAT2(embb_atomic_xor_assign_, EMBB_ATOMIC_PARAMETER_ATOMIC_TYPE_SUFFIX)(\ EMBB_CAT2(embb_atomic_, EMBB_ATOMIC_PARAMETER_ATOMIC_TYPE_SUFFIX)* variable, EMBB_ATOMIC_PARAMETER_TYPE_NATIVE value) { \ EMBB_CAT2(EMBB_BASE_BASIC_TYPE_SIZE_, EMBB_ATOMIC_PARAMETER_TYPE_SIZE) value_pun;\ memcpy(&value_pun, &value, sizeof(EMBB_ATOMIC_PARAMETER_TYPE_NATIVE));\ diff --git a/base_c/include/embb/base/c/internal/bitset.h b/base_c/include/embb/base/c/internal/bitset.h index 6ff6959..f9b7404 100644 --- a/base_c/include/embb/base/c/internal/bitset.h +++ b/base_c/include/embb/base/c/internal/bitset.h @@ -33,7 +33,7 @@ #include -EMBB_INLINE void embb_bitset_set( +EMBB_PLATFORM_INLINE void embb_bitset_set( uint64_t * that, unsigned int bit ) { @@ -42,7 +42,7 @@ EMBB_INLINE void embb_bitset_set( *that |= (1ull << bit); } -EMBB_INLINE void embb_bitset_set_n( +EMBB_PLATFORM_INLINE void embb_bitset_set_n( uint64_t * that, unsigned int count) { assert(NULL != that); @@ -55,7 +55,7 @@ EMBB_INLINE void embb_bitset_set_n( } } -EMBB_INLINE void embb_bitset_clear( +EMBB_PLATFORM_INLINE void embb_bitset_clear( uint64_t * that, unsigned int bit ) { @@ -64,21 +64,21 @@ EMBB_INLINE void embb_bitset_clear( *that &= ~(1ull << bit); } -EMBB_INLINE void embb_bitset_clear_all( +EMBB_PLATFORM_INLINE void embb_bitset_clear_all( uint64_t * that ) { assert(NULL != that); *that = 0ull; } -EMBB_INLINE unsigned int embb_bitset_is_set( +EMBB_PLATFORM_INLINE unsigned int embb_bitset_is_set( uint64_t const * that, unsigned int bit ) { return (unsigned int)((*that & (1ull << bit)) ? 1 : 0); } -EMBB_INLINE void embb_bitset_intersect( +EMBB_PLATFORM_INLINE void embb_bitset_intersect( uint64_t * that, uint64_t mask ) { @@ -86,7 +86,7 @@ EMBB_INLINE void embb_bitset_intersect( *that &= mask; } -EMBB_INLINE void embb_bitset_union( +EMBB_PLATFORM_INLINE void embb_bitset_union( uint64_t * that, uint64_t mask ) { @@ -94,7 +94,7 @@ EMBB_INLINE void embb_bitset_union( *that |= mask; } -EMBB_INLINE unsigned int embb_bitset_count( +EMBB_PLATFORM_INLINE unsigned int embb_bitset_count( uint64_t const * that ) { unsigned int count = 0; diff --git a/base_c/include/embb/base/c/internal/cmake_config.h.in b/base_c/include/embb/base/c/internal/cmake_config.h.in index 7b53f82..01a5b2a 100644 --- a/base_c/include/embb/base/c/internal/cmake_config.h.in +++ b/base_c/include/embb/base/c/internal/cmake_config.h.in @@ -36,21 +36,21 @@ /** * Is used to get the number of cores on certain systems. */ -#cmakedefine EMBB_HAS_HEADER_SYSINFO +#cmakedefine EMBB_PLATFORM_HAS_HEADER_SYSINFO /** * Is used to get the number of cores on certain systems. */ -#cmakedefine EMBB_HAS_HEADER_SYSCTL +#cmakedefine EMBB_PLATFORM_HAS_HEADER_SYSCTL /** * Is used to set thread affinities on certain systems. */ -#cmakedefine EMBB_HAS_HEADER_CPUSET +#cmakedefine EMBB_PLATFORM_HAS_HEADER_CPUSET /** * Is used for Linux thread affinities. */ -#cmakedefine EMBB_HAS_GLIB_CPU +#cmakedefine EMBB_PLATFORM_HAS_GLIB_CPU #endif /* EMBB_BASE_INTERNAL_CMAKE_CONFIG_H_ */ \ No newline at end of file diff --git a/base_c/include/embb/base/c/internal/config.h b/base_c/include/embb/base/c/internal/config.h index daf563a..89cab10 100644 --- a/base_c/include/embb/base/c/internal/config.h +++ b/base_c/include/embb/base/c/internal/config.h @@ -45,9 +45,9 @@ * which has 128 bytes. */ #if defined(_M_IA64) || defined(_IA64) -#define EMBB_CACHE_LINE_SIZE 128 +#define EMBB_PLATFORM_CACHE_LINE_SIZE 128 #else -#define EMBB_CACHE_LINE_SIZE 64 +#define EMBB_PLATFORM_CACHE_LINE_SIZE 64 #endif /* For MSVC, if _DEBUG is set, set also EMBB_DEBUG. @@ -59,41 +59,41 @@ #endif #ifdef __GNUC__ -#define EMBB_ALIGN(size) __attribute__ ((aligned(size))) +#define EMBB_PLATFORM_ALIGN(size) __attribute__ ((aligned(size))) #elif defined _MSC_VER || defined __INTEL_COMPILER -#define EMBB_ALIGN(size) __declspec(align(size)) +#define EMBB_PLATFORM_ALIGN(size) __declspec(align(size)) #else #error "Unsupported compiler" #endif #if __GNUC__ -#define EMBB_INLINE static inline -#define EMBB_COMPILER_GNUC +#define EMBB_PLATFORM_INLINE static inline +#define EMBB_PLATFORM_COMPILER_GNUC #elif _MSC_VER -#define EMBB_INLINE __inline -#define EMBB_COMPILER_MSVC +#define EMBB_PLATFORM_INLINE __inline +#define EMBB_PLATFORM_COMPILER_MSVC #else -#define EMBB_INLINE inline -#define EMBB_COMPILER_UNKNOWN +#define EMBB_PLATFORM_INLINE inline +#define EMBB_PLATFORM_COMPILER_UNKNOWN #endif #if defined(__x86_64__) || defined(_M_X64) -#define EMBB_ARCH_X86_64 -#define EMBB_ARCH_X86 -#define EMBB_HAS_CAS_64 +#define EMBB_PLATFORM_ARCH_X86_64 +#define EMBB_PLATFORM_ARCH_X86 +#define EMBB_PLATFORM_HAS_CAS_64 #elif defined(__i386) || defined(_M_IX86) -#define EMBB_ARCH_X86_32 -#define EMBB_ARCH_X86 +#define EMBB_PLATFORM_ARCH_X86_32 +#define EMBB_PLATFORM_ARCH_X86 #elif defined(__arm__) -#define EMBB_ARCH_ARM +#define EMBB_PLATFORM_ARCH_ARM #else -#define EMBB_ARCH_UNKNOWN +#define EMBB_PLATFORM_ARCH_UNKNOWN #endif -#if defined(EMBB_COMPILER_MSVC) -#define EMBB_THREADING_WINTHREADS -#elif defined(EMBB_COMPILER_GNUC) -#define EMBB_THREADING_POSIXTHREADS +#if defined(EMBB_PLATFORM_COMPILER_MSVC) +#define EMBB_PLATFORM_THREADING_WINTHREADS +#elif defined(EMBB_PLATFORM_COMPILER_GNUC) +#define EMBB_PLATFORM_THREADING_POSIXTHREADS #else #error "No thread implementation could be determined" #endif diff --git a/base_c/include/embb/base/c/internal/platform.h b/base_c/include/embb/base/c/internal/platform.h index 4ed71f4..96d5c0f 100644 --- a/base_c/include/embb/base/c/internal/platform.h +++ b/base_c/include/embb/base/c/internal/platform.h @@ -37,9 +37,9 @@ extern "C" { #define EMBB_TIME_MAX_SECONDS ULLONG_MAX #define EMBB_DURATION_MAX_SECONDS 60 * 60 * 24 * 7 -#ifdef EMBB_THREADING_WINTHREADS +#ifdef EMBB_PLATFORM_THREADING_WINTHREADS -#ifdef EMBB_COMPILER_MSVC +#ifdef EMBB_PLATFORM_COMPILER_MSVC // Suppress virtual functions but non-virtual constructor warning // in windows headers #pragma warning(push) @@ -49,7 +49,7 @@ extern "C" { #define NOMINMAX #include -#ifdef EMBB_COMPILER_MSVC +#ifdef EMBB_PLATFORM_COMPILER_MSVC #pragma warning(pop) // Reset warning 4640 #endif @@ -71,7 +71,7 @@ typedef CONDITION_VARIABLE embb_condition_t; #define EMBB_THREAD_SPECIFIC static __declspec(thread) -#elif defined EMBB_THREADING_POSIXTHREADS /* EMBB_THREADING_WINTHREADS */ +#elif defined EMBB_PLATFORM_THREADING_POSIXTHREADS /* EMBB_PLATFORM_THREADING_WINTHREADS */ #include #include @@ -95,7 +95,7 @@ typedef pthread_cond_t embb_condition_t; #define EMBB_THREAD_SPECIFIC __thread -#else /* EMBB_THREADING_POSIXTHREADS */ +#else /* EMBB_PLATFORM_THREADING_POSIXTHREADS */ #error "No threading platform defined!" diff --git a/base_c/src/condition_variable.c b/base_c/src/condition_variable.c index f0880ab..f4f2250 100644 --- a/base_c/src/condition_variable.c +++ b/base_c/src/condition_variable.c @@ -43,7 +43,7 @@ int embb_condition_wait_for(embb_condition_t* condition_var, return embb_condition_wait_until(condition_var, mutex, &time); } -#ifdef EMBB_THREADING_WINTHREADS +#ifdef EMBB_PLATFORM_THREADING_WINTHREADS int embb_condition_init(embb_condition_t* condition_var) { assert(condition_var != NULL); @@ -108,9 +108,9 @@ int embb_condition_destroy(embb_condition_t* condition_var) { return EMBB_SUCCESS; } -#endif /* EMBB_THREADING_WINTHREADS */ +#endif /* EMBB_PLATFORM_THREADING_WINTHREADS */ -#ifdef EMBB_THREADING_POSIXTHREADS +#ifdef EMBB_PLATFORM_THREADING_POSIXTHREADS int embb_condition_init(embb_condition_t* condition_var) { assert(condition_var != NULL); @@ -165,4 +165,4 @@ int embb_condition_destroy(embb_condition_t* condition_var) { return EMBB_SUCCESS; } -#endif /* EMBB_THREADING_POSIXTHREADS */ +#endif /* EMBB_PLATFORM_THREADING_POSIXTHREADS */ diff --git a/base_c/src/core_set.c b/base_c/src/core_set.c index dc19ad7..558e7f9 100644 --- a/base_c/src/core_set.c +++ b/base_c/src/core_set.c @@ -31,7 +31,7 @@ #include #include -#ifdef EMBB_THREADING_WINTHREADS +#ifdef EMBB_PLATFORM_THREADING_WINTHREADS /** * For handling of more than 64 logical processors on Windows. @@ -87,21 +87,21 @@ void embb_core_set_init(embb_core_set_t* core_set, int initializer) { } } -#endif /* EMBB_THREADING_WINTHREADS */ +#endif /* EMBB_PLATFORM_THREADING_WINTHREADS */ -#ifdef EMBB_THREADING_POSIXTHREADS +#ifdef EMBB_PLATFORM_THREADING_POSIXTHREADS -#ifdef EMBB_HAS_HEADER_SYSINFO +#ifdef EMBB_PLATFORM_HAS_HEADER_SYSINFO #include -#elif defined EMBB_HAS_HEADER_SYSCTL +#elif defined EMBB_PLATFORM_HAS_HEADER_SYSCTL #include #include #endif unsigned int embb_core_count_available() { -#ifdef EMBB_HAS_HEADER_SYSINFO +#ifdef EMBB_PLATFORM_HAS_HEADER_SYSINFO return get_nprocs(); -#elif defined EMBB_HAS_HEADER_SYSCTL +#elif defined EMBB_PLATFORM_HAS_HEADER_SYSCTL const size_t kBufferSize = sizeof(unsigned int); char buf[kBufferSize]; size_t len = kBufferSize; @@ -123,7 +123,7 @@ void embb_core_set_init(embb_core_set_t* core_set, int initializer) { } } -#endif /* EMBB_THREADING_POSIXTHREADS */ +#endif /* EMBB_PLATFORM_THREADING_POSIXTHREADS */ void embb_core_set_add(embb_core_set_t* core_set, unsigned int core_number) { assert(core_set != NULL); diff --git a/base_c/src/log.c b/base_c/src/log.c index 0c16228..65ed135 100644 --- a/base_c/src/log.c +++ b/base_c/src/log.c @@ -91,14 +91,14 @@ static void embb_log_write_internal( log_level_str = " "; break; } -#if defined(EMBB_COMPILER_MSVC) +#if defined(EMBB_PLATFORM_COMPILER_MSVC) char msg_buffer[400]; char buffer[500]; vsprintf_s(msg_buffer, sizeof(msg_buffer), message, argp); sprintf_s(buffer, sizeof(buffer), "[%s] - [%s] %s", channel_str, log_level_str, msg_buffer); embb_log_global_log_function(log_context, buffer); -#elif defined(EMBB_COMPILER_GNUC) +#elif defined(EMBB_PLATFORM_COMPILER_GNUC) char msg_buffer[400]; char buffer[500]; vsnprintf(msg_buffer, sizeof(msg_buffer), message, argp); diff --git a/base_c/src/memory_allocation.c b/base_c/src/memory_allocation.c index c6f8bfc..a2f2fe0 100644 --- a/base_c/src/memory_allocation.c +++ b/base_c/src/memory_allocation.c @@ -166,7 +166,7 @@ void embb_free(void * ptr) { void *embb_alloc_aligned(size_t alignment, size_t size) { void* malloc_addr = NULL; -#ifdef EMBB_COMPILER_MSVC +#ifdef EMBB_PLATFORM_COMPILER_MSVC /* * From the Documentation: * Allocates memory on a specified alignment boundary. @@ -176,7 +176,7 @@ void *embb_alloc_aligned(size_t alignment, size_t size) { * failed. The pointer is a multiple of alignment. */ malloc_addr = _aligned_malloc(size, alignment); -#elif defined EMBB_COMPILER_GNUC +#elif defined EMBB_PLATFORM_COMPILER_GNUC /* * From the Documentation: * The posix_memalign() function shall allocate size bytes aligned on a @@ -193,10 +193,10 @@ void *embb_alloc_aligned(size_t alignment, size_t size) { } void embb_free_aligned(void* ptr) { -#ifdef EMBB_COMPILER_MSVC +#ifdef EMBB_PLATFORM_COMPILER_MSVC _aligned_free(ptr); #else -#ifdef EMBB_COMPILER_GNUC +#ifdef EMBB_PLATFORM_COMPILER_GNUC free(ptr); #else #error Unsupported compiler @@ -211,5 +211,5 @@ size_t embb_get_bytes_allocated() { #endif void *embb_alloc_cache_aligned(size_t size) { - return embb_alloc_aligned(EMBB_CACHE_LINE_SIZE, size); + return embb_alloc_aligned(EMBB_PLATFORM_CACHE_LINE_SIZE, size); } diff --git a/base_c/src/mutex.c b/base_c/src/mutex.c index 68b3212..f71428b 100644 --- a/base_c/src/mutex.c +++ b/base_c/src/mutex.c @@ -29,7 +29,7 @@ #include -#ifdef EMBB_THREADING_WINTHREADS +#ifdef EMBB_PLATFORM_THREADING_WINTHREADS int embb_mutex_init(embb_mutex_t* mutex, int type) { /* Critical sections in Windows are always recursive */ @@ -59,9 +59,9 @@ void embb_mutex_destroy(embb_mutex_t* mutex) { DeleteCriticalSection(mutex); } -#endif /* EMBB_THREADING_WINTHREADS */ +#endif /* EMBB_PLATFORM_THREADING_WINTHREADS */ -#ifdef EMBB_THREADING_POSIXTHREADS +#ifdef EMBB_PLATFORM_THREADING_POSIXTHREADS int embb_mutex_init(embb_mutex_t* mutex, int type) { if (type == EMBB_MUTEX_PLAIN) { @@ -114,4 +114,4 @@ void embb_mutex_destroy(embb_mutex_t* mutex) { pthread_mutex_destroy(mutex); } -#endif /* EMBB_THREADING_POSIXTHREADS */ +#endif /* EMBB_PLATFORM_THREADING_POSIXTHREADS */ diff --git a/base_c/src/thread.c b/base_c/src/thread.c index c934984..1f44e33 100644 --- a/base_c/src/thread.c +++ b/base_c/src/thread.c @@ -40,7 +40,7 @@ void embb_thread_set_max_count(unsigned int max) { embb_internal_thread_index_set_max(max); } -#ifdef EMBB_THREADING_WINTHREADS +#ifdef EMBB_PLATFORM_THREADING_WINTHREADS /** * Used to wrap client thread start function and argument when calling internal @@ -151,21 +151,21 @@ int embb_thread_equal(const embb_thread_t* lhs, const embb_thread_t* rhs) { return 0; } -#endif /* EMBB_THREADING_WINTHREADS */ +#endif /* EMBB_PLATFORM_THREADING_WINTHREADS */ -#ifdef EMBB_THREADING_POSIXTHREADS +#ifdef EMBB_PLATFORM_THREADING_POSIXTHREADS -#ifdef EMBB_HAS_GLIB_CPU +#ifdef EMBB_PLATFORM_HAS_GLIB_CPU #include -#elif defined EMBB_HAS_HEADER_CPUSET +#elif defined EMBB_PLATFORM_HAS_HEADER_CPUSET #include #include #include #endif -#ifdef EMBB_HAS_HEADER_SYSINFO +#ifdef EMBB_PLATFORM_HAS_HEADER_SYSINFO #include /* Used to get number of processors */ -#endif /* EMBB_HAS_HEADER_SYSINFO */ +#endif /* EMBB_PLATFORM_HAS_HEADER_SYSINFO */ /** * Used to wrap client thread start function and argument when calling internal @@ -207,10 +207,10 @@ int embb_thread_create(embb_thread_t* thread, const embb_core_set_t* core_set, int status = pthread_attr_init(&attr); if (status != 0) return EMBB_ERROR; if (core_set != NULL) { -#if defined(EMBB_HAS_GLIB_CPU) || defined(EMBB_HAS_HEADER_CPUSET) +#if defined(EMBB_PLATFORM_HAS_GLIB_CPU) || defined(EMBB_PLATFORM_HAS_HEADER_CPUSET) assert(embb_core_count_available() < CPU_SETSIZE && "Core sets are only supported up to CPU_SETSIZE processors!"); -#ifdef EMBB_HAS_GLIB_CPU +#ifdef EMBB_PLATFORM_HAS_GLIB_CPU cpu_set_t cpuset; #else cpuset_t cpuset; @@ -265,4 +265,4 @@ int embb_thread_equal(const embb_thread_t* lhs, const embb_thread_t* rhs) { return pthread_equal(lhs->embb_internal_handle, rhs->embb_internal_handle); } -#endif /* EMBB_THREADING_POSIXTHREADS */ +#endif /* EMBB_PLATFORM_THREADING_POSIXTHREADS */ diff --git a/base_c/src/time.c b/base_c/src/time.c index 04f3968..c89dcd4 100644 --- a/base_c/src/time.c +++ b/base_c/src/time.c @@ -53,7 +53,7 @@ int embb_time_compare(const embb_time_t* lhs, const embb_time_t* rhs) { } -#ifdef EMBB_THREADING_WINTHREADS +#ifdef EMBB_PLATFORM_THREADING_WINTHREADS int embb_time_in(embb_time_t* time, const embb_duration_t* duration) { assert(time != NULL); @@ -81,10 +81,10 @@ int embb_time_in(embb_time_t* time, const embb_duration_t* duration) { return EMBB_SUCCESS; } -#endif /* EMBB_THREADING_WINTHREADS */ +#endif /* EMBB_PLATFORM_THREADING_WINTHREADS */ -#ifdef EMBB_THREADING_POSIXTHREADS +#ifdef EMBB_PLATFORM_THREADING_POSIXTHREADS int embb_time_in(embb_time_t* time, const embb_duration_t* duration) { assert(time != NULL); @@ -102,5 +102,5 @@ int embb_time_in(embb_time_t* time, const embb_duration_t* duration) { return EMBB_SUCCESS; } -#endif /* EMBB_THREADING_POSIXTHREADS */ +#endif /* EMBB_PLATFORM_THREADING_POSIXTHREADS */ diff --git a/base_c/test/alloc_test.cc b/base_c/test/alloc_test.cc index 0e32bb8..2d741ad 100644 --- a/base_c/test/alloc_test.cc +++ b/base_c/test/alloc_test.cc @@ -174,7 +174,7 @@ void AllocTest::TestMixedAllocs() { PT_EXPECT_NE(cache_aligned, static_cast(NULL)); allocated = embb_get_bytes_allocated(); #ifdef EMBB_DEBUG - expected += (1 + 1) * EMBB_CACHE_LINE_SIZE + 3 * sizeof(size_t) - 1; + expected += (1 + 1) * EMBB_PLATFORM_CACHE_LINE_SIZE + 3 * sizeof(size_t) - 1; #endif // else EMBB_DEBUG PT_EXPECT_EQ(allocated, expected); diff --git a/base_cpp/include/embb/base/atomic.h b/base_cpp/include/embb/base/atomic.h index 684fecc..f2e5eea 100644 --- a/base_cpp/include/embb/base/atomic.h +++ b/base_cpp/include/embb/base/atomic.h @@ -531,7 +531,7 @@ __EMBB_ATOMIC_INTEGER_SPECIALIZATION(unsigned short); __EMBB_ATOMIC_INTEGER_SPECIALIZATION(signed int); __EMBB_ATOMIC_INTEGER_SPECIALIZATION(unsigned int); -#ifdef EMBB_ARCH_X86_64 +#ifdef EMBB_PLATFORM_ARCH_X86_64 __EMBB_ATOMIC_INTEGER_SPECIALIZATION(size_t); #endif diff --git a/base_cpp/include/embb/base/exceptions.h b/base_cpp/include/embb/base/exceptions.h index 4feb3fc..f61b334 100644 --- a/base_cpp/include/embb/base/exceptions.h +++ b/base_cpp/include/embb/base/exceptions.h @@ -27,16 +27,16 @@ #ifndef EMBB_BASE_EXCEPTIONS_H_ #define EMBB_BASE_EXCEPTIONS_H_ -#ifdef EMBB_COMPILER_MSVC +#ifdef EMBB_PLATFORM_COMPILER_MSVC #pragma warning(push) // Disable warning that exceptions are disabled but try/catch is used. #pragma warning(disable : 4530) -#endif // EMBB_COMPILER_MSVC +#endif // EMBB_PLATFORM_COMPILER_MSVC #include #include -#ifdef EMBB_COMPILER_MSVC +#ifdef EMBB_PLATFORM_COMPILER_MSVC #pragma warning(pop) #endif diff --git a/base_cpp/include/embb/base/internal/config.h b/base_cpp/include/embb/base/internal/config.h index d076dc3..21e3805 100644 --- a/base_cpp/include/embb/base/internal/config.h +++ b/base_cpp/include/embb/base/internal/config.h @@ -31,7 +31,7 @@ #include /* Disable exceptions in STL of MSVC. Leads to errors when used like this!!! */ -/*#if defined(EMBB_COMPILER_MSVC) && !defined(EMBB_USE_EXCEPTIONS) +/*#if defined(EMBB_PLATFORM_COMPILER_MSVC) && !defined(EMBB_USE_EXCEPTIONS) #define _HAS_EXCEPTIONS 0 #endif*/ diff --git a/base_cpp/include/embb/base/internal/duration-inl.h b/base_cpp/include/embb/base/internal/duration-inl.h index 3a8f486..4a4fba0 100644 --- a/base_cpp/include/embb/base/internal/duration-inl.h +++ b/base_cpp/include/embb/base/internal/duration-inl.h @@ -38,7 +38,7 @@ const Duration& Duration::Zero() { return zero; } -#ifdef EMBB_COMPILER_MSVC +#ifdef EMBB_PLATFORM_COMPILER_MSVC // Suppress non-thread-safe static initialization warning // in Max() and Min() #pragma warning(push) @@ -57,7 +57,7 @@ const Duration& Duration::Min() { return minimum; } -#ifdef EMBB_COMPILER_MSVC +#ifdef EMBB_PLATFORM_COMPILER_MSVC #pragma warning(pop) // Reset warning 4640 #endif diff --git a/base_cpp/include/embb/base/internal/platform.h b/base_cpp/include/embb/base/internal/platform.h index 5fe2cbf..b6fa3b6 100644 --- a/base_cpp/include/embb/base/internal/platform.h +++ b/base_cpp/include/embb/base/internal/platform.h @@ -34,7 +34,7 @@ #include #include -#ifdef EMBB_THREADING_WINTHREADS +#ifdef EMBB_PLATFORM_THREADING_WINTHREADS namespace embb { namespace base { @@ -49,7 +49,7 @@ typedef embb_condition_t ConditionVariableType; } // namespace base } // namespace embb -#elif defined EMBB_THREADING_POSIXTHREADS // EMBB_THREADING_WINTHREADS +#elif defined EMBB_PLATFORM_THREADING_POSIXTHREADS // EMBB_PLATFORM_THREADING_WINTHREADS namespace embb { namespace base { @@ -64,7 +64,7 @@ typedef embb_condition_t ConditionVariableType; } // namespace base } // namespace embb -#else // EMBB_THREADING_POSIXTHREADS +#else // EMBB_PLATFORM_THREADING_POSIXTHREADS #error "No threading platform defined!" diff --git a/base_cpp/src/thread.cc b/base_cpp/src/thread.cc index c5a125b..4e2d645 100644 --- a/base_cpp/src/thread.cc +++ b/base_cpp/src/thread.cc @@ -41,7 +41,7 @@ void Thread::SetThreadsMaxCount(unsigned int max_count) { } Thread::ID Thread::CurrentGetID() { -#if defined EMBB_THREADING_WINTHREADS +#if defined EMBB_PLATFORM_THREADING_WINTHREADS return Thread::ID(GetCurrentThreadId()); #else return Thread::ID(embb_thread_current().embb_internal_handle); @@ -59,15 +59,15 @@ void Thread::Join() { } Thread::ID Thread::GetID() { -#if defined EMBB_THREADING_WINTHREADS +#if defined EMBB_PLATFORM_THREADING_WINTHREADS return Thread::ID(GetCurrentThreadId()); -#elif defined EMBB_THREADING_POSIXTHREADS +#elif defined EMBB_PLATFORM_THREADING_POSIXTHREADS return Thread::ID(rep_.embb_internal_handle); #endif } bool operator==(Thread::ID lhs, Thread::ID rhs) { -#if defined EMBB_THREADING_WINTHREADS +#if defined EMBB_PLATFORM_THREADING_WINTHREADS return lhs.id_ == rhs.id_; #else return pthread_equal(lhs.id_, rhs.id_) != 0; @@ -75,7 +75,7 @@ bool operator==(Thread::ID lhs, Thread::ID rhs) { } bool operator!=(Thread::ID lhs, Thread::ID rhs) { -#if defined EMBB_THREADING_WINTHREADS +#if defined EMBB_PLATFORM_THREADING_WINTHREADS return lhs.id_ != rhs.id_; #else return pthread_equal(lhs.id_, rhs.id_) == 0; diff --git a/base_cpp/test/memory_allocation_test.cc b/base_cpp/test/memory_allocation_test.cc index 188a83d..4c4c9f9 100644 --- a/base_cpp/test/memory_allocation_test.cc +++ b/base_cpp/test/memory_allocation_test.cc @@ -84,12 +84,12 @@ void MemoryAllocationTest::ClassAllocationTest() { aligned_allocs[i]->b = 0xF000 | i; #ifdef EMBB_DEBUG size_t n = (sizeof(DummyClassForAlignedAllocation) - + (EMBB_CACHE_LINE_SIZE - 1)) / EMBB_CACHE_LINE_SIZE; - expected += (n + 1)*EMBB_CACHE_LINE_SIZE + (sizeof(size_t) * 3 - 1); + + (EMBB_PLATFORM_CACHE_LINE_SIZE - 1)) / EMBB_PLATFORM_CACHE_LINE_SIZE; + expected += (n + 1)*EMBB_PLATFORM_CACHE_LINE_SIZE + (sizeof(size_t) * 3 - 1); #endif // else EMBB_DEBUG //check that the memory is aligned! - PT_ASSERT_EQ((uintptr_t)aligned_allocs[i] % EMBB_CACHE_LINE_SIZE, + PT_ASSERT_EQ((uintptr_t)aligned_allocs[i] % EMBB_PLATFORM_CACHE_LINE_SIZE, (uintptr_t)0); } @@ -135,15 +135,15 @@ void MemoryAllocationTest::ClassAllocationTest() { new DummyClassForAlignedAllocation[alloc_iterations]; #ifdef EMBB_DEBUG size_t n = (sizeof(DummyClassForAlignedAllocation)*alloc_iterations - + (EMBB_CACHE_LINE_SIZE - 1)) / EMBB_CACHE_LINE_SIZE; - expected += (n + 1)*EMBB_CACHE_LINE_SIZE + (sizeof(size_t) * 3 - 1); + + (EMBB_PLATFORM_CACHE_LINE_SIZE - 1)) / EMBB_PLATFORM_CACHE_LINE_SIZE; + expected += (n + 1)*EMBB_PLATFORM_CACHE_LINE_SIZE + (sizeof(size_t) * 3 - 1); #endif // else EMBB_DEBUG // This assert does _not_ hold, but is left for documentation. // It is not guaranteed that the pointer to the array is aligned. // See the documentation of the overloaded new[] operator in // class MemoryAllocation. - // PT_ASSERT_EQ((uintptr_t)aligned_allocated % EMBB_CACHE_LINE_SIZE, 0); + // PT_ASSERT_EQ((uintptr_t)aligned_allocated % EMBB_PLATFORM_CACHE_LINE_SIZE, 0); //delete! expected = 0; diff --git a/containers_cpp/include/embb/containers/internal/hazard_pointer.h b/containers_cpp/include/embb/containers/internal/hazard_pointer.h index 03dc57c..1fdf266 100644 --- a/containers_cpp/include/embb/containers/internal/hazard_pointer.h +++ b/containers_cpp/include/embb/containers/internal/hazard_pointer.h @@ -34,7 +34,7 @@ #include #include -#if defined(EMBB_COMPILER_MSVC) +#if defined(EMBB_PLATFORM_COMPILER_MSVC) #define EMBB_CONTAINERS_CPP_DEPENDANT_TYPENAME #else #define EMBB_CONTAINERS_CPP_DEPENDANT_TYPENAME typename diff --git a/containers_cpp/include/embb/containers/internal/lock_free_mpmc_queue-inl.h b/containers_cpp/include/embb/containers/internal/lock_free_mpmc_queue-inl.h index 9c61388..e2ac127 100644 --- a/containers_cpp/include/embb/containers/internal/lock_free_mpmc_queue-inl.h +++ b/containers_cpp/include/embb/containers/internal/lock_free_mpmc_queue-inl.h @@ -80,13 +80,13 @@ LockFreeMPMCQueue::LockFreeMPMCQueue(size_t capacity) : capacity(capacity), // Disable "this is used in base member initializer" warning. // We explicitly want this. -#ifdef EMBB_COMPILER_MSVC +#ifdef EMBB_PLATFORM_COMPILER_MSVC #pragma warning(push) #pragma warning(disable:4355) #endif delete_pointer_callback(*this, &LockFreeMPMCQueue::DeletePointerCallback), -#ifdef EMBB_COMPILER_MSVC +#ifdef EMBB_PLATFORM_COMPILER_MSVC #pragma warning(pop) #endif hazardPointer(delete_pointer_callback, NULL, 2), diff --git a/containers_cpp/include/embb/containers/internal/lock_free_stack-inl.h b/containers_cpp/include/embb/containers/internal/lock_free_stack-inl.h index 7c6e9ab..12be4ed 100644 --- a/containers_cpp/include/embb/containers/internal/lock_free_stack-inl.h +++ b/containers_cpp/include/embb/containers/internal/lock_free_stack-inl.h @@ -72,13 +72,13 @@ LockFreeStack< Type, ValuePool >::LockFreeStack(size_t capacity) : capacity(capacity), // Disable "this is used in base member initializer" warning. // We explicitly want this. -#ifdef EMBB_COMPILER_MSVC +#ifdef EMBB_PLATFORM_COMPILER_MSVC #pragma warning(push) #pragma warning(disable:4355) #endif delete_pointer_callback(*this, &LockFreeStack::DeletePointerCallback), -#ifdef EMBB_COMPILER_MSVC +#ifdef EMBB_PLATFORM_COMPILER_MSVC #pragma warning(pop) #endif hazardPointer(delete_pointer_callback, NULL, 1), diff --git a/containers_cpp/test/hazard_pointer_test.cc b/containers_cpp/test/hazard_pointer_test.cc index 56f455b..7704e69 100644 --- a/containers_cpp/test/hazard_pointer_test.cc +++ b/containers_cpp/test/hazard_pointer_test.cc @@ -32,12 +32,12 @@ namespace embb { namespace containers { namespace test { HazardPointerTest::HazardPointerTest() : -#ifdef EMBB_COMPILER_MSVC +#ifdef EMBB_PLATFORM_COMPILER_MSVC #pragma warning(push) #pragma warning(disable:4355) #endif delete_pointer_callback(*this, &HazardPointerTest::DeletePointerCallback), -#ifdef EMBB_COMPILER_MSVC +#ifdef EMBB_PLATFORM_COMPILER_MSVC #pragma warning(pop) #endif object_pool(NULL), diff --git a/mtapi_c/src/mtapi_status_t.h b/mtapi_c/src/mtapi_status_t.h index 51af480..776c23d 100644 --- a/mtapi_c/src/mtapi_status_t.h +++ b/mtapi_c/src/mtapi_status_t.h @@ -30,7 +30,7 @@ #include #include -EMBB_INLINE void mtapi_status_set( +EMBB_PLATFORM_INLINE void mtapi_status_set( mtapi_status_t* status, mtapi_status_t value) { if (MTAPI_NULL != status) {