wasm-micro-runtime/build-scripts/warnings.cmake
liang.he@intel.com 0050677248 Turn warnings into errors in CI
- Apply global warnings in warnings.cmake instead of maintaining them in
  separate files.
- Enable errors during CI when building iwasm and wamrc.
- Since GCC and Clang are the default compilers on Ubuntu and macOS, enabling
  `-Werror` on both platforms can be treated as checking with different
  compilers.
2025-07-11 05:10:10 +00:00

29 lines
950 B
CMake
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Copyright (C) 2019 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
# global additional warnings. Keep those options consistent with wamr-compiler/CMakeLists.txt.
if (MSVC)
# warning level 4
add_compile_options(/W4)
else ()
# refer to https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
add_compile_options(
-Wall -Wextra -Wformat -Wformat-security
$<$<COMPILE_LANGUAGE:C>:-Wshadow>
)
# -pedantic causes warnings like "ISO C forbids initialization between function pointer and void *" which
# is widely used in the codebase.
#
# -fpermissive causes warnings like "-fpermissive is valid for C++/ObjC++ but not for C"
#
add_compile_options (
$<$<COMPILE_LANGUAGE:C>:-Wincompatible-pointer-types>
$<$<COMPILE_LANGUAGE:C>:-Wimplicit-function-declaration>
)
# waivers
add_compile_options (
-Wno-unused
-Wno-unused-parameter
)
endif ()