Introduce gb_*_set_external_code

...to harmonize the mechanisms to not define LIBO_INTERNAL_ONLY for extension
code and CppunitTest_odk_checkapi.  (It also needs to revert any -Wundef, as the
config_host/config_*.h files will not be included, so the HAVE_* macros will be
undefined.)

This obsoletes the need for RTL_DISABLE_FAST_STRING.

Change-Id: If5eacba80c349efb90762aade8f2ea6d2db7e314
This commit is contained in:
Stephan Bergmann 2014-12-18 16:34:46 +01:00
parent 1cd9420755
commit 86ba184394
15 changed files with 38 additions and 16 deletions

View file

@ -13,6 +13,8 @@ $(eval $(call gb_Library_add_exception_objects,active_native, \
desktop/test/deployment/active/active_native \
))
$(eval $(call gb_Library_set_external_code,active_native))
$(eval $(call gb_Library_use_externals,active_native, \
boost_headers \
))

View file

@ -15,6 +15,8 @@ $(eval $(call gb_Library_add_exception_objects,passive_native, \
$(eval $(call gb_Library_set_componentfile,passive_native,desktop/test/deployment/passive/passive_native))
$(eval $(call gb_Library_set_external_code,passive_native))
$(eval $(call gb_Library_use_externals,passive_native, \
boost_headers \
))

View file

@ -32,6 +32,8 @@ $(eval $(call gb_Library_use_externals,mysqlcppconn,\
endif
endif
$(eval $(call gb_Library_set_external_code,mysqlcppconn))
$(eval $(call gb_Library_set_warnings_not_errors,mysqlcppconn))
$(eval $(call gb_Library_set_generated_cxx_suffix,mysqlcppconn,cpp))

View file

@ -13,15 +13,11 @@
#include <sal/config.h>
#include <sal/types.h>
// Manually defining RTL_DISABLE_FAST_STRING allows to force turning fast string concatenation off
// (e.g. for debugging).
#ifndef RTL_DISABLE_FAST_STRING
// This feature is not part of public API and is meant to be used only internally by LibreOffice.
#ifdef LIBO_INTERNAL_ONLY
// Enable fast string concatenation.
#define RTL_FAST_STRING
#endif
#endif
// The unittest uses slightly different code to help check that the proper
// calls are made. The class is put into a different namespace to make

View file

@ -9,8 +9,6 @@
$(eval $(call gb_Library_Library,mysqlc))
$(eval $(call gb_Library_add_cxxflags,mysqlc,-DRTL_DISABLE_FAST_STRING))
$(eval $(call gb_Library_use_externals,mysqlc,\
boost_headers \
mysqlcppconn \
@ -59,4 +57,6 @@ $(eval $(call gb_Library_add_exception_objects,mysqlc,\
$(eval $(call gb_Library_set_componentfile,mysqlc,mysqlc/source/mysqlc))
$(eval $(call gb_Library_set_external_code,mysqlc))
# vim: set noet sw=4 ts=4:

View file

@ -26,7 +26,6 @@ $(eval $(call gb_CppunitTest_use_internal_comprehensive_api,odk_checkapi,\
$(eval $(call gb_CppunitTest_disable_compiler_plugins,odk_checkapi))
$(eval $(call gb_CppunitTest_add_cxxflags,odk_checkapi,\
$(gb_CXXFLAGS_Wundef) \
$(gb_CXX03FLAGS) \
))
@ -38,4 +37,6 @@ $(eval $(call gb_CppunitTest_use_libraries,odk_checkapi,\
$(gb_UWINAPI) \
))
$(eval $(call gb_CppunitTest_set_external_code,odk_checkapi))
# vim: set noet sw=4 ts=4:

View file

@ -8,7 +8,9 @@
*/
// Acts as if building outside of LO.
#undef LIBO_INTERNAL_ONLY
#ifdef LIBO_INTERNAL_ONLY
#error Build system problem, LIBO_INTERNAL_ONLY should not be set here.
#endif
// The whole purpose of this test is to check that public API headers
// build even without RTL_USING (which enables using e.g. rtl::OUString
@ -17,7 +19,7 @@
// for uses of such types.
#ifdef RTL_USING
#error Build system problem, RTL_USING using should not be set here.
#error Build system problem, RTL_USING should not be set here.
#endif
// Additionally, check that public API headers build also with C++03.

View file

@ -385,6 +385,7 @@ $(eval $(foreach method,\
use_custom_headers \
set_visibility_default \
set_warnings_not_errors \
set_external_code \
set_generated_cxx_suffix \
disable_compiler_plugins \
,\

View file

@ -138,6 +138,7 @@ $(eval $(foreach method,\
set_precompiled_header \
add_nativeres \
set_warnings_not_errors \
set_external_code \
set_generated_cxx_suffix \
disable_compiler_plugins \
,\

View file

@ -223,6 +223,7 @@ $(eval $(foreach method,\
set_nativeres \
set_visibility_default \
set_warnings_not_errors \
set_external_code \
set_generated_cxx_suffix \
disable_compiler_plugins \
,\

View file

@ -615,6 +615,7 @@ $(call gb_LinkTarget_get_target,$(1)) : EXTRAOBJECTLISTS :=
$(call gb_LinkTarget_get_target,$(1)) : NATIVERES :=
$(call gb_LinkTarget_get_target,$(1)) : VISIBILITY :=
$(call gb_LinkTarget_get_target,$(1)) : WARNINGS_NOT_ERRORS :=
$(call gb_LinkTarget_get_target,$(1)) : EXTERNAL_CODE :=
$(call gb_LinkTarget_get_target,$(1)) : SOVERSIONSCRIPT :=
$(call gb_LinkTarget_get_target,$(1)) : T_COMPILER_PLUGINS := $$(COMPILER_PLUGINS)
@ -1369,6 +1370,12 @@ $(call gb_LinkTarget_get_target,$(1)) : WARNINGS_NOT_ERRORS := $(true)
endef
# call gb_LinkTarget_set_external_code,linktarget
define gb_LinkTarget_set_external_code
$(call gb_LinkTarget_get_target,$(1)) : EXTERNAL_CODE := $(true)
endef
# Set suffix of C++ files, if different from 'cxx'
#
# This is useful for external libraries.

View file

@ -110,6 +110,7 @@ $(eval $(foreach method,\
add_sdi_headers \
set_precompiled_header \
set_warnings_not_errors \
set_external_code \
set_generated_cxx_suffix \
disable_compiler_plugins \
,\

View file

@ -210,13 +210,6 @@ gb_GLOBALDEFS := \
$(gb_COMPILERDEFS) \
$(gb_CPUDEFS) \
# This is used to detect whether LibreOffice is being built (as opposed to building
# 3rd-party code). Used for tag deprecation for API we want to
# ensure is not used at all externally while we clean
# out our internal usage, for code in sal/ that should be used only internally, etc.
gb_GLOBALDEFS += \
-DLIBO_INTERNAL_ONLY \
ifeq ($(gb_ENABLE_DBGUTIL),$(true))
gb_GLOBALDEFS += -DDBG_UTIL
@ -268,6 +261,13 @@ gb_GLOBALDEFS += \
gb_GLOBALDEFS := $(sort $(gb_GLOBALDEFS))
# This is used to detect whether LibreOffice is being built (as opposed to building
# 3rd-party code). Used for tag deprecation for API we want to
# ensure is not used at all externally while we clean
# out our internal usage, for code in sal/ that should be used only internally, etc.
gb_DEFS_INTERNAL := \
-DLIBO_INTERNAL_ONLY \
include $(GBUILDDIR)/Deliver.mk
$(eval $(call gb_Deliver_init))

View file

@ -54,6 +54,7 @@ $(call gb_Helper_abbreviate_dirs,\
$(if $(WARNINGS_NOT_ERRORS),,$(gb_CFLAGS_WERROR)) \
$(if $(5),$(gb_COMPILER_PLUGINS)) \
$(2) \
$(if $(EXTERNAL_CODE),$(gb_CXXFLAGS_Wundef),$(gb_DEFS_INTERNAL)) \
-c $(3) \
-o $(1) \
$(call gb_cxx_dep_generation_options,$(1),$(4)) \
@ -77,6 +78,7 @@ $(call gb_Helper_abbreviate_dirs,\
$(if $(WARNINGS_NOT_ERRORS),,$(gb_CFLAGS_WERROR)) \
$(gb_COMPILER_PLUGINS) \
$(T_CFLAGS) $(T_CFLAGS_APPEND) \
$(if $(EXTERNAL_CODE),$(gb_CXXFLAGS_Wundef),$(gb_DEFS_INTERNAL)) \
-c $(2) \
-I$(dir $(2)) \
$(INCLUDE) \
@ -93,6 +95,7 @@ $(call gb_Helper_abbreviate_dirs,\
$(if $(WARNINGS_NOT_ERRORS),,$(gb_CFLAGS_WERROR)) \
$(gb_COMPILER_PLUGINS) \
$(T_OBJCFLAGS) $(T_OBJCFLAGS_APPEND) \
$(if $(EXTERNAL_CODE),$(gb_CXXFLAGS_Wundef),$(gb_DEFS_INTERNAL)) \
-c $(2) \
-I$(dir $(2)) \
$(INCLUDE) \
@ -112,6 +115,7 @@ $(call gb_Helper_abbreviate_dirs,\
$(if $(WARNINGS_NOT_ERRORS),,$(gb_CFLAGS_WERROR)) \
$(gb_COMPILER_PLUGINS) \
$(T_CXXFLAGS) $(T_CXXFLAGS_APPEND) \
$(if $(EXTERNAL_CODE),$(gb_CXXFLAGS_Wundef),$(gb_DEFS_INTERNAL)) \
-c $(2) \
-I$(dir $(2)) \
$(INCLUDE) \
@ -128,6 +132,7 @@ $(call gb_Helper_abbreviate_dirs,\
$(if $(WARNINGS_NOT_ERRORS),,$(gb_CFLAGS_WERROR)) \
$(gb_COMPILER_PLUGINS) \
$(T_OBJCXXFLAGS) $(T_OBJCXXFLAGS_APPEND) \
$(if $(EXTERNAL_CODE),$(gb_CXXFLAGS_Wundef),$(gb_DEFS_INTERNAL)) \
-c $(2) \
-I$(dir $(2)) \
$(INCLUDE) \

View file

@ -42,6 +42,7 @@ $(call gb_Helper_abbreviate_dirs,\
$(if $(filter YES,$(CXXOBJECT_X64)), $(CXX_X64_BINARY), \
$(if $(filter %.c,$(3)), $(gb_CC), $(gb_CXX))) \
$(DEFS) \
$(if $(EXTERNAL_CODE),,$(gb_DEFS_INTERNAL)) \
$(gb_LTOFLAGS) \
$(2) \
$(if $(WARNINGS_NOT_ERRORS),,$(gb_CFLAGS_WERROR)) \