office-gobmx/solenv/gbuild/CompilerTest.mk
Stephan Bergmann c6db02a2af Extend loplugin:stringview to OUStringBuffer::copy
(Somewhat oddly, there is no OStringBuffer::copy counterpart.)

This required some modification to StringView::VisitCXXConstructExpr to avoid

> In file included from odk/qa/checkapi/checkapi.cxx:29:
> In file included from workdir/CustomTarget/odk/allheaders/allheaders.hxx:351:
> In file included from instdir/sdk/include/rtl/math.hxx:31:
> instdir/sdk/include/rtl/ustrbuf.hxx:1687:16: error: rather than copy, pass with a view using subView() [loplugin:stringview]
>         return copy( beginIndex, getLength() - beginIndex );
>                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

while building CppunitTest_odk_checkapi as external C++03 code, where the
returned value is wrapped in a CXXConstructExpr.  And testing for that case
required a new CompilerTest_compilerplugins_clang-c++03 that uses gb_CXX03FLAGS
and needs to not set LIBO_INTERNAL_ONLY (via gb_CompilerTest_set_external_code),
as compiling as C++03 would otherwise generate lots of errors like unknown
char16_t at include/sal/types.h:118.  (There was a choice whether to name the
new test "-c++03" or "-external", but the issue it tests is caused more by the
code being compiled with C++03 than by this being external code, see above.)

Change-Id: I873a9c5a70d3ea949cf13a169d46920b71282712
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130036
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-02-16 22:45:42 +01:00

53 lines
3.1 KiB
Makefile

# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t; fill-column: 100 -*-
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
define gb_CompilerTest_CompilerTest
$(call gb_CompilerTest__CompilerTest_impl,$(1),$(call gb_CompilerTest_get_linktarget,$(1)))
endef
# call gb_CompilerTest__CompilerTest_impl,compilertest,linktarget
define gb_CompilerTest__CompilerTest_impl
$(call gb_LinkTarget_LinkTarget,$(2),CompilerTest_$(1),NONE)
$(call gb_LinkTarget_set_targettype,$(2),CompilerTest)
$(call gb_LinkTarget_get_target,$(2)): COMPILER_TEST := $(true)
$(call gb_LinkTarget_get_target,$(2)): ENABLE_WERROR := $(true)
$(call gb_CompilerTest_get_target,$(1)): $(call gb_LinkTarget_get_target,$(2))
$(call gb_CompilerTest_get_clean_target,$(1)): $(call gb_LinkTarget_get_clean_target,$(2))
$$(eval $$(call gb_Module_register_target,$(call gb_CompilerTest_get_target,$(1)),$(call gb_CompilerTest_get_clean_target,$(1))))
$(call gb_Helper_make_userfriendly_targets,$(1),CompilerTest)
endef
# forward the call to the gb_LinkTarget implementation
# (note: because the function name is in $(1), the other args are shifted by 1)
define gb_CompilerTest__forward_to_Linktarget
$(call gb_LinkTarget_$(subst gb_CompilerTest_,,$(1)),$(call gb_CompilerTest_get_linktarget,$(2)),$(3),$(4),CompilerTest_$(2))
endef
# copy pasta for forwarding: this could be (and was) done more elegantly, but
# these here can be found by both git grep and ctags
gb_CompilerTest_add_cobject = $(call gb_CompilerTest__forward_to_Linktarget,$(0),$(1),$(2),$(3))
gb_CompilerTest_add_cobjects = $(call gb_CompilerTest__forward_to_Linktarget,$(0),$(1),$(2),$(3))
gb_CompilerTest_add_cxxobject = $(call gb_CompilerTest__forward_to_Linktarget,$(0),$(1),$(2),$(3))
gb_CompilerTest_add_cxxobjects = $(call gb_CompilerTest__forward_to_Linktarget,$(0),$(1),$(2),$(3))
gb_CompilerTest_add_exception_objects = $(call gb_CompilerTest__forward_to_Linktarget,$(0),$(1),$(2),$(3))
gb_CompilerTest_add_objcobject = $(call gb_CompilerTest__forward_to_Linktarget,$(0),$(1),$(2),$(3))
gb_CompilerTest_add_objcobjects = $(call gb_CompilerTest__forward_to_Linktarget,$(0),$(1),$(2),$(3))
gb_CompilerTest_add_objcxxobject = $(call gb_CompilerTest__forward_to_Linktarget,$(0),$(1),$(2),$(3))
gb_CompilerTest_add_objcxxobjects = $(call gb_CompilerTest__forward_to_Linktarget,$(0),$(1),$(2),$(3))
gb_CompilerTest_add_cxxclrobject = $(call gb_CompilerTest__forward_to_Linktarget,$(0),$(1),$(2),$(3))
gb_CompilerTest_add_cxxclrobjects = $(call gb_CompilerTest__forward_to_Linktarget,$(0),$(1),$(2),$(3))
gb_CompilerTest_add_cxxflags = $(call gb_CompilerTest__forward_to_Linktarget,$(0),$(1),$(2),$(3))
gb_CompilerTest_set_external_code = $(call gb_CompilerTest__forward_to_Linktarget,$(0),$(1),$(2),$(3))
gb_CompilerTest_use_externals = $(call gb_CompilerTest__forward_to_Linktarget,$(0),$(1),$(2),$(3))
gb_CompilerTest_use_udk_api = $(call gb_CompilerTest__forward_to_Linktarget,$(0),$(1),$(2),$(3))
# vim: set noet sw=4 ts=4: