From 2019717d0c7a32fde1eb717efa061f3b6198324c Mon Sep 17 00:00:00 2001 From: i80287 Date: Tue, 29 Oct 2024 23:50:42 +0300 Subject: [PATCH] update config_macros.hpp --- bstrees/config_macros.hpp | 23 ++++++++++++++++++--- graphs/HungarianAlgorithm/config_macros.hpp | 18 +++++++++++++++- number_theory/config_macros.hpp | 18 +++++++++++++++- vec_instructs/config_macros.hpp | 18 +++++++++++++++- 4 files changed, 71 insertions(+), 6 deletions(-) diff --git a/bstrees/config_macros.hpp b/bstrees/config_macros.hpp index f3cb635..8b1a6ff 100644 --- a/bstrees/config_macros.hpp +++ b/bstrees/config_macros.hpp @@ -292,7 +292,7 @@ #define ATTRIBUTE_COLD #endif -#if CONFIG_GNUC_AT_LEAST(4, 4) || CONFIG_HAS_GCC_ATTRIBUTE(hot) +#if CONFIG_GNUC_AT_LEAST(4, 3) || CONFIG_HAS_GCC_ATTRIBUTE(hot) #define ATTRIBUTE_HOT __attribute__((hot)) #elif (defined(__GNUG__) || defined(__clang__)) && CONFIG_HAS_CPP_ATTRIBUTE(gnu::hot) #define ATTRIBUTE_HOT [[gnu::hot]] @@ -427,7 +427,23 @@ #define ATTRIBUTE_FALLTHROUGH #endif -#if defined(__clang__) +#if CONFIG_CLANG_AT_LEAST(3, 7) +/* + * nullability specifier is a Clang extension + * Possible warning can be suppressed with the following code: + * + * #if defined(__clang__) + * #pragma clang diagnostic push + * #pragma clang diagnostic ignored "-Wnullability-extension" + * #endif + * + * Some code that uses CONFIG_CLANG_NONNULL_QUALIFIER or CONFIG_CLANG_NULLABLE_QUALIFIER + * + * #if defined(__clang__) + * #pragma clang diagnostic pop + * #endif + * + **/ #define CONFIG_CLANG_NONNULL_QUALIFIER _Nonnull #define CONFIG_CLANG_NULLABLE_QUALIFIER _Nullable #else @@ -609,11 +625,12 @@ namespace config { template ATTRIBUTE_ALWAYS_INLINE constexpr bool is_gcc_constant_p(ATTRIBUTE_MAYBE_UNUSED T expr) noexcept { +#if CONFIG_HAS_BUILTIN(__builtin_constant_p) #if CONFIG_HAS_INCLUDE() + // not std::is_trivial_v for backward compatibility with old compilers C++ versions static_assert(std::is_trivial::value, "Type passed to the is_gcc_constant_p() should be trivial"); #endif -#if CONFIG_HAS_BUILTIN(__builtin_constant_p) return static_cast(__builtin_constant_p(expr)); #else return false; diff --git a/graphs/HungarianAlgorithm/config_macros.hpp b/graphs/HungarianAlgorithm/config_macros.hpp index 14a6ba3..8b1a6ff 100644 --- a/graphs/HungarianAlgorithm/config_macros.hpp +++ b/graphs/HungarianAlgorithm/config_macros.hpp @@ -427,7 +427,23 @@ #define ATTRIBUTE_FALLTHROUGH #endif -#if defined(__clang__) +#if CONFIG_CLANG_AT_LEAST(3, 7) +/* + * nullability specifier is a Clang extension + * Possible warning can be suppressed with the following code: + * + * #if defined(__clang__) + * #pragma clang diagnostic push + * #pragma clang diagnostic ignored "-Wnullability-extension" + * #endif + * + * Some code that uses CONFIG_CLANG_NONNULL_QUALIFIER or CONFIG_CLANG_NULLABLE_QUALIFIER + * + * #if defined(__clang__) + * #pragma clang diagnostic pop + * #endif + * + **/ #define CONFIG_CLANG_NONNULL_QUALIFIER _Nonnull #define CONFIG_CLANG_NULLABLE_QUALIFIER _Nullable #else diff --git a/number_theory/config_macros.hpp b/number_theory/config_macros.hpp index 14a6ba3..8b1a6ff 100644 --- a/number_theory/config_macros.hpp +++ b/number_theory/config_macros.hpp @@ -427,7 +427,23 @@ #define ATTRIBUTE_FALLTHROUGH #endif -#if defined(__clang__) +#if CONFIG_CLANG_AT_LEAST(3, 7) +/* + * nullability specifier is a Clang extension + * Possible warning can be suppressed with the following code: + * + * #if defined(__clang__) + * #pragma clang diagnostic push + * #pragma clang diagnostic ignored "-Wnullability-extension" + * #endif + * + * Some code that uses CONFIG_CLANG_NONNULL_QUALIFIER or CONFIG_CLANG_NULLABLE_QUALIFIER + * + * #if defined(__clang__) + * #pragma clang diagnostic pop + * #endif + * + **/ #define CONFIG_CLANG_NONNULL_QUALIFIER _Nonnull #define CONFIG_CLANG_NULLABLE_QUALIFIER _Nullable #else diff --git a/vec_instructs/config_macros.hpp b/vec_instructs/config_macros.hpp index 14a6ba3..8b1a6ff 100644 --- a/vec_instructs/config_macros.hpp +++ b/vec_instructs/config_macros.hpp @@ -427,7 +427,23 @@ #define ATTRIBUTE_FALLTHROUGH #endif -#if defined(__clang__) +#if CONFIG_CLANG_AT_LEAST(3, 7) +/* + * nullability specifier is a Clang extension + * Possible warning can be suppressed with the following code: + * + * #if defined(__clang__) + * #pragma clang diagnostic push + * #pragma clang diagnostic ignored "-Wnullability-extension" + * #endif + * + * Some code that uses CONFIG_CLANG_NONNULL_QUALIFIER or CONFIG_CLANG_NULLABLE_QUALIFIER + * + * #if defined(__clang__) + * #pragma clang diagnostic pop + * #endif + * + **/ #define CONFIG_CLANG_NONNULL_QUALIFIER _Nonnull #define CONFIG_CLANG_NULLABLE_QUALIFIER _Nullable #else