[CK-TILE] Guard against compiler lexer diagnostic (#3444)

* [CK-TILE] Guard against compiler lexer diagnostic

A recent change to Clang added a lexer-level diagnostic about that C2y
language feature. Since that is lexer level, the `__extension__`
compiler built-in does not work as it is only respected *after* the
lexer when parsing.

This change adds guarding pragmas to disable the diagnostic in the
lexer and not lead to warnings being treated as errors.

* Fixing still existing build issue

Once the one warning was removed, another one poppoed up. Both are
related to the same c2y feature. Thus, ignoring both.

* clang-format handling

---------

Co-authored-by: Illia Silin <98187287+illsilin@users.noreply.github.com>
This commit is contained in:
Jan Patrick Lehr
2025-12-20 02:32:20 +01:00
committed by GitHub
parent cbc8335964
commit 9bd67c2cf2
2 changed files with 32 additions and 11 deletions

View File

@@ -101,15 +101,30 @@ template <int I>
struct static_counter_uniq_;
}
#define MAKE_SC() \
__extension__ ck_tile::static_counter<ck_tile::impl::static_counter_uniq_<__COUNTER__>> {}
// clang-format off
#define MAKE_SC() \
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Wpre-c2y-compat\"") \
_Pragma("clang diagnostic ignored \"-Wc2y-extensions\"") \
ck_tile::static_counter<ck_tile::impl::static_counter_uniq_<__COUNTER__>>{} \
_Pragma("clang diagnostic pop")
#define MAKE_SC_WITH(start_, step_) \
__extension__ ck_tile:: \
static_counter<ck_tile::impl::static_counter_uniq_<__COUNTER__>, start_, step_> \
{ \
}
#define NEXT_SC(c_) __extension__ c_.next<__COUNTER__>()
#define NEXT_SCI(c_, static_i_) __extension__ c_.next<__COUNTER__ + static_i_>()
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Wpre-c2y-compat\"") \
_Pragma("clang diagnostic ignored \"-Wc2y-extensions\"") ck_tile:: \
static_counter<ck_tile::impl::static_counter_uniq_<__COUNTER__>, start_, step_>{} \
_Pragma("clang diagnostic pop")
#define NEXT_SC(c_) \
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Wpre-c2y-compat\"") \
_Pragma("clang diagnostic ignored \"-Wc2y-extensions\"") c_.next<__COUNTER__>() \
_Pragma("clang diagnostic pop")
#define NEXT_SCI(c_, static_i_) \
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Wpre-c2y-compat\"") \
_Pragma("clang diagnostic ignored \"-Wc2y-extensions\"") \
c_.next<__COUNTER__ + static_i_>() _Pragma("clang diagnostic pop")
// clang-format on
// Usage:
// constexpr auto c = MAKE_SC()