Skip to content

Turn warnings into errors in CI #4397

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lum1n0us
Copy link
Collaborator

  • Apply global warnings in config_common.cmake instead of maintaining them in separate files.
  • Enable errors during CI when building iwasm and wamrc

@lum1n0us lum1n0us linked an issue Jun 20, 2025 that may be closed by this pull request
@lum1n0us lum1n0us force-pushed the fix/global_wanring_options branch 8 times, most recently from f5a4210 to b1a3ca5 Compare June 27, 2025 05:15
- Apply global warnings in config_common.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.
# Remove the extra spaces for better make log
string (REGEX REPLACE " *" " " CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
endif()

# global additional warnings. Keep those options consistent with config_common.cmake.
if (MSVC)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

feels like a duplication of config_common.cmake - would it make sense to create warnings.cmake file and move the common code there, so it can be included when needed?

#
# -fpermissive causes warnings like "-fpermissive is valid for C++/ObjC++ but not for C"
#
# _Static_assert and _Alignof requires c11 or later
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this c11 comment intended to be here? why?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for reminding me. I am inclined to start a discussion here, as we are using _Static_assert and _Alignof(and/or atomic), primarily in WASI. Do we need to designate C11 as our standard, or should we continue using a lower version, like C99, for cross-platform compatibility?


code in wamr-compiler/CMakeLists.txt

if (WAMR_BUILD_LIBC_WASI EQUAL 1)
  # Enable _Static_assert
  set (CMAKE_C_STANDARD 11)
  if (MSVC)
    add_compile_options(/experimental:c11atomics)
  endif()
else()
  set (CMAKE_C_STANDARD 99)
endif()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enables errors for implicit function declaration by default
3 participants