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
1 change: 1 addition & 0 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ jobs:
-DPA_USE_SKELETON=ON
-DPA_BUILD_TESTS=ON
-DPA_BUILD_EXAMPLES=ON
-DPA_WARNINGS_ARE_ERRORS=ON
-S .
-B build
- name: build
Expand Down
37 changes: 37 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,43 @@ else()
set(LIBRARY_BUILD_TYPE STATIC)
endif()

option(PA_WARNINGS_ARE_ERRORS "Turn compiler warnings into errors" OFF)
if(PA_WARNINGS_ARE_ERRORS)
if(MSVC)
add_compile_options(/WX
# "Grandfathered" warnings that existed before we started enforcement.
# Do *NOT* add warnings to this list. Instead, fix your code so that it doesn't produce the warning.
# TODO: fix the offending code so that we don't have to exclude specific warnings anymore.
/wd4018 # W3 signed/unsigned mismatch
/wd4024 # W1 different types for formal and actual parameter
/wd4047 # W1 differs in levels of indirection
/wd4101 # W3 unreferenced local variable
/wd4133 # W3 incompatible types
/wd4146 # W2 unary minus operator applied to unsigned type, result still unsigned
/wd4244 # W2 conversion possible loss of data
/wd4267 # W3 conversion possible loss of data
/wd4305 # W1 truncation
/wd4477 # W1 format string requires an argument of type, but variadic argument number has type
/wd4996 # W3 unsafe/deprecated
)
else()
add_compile_options(-Werror
# "Grandfathered" warnings that existed before we started enforcement.
# Do *NOT* add warnings to this list. Instead, fix your code so that it doesn't produce the warning.
# TODO: fix the offending code so that we don't have to exclude specific warnings anymore.
-Wno-error=deprecated-declarations # https://github.com/PortAudio/portaudio/issues/213 https://github.com/PortAudio/portaudio/issues/641
-Wno-error=incompatible-pointer-types
-Wno-error=int-conversion
-Wno-error=stringop-overflow
)
if (CMAKE_C_COMPILER_ID MATCHES "Clang")
# Don't fail on older clang versions that don't recognize the latest warnings in the list above.
# Note that unrecognized warning options are not a fatal error on GCC, and in fact, GCC will choke on this option. Hence the conditional.
add_compile_options(-Wno-error=unknown-warning-option)
endif()
endif()
endif()

add_library(PortAudio
${LIBRARY_BUILD_TYPE}
src/common/pa_allocation.c
Expand Down