diff --git a/libunwind/src/CMakeLists.txt b/libunwind/src/CMakeLists.txt index 1424f7fc8168c..4683c9687e502 100644 --- a/libunwind/src/CMakeLists.txt +++ b/libunwind/src/CMakeLists.txt @@ -56,7 +56,11 @@ if (RUST_SGX) # on older platforms. # # See https://github.com/rust-lang/rust/issues/34978 - list(APPEND LIBUNWIND_COMPILE_FLAGS -Wa,-mrelax-relocations=no) + if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + list(APPEND LIBUNWIND_COMPILE_FLAGS -Wa,-mrelax-relocations=no) + else() + list(APPEND LIBUNWIND_COMPILE_FLAGS) + endif() # Sources list(APPEND LIBUNWIND_C_SOURCES UnwindRustSgx.c) @@ -119,9 +123,9 @@ string(REPLACE ";" " " LIBUNWIND_C_FLAGS "${LIBUNWIND_C_FLAGS}") string(REPLACE ";" " " LIBUNWIND_LINK_FLAGS "${LIBUNWIND_LINK_FLAGS}") set_property(SOURCE ${LIBUNWIND_CXX_SOURCES} - APPEND_STRING PROPERTY COMPILE_FLAGS " ${CMAKE_CXX_FLAGS} ${LIBUNWIND_CXX_FLAGS}") + APPEND_STRING PROPERTY COMPILE_FLAGS " ${LIBUNWIND_CXX_FLAGS}") set_property(SOURCE ${LIBUNWIND_C_SOURCES} - APPEND_STRING PROPERTY COMPILE_FLAGS " ${CMAKE_C_FLAGS} ${LIBUNWIND_C_FLAGS}") + APPEND_STRING PROPERTY COMPILE_FLAGS " ${LIBUNWIND_C_FLAGS}") # Add a object library that contains the compiled source files. add_library(unwind_objects OBJECT ${LIBUNWIND_SOURCES} ${LIBUNWIND_HEADERS}) diff --git a/libunwind/src/UnwindLevel1.c b/libunwind/src/UnwindLevel1.c index a26d64fba01ef..1d8c49d705a3d 100644 --- a/libunwind/src/UnwindLevel1.c +++ b/libunwind/src/UnwindLevel1.c @@ -19,7 +19,10 @@ // to export these functions from libunwind.so as well. #define _LIBUNWIND_UNWIND_LEVEL1_EXTERNAL_LINKAGE 1 +#ifndef __clang__ #pragma GCC diagnostic ignored "-Wunused-but-set-variable" +#endif + #pragma GCC diagnostic ignored "-Wempty-body" #include diff --git a/libunwind/src/UnwindRustSgx.c b/libunwind/src/UnwindRustSgx.c index 0e336a791e7f0..1046cfab7b425 100644 --- a/libunwind/src/UnwindRustSgx.c +++ b/libunwind/src/UnwindRustSgx.c @@ -17,6 +17,7 @@ #include #include "UnwindRustSgx.h" +#pragma GCC diagnostic ignored "-Wunused-parameter" #define max_log 256 diff --git a/libunwind/src/UnwindRustSgxSnprintf.c b/libunwind/src/UnwindRustSgxSnprintf.c index 8394f213f66cf..6edf52bc3014e 100644 --- a/libunwind/src/UnwindRustSgxSnprintf.c +++ b/libunwind/src/UnwindRustSgxSnprintf.c @@ -5,8 +5,13 @@ * on all source code distributions */ -#pragma GCC diagnostic ignored "-Wconversion" +#ifndef __clang__ #pragma GCC diagnostic ignored "-Wdiscarded-qualifiers" +#else +#pragma GCC diagnostic ignored "-Wincompatible-pointer-types-discards-qualifiers" +#endif + +#pragma GCC diagnostic ignored "-Wconversion" #pragma GCC diagnostic ignored "-Wfloat-conversion" #pragma GCC diagnostic ignored "-Wsign-conversion" #pragma GCC diagnostic ignored "-Wstrict-overflow" diff --git a/libunwind/src/libunwind.cpp b/libunwind/src/libunwind.cpp index 094224fda3e9c..ac572923d2374 100644 --- a/libunwind/src/libunwind.cpp +++ b/libunwind/src/libunwind.cpp @@ -10,7 +10,11 @@ // //===----------------------------------------------------------------------===// +#ifndef __clang__ #pragma GCC diagnostic ignored "-Wmaybe-uninitialized" +#endif + +#pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wmissing-braces" #pragma GCC diagnostic ignored "-Wsign-conversion" #pragma GCC diagnostic ignored "-Wstrict-aliasing"