Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
flagarde committed May 16, 2024
1 parent a58de40 commit 9b41692
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
20 changes: 10 additions & 10 deletions include/Khaos/Version.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@
*/

#if defined(__clang__)
#define KHAOS_PUSH_WARNING_CXX98_COMPAT_PEDANTIC() _Pragma("clang diagnostic push") _Pragma("clang diagnostic ignored \"-Wc++98-compat-pedantic\"") /* //NOSONAR */
#define KHAOS_POP_WARNING_CXX98_COMPAT_PEDANTIC() _Pragma("clang diagnostic pop") /* //NOSONAR */
#define KHAOS_PUSH_CXX98_COMPAT_PEDANTIC() _Pragma("clang diagnostic push") _Pragma("clang diagnostic ignored \"-Wc++98-compat-pedantic\"") /* //NOSONAR */
#define KHAOS_POP_CXX98_COMPAT_PEDANTIC() _Pragma("clang diagnostic pop") /* //NOSONAR */
#else
#define KHAOS_PUSH_WARNING_CXX98_COMPAT_PEDANTIC() /* //NOSONAR */
#define KHAOS_POP_WARNING_CXX98_COMPAT_PEDANTIC() /* //NOSONAR */
#define KHAOS_PUSH_CXX98_COMPAT_PEDANTIC() /* //NOSONAR */
#define KHAOS_POP_CXX98_COMPAT_PEDANTIC() /* //NOSONAR */
#endif

/*!
Expand All @@ -51,8 +51,8 @@
* #define KHAOS_DEFINE_name_VERSION_PRIVATE() SET_VERSION(2,3,4,5)
* \endcode
*/
#define SET_VERSION(major, minor, patch, tweak) \
(KHAOS_PUSH_WARNING_CXX98_COMPAT_PEDANTIC()(((major) * 1ULL % (1 << 16)) << 48) + (((minor) * 1ULL % (1 << 16)) << 32) + (((patch) * 1ULL % (1 << 16)) << 16) + ((tweak) * 1ULL % (1 << 16)) KHAOS_POP_WARNING_CXX98_COMPAT_PEDANTIC()) /* //NOSONAR */
#define SET_VERSION(major, minor, patch, tweak) /* //NOSONAR */ \
(KHAOS_PUSH_CXX98_COMPAT_PEDANTIC()(((major) * 1ULL % (1 << 16)) << 48) + (((minor) * 1ULL % (1 << 16)) << 32) + (((patch) * 1ULL % (1 << 16)) << 16) + ((tweak) * 1ULL % (1 << 16)) KHAOS_POP_CXX98_COMPAT_PEDANTIC()) /* //NOSONAR */

/*!
* \hideinitializer
Expand All @@ -61,7 +61,7 @@
*
* \note Value can be directly used in both preprocessor and compiler expressions for comparison to other similarly defined values.
*/
#define GET_VERSION_MAJOR(name) (KHAOS_PUSH_WARNING_CXX98_COMPAT_PEDANTIC()(((KHAOS_DEFINE_##name##_VERSION_PRIVATE()) * 1ULL) >> 48) % (1 << 16) KHAOS_POP_WARNING_CXX98_COMPAT_PEDANTIC()) /* //NOSONAR */
#define GET_VERSION_MAJOR(name) (KHAOS_PUSH_CXX98_COMPAT_PEDANTIC()(((KHAOS_DEFINE_##name##_VERSION_PRIVATE()) * 1ULL) >> 48) % (1 << 16) KHAOS_POP_CXX98_COMPAT_PEDANTIC()) /* //NOSONAR */

/*!
* \hideinitializer
Expand All @@ -70,7 +70,7 @@
*
* \note Value can be directly used in both preprocessor and compiler expressions for comparison to other similarly defined values.
*/
#define GET_VERSION_MINOR(name) (KHAOS_PUSH_WARNING_CXX98_COMPAT_PEDANTIC()(((KHAOS_DEFINE_##name##_VERSION_PRIVATE()) * 1ULL) >> 32) % (1 << 16) KHAOS_POP_WARNING_CXX98_COMPAT_PEDANTIC()) /* //NOSONAR */
#define GET_VERSION_MINOR(name) (KHAOS_PUSH_CXX98_COMPAT_PEDANTIC()(((KHAOS_DEFINE_##name##_VERSION_PRIVATE()) * 1ULL) >> 32) % (1 << 16) KHAOS_POP_CXX98_COMPAT_PEDANTIC()) /* //NOSONAR */

/*!
* \hideinitializer
Expand All @@ -79,7 +79,7 @@
*
* \note Value can be directly used in both preprocessor and compiler expressions for comparison to other similarly defined values.
*/
#define GET_VERSION_PATCH(name) (KHAOS_PUSH_WARNING_CXX98_COMPAT_PEDANTIC()(((KHAOS_DEFINE_##name##_VERSION_PRIVATE()) * 1ULL) >> 16) % (1 << 16) KHAOS_POP_WARNING_CXX98_COMPAT_PEDANTIC()) /* //NOSONAR */
#define GET_VERSION_PATCH(name) (KHAOS_PUSH_CXX98_COMPAT_PEDANTIC()(((KHAOS_DEFINE_##name##_VERSION_PRIVATE()) * 1ULL) >> 16) % (1 << 16) KHAOS_POP_CXX98_COMPAT_PEDANTIC()) /* //NOSONAR */

/*!
* \hideinitializer
Expand All @@ -88,6 +88,6 @@
*
* \note Value can be directly used in both preprocessor and compiler expressions for comparison to other similarly defined values.
*/
#define GET_VERSION_TWEAK(name) (KHAOS_PUSH_WARNING_CXX98_COMPAT_PEDANTIC()((KHAOS_DEFINE_##name##_VERSION_PRIVATE()) * 1ULL) % (1 << 16) KHAOS_POP_WARNING_CXX98_COMPAT_PEDANTIC()) /* //NOSONAR */
#define GET_VERSION_TWEAK(name) (KHAOS_PUSH_CXX98_COMPAT_PEDANTIC()((KHAOS_DEFINE_##name##_VERSION_PRIVATE()) * 1ULL) % (1 << 16) KHAOS_POP_CXX98_COMPAT_PEDANTIC()) /* //NOSONAR */

#endif /* KHAOS_VERSION_H_ */
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ set(KHAOS_PUBLIC_HEADERS
"${PROJECT_SOURCE_DIR}/include/Khaos/Preprocessor.h"
"${PROJECT_SOURCE_DIR}/include/Khaos/Version.h")
set_target_properties(Khaos PROPERTIES PUBLIC_HEADER "${KHAOS_PUBLIC_HEADERS}")
target_compile_options(Khaos INTERFACE $<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>>:-Wall> $<$<CXX_COMPILER_ID:MSVC>:/W4>)
target_compile_options(Khaos INTERFACE $<$<AND:$<CXX_COMPILER_ID:Clang>,$<CMAKE_CXX_COMPILER_FRONTEND_VARIANT:GNU>,$<VERSION_LESS:CMAKE_CXX_COMPILER_VERSION,3.6>>:-Wno-c++98-compat-pedantic>)
target_include_directories(Khaos INTERFACE "$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include/>" "$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include/>" "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>")
install(TARGETS Khaos EXPORT KhaosTargets
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
Expand Down

0 comments on commit 9b41692

Please sign in to comment.