diff --git a/cmake/modules/Hexagon.cmake b/cmake/modules/Hexagon.cmake index d45311a87fec..03ab62de66b0 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 937214e35233..7d88bbb748d0 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.