From 5ddad0bbdeba2eabb4c6422c7055a97a931f4234 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 22 Jan 2025 18:20:58 -0500 Subject: [PATCH] apply workarounds for (probably bogus) warnings or errors from nvcc --- src/fmt/base.h | 12 ++++++++++++ src/fmt/format.h | 4 +++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/fmt/base.h b/src/fmt/base.h index efa957d8d2..befecfc0f6 100644 --- a/src/fmt/base.h +++ b/src/fmt/base.h @@ -480,11 +480,23 @@ constexpr FMT_ALWAYS_INLINE const char* narrow(const char* s) { return s; } template FMT_CONSTEXPR auto compare(const Char* s1, const Char* s2, std::size_t n) -> int { + // LAMMPS customization. Try to suppress warnings from nvcc +#if 0 // original code if (!is_constant_evaluated() && sizeof(Char) == 1) return memcmp(s1, s2, n); for (; n != 0; ++s1, ++s2, --n) { if (*s1 < *s2) return -1; if (*s1 > *s2) return 1; } +#else + if (!is_constant_evaluated() && sizeof(Char) == 1) { + return memcmp(s1, s2, n); + } else { + for (; n != 0; ++s1, ++s2, --n) { + if (*s1 < *s2) return -1; + if (*s1 > *s2) return 1; + } + } +#endif return 0; } diff --git a/src/fmt/format.h b/src/fmt/format.h index 92a1d5b7a0..df7582cac3 100644 --- a/src/fmt/format.h +++ b/src/fmt/format.h @@ -2591,7 +2591,9 @@ class bigint { } public: - FMT_CONSTEXPR bigint() : exp_(0) {} + // LAMMPS customization. NVCC wrongly complains about calling a non-constepr function + // so we comment out constexpr here for now. + /* FMT_CONSTEXPR */ bigint() : exp_(0) {} explicit bigint(uint64_t n) { assign(n); } bigint(const bigint&) = delete;