From 14e475b3e5bdb32c4347cee98b4fbb7fe6550fb7 Mon Sep 17 00:00:00 2001 From: Vladimir Morozov Date: Fri, 3 Apr 2020 11:11:14 -0700 Subject: [PATCH] Updated compilerAdapters liblet from RNW Mso clone (#37) * Updated compilerAdapters liblet from RNW Mso clone * Change files --- ...03-10-57-17-MS_UpdateCompilerAdapters.json | 8 ++ .../compilerAdapters/compilerFeatures.h | 6 +- .../compilerAdapters/compilerWarnings.h | 9 ++- .../compilerAdapters/compilerWarnings_impl.h | 7 +- .../include/compilerAdapters/cppMacros.h | 78 ++++++++----------- .../include/compilerAdapters/cppMacrosDebug.h | 9 ++- .../compilerAdapters/declspecDefinitions.h | 9 ++- .../compilerAdapters/functionDecorations.h | 9 ++- .../include/compilerAdapters/intrinsics.h | 9 ++- .../include/compilerAdapters/linker.h | 10 +-- .../include/compilerAdapters/managedCpp.h | 11 +-- .../include/cppExtensions/autoRestore.h | 6 +- .../include/cppExtensions/threadLocal_fls.h | 2 +- .../cppExtensions/threadLocal_pthread.h | 2 +- libs/cppExtensions/tests/autoRestoreTest.cpp | 2 +- libs/functional/include/functional/functor.h | 4 +- .../include/functional/functorRef.h | 8 +- libs/memoryApi/include/memoryApi/memoryApi.h | 2 +- libs/object/include/object/fixedSwarm.h | 2 +- libs/object/include/object/lazyInit.h | 2 +- libs/object/include/object/objectRefCount.h | 14 ++-- .../object/include/object/objectWithWeakRef.h | 8 +- libs/object/include/object/queryCast.h | 2 +- libs/object/include/object/refCountedObject.h | 14 ++-- libs/object/include/object/swarm.h | 6 +- libs/object/include/object/unknownObject.h | 14 ++-- libs/object/tests/lazyInitTest.cpp | 4 +- libs/object/tests/refCountedObjectTest.cpp | 2 +- libs/object/tests/testAllocators.h | 2 +- libs/object/tests/unknownObjectTest.cpp | 2 +- libs/smartPtr/include/smartPtr/cntPtr.h | 2 +- .../include/smartPtr/smartPointerBase.h | 4 +- .../smartPtr/include/smartPtr/smartPointers.h | 8 +- tools/cmake/liblet.cmake | 2 +- 34 files changed, 139 insertions(+), 140 deletions(-) create mode 100644 change/@microsoft-mso-2020-04-03-10-57-17-MS_UpdateCompilerAdapters.json diff --git a/change/@microsoft-mso-2020-04-03-10-57-17-MS_UpdateCompilerAdapters.json b/change/@microsoft-mso-2020-04-03-10-57-17-MS_UpdateCompilerAdapters.json new file mode 100644 index 0000000..d68eafc --- /dev/null +++ b/change/@microsoft-mso-2020-04-03-10-57-17-MS_UpdateCompilerAdapters.json @@ -0,0 +1,8 @@ +{ + "type": "patch", + "comment": "Updated compilerAdapters liblet from RNW Mso clone", + "packageName": "@microsoft/mso", + "email": "vmorozov@microsoft.com", + "dependentChangeType": "patch", + "date": "2020-04-03T17:57:16.828Z" +} \ No newline at end of file diff --git a/libs/compilerAdapters/include/compilerAdapters/compilerFeatures.h b/libs/compilerAdapters/include/compilerAdapters/compilerFeatures.h index dd32fbc..14cbaaa 100644 --- a/libs/compilerAdapters/include/compilerAdapters/compilerFeatures.h +++ b/libs/compilerAdapters/include/compilerAdapters/compilerFeatures.h @@ -2,8 +2,8 @@ // Licensed under the MIT license. #pragma once -#ifndef COMPILERADAPTERS_COMPILERFEATURES_H -#define COMPILERADAPTERS_COMPILERFEATURES_H +#ifndef MSO_COMPILERADAPTERS_COMPILERFEATURES_H +#define MSO_COMPILERADAPTERS_COMPILERFEATURES_H //============================================================================= // Detect whether compiler features are present @@ -29,4 +29,4 @@ #endif #endif -#endif // COMPILERADAPTERS_COMPILERFEATURES_H +#endif // MSO_COMPILERADAPTERS_COMPILERFEATURES_H diff --git a/libs/compilerAdapters/include/compilerAdapters/compilerWarnings.h b/libs/compilerAdapters/include/compilerAdapters/compilerWarnings.h index 5dd2a9a..48546f4 100644 --- a/libs/compilerAdapters/include/compilerAdapters/compilerWarnings.h +++ b/libs/compilerAdapters/include/compilerAdapters/compilerWarnings.h @@ -1,6 +1,10 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. +#pragma once +#ifndef MSO_COMPILERADAPTERS_COMPILERWARNINGS_H +#define MSO_COMPILERADAPTERS_COMPILERWARNINGS_H + /** This header contains cross-plat macros for suppressing compiler warnings @@ -13,8 +17,7 @@ FUTURE: auto-generate this from shared file */ -#ifndef LIBLET_COMPILERADAPTERS_COMPILERWARNINGS_H -#define LIBLET_COMPILERADAPTERS_COMPILERWARNINGS_H + #include #define BEGIN_DISABLE_WARNING_ASSIGNMENT_OPERATOR_IMPLICITLY_DELETED() BEGIN_DISABLE_COMPILER_WARNING_MSVC(4626) @@ -141,4 +144,4 @@ #define BEGIN_DISABLE_WARNING_USING_UNINITIALIZED_VARIABLE() BEGIN_DISABLE_COMPILER_WARNING_MSVC(4700) #define END_DISABLE_WARNING_USING_UNINITIALIZED_VARIABLE() END_DISABLE_COMPILER_WARNING() -#endif // LIBLET_COMPILERADAPTERS_COMPILERWARNINGS_H +#endif // MSO_COMPILERADAPTERS_COMPILERWARNINGS_H diff --git a/libs/compilerAdapters/include/compilerAdapters/compilerWarnings_impl.h b/libs/compilerAdapters/include/compilerAdapters/compilerWarnings_impl.h index 9ef22e2..3ec0fbd 100644 --- a/libs/compilerAdapters/include/compilerAdapters/compilerWarnings_impl.h +++ b/libs/compilerAdapters/include/compilerAdapters/compilerWarnings_impl.h @@ -1,11 +1,12 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. +#pragma once +#ifndef MSO_COMPILERADAPTERS_COMPILERWARNINGS_IMPL_H +#define MSO_COMPILERADAPTERS_COMPILERWARNINGS_IMPL_H /** Implementation details for suppressing compiler warnings in a cross-plat manner. */ -#ifndef LIBLET_COMPILERADAPTERS_COMPILERWARNINGS_IMPL_H -#define LIBLET_COMPILERADAPTERS_COMPILERWARNINGS_IMPL_H #if defined(__clang__) @@ -55,4 +56,4 @@ #define END_DISABLE_COMPILER_WARNING() COMPILER_WARNING_POP() -#endif // LIBLET_COMPILERADAPTERS_COMPILERWARNINGS_IMPL_H +#endif // MSO_COMPILERADAPTERS_COMPILERWARNINGS_IMPL_H diff --git a/libs/compilerAdapters/include/compilerAdapters/cppMacros.h b/libs/compilerAdapters/include/compilerAdapters/cppMacros.h index 5095dee..9341a69 100644 --- a/libs/compilerAdapters/include/compilerAdapters/cppMacros.h +++ b/libs/compilerAdapters/include/compilerAdapters/cppMacros.h @@ -1,17 +1,16 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -/** - Various low level macros that are globally useful -*/ #pragma once -#ifndef COMPILERADAPTERS_CPPMACROS_H -#define COMPILERADAPTERS_CPPMACROS_H - -#include +#ifndef MSO_COMPILERADAPTERS_CPPMACROS_H +#define MSO_COMPILERADAPTERS_CPPMACROS_H /** - Broadly used macros + Various low level macros that are globally useful +*/ + +/** + Broadly used macros */ #ifndef FImplies #define FImplies(a, b) (!(a) || (b)) @@ -26,8 +25,8 @@ #endif /** - Statement - used for control flow macros like Check, IfFailGo - Make the macro act like a statement. + Statement - used for control flow macros like Check, IfFailGo + Make the macro act like a statement. */ #if defined(__GNUC__) #define Statement(x) \ @@ -50,41 +49,26 @@ #endif /** - Prevent the compiler from automatically providing implementations of various - class features. Use the macro in your class public: section. - TODO: probably need to update with new Move functions + Prevent the compiler from automatically providing implementations of various + class features. Use the macro in your class public: section. */ -#define MSO_NO_COPYCONSTR(C) \ - BEGIN_DISABLE_WARNING_LOCAL_CLASS_FUNC_NOT_DEFINED() \ - C(const C &) = delete; \ - END_DISABLE_WARNING_LOCAL_CLASS_FUNC_NOT_DEFINED() - -#define MSO_NO_ASSIGNMENT(C) \ - BEGIN_DISABLE_WARNING_LOCAL_CLASS_FUNC_NOT_DEFINED() \ - const C &operator=(const C &) = delete; \ - END_DISABLE_WARNING_LOCAL_CLASS_FUNC_NOT_DEFINED() - -#define MSO_NO_DEFAULTCONSTR(C) \ - BEGIN_DISABLE_WARNING_LOCAL_CLASS_FUNC_NOT_DEFINED() \ - explicit C() = delete; \ - END_DISABLE_WARNING_LOCAL_CLASS_FUNC_NOT_DEFINED() - -#ifndef DECLARE_COPYCONSTR_AND_ASSIGNMENT -#define DECLARE_COPYCONSTR_AND_ASSIGNMENT(C) \ - MSO_NO_COPYCONSTR(C) \ - MSO_NO_ASSIGNMENT(C) -#endif +#define MSO_NO_COPY_CTOR(type) type(const type &) = delete +#define MSO_NO_COPY_ASSIGNMENT(type) type &operator=(const type &) = delete +#define MSO_NO_DEFAULT_CTOR(type) type() = delete +#define MSO_NO_COPY_CTOR_AND_ASSIGNMENT(type) \ + MSO_NO_COPY_CTOR(type); \ + MSO_NO_COPY_ASSIGNMENT(type) #if defined(__cplusplus) #include /** - When using an enum class to define a set of bitflags, normal bitflag - enum operations, such as |, ^, and &, don't work without lots of casts. - Use this macro to define |, ^, and & for your enum class, where |, ^ and ~ - will return an enum class type, and & will evaluate to true or false. - The implementation causes error C3281 (global operator cannot have - managed type in signature) for managed code. + When using an enum class to define a set of bitflags, normal bitflag + enum operations, such as |, ^, and &, don't work without lots of casts. + Use this macro to define |, ^, and & for your enum class, where |, ^ and ~ + will return an enum class type, and & will evaluate to true or false. + The implementation causes error C3281 (global operator cannot have + managed type in signature) for managed code. */ #define ENUM_CLASS_FLAGS_OPERATORS(TEnum) \ constexpr TEnum operator~(TEnum a) noexcept \ @@ -129,9 +113,9 @@ #endif // !__cplusplus /** - Macros to help share enums between C++ and CX. - Enums must derive from int (the default) - Flag enums must derive from unsigned int + Macros to help share enums between C++ and CX. + Enums must derive from int (the default) + Flag enums must derive from unsigned int */ #if defined(_WINRT_COMP) && !defined(__clang__) #define EXPOSE_WINRT_ENUM public @@ -142,10 +126,10 @@ #endif /** - Macros to force placement of symbols into a particular segment. - For example on iOS ensure large globals aren't placed in the text - segment because there is a size limit enforced by Apple. - */ + Macros to force placement of symbols into a particular segment. + For example on iOS ensure large globals aren't placed in the text + segment because there is a size limit enforced by Apple. +*/ #if MS_TARGET_APPLE #define DATA_SEGMENT_CONST __attribute__((section("__DATA,__const"))) #else @@ -158,4 +142,4 @@ #define __declspec(s) #endif -#endif // COMPILERADAPTERS_CPPMACROS_H +#endif // MSO_COMPILERADAPTERS_CPPMACROS_H diff --git a/libs/compilerAdapters/include/compilerAdapters/cppMacrosDebug.h b/libs/compilerAdapters/include/compilerAdapters/cppMacrosDebug.h index 185e749..829744d 100644 --- a/libs/compilerAdapters/include/compilerAdapters/cppMacrosDebug.h +++ b/libs/compilerAdapters/include/compilerAdapters/cppMacrosDebug.h @@ -1,12 +1,13 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. +#pragma once +#ifndef MSO_COMPILERADAPTERS_CPPMACROSDEBUG_H +#define MSO_COMPILERADAPTERS_CPPMACROSDEBUG_H + /** Some globally useful debug-only macros */ -#pragma once -#ifndef COMPILERADAPTERS_CPPMACROSDEBUG_H -#define COMPILERADAPTERS_CPPMACROSDEBUG_H #include @@ -92,4 +93,4 @@ __inline int32_t MsoDebugBreak(void) #define MsoDebugBreak() (0) #endif -#endif +#endif // MSO_COMPILERADAPTERS_CPPMACROSDEBUG_H diff --git a/libs/compilerAdapters/include/compilerAdapters/declspecDefinitions.h b/libs/compilerAdapters/include/compilerAdapters/declspecDefinitions.h index 10183d7..7deaa7b 100644 --- a/libs/compilerAdapters/include/compilerAdapters/declspecDefinitions.h +++ b/libs/compilerAdapters/include/compilerAdapters/declspecDefinitions.h @@ -1,13 +1,14 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. +#pragma once +#ifndef MSO_COMPILERADAPTERS_DECLSPECDEFINITIONS_H +#define MSO_COMPILERADAPTERS_DECLSPECDEFINITIONS_H + /** Cross-compiler support for declspec things FUTURE: reconcile this with compilerFeatures.h */ -#pragma once -#ifndef COMPILERADAPTERS_DECLSPECDEFINITIONS_H -#define COMPILERADAPTERS_DECLSPECDEFINITIONS_H #ifndef DECLSPEC_NORETURN #if defined(__clang__) || defined(__GNUC__) @@ -71,4 +72,4 @@ #endif #endif -#endif // COMPILERADAPTERS_DECLSPECDEFINITIONS_H +#endif // MSO_COMPILERADAPTERS_DECLSPECDEFINITIONS_H diff --git a/libs/compilerAdapters/include/compilerAdapters/functionDecorations.h b/libs/compilerAdapters/include/compilerAdapters/functionDecorations.h index 03f1d62..d458b56 100644 --- a/libs/compilerAdapters/include/compilerAdapters/functionDecorations.h +++ b/libs/compilerAdapters/include/compilerAdapters/functionDecorations.h @@ -1,12 +1,13 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. +#pragma once +#ifndef MSO_COMPILERADAPTERS_FUNCTIONDECORATIONS_H +#define MSO_COMPILERADAPTERS_FUNCTIONDECORATIONS_H + /** Cross-platform/language macros to decorate APIs */ -#pragma once -#ifndef COMPILERADAPTERS_FUNCTIONDECORATIONS_H -#define COMPILERADAPTERS_FUNCTIONDECORATIONS_H /** The Liblet::PublicApi attribute is used to mark a function, class or @@ -230,4 +231,4 @@ #endif -#endif +#endif // MSO_COMPILERADAPTERS_FUNCTIONDECORATIONS_H diff --git a/libs/compilerAdapters/include/compilerAdapters/intrinsics.h b/libs/compilerAdapters/include/compilerAdapters/intrinsics.h index 1238d54..6406104 100644 --- a/libs/compilerAdapters/include/compilerAdapters/intrinsics.h +++ b/libs/compilerAdapters/include/compilerAdapters/intrinsics.h @@ -1,12 +1,13 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. +#pragma once +#ifndef MSO_COMPILERADAPTERS_INTRINSICS_H +#define MSO_COMPILERADAPTERS_INTRINSICS_H + /** Adapters for various compiler intrinsics */ -#pragma once -#ifndef COMPILERADAPTERS_INTRINSICS_H -#define COMPILERADAPTERS_INTRINSICS_H /** Macro that calls compiler intrinsics to terminate the application and bypass all exception handlers */ #if defined(__clang__) || defined(__GNUC__) @@ -18,4 +19,4 @@ #define MSO_FUNC_RETURN_ADDRESS() _ReturnAddress() #endif -#endif +#endif // MSO_COMPILERADAPTERS_INTRINSICS_H diff --git a/libs/compilerAdapters/include/compilerAdapters/linker.h b/libs/compilerAdapters/include/compilerAdapters/linker.h index ef5d1e3..c6783c7 100644 --- a/libs/compilerAdapters/include/compilerAdapters/linker.h +++ b/libs/compilerAdapters/include/compilerAdapters/linker.h @@ -1,12 +1,9 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -/** - Things related to linking -*/ #pragma once -#ifndef COMPILERADAPTERS_LINKER_H -#define COMPILERADAPTERS_LINKER_H +#ifndef MSO_COMPILERADAPTERS_LINKER_H +#define MSO_COMPILERADAPTERS_LINKER_H /** If a library has no direct entry points, it may be necessary to force @@ -66,4 +63,5 @@ #define MSO_LINK_SYMBOL(symbol) #endif // MS_TARGET_WINDOWS -#endif + +#endif // MSO_COMPILERADAPTERS_LINKER_H diff --git a/libs/compilerAdapters/include/compilerAdapters/managedCpp.h b/libs/compilerAdapters/include/compilerAdapters/managedCpp.h index 1b9da13..6aadae3 100644 --- a/libs/compilerAdapters/include/compilerAdapters/managedCpp.h +++ b/libs/compilerAdapters/include/compilerAdapters/managedCpp.h @@ -1,19 +1,20 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. +#pragma once +#ifndef MSO_COMPILERADAPTERS_MANAGEDCPP_H +#define MSO_COMPILERADAPTERS_MANAGEDCPP_H + /** Support for managed C++ compilation available only in VC++. */ -#pragma once -#ifndef COMPILERADAPTERS_MANAGEDCPP_H -#define COMPILERADAPTERS_MANAGEDCPP_H /** VC++ specific pragmas to indicate that code must not be compiled as managed. Functions are compiled as managed by default when /clr is used. The pragmas below allow explicitly indicate that code is unmanaged, but these pragmas are not recognized by Clang compiler. - */ +*/ #if !defined(__clang__) #define MSO_PRAGMA_MANAGED_PUSH_OFF __pragma(managed(push, off)) @@ -26,4 +27,4 @@ #endif // !defined(__clang__) -#endif // COMPILERADAPTERS_MANAGEDCPP_H +#endif // MSO_COMPILERADAPTERS_MANAGEDCPP_H diff --git a/libs/cppExtensions/include/cppExtensions/autoRestore.h b/libs/cppExtensions/include/cppExtensions/autoRestore.h index 7c6609e..d5bbc7d 100644 --- a/libs/cppExtensions/include/cppExtensions/autoRestore.h +++ b/libs/cppExtensions/include/cppExtensions/autoRestore.h @@ -52,7 +52,7 @@ public: *m_pValue = m_previousValue; } - DECLARE_COPYCONSTR_AND_ASSIGNMENT(TRestorer) + MSO_NO_COPY_CTOR_AND_ASSIGNMENT(TRestorer); TRestorer& operator=(TRestorer&& other) noexcept = delete; bool IsEnabled() noexcept @@ -134,7 +134,7 @@ public: } } - DECLARE_COPYCONSTR_AND_ASSIGNMENT(TPropertyRestorer) // No copying! + MSO_NO_COPY_CTOR_AND_ASSIGNMENT(TPropertyRestorer); // No copying! template < typename TSelf = TPropertyRestorer, @@ -226,7 +226,7 @@ public: m_fnCleanup(); } - DECLARE_COPYCONSTR_AND_ASSIGNMENT(TCleanup) + MSO_NO_COPY_CTOR_AND_ASSIGNMENT(TCleanup); void enable() noexcept { diff --git a/libs/cppExtensions/include/cppExtensions/threadLocal_fls.h b/libs/cppExtensions/include/cppExtensions/threadLocal_fls.h index ba2a4cf..a68d537 100644 --- a/libs/cppExtensions/include/cppExtensions/threadLocal_fls.h +++ b/libs/cppExtensions/include/cppExtensions/threadLocal_fls.h @@ -16,7 +16,7 @@ namespace Mso { namespace Details { struct ThreadLocalImpl { - DECLARE_COPYCONSTR_AND_ASSIGNMENT(ThreadLocalImpl); + MSO_NO_COPY_CTOR_AND_ASSIGNMENT(ThreadLocalImpl); static_assert(FLS_OUT_OF_INDEXES == TLS_OUT_OF_INDEXES, "Assumption violation"); ThreadLocalImpl() noexcept : ThreadLocalImpl(nullptr) {} diff --git a/libs/cppExtensions/include/cppExtensions/threadLocal_pthread.h b/libs/cppExtensions/include/cppExtensions/threadLocal_pthread.h index 35a00e9..2305b6b 100644 --- a/libs/cppExtensions/include/cppExtensions/threadLocal_pthread.h +++ b/libs/cppExtensions/include/cppExtensions/threadLocal_pthread.h @@ -13,7 +13,7 @@ namespace Mso { namespace Details { struct ThreadLocalImpl { - DECLARE_COPYCONSTR_AND_ASSIGNMENT(ThreadLocalImpl) + MSO_NO_COPY_CTOR_AND_ASSIGNMENT(ThreadLocalImpl); ThreadLocalImpl() noexcept { diff --git a/libs/cppExtensions/tests/autoRestoreTest.cpp b/libs/cppExtensions/tests/autoRestoreTest.cpp index b73d2be..5cb9c95 100644 --- a/libs/cppExtensions/tests/autoRestoreTest.cpp +++ b/libs/cppExtensions/tests/autoRestoreTest.cpp @@ -193,7 +193,7 @@ TEST_CLASS (TPropertyRestorerTest) private: Unmovable(Unmovable&&) = delete; Unmovable& operator=(Unmovable&&) = delete; - DECLARE_COPYCONSTR_AND_ASSIGNMENT(Unmovable); // No copying! + MSO_NO_COPY_CTOR_AND_ASSIGNMENT(Unmovable); // No copying! }; // Ensure PropertyRestorer doesn't cause any extra constructor calls. diff --git a/libs/functional/include/functional/functor.h b/libs/functional/include/functional/functor.h index 2308712..5c4bb80 100644 --- a/libs/functional/include/functional/functor.h +++ b/libs/functional/include/functional/functor.h @@ -175,7 +175,7 @@ class FunctionObjectWrapper final { public: FunctionObjectWrapper() = delete; - DECLARE_COPYCONSTR_AND_ASSIGNMENT(FunctionObjectWrapper) + MSO_NO_COPY_CTOR_AND_ASSIGNMENT(FunctionObjectWrapper); template FunctionObjectWrapper(T&& func) noexcept : m_func(std::forward(func)) @@ -198,7 +198,7 @@ class FunctionObjectWrapperThrow final { public: FunctionObjectWrapperThrow() = delete; - DECLARE_COPYCONSTR_AND_ASSIGNMENT(FunctionObjectWrapperThrow) + MSO_NO_COPY_CTOR_AND_ASSIGNMENT(FunctionObjectWrapperThrow); template FunctionObjectWrapperThrow(T&& func) noexcept : m_func(std::forward(func)) diff --git a/libs/functional/include/functional/functorRef.h b/libs/functional/include/functional/functorRef.h index 2c0ec5f..65f37e1 100644 --- a/libs/functional/include/functional/functorRef.h +++ b/libs/functional/include/functional/functorRef.h @@ -144,7 +144,7 @@ public: } //! Delete copy and move constructors and assignment operators. - DECLARE_COPYCONSTR_AND_ASSIGNMENT(FunctorRef) + MSO_NO_COPY_CTOR_AND_ASSIGNMENT(FunctorRef); //! Calls referenced function object. //! Crash if referenced function object is nullptr. @@ -181,7 +181,7 @@ private: struct FunctorRefWrapper final : IFunctorRef { FunctorRefWrapper(T* func) noexcept : m_func(func) {} - DECLARE_COPYCONSTR_AND_ASSIGNMENT(FunctorRefWrapper) + MSO_NO_COPY_CTOR_AND_ASSIGNMENT(FunctorRefWrapper); ~FunctorRefWrapper() = delete; TResult Invoke(TArgs&&... args) const noexcept override @@ -241,7 +241,7 @@ public: } //! Delete copy and move constructors and assignment operators. - DECLARE_COPYCONSTR_AND_ASSIGNMENT(FunctorRefThrow) + MSO_NO_COPY_CTOR_AND_ASSIGNMENT(FunctorRefThrow); //! Calls referenced function object. //! Crash if referenced function object is nullptr. @@ -278,7 +278,7 @@ private: struct FunctorRefThrowWrapper final : IFunctorRefThrow { FunctorRefThrowWrapper(T* func) noexcept : m_func(func) {} - DECLARE_COPYCONSTR_AND_ASSIGNMENT(FunctorRefThrowWrapper) + MSO_NO_COPY_CTOR_AND_ASSIGNMENT(FunctorRefThrowWrapper); ~FunctorRefThrowWrapper() = delete; TResult Invoke(TArgs&&... args) const override diff --git a/libs/memoryApi/include/memoryApi/memoryApi.h b/libs/memoryApi/include/memoryApi/memoryApi.h index 2229ff1..cd439e3 100644 --- a/libs/memoryApi/include/memoryApi/memoryApi.h +++ b/libs/memoryApi/include/memoryApi/memoryApi.h @@ -440,7 +440,7 @@ public: #endif private: - DECLARE_COPYCONSTR_AND_ASSIGNMENT(MemoryPtr) + MSO_NO_COPY_CTOR_AND_ASSIGNMENT(MemoryPtr); }; } // namespace Mso diff --git a/libs/object/include/object/fixedSwarm.h b/libs/object/include/object/fixedSwarm.h index e0279fd..5509810 100644 --- a/libs/object/include/object/fixedSwarm.h +++ b/libs/object/include/object/fixedSwarm.h @@ -156,7 +156,7 @@ public: FixedSwarmBase() noexcept : Super(), m_storage() {} - DECLARE_COPYCONSTR_AND_ASSIGNMENT(FixedSwarmBase) + MSO_NO_COPY_CTOR_AND_ASSIGNMENT(FixedSwarmBase); template MemberType* Get() const noexcept diff --git a/libs/object/include/object/lazyInit.h b/libs/object/include/object/lazyInit.h index 4cef778..562051f 100644 --- a/libs/object/include/object/lazyInit.h +++ b/libs/object/include/object/lazyInit.h @@ -40,7 +40,7 @@ class LazyInit final "The type must be derived from Mso::IRefCounted or IUnknown."); public: - DECLARE_COPYCONSTR_AND_ASSIGNMENT(LazyInit) + MSO_NO_COPY_CTOR_AND_ASSIGNMENT(LazyInit); explicit LazyInit() noexcept = default; diff --git a/libs/object/include/object/objectRefCount.h b/libs/object/include/object/objectRefCount.h index 90cf686..bd99b53 100644 --- a/libs/object/include/object/objectRefCount.h +++ b/libs/object/include/object/objectRefCount.h @@ -25,7 +25,7 @@ #pragma push_macro("new") #undef new -#define _MSO_OBJECT_SIMPLEREFCOUNT(TObject) \ +#define MSO_OBJECT_SIMPLEREFCOUNT(TObject) \ public: \ bool IsUniqueRef() const noexcept \ { \ @@ -35,11 +35,11 @@ public: \ template \ void* operator new(size_t, UseMsoMakeInsteadOfOperatorNew* = nullptr); \ - DECLARE_COPYCONSTR_AND_ASSIGNMENT(TObject) + MSO_NO_COPY_CTOR_AND_ASSIGNMENT(TObject) -#define _MSO_OBJECT_NOREFCOUNT(TObject) \ +#define MSO_OBJECT_NOREFCOUNT(TObject) \ public: \ - DECLARE_COPYCONSTR_AND_ASSIGNMENT(TObject) + MSO_NO_COPY_CTOR_AND_ASSIGNMENT(TObject) namespace Mso { @@ -160,7 +160,7 @@ public: using TypeToDelete = RefCountedWrapperBase; // To verify that TypeToDelete is the first in the inheritance chain. - _MSO_OBJECT_SIMPLEREFCOUNT(RefCountedWrapperBase) + MSO_OBJECT_SIMPLEREFCOUNT(RefCountedWrapperBase); void AddRef() const noexcept { @@ -195,7 +195,7 @@ class RefCountedWrapper , public T { public: - DECLARE_COPYCONSTR_AND_ASSIGNMENT(RefCountedWrapper) + MSO_NO_COPY_CTOR_AND_ASSIGNMENT(RefCountedWrapper); using MakePolicy = Mso::MakePolicy::ThrowCtor; @@ -216,7 +216,7 @@ template <> class RefCountedWrapper : public RefCountedWrapperBase { public: - DECLARE_COPYCONSTR_AND_ASSIGNMENT(RefCountedWrapper) + MSO_NO_COPY_CTOR_AND_ASSIGNMENT(RefCountedWrapper); RefCountedWrapper() noexcept = default; }; diff --git a/libs/object/include/object/objectWithWeakRef.h b/libs/object/include/object/objectWithWeakRef.h index f489a11..7e6f853 100644 --- a/libs/object/include/object/objectWithWeakRef.h +++ b/libs/object/include/object/objectWithWeakRef.h @@ -70,7 +70,7 @@ To implement your classes please use classes defined in the msoUnknownObject.h o #pragma push_macro("new") #undef new -#define _MSO_OBJECT_WEAKREFCOUNT(TObject) \ +#define MSO_OBJECT_WEAKREFCOUNT(TObject) \ public: \ Mso::ObjectWeakRef& GetWeakRef() const noexcept \ { \ @@ -84,7 +84,7 @@ public: \ template \ void* operator new(size_t, UseMsoMakeInsteadOfOperatorNew* = nullptr); \ - DECLARE_COPYCONSTR_AND_ASSIGNMENT(TObject) + MSO_NO_COPY_CTOR_AND_ASSIGNMENT(TObject) namespace Mso { @@ -100,7 +100,7 @@ public: using TypeToDelete = ObjectWeakRef; // To verify that TypeToDelete is the first in the inheritance chain. - _MSO_OBJECT_SIMPLEREFCOUNT(ObjectWeakRef) + MSO_OBJECT_SIMPLEREFCOUNT(ObjectWeakRef); ObjectWeakRef() = default; @@ -210,7 +210,7 @@ template class ObjectWeakRefContainer : public TWeakRef { public: - DECLARE_COPYCONSTR_AND_ASSIGNMENT(ObjectWeakRefContainer) + MSO_NO_COPY_CTOR_AND_ASSIGNMENT(ObjectWeakRefContainer); ObjectWeakRefContainer() = default; diff --git a/libs/object/include/object/queryCast.h b/libs/object/include/object/queryCast.h index 8509010..f8f9ff9 100644 --- a/libs/object/include/object/queryCast.h +++ b/libs/object/include/object/queryCast.h @@ -298,7 +298,7 @@ public: MSO_STRUCT_GUID(QueryCastBridge, "A39D5FC8-0641-4EEE-8C97-DDEF114D487D") struct QueryCastBridge { - // DECLARE_COPYCONSTR_AND_ASSIGNMENT(QueryCastBridge); + // MSO_NO_COPY_CTOR_AND_ASSIGNMENT(QueryCastBridge); void* Object; // It must be a first field. In that case **ppvObject in QueryInterface will have the same semantic as // with the normal QueryInterface calls. const GUID& ObjectId; diff --git a/libs/object/include/object/refCountedObject.h b/libs/object/include/object/refCountedObject.h index 9f5d44f..dffc001 100644 --- a/libs/object/include/object/refCountedObject.h +++ b/libs/object/include/object/refCountedObject.h @@ -302,7 +302,7 @@ public: using RefCountedObjectType = RefCountedObject; // To use in derived class as "using Super = RefCountedObjectType" using TypeToDelete = RefCountedObject; // To verify that TypeToDelete is the first in the inheritance chain. - _MSO_OBJECT_SIMPLEREFCOUNT(RefCountedObject) + MSO_OBJECT_SIMPLEREFCOUNT(RefCountedObject); void AddRef() const noexcept override { @@ -348,7 +348,7 @@ public: using RefCountedObjectType = RefCountedObject; // To use in derived class as "using Super = RefCountedObjectType" using TypeToDelete = RefCountedObject; // To verify that TypeToDelete is the first in the inheritance chain. - _MSO_OBJECT_SIMPLEREFCOUNT(RefCountedObject) + MSO_OBJECT_SIMPLEREFCOUNT(RefCountedObject); void AddRef() const noexcept override { @@ -394,7 +394,7 @@ public: using RefCountedObjectType = RefCountedObject; // To use in derived class as "using Super = RefCountedObjectType" using TypeToDelete = RefCountedObject; // To verify that TypeToDelete is the first in the inheritance chain. - _MSO_OBJECT_WEAKREFCOUNT(RefCountedObject) + MSO_OBJECT_WEAKREFCOUNT(RefCountedObject); void AddRef() const noexcept override { @@ -423,7 +423,7 @@ class RefCountedObject RefCountedObject(TArgs&&... args) noexcept : TBaseType0(std::forward(args)...) @@ -453,7 +453,7 @@ public: RefCountedObjectNoVTable; // To use in derived class as "using Super = RefCountedObjectNoVTableType" using TypeToDelete = TDerived; // To verify that TypeToDelete is the first in the inheritance chain. - _MSO_OBJECT_SIMPLEREFCOUNT(RefCountedObjectNoVTable) + MSO_OBJECT_SIMPLEREFCOUNT(RefCountedObjectNoVTable); void AddRef() const noexcept { @@ -496,7 +496,7 @@ public: RefCountedObjectNoVTable; // To use in derived class as "using Super = RefCountedObjectNoVTableType" using TypeToDelete = TDerived; // To verify that TypeToDelete is the first in the inheritance chain. - _MSO_OBJECT_SIMPLEREFCOUNT(RefCountedObjectNoVTable) + MSO_OBJECT_SIMPLEREFCOUNT(RefCountedObjectNoVTable); void AddRef() const noexcept { @@ -539,7 +539,7 @@ public: RefCountedObjectNoVTable; // To use in derived class as "using Super = RefCountedObjectNoVTableType" using TypeToDelete = TDerived; // To verify that TypeToDelete is the first in the inheritance chain. - _MSO_OBJECT_WEAKREFCOUNT(RefCountedObjectNoVTable) + MSO_OBJECT_WEAKREFCOUNT(RefCountedObjectNoVTable); void AddRef() const noexcept { diff --git a/libs/object/include/object/swarm.h b/libs/object/include/object/swarm.h index 6dac21d..e50e97a 100644 --- a/libs/object/include/object/swarm.h +++ b/libs/object/include/object/swarm.h @@ -121,7 +121,7 @@ class Swarm : public ObjectWeakRef public: Swarm() noexcept : ObjectWeakRef(), m_headMember() {} - DECLARE_COPYCONSTR_AND_ASSIGNMENT(Swarm) + MSO_NO_COPY_CTOR_AND_ASSIGNMENT(Swarm); template static Mso::TCntPtr Make(TArgs&&... args) noexcept(T::MakePolicy::IsNoExcept) @@ -336,7 +336,7 @@ template class SwarmMemberPtr { public: - DECLARE_COPYCONSTR_AND_ASSIGNMENT(SwarmMemberPtr) + MSO_NO_COPY_CTOR_AND_ASSIGNMENT(SwarmMemberPtr); SwarmMemberPtr() noexcept {} @@ -463,7 +463,7 @@ template class SwarmMemberPtr { public: - DECLARE_COPYCONSTR_AND_ASSIGNMENT(SwarmMemberPtr) + MSO_NO_COPY_CTOR_AND_ASSIGNMENT(SwarmMemberPtr); SwarmMemberPtr() noexcept {} diff --git a/libs/object/include/object/unknownObject.h b/libs/object/include/object/unknownObject.h index 8d70596..6f825cb 100644 --- a/libs/object/include/object/unknownObject.h +++ b/libs/object/include/object/unknownObject.h @@ -380,7 +380,7 @@ public: using UnknownObjectType = UnknownObject; // To use in derived class as "using Super = UnknownObjectType" using TypeToDelete = UnknownObject; // To verify that TypeToDelete is the first in the inheritance chain. - _MSO_OBJECT_SIMPLEREFCOUNT(UnknownObject) + MSO_OBJECT_SIMPLEREFCOUNT(UnknownObject); _Success_(return == S_OK) STDMETHOD(QueryInterface)(const GUID& riid, _Outptr_ void** ppvObject) noexcept override { @@ -436,7 +436,7 @@ public: using UnknownObjectType = UnknownObject; // To use in derived class as "using Super = UnknownObjectType" using TypeToDelete = UnknownObject; // To verify that TypeToDelete is the first in the inheritance chain. - _MSO_OBJECT_SIMPLEREFCOUNT(UnknownObject) + MSO_OBJECT_SIMPLEREFCOUNT(UnknownObject); _Success_(return == S_OK) STDMETHOD(QueryInterface)(const GUID& riid, _Outptr_ void** ppvObject) override { @@ -491,7 +491,7 @@ public: using UnknownObjectType = UnknownObject; // To use in derived class as "using Super = UnknownObjectType" using TypeToDelete = UnknownObject; // To verify that TypeToDelete is the first in the inheritance chain. - _MSO_OBJECT_SIMPLEREFCOUNT(UnknownObject) + MSO_OBJECT_SIMPLEREFCOUNT(UnknownObject); _Success_(return == S_OK) STDMETHOD(QueryInterface)(const GUID& /*riid*/, _Outptr_ void** /*ppvObject*/) noexcept override @@ -548,7 +548,7 @@ public: using UnknownObjectType = UnknownObject; // To use in derived class as "using Super = UnknownObjectType" using TypeToDelete = UnknownObject; // To verify that TypeToDelete is the first in the inheritance chain. - _MSO_OBJECT_WEAKREFCOUNT(UnknownObject) + MSO_OBJECT_WEAKREFCOUNT(UnknownObject); void* QueryCast(const GUID& riid) noexcept { @@ -595,7 +595,7 @@ class DECLSPEC_NOVTABLE UnknownObject UnknownObject(TArgs&&... args) noexcept : Super(std::forward(args)...) @@ -631,7 +631,7 @@ class DECLSPEC_NOVTABLE UnknownObject UnknownObject(TArgs&&... args) noexcept : Super(std::forward(args)...) @@ -668,7 +668,7 @@ class AgileUnknownObject : public UnknownObject using Super = UnknownObject; public: - DECLARE_COPYCONSTR_AND_ASSIGNMENT(AgileUnknownObject) + MSO_NO_COPY_CTOR_AND_ASSIGNMENT(AgileUnknownObject); template AgileUnknownObject(TArgs&&... args) noexcept : Super(std::forward(args)...) diff --git a/libs/object/tests/lazyInitTest.cpp b/libs/object/tests/lazyInitTest.cpp index 18d42b6..54e8741 100644 --- a/libs/object/tests/lazyInitTest.cpp +++ b/libs/object/tests/lazyInitTest.cpp @@ -25,7 +25,7 @@ class CountedType final : public Mso::RefCountedObject>::type; // TODO: consider allowing this via extension of THelper? - DECLARE_COPYCONSTR_AND_ASSIGNMENT(THolder) + MSO_NO_COPY_CTOR_AND_ASSIGNMENT(THolder); /** Construction / Destruction @@ -524,7 +524,7 @@ class THolderPair : protected THolder, THelper> using _Myt = THolderPair; public: - DECLARE_COPYCONSTR_AND_ASSIGNMENT(THolderPair) + MSO_NO_COPY_CTOR_AND_ASSIGNMENT(THolderPair); using Super = THolder, THelper>; using TRefType = typename std:: diff --git a/libs/smartPtr/include/smartPtr/smartPointers.h b/libs/smartPtr/include/smartPtr/smartPointers.h index 156c18e..4f8108d 100644 --- a/libs/smartPtr/include/smartPtr/smartPointers.h +++ b/libs/smartPtr/include/smartPtr/smartPointers.h @@ -60,7 +60,7 @@ public: } private: - DECLARE_COPYCONSTR_AND_ASSIGNMENT(TOwnerPtr) + MSO_NO_COPY_CTOR_AND_ASSIGNMENT(TOwnerPtr); }; /** @@ -111,7 +111,7 @@ public: } private: - DECLARE_COPYCONSTR_AND_ASSIGNMENT(TArrayHolder) + MSO_NO_COPY_CTOR_AND_ASSIGNMENT(TArrayHolder); }; /** @@ -146,7 +146,7 @@ public: IMPLEMENT_THOLDER_RVALUE_REFS(TOwnerIPtr); private: - DECLARE_COPYCONSTR_AND_ASSIGNMENT(TOwnerIPtr) + MSO_NO_COPY_CTOR_AND_ASSIGNMENT(TOwnerIPtr); }; /** @@ -181,7 +181,7 @@ public: IMPLEMENT_THOLDER_RVALUE_REFS(TDestroyPtr); private: - DECLARE_COPYCONSTR_AND_ASSIGNMENT(TDestroyPtr) + MSO_NO_COPY_CTOR_AND_ASSIGNMENT(TDestroyPtr); }; /** diff --git a/tools/cmake/liblet.cmake b/tools/cmake/liblet.cmake index 932f63d..dcb1382 100644 --- a/tools/cmake/liblet.cmake +++ b/tools/cmake/liblet.cmake @@ -35,7 +35,7 @@ message(STATUS "Enable includes checks: ${MSO_ENABLE_INCLUDES_CHECKS}") ########################################### # require C++14 -set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD 17) #set(CMAKE_CXX_EXTENSIONS OFF) #set(CMAKE_CXX_STANDARD_REQUIRED ON)