Add -Werror flag to clang copts
Use -Wno-unused-command-line-argument to suppress the unused {MD, MT,
MF} flags. It is also applied in
https://github.com/google/iree/blob/75d4bb8/build_tools/cmake/iree_copts.cmake#L105
Change-Id: I31dc29ad273dae2123744299e98e802c5e453551
diff --git a/cmake/riscv_baremetal.cmake b/cmake/riscv_baremetal.cmake
index 74d6e7c..bd67cf9 100644
--- a/cmake/riscv_baremetal.cmake
+++ b/cmake/riscv_baremetal.cmake
@@ -5,12 +5,12 @@
set(CMAKE_SYSTEM_ABI ilp32)
set(CMAKE_EXECUTABLE_SUFFIX ".elf")
-# TODO: -Werror fails for clang due to un-used flags. Track down where those flags get added.
set(VEC_DEFAULT_COPTS
"-Wall"
"-O0"
"-g3"
- "-ggdb")
+ "-ggdb"
+ "-Werror")
if( ${BUILD_IREE} )
set(CMAKE_SYSTEM_PROCESSOR rv32imfv0p10)
@@ -29,6 +29,8 @@
set(CMAKE_STRIP "${RISCV_TOOLCHAIN_ROOT}/llvm-strip")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -menable-experimental-extensions -march=${CMAKE_SYSTEM_PROCESSOR} -mabi=${CMAKE_SYSTEM_ABI}")
+ set(VEC_DEFAULT_COPTS "${VEC_DEFAULT_COPTS}"
+ "-Wno-unused-command-line-argument")
else()
set(CMAKE_SYSTEM_PROCESSOR rv32imv)
@@ -59,7 +61,6 @@
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=${CMAKE_SYSTEM_PROCESSOR} -mabi=${CMAKE_SYSTEM_ABI}")
set(VEC_DEFAULT_COPTS "${VEC_DEFAULT_COPTS}"
- "-Werror"
"-ffreestanding"
"-ffunction-sections"
"-fstack-usage"