From b0c4ca9e088cbff5a5dbc5e95486397041a51d4a Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Wed, 11 Aug 2021 20:55:14 +0100 Subject: make --with-idlc-cpp=cpp work for gcc cpp as a ucpp replacement MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit e.g. the example of https://bugs.launchpad.net/ubuntu/+source/libreoffice/+bug/1524638 has the same output .urd using cpp with these flags as ucpp created Change-Id: Iadfd2deba7d365c66c3260fd6736c031987e107c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120347 Tested-by: Jenkins Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara --- idlc/Executable_idlc.mk | 8 ++++++++ idlc/source/idlccompile.cxx | 8 ++++++++ 2 files changed, 16 insertions(+) (limited to 'idlc') diff --git a/idlc/Executable_idlc.mk b/idlc/Executable_idlc.mk index e194e9049c77..f2f79dcb8911 100644 --- a/idlc/Executable_idlc.mk +++ b/idlc/Executable_idlc.mk @@ -35,10 +35,18 @@ $(eval $(call gb_Executable_add_scanners,idlc,\ )) ifneq (,$(SYSTEM_UCPP)) + $(eval $(call gb_Executable_add_defs,idlc,\ -DSYSTEM_UCPP \ -DUCPP=\"file://$(SYSTEM_UCPP)\" \ )) + +ifneq ($(SYSTEM_UCPP_IS_GCC),) +$(eval $(call gb_Executable_add_defs,idlc,\ + -DSYSTEM_UCPP_IS_GCC \ +)) +endif + endif $(eval $(call gb_Executable_add_exception_objects,idlc,\ diff --git a/idlc/source/idlccompile.cxx b/idlc/source/idlccompile.cxx index bf3325d6821a..1902d63e0cad 100644 --- a/idlc/source/idlccompile.cxx +++ b/idlc/source/idlccompile.cxx @@ -237,7 +237,15 @@ sal_Int32 compileFile(const OString * pathname) ::std::vector< OUString> lCppArgs; lCppArgs.emplace_back("-DIDL"); lCppArgs.emplace_back("-C"); +#ifdef SYSTEM_UCPP_IS_GCC + // -nostdinc Do not search the standard system directories for header files + lCppArgs.emplace_back("-nostdinc"); + // with gcc cpp, even when not explicitly including anything, /usr/include/stdc-predef.h + // gets inserted without -nostdinc +#else + // -zI Do not use the standard (compile-time) include path. lCppArgs.emplace_back("-zI"); +#endif Options* pOptions = idlc()->getOptions(); -- cgit