CG: Update async to resolve CVE-2021-43138 (#9837)

* CG: Update async to resolve CVE-2021-43138

This PR updates our dependency on async.

* Change files

* yarn format

* Change files

* lint fix
This commit is contained in:
Jon Thysell 2022-04-19 09:12:17 -07:00 коммит произвёл GitHub
Родитель afe9bf0154
Коммит 3f85b243ff
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
68 изменённых файлов: 243 добавлений и 231 удалений

Просмотреть файл

@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "CG: Update async to resolve CVE-2021-43138",
"packageName": "@rnw-scripts/format-files",
"email": "jthysell@microsoft.com",
"dependentChangeType": "patch"
}

Просмотреть файл

@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "CG: Update async to resolve CVE-2021-43138",
"packageName": "@rnw-scripts/integrate-rn",
"email": "jthysell@microsoft.com",
"dependentChangeType": "patch"
}

Просмотреть файл

@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "CG: Update async to resolve CVE-2021-43138",
"packageName": "react-native-platform-override",
"email": "jthysell@microsoft.com",
"dependentChangeType": "patch"
}

Просмотреть файл

@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "CG: Update async to resolve CVE-2021-43138",
"packageName": "react-native-windows",
"email": "jthysell@microsoft.com",
"dependentChangeType": "patch"
}

Просмотреть файл

@ -18,8 +18,8 @@
"format-files": "./bin.js"
},
"dependencies": {
"async": "^3.2.0",
"clang-format": "1.5.0",
"async": "^3.2.3",
"clang-format": "^1.7.0",
"source-map-support": "^0.5.19"
},
"devDependencies": {
@ -40,4 +40,4 @@
"engines": {
"node": ">= 14"
}
}
}

Просмотреть файл

@ -22,7 +22,7 @@
"@react-native-windows/find-repo-root": "^0.0.0-canary.31",
"@react-native-windows/fs": "^0.0.0-canary.2",
"@react-native-windows/package-utils": "^0.0.0-canary.28",
"async": "^3.2.0",
"async": "^3.2.3",
"lodash": "^4.17.15",
"ora": "^3.4.0",
"react-native-platform-override": "^1.6.9",
@ -59,4 +59,4 @@
"engines": {
"node": ">= 14"
}
}
}

Просмотреть файл

@ -24,7 +24,7 @@
"dependencies": {
"@react-native-windows/fs": "^0.0.0-canary.2",
"@react-native-windows/package-utils": "^0.0.0-canary.28",
"async": "^3.2.0",
"async": "^3.2.3",
"chalk": "^4.1.0",
"fp-ts": "^2.5.0",
"globby": "^9.2.0",
@ -83,4 +83,4 @@
"!lib-commonjs/e2etest/**",
"!lib-commonjs/test/**"
]
}
}

Просмотреть файл

@ -168,7 +168,7 @@ TEST_CLASS (DynamicReaderWriterTests) {
private:
template <class TWriterValue, class TReaderValue = TWriterValue>
void TestScalar(
void (IJSValueWriter::*writerMethod)(TWriterValue) const,
void(IJSValueWriter::*writerMethod)(TWriterValue) const,
TReaderValue (IJSValueReader::*readerMethod)() const,
JSValueType runtimeType,
TWriterValue value) {

Просмотреть файл

@ -303,10 +303,8 @@ struct NestedObjectWithPrimitiveValues {
// on DynamicReader+DynamicWriter and JsiReader+JsiWriter
// in this way we ensure that two implementation behaves exactly the same
#define IMPORT_READER_TEST_CASE(name) \
TEST_METHOD(name) { \
RunReaderTest<ReaderTestCases::name>(); \
}
#define IMPORT_READER_TEST_CASE(name) \
TEST_METHOD(name) { RunReaderTest<ReaderTestCases::name>(); }
#define IMPORT_ARGUMENT_READER_TEST_CASES \
IMPORT_READER_TEST_CASE(EmptyArray) \

Просмотреть файл

@ -21,21 +21,21 @@ struct ReactModuleBuilderMock {
ReactModuleBuilderMock() noexcept;
template <class... TArgs>
void Call0(std::wstring const &methodName, TArgs &&... args) noexcept;
void Call0(std::wstring const &methodName, TArgs &&...args) noexcept;
template <class... TArgs, class... TReasolveArgs>
Mso::Future<bool>
Call1(std::wstring const &methodName, std::function<void(TReasolveArgs...)> &&resolve, TArgs &&... args) noexcept;
Call1(std::wstring const &methodName, std::function<void(TReasolveArgs...)> &&resolve, TArgs &&...args) noexcept;
template <class... TArgs, class... TResolveArgs, class... TRejectArgs>
Mso::Future<bool> Call2(
std::wstring const &methodName,
std::function<void(TResolveArgs...)> const &resolve,
std::function<void(TRejectArgs...)> const &reject,
TArgs &&... args) noexcept;
TArgs &&...args) noexcept;
template <class TResult, class... TArgs>
void CallSync(std::wstring const &methodName, TResult &result, TArgs &&... args) noexcept;
void CallSync(std::wstring const &methodName, TResult &result, TArgs &&...args) noexcept;
JSValueObject GetConstants() noexcept;
@ -82,7 +82,7 @@ struct ReactModuleBuilderMock {
static IJSValueWriter ArgWriter() noexcept;
template <class... TArgs>
static IJSValueReader ArgReader(TArgs &&... args) noexcept;
static IJSValueReader ArgReader(TArgs &&...args) noexcept;
static IJSValueReader CreateArgReader(std::function<void(IJSValueWriter const &)> const &argWriter) noexcept;
template <class... TArgs, size_t... I>
@ -216,7 +216,7 @@ struct ReactModuleBuilderImpl : implements<ReactModuleBuilderImpl, IReactModuleB
//===========================================================================
template <class... TArgs>
inline void ReactModuleBuilderMock::Call0(std::wstring const &methodName, TArgs &&... args) noexcept {
inline void ReactModuleBuilderMock::Call0(std::wstring const &methodName, TArgs &&...args) noexcept {
if (auto method = GetMethod0(methodName)) {
method(ArgReader(std::forward<TArgs>(args)...), ArgWriter(), nullptr, nullptr);
}
@ -226,7 +226,7 @@ template <class... TArgs, class... TResolveArgs>
inline Mso::Future<bool> ReactModuleBuilderMock::Call1(
std::wstring const &methodName,
std::function<void(TResolveArgs...)> &&resolve,
TArgs &&... args) noexcept {
TArgs &&...args) noexcept {
Mso::Promise<bool> promise;
if (auto method = GetMethod1(methodName)) {
method(
@ -243,7 +243,7 @@ inline Mso::Future<bool> ReactModuleBuilderMock::Call2(
std::wstring const &methodName,
std::function<void(TResolveArgs...)> const &resolve,
std::function<void(TRejectArgs...)> const &reject,
TArgs &&... args) noexcept {
TArgs &&...args) noexcept {
Mso::Promise<bool> promise;
if (auto method = GetMethod2(methodName)) {
method(
@ -257,7 +257,7 @@ inline Mso::Future<bool> ReactModuleBuilderMock::Call2(
template <class TResult, class... TArgs>
inline void
ReactModuleBuilderMock::CallSync(std::wstring const &methodName, TResult &result, TArgs &&... args) noexcept {
ReactModuleBuilderMock::CallSync(std::wstring const &methodName, TResult &result, TArgs &&...args) noexcept {
if (auto method = GetSyncMethod(methodName)) {
auto writer = ArgWriter();
method(ArgReader(std::forward<TArgs>(args)...), writer);
@ -266,7 +266,7 @@ ReactModuleBuilderMock::CallSync(std::wstring const &methodName, TResult &result
}
template <class... TArgs>
inline /*static*/ IJSValueReader ReactModuleBuilderMock::ArgReader(TArgs &&... args) noexcept {
inline /*static*/ IJSValueReader ReactModuleBuilderMock::ArgReader(TArgs &&...args) noexcept {
return CreateArgReader(
[&args...](IJSValueWriter const &writer) mutable noexcept { WriteArgs(writer, std::forward<TArgs>(args)...); });
}

Просмотреть файл

@ -92,7 +92,7 @@ __declspec(selectany) std::unordered_map<std::wstring, IndirectLibrary> indirect
} // namespace details
template <typename TFn, typename... TArgs>
auto CallIndirect(const wchar_t *dllName, const char *fnName, TArgs &&... args) noexcept {
auto CallIndirect(const wchar_t *dllName, const char *fnName, TArgs &&...args) noexcept {
if (details::indirectLibraries.count(dllName) == 0) {
details::indirectLibraries.emplace(dllName, WINRT_IMPL_LoadLibraryW(dllName));
}

Просмотреть файл

@ -1003,7 +1003,7 @@ size_t JsiAbiRuntime::ValueRefArray::Size() const noexcept {
//===========================================================================
JsiAbiRuntime::PropNameIDRef::PropNameIDRef(JsiPropertyIdRef const &data) noexcept
: m_propertyId{make<PropNameID>(new (std::addressof(m_pointerStore)) DataPointerValue(data.Data))} {}
: m_propertyId{make<PropNameID>(new(std::addressof(m_pointerStore)) DataPointerValue(data.Data))} {}
JsiAbiRuntime::PropNameIDRef::~PropNameIDRef() noexcept {}

Просмотреть файл

@ -1254,7 +1254,7 @@ size_t NapiJsiRuntime::JsiValueViewArgs::Size() const noexcept {
#pragma region PropNameIDView
NapiJsiRuntime::PropNameIDView::PropNameIDView(NapiJsiRuntime *runtime, napi_value propertyId) noexcept
: m_propertyId{make<PropNameID>(new (std::addressof(m_pointerStore)) NapiPointerValueView{runtime, propertyId})} {}
: m_propertyId{make<PropNameID>(new(std::addressof(m_pointerStore)) NapiPointerValueView{runtime, propertyId})} {}
NapiJsiRuntime::PropNameIDView::operator PropNameID const &() const noexcept {
return m_propertyId;

Просмотреть файл

@ -90,7 +90,7 @@ void ReadValue(IJSValueReader const &reader, /*out*/ T &value) noexcept;
bool SkipArrayToEnd(IJSValueReader const &reader) noexcept;
template <class... TArgs>
void ReadArgs(IJSValueReader const &reader, /*out*/ TArgs &... args) noexcept;
void ReadArgs(IJSValueReader const &reader, /*out*/ TArgs &...args) noexcept;
//===========================================================================
// IJSValueReader extensions implementation
@ -432,7 +432,7 @@ inline bool SkipArrayToEnd(IJSValueReader const &reader) noexcept {
}
template <class... TArgs>
inline void ReadArgs(IJSValueReader const &reader, /*out*/ TArgs &... args) noexcept {
inline void ReadArgs(IJSValueReader const &reader, /*out*/ TArgs &...args) noexcept {
// Read as many arguments as we can or return default values.
bool success = reader.ValueType() == JSValueType::Array;
((success = success && reader.GetNextArrayItem(), args = success ? ReadValue<TArgs>(reader) : TArgs{}), ...);

Просмотреть файл

@ -64,10 +64,10 @@ template <class T>
void WriteProperties(IJSValueWriter const &writer, T const &value) noexcept;
template <class... TArgs>
void WriteArgs(IJSValueWriter const &writer, TArgs const &... args) noexcept;
void WriteArgs(IJSValueWriter const &writer, TArgs const &...args) noexcept;
template <class... TArgs>
JSValueArgWriter MakeJSValueArgWriter(TArgs &&... args) noexcept;
JSValueArgWriter MakeJSValueArgWriter(TArgs &&...args) noexcept;
IJSValueWriter MakeJSValueTreeWriter() noexcept;
@ -264,7 +264,7 @@ inline void WriteProperties(IJSValueWriter const &writer, T const &value) noexce
}
template <class... TArgs>
inline void WriteArgs(IJSValueWriter const &writer, TArgs const &... args) noexcept {
inline void WriteArgs(IJSValueWriter const &writer, TArgs const &...args) noexcept {
writer.WriteArrayBegin();
(WriteValue(writer, args), ...);
writer.WriteArrayEnd();
@ -276,7 +276,7 @@ inline JSValueArgWriter MakeJSValueArgWriter(T &&argWriter) noexcept {
}
template <class... TArgs>
inline JSValueArgWriter MakeJSValueArgWriter(TArgs &&... args) noexcept {
inline JSValueArgWriter MakeJSValueArgWriter(TArgs &&...args) noexcept {
return [&args...](IJSValueWriter const &writer) noexcept { WriteArgs(writer, args...); };
}
@ -286,7 +286,7 @@ inline JSValueArgWriter MakeJSValueWriter(T &&argWriter) noexcept {
}
template <class... TArgs>
inline JSValueArgWriter MakeJSValueWriter(TArgs &&... args) noexcept {
inline JSValueArgWriter MakeJSValueWriter(TArgs &&...args) noexcept {
return [&args...](IJSValueWriter const &[[maybe_unused]] writer) noexcept { (WriteValue(writer, args), ...); };
}

Просмотреть файл

@ -280,7 +280,7 @@ struct IsPromise<ReactPromise<T>> : std::true_type {};
template <class TArgsTuple>
constexpr size_t GetPromiseCount() noexcept {
if constexpr (
std::tuple_size_v<TArgsTuple> > 0 &&
std::tuple_size_v < TArgsTuple >> 0 &&
IsPromise<TupleElementOrVoid<std::tuple_size_v<TArgsTuple> - 1, TArgsTuple>>::value) {
return 1;
} else {

Просмотреть файл

@ -53,7 +53,7 @@ struct ReactContext {
// Call methodName JS function of module with moduleName.
// args are either function arguments or a single lambda with 'IJSValueWriter const&' argument.
template <class... TArgs>
void CallJSFunction(std::wstring_view moduleName, std::wstring_view methodName, TArgs &&... args) const noexcept {
void CallJSFunction(std::wstring_view moduleName, std::wstring_view methodName, TArgs &&...args) const noexcept {
m_handle.CallJSFunction(moduleName, methodName, MakeJSValueArgWriter(std::forward<TArgs>(args)...));
}
@ -61,7 +61,7 @@ struct ReactContext {
// Call eventName JS event of module with eventEmitterName.
// args are either function arguments or a single lambda with 'IJSValueWriter const&' argument.
template <class... TArgs>
void EmitJSEvent(std::wstring_view eventEmitterName, std::wstring_view eventName, TArgs &&... args) const noexcept {
void EmitJSEvent(std::wstring_view eventEmitterName, std::wstring_view eventName, TArgs &&...args) const noexcept {
m_handle.EmitJSEvent(eventEmitterName, eventName, MakeJSValueWriter(std::forward<TArgs>(args)...));
}
@ -69,7 +69,7 @@ struct ReactContext {
// Dispatch eventName event to the view.
// args are either function arguments or a single lambda with 'IJSValueWriter const&' argument.
template <class... TArgs>
void DispatchEvent(xaml::FrameworkElement const &view, std::wstring_view eventName, TArgs &&... args) const noexcept {
void DispatchEvent(xaml::FrameworkElement const &view, std::wstring_view eventName, TArgs &&...args) const noexcept {
XamlUIService::FromContext(m_handle).DispatchEvent(
view, eventName, MakeJSValueWriter(std::forward<TArgs>(args)...));
}

Просмотреть файл

@ -22,7 +22,7 @@ template <class T>
struct ReactNonAbiValue : implements<ReactNonAbiValue<T>, IReactNonAbiValue> {
// Create ReactNonAbiValue and construct the wrapped value.
template <class... TArgs>
ReactNonAbiValue(TArgs &&... args) noexcept : m_value{std::forward<TArgs>(args)...} {}
ReactNonAbiValue(TArgs &&...args) noexcept : m_value{std::forward<TArgs>(args)...} {}
// Get a pointer to the wrapped value.
int64_t GetPtr() const noexcept {
@ -47,7 +47,7 @@ template <class T>
struct ReactNonAbiValue : Windows::Foundation::IInspectable {
// Create a new instance of implementation::ReactNonAbiValue with args and keep a ref-counted pointer to it.
template <class... TArgs>
ReactNonAbiValue(std::in_place_t, TArgs &&... args) noexcept
ReactNonAbiValue(std::in_place_t, TArgs &&...args) noexcept
: IInspectable{make<implementation::ReactNonAbiValue<T>>(std::forward<TArgs>(args)...)} {}
// Create an empty ReactNonAbiValue.
@ -100,7 +100,7 @@ struct ReactNonAbiValue : Windows::Foundation::IInspectable {
// Call the call operator() for the stored value.
// Crash the app if ReactNonAbiValue is empty.
template <class... TArgs>
auto operator()(TArgs &&... args) const {
auto operator()(TArgs &&...args) const {
return (*GetPtr())(std::forward<TArgs>(args)...);
}
};

Просмотреть файл

@ -140,9 +140,9 @@ bool DynamicReader::GetBoolean() noexcept {
}
int64_t DynamicReader::GetInt64() noexcept {
return (m_current->type() == folly::dynamic::Type::INT64)
? m_current->getInt()
: (m_current->type() == folly::dynamic::Type::DOUBLE) ? static_cast<int64_t>(m_current->getDouble()) : 0;
return (m_current->type() == folly::dynamic::Type::INT64) ? m_current->getInt()
: (m_current->type() == folly::dynamic::Type::DOUBLE) ? static_cast<int64_t>(m_current->getDouble())
: 0;
}
double DynamicReader::GetDouble() noexcept {

Просмотреть файл

@ -13,7 +13,7 @@
#pragma warning(push)
#pragma warning(disable : 4244 4305)
//#include <react/renderer/components/view/ViewProps.h>
// #include <react/renderer/components/view/ViewProps.h>
#pragma warning(pop)
namespace Microsoft::ReactNative {

Просмотреть файл

@ -13,7 +13,7 @@
#pragma warning(push)
#pragma warning(disable : 4244 4305)
//#include <react/renderer/components/view/ViewProps.h>
// #include <react/renderer/components/view/ViewProps.h>
#pragma warning(pop)
namespace Microsoft::ReactNative {

Просмотреть файл

@ -4,7 +4,7 @@
#pragma once
#if !MS_TARGET_APPLE
//#include <msoFolly/MsoFolly.h>
// #include <msoFolly/MsoFolly.h>
#endif
#pragma warning(push)

Просмотреть файл

@ -205,8 +205,8 @@ void DevMenuManager::CreateAndShowUI() noexcept {
if (Mso::React::ReactOptions::JsiEngine(m_context->Properties()) == Mso::React::JSIEngine::Hermes) {
m_samplingProfilerRevoker = devMenu.SamplingProfiler().Click(
winrt::auto_revoke,
[wkThis = weak_from_this()](
auto & /*sender*/, xaml::RoutedEventArgs const & /*args*/) noexcept -> winrt::fire_and_forget {
[wkThis = weak_from_this()](auto & /*sender*/, xaml::RoutedEventArgs const & /*args*/) noexcept
-> winrt::fire_and_forget {
if (auto strongThis = wkThis.lock()) {
strongThis->Hide();
if (!Microsoft::ReactNative::HermesSamplingProfiler::IsStarted()) {

Просмотреть файл

@ -231,7 +231,7 @@ bool FrameworkElementViewManager::UpdateProperty(
}
if (!element.IsLoaded()) {
element.Loaded([=](auto sender, auto &&) -> auto {
element.Loaded([=](auto sender, auto &&) -> auto{
ApplyTransformMatrix(sender.as<xaml::UIElement>(), nodeToUpdate, transformMatrix);
});
} else {

Просмотреть файл

@ -141,14 +141,10 @@ class EffectBase : public winrt::implements<EffectBase, abi::IGraphicsEffectD2D1
#pragma push_macro("DECLARE_SOURCE")
#undef DECLARE_SOURCE
#define DECLARE_SOURCE(Name) \
winrt::IGraphicsEffectSource m_##Name; \
winrt::IGraphicsEffectSource Name() { \
return m_##Name; \
} \
void Name(winrt::IGraphicsEffectSource const &value) { \
m_##Name = value; \
}
#define DECLARE_SOURCE(Name) \
winrt::IGraphicsEffectSource m_##Name; \
winrt::IGraphicsEffectSource Name() { return m_##Name; } \
void Name(winrt::IGraphicsEffectSource const &value) { m_##Name = value; }
#pragma push_macro("DECLARE_SINGLE_SOURCE")
#undef DECLARE_SINGLE_SOURCE
@ -192,9 +188,7 @@ class EffectBase : public winrt::implements<EffectBase, abi::IGraphicsEffectD2D1
Type m_##Name = InitialValue; \
\
public: \
Type Name() { \
return m_##Name; \
} \
Type Name() { return m_##Name; } \
void Name(Type const &value) { \
if (!(0, Condition)) { \
throw winrt::hresult_invalid_argument(); \

Просмотреть файл

@ -259,7 +259,8 @@ winrt::fire_and_forget ReactImage::SetBackground(bool fireLoadEndEvent) {
compositionBrush->TintColor(strong_this->m_tintColor);
const auto surface = fromStream ? winrt::LoadedImageSurface::StartLoadFromStream(memoryStream)
: uri ? winrt::LoadedImageSurface::StartLoadFromUri(uri) : nullptr;
: uri ? winrt::LoadedImageSurface::StartLoadFromUri(uri)
: nullptr;
m_sizeChangedRevoker = strong_this->SizeChanged(
winrt::auto_revoke, [compositionBrush](const auto &, const winrt::SizeChangedEventArgs &args) {

Просмотреть файл

@ -7,7 +7,7 @@
#include "compilerAdapters/cppMacrosDebug.h"
#include "motifCpp/TestCheck.h"
#include "motifCpp/libletawarememleakdetection.h"
//#include "debugHeap/memoryLeakDetection.h"
// #include "debugHeap/memoryLeakDetection.h"
using namespace std::chrono_literals;

Просмотреть файл

@ -16,7 +16,7 @@ struct FailingExecutor {
}
template <class TCallback, class... TArgs>
auto Invoke(TCallback &&callback, TArgs &&... args) noexcept {
auto Invoke(TCallback &&callback, TArgs &&...args) noexcept {
return callback(std::forward<TArgs>(args)...);
}
};

Просмотреть файл

@ -66,7 +66,7 @@ struct MockExecutorOnCancel {
}
template <class Callback, class... TArgs>
auto Invoke(Callback &&callback, TArgs &&... args) noexcept {
auto Invoke(Callback &&callback, TArgs &&...args) noexcept {
TestCheckFail("Must not be invoked");
return callback(std::forward<TArgs>(args)...);
}
@ -83,7 +83,7 @@ struct MockInlineExecutor {
}
template <class Callback, class... TArgs>
auto Invoke(Callback &&callback, TArgs &&... args) noexcept {
auto Invoke(Callback &&callback, TArgs &&...args) noexcept {
return callback(std::forward<TArgs>(args)...);
}
};

Просмотреть файл

@ -5,7 +5,7 @@
#include "motifCpp/testCheck.h"
// Uncomment to see errors
//#define MOTIF_TEST_SHOW_ERRORS
// #define MOTIF_TEST_SHOW_ERRORS
TEST_CLASS (MotifCppTest) {
#ifdef MOTIF_TEST_SHOW_ERRORS

Просмотреть файл

@ -357,7 +357,7 @@ class QueryCastBase1WithArgs : public IQueryCastBase1 {
template <typename T>
struct StructWithBase : public T {
template <typename... Args>
StructWithBase(Args &&... args) : T(std::forward<Args>(args)...) {}
StructWithBase(Args &&...args) : T(std::forward<Args>(args)...) {}
};
// A helper method to call QueryCastTraits::QueryCast.

Просмотреть файл

@ -6,9 +6,9 @@
#include "eventWaitHandle/eventWaitHandle.h"
#include "motifCpp/testCheck.h"
//#define TEST_BAD_INHERITANCE1 // Uncomment to see compilation error
//#define TEST_BAD_INHERITANCE2 // Uncomment to confirm VEC, but observe a memory leak. We cannot safely destroy this
// class.
// #define TEST_BAD_INHERITANCE1 // Uncomment to see compilation error
// #define TEST_BAD_INHERITANCE2 // Uncomment to confirm VEC, but observe a memory leak. We cannot safely destroy this
// class.
struct DECLSPEC_NOVTABLE IRefBaseSample1 : public Mso::IRefCounted {
virtual int GetValue1() = 0;

Просмотреть файл

@ -10,9 +10,9 @@
#include "motifCpp/testCheck.h"
#include "testAllocators.h"
//#define TEST_BAD_INHERITANCE1 // Uncomment to see compilation error
//#define TEST_BAD_INHERITANCE2 // Uncomment to confirm VEC, but observe a memory leak. We cannot safely destroy this
// class.
// #define TEST_BAD_INHERITANCE1 // Uncomment to see compilation error
// #define TEST_BAD_INHERITANCE2 // Uncomment to confirm VEC, but observe a memory leak. We cannot safely destroy this
// class.
MSO_STRUCT_GUID(IBaseSample1, "16872411-FA64-436C-92F4-22FE6B536FC8")
struct DECLSPEC_NOVTABLE IBaseSample1 : public IUnknown {

Просмотреть файл

@ -56,7 +56,7 @@ struct ActiveObjectMakePolicy {
static const bool IsNoExcept{true};
template <typename T, typename TMemoryGuard, typename... TArgs>
static void Make(TMemoryGuard &memoryGuard, TArgs &&... args) noexcept;
static void Make(TMemoryGuard &memoryGuard, TArgs &&...args) noexcept;
};
//! Custom deleter to call Finalize() or FinalizeSync() from the associated queue.
@ -159,7 +159,7 @@ struct ActiveObjectBase : IUnknown {
//=============================================================================================
template <typename T, typename TMemoryGuard, typename... TArgs>
/*static*/ void ActiveObjectMakePolicy::Make(TMemoryGuard &memoryGuard, TArgs &&... args) noexcept {
/*static*/ void ActiveObjectMakePolicy::Make(TMemoryGuard &memoryGuard, TArgs &&...args) noexcept {
memoryGuard.Obj = ::new (memoryGuard.ObjMemory) T{std::forward<TArgs>(args)...};
memoryGuard.ObjMemory = nullptr; // Memory is now controlled by the object. Set to null to avoid memory destruction.

Просмотреть файл

@ -29,11 +29,9 @@
Make the macro act like a statement.
*/
#ifndef __GNUC__
#define Statement(x) \
__pragma(warning(push)) __pragma(warning(disable : 4127 25037)) do { \
x; \
} \
while (0) \
#define Statement(x) \
__pragma(warning(push)) __pragma(warning(disable : 4127 25037)) do { x; } \
while (0) \
__pragma(warning(pop))
#else
#define Statement(x) \

Просмотреть файл

@ -28,7 +28,7 @@ class ErrorProvider final : public IErrorProvider {
ErrorCode MakeErrorCode(const T &errorInfo) const noexcept;
template <class TValue, class... TArgs>
Maybe<TValue> MakeMaybe(TArgs &&... errorArgs) const noexcept;
Maybe<TValue> MakeMaybe(TArgs &&...errorArgs) const noexcept;
// TODO: deprecate this method in favor of TryGetErrorInfo
bool IsOwnedErrorCode(const ErrorCode &errorCode) const noexcept;
@ -87,7 +87,7 @@ ErrorCode ErrorProvider<T, GuidToken>::MakeErrorCode(const T &errorInfo) const n
template <class T, class GuidToken>
template <class TValue, class... TArgs>
Maybe<TValue> ErrorProvider<T, GuidToken>::MakeMaybe(TArgs &&... errorArgs) const noexcept {
Maybe<TValue> ErrorProvider<T, GuidToken>::MakeMaybe(TArgs &&...errorArgs) const noexcept {
return Mso::Maybe<TValue>(MakeErrorCode(T(std::forward<TArgs>(errorArgs)...)));
}

Просмотреть файл

@ -46,14 +46,14 @@ class Maybe {
_Allow_implicit_ctor_ Maybe(T &&value) noexcept;
template <class... TArgs>
explicit Maybe(InPlaceTag, TArgs &&... args) noexcept;
explicit Maybe(InPlaceTag, TArgs &&...args) noexcept;
template <
class TItem,
class... TArgs,
class TDummy =
typename std::enable_if<std::is_constructible<T, std::initializer_list<TItem> &, TArgs &&...>::value>::type>
explicit Maybe(InPlaceTag, std::initializer_list<TItem> il, TArgs &&... args) noexcept;
explicit Maybe(InPlaceTag, std::initializer_list<TItem> il, TArgs &&...args) noexcept;
_Allow_implicit_ctor_ Maybe(const ErrorCode &error) noexcept;
_Allow_implicit_ctor_ Maybe(ErrorCode &&error) noexcept;
@ -163,13 +163,13 @@ Maybe<T>::Maybe(T &&value) noexcept {
template <class T>
template <class... TArgs>
Maybe<T>::Maybe(InPlaceTag, TArgs &&... args) noexcept {
Maybe<T>::Maybe(InPlaceTag, TArgs &&...args) noexcept {
::new (reinterpret_cast<T *>(&reinterpret_cast<char &>(m_value))) T(std::forward<TArgs>(args)...);
}
template <class T>
template <class TItem, class... TArgs, class TDummy>
Maybe<T>::Maybe(InPlaceTag, std::initializer_list<TItem> il, TArgs &&... args) noexcept {
Maybe<T>::Maybe(InPlaceTag, std::initializer_list<TItem> il, TArgs &&...args) noexcept {
::new (reinterpret_cast<T *>(&reinterpret_cast<char &>(m_value))) T(il, std::forward<TArgs>(args)...);
}

Просмотреть файл

@ -161,7 +161,7 @@ class FunctionObjectWrapper final
template <typename T>
FunctionObjectWrapper(T &&func) noexcept : m_func(std::forward<T>(func)) {}
virtual TResult Invoke(TArgs &&... args) noexcept override {
virtual TResult Invoke(TArgs &&...args) noexcept override {
return m_func(std::forward<TArgs>(args)...);
}
@ -180,7 +180,7 @@ class FunctionObjectWrapperThrow final
template <typename T>
FunctionObjectWrapperThrow(T &&func) noexcept : m_func(std::forward<T>(func)) {}
virtual TResult Invoke(TArgs &&... args) override {
virtual TResult Invoke(TArgs &&...args) override {
return m_func(std::forward<TArgs>(args)...);
}
@ -199,7 +199,7 @@ class FunctionPointerWrapper final : public ConstexprFunctorBase<Mso::IFunctor<T
public:
constexpr FunctionPointerWrapper(TFunc func) noexcept : m_func(func) {}
TResult Invoke(TArgs &&... args) noexcept override {
TResult Invoke(TArgs &&...args) noexcept override {
return (*m_func)(std::forward<TArgs>(args)...);
}
@ -216,7 +216,7 @@ class FunctionPointerWrapperThrow final : public ConstexprFunctorBase<Mso::IFunc
public:
constexpr FunctionPointerWrapperThrow(TFunc func) noexcept : m_func(func) {}
TResult Invoke(TArgs &&... args) override {
TResult Invoke(TArgs &&...args) override {
return (*m_func)(std::forward<TArgs>(args)...);
}
@ -234,7 +234,7 @@ class StatelessFunctorWrapper final : public ConstexprFunctorBase<Mso::IFunctor<
public:
constexpr StatelessFunctorWrapper(TFunc &func) noexcept : m_func(func) {}
TResult Invoke(TArgs &&... args) noexcept override {
TResult Invoke(TArgs &&...args) noexcept override {
return m_func(std::forward<TArgs>(args)...);
}
@ -248,7 +248,7 @@ class StatelessFunctorWrapperThrow final : public ConstexprFunctorBase<Mso::IFun
public:
constexpr StatelessFunctorWrapperThrow(TFunc &func) noexcept : m_func(func) {}
TResult Invoke(TArgs &&... args) override {
TResult Invoke(TArgs &&...args) override {
return m_func(std::forward<TArgs>(args)...);
}

Просмотреть файл

@ -178,7 +178,7 @@ class FunctorRef<TResult(TArgs...)>
FunctorRefWrapper &operator=(FunctorRefWrapper const &) = delete;
~FunctorRefWrapper() = delete;
TResult Invoke(TArgs &&... args) const noexcept override {
TResult Invoke(TArgs &&...args) const noexcept override {
// If you see OACR warning "Nothrow Func Throws" here then it means that the
// provided lambda or function object's operator() are not marked as noexcept.
@ -269,7 +269,7 @@ class FunctorRefThrow<TResult(TArgs...)> final {
FunctorRefThrowWrapper &operator=(FunctorRefThrowWrapper const &) = delete;
~FunctorRefThrowWrapper() = delete;
TResult Invoke(TArgs &&... args) const override {
TResult Invoke(TArgs &&...args) const override {
OACR_POSSIBLE_THROW;
// We use const_cast to enable support for mutable lambdas
return (*const_cast<FunctorRefThrowWrapper *>(this)->m_func)(std::forward<TArgs>(args)...);

Просмотреть файл

@ -197,7 +197,7 @@ namespace Internal {
struct ExecutorInvoker {
template <class TCallback, class... TArgs>
auto Invoke(TCallback &&callback, TArgs &&... args) noexcept -> decltype(callback(std::forward<TArgs>(args)...)) {
auto Invoke(TCallback &&callback, TArgs &&...args) noexcept -> decltype(callback(std::forward<TArgs>(args)...)) {
UNREFERENCED_OACR(this);
static_assert(noexcept(callback(std::forward<TArgs>(args)...)), "Callback must not throw.");
return callback(std::forward<TArgs>(args)...);
@ -209,7 +209,7 @@ struct ThrowingExecutor : TBaseExecutor {
using TBaseExecutor::TBaseExecutor;
template <class TCallback, class... TArgs>
auto Invoke(TCallback &&callback, TArgs &&... args) noexcept {
auto Invoke(TCallback &&callback, TArgs &&...args) noexcept {
using TResult = decltype(callback(std::forward<TArgs>(args)...));
constexpr const bool isNoExcept = noexcept(callback(std::forward<TArgs>(args)...));
return Mso::Futures::MaybeInvoker<TResult, isNoExcept>::Invoke(

Просмотреть файл

@ -32,14 +32,14 @@ inline Future<void> MakeCompletedFuture() noexcept {
}
template <class T, class... TArgs>
inline Future<T> MakeCompletedFutureEmplaced(TArgs &&... args) noexcept {
inline Future<T> MakeCompletedFutureEmplaced(TArgs &&...args) noexcept {
Promise<T> promise;
promise.EmplaceValue(std::forward<TArgs>(args)...);
return promise.AsFuture();
}
template <class T, class U, class... TArgs>
inline Future<T> MakeCompletedFutureEmplaced(std::initializer_list<U> il, TArgs &&... args) noexcept {
inline Future<T> MakeCompletedFutureEmplaced(std::initializer_list<U> il, TArgs &&...args) noexcept {
Promise<T> promise;
promise.EmplaceValue(il, std::forward<TArgs>(args)...);
return promise.AsFuture();
@ -59,14 +59,14 @@ inline Future<void> MakeSucceededFuture() noexcept {
}
template <class T, class... TArgs>
inline Future<T> MakeSucceededFutureEmplaced(TArgs &&... args) noexcept {
inline Future<T> MakeSucceededFutureEmplaced(TArgs &&...args) noexcept {
Promise<T> promise;
promise.EmplaceValue(std::forward<TArgs>(args)...);
return promise.AsFuture();
}
template <class T, class U, class... TArgs>
inline Future<T> MakeSucceededFutureEmplaced(std::initializer_list<U> il, TArgs &&... args) noexcept {
inline Future<T> MakeSucceededFutureEmplaced(std::initializer_list<U> il, TArgs &&...args) noexcept {
Promise<T> promise;
promise.EmplaceValue(il, std::forward<TArgs>(args)...);
return promise.AsFuture();

Просмотреть файл

@ -70,7 +70,7 @@ struct IFuture : IUnknown {
virtual void AddContinuation(Mso::CntPtr<IFuture> &&continuation) noexcept = 0;
_Success_(
return ) virtual bool TryStartSetValue(_Out_ ByteArrayView &valueBuffer, bool crashIfFailed = false) noexcept = 0;
return) virtual bool TryStartSetValue(_Out_ ByteArrayView &valueBuffer, bool crashIfFailed = false) noexcept = 0;
virtual void Post() noexcept = 0;
virtual void StartAwaiting() noexcept = 0;
virtual bool TrySetSuccess(bool crashIfFailed = false) noexcept = 0;
@ -81,7 +81,7 @@ struct IFuture : IUnknown {
virtual bool IsFailed() const noexcept = 0;
template <class T, class... TArgs>
void SetValue(TArgs &&... args) noexcept {
void SetValue(TArgs &&...args) noexcept {
ByteArrayView valueBuffer;
(void)TryStartSetValue(/*ref*/ valueBuffer, /*crashIfFailed:*/ true);
::new (valueBuffer.VoidDataChecked(sizeof(T))) T(std::forward<TArgs>(args)...);
@ -89,7 +89,7 @@ struct IFuture : IUnknown {
}
template <class T, class... TArgs>
bool TrySetValue(TArgs &&... args) noexcept {
bool TrySetValue(TArgs &&...args) noexcept {
ByteArrayView valueBuffer;
if (TryStartSetValue(/*ref*/ valueBuffer)) {
::new (valueBuffer.VoidDataChecked(sizeof(T))) T(std::forward<TArgs>(args)...);

Просмотреть файл

@ -15,7 +15,7 @@ namespace Mso::Futures {
template <class TResult, bool isNoExcept>
struct MaybeInvoker {
template <class TCallback, class... TArgs>
static auto Invoke(TCallback &&callback, TArgs &&... args) noexcept {
static auto Invoke(TCallback &&callback, TArgs &&...args) noexcept {
OACR_WARNING_SUPPRESS(UNNECESSARY_TRY_CATCH, "Here we only execute lambdas that have no noexcept");
try {
return Mso::Maybe<TResult>(callback(std::forward<TArgs>(args)...));
@ -29,7 +29,7 @@ struct MaybeInvoker {
template <class TResult>
struct MaybeInvoker<TResult, /*isNoExcept:*/ true> {
template <class TCallback, class... TArgs>
static auto Invoke(TCallback &&callback, TArgs &&... args) noexcept {
static auto Invoke(TCallback &&callback, TArgs &&...args) noexcept {
return Mso::Maybe<TResult>(callback(std::forward<TArgs>(args)...));
}
};
@ -38,7 +38,7 @@ struct MaybeInvoker<TResult, /*isNoExcept:*/ true> {
template <>
struct MaybeInvoker<void, /*isNoExcept:*/ false> {
template <class TCallback, class... TArgs>
static auto Invoke(TCallback &&callback, TArgs &&... args) noexcept {
static auto Invoke(TCallback &&callback, TArgs &&...args) noexcept {
OACR_WARNING_SUPPRESS(UNNECESSARY_TRY_CATCH, "Here we only execute lambdas that have no noexcept");
try {
callback(std::forward<TArgs>(args)...);
@ -53,7 +53,7 @@ struct MaybeInvoker<void, /*isNoExcept:*/ false> {
template <>
struct MaybeInvoker<void, /*isNoExcept:*/ true> {
template <class TCallback, class... TArgs>
static auto Invoke(TCallback &&callback, TArgs &&... args) noexcept {
static auto Invoke(TCallback &&callback, TArgs &&...args) noexcept {
callback(std::forward<TArgs>(args)...);
return Mso::Maybe<void>();
}
@ -63,7 +63,7 @@ struct MaybeInvoker<void, /*isNoExcept:*/ true> {
template <class T>
struct MaybeInvoker<Mso::Maybe<T>, /*isNoExcept:*/ false> {
template <class TCallback, class... TArgs>
static auto Invoke(TCallback &&callback, TArgs &&... args) noexcept {
static auto Invoke(TCallback &&callback, TArgs &&...args) noexcept {
OACR_WARNING_SUPPRESS(UNNECESSARY_TRY_CATCH, "Here we only execute lambdas that have no noexcept");
try {
return callback(std::forward<TArgs>(args)...);
@ -77,7 +77,7 @@ struct MaybeInvoker<Mso::Maybe<T>, /*isNoExcept:*/ false> {
template <class T>
struct MaybeInvoker<Mso::Maybe<T>, /*isNoExcept:*/ true> {
template <class TCallback, class... TArgs>
static auto Invoke(TCallback &&callback, TArgs &&... args) noexcept {
static auto Invoke(TCallback &&callback, TArgs &&...args) noexcept {
return callback(std::forward<TArgs>(args)...);
}
};

Просмотреть файл

@ -103,28 +103,28 @@ inline bool PromiseGroup<T>::TrySetValue(T &&value) const noexcept {
template <class T>
template <class... TArgs>
inline void PromiseGroup<T>::EmplaceValue(TArgs &&... args) const noexcept {
inline void PromiseGroup<T>::EmplaceValue(TArgs &&...args) const noexcept {
VerifyElseCrashSzTag(!m_state.IsEmpty(), "State is empty.", 0x0150d40b /* tag_bunql */);
m_state->SetValue<T>(std::forward<TArgs>(args)...);
}
template <class T>
template <class TArg, class... TArgs>
inline void PromiseGroup<T>::EmplaceValue(std::initializer_list<TArg> init, TArgs &&... args) const noexcept {
inline void PromiseGroup<T>::EmplaceValue(std::initializer_list<TArg> init, TArgs &&...args) const noexcept {
VerifyElseCrashSzTag(!m_state.IsEmpty(), "State is empty.", 0x0150d40c /* tag_bunqm */);
m_state->SetValue<T>(init, std::forward<TArgs>(args)...);
}
template <class T>
template <class... TArgs>
inline bool PromiseGroup<T>::TryEmplaceValue(TArgs &&... args) const noexcept {
inline bool PromiseGroup<T>::TryEmplaceValue(TArgs &&...args) const noexcept {
VerifyElseCrashSzTag(!m_state.IsEmpty(), "State is empty.", 0x0150d40d /* tag_bunqn */);
return m_state->TrySetValue<T>(std::forward<TArgs>(args)...);
}
template <class T>
template <class TArg, class... TArgs>
inline bool PromiseGroup<T>::TryEmplaceValue(std::initializer_list<TArg> init, TArgs &&... args) const noexcept {
inline bool PromiseGroup<T>::TryEmplaceValue(std::initializer_list<TArg> init, TArgs &&...args) const noexcept {
VerifyElseCrashSzTag(!m_state.IsEmpty(), "State is empty.", 0x0150d40e /* tag_bunqo */);
return m_state->TrySetValue<T>(init, std::forward<TArgs>(args)...);
}

Просмотреть файл

@ -132,28 +132,28 @@ inline bool Promise<T>::TrySetValue(Mso::Maybe<T> &&value) const noexcept {
template <class T>
template <class... TArgs>
inline void Promise<T>::EmplaceValue(TArgs &&... args) const noexcept {
inline void Promise<T>::EmplaceValue(TArgs &&...args) const noexcept {
VerifyElseCrashSzTag(!m_state.IsEmpty(), "State is empty.", 0x012ca405 /* tag_blkqf */);
this->m_state->template SetValue<T>(std::forward<TArgs>(args)...);
}
template <class T>
template <class TArg, class... TArgs>
inline void Promise<T>::EmplaceValue(std::initializer_list<TArg> init, TArgs &&... args) const noexcept {
inline void Promise<T>::EmplaceValue(std::initializer_list<TArg> init, TArgs &&...args) const noexcept {
VerifyElseCrashSzTag(!m_state.IsEmpty(), "State is empty.", 0x016056ce /* tag_byf1o */);
m_state->SetValue<T>(init, std::forward<TArgs>(args)...);
}
template <class T>
template <class... TArgs>
inline bool Promise<T>::TryEmplaceValue(TArgs &&... args) const noexcept {
inline bool Promise<T>::TryEmplaceValue(TArgs &&...args) const noexcept {
VerifyElseCrashSzTag(!m_state.IsEmpty(), "State is empty.", 0x012ca406 /* tag_blkqg */);
return m_state->TrySetValue<T>(std::forward<TArgs>(args)...);
}
template <class T>
template <class TArg, class... TArgs>
inline bool Promise<T>::TryEmplaceValue(std::initializer_list<TArg> init, TArgs &&... args) const noexcept {
inline bool Promise<T>::TryEmplaceValue(std::initializer_list<TArg> init, TArgs &&...args) const noexcept {
VerifyElseCrashSzTag(!m_state.IsEmpty(), "State is empty.", 0x016056cf /* tag_byf1p */);
return m_state->TrySetValue<T>(init, std::forward<TArgs>(args)...);
}

Просмотреть файл

@ -75,8 +75,8 @@ template <class TFutureValue, class TExecutor, class TCallback>
struct GetResultTraits<TFutureValue, TExecutor, TCallback, CallbackArgKind::Maybe> {
using Type = ResultTraits<
TFutureValue,
decltype(
std::declval<TExecutor>().Invoke(std::declval<TCallback>(), std::declval<Mso::Maybe<TFutureValue> &&>()))>;
decltype(std::declval<TExecutor>()
.Invoke(std::declval<TCallback>(), std::declval<Mso::Maybe<TFutureValue> &&>()))>;
static_assert(
noexcept(
std::declval<TExecutor>().Invoke(std::declval<TCallback>(), std::declval<Mso::Maybe<TFutureValue> &&>())),
@ -87,8 +87,8 @@ template <class TFutureValue, class TExecutor, class TCallback>
struct GetResultTraits<TFutureValue, TExecutor, TCallback, CallbackArgKind::MaybeRef> {
using Type = ResultTraits<
TFutureValue,
decltype(
std::declval<TExecutor>().Invoke(std::declval<TCallback>(), std::declval<Mso::Maybe<TFutureValue> &>()))>;
decltype(std::declval<TExecutor>()
.Invoke(std::declval<TCallback>(), std::declval<Mso::Maybe<TFutureValue> &>()))>;
static_assert(
noexcept(std::declval<TExecutor>().Invoke(std::declval<TCallback>(), std::declval<Mso::Maybe<TFutureValue> &>())),
"Executor's Invoke method must not throw");

Просмотреть файл

@ -289,7 +289,7 @@ inline Future<void> WhenAll(Future<void> (&futures)[size]) noexcept {
}
template <class T0, class... Ts>
Future<std::tuple<T0, Ts...>> WhenAll(const Future<T0> &future0, const Future<Ts> &... futures) noexcept {
Future<std::tuple<T0, Ts...>> WhenAll(const Future<T0> &future0, const Future<Ts> &...futures) noexcept {
using ResultType = std::tuple<T0, Ts...>;
using TaskType = Mso::Futures::WhenAllFutureTask<void>;
const size_t taskSize = TaskType::GetTaskSize(1 + sizeof...(Ts));

Просмотреть файл

@ -86,11 +86,11 @@ Future<void> MakeCompletedFuture() noexcept;
//! Create an instance of completed Mso::Future<T> from a value created in-place.
template <class T, class... TArgs>
Future<T> MakeCompletedFutureEmplaced(TArgs &&... args) noexcept;
Future<T> MakeCompletedFutureEmplaced(TArgs &&...args) noexcept;
//! Create an instance of completed Mso::Future<T> from a value created in-place.
template <class T, class U, class... TArgs>
Future<T> MakeCompletedFutureEmplaced(std::initializer_list<U> il, TArgs &&... args) noexcept;
Future<T> MakeCompletedFutureEmplaced(std::initializer_list<U> il, TArgs &&...args) noexcept;
//! Create an instance of succeeded Mso::Future<T> from a provided value.
template <class T>
@ -101,11 +101,11 @@ Future<void> MakeSucceededFuture() noexcept;
//! Create an instance of completed Mso::Future<T> from a value created in-place.
template <class T, class... TArgs>
Future<T> MakeSucceededFutureEmplaced(TArgs &&... args) noexcept;
Future<T> MakeSucceededFutureEmplaced(TArgs &&...args) noexcept;
//! Create an instance of completed Mso::Future<T> from a value created in-place.
template <class T, class U, class... TArgs>
Future<T> MakeSucceededFutureEmplaced(std::initializer_list<U> il, TArgs &&... args) noexcept;
Future<T> MakeSucceededFutureEmplaced(std::initializer_list<U> il, TArgs &&...args) noexcept;
//! Create an instance of Mso::Future<T> with error code.
template <class T>
@ -169,7 +169,7 @@ LIBLET_PUBLICAPI Future<void> WhenAll(const std::vector<Future<void>> &futures)
//! Each future may have its own return type.
//! Returns Future<std::tuple<Ts...>>.
template <class T0, class... Ts>
Future<std::tuple<T0, Ts...>> WhenAll(const Future<T0> &future0, const Future<Ts> &... futures) noexcept;
Future<std::tuple<T0, Ts...>> WhenAll(const Future<T0> &future0, const Future<Ts> &...futures) noexcept;
//=============================================================================
// Mso::WhenAny overloads.
@ -315,19 +315,19 @@ struct Promise {
/// Sets the value in-place and completes the Promise. It can be called only once. Otherwise it crashes the app.
template <class... TArgs>
void EmplaceValue(TArgs &&... args) const noexcept;
void EmplaceValue(TArgs &&...args) const noexcept;
/// Sets the value in-place and completes the PromiseGroup. It can be called only once. Otherwise it VECs.
template <class TArg, class... TArgs>
void EmplaceValue(std::initializer_list<TArg> init, TArgs &&... args) const noexcept;
void EmplaceValue(std::initializer_list<TArg> init, TArgs &&...args) const noexcept;
/// Tries to set the value in-place if Promise is not completed or abandoned yet. Returns true on success.
template <class... TArgs>
bool TryEmplaceValue(TArgs &&... args) const noexcept;
bool TryEmplaceValue(TArgs &&...args) const noexcept;
/// Tries to set the value in-place if PromiseGroup is not completed or abandoned yet. Returns true on success.
template <class TArg, class... TArgs>
bool TryEmplaceValue(std::initializer_list<TArg> init, TArgs &&... args) const noexcept;
bool TryEmplaceValue(std::initializer_list<TArg> init, TArgs &&...args) const noexcept;
/// Tries to set Promise to Failed state with a CancellationError. Returns true if cancel succeeded.
bool TryCancel() const noexcept;
@ -809,19 +809,19 @@ struct PromiseGroup {
/// Sets the value in-place and completes the PromiseGroup. It can be called only once. Otherwise it VECs.
template <class... TArgs>
void EmplaceValue(TArgs &&... args) const noexcept;
void EmplaceValue(TArgs &&...args) const noexcept;
/// Sets the value in-place and completes the PromiseGroup. It can be called only once. Otherwise it VECs.
template <class TArg, class... TArgs>
void EmplaceValue(std::initializer_list<TArg> init, TArgs &&... args) const noexcept;
void EmplaceValue(std::initializer_list<TArg> init, TArgs &&...args) const noexcept;
/// Tries to set the value in-place if PromiseGroup is not completed or abandoned yet. Returns true on success.
template <class... TArgs>
bool TryEmplaceValue(TArgs &&... args) const noexcept;
bool TryEmplaceValue(TArgs &&...args) const noexcept;
/// Tries to set the value in-place if PromiseGroup is not completed or abandoned yet. Returns true on success.
template <class TArg, class... TArgs>
bool TryEmplaceValue(std::initializer_list<TArg> init, TArgs &&... args) const noexcept;
bool TryEmplaceValue(std::initializer_list<TArg> init, TArgs &&...args) const noexcept;
/// Tries to set Promise to Failed state with the provided error code. It crashes app if error code cannot be set.
void SetError(const ErrorCode &errorCode) const noexcept;

Просмотреть файл

@ -16,7 +16,7 @@ See the msoGuid.h for the usage guidelines.
#endif
// Clang compiler must target C++11 or up to support MSO*GUIDs because we rely on constexpr.
//#if (__cplusplus >= 201103L) && !defined(MSO_GUID_DISABLED)
// #if (__cplusplus >= 201103L) && !defined(MSO_GUID_DISABLED)
#include "compilerAdapters/compilerFeatures.h"
#if MS_TARGET_POSIX

Просмотреть файл

@ -30,7 +30,7 @@ namespace Details {
template <typename T>
struct Emplacer {
template <typename... Args>
static void Place(_Inout_updates_bytes_all_(sizeof(T)) void *mem, Args &&... args) noexcept {
static void Place(_Inout_updates_bytes_all_(sizeof(T)) void *mem, Args &&...args) noexcept {
new (mem) T(std::forward<Args>(args)...);
}
};
@ -38,7 +38,7 @@ struct Emplacer {
template <typename T, size_t N>
struct Emplacer<T[N]> {
template <typename... Args>
static void Place(void *mem, Args &&... args) {
static void Place(void *mem, Args &&...args) {
new (mem) T[N]{std::forward<Args>(args)...};
}
};
@ -116,14 +116,18 @@ Disambiguator used to ensure a throwing new
new (Mso::Memory::throwNew) Zoo();
*/
OACR_WARNING_SUPPRESS(SPECIFY_SELECTANY, "Not needed for marker type")
static const struct throwNew_t { throwNew_t() noexcept = default; } throwNew;
static const struct throwNew_t {
throwNew_t() noexcept = default;
} throwNew;
/**
Disambiguator used to ensure a crashing new
new (Mso::Memory::failFast) Zoo();
*/
OACR_WARNING_SUPPRESS(SPECIFY_SELECTANY, "Not needed for marker type")
static const struct failFast_t { failFast_t() noexcept = default; } failFast;
static const struct failFast_t {
failFast_t() noexcept = default;
} failFast;
/**
Construct a object of type `T` stored at `mem`.
@ -131,7 +135,7 @@ Construct a object of type `T` stored at `mem`.
Arguments are forwarded to constructor of `T`.
*/
template <typename T, typename... Args>
static void Place(__inout_bcount(sizeof(T)) void *mem, Args &&... args) {
static void Place(__inout_bcount(sizeof(T)) void *mem, Args &&...args) {
Details::Emplacer<T>::Place(mem, std::forward<Args>(args)...);
}
@ -187,7 +191,9 @@ namespace NoThrow {
new (Mso::Memory::NoThrow::MarkingLeak) Zoo();
*/
OACR_WARNING_SUPPRESS(SPECIFY_SELECTANY, "Not needed for marker type")
static const struct MarkingLeak_t { MarkingLeak_t() noexcept = default; } MarkingLeak;
static const struct MarkingLeak_t {
MarkingLeak_t() noexcept = default;
} MarkingLeak;
} // namespace NoThrow
} // namespace Memory
@ -205,7 +211,7 @@ Allocates object T by passing args to its constructor.
*/
template <typename T, typename... TArgs>
OACR_WARNING_SUPPRESS(NULL_ON_NON_POINTER, "false positive")
_Ret_notnull_ T *New(TArgs &&... t) {
_Ret_notnull_ T *New(TArgs &&...t) {
Debug(Mso::Memory::AutoShutdownLeakScope scope);
T *pT = new (std::nothrow) T(std::forward<TArgs>(t)...);
if (pT == nullptr)

Просмотреть файл

@ -32,7 +32,7 @@ struct GTestFixture : ::testing::Test {
std::unique_ptr<TestClass> m_test;
};
template <int &... ExplicitParameterBarrier, typename Factory>
template <int &...ExplicitParameterBarrier, typename Factory>
inline auto RegisterTest(
const char *test_suite_name,
const char *test_name,

Просмотреть файл

@ -31,15 +31,13 @@
\
struct className : Mso::UnitTests::Internal::TestClassBase<className, TestClassInfo_##className>
#define TEST_METHOD(methodName) \
struct TestMethodInfo_##methodName final \
: Mso::UnitTests::Internal::TestMethodInfoReg<TestMethodInfo_##methodName> { \
TestMethodInfo_##methodName() : TestMethodInfoRegType{TestClassInfoType::Instance, #methodName, __LINE__} {} \
\
void Invoke(Mso::UnitTests::TestClass &test) const override { \
static_cast<TestClassType &>(test).methodName(); \
} \
}; \
#define TEST_METHOD(methodName) \
struct TestMethodInfo_##methodName final \
: Mso::UnitTests::Internal::TestMethodInfoReg<TestMethodInfo_##methodName> { \
TestMethodInfo_##methodName() : TestMethodInfoRegType{TestClassInfoType::Instance, #methodName, __LINE__} {} \
\
void Invoke(Mso::UnitTests::TestClass &test) const override { static_cast<TestClassType &>(test).methodName(); } \
}; \
virtual void methodName()
#define TESTMETHOD_REQUIRES_SEH(methodName) TEST_METHOD(methodName)

Просмотреть файл

@ -23,7 +23,7 @@ namespace Mso {
// ValidateObject throws, or when some of the lambda's are inlined...
template <typename T, typename TResult = T, typename... TArgs>
inline Mso::CntPtr<TResult> Make(TArgs &&... args) noexcept(T::MakePolicy::IsNoExcept) {
inline Mso::CntPtr<TResult> Make(TArgs &&...args) noexcept(T::MakePolicy::IsNoExcept) {
typename T::RefCountPolicy::template MemoryGuard<T> memoryGuard = {};
T::RefCountPolicy::AllocateMemory(memoryGuard);
VerifyAllocElseCrashTag(memoryGuard.ObjMemory, 0x01117748 /* tag_bex3i */);
@ -47,7 +47,7 @@ inline Mso::CntPtr<TResult> Make(TArgs &&... args) noexcept(T::MakePolicy::IsNoE
Method MakeAlloc is noexcept depending on the Make policy IsNoExcept value.
*/
template <typename T, typename TResult = T, typename TAllocArg, typename... TArgs>
inline Mso::CntPtr<TResult> MakeAlloc(TAllocArg &&allocArg, TArgs &&... args) noexcept(T::MakePolicy::IsNoExcept) {
inline Mso::CntPtr<TResult> MakeAlloc(TAllocArg &&allocArg, TArgs &&...args) noexcept(T::MakePolicy::IsNoExcept) {
typename T::RefCountPolicy::template MemoryGuard<T> memoryGuard = {};
T::RefCountPolicy::AllocateMemory(memoryGuard, std::forward<TAllocArg>(allocArg));
VerifyAllocElseCrashTag(memoryGuard.ObjMemory, 0x01117749 /* tag_bex3j */);
@ -70,7 +70,7 @@ inline Mso::CntPtr<TResult> MakeAlloc(TAllocArg &&allocArg, TArgs &&... args) no
Method MakeElseNull is noexcept depending on the Make policy IsNoExcept value.
*/
template <typename T, typename TResult = T, typename... TArgs>
inline Mso::CntPtr<TResult> MakeElseNull(TArgs &&... args) noexcept(T::MakePolicy::IsNoExcept) {
inline Mso::CntPtr<TResult> MakeElseNull(TArgs &&...args) noexcept(T::MakePolicy::IsNoExcept) {
Mso::CntPtr<TResult> result; // Hopefully we can benefit from NRVO
typename T::RefCountPolicy::template MemoryGuard<T> memoryGuard = {};
@ -98,7 +98,7 @@ inline Mso::CntPtr<TResult> MakeElseNull(TArgs &&... args) noexcept(T::MakePolic
Method MakeAllocElseNull is noexcept depending on the Make policy IsNoExcept value.
*/
template <typename T, typename TResult = T, typename TAllocArg, typename... TArgs>
inline Mso::CntPtr<TResult> MakeAllocElseNull(TAllocArg &&allocArg, TArgs &&... args) noexcept(
inline Mso::CntPtr<TResult> MakeAllocElseNull(TAllocArg &&allocArg, TArgs &&...args) noexcept(
T::MakePolicy::IsNoExcept) {
Mso::CntPtr<TResult> result; // Hopefully we can benefit from NRVO
@ -125,7 +125,7 @@ struct ThrowCtor {
static const bool IsNoExcept = false;
template <typename T, typename TMemoryGuard, typename... TArgs>
static void Make(TMemoryGuard &memoryGuard, TArgs &&... args) {
static void Make(TMemoryGuard &memoryGuard, TArgs &&...args) {
OACR_POSSIBLE_THROW;
memoryGuard.Obj = ::new (memoryGuard.ObjMemory) T(std::forward<TArgs>(args)...);
memoryGuard.ObjMemory = nullptr; // Memory is now controlled by the object. Set to null to avoid memory destruction.
@ -139,7 +139,7 @@ struct NoThrowCtor {
static const bool IsNoExcept = true;
template <typename T, typename TMemoryGuard, typename... TArgs>
static void Make(TMemoryGuard &memoryGuard, TArgs &&... args) noexcept {
static void Make(TMemoryGuard &memoryGuard, TArgs &&...args) noexcept {
memoryGuard.Obj = ::new (memoryGuard.ObjMemory) T(std::forward<TArgs>(args)...);
memoryGuard.ObjMemory = nullptr; // Memory is now controlled by the object. Set to null to avoid memory destruction.
}
@ -152,7 +152,7 @@ struct ThrowCtorAndInitializeThis {
static const bool IsNoExcept = false;
template <typename T, typename TMemoryGuard, typename... TArgs>
static void Make(TMemoryGuard &memoryGuard, TArgs &&... args) {
static void Make(TMemoryGuard &memoryGuard, TArgs &&...args) {
OACR_POSSIBLE_THROW;
memoryGuard.Obj = ::new (memoryGuard.ObjMemory) T();
memoryGuard.ObjMemory = nullptr; // Memory is now controlled by the object. Set to null to avoid memory destruction.
@ -167,7 +167,7 @@ struct NoThrowCtorAndInitializeThis {
static const bool IsNoExcept = true;
template <typename T, typename TMemoryGuard, typename... TArgs>
static void Make(TMemoryGuard &memoryGuard, TArgs &&... args) noexcept {
static void Make(TMemoryGuard &memoryGuard, TArgs &&...args) noexcept {
memoryGuard.Obj = ::new (memoryGuard.ObjMemory) T();
memoryGuard.ObjMemory = nullptr; // Memory is now controlled by the object. Set to null to avoid memory destruction.
memoryGuard.Obj->InitializeThis(std::forward<TArgs>(args)...);

Просмотреть файл

@ -18,9 +18,7 @@
#define MSO_OBJECT_SIMPLEREFCOUNT(TObject) \
public: \
bool IsUniqueRef() const noexcept { \
return m_refCount.load(std::memory_order_acquire) == 1; \
} \
bool IsUniqueRef() const noexcept { return m_refCount.load(std::memory_order_acquire) == 1; } \
Debug(uint32_t RefCount() const noexcept { return m_refCount.load(std::memory_order_acquire); }) \
\
template <typename UseMsoMakeInsteadOfOperatorNew> \
@ -169,7 +167,7 @@ class RefCountedWrapper : public RefCountedWrapperBase, public T {
using MakePolicy = Mso::MakePolicy::ThrowCtor;
template <typename... U>
RefCountedWrapper(U &&... args) noexcept : T(std::forward<U>(args)...) {}
RefCountedWrapper(U &&...args) noexcept : T(std::forward<U>(args)...) {}
};
/**
@ -193,7 +191,7 @@ template <typename T>
using RefCountedPtr = Mso::CntPtr<RefCountedWrapper<T>>;
template <typename T, typename... U>
RefCountedPtr<T> Make_RefCounted(U &&... args) noexcept {
RefCountedPtr<T> Make_RefCounted(U &&...args) noexcept {
return Mso::Make<RefCountedWrapper<T>>(std::forward<U>(args)...);
}

Просмотреть файл

@ -65,18 +65,14 @@
// CntPtr and get a pointer to the ObjectWeakRef using the base ObjectWithWeakRef class.
//
#define MSO_OBJECT_WEAKREFCOUNT(TObject) \
public: \
Mso::ObjectWeakRef &GetWeakRef() const noexcept { \
return *Mso::Details::GetWeakRef(this); \
} \
bool IsUniqueRef() const noexcept { \
return GetWeakRef().IsUniqueRef(); \
} \
Debug(uint32_t RefCount() const noexcept { return GetWeakRef().RefCount(); }) \
\
template <typename UseMsoMakeInsteadOfOperatorNew> \
void *operator new(size_t, UseMsoMakeInsteadOfOperatorNew * = nullptr); \
#define MSO_OBJECT_WEAKREFCOUNT(TObject) \
public: \
Mso::ObjectWeakRef &GetWeakRef() const noexcept { return *Mso::Details::GetWeakRef(this); } \
bool IsUniqueRef() const noexcept { return GetWeakRef().IsUniqueRef(); } \
Debug(uint32_t RefCount() const noexcept { return GetWeakRef().RefCount(); }) \
\
template <typename UseMsoMakeInsteadOfOperatorNew> \
void *operator new(size_t, UseMsoMakeInsteadOfOperatorNew * = nullptr); \
MSO_NO_COPY_CTOR_AND_ASSIGNMENT(TObject)
namespace Mso {
@ -315,7 +311,7 @@ template <
typename TResult = T,
typename TContainer = ObjectWeakRefContainer<T, ObjectWeakRef>,
typename... TArgs>
inline Mso::CntPtr<TResult> MakeWeakRefObject(TArgs &&... args) noexcept(T::MakePolicy::IsNoExcept) {
inline Mso::CntPtr<TResult> MakeWeakRefObject(TArgs &&...args) noexcept(T::MakePolicy::IsNoExcept) {
typename T::RefCountPolicy::template MemoryGuard<T, TContainer> memoryGuard = {};
T::RefCountPolicy::AllocateMemory(memoryGuard);
VerifyAllocElseCrashTag(memoryGuard.ObjMemory, 0x0111774a /* tag_bex3k */);
@ -344,7 +340,7 @@ template <
typename TContainer = ObjectWeakRefContainer<T, ObjectWeakRef>,
typename TAllocArg,
typename... TArgs>
inline Mso::CntPtr<TResult> MakeAllocWeakRefObject(TAllocArg &&allocArg, TArgs &&... args) noexcept(
inline Mso::CntPtr<TResult> MakeAllocWeakRefObject(TAllocArg &&allocArg, TArgs &&...args) noexcept(
T::MakePolicy::IsNoExcept) {
typename T::RefCountPolicy::template MemoryGuard<T, TContainer> memoryGuard = {};
T::RefCountPolicy::AllocateMemory(memoryGuard, std::forward<TAllocArg>(allocArg));

Просмотреть файл

@ -159,7 +159,7 @@ class DECLSPEC_NOVTABLE QueryCastChain : public T {
protected:
template <typename... TArgs>
QueryCastChain(TArgs &&... args) noexcept : T(std::forward<TArgs>(args)...) {}
QueryCastChain(TArgs &&...args) noexcept : T(std::forward<TArgs>(args)...) {}
private:
// Recursively calls itself while we have two or more base types.
@ -205,7 +205,7 @@ class DECLSPEC_NOVTABLE QueryCastGuid : public T {
protected:
template <typename... TArgs>
QueryCastGuid(TArgs &&... args) noexcept : T(std::forward<TArgs>(args)...) {}
QueryCastGuid(TArgs &&...args) noexcept : T(std::forward<TArgs>(args)...) {}
};
/// Implements the QueryCast that does not do any query cast for a type.
@ -221,7 +221,7 @@ class DECLSPEC_NOVTABLE QueryCastHidden : public T {
protected:
template <typename... TArgs>
QueryCastHidden(TArgs &&... args) noexcept : T(std::forward<TArgs>(args)...) {}
QueryCastHidden(TArgs &&...args) noexcept : T(std::forward<TArgs>(args)...) {}
};
/// Delegates the QueryCast implementation to the list of the base types.
@ -235,7 +235,7 @@ class DECLSPEC_NOVTABLE QueryCastList : public TBase0, public TBases... {
protected:
template <typename... TArgs>
QueryCastList(TArgs &&... args) noexcept : TBase0(std::forward<TArgs>(args)...) {}
QueryCastList(TArgs &&...args) noexcept : TBase0(std::forward<TArgs>(args)...) {}
public:
void *QueryCast(const GUID &riid) noexcept {

Просмотреть файл

@ -313,7 +313,7 @@ class RefCountedObject : public TBaseType0, public TBaseTypes... {
protected:
template <typename... TArgs>
RefCountedObject(TArgs &&... args) noexcept : TBaseType0(std::forward<TArgs>(args)...) {}
RefCountedObject(TArgs &&...args) noexcept : TBaseType0(std::forward<TArgs>(args)...) {}
virtual ~RefCountedObject() = default;
@ -351,7 +351,7 @@ class RefCountedObject<Mso::SimpleRefCountPolicy<TDeleter, TAllocator>, TBaseTyp
protected:
template <typename... TArgs>
RefCountedObject(TArgs &&... args) noexcept : TBaseType0(std::forward<TArgs>(args)...) {}
RefCountedObject(TArgs &&...args) noexcept : TBaseType0(std::forward<TArgs>(args)...) {}
virtual ~RefCountedObject() = default;
@ -382,7 +382,7 @@ class RefCountedObject<Mso::WeakRefCountPolicy<TDeleter, TAllocator>, TBaseType0
protected:
template <typename... TArgs>
RefCountedObject(TArgs &&... args) noexcept : TBaseType0(std::forward<TArgs>(args)...) {}
RefCountedObject(TArgs &&...args) noexcept : TBaseType0(std::forward<TArgs>(args)...) {}
virtual ~RefCountedObject() = default;
};
@ -396,7 +396,7 @@ class RefCountedObject<Mso::RefCountStrategy::NoRefCount, TBaseType0, TBaseTypes
MSO_OBJECT_NOREFCOUNT(RefCountedObject);
template <typename... TArgs>
RefCountedObject(TArgs &&... args) noexcept : TBaseType0(std::forward<TArgs>(args)...) {}
RefCountedObject(TArgs &&...args) noexcept : TBaseType0(std::forward<TArgs>(args)...) {}
void AddRef() const noexcept override {}
void Release() const noexcept override {}

Просмотреть файл

@ -394,7 +394,7 @@ class DECLSPEC_NOVTABLE UnknownObject : public Mso::QueryCastList<TBaseType0, TB
protected:
template <typename... TArgs>
UnknownObject(TArgs &&... args) noexcept : Super(std::forward<TArgs>(args)...) {}
UnknownObject(TArgs &&...args) noexcept : Super(std::forward<TArgs>(args)...) {}
virtual ~UnknownObject() noexcept = default;
@ -442,7 +442,7 @@ class DECLSPEC_NOVTABLE UnknownObject<Mso::SimpleRefCountPolicy<TDeleter, TAlloc
protected:
template <typename... TArgs>
UnknownObject(TArgs &&... args) noexcept : Super(std::forward<TArgs>(args)...) {}
UnknownObject(TArgs &&...args) noexcept : Super(std::forward<TArgs>(args)...) {}
virtual ~UnknownObject() noexcept = default;
@ -489,7 +489,7 @@ class DECLSPEC_NOVTABLE UnknownObject<Mso::RefCountStrategy::SimpleNoQuery, TBas
protected:
template <typename... TArgs>
UnknownObject(TArgs &&... args) noexcept : TBaseType0(std::forward<TArgs>(args)...) {}
UnknownObject(TArgs &&...args) noexcept : TBaseType0(std::forward<TArgs>(args)...) {}
virtual ~UnknownObject() noexcept = default;
@ -536,7 +536,7 @@ class UnknownObject<Mso::WeakRefCountPolicy<TDeleter, TAllocator>, TBaseType0, T
protected:
template <typename... TArgs>
UnknownObject(TArgs &&... args) noexcept : Super(std::forward<TArgs>(args)...) {}
UnknownObject(TArgs &&...args) noexcept : Super(std::forward<TArgs>(args)...) {}
virtual ~UnknownObject() noexcept = default;
};
@ -552,7 +552,7 @@ class DECLSPEC_NOVTABLE UnknownObject<Mso::RefCountStrategy::NoRefCount, TBaseTy
MSO_OBJECT_NOREFCOUNT(UnknownObject);
template <typename... TArgs>
UnknownObject(TArgs &&... args) noexcept : Super(std::forward<TArgs>(args)...) {}
UnknownObject(TArgs &&...args) noexcept : Super(std::forward<TArgs>(args)...) {}
_Success_(return == S_OK) STDMETHOD(QueryInterface)(const GUID &riid, _Outptr_ void **ppvObject) noexcept override {
return ::Mso::Details::QueryInterfaceHelper<UnknownObject>::QueryInterface(this, riid, ppvObject);
@ -582,7 +582,7 @@ class DECLSPEC_NOVTABLE UnknownObject<Mso::RefCountStrategy::NoRefCountNoQuery,
MSO_OBJECT_NOREFCOUNT(UnknownObject);
template <typename... TArgs>
UnknownObject(TArgs &&... args) noexcept : Super(std::forward<TArgs>(args)...) {}
UnknownObject(TArgs &&...args) noexcept : Super(std::forward<TArgs>(args)...) {}
_Success_(return == S_OK)
STDMETHOD(QueryInterface)(const GUID & /*riid*/, _Outptr_ void ** /*ppvObject*/) noexcept override {
@ -613,7 +613,7 @@ class AgileUnknownObject : public UnknownObject<TBaseTypes...> {
MSO_NO_COPY_CTOR_AND_ASSIGNMENT(AgileUnknownObject);
template <typename... TArgs>
AgileUnknownObject(TArgs &&... args) noexcept : Super(std::forward<TArgs>(args)...) {}
AgileUnknownObject(TArgs &&...args) noexcept : Super(std::forward<TArgs>(args)...) {}
_Success_(return == S_OK) STDMETHOD(QueryInterface)(const GUID &riid, _Outptr_ void **ppvObject) noexcept override {
HRESULT hr = Super::QueryInterface(riid, ppvObject);

Просмотреть файл

@ -14,7 +14,7 @@ typedef unsigned long DWORD;
#define NOMINMAX
#endif
//#include <winsock2.h>
// #include <winsock2.h>
#include <windows.h>
#endif // defined(MS_TARGET_POSIX)

Просмотреть файл

@ -155,12 +155,12 @@ struct CntPtrRef {
operator CntPtr<T> *() const noexcept;
operator void *() const noexcept;
operator T * *() const noexcept;
operator void * *() const noexcept;
operator const void * *() const noexcept;
operator T **() const noexcept;
operator void **() const noexcept;
operator const void **() const noexcept;
template <typename TBase, EnableIfIsBaseOf<TBase, T> = 0>
explicit operator TBase * *() const noexcept;
explicit operator TBase **() const noexcept;
T *&operator*() noexcept;
T **ClearAndGetAddressOf() noexcept;
@ -508,23 +508,23 @@ inline CntPtrRef<T>::operator void *() const noexcept {
}
template <typename T>
inline CntPtrRef<T>::operator T * *() const noexcept {
inline CntPtrRef<T>::operator T **() const noexcept {
return const_cast<CntPtrRef *>(this)->m_pCntPtr->GetAddressOf();
}
template <typename T>
inline CntPtrRef<T>::operator void * *() const noexcept {
inline CntPtrRef<T>::operator void **() const noexcept {
return reinterpret_cast<void **>(const_cast<CntPtrRef *>(this)->m_pCntPtr->GetAddressOf());
}
template <typename T>
inline CntPtrRef<T>::operator const void * *() const noexcept {
inline CntPtrRef<T>::operator const void **() const noexcept {
return (const void **)(const_cast<CntPtrRef *>(this)->m_pCntPtr->GetAddressOf());
}
template <typename T>
template <typename TBase, EnableIfIsBaseOf<TBase, T>>
inline CntPtrRef<T>::operator TBase * *() const noexcept {
inline CntPtrRef<T>::operator TBase **() const noexcept {
return (TBase **)const_cast<CntPtrRef *>(this)->m_pCntPtr->GetAddressOf();
}

Просмотреть файл

@ -226,7 +226,7 @@ class FutureImpl final : public Mso::QueryCastList<Mso::QueryCastDerived<FutureI
void AddContinuation(Mso::CntPtr<IFuture> &&continuation) noexcept override;
_Success_(
return ) bool TryStartSetValue(_Out_ ByteArrayView &valueBuffer, bool crashIfFailed = false) noexcept override;
return) bool TryStartSetValue(_Out_ ByteArrayView &valueBuffer, bool crashIfFailed = false) noexcept override;
void Post() noexcept override;
void StartAwaiting() noexcept override;
bool TrySetSuccess(bool crashIfFailed = false) noexcept override;

Просмотреть файл

@ -50,11 +50,11 @@ _Use_decl_annotations_ void Free(void *pv) noexcept {
::free(pv);
}
//#ifdef DEBUG
// void RegisterCallback(Mso::LibletAPI::ILibletMemoryMarking&) noexcept {}
// #ifdef DEBUG
// void RegisterCallback(Mso::LibletAPI::ILibletMemoryMarking&) noexcept {}
//
// void UnregisterCallback(Mso::LibletAPI::ILibletMemoryMarking&) noexcept {}
//#endif
// void UnregisterCallback(Mso::LibletAPI::ILibletMemoryMarking&) noexcept {}
// #endif
} // namespace Memory
} // namespace Mso

Просмотреть файл

@ -72,7 +72,7 @@ struct IAbiFunctor; // Intentionally not implemented to allow the specialization
template <class TResult, class... TArgs>
struct IAbiFunctor<TResult(TArgs...)> : IAbiObject {
virtual TResult Invoke(TArgs &&... args) noexcept = 0;
virtual TResult Invoke(TArgs &&...args) noexcept = 0;
};
// IAbiFunctorThrow is a representation of a function object (functors)
@ -83,7 +83,7 @@ struct IAbiFunctorThrow; // Intentionally not implemented to allow the
template <class TResult, class... TArgs>
struct IAbiFunctorThrow<TResult(TArgs...)> : IAbiObject {
virtual TResult Invoke(TArgs &&... args) = 0;
virtual TResult Invoke(TArgs &&...args) = 0;
};
// A base class to implement ABI safe types.
@ -107,7 +107,7 @@ struct AbiObject : TAbiInterface {
// A helper method to create new instance of ABI safe object and return AbiPtr.
template <class T, class TResult = T, class... TArgs>
AbiPtr<TResult> AbiMake(TArgs &&... args) {
AbiPtr<TResult> AbiMake(TArgs &&...args) {
return AbiPtr<TResult>{new T{std::forward<TArgs>(args)...}};
}

Просмотреть файл

@ -991,7 +991,7 @@ size_t ChakraRuntime::JsiValueViewArgs::Size() const noexcept {
ChakraRuntime::PropNameIDView::PropNameIDView(JsPropertyIdRef propertyId) noexcept
: m_propertyId{
make<facebook::jsi::PropNameID>(new (std::addressof(m_pointerStore)) ChakraPointerValueView(propertyId))} {}
make<facebook::jsi::PropNameID>(new(std::addressof(m_pointerStore)) ChakraPointerValueView(propertyId))} {}
ChakraRuntime::PropNameIDView::~PropNameIDView() noexcept {}

Просмотреть файл

@ -17,7 +17,7 @@ void BatchingQueueCallInvoker::invokeAsync(std::function<void()> &&func) noexcep
EnsureQueue();
m_taskQueue->emplace_back(std::move(func));
//#define TRACK_UI_CALLS
// #define TRACK_UI_CALLS
#ifdef TRACK_UI_CALLS
char buffer[1024];
static uint32_t cCalls = 0;

Просмотреть файл

@ -56,7 +56,7 @@ class FbSystraceSection {
}
template <typename... RestArg>
FbSystraceSection(uint64_t tag, std::string &&profileName, RestArg &&... rest)
FbSystraceSection(uint64_t tag, std::string &&profileName, RestArg &&...rest)
: tag_(tag), profile_name_(std::move(profileName)) {
id_ = s_id_counter++;
init(std::forward<RestArg>(rest)...);
@ -72,7 +72,7 @@ class FbSystraceSection {
}
template <typename Arg, typename... RestArg>
void init(Arg &&arg, RestArg &&... rest) {
void init(Arg &&arg, RestArg &&...rest) {
if constexpr (std::is_convertible_v<Arg, std::string>) {
args_[index_++] = std::forward<Arg>(arg);
} else {

Просмотреть файл

@ -44,7 +44,7 @@ function processTransform(
const result = MatrixMath.createIdentityMatrix();
transform.forEach((transformation) => {
transform.forEach(transformation => {
const key = Object.keys(transformation)[0];
const value = transformation[key];
@ -141,7 +141,7 @@ function _convertToRadians(value: string): number {
}
function _validateTransforms(transform: Array<Object>): void {
transform.forEach((transformation) => {
transform.forEach(transformation => {
const keys = Object.keys(transformation);
invariant(
keys.length === 1,

Просмотреть файл

@ -3189,19 +3189,14 @@ async-settle@^1.0.0:
dependencies:
async-done "^1.2.2"
async@^1.5.2:
version "1.5.2"
resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a"
integrity sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=
async@^2.4.0:
version "2.6.3"
resolved "https://registry.yarnpkg.com/async/-/async-2.6.3.tgz#d72625e2344a3656e3a3ad4fa749fa83299d82ff"
integrity sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==
version "2.6.4"
resolved "https://registry.yarnpkg.com/async/-/async-2.6.4.tgz#706b7ff6084664cd7eae713f6f965433b5504221"
integrity sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==
dependencies:
lodash "^4.17.14"
async@^3.2.0, async@^3.2.2:
async@^3.2.0, async@^3.2.2, async@^3.2.3:
version "3.2.3"
resolved "https://registry.yarnpkg.com/async/-/async-3.2.3.tgz#ac53dafd3f4720ee9e8a160628f18ea91df196c9"
integrity sha512-spZRyzKL5l5BZQrr/6m/SqFdBN0q3OCI0f9rjfBzCMBIP4p75P620rR3gTmaksNOhmzgdxcaxdNfMy6anrbM0g==
@ -3950,12 +3945,12 @@ cjs-module-lexer@^0.6.0:
resolved "https://registry.yarnpkg.com/cjs-module-lexer/-/cjs-module-lexer-0.6.0.tgz#4186fcca0eae175970aee870b9fe2d6cf8d5655f"
integrity sha512-uc2Vix1frTfnuzxxu1Hp4ktSvM3QaI4oXl4ZUqL1wjTu/BGki9TrCWoqLTg/drR1KwAEarXuRFCG2Svr1GxPFw==
clang-format@1.5.0, clang-format@^1.2.4:
version "1.5.0"
resolved "https://registry.yarnpkg.com/clang-format/-/clang-format-1.5.0.tgz#1bd4c47b66a1a02556b192b93f5505e7ccec84fb"
integrity sha512-C1LucFX7E+ABVYcPEbBHM4PYQ2+WInXsqsLpFlQ9cmRfSbk7A7b1I06h/nE4bQ3MsyEkb31jY2gC0Dtc76b4IA==
clang-format@^1.2.4, clang-format@^1.7.0:
version "1.7.0"
resolved "https://registry.yarnpkg.com/clang-format/-/clang-format-1.7.0.tgz#c06c63ec1ae2a2590d8eac2562daeb877ca30d44"
integrity sha512-BNuK+rXAK/Fk0rOQ1DW6bpSQUAZz6tpbZHTQn6m4PsgEkE1SNr6AQ/hhFK/b4KJrl4zjcl68molP+rEaKSZRAQ==
dependencies:
async "^1.5.2"
async "^3.2.3"
glob "^7.0.0"
resolve "^1.1.6"