diff --git a/CMakeLists.txt b/CMakeLists.txt index bcb8ac82a594b..d7521866bf54d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -146,7 +146,7 @@ if(cxxmodules) message(FATAL_ERROR "cxxmodules is not supported by this compiler") endif() - set(ROOT_CXXMODULES_COMMONFLAGS "${ROOT_CXXMODULES_COMMONFLAGS} -fmodules -fmodules-cache-path=${CMAKE_BINARY_DIR}/include/pcms/ -fno-autolink -fdiagnostics-show-note-include-stack") + set(ROOT_CXXMODULES_COMMONFLAGS "${ROOT_CXXMODULES_COMMONFLAGS} -fmodules -fmodules-cache-path=${CMAKE_BINARY_DIR}/include/pcms/ -fno-autolink -fdiagnostics-show-note-include-stack -Wno-module-import-in-extern-c") # FIXME: We should remove this once libc++ supports -fmodules-local-submodule-visibility. if (APPLE) @@ -192,6 +192,7 @@ if(cxxmodules) configure_file(${CMAKE_SOURCE_DIR}/build/unix/modulemap.overlay.yaml.in ${CMAKE_BINARY_DIR}/include/modulemap.overlay.yaml @ONLY) configure_file(${CMAKE_SOURCE_DIR}/build/unix/stl.cppmap ${CMAKE_BINARY_DIR}/include/stl.cppmap) + configure_file(${CMAKE_SOURCE_DIR}/build/unix/libc.modulemap ${CMAKE_BINARY_DIR}/include/libc.modulemap) endif() # These vars are useful when we want to compile things without cxxmodules. diff --git a/build/rmkdepend/mainroot.cxx b/build/rmkdepend/mainroot.cxx index 23df7c1ae4e28..7b05e778ec8e8 100644 --- a/build/rmkdepend/mainroot.cxx +++ b/build/rmkdepend/mainroot.cxx @@ -27,12 +27,10 @@ #include -extern "C" { #if defined(__sun) && defined(__SUNPRO_CC) #include #endif #include "def.h" -} #ifndef WIN32 #include diff --git a/build/unix/libc.modulemap b/build/unix/libc.modulemap new file mode 100644 index 0000000000000..3a7c6a0826e15 --- /dev/null +++ b/build/unix/libc.modulemap @@ -0,0 +1,40 @@ +module "libc" { + export * + module "assert.h" { + export * + header "assert.h" + } + module "ctype.h" { + export * + header "ctype.h" + } + module "errno.h" { + export * + header "errno.h" + } + module "fenv.h" { + export * + header "fenv.h" + } + module "float.h" { + export * + header "float.h" + } + module "inttypes.h" { + export * + header "inttypes.h" + } + + module "xlocale.h" { + export * + header "xlocale.h" + } + module "math.h" { + export * + header "math.h" + } + module "stdio.h" { + export * + header "stdio.h" + } +} diff --git a/build/unix/modulemap.overlay.yaml.in b/build/unix/modulemap.overlay.yaml.in index 619eaa638cd3e..db5eab20c4560 100644 --- a/build/unix/modulemap.overlay.yaml.in +++ b/build/unix/modulemap.overlay.yaml.in @@ -8,6 +8,13 @@ 'external-contents': '@CMAKE_BINARY_DIR@/include/stl.cppmap' } ] + }, + { 'name': '/usr/include/', 'type': 'directory', + 'contents': [ + { 'name': 'module.modulemap', 'type': 'file', + 'external-contents': '@CMAKE_BINARY_DIR@/include/libc.modulemap' + } + ] } ] } diff --git a/graf2d/asimage/src/TASImage.cxx b/graf2d/asimage/src/TASImage.cxx index e7a8ddb2631ea..0b598d5f3324c 100644 --- a/graf2d/asimage/src/TASImage.cxx +++ b/graf2d/asimage/src/TASImage.cxx @@ -94,7 +94,6 @@ ROOT tutorials: `$ROOTSYS/tutorials/image/` #else # include "Windows4root.h" #endif -extern "C" { #ifndef WIN32 #ifdef R__HAS_COCOA # define X_DISPLAY_MISSING 1 @@ -107,6 +106,7 @@ extern "C" { #endif # include # include +extern "C" { # include } diff --git a/graf2d/asimage/src/TASPaletteEditor.cxx b/graf2d/asimage/src/TASPaletteEditor.cxx index dc843a567695e..bfd76ef1ae5cf 100644 --- a/graf2d/asimage/src/TASPaletteEditor.cxx +++ b/graf2d/asimage/src/TASPaletteEditor.cxx @@ -40,7 +40,6 @@ It is called by a pull down menu item of TASImage. #include "Windows4root.h" #endif -extern "C" { #ifndef WIN32 # include #else @@ -48,8 +47,8 @@ extern "C" { # include #endif # include +extern "C" { # include - } diff --git a/graf2d/asimage/src/TASPluginGS.cxx b/graf2d/asimage/src/TASPluginGS.cxx index f925e7cfad976..9f3eb1a74d84a 100644 --- a/graf2d/asimage/src/TASPluginGS.cxx +++ b/graf2d/asimage/src/TASPluginGS.cxx @@ -30,7 +30,6 @@ Allows to read PS/EPS/PDF files via GhostScript # define popen_flags "r" #endif -extern "C" { #ifndef WIN32 # include #else @@ -39,7 +38,6 @@ extern "C" { # define X_DISPLAY_MISSING 1 #endif # include -} ClassImp(TASPluginGS)