Add simple contract implementation

This commit is contained in:
Rick Winter 2020-03-17 11:44:40 -07:00 committed by GitHub
parent 603c9d9694
commit 5ee2b47171
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 0 deletions

View File

@ -3,6 +3,8 @@
#pragma once
#include <internal/contract.hpp>
namespace azure
{
namespace core

View 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