Skip to content

Commit

Permalink
Fix Warnings on MSVC and NVCC
Browse files Browse the repository at this point in the history
  • Loading branch information
junrushao committed Jan 16, 2024
1 parent 5547b16 commit df5e3ff
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions include/tvm/runtime/logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -352,10 +352,16 @@ class LogFatal {
#ifdef _MSC_VER
#pragma disagnostic push
#pragma warning(disable : 4722)
#elif defined(__CUDACC__)
#pragma nv_exec_check_disable
#pragma diag_suppress 1305
#endif
[[noreturn]] ~LogFatal() TVM_THROW_EXCEPTION { GetEntry().Finalize(); }
#ifdef _MSC_VER
#pragma disagnostic pop
#elif defined(__CUDACC__)
#pragma nv_exec_check_enable
#pragma diag_default 1305
#endif
std::ostringstream& stream() { return GetEntry().stream_; }

Expand Down Expand Up @@ -560,15 +566,26 @@ std::unique_ptr<std::string> LogCheckFormat(const X& x, const Y& y) {
return LogCheck##name<int, int>(x, y); \
}

#if defined(__GNUC__) || defined(__clang__) // GCC and Clang
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsign-compare"
#elif defined(_MSC_VER) // MSVC
#pragma warning(push)
#pragma warning(disable : 4389) // '==' : signed/unsigned mismatch
#endif

TVM_CHECK_FUNC(_LT, <)
TVM_CHECK_FUNC(_GT, >)
TVM_CHECK_FUNC(_LE, <=)
TVM_CHECK_FUNC(_GE, >=)
TVM_CHECK_FUNC(_EQ, ==)
TVM_CHECK_FUNC(_NE, !=)

#if defined(__GNUC__) || defined(__clang__) // GCC and Clang
#pragma GCC diagnostic pop
#elif defined(_MSC_VER) // MSVC
#pragma warning(pop)
#endif

} // namespace detail

Expand Down

0 comments on commit df5e3ff

Please sign in to comment.