From 3db53b17b34cf1c4fee49fa3a7ff647f56622b94 Mon Sep 17 00:00:00 2001
From: Markus Frank <Markus.Frank@cern.ch>
Date: Tue, 16 Jul 2019 17:30:58 +0200
Subject: [PATCH] Remove clang warnings.

---
 DDDigi/include/DDDigi/DigiAction.h         | 32 +++++++++++++++-------
 DDDigi/include/DDDigi/DigiActionSequence.h | 12 ++------
 DDDigi/include/DDDigi/DigiInputAction.h    | 10 ++-----
 DDDigi/include/DDDigi/DigiKernel.h         |  4 +++
 DDDigi/include/DDDigi/DigiLockedAction.h   | 11 +++-----
 DDDigi/include/DDDigi/DigiSynchronize.h    | 13 ++-------
 6 files changed, 38 insertions(+), 44 deletions(-)

diff --git a/DDDigi/include/DDDigi/DigiAction.h b/DDDigi/include/DDDigi/DigiAction.h
index a279733e9..e85883312 100644
--- a/DDDigi/include/DDDigi/DigiAction.h
+++ b/DDDigi/include/DDDigi/DigiAction.h
@@ -23,6 +23,25 @@
 #include <string>
 #include <cstdarg>
 
+#if defined(G__ROOT) || defined(__CLING__) || defined(__ROOTCLING__)
+#define DDDIGI_DEFINE_ACTION_DEFAULT_CTOR(action)  public: action() = default;
+#else
+#define DDDIGI_DEFINE_ACTION_DEFAULT_CTOR(action)  protected: action() = delete;
+#endif
+
+/// 1) Allow default constructor (necessary for ROOT)
+/// 2) Inhibit move constructor
+/// 3) Inhibit copy constructor
+/// 4) Inhibit move operator
+/// 5) Inhibit assignment operator
+#define DDDIGI_DEFINE_ACTION_CONSTRUCTORS(action)  \
+  DDDIGI_DEFINE_ACTION_DEFAULT_CTOR(action)        \
+  protected:                                       \
+  action(action&& copy) = delete;                  \
+  action(const action& copy) = delete;             \
+  action& operator=(action&& copy) = delete;       \
+  action& operator=(const action& copy) = delete
+
 /// Namespace for the AIDA detector description toolkit
 namespace dd4hep {
 
@@ -207,16 +226,9 @@ namespace dd4hep {
       };
 
     protected:
-      /// Inhibit default constructor
-      DigiAction() = delete;
-      /// Inhibit copy constructor
-      DigiAction(const DigiAction& copy) = delete;
-      /// Inhibit move constructor
-      DigiAction(DigiAction&& copy) = delete;
-      /// Inhibit assignment operator
-      DigiAction& operator=(const DigiAction& copy) = delete;
-      /// Inhibit assignment operator
-      DigiAction& operator=(DigiAction&& copy) = delete;
+
+      /// Define standard assignments and constructors
+      DDDIGI_DEFINE_ACTION_CONSTRUCTORS(DigiAction);
 
       /// Default destructor
       virtual ~DigiAction();
diff --git a/DDDigi/include/DDDigi/DigiActionSequence.h b/DDDigi/include/DDDigi/DigiActionSequence.h
index 836405833..ce27fbc0a 100644
--- a/DDDigi/include/DDDigi/DigiActionSequence.h
+++ b/DDDigi/include/DDDigi/DigiActionSequence.h
@@ -48,16 +48,8 @@ namespace dd4hep {
       CallbackSequence   m_end;
 
     protected:
-      /// Inhibit public use of default constructor
-      DigiActionSequence() = delete;
-      /// Inhibit move constructor
-      DigiActionSequence(DigiActionSequence&& copy) = delete;
-      /// Inhibit copy constructor
-      DigiActionSequence(const DigiActionSequence& copy) = delete;
-      /// Inhibit move operator
-      DigiActionSequence& operator=(DigiActionSequence&& copy) = delete;
-      /// Inhibit assignment operator
-      DigiActionSequence& operator=(const DigiActionSequence& copy) = delete;
+      /// Define standard assignments and constructors
+      DDDIGI_DEFINE_ACTION_CONSTRUCTORS(DigiActionSequence);
 
     public:
       /// Standard constructor
diff --git a/DDDigi/include/DDDigi/DigiInputAction.h b/DDDigi/include/DDDigi/DigiInputAction.h
index b37a9cb60..5ed83e10f 100644
--- a/DDDigi/include/DDDigi/DigiInputAction.h
+++ b/DDDigi/include/DDDigi/DigiInputAction.h
@@ -35,15 +35,11 @@ namespace dd4hep {
      */
     class DigiInputAction : public DigiAction {
     protected:
+      /// Input data specification
       std::vector<std::string> m_input;
-      
     protected:
-      /// Inhibit copy constructor
-      DigiInputAction() = delete;
-      /// Inhibit copy constructor
-      DigiInputAction(const DigiInputAction& copy) = delete;
-      /// Inhibit assignment operator
-      DigiInputAction& operator=(const DigiInputAction& copy) = delete;
+      /// Define standard assignments and constructors
+      DDDIGI_DEFINE_ACTION_CONSTRUCTORS(DigiInputAction);
 
     public:
       /// Standard constructor
diff --git a/DDDigi/include/DDDigi/DigiKernel.h b/DDDigi/include/DDDigi/DigiKernel.h
index e6f265843..f652aa2e6 100644
--- a/DDDigi/include/DDDigi/DigiKernel.h
+++ b/DDDigi/include/DDDigi/DigiKernel.h
@@ -65,6 +65,10 @@ namespace dd4hep {
       /// Notify kernel that the execution of one single event finished
       void notify(DigiContext* context, const std::exception& e);
       
+    protected:
+      /// Define standard assignments and constructors
+      DDDIGI_DEFINE_ACTION_CONSTRUCTORS(DigiKernel);
+
     public:
       /// Standard constructor for the master instance
       DigiKernel(Detector& description);
diff --git a/DDDigi/include/DDDigi/DigiLockedAction.h b/DDDigi/include/DDDigi/DigiLockedAction.h
index 4d4c97e5d..c38ca7231 100644
--- a/DDDigi/include/DDDigi/DigiLockedAction.h
+++ b/DDDigi/include/DDDigi/DigiLockedAction.h
@@ -42,14 +42,11 @@ namespace dd4hep {
       std::mutex  m_lock;
       /// Reference to underlying action
       DigiAction* m_action = 0;
-    protected:
-      /// Inhibit copy constructor
-      DigiLockedAction() = delete;
-      /// Inhibit copy constructor
-      DigiLockedAction(const DigiLockedAction& copy) = delete;
-      /// Inhibit assignment operator
-      DigiLockedAction& operator=(const DigiLockedAction& copy) = delete;
 
+    protected:
+      /// Define standard assignments and constructors
+      DDDIGI_DEFINE_ACTION_CONSTRUCTORS(DigiLockedAction);
+      
     public:
       /// Standard constructor
       DigiLockedAction(const DigiKernel& kernel, const std::string& nam);
diff --git a/DDDigi/include/DDDigi/DigiSynchronize.h b/DDDigi/include/DDDigi/DigiSynchronize.h
index c7f4bee0b..eb76a1e22 100644
--- a/DDDigi/include/DDDigi/DigiSynchronize.h
+++ b/DDDigi/include/DDDigi/DigiSynchronize.h
@@ -36,16 +36,9 @@ namespace dd4hep {
       /// The list of action objects to be called
       Actors<DigiAction> m_actors;
 
-      /// Inhibit public use of default constructor
-      DigiSynchronize() = default;
-      /// Inhibit move constructor
-      DigiSynchronize(DigiSynchronize&& copy) = delete;
-      /// Inhibit copy constructor
-      DigiSynchronize(const DigiSynchronize& copy) = delete;
-      /// Inhibit move operator
-      DigiSynchronize& operator=(DigiSynchronize&& copy) = delete;
-      /// Inhibit assignment operator
-      DigiSynchronize& operator=(const DigiSynchronize& copy) = delete;
+    protected:
+      /// Define standard assignments and constructors
+      DDDIGI_DEFINE_ACTION_CONSTRUCTORS(DigiSynchronize);
 
     public:
       /// Standard constructor
-- 
GitLab