From dc8dcbc474f2649f0d68bfcc92611d6e2ecabd73 Mon Sep 17 00:00:00 2001
From: Vassil Vassilev <vvasilev@cern.ch>
Date: Sat, 17 Dec 2016 13:43:48 +0100
Subject: [PATCH] libcpp_string_view.h must only be included through
 RWrap_libcpp_string_view.h

---
 Makefile                                | 2 +-
 cmake/modules/RootNewMacros.cmake       | 2 +-
 core/metautils/inc/libcpp_string_view.h | 4 ++++
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 36029baff88..8a9fcba9be0 100644
--- a/Makefile
+++ b/Makefile
@@ -871,7 +871,7 @@ CXXMODULES_CORE_EXCLUDE := RConversionRuleParser.h TSchemaRuleProcessor.h \
 			   Rtypes.h RtypesCore.h TClassEdit.h TMetaUtils.h \
 			   TSchemaType.h DllImport.h TGenericClassInfo.h \
 			   TSchemaHelper.h ESTLType.h RStringView.h Varargs.h \
-			   RootMetaSelection.h \
+			   RootMetaSelection.h libcpp_string_view.h \
 			   RWrap_libcpp_string_view.h TAtomicCountGcc.h \
 			   TException.h ROOT/TThreadExecutor.hxx TBranchProxyTemplate.h \
 			   TGLIncludes.h TGLWSIncludes.h snprintf.h strlcpy.h
diff --git a/cmake/modules/RootNewMacros.cmake b/cmake/modules/RootNewMacros.cmake
index 0cebb805a23..2ccac9f3dc2 100644
--- a/cmake/modules/RootNewMacros.cmake
+++ b/cmake/modules/RootNewMacros.cmake
@@ -424,7 +424,7 @@ function (ROOT_CXXMODULES_APPEND_TO_MODULEMAP library library_headers)
 			Rtypes.h RtypesCore.h TClassEdit.h TMetaUtils.h
 			TSchemaType.h DllImport.h TGenericClassInfo.h
 			TSchemaHelper.h ESTLType.h RStringView.h Varargs.h
-			RootMetaSelection.h
+			RootMetaSelection.h libcpp_string_view.h
 			RWrap_libcpp_string_view.h TAtomicCountGcc.h
 			TException.h ThreadLocalStorage.h ROOT/TThreadExecutor.hxx
                         TBranchProxyTemplate.h TGLIncludes.h TGLWSIncludes.h
diff --git a/core/metautils/inc/libcpp_string_view.h b/core/metautils/inc/libcpp_string_view.h
index bdd4952ac7c..b024cf5e3b7 100644
--- a/core/metautils/inc/libcpp_string_view.h
+++ b/core/metautils/inc/libcpp_string_view.h
@@ -11,6 +11,10 @@
 #ifndef _LIBCPP_LFTS_STRING_VIEW
 #define _LIBCPP_LFTS_STRING_VIEW
 
+#ifndef RWrap_libcpp_string_view_h
+#error "Do not use libcpp_string_view.h directly. #include \"RWrap_libcpp_string_view.h\" instead."
+#endif // RWrap_libcpp_string_view_h
+
 /*
 string_view synopsis
 
-- 
GitLab