diff --git a/include/fmt/core.h b/include/fmt/core.h index 8e8d2f1ce443..01cf34cf1d4f 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -24,7 +24,8 @@ # define FMT_CLANG_VERSION 0 #endif -#if defined(__GNUC__) && !defined(__clang__) && !defined(__INTEL_COMPILER) +#if defined(__GNUC__) && !defined(__clang__) && !defined(__INTEL_COMPILER) && \ + !defined(__NVCOMPILER) # define FMT_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__) #else # define FMT_GCC_VERSION 0 diff --git a/include/fmt/format.h b/include/fmt/format.h index c4c9321dc95c..f9d9f683ef2c 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -970,11 +970,14 @@ FMT_CONSTEXPR auto count_digits(UInt n) -> int { if (num_bits() == 32) return (FMT_BUILTIN_CLZ(static_cast(n) | 1) ^ 31) / BITS + 1; #endif - int num_digits = 0; - do { - ++num_digits; - } while ((n >>= BITS) != 0); - return num_digits; + // Lambda avoids unreachable code warnings from NVHPC. + return [](UInt m) { + int num_digits = 0; + do { + ++num_digits; + } while ((m >>= BITS) != 0); + return num_digits; + }(n); } template <> auto count_digits<4>(detail::fallback_uintptr n) -> int;