apply workarounds for (probably bogus) warnings or errors from nvcc

This commit is contained in:
Axel Kohlmeyer
2025-01-22 18:20:58 -05:00
parent 94eee049b4
commit 5ddad0bbde
2 changed files with 15 additions and 1 deletions

View File

@ -480,11 +480,23 @@ constexpr FMT_ALWAYS_INLINE const char* narrow(const char* s) { return s; }
template <typename Char>
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;
}

View File

@ -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;