Skip to content
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

Fix nvcc warnings #278

Merged
merged 1 commit into from
Feb 4, 2025
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
16 changes: 15 additions & 1 deletion test/multithreaded/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,21 @@ set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 20)
# enable compiler warnings
if(NOT mallocMC_TEST_INSTALLED_VERSION)
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU")
target_compile_options(mallocMC INTERFACE -Wall -Wpedantic -Wextra -Werror "$<$<COMPILE_LANGUAGE:CUDA>:SHELL:default-stream-launch>")
target_compile_options(
mallocMC
INTERFACE
-Wall
# nvcc generate C code which uses directives GCC complains about like this:
# warning: style of line directive is a GCC extension
# So we can't use -pedantic here.
$<$<NOT:$<COMPILE_LANGUAGE:CUDA>>:-Wpedantic>
-Wextra
# Somehow, with the commandline that CMake composes nvcc misinterprets the flag
# after -Werror as an argument to -Werror leading to errors like
# nvcc fatal : Value '-Wpedantic' is not defined for option 'Werror'
# So, we can't compile with -Werror for nvcc.
$<$<NOT:$<COMPILE_LANGUAGE:CUDA>>:-Werror>
)
elseif(MSVC)
target_compile_options(mallocMC INTERFACE /W4 /WX)
endif()
Expand Down
16 changes: 15 additions & 1 deletion test/unit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,21 @@ set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 20)
# enable compiler warnings
if(NOT mallocMC_TEST_INSTALLED_VERSION)
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU")
target_compile_options(mallocMC INTERFACE -Wall -Wpedantic -Wextra -Werror "$<$<COMPILE_LANGUAGE:CUDA>:SHELL:default-stream-launch>")
target_compile_options(
mallocMC
INTERFACE
-Wall
# nvcc generate C code which uses directives GCC complains about like this:
# warning: style of line directive is a GCC extension
# So we can't use -pedantic here.
$<$<NOT:$<COMPILE_LANGUAGE:CUDA>>:-Wpedantic>
-Wextra
# Somehow, with the commandline that CMake composes nvcc misinterprets the flag
# after -Werror as an argument to -Werror leading to errors like
# nvcc fatal : Value '-Wpedantic' is not defined for option 'Werror'
# So, we can't compile with -Werror for nvcc.
$<$<NOT:$<COMPILE_LANGUAGE:CUDA>>:-Werror>
)
elseif(MSVC)
target_compile_options(mallocMC INTERFACE /W4 /WX)
endif()
Expand Down