Skip to content

Commit

Permalink
update config_macros.hpp
Browse files Browse the repository at this point in the history
  • Loading branch information
i80287 committed Oct 29, 2024
1 parent 2f8bc52 commit 2019717
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 6 deletions.
23 changes: 20 additions & 3 deletions bstrees/config_macros.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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]]
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -609,11 +625,12 @@ namespace config {

template <class T>
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(<type_traits>)
// not std::is_trivial_v for backward compatibility with old compilers C++ versions
static_assert(std::is_trivial<T>::value,
"Type passed to the is_gcc_constant_p() should be trivial");
#endif
#if CONFIG_HAS_BUILTIN(__builtin_constant_p)
return static_cast<bool>(__builtin_constant_p(expr));
#else
return false;
Expand Down
18 changes: 17 additions & 1 deletion graphs/HungarianAlgorithm/config_macros.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 17 additions & 1 deletion number_theory/config_macros.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 17 additions & 1 deletion vec_instructs/config_macros.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2019717

Please sign in to comment.