Skip to content

Commit 7e1cbc7

Browse files
authored
Merge pull request #214 from elbeno/fix-pragmas
2 parents 19369a5 + 4b719be commit 7e1cbc7

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

include/stdx/static_assert.hpp

+5-7
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,16 @@ template <ct_string Fmt, auto... Args> constexpr auto static_format() {
3939
} // namespace v1
4040
} // namespace stdx
4141

42-
STDX_PRAGMA(diagnostic push)
43-
#ifdef __clang__
44-
STDX_PRAGMA(diagnostic ignored "-Wunknown-warning-option")
45-
STDX_PRAGMA(diagnostic ignored "-Wc++26-extensions")
46-
#endif
4742
#if __cpp_static_assert >= 202306L
43+
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
4844
#define STATIC_ASSERT(cond, ...) \
4945
[]<bool B>() -> bool { \
46+
STDX_PRAGMA(diagnostic push) \
47+
STDX_PRAGMA(diagnostic ignored "-Wunknown-warning-option") \
48+
STDX_PRAGMA(diagnostic ignored "-Wc++26-extensions") \
5049
static_assert( \
5150
B, std::string_view{stdx::detail::static_format<__VA_ARGS__>()}); \
51+
STDX_PRAGMA(diagnostic pop) \
5252
return B; \
5353
}.template operator()<cond>()
5454
#else
@@ -58,8 +58,6 @@ STDX_PRAGMA(diagnostic ignored "-Wc++26-extensions")
5858
stdx::ct_check<B>.template emit<stdx::detail::static_format<__VA_ARGS__>()>(); \
5959
return B; \
6060
}.template operator()<cond>()
61-
6261
#endif
63-
STDX_PRAGMA(diagnostic pop)
6462

6563
#endif

0 commit comments

Comments
 (0)