diff --git a/include/webcpp/crypto/backends/bearssl.hpp b/include/webcpp/crypto/backends/bearssl.hpp index 3cfc521a..19e875e3 100644 --- a/include/webcpp/crypto/backends/bearssl.hpp +++ b/include/webcpp/crypto/backends/bearssl.hpp @@ -70,9 +70,9 @@ WEBCPP_CRYPTO_DETAIL_BEARSSL_CONFIGURATION)) #endif -// src/canary_bearssl.c defines the canary with a constant; this is its declaration. -// NOLINTNEXTLINE(bugprone-dynamic-static-initializers): a declaration, never initialised here -extern "C" const char WEBCPP_CRYPTO_DETAIL_BEARSSL_CANARY; +// src/canary_bearssl.c defines the canary with a constant, so its initialisation is static, never +// dynamic; constinit, on this declaration, states it. +extern "C" constinit const char WEBCPP_CRYPTO_DETAIL_BEARSSL_CANARY; namespace webcpp::crypto::backends { diff --git a/include/webcpp/crypto/backends/ctaes.hpp b/include/webcpp/crypto/backends/ctaes.hpp index be6b0753..5bde2832 100644 --- a/include/webcpp/crypto/backends/ctaes.hpp +++ b/include/webcpp/crypto/backends/ctaes.hpp @@ -57,9 +57,9 @@ extern "C" { WEBCPP_CRYPTO_DETAIL_CTAES_CONFIGURATION)) #endif -// src/canary_ctaes.c defines the canary with a constant; this is its declaration. -// NOLINTNEXTLINE(bugprone-dynamic-static-initializers): a declaration, never initialised here -extern "C" const char WEBCPP_CRYPTO_DETAIL_CTAES_CANARY; +// src/canary_ctaes.c defines the canary with a constant, so its initialisation is static, never +// dynamic; constinit, on this declaration, states it. +extern "C" constinit const char WEBCPP_CRYPTO_DETAIL_CTAES_CANARY; namespace webcpp::crypto::backends { diff --git a/include/webcpp/crypto/backends/secp256k1.hpp b/include/webcpp/crypto/backends/secp256k1.hpp index 34e85647..687f62b4 100644 --- a/include/webcpp/crypto/backends/secp256k1.hpp +++ b/include/webcpp/crypto/backends/secp256k1.hpp @@ -63,9 +63,9 @@ WEBCPP_CRYPTO_DETAIL_SECP256K1_CONFIGURATION)) #endif -// src/canary_secp256k1.c defines the canary with a constant; this is its declaration. -// NOLINTNEXTLINE(bugprone-dynamic-static-initializers): a declaration, never initialised here -extern "C" const char WEBCPP_CRYPTO_DETAIL_SECP256K1_CANARY; +// src/canary_secp256k1.c defines the canary with a constant, so its initialisation is static, never +// dynamic; constinit, on this declaration, states it. +extern "C" constinit const char WEBCPP_CRYPTO_DETAIL_SECP256K1_CANARY; namespace webcpp::crypto::backends { diff --git a/include/webcpp/crypto/backends/sodium.hpp b/include/webcpp/crypto/backends/sodium.hpp index 506b7186..903b1240 100644 --- a/include/webcpp/crypto/backends/sodium.hpp +++ b/include/webcpp/crypto/backends/sodium.hpp @@ -52,9 +52,9 @@ WEBCPP_CRYPTO_DETAIL_MISMATCH_VALUE(sodium, WEBCPP_CRYPTO_SODIUM_COMMIT, portable)) #endif -// src/canary_sodium.c defines the canary with a constant; this is its declaration. -// NOLINTNEXTLINE(bugprone-dynamic-static-initializers): a declaration, never initialised here -extern "C" const char WEBCPP_CRYPTO_DETAIL_SODIUM_CANARY; +// src/canary_sodium.c defines the canary with a constant, so its initialisation is static, never +// dynamic; constinit, on this declaration, states it. +extern "C" constinit const char WEBCPP_CRYPTO_DETAIL_SODIUM_CANARY; namespace webcpp::crypto::backends { diff --git a/test/msvc/canary_secp256k1_two_files/other.cpp b/test/msvc/canary_secp256k1_two_files/other.cpp index 45be9ea3..499e81be 100644 --- a/test/msvc/canary_secp256k1_two_files/other.cpp +++ b/test/msvc/canary_secp256k1_two_files/other.cpp @@ -17,8 +17,9 @@ #include // The canary of the configuration above, which the large tables' archive does not define. The -// header declared it, so this definition has external linkage. -extern "C" const char WEBCPP_CRYPTO_DETAIL_SECP256K1_CANARY = 0; +// header declared it, so this definition has external linkage; it declared it constinit, which +// its initialising declaration repeats. +extern "C" constinit const char WEBCPP_CRYPTO_DETAIL_SECP256K1_CANARY = 0; bool sign_other() { std::array secret{}; diff --git a/test/msvc/canary_two_files/other.cpp b/test/msvc/canary_two_files/other.cpp index 04eb7645..27c40e69 100644 --- a/test/msvc/canary_two_files/other.cpp +++ b/test/msvc/canary_two_files/other.cpp @@ -19,8 +19,9 @@ #include // The canary of the configuration above, which no archive defines (the archive of MSVC's BearSSL -// is built noseeder). The header declared it, so this definition has external linkage. -extern "C" const char WEBCPP_CRYPTO_DETAIL_BEARSSL_CANARY = 0; +// is built noseeder). The header declared it, so this definition has external linkage; it +// declared it constinit, which its initialising declaration repeats. +extern "C" constinit const char WEBCPP_CRYPTO_DETAIL_BEARSSL_CANARY = 0; bool seal_other() { std::array const key{};