Change the shared bridgetest code from static to dynamic library

...so ASan builds do not complain about ODR violations due to multiple instances
of vtable for testtools::bridgetest::CurrentContextChecker after
a53808c0ed "loplugin:dllprivate" removed the
SAL_DLLPRIVATE from class CurrentContextChecker (which apparently /did/ have an
impact with -fvisibility-ms-compat, as used by Linux Clang ASan/UBSan builds).

Change-Id: Ifb1ba1819f7ea989300f4696d44f9599a1436563
This commit is contained in:
Stephan Bergmann 2016-09-14 15:52:04 +02:00
parent 0f6cb25be8
commit 16bbeb5713
9 changed files with 74 additions and 39 deletions

View file

@ -487,6 +487,7 @@ $(eval $(call gb_Helper_register_libraries,PLAINLIBS_NONE, \
test-setupvcl \ test-setupvcl \
testtools_cppobj \ testtools_cppobj \
testtools_bridgetest \ testtools_bridgetest \
testtools_bridgetest-common \
testtools_constructors \ testtools_constructors \
unobootstrapprotector \ unobootstrapprotector \
unoexceptionprotector \ unoexceptionprotector \

View file

@ -0,0 +1,38 @@
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
#
# 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/.
#
$(eval $(call gb_Library_Library,testtools_bridgetest-common))
$(eval $(call gb_Library_add_defs,testtools_bridgetest-common, \
-DLO_DLLIMPLEMENTATION_TESTTOOLS \
))
$(eval $(call gb_Library_use_external,testtools_bridgetest-common,boost_headers))
$(eval $(call gb_Library_use_internal_api,testtools_bridgetest-common,\
bridgetest \
))
$(eval $(call gb_Library_use_libraries,testtools_bridgetest-common, \
cppu \
cppuhelper \
sal \
))
$(eval $(call gb_Library_use_api,testtools_bridgetest-common,\
udkapi \
))
$(eval $(call gb_Library_add_exception_objects,testtools_bridgetest-common,\
testtools/source/bridgetest/currentcontextchecker \
testtools/source/bridgetest/multi \
))
# vim: set noet sw=4 ts=4:

View file

@ -19,16 +19,13 @@ $(eval $(call gb_Library_use_api,testtools_bridgetest,\
udkapi \ udkapi \
)) ))
$(eval $(call gb_Library_use_static_libraries,testtools_bridgetest,\
testtools_bridgetest_s \
))
$(eval $(call gb_Library_use_external,testtools_bridgetest,boost_headers)) $(eval $(call gb_Library_use_external,testtools_bridgetest,boost_headers))
$(eval $(call gb_Library_use_libraries,testtools_bridgetest,\ $(eval $(call gb_Library_use_libraries,testtools_bridgetest,\
cppu \ cppu \
cppuhelper \ cppuhelper \
sal \ sal \
testtools_bridgetest-common \
)) ))
$(eval $(call gb_Library_add_exception_objects,testtools_bridgetest,\ $(eval $(call gb_Library_add_exception_objects,testtools_bridgetest,\

View file

@ -26,14 +26,11 @@ $(eval $(call gb_Library_use_api,testtools_cppobj,\
$(eval $(call gb_Library_use_external,testtools_cppobj,boost_headers)) $(eval $(call gb_Library_use_external,testtools_cppobj,boost_headers))
$(eval $(call gb_Library_use_static_libraries,testtools_cppobj,\
testtools_bridgetest_s \
))
$(eval $(call gb_Library_use_libraries,testtools_cppobj,\ $(eval $(call gb_Library_use_libraries,testtools_cppobj,\
cppu \ cppu \
cppuhelper \ cppuhelper \
sal \ sal \
testtools_bridgetest-common \
)) ))
$(eval $(call gb_Library_add_exception_objects,testtools_cppobj,\ $(eval $(call gb_Library_add_exception_objects,testtools_cppobj,\

View file

@ -15,9 +15,9 @@ $(eval $(call gb_Module_add_targets,testtools,\
CustomTarget_bridgetest \ CustomTarget_bridgetest \
InternalUnoApi_bridgetest \ InternalUnoApi_bridgetest \
InternalUnoApi_performance \ InternalUnoApi_performance \
StaticLibrary_bridgetest \
Library_cppobj \ Library_cppobj \
Library_bridgetest \ Library_bridgetest \
Library_bridgetest-common \
Library_constructors \ Library_constructors \
Rdb_uno_services \ Rdb_uno_services \
)) ))

View file

@ -1,28 +0,0 @@
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
#
# 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/.
#
$(eval $(call gb_StaticLibrary_StaticLibrary,testtools_bridgetest_s))
$(eval $(call gb_StaticLibrary_use_external,testtools_bridgetest_s,boost_headers))
$(eval $(call gb_StaticLibrary_use_internal_api,testtools_bridgetest_s,\
bridgetest \
))
$(eval $(call gb_StaticLibrary_use_api,testtools_bridgetest_s,\
udkapi \
))
$(eval $(call gb_StaticLibrary_add_exception_objects,testtools_bridgetest_s,\
testtools/source/bridgetest/currentcontextchecker \
testtools/source/bridgetest/multi \
))
# vim: set noet sw=4 ts=4:

View file

@ -28,9 +28,11 @@
#include "sal/types.h" #include "sal/types.h"
#include "test/testtools/bridgetest/XCurrentContextChecker.hpp" #include "test/testtools/bridgetest/XCurrentContextChecker.hpp"
#include <dllapi.hxx>
namespace testtools { namespace bridgetest { namespace testtools { namespace bridgetest {
class CurrentContextChecker : class LO_DLLPUBLIC_TESTTOOLS CurrentContextChecker :
public ::osl::DebugBase< CurrentContextChecker >, public ::osl::DebugBase< CurrentContextChecker >,
public ::cppu::WeakImplHelper< public ::cppu::WeakImplHelper<
::test::testtools::bridgetest::XCurrentContextChecker > ::test::testtools::bridgetest::XCurrentContextChecker >
@ -49,7 +51,7 @@ private:
CurrentContextChecker(CurrentContextChecker &) = delete; CurrentContextChecker(CurrentContextChecker &) = delete;
void operator =(CurrentContextChecker &) = delete; void operator =(CurrentContextChecker &) = delete;
bool performCheck( SAL_DLLPRIVATE bool performCheck(
css::uno::Reference< ::test::testtools::bridgetest::XCurrentContextChecker > const & other, css::uno::Reference< ::test::testtools::bridgetest::XCurrentContextChecker > const & other,
::sal_Int32 setSteps, ::sal_Int32 checkSteps); ::sal_Int32 setSteps, ::sal_Int32 checkSteps);
}; };

View file

@ -0,0 +1,25 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* 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/.
*/
#ifndef INCLUDED_TESTTOOLS_SOURCE_BRIDGETEST_DLLAPI_HXX
#define INCLUDED_TESTTOOLS_SOURCE_BRIDGETEST_DLLAPI_HXX
#include <sal/config.h>
#include <sal/types.h>
#if defined LO_DLLIMPLEMENTATION_TESTTOOLS
#define LO_DLLPUBLIC_TESTTOOLS SAL_DLLPUBLIC_EXPORT
#else
#define LO_DLLPUBLIC_TESTTOOLS SAL_DLLPUBLIC_IMPORT
#endif
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */

View file

@ -29,6 +29,8 @@
#include "sal/types.h" #include "sal/types.h"
#include "test/testtools/bridgetest/XMulti.hpp" #include "test/testtools/bridgetest/XMulti.hpp"
#include <dllapi.hxx>
namespace testtools { namespace bridgetest { namespace testtools { namespace bridgetest {
class Multi: public cppu::WeakImplHelper< test::testtools::bridgetest::XMulti > class Multi: public cppu::WeakImplHelper< test::testtools::bridgetest::XMulti >
@ -109,6 +111,7 @@ private:
double m_attribute3; double m_attribute3;
}; };
LO_DLLPUBLIC_TESTTOOLS
OUString testMulti( css::uno::Reference< test::testtools::bridgetest::XMulti > const & multi); OUString testMulti( css::uno::Reference< test::testtools::bridgetest::XMulti > const & multi);
} } } }