From 16bbeb5713f4f9894e81ecf34a0e00f56a425f96 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Wed, 14 Sep 2016 15:52:04 +0200 Subject: 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 a53808c0ed577468393aced90963af6496706959 "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 --- testtools/Library_bridgetest-common.mk | 38 ++++++++++++++++++++++ testtools/Library_bridgetest.mk | 5 +-- testtools/Library_cppobj.mk | 5 +-- testtools/Module_testtools.mk | 2 +- testtools/StaticLibrary_bridgetest.mk | 28 ---------------- .../source/bridgetest/currentcontextchecker.hxx | 6 ++-- testtools/source/bridgetest/dllapi.hxx | 25 ++++++++++++++ testtools/source/bridgetest/multi.hxx | 3 ++ 8 files changed, 73 insertions(+), 39 deletions(-) create mode 100644 testtools/Library_bridgetest-common.mk delete mode 100644 testtools/StaticLibrary_bridgetest.mk create mode 100644 testtools/source/bridgetest/dllapi.hxx (limited to 'testtools') diff --git a/testtools/Library_bridgetest-common.mk b/testtools/Library_bridgetest-common.mk new file mode 100644 index 000000000000..1ca38bca6b49 --- /dev/null +++ b/testtools/Library_bridgetest-common.mk @@ -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: diff --git a/testtools/Library_bridgetest.mk b/testtools/Library_bridgetest.mk index 7953b66145bb..52f335761fdf 100644 --- a/testtools/Library_bridgetest.mk +++ b/testtools/Library_bridgetest.mk @@ -19,16 +19,13 @@ $(eval $(call gb_Library_use_api,testtools_bridgetest,\ 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_libraries,testtools_bridgetest,\ cppu \ cppuhelper \ sal \ + testtools_bridgetest-common \ )) $(eval $(call gb_Library_add_exception_objects,testtools_bridgetest,\ diff --git a/testtools/Library_cppobj.mk b/testtools/Library_cppobj.mk index f2d50d79b795..086b1fa0b6f5 100644 --- a/testtools/Library_cppobj.mk +++ b/testtools/Library_cppobj.mk @@ -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_static_libraries,testtools_cppobj,\ - testtools_bridgetest_s \ -)) - $(eval $(call gb_Library_use_libraries,testtools_cppobj,\ cppu \ cppuhelper \ sal \ + testtools_bridgetest-common \ )) $(eval $(call gb_Library_add_exception_objects,testtools_cppobj,\ diff --git a/testtools/Module_testtools.mk b/testtools/Module_testtools.mk index 9ffb2520ff4f..a1b84e175b30 100644 --- a/testtools/Module_testtools.mk +++ b/testtools/Module_testtools.mk @@ -15,9 +15,9 @@ $(eval $(call gb_Module_add_targets,testtools,\ CustomTarget_bridgetest \ InternalUnoApi_bridgetest \ InternalUnoApi_performance \ - StaticLibrary_bridgetest \ Library_cppobj \ Library_bridgetest \ + Library_bridgetest-common \ Library_constructors \ Rdb_uno_services \ )) diff --git a/testtools/StaticLibrary_bridgetest.mk b/testtools/StaticLibrary_bridgetest.mk deleted file mode 100644 index b1a076f8e537..000000000000 --- a/testtools/StaticLibrary_bridgetest.mk +++ /dev/null @@ -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: diff --git a/testtools/source/bridgetest/currentcontextchecker.hxx b/testtools/source/bridgetest/currentcontextchecker.hxx index f431762e90ce..1877392129ac 100644 --- a/testtools/source/bridgetest/currentcontextchecker.hxx +++ b/testtools/source/bridgetest/currentcontextchecker.hxx @@ -28,9 +28,11 @@ #include "sal/types.h" #include "test/testtools/bridgetest/XCurrentContextChecker.hpp" +#include + namespace testtools { namespace bridgetest { -class CurrentContextChecker : +class LO_DLLPUBLIC_TESTTOOLS CurrentContextChecker : public ::osl::DebugBase< CurrentContextChecker >, public ::cppu::WeakImplHelper< ::test::testtools::bridgetest::XCurrentContextChecker > @@ -49,7 +51,7 @@ private: CurrentContextChecker(CurrentContextChecker &) = delete; void operator =(CurrentContextChecker &) = delete; - bool performCheck( + SAL_DLLPRIVATE bool performCheck( css::uno::Reference< ::test::testtools::bridgetest::XCurrentContextChecker > const & other, ::sal_Int32 setSteps, ::sal_Int32 checkSteps); }; diff --git a/testtools/source/bridgetest/dllapi.hxx b/testtools/source/bridgetest/dllapi.hxx new file mode 100644 index 000000000000..8777a934a113 --- /dev/null +++ b/testtools/source/bridgetest/dllapi.hxx @@ -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 + +#include + +#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: */ diff --git a/testtools/source/bridgetest/multi.hxx b/testtools/source/bridgetest/multi.hxx index 9909ce573247..6ed12840c7a0 100644 --- a/testtools/source/bridgetest/multi.hxx +++ b/testtools/source/bridgetest/multi.hxx @@ -29,6 +29,8 @@ #include "sal/types.h" #include "test/testtools/bridgetest/XMulti.hpp" +#include + namespace testtools { namespace bridgetest { class Multi: public cppu::WeakImplHelper< test::testtools::bridgetest::XMulti > @@ -109,6 +111,7 @@ private: double m_attribute3; }; +LO_DLLPUBLIC_TESTTOOLS OUString testMulti( css::uno::Reference< test::testtools::bridgetest::XMulti > const & multi); } } -- cgit