From ae82afcac3986b62049c87fe3e96e2af790f75f8 Mon Sep 17 00:00:00 2001 From: Markus Frank <Markus.Frank@cern.ch> Date: Thu, 3 Oct 2019 17:37:35 +0200 Subject: [PATCH] Inhibit not allowed use of DetectorImp.h --- DDCore/CMakeLists.txt | 1 + DDCore/include/DD4hep/DetectorImp.h | 15 ++++++++++++++- DDCore/src/DetectorImp.cpp | 2 ++ DDCore/src/plugins/StandardPlugins.cpp | 1 + 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/DDCore/CMakeLists.txt b/DDCore/CMakeLists.txt index 4078194af..8c08055ae 100644 --- a/DDCore/CMakeLists.txt +++ b/DDCore/CMakeLists.txt @@ -31,6 +31,7 @@ dd4hep_add_dictionary( G__DD4hep include/XML/tinystring.h LINKDEF include/ROOT/LinkDef.h USES DDParsers ${XML_LIBRARIES} + DEFINITIONS DD4HEP_MUST_USE_DETECTORIMP_H ) dd4hep_add_dictionary( G__DD4hepGeo diff --git a/DDCore/include/DD4hep/DetectorImp.h b/DDCore/include/DD4hep/DetectorImp.h index 441f30a60..c0c462e94 100644 --- a/DDCore/include/DD4hep/DetectorImp.h +++ b/DDCore/include/DD4hep/DetectorImp.h @@ -10,10 +10,23 @@ // Author : M.Frank // //========================================================================== - #ifndef DD4HEP_DetectorGEOIMP_H #define DD4HEP_DetectorGEOIMP_H +//========================================================================== +// +// Please note: +// +// This header file is purely DD4hep internal. It should never be used +// independently outside DetectorImp.cpp and certain DD4hep specific plugins. +// This header files is only publicly present to satisfy the ROOT interpreter +// when loading precompiled dictionary libraries. +// +//========================================================================== +#if !defined(DD4HEP_MUST_USE_DETECTORIMP_H) && !defined(G__ROOT) +#error "DetectorImp.h is a dd4hep internal header. Never use it in a depending compilation unit!" +#endif + // Framework include files #include "DD4hep/DetectorData.h" #include "DD4hep/DetectorLoad.h" diff --git a/DDCore/src/DetectorImp.cpp b/DDCore/src/DetectorImp.cpp index f89d06c39..663782df7 100644 --- a/DDCore/src/DetectorImp.cpp +++ b/DDCore/src/DetectorImp.cpp @@ -11,6 +11,8 @@ // //========================================================================== +#define DD4HEP_MUST_USE_DETECTORIMP_H 1 + // Framework include files #include "DD4hep/Plugins.h" #include "DD4hep/Printout.h" diff --git a/DDCore/src/plugins/StandardPlugins.cpp b/DDCore/src/plugins/StandardPlugins.cpp index eb81f8cbe..4c8d3aa4c 100644 --- a/DDCore/src/plugins/StandardPlugins.cpp +++ b/DDCore/src/plugins/StandardPlugins.cpp @@ -12,6 +12,7 @@ //========================================================================== // Framework include files +#define DD4HEP_MUST_USE_DETECTORIMP_H #include "DD4hep/Detector.h" #include "DD4hep/DetectorImp.h" #include "DD4hep/Memory.h" -- GitLab