added MinGW workflow by firewave · Pull Request #475 · cppcheck-opensource/simplecpp · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
138 changes: 138 additions & 0 deletions .github/workflows/CI-mingw.yml
12 changes: 11 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
add_compile_options(-Woverloaded-virtual) # when a function declaration hides virtual functions from a base class

add_compile_options(-Wsuggest-attribute=noreturn)
add_compile_options_safe(-Wuseless-cast)
if (NOT MINGW)
add_compile_options_safe(-Wuseless-cast)
endif()

# we are not interested in these
set_source_files_properties(test.cpp PROPERTIES COMPILE_FLAGS -Wno-multichar)
Expand Down Expand Up @@ -62,6 +64,14 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")

# contradicts -Wcovered-switch-default
add_compile_options(-Wno-switch-default)
if (MINGW)
add_compile_options(-Wno-reserved-macro-identifier)
add_compile_options(-Wno-unused-macros)
endif()

# these are experimental warnings which might produce false positives
add_compile_options_safe(-Wno-thread-safety-negative)
add_compile_options_safe(-Wno-thread-safety-beta)

# TODO: fix these?
add_compile_options(-Wno-padded)
Expand Down
15 changes: 13 additions & 2 deletions selfcheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,20 @@ if [ "$cxx_type" = "Ubuntu" ] || [ "$cxx_type" = "Debian" ]; then
fi

# TODO: generate defines from compiler
if [ "$cxx_type" = "g++" ]; then
if [ "$cxx_type" = "g++" ] || [ "$cxx_type" = "g++.exe" ]; then
defs=
defs="$defs -D__GNUC__"
defs="$defs -D__STDC__"
defs="$defs -D__x86_64__"
defs="$defs -D__STDC_HOSTED__"
defs="$defs -D__CHAR_BIT__=8"
if [ "${MSYSTEM}" = "MINGW32" ] || [ "${MSYSTEM}" = "MINGW64" ]; then
defs="$defs -D_WIN32"
fi
defs="$defs -D__has_builtin(x)=(1)"
defs="$defs -D__has_cpp_attribute(x)=(1)"
defs="$defs -D__has_attribute(x)=(1)"
defs="$defs -Ddefined(x)=(0)"

inc=
while read line
Expand All @@ -63,12 +67,19 @@ elif [ "$cxx_type" = "clang" ]; then
defs="$defs -D__x86_64__"
defs="$defs -D__STDC_HOSTED__"
defs="$defs -D__CHAR_BIT__=8"
defs="$defs -D__BYTE_ORDER__=1234"
defs="$defs -D__SIZEOF_SIZE_T__=8"
if [ "${MSYSTEM}" = "MINGW32" ] || [ "${MSYSTEM}" = "MINGW64" ] || [ "${MSYSTEM}" = "CLANG64" ]; then
defs="$defs -D_WIN32"
fi
defs="$defs -D__has_builtin(x)=(1)"
defs="$defs -D__has_cpp_attribute(x)=(1)"
defs="$defs -D__has_feature(x)=(1)"
defs="$defs -D__has_include_next(x)=(0)"
defs="$defs -D__has_include_next(x)=(1)"
defs="$defs -D__has_attribute(x)=(0)"
defs="$defs -D__building_module(x)=(0)"
defs="$defs -D__has_extension(x)=(1)"
defs="$defs -Ddefined(x)=(0)"

inc=
while read line
Expand Down
2 changes: 1 addition & 1 deletion simplecpp.cpp