Add simple contract implementation
This commit is contained in:
parent
603c9d9694
commit
5ee2b47171
@ -3,6 +3,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <internal/contract.hpp>
|
||||
|
||||
namespace azure
|
||||
{
|
||||
namespace core
|
||||
|
||||
21
sdk/core/azure-core/inc/internal/contract.hpp
Normal file
21
sdk/core/azure-core/inc/internal/contract.hpp
Normal file
@ -0,0 +1,21 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef NO_CONTRACTS_CHECKING
|
||||
#define AZ_CONTRACT(condition, error)
|
||||
#define AZ_CONTRACT_ARG_NOT_NULL(arg)
|
||||
#else
|
||||
#define AZ_CONTRACT(condition, error) \
|
||||
do \
|
||||
{ \
|
||||
if (!(condition)) \
|
||||
{ \
|
||||
return error; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define AZ_CONTRACT_ARG_NOT_NULL(arg) AZ_CONTRACT((arg) != NULL, 1)
|
||||
|
||||
#endif
|
||||
Loading…
Reference in New Issue
Block a user