From 54f14bcf3c457f50ccefc0d808f87ee4913c328c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franz=20P=C3=B6schel?= Date: Thu, 9 Nov 2023 14:29:27 +0100 Subject: [PATCH] Some fixes for DatatypeMacros --- include/openPMD/DatatypeMacros.hpp | 10 ++++++---- include/openPMD/backend/Attribute.hpp | 5 ++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/include/openPMD/DatatypeMacros.hpp b/include/openPMD/DatatypeMacros.hpp index aa78879aab..d72e86408f 100644 --- a/include/openPMD/DatatypeMacros.hpp +++ b/include/openPMD/DatatypeMacros.hpp @@ -18,7 +18,11 @@ * and the GNU Lesser General Public License along with openPMD-api. * If not, see . */ -#pragma once + +// sic! +// no #pragma once +// Since the macros can be un-defined with UndefDatatypeMacros.hpp, this header +// may be included multiple times into one translation unit #include #include @@ -89,7 +93,6 @@ using openpmd_array_double_7 = std::array; MACRO(std::complex) \ MACRO(std::complex) \ MACRO(std::string) \ - MACRO(array_double_7) \ MACRO(bool) #define OPENPMD_FOREACH_DATASET_DATATYPE(MACRO) \ @@ -109,5 +112,4 @@ using openpmd_array_double_7 = std::array; MACRO(long double) \ MACRO(std::complex) \ MACRO(std::complex) \ - MACRO(std::complex) \ - MACRO(std::array) + MACRO(std::complex) diff --git a/include/openPMD/backend/Attribute.hpp b/include/openPMD/backend/Attribute.hpp index 6306bcaaf2..58ca5821b2 100644 --- a/include/openPMD/backend/Attribute.hpp +++ b/include/openPMD/backend/Attribute.hpp @@ -21,10 +21,13 @@ #pragma once #include "openPMD/Datatype.hpp" -#include "openPMD/DatatypeMacros.hpp" #include "openPMD/auxiliary/TypeTraits.hpp" #include "openPMD/auxiliary/Variant.hpp" +// comment to prevent clang-format from moving this #include up +// datatype macros may be included and un-included in other headers +#include "openPMD/DatatypeMacros.hpp" + #include #include #include