Support Clang 16 (#4592)

This commit is contained in:
Mariusz Glebocki 2023-10-20 21:47:09 +02:00 committed by GitHub
parent 83a0085c4d
commit c7a0613c57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 18 deletions

View File

@ -371,10 +371,9 @@ _MY_CXX_CHECK_OPT(CFG_CXXFLAGS_WEXTRA,-Wthread-safety)
AC_SUBST(CFG_CXXFLAGS_WEXTRA)
# Flags for coroutine support for dynamic scheduling
_MY_CXX_CHECK_IFELSE(
-fcoroutines-ts,
[CFG_CXXFLAGS_COROUTINES="-fcoroutines-ts"],
[CFG_CXXFLAGS_COROUTINES="-fcoroutines"])
_MY_CXX_CHECK_SET(CFG_CXXFLAGS_COROUTINES,-fcoroutines-ts)
_MY_CXX_CHECK_SET(CFG_CXXFLAGS_COROUTINES,-fcoroutines)
_MY_CXX_CHECK_SET(CFG_CXXFLAGS_COROUTINES,-fcoroutines-ts -Wno-deprecated-experimental-coroutine)
AC_SUBST(CFG_CXXFLAGS_COROUTINES)
# HAVE_COROUTINES
@ -442,7 +441,10 @@ m4_foreach([cflag],[
[-mno-cet],
[-Qunused-arguments],
[-Wno-bool-operation],
[-Wno-c++11-narrowing],
[-Wno-constant-logical-operand],
[-Wno-non-pod-varargs],
[-Wno-overloaded-virtual],
[-Wno-parentheses-equality],
[-Wno-shadow],
[-Wno-sign-compare],

View File

@ -250,6 +250,16 @@ template <class T_Value, uint64_t T_numValues>
class VlRandC final {
T_Value m_remaining = 0; // Number of values to pull before re-randomize
T_Value m_lfsr = 1; // LFSR state
public:
// CONSTRUCTORS
VlRandC() {
static_assert(T_numValues >= 1, "");
static_assert(sizeof(T_Value) == 8 || (T_numValues < (1ULL << (8 * sizeof(T_Value)))), "");
}
// METHODS
T_Value randomize(VlRNG& rngr) {
if (VL_UNLIKELY(!m_remaining)) reseed(rngr);
// Polynomials are first listed at https://users.ece.cmu.edu/~koopman/lfsr/
static constexpr uint64_t s_polynomials[] = {
0x0ULL, // 0 never used (constant, no randomization)
@ -264,16 +274,6 @@ class VlRandC final {
0x80000057ULL, // 32
0x100000029ULL // 33
};
public:
// CONSTRUCTORS
VlRandC() {
static_assert(T_numValues >= 1, "");
static_assert(sizeof(T_Value) == 8 || (T_numValues < (1ULL << (8 * sizeof(T_Value)))), "");
}
// METHODS
T_Value randomize(VlRNG& rngr) {
if (VL_UNLIKELY(!m_remaining)) reseed(rngr);
constexpr uint32_t clogWidth = VL_CLOG2_CE_Q(T_numValues) + 1;
constexpr uint32_t lfsrWidth = (clogWidth < 2) ? 2 : clogWidth;
constexpr T_Value polynomial = static_cast<T_Value>(s_polynomials[lfsrWidth]);