From 6b5a2f151fc245aec3d457e49d19e8df3332b2c1 Mon Sep 17 00:00:00 2001 From: junggjo9 Date: Thu, 26 Oct 2023 22:54:59 +0200 Subject: [PATCH] fix: GeoVisualization - Fix compiler warning that's appearing in Athena (#2585) The athena compiler is throwing a warning if the Visualization library is loaded. ``` /var/lib/jenkins/workspace/CI-MERGE-REQUEST-EL9/main/Tracking/Acts/ActsGeometry/src/SimpleCylinderDetBuilderTool.cxx: In member function 'virtual Acts::Experimental::DetectorComponent ActsTrk::SimpleCylinderDetBuilderTool::construct(const Acts::GeometryContext&) const': /var/lib/jenkins/workspace/CI-MERGE-REQUEST-EL9/main/Tracking/Acts/ActsGeometry/src/SimpleCylinderDetBuilderTool.cxx:35:53: warning: 'static' expression 'Acts::s_viewSensitive' of type 'Acts::ViewConfig' passed to pointer or reference function argument of 'Acts::GeometryView3D::drawDetectorVolume' within function 'virtual Acts::Experimental::DetectorComponent ActsTrk::SimpleCylinderDetBuilderTool::construct(const Acts::GeometryContext&) const'; may not be thread-safe 35 | Acts::GeometryView3D::drawDetectorVolume(helper, *cylinderDetectorVolume, gctx->context()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /var/lib/jenkins/workspace/CI-MERGE-REQUEST-EL9/main/Tracking/Acts/ActsGeometry/src/SimpleCylinderDetBuilderTool.cxx:8: /build/ci-builds/main/Athena/install/AthenaExternals/24.0.15/InstallArea/x86_64-el9-gcc13-opt/include/Acts/Visualization/GeometryView3D.hpp:34:19: note: Declared here: 34 | static ViewConfig s_viewSensitive = ViewConfig({0, 180, 240}); | ^~~~~~~~~~~~~~~ /var/lib/jenkins/workspace/CI-MERGE-REQUEST-EL9/main/Tracking/Acts/ActsGeometry/src/SimpleCylinderDetBuilderTool.cxx:35:53: note: See . 35 | Acts::GeometryView3D::drawDetectorVolume(helper, *cylinderDetectorVolume, gctx->context()); ``` I hope that's fixing the warning. --- Core/include/Acts/Visualization/GeometryView3D.hpp | 10 +++++----- Core/src/Visualization/GeometryView3D.cpp | 10 ++++++++++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Core/include/Acts/Visualization/GeometryView3D.hpp b/Core/include/Acts/Visualization/GeometryView3D.hpp index 22071d3e1c2..3dc9f7256ae 100644 --- a/Core/include/Acts/Visualization/GeometryView3D.hpp +++ b/Core/include/Acts/Visualization/GeometryView3D.hpp @@ -31,11 +31,11 @@ class DetectorVolume; class Portal; } // namespace Experimental -static ViewConfig s_viewSensitive = ViewConfig({0, 180, 240}); -static ViewConfig s_viewPassive = ViewConfig({240, 280, 0}); -static ViewConfig s_viewVolume = ViewConfig({220, 220, 0}); -static ViewConfig s_viewGrid = ViewConfig({220, 0, 0}); -static ViewConfig s_viewLine = ViewConfig({0, 0, 220}); +static const ViewConfig s_viewSensitive; +static const ViewConfig s_viewPassive; +static const ViewConfig s_viewVolume; +static const ViewConfig s_viewGrid; +static const ViewConfig s_viewLine; struct GeometryView3D { /// Helper method to draw Polyhedron objects diff --git a/Core/src/Visualization/GeometryView3D.cpp b/Core/src/Visualization/GeometryView3D.cpp index 92ba990f8ba..78a9260cda6 100644 --- a/Core/src/Visualization/GeometryView3D.cpp +++ b/Core/src/Visualization/GeometryView3D.cpp @@ -64,6 +64,16 @@ std::string getWorkingDirectory() { } // namespace +namespace Acts { +namespace Experimental { +ViewConfig s_viewSensitive = ViewConfig({0, 180, 240}); +ViewConfig s_viewPassive = ViewConfig({240, 280, 0}); +ViewConfig s_viewVolume = ViewConfig({220, 220, 0}); +ViewConfig s_viewGrid = ViewConfig({220, 0, 0}); +ViewConfig s_viewLine = ViewConfig({0, 0, 220}); +} // namespace Experimental +} // namespace Acts + void Acts::GeometryView3D::drawPolyhedron(IVisualization3D& helper, const Polyhedron& polyhedron, const ViewConfig& viewConfig) {