зеркало из https://github.com/microsoft/mso.git
Updated compilerAdapters liblet from RNW Mso clone (#37)
* Updated compilerAdapters liblet from RNW Mso clone * Change files
This commit is contained in:
Родитель
97457deb92
Коммит
14e475b3e5
|
@ -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"
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -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 <compilerAdapters/compilerWarnings_impl.h>
|
||||
|
||||
#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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 <compilerAdapters/compilerWarnings.h>
|
||||
#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 <type_traits>
|
||||
|
||||
/**
|
||||
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
|
||||
|
|
|
@ -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 <cstdint>
|
||||
|
||||
|
@ -92,4 +93,4 @@ __inline int32_t MsoDebugBreak(void)
|
|||
#define MsoDebugBreak() (0)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif // MSO_COMPILERADAPTERS_CPPMACROSDEBUG_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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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) {}
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace Mso { namespace Details {
|
|||
|
||||
struct ThreadLocalImpl
|
||||
{
|
||||
DECLARE_COPYCONSTR_AND_ASSIGNMENT(ThreadLocalImpl)
|
||||
MSO_NO_COPY_CTOR_AND_ASSIGNMENT(ThreadLocalImpl);
|
||||
|
||||
ThreadLocalImpl() noexcept
|
||||
{
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -175,7 +175,7 @@ class FunctionObjectWrapper final
|
|||
{
|
||||
public:
|
||||
FunctionObjectWrapper() = delete;
|
||||
DECLARE_COPYCONSTR_AND_ASSIGNMENT(FunctionObjectWrapper)
|
||||
MSO_NO_COPY_CTOR_AND_ASSIGNMENT(FunctionObjectWrapper);
|
||||
|
||||
template <typename T>
|
||||
FunctionObjectWrapper(T&& func) noexcept : m_func(std::forward<T>(func))
|
||||
|
@ -198,7 +198,7 @@ class FunctionObjectWrapperThrow final
|
|||
{
|
||||
public:
|
||||
FunctionObjectWrapperThrow() = delete;
|
||||
DECLARE_COPYCONSTR_AND_ASSIGNMENT(FunctionObjectWrapperThrow)
|
||||
MSO_NO_COPY_CTOR_AND_ASSIGNMENT(FunctionObjectWrapperThrow);
|
||||
|
||||
template <typename T>
|
||||
FunctionObjectWrapperThrow(T&& func) noexcept : m_func(std::forward<T>(func))
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -440,7 +440,7 @@ public:
|
|||
#endif
|
||||
|
||||
private:
|
||||
DECLARE_COPYCONSTR_AND_ASSIGNMENT(MemoryPtr)
|
||||
MSO_NO_COPY_CTOR_AND_ASSIGNMENT(MemoryPtr);
|
||||
};
|
||||
} // namespace Mso
|
||||
|
||||
|
|
|
@ -156,7 +156,7 @@ public:
|
|||
|
||||
FixedSwarmBase() noexcept : Super(), m_storage() {}
|
||||
|
||||
DECLARE_COPYCONSTR_AND_ASSIGNMENT(FixedSwarmBase)
|
||||
MSO_NO_COPY_CTOR_AND_ASSIGNMENT(FixedSwarmBase);
|
||||
|
||||
template <size_t Index>
|
||||
MemberType<Index>* Get() const noexcept
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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 <typename UseMsoMakeInsteadOfOperatorNew> \
|
||||
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<void> : public RefCountedWrapperBase
|
||||
{
|
||||
public:
|
||||
DECLARE_COPYCONSTR_AND_ASSIGNMENT(RefCountedWrapper)
|
||||
MSO_NO_COPY_CTOR_AND_ASSIGNMENT(RefCountedWrapper);
|
||||
RefCountedWrapper() noexcept = default;
|
||||
};
|
||||
|
||||
|
|
|
@ -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 <typename UseMsoMakeInsteadOfOperatorNew> \
|
||||
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 <typename TObject, typename TWeakRef>
|
|||
class ObjectWeakRefContainer : public TWeakRef
|
||||
{
|
||||
public:
|
||||
DECLARE_COPYCONSTR_AND_ASSIGNMENT(ObjectWeakRefContainer)
|
||||
MSO_NO_COPY_CTOR_AND_ASSIGNMENT(ObjectWeakRefContainer);
|
||||
|
||||
ObjectWeakRefContainer() = default;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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<Mso::RefCountStrategy::NoRefCount, TBaseType0, TBaseTypes
|
|||
public:
|
||||
using RefCountedObjectType = RefCountedObject; // To use in derived class as "using Super = RefCountedObjectType"
|
||||
|
||||
_MSO_OBJECT_NOREFCOUNT(RefCountedObject)
|
||||
MSO_OBJECT_NOREFCOUNT(RefCountedObject);
|
||||
|
||||
template <typename... TArgs>
|
||||
RefCountedObject(TArgs&&... args) noexcept : TBaseType0(std::forward<TArgs>(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
|
||||
{
|
||||
|
|
|
@ -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 <typename T, typename TResult = T, typename... TArgs>
|
||||
static Mso::TCntPtr<TResult> Make(TArgs&&... args) noexcept(T::MakePolicy::IsNoExcept)
|
||||
|
@ -336,7 +336,7 @@ template <typename T, bool KnownSameSwarm = false>
|
|||
class SwarmMemberPtr
|
||||
{
|
||||
public:
|
||||
DECLARE_COPYCONSTR_AND_ASSIGNMENT(SwarmMemberPtr)
|
||||
MSO_NO_COPY_CTOR_AND_ASSIGNMENT(SwarmMemberPtr);
|
||||
|
||||
SwarmMemberPtr() noexcept {}
|
||||
|
||||
|
@ -463,7 +463,7 @@ template <typename T>
|
|||
class SwarmMemberPtr<T, /*KnownSameSwarm*/ true>
|
||||
{
|
||||
public:
|
||||
DECLARE_COPYCONSTR_AND_ASSIGNMENT(SwarmMemberPtr)
|
||||
MSO_NO_COPY_CTOR_AND_ASSIGNMENT(SwarmMemberPtr);
|
||||
|
||||
SwarmMemberPtr() noexcept {}
|
||||
|
||||
|
|
|
@ -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<Mso::RefCountStrategy::NoRefCount, TBaseTy
|
|||
public:
|
||||
using UnknownObjectType = UnknownObject; // To use in derived class as "using Super = UnknownObjectType"
|
||||
|
||||
_MSO_OBJECT_NOREFCOUNT(UnknownObject)
|
||||
MSO_OBJECT_NOREFCOUNT(UnknownObject);
|
||||
|
||||
template <typename... TArgs>
|
||||
UnknownObject(TArgs&&... args) noexcept : Super(std::forward<TArgs>(args)...)
|
||||
|
@ -631,7 +631,7 @@ class DECLSPEC_NOVTABLE UnknownObject<Mso::RefCountStrategy::NoRefCountNoQuery,
|
|||
public:
|
||||
using UnknownObjectType = UnknownObject; // To use in derived class as "using Super = UnknownObjectType"
|
||||
|
||||
_MSO_OBJECT_NOREFCOUNT(UnknownObject)
|
||||
MSO_OBJECT_NOREFCOUNT(UnknownObject);
|
||||
|
||||
template <typename... TArgs>
|
||||
UnknownObject(TArgs&&... args) noexcept : Super(std::forward<TArgs>(args)...)
|
||||
|
@ -668,7 +668,7 @@ class AgileUnknownObject : public UnknownObject<TBaseTypes...>
|
|||
using Super = UnknownObject<TBaseTypes...>;
|
||||
|
||||
public:
|
||||
DECLARE_COPYCONSTR_AND_ASSIGNMENT(AgileUnknownObject)
|
||||
MSO_NO_COPY_CTOR_AND_ASSIGNMENT(AgileUnknownObject);
|
||||
|
||||
template <typename... TArgs>
|
||||
AgileUnknownObject(TArgs&&... args) noexcept : Super(std::forward<TArgs>(args)...)
|
||||
|
|
|
@ -25,7 +25,7 @@ class CountedType final : public Mso::RefCountedObject<Mso::RefCountStrategy::We
|
|||
friend MakePolicy;
|
||||
|
||||
public:
|
||||
DECLARE_COPYCONSTR_AND_ASSIGNMENT(CountedType)
|
||||
MSO_NO_COPY_CTOR_AND_ASSIGNMENT(CountedType);
|
||||
|
||||
int GetCallCount() const noexcept override
|
||||
{
|
||||
|
@ -78,7 +78,7 @@ class UnknownType final : public Mso::UnknownObject<Mso::RefCountStrategy::WeakR
|
|||
friend MakePolicy;
|
||||
|
||||
public:
|
||||
DECLARE_COPYCONSTR_AND_ASSIGNMENT(UnknownType)
|
||||
MSO_NO_COPY_CTOR_AND_ASSIGNMENT(UnknownType);
|
||||
|
||||
int GetArgument0() const noexcept override
|
||||
{
|
||||
|
|
|
@ -541,7 +541,7 @@ class BadRefCountedObject1 final
|
|||
friend MakePolicy; // To allow constructor to be private or protected.
|
||||
|
||||
public:
|
||||
DECLARE_COPYCONSTR_AND_ASSIGNMENT(BadRefCountedObject1);
|
||||
MSO_NO_COPY_CTOR_AND_ASSIGNMENT(BadRefCountedObject1);
|
||||
|
||||
virtual int GetValue1() override
|
||||
{
|
||||
|
|
|
@ -39,7 +39,7 @@ struct MyMemHeap : public IMyMemHeap
|
|||
{
|
||||
MyMemHeap(bool& allocCalled, bool& freeCalled) noexcept : m_allocCalled(allocCalled), m_freeCalled(freeCalled) {}
|
||||
|
||||
DECLARE_COPYCONSTR_AND_ASSIGNMENT(MyMemHeap)
|
||||
MSO_NO_COPY_CTOR_AND_ASSIGNMENT(MyMemHeap);
|
||||
|
||||
virtual void* Alloc(size_t size) noexcept override
|
||||
{
|
||||
|
|
|
@ -932,7 +932,7 @@ class BadUnknownObject1 final
|
|||
friend MakePolicy; // To allow constructor to be private or protected.
|
||||
|
||||
public:
|
||||
DECLARE_COPYCONSTR_AND_ASSIGNMENT(BadUnknownObject1);
|
||||
MSO_NO_COPY_CTOR_AND_ASSIGNMENT(BadUnknownObject1);
|
||||
|
||||
virtual int GetValue1() const override
|
||||
{
|
||||
|
|
|
@ -63,7 +63,7 @@ class TRefCountedImpl : public TInterfaces...
|
|||
OACR_MARK_CLASS_DEPRECATED(Mso::RefCountedObject)
|
||||
|
||||
public:
|
||||
DECLARE_COPYCONSTR_AND_ASSIGNMENT(TRefCountedImpl)
|
||||
MSO_NO_COPY_CTOR_AND_ASSIGNMENT(TRefCountedImpl);
|
||||
|
||||
virtual void AddRef() const noexcept override
|
||||
{
|
||||
|
|
|
@ -44,7 +44,7 @@ public:
|
|||
std::remove_pointer_t<TArrowType>>::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<THolderPairData<T, TData>, THelper>
|
|||
using _Myt = THolderPair<T, TData, THelper>;
|
||||
|
||||
public:
|
||||
DECLARE_COPYCONSTR_AND_ASSIGNMENT(THolderPair)
|
||||
MSO_NO_COPY_CTOR_AND_ASSIGNMENT(THolderPair);
|
||||
|
||||
using Super = THolder<THolderPairData<T, TData>, THelper>;
|
||||
using TRefType = typename std::
|
||||
|
|
|
@ -60,7 +60,7 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
DECLARE_COPYCONSTR_AND_ASSIGNMENT(TOwnerPtr<T>)
|
||||
MSO_NO_COPY_CTOR_AND_ASSIGNMENT(TOwnerPtr<T>);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -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);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче