You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by me...@apache.org on 2022/05/16 20:34:45 UTC
[tvm] branch main updated: [build][hexagon] fix several compiler warnings (#11245)
This is an automated email from the ASF dual-hosted git repository.
mehrdadh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git
The following commit(s) were added to refs/heads/main by this push:
new ebf3607067 [build][hexagon] fix several compiler warnings (#11245)
ebf3607067 is described below
commit ebf360706792a3022c38086d3e2f1379d9abe457
Author: Christian Convey <cc...@octoml.ai>
AuthorDate: Mon May 16 16:34:38 2022 -0400
[build][hexagon] fix several compiler warnings (#11245)
---
cmake/modules/Hexagon.cmake | 10 +++++++++-
src/runtime/hexagon/rpc/simulator/session.cc | 21 +++++++++++++++++++++
2 files changed, 30 insertions(+), 1 deletion(-)
diff --git a/cmake/modules/Hexagon.cmake b/cmake/modules/Hexagon.cmake
index d45311a87f..03ab62de66 100644
--- a/cmake/modules/Hexagon.cmake
+++ b/cmake/modules/Hexagon.cmake
@@ -61,7 +61,7 @@ endif()
# the path to the SDK), unless it's needed. The flag USE_HEXAGON decides
# whether any Hexagon-related functionality is enabled. Specifically,
# setting USE_HEXAGON=OFF, disables any form of Hexagon support.
-#
+#
# Note on the function of USE_HEXAGON_RPC:
# - When building for Hexagon, this will build the Hexagon endpoint of the
# RPC server: the FastRPC skel library (with TVM runtime built into it),
@@ -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")
+ # We can't easily fix this at the source-code level, because the .c file is generated
+ # by the qaic program. But it should be safe to ignore the warning:
+ # https://stackoverflow.com/questions/13905200/is-it-wise-to-ignore-gcc-clangs-wmissing-braces-warning
+ set_source_files_properties("${TVMRT_SOURCE_DIR}/hexagon/rpc/hexagon_rpc_stub.c"
+ PROPERTY COMPILE_FLAGS "-Wno-missing-braces")
+ endif()
endfunction()
if(BUILD_FOR_ANDROID)
diff --git a/src/runtime/hexagon/rpc/simulator/session.cc b/src/runtime/hexagon/rpc/simulator/session.cc
index 937214e352..7d88bbb748 100644
--- a/src/runtime/hexagon/rpc/simulator/session.cc
+++ b/src/runtime/hexagon/rpc/simulator/session.cc
@@ -466,6 +466,18 @@ std::string SimulatorRPCChannel::Cpu_::str() const {
return default_cpu_;
}
+// LOG(FATAL) always throws an exception or terminates the
+// process, but the compiler doesn't know that.
+#if (__GNUC__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wreturn-type"
+#endif
+
+#if (__clang__)
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wreturn-type"
+#endif
+
std::string SimulatorRPCChannel::Message_::str() const {
switch (msg.code) {
case Message::kNone:
@@ -483,10 +495,19 @@ std::string SimulatorRPCChannel::Message_::str() const {
case Message::kSendEnd:
return "kSendEnd";
default:
+ LOG(FATAL) << "Internal error: Unrecognized code value: " << msg.code;
break;
}
}
+#if (__GNUC__)
+#pragma GCC diagnostic pop
+#endif
+
+#if (__clang__)
+#pragma GCC diagnostic pop
+#endif
+
SimulatorRPCChannel::SDKInfo_::SDKInfo_(const std::string& sdk_root, const std::string& cpu)
: root(sdk_root) {
// For v69 chips, still look for v68 in the directory names.