From 7e1335282481d038fff72531aae823809ab3fae6 Mon Sep 17 00:00:00 2001 From: Ronan Abhamon Date: Thu, 28 Sep 2017 17:39:12 +0200 Subject: [PATCH] feat(General): L_DECLARE_PRIVATE can declare a LINPHONE_NAMESPACE::Tester friend --- include/linphone/utils/general.h | 22 +++++++++++++++------- tester/CMakeLists.txt | 2 ++ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/include/linphone/utils/general.h b/include/linphone/utils/general.h index b9e36ade1..060c85df1 100644 --- a/include/linphone/utils/general.h +++ b/include/linphone/utils/general.h @@ -79,9 +79,12 @@ void l_assert (const char *condition, const char *file, int line); #define L_UNLIKELY(EXPRESSION) EXPRESSION #endif -// Allows access to private internal data. -// Gives a control to C Wrapper. -#define L_DECLARE_PRIVATE(CLASS) \ +class ClonableObject; +class ClonableObjectPrivate; +class Object; +class ObjectPrivate; + +#define L_INTERNAL_DECLARE_PRIVATE(CLASS) \ inline CLASS ## Private *getPrivate() { \ return reinterpret_cast(mPrivate); \ } \ @@ -91,10 +94,15 @@ void l_assert (const char *condition, const char *file, int line); friend class CLASS ## Private; \ friend class Wrapper; -class ClonableObject; -class ClonableObjectPrivate; -class Object; -class ObjectPrivate; +// Allows access to private internal data. +// Gives a control to C Wrapper. +#ifndef LINPHONE_TESTER + #define L_DECLARE_PRIVATE(CLASS) L_INTERNAL_DECLARE_PRIVATE(CLASS) +#else + #define L_DECLARE_PRIVATE(CLASS) \ + L_INTERNAL_DECLARE_PRIVATE(CLASS) \ + friend class Tester; +#endif template inline ClonableObject *getPublicHelper (T *object, ClonableObjectPrivate *context) { diff --git a/tester/CMakeLists.txt b/tester/CMakeLists.txt index ed7fa481d..cc9952668 100644 --- a/tester/CMakeLists.txt +++ b/tester/CMakeLists.txt @@ -218,6 +218,8 @@ bc_apply_compile_flags(SOURCE_FILES_C STRICT_OPTIONS_CPP STRICT_OPTIONS_C) bc_apply_compile_flags(SOURCE_FILES_CXX STRICT_OPTIONS_CPP STRICT_OPTIONS_CXX) bc_apply_compile_flags(SOURCE_FILES_OBJC STRICT_OPTIONS_CPP STRICT_OPTIONS_OBJC) +add_definitions("-DLINPHONE_TESTER") + if(MSVC) get_source_file_property(MESSAGE_TESTER_C_COMPILE_FLAGS message_tester.c COMPILE_FLAGS) set(MESSAGE_TESTER_C_COMPILE_FLAGS "${MESSAGE_TESTER_C_COMPILE_FLAGS} /wd4996") # Disable "was declared deprecated" warnings