From 8f6398555e001ff8afd55a8c8d72ad5374f30982 Mon Sep 17 00:00:00 2001 From: "Seth R. Johnson" Date: Wed, 8 Jan 2025 16:16:23 -0500 Subject: [PATCH] Fix unnecessary use of inline constexpr (#1568) --- src/accel/SetupOptionsMessenger.cc | 8 ++++---- src/celeritas/field/FieldDriverOptions.hh | 6 +++--- src/celeritas/io/ImportMaterial.hh | 4 +--- src/celeritas/io/ImportVolume.hh | 4 +--- src/celeritas/track/StatusCheckData.hh | 3 +-- src/celeritas/user/RootStepWriter.hh | 4 ++-- src/corecel/cont/InitializedValue.hh | 2 +- src/corecel/data/Collection.hh | 4 ++-- src/corecel/math/BisectionRootFinder.hh | 2 +- src/corecel/math/IllinoisRootFinder.hh | 2 +- src/corecel/math/RegulaFalsiRootFinder.hh | 2 +- src/corecel/sys/TracingSession.hh | 2 +- src/geocel/GeoTraits.hh | 8 ++++---- src/geocel/g4/GeantGeoTraits.hh | 4 ++-- src/geocel/vg/VecgeomGeoTraits.hh | 4 ++-- src/orange/OrangeData.hh | 4 ++-- src/orange/OrangeGeoTraits.hh | 4 ++-- test/orange/surf/FaceNamer.test.cc | 4 ++-- 18 files changed, 33 insertions(+), 38 deletions(-) diff --git a/src/accel/SetupOptionsMessenger.cc b/src/accel/SetupOptionsMessenger.cc index 4c2be65b86..535c58d0bc 100644 --- a/src/accel/SetupOptionsMessenger.cc +++ b/src/accel/SetupOptionsMessenger.cc @@ -28,7 +28,7 @@ struct UICommandTraits; template<> struct UICommandTraits { - static inline constexpr char type_info = 's'; + static constexpr char type_info = 's'; static std::string const& to_string(G4String const& v) { return v; } static std::string from_string(G4String const& v) { return v; } }; @@ -36,7 +36,7 @@ struct UICommandTraits template<> struct UICommandTraits { - static inline constexpr char type_info = 'b'; + static constexpr char type_info = 'b'; static G4String to_string(bool v) { return G4UIcommand::ConvertToString(v); @@ -50,7 +50,7 @@ struct UICommandTraits template struct UICommandTraits>> { - static inline constexpr char type_info = 'i'; + static constexpr char type_info = 'i'; static std::string to_string(T v) { return std::to_string(v); } static long from_string(G4String const& v) { @@ -69,7 +69,7 @@ struct UICommandTraits>> template<> struct UICommandTraits { - static inline constexpr char type_info = 'd'; + static constexpr char type_info = 'd'; static G4String to_string(double v) { return G4UIcommand::ConvertToString(v); diff --git a/src/celeritas/field/FieldDriverOptions.hh b/src/celeritas/field/FieldDriverOptions.hh index 46bdd91b25..6ecaa89fb5 100644 --- a/src/celeritas/field/FieldDriverOptions.hh +++ b/src/celeritas/field/FieldDriverOptions.hh @@ -64,13 +64,13 @@ struct FieldDriverOptions short int max_substeps = 10; //! Initial step tolerance - static constexpr inline real_type initial_step_tol = 1e-6; + static constexpr real_type initial_step_tol = 1e-6; //! Chord distance fudge factor - static constexpr inline real_type dchord_tol = 1e-5 * units::millimeter; + static constexpr real_type dchord_tol = 1e-5 * units::millimeter; //! Lowest allowable scaling factor when searching for a chord - static constexpr inline real_type min_chord_shrink = 0.5; + static constexpr real_type min_chord_shrink = 0.5; //! Whether all data are assigned and valid explicit CELER_FUNCTION operator bool() const diff --git a/src/celeritas/io/ImportMaterial.hh b/src/celeritas/io/ImportMaterial.hh index bd313e8724..3ec2f4ec38 100644 --- a/src/celeritas/io/ImportMaterial.hh +++ b/src/celeritas/io/ImportMaterial.hh @@ -96,9 +96,7 @@ struct ImportPhysMaterial using MapIntCutoff = std::map; //!@} -#ifndef SWIG - static inline constexpr Index unspecified = -1; -#endif + static constexpr Index unspecified = -1; Index geo_material_id{}; //!< Index in geo_materials list Index optical_material_id{unspecified}; //!< Optional index in optical mat diff --git a/src/celeritas/io/ImportVolume.hh b/src/celeritas/io/ImportVolume.hh index 4942adb819..8d75d36f47 100644 --- a/src/celeritas/io/ImportVolume.hh +++ b/src/celeritas/io/ImportVolume.hh @@ -39,9 +39,7 @@ struct ImportVolume using Index = unsigned int; //!@} -#ifndef SWIG - static inline constexpr Index unspecified = -1; -#endif + static constexpr Index unspecified = -1; Index geo_material_id{unspecified}; //!< Material defined by geometry Index region_id{unspecified}; //!< Optional region associated diff --git a/src/celeritas/track/StatusCheckData.hh b/src/celeritas/track/StatusCheckData.hh index c4ec9ba762..5048725ff8 100644 --- a/src/celeritas/track/StatusCheckData.hh +++ b/src/celeritas/track/StatusCheckData.hh @@ -24,8 +24,7 @@ struct StatusCheckParamsData celeritas::Collection orders; - static inline constexpr StepActionOrder implicit_order - = StepActionOrder::size_; + static constexpr StepActionOrder implicit_order = StepActionOrder::size_; //// METHODS //// diff --git a/src/celeritas/user/RootStepWriter.hh b/src/celeritas/user/RootStepWriter.hh index ed6f390301..8f657a8aa1 100644 --- a/src/celeritas/user/RootStepWriter.hh +++ b/src/celeritas/user/RootStepWriter.hh @@ -27,7 +27,7 @@ class RootFileManager; //! Input to \c make_write_filter (below) for filtering ROOT MC truth output struct SimpleRootFilterInput { - static inline constexpr size_type unspecified{static_cast(-1)}; + static constexpr size_type unspecified{static_cast(-1)}; std::vector track_id; size_type event_id = unspecified; @@ -58,7 +58,7 @@ class RootStepWriter final : public StepInterface { public: // Unspecified step attribute data value - static inline constexpr size_type unspecified{static_cast(-1)}; + static constexpr size_type unspecified{static_cast(-1)}; //! Truth step point data; Naming convention must match StepPointStateData struct TStepPoint diff --git a/src/corecel/cont/InitializedValue.hh b/src/corecel/cont/InitializedValue.hh index 37d3f2b53a..e1639a3a20 100644 --- a/src/corecel/cont/InitializedValue.hh +++ b/src/corecel/cont/InitializedValue.hh @@ -37,7 +37,7 @@ template> class InitializedValue { private: - static inline constexpr bool ne_finalize_ + static constexpr bool ne_finalize_ = noexcept(std::declval()(std::declval())); public: diff --git a/src/corecel/data/Collection.hh b/src/corecel/data/Collection.hh index f69584d615..63855bebd9 100644 --- a/src/corecel/data/Collection.hh +++ b/src/corecel/data/Collection.hh @@ -266,8 +266,8 @@ class Collection using AllItemsT = AllItems; //!@} - static constexpr inline Ownership ownership = W; - static constexpr inline MemSpace memspace = M; + static constexpr Ownership ownership = W; + static constexpr MemSpace memspace = M; public: //// CONSTRUCTION //// diff --git a/src/corecel/math/BisectionRootFinder.hh b/src/corecel/math/BisectionRootFinder.hh index 459c23942a..d5e326a260 100644 --- a/src/corecel/math/BisectionRootFinder.hh +++ b/src/corecel/math/BisectionRootFinder.hh @@ -48,7 +48,7 @@ class BisectionRootFinder real_type tol_; // Maximum amount of iterations - static constexpr inline int max_iters_ = 50; + static constexpr int max_iters_ = 50; }; //---------------------------------------------------------------------------// diff --git a/src/corecel/math/IllinoisRootFinder.hh b/src/corecel/math/IllinoisRootFinder.hh index 1c69c9641f..b7dd6f7857 100644 --- a/src/corecel/math/IllinoisRootFinder.hh +++ b/src/corecel/math/IllinoisRootFinder.hh @@ -43,7 +43,7 @@ class IllinoisRootFinder real_type tol_; // Maximum amount of iterations - static constexpr inline int max_iters_ = 50; + static constexpr int max_iters_ = 50; }; //---------------------------------------------------------------------------// diff --git a/src/corecel/math/RegulaFalsiRootFinder.hh b/src/corecel/math/RegulaFalsiRootFinder.hh index 44c79164d7..9b5f4d62bc 100644 --- a/src/corecel/math/RegulaFalsiRootFinder.hh +++ b/src/corecel/math/RegulaFalsiRootFinder.hh @@ -49,7 +49,7 @@ class RegulaFalsiRootFinder real_type tol_; // Maximum amount of iterations - static constexpr inline int max_iters_ = 50; + static constexpr int max_iters_ = 50; }; //---------------------------------------------------------------------------// diff --git a/src/corecel/sys/TracingSession.hh b/src/corecel/sys/TracingSession.hh index bb53710870..1d6ddb0bb8 100644 --- a/src/corecel/sys/TracingSession.hh +++ b/src/corecel/sys/TracingSession.hh @@ -60,7 +60,7 @@ class TracingSession CELER_DELETE_COPY_MOVE(TracingSession); private: - static inline constexpr int system_fd_{-1}; + static constexpr int system_fd_{-1}; struct Deleter { void operator()(perfetto::TracingSession*); diff --git a/src/geocel/GeoTraits.hh b/src/geocel/GeoTraits.hh index 04a2ad04e9..86097de5a5 100644 --- a/src/geocel/GeoTraits.hh +++ b/src/geocel/GeoTraits.hh @@ -42,10 +42,10 @@ struct GeoTraits using TrackView = void; //! Descriptive name for the geometry - static constexpr inline char const* name = nullptr; + static constexpr char const* name = nullptr; //! TO BE REMOVED: "native" file extension for this geometry - static constexpr inline char const* ext = nullptr; + static constexpr char const* ext = nullptr; }; //---------------------------------------------------------------------------// @@ -68,8 +68,8 @@ struct NotConfiguredGeoTraits template using StateData = void; using TrackView = void; - static constexpr inline char const* name = nullptr; - static constexpr inline char const* ext = nullptr; + static constexpr char const* name = nullptr; + static constexpr char const* ext = nullptr; }; //---------------------------------------------------------------------------// diff --git a/src/geocel/g4/GeantGeoTraits.hh b/src/geocel/g4/GeantGeoTraits.hh index ad51c1eb5f..c442cef4f0 100644 --- a/src/geocel/g4/GeantGeoTraits.hh +++ b/src/geocel/g4/GeantGeoTraits.hh @@ -40,10 +40,10 @@ struct GeoTraits using TrackView = GeantGeoTrackView; //! Descriptive name for the geometry - static constexpr inline char const* name = "Geant4"; + static constexpr char const* name = "Geant4"; //! TO BE REMOVED: "native" file extension for this geometry - static constexpr inline char const* ext = ".gdml"; + static constexpr char const* ext = ".gdml"; }; #else //! Geant4 is unavailable diff --git a/src/geocel/vg/VecgeomGeoTraits.hh b/src/geocel/vg/VecgeomGeoTraits.hh index 50b43a30c8..662a288f5b 100644 --- a/src/geocel/vg/VecgeomGeoTraits.hh +++ b/src/geocel/vg/VecgeomGeoTraits.hh @@ -40,10 +40,10 @@ struct GeoTraits using TrackView = VecgeomTrackView; //! Descriptive name for the geometry - static constexpr inline char const* name = "VecGeom"; + static constexpr char const* name = "VecGeom"; //! TO BE REMOVED: "native" file extension for this geometry - static constexpr inline char const* ext = ".gdml"; + static constexpr char const* ext = ".gdml"; }; #else //! VecGeom is unavailable diff --git a/src/orange/OrangeData.hh b/src/orange/OrangeData.hh index 278b1501a0..b200ef8c30 100644 --- a/src/orange/OrangeData.hh +++ b/src/orange/OrangeData.hh @@ -28,10 +28,10 @@ namespace celeritas //---------------------------------------------------------------------------// //! Local ID of exterior volume for unit-type universes -static inline constexpr LocalVolumeId orange_exterior_volume{0}; +inline constexpr LocalVolumeId orange_exterior_volume{0}; //! ID of the top-level (global/world, level=0) universe (scene) -static inline constexpr UniverseId orange_global_universe{0}; +inline constexpr UniverseId orange_global_universe{0}; //---------------------------------------------------------------------------// /*! diff --git a/src/orange/OrangeGeoTraits.hh b/src/orange/OrangeGeoTraits.hh index 9fdccb5cfa..dcccc5bee5 100644 --- a/src/orange/OrangeGeoTraits.hh +++ b/src/orange/OrangeGeoTraits.hh @@ -37,10 +37,10 @@ struct GeoTraits using TrackView = OrangeTrackView; //! Descriptive name for the geometry - static constexpr inline char const* name = "ORANGE"; + static constexpr char const* name = "ORANGE"; //! TO BE REMOVED: "native" file extension for this geometry - static constexpr inline char const* ext = ".org.json"; + static constexpr char const* ext = ".org.json"; }; //---------------------------------------------------------------------------// diff --git a/test/orange/surf/FaceNamer.test.cc b/test/orange/surf/FaceNamer.test.cc index 216aee4ebc..9deb5ecabe 100644 --- a/test/orange/surf/FaceNamer.test.cc +++ b/test/orange/surf/FaceNamer.test.cc @@ -20,8 +20,8 @@ namespace test class FaceNamerTest : public ::celeritas::test::Test { protected: - static inline constexpr auto in = Sense::inside; - static inline constexpr auto out = Sense::outside; + static constexpr auto in = Sense::inside; + static constexpr auto out = Sense::outside; }; TEST_F(FaceNamerTest, typed)