Enable the use of some warnings when building ROCclr

Enabling anything beyond -Wall like -Wextra or -pedantic seems impossible as our code base explodes in thousands of warnings.

-Wno-unused-{variable/function} is not present in the p4 build, but with gcc7.4.0 we get hundreds of instances of this warning being triggered in the code base.

With this change only two warnings show up during the build - -Wsequence-point and -Wunused-but-set-variable. The fix for the first is alredy in review.

Change-Id: I2ff37981377487b0e07fd9490498e38a60792c0c
This commit is contained in:
Vlad Sytchenko
2020-06-15 15:17:10 -04:00
committed by Vladislav Sytchenko
parent afe825c506
commit 947dbe82fb
+15 -4
View File
@@ -40,10 +40,6 @@ endif()
option(USE_COMGR_LIBRARY "Use comgr library" ON)
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
add_compile_options("-Wno-ignored-attributes")
endif()
find_package(amd_comgr REQUIRED CONFIG
PATHS
/opt/rocm/
@@ -86,6 +82,21 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") OR
(CMAKE_${COMPILER}_COMPILER_ID MATCHES "Clang"))
add_definitions(
# Enabling -Wextra or -pedantic will cause
# thousands of warnings. Keep things simple for now.
-Wall
# Makefile build adds -fno-strict-aliasing instead.
-Wno-strict-aliasing
# This one seems impossible to fix for now.
# There are hundreds of instances of unused vars/functions
# throughout the code base.
-Wno-unused-variable
-Wno-unused-function)
endif()
add_definitions(-D__x86_64__ -DOPENCL_MAJOR=2 -DOPENCL_MINOR=1 -DCL_TARGET_OPENCL_VERSION=220 -DATI_OS_LINUX -DATI_ARCH_X86 -DLITTLEENDIAN_CPU -DATI_BITS_64 -DWITH_TARGET_AMDGCN -DOPENCL_EXPORTS -DCL_USE_DEPRECATED_OPENCL_1_0_APIS -DCL_USE_DEPRECATED_OPENCL_1_1_APIS -DCL_USE_DEPRECATED_OPENCL_1_2_APIS -DCL_USE_DEPRECATED_OPENCL_2_0_APIS -DVEGA10_ONLY=false -DWITH_LIGHTNING_COMPILER)
add_definitions(-DOPENCL_C_MAJOR=2 -DOPENCL_C_MINOR=0)