From 0e09032c40f62cf5030035d6400941e7a44a9f21 Mon Sep 17 00:00:00 2001 From: Enric Tejedor Saavedra <enric.tejedor.saavedra@cern.ch> Date: Thu, 23 May 2019 11:31:02 +0200 Subject: [PATCH] [Exp PyROOT] Disable strict-aliasing warnings The warnings are triggered by the use of the Py_RETURN_TRUE and Py_RETURN_FALSE macros of the Python C API. The use of such macros is necessary and cannot be worked around. The option is disabled on Windows since it does not exist. --- bindings/pyroot_experimental/PyROOT/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bindings/pyroot_experimental/PyROOT/CMakeLists.txt b/bindings/pyroot_experimental/PyROOT/CMakeLists.txt index e62b87c76ff..39e648c73c4 100644 --- a/bindings/pyroot_experimental/PyROOT/CMakeLists.txt +++ b/bindings/pyroot_experimental/PyROOT/CMakeLists.txt @@ -62,6 +62,11 @@ endforeach() ROOT_LINKER_LIBRARY(ROOTPython ${sources} LIBRARIES Core Tree cppyy) ROOT_INSTALL_HEADERS(inc) +# Disables warnings caused by Py_RETURN_TRUE/Py_RETURN_FALSE +if(NOT MSVC) + target_compile_options(ROOTPython PRIVATE -Wno-strict-aliasing) +endif() + # Disables warnings originating from deprecated register keyword in Python if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND CMAKE_CXX_STANDARD GREATER_EQUAL 11) target_compile_options(ROOTPython PRIVATE -Wno-register) -- GitLab