You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2022/05/09 20:44:59 UTC

[GitHub] [tvm] kparzysz-quic commented on a diff in pull request #11245: [build][hexagon] fix several compiler warnings

kparzysz-quic commented on code in PR #11245:
URL: https://github.com/apache/tvm/pull/11245#discussion_r868441174


##########
cmake/modules/Hexagon.cmake:
##########
@@ -172,6 +172,14 @@ if(USE_HEXAGON_RPC)
           -o "${TVMRT_SOURCE_DIR}/hexagon/rpc"
       MAIN_DEPENDENCY "${TVMRT_SOURCE_DIR}/hexagon/rpc/hexagon_rpc.idl"
     )
+
+    if (("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") OR ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang"))

Review Comment:
   Please remove the extra parentheses, and the space after `if`.



##########
src/runtime/hexagon/rpc/simulator/session.cc:
##########
@@ -483,7 +483,13 @@ std::string SimulatorRPCChannel::Message_::str() const {
     case Message::kSendEnd:
       return "kSendEnd";
     default:
-      break;
+      LOG(FATAL) << "Internal error: unexpected message code: " << msg.code;
+#if (__GCC__ || __clang__)
+#if __has_builtin(__builtin_unreachable)
+      __builtin_unreachable()
+#endif
+#endif
+          break;

Review Comment:
   The `LOG(FATAL)` should terminate the program, so the builtin isn't really needed---more so that it only happens if the compiler supports it.  A better thing may be to return `"kInvalid_" + std::to_string(msg.code)` or something like that if you don't trust the LOG to cause an abort.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org