Rename ONNXRUNTIME_API_STATUSCALL to ONNXRUNTIME_API_CALL since it's … (#165)

* Rename ONNXRUNTIME_API_STATUSCALL to ONNXRUNTIME_API_CALL since it's just for calling convention, there's no status return value implied.

* Missed a function
This commit is contained in:
Ryan Hill 2018-12-13 14:42:51 -08:00 committed by GitHub
parent c5a0119d42
commit d419170c7b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 54 additions and 54 deletions

View file

@ -24,14 +24,14 @@ class ObjectBase {
ObjectBase() : cls_(&static_cls), ref_count(1) {
}
static uint32_t ONNXRUNTIME_API_STATUSCALL ONNXRuntimeReleaseImpl(void* this_) {
static uint32_t ONNXRUNTIME_API_CALL ONNXRuntimeReleaseImpl(void* this_) {
T* this_ptr = reinterpret_cast<T*>(this_);
if (--this_ptr->ref_count == 0)
delete this_ptr;
return 0;
}
static uint32_t ONNXRUNTIME_API_STATUSCALL ONNXRuntimeAddRefImpl(void* this_) {
static uint32_t ONNXRUNTIME_API_CALL ONNXRuntimeAddRefImpl(void* this_) {
T* this_ptr = reinterpret_cast<T*>(this_);
++this_ptr->ref_count;
return 0;

View file

@ -38,11 +38,11 @@ extern "C" {
#else
#define ONNX_RUNTIME_EXPORT
#endif
#define ONNXRUNTIME_API_STATUSCALL _stdcall
#define ONNXRUNTIME_API_CALL _stdcall
#define ONNX_RUNTIME_MUST_USE_RESULT
#else
#define ONNX_RUNTIME_EXPORT
#define ONNXRUNTIME_API_STATUSCALL
#define ONNXRUNTIME_API_CALL
#define ONNX_RUNTIME_MUST_USE_RESULT __attribute__((warn_unused_result))
#endif
@ -79,14 +79,14 @@ typedef void ONNXStatus;
// __VA_ARGS__ on Windows and Linux are different
#define ONNXRUNTIME_API(RETURN_TYPE, NAME, ...) \
ONNX_RUNTIME_EXPORT RETURN_TYPE ONNXRUNTIME_API_STATUSCALL NAME(__VA_ARGS__) NO_EXCEPTION
ONNX_RUNTIME_EXPORT RETURN_TYPE ONNXRUNTIME_API_CALL NAME(__VA_ARGS__) NO_EXCEPTION
#define ONNXRUNTIME_API_STATUS(NAME, ...) \
ONNX_RUNTIME_EXPORT ONNXStatus* ONNXRUNTIME_API_STATUSCALL NAME(__VA_ARGS__) NO_EXCEPTION ONNX_RUNTIME_MUST_USE_RESULT
ONNX_RUNTIME_EXPORT ONNXStatus* ONNXRUNTIME_API_CALL NAME(__VA_ARGS__) NO_EXCEPTION ONNX_RUNTIME_MUST_USE_RESULT
// Used in *.cc files. Almost as same as ONNXRUNTIME_API_STATUS, except without ONNX_RUNTIME_MUST_USE_RESULT
#define ONNXRUNTIME_API_STATUS_IMPL(NAME, ...) \
ONNX_RUNTIME_EXPORT ONNXStatus* ONNXRUNTIME_API_STATUSCALL NAME(__VA_ARGS__) NO_EXCEPTION
ONNX_RUNTIME_EXPORT ONNXStatus* ONNXRUNTIME_API_CALL NAME(__VA_ARGS__) NO_EXCEPTION
#define DEFINE_RUNTIME_CLASS2(NAME, TYPE) \
ONNXRUNTIME_API(void, Release##NAME, _Frees_ptr_opt_ TYPE* input);
@ -237,9 +237,9 @@ DEFINE_RUNTIME_CLASS(ONNXRuntimeProvider);
*/
typedef struct ONNXObject {
///returns the new reference count.
uint32_t(ONNXRUNTIME_API_STATUSCALL* AddRef)(void* this_);
uint32_t(ONNXRUNTIME_API_CALL* AddRef)(void* this_);
///returns the new reference count.
uint32_t(ONNXRUNTIME_API_STATUSCALL* Release)(void* this_);
uint32_t(ONNXRUNTIME_API_CALL* Release)(void* this_);
//TODO: implement QueryInterface?
} ONNXObject;
@ -263,7 +263,7 @@ ONNXRUNTIME_API(uint32_t, ONNXRuntimeReleaseObject, _Inout_opt_ void* ptr);
//Inherented from ONNXObject
typedef struct ONNXRuntimeProviderFactoryInterface {
ONNXObject parent;
ONNXStatus*(ONNXRUNTIME_API_STATUSCALL* CreateProvider)(void* this_, ONNXRuntimeProvider** out);
ONNXStatus*(ONNXRUNTIME_API_CALL* CreateProvider)(void* this_, ONNXRuntimeProvider** out);
} ONNXRuntimeProviderFactoryInterface;
struct ONNXRuntimeSessionOptions;
@ -350,9 +350,9 @@ ONNXRUNTIME_API(ONNXRuntimeAllocatorType, ONNXRuntimeAllocatorInfoGetType, _In_
//inherented from ONNXObject
typedef struct ONNXRuntimeAllocatorInteface {
struct ONNXObject parent;
void*(ONNXRUNTIME_API_STATUSCALL* Alloc)(void* this_, size_t size);
void(ONNXRUNTIME_API_STATUSCALL* Free)(void* this_, void* p);
const struct ONNXRuntimeAllocatorInfo*(ONNXRUNTIME_API_STATUSCALL* Info)(const void* this_);
void*(ONNXRUNTIME_API_CALL* Alloc)(void* this_, size_t size);
void(ONNXRUNTIME_API_CALL* Free)(void* this_, void* p);
const struct ONNXRuntimeAllocatorInfo*(ONNXRUNTIME_API_CALL* Info)(const void* this_);
} ONNXRuntimeAllocatorInteface;
typedef ONNXRuntimeAllocatorInteface* ONNXRuntimeAllocator;
@ -372,7 +372,7 @@ typedef enum ONNXRuntimeLoggingLevel {
ONNXRUNTIME_LOGGING_LEVEL_kFATAL = 4
} ONNXRuntimeLoggingLevel;
typedef void(ONNXRUNTIME_API_STATUSCALL* ONNXRuntimeLoggingFunction)(
typedef void(ONNXRUNTIME_API_CALL* ONNXRuntimeLoggingFunction)(
void* param, ONNXRuntimeLoggingLevel severity, const char* category, const char* logid, const char* code_location,
const char* message);
/**

View file

@ -15,7 +15,7 @@ struct CpuProviderFactory {
CpuProviderFactory();
};
ONNXStatus* ONNXRUNTIME_API_STATUSCALL CreateCpu(void* this_, ONNXRuntimeProvider** out) {
ONNXStatus* ONNXRUNTIME_API_CALL CreateCpu(void* this_, ONNXRuntimeProvider** out) {
CPUExecutionProviderInfo info;
CpuProviderFactory* this_ptr = (CpuProviderFactory*)this_;
info.create_arena = this_ptr->create_arena;
@ -24,14 +24,14 @@ ONNXStatus* ONNXRUNTIME_API_STATUSCALL CreateCpu(void* this_, ONNXRuntimeProvide
return nullptr;
}
uint32_t ONNXRUNTIME_API_STATUSCALL ReleaseCpu(void* this_) {
uint32_t ONNXRUNTIME_API_CALL ReleaseCpu(void* this_) {
CpuProviderFactory* this_ptr = (CpuProviderFactory*)this_;
if (--this_ptr->ref_count == 0)
delete this_ptr;
return 0;
}
uint32_t ONNXRUNTIME_API_STATUSCALL AddRefCpu(void* this_) {
uint32_t ONNXRUNTIME_API_CALL AddRefCpu(void* this_) {
CpuProviderFactory* this_ptr = (CpuProviderFactory*)this_;
++this_ptr->ref_count;
return 0;

View file

@ -15,7 +15,7 @@ struct CUDAProviderFactory {
CUDAProviderFactory();
};
ONNXStatus* ONNXRUNTIME_API_STATUSCALL CreateCuda(void* this_, ONNXRuntimeProvider** out) {
ONNXStatus* ONNXRUNTIME_API_CALL CreateCuda(void* this_, ONNXRuntimeProvider** out) {
CUDAExecutionProviderInfo info;
CUDAProviderFactory* this_ptr = (CUDAProviderFactory*)this_;
info.device_id = this_ptr->device_id;
@ -24,14 +24,14 @@ ONNXStatus* ONNXRUNTIME_API_STATUSCALL CreateCuda(void* this_, ONNXRuntimeProvid
return nullptr;
}
uint32_t ONNXRUNTIME_API_STATUSCALL ReleaseCuda(void* this_) {
uint32_t ONNXRUNTIME_API_CALL ReleaseCuda(void* this_) {
CUDAProviderFactory* this_ptr = (CUDAProviderFactory*)this_;
if (--this_ptr->ref_count == 0)
delete this_ptr;
return 0;
}
uint32_t ONNXRUNTIME_API_STATUSCALL AddRefCuda(void* this_) {
uint32_t ONNXRUNTIME_API_CALL AddRefCuda(void* this_) {
CUDAProviderFactory* this_ptr = (CUDAProviderFactory*)this_;
++this_ptr->ref_count;
return 0;

View file

@ -15,7 +15,7 @@ struct MkldnnProviderFactory {
MkldnnProviderFactory();
};
ONNXStatus* ONNXRUNTIME_API_STATUSCALL CreateMkldnn(void* this_, ONNXRuntimeProvider** out) {
ONNXStatus* ONNXRUNTIME_API_CALL CreateMkldnn(void* this_, ONNXRuntimeProvider** out) {
MKLDNNExecutionProviderInfo info;
MkldnnProviderFactory* this_ptr = (MkldnnProviderFactory*)this_;
info.create_arena = this_ptr->create_arena;
@ -24,14 +24,14 @@ ONNXStatus* ONNXRUNTIME_API_STATUSCALL CreateMkldnn(void* this_, ONNXRuntimeProv
return nullptr;
}
uint32_t ONNXRUNTIME_API_STATUSCALL ReleaseMkldnn(void* this_) {
uint32_t ONNXRUNTIME_API_CALL ReleaseMkldnn(void* this_) {
MkldnnProviderFactory* this_ptr = (MkldnnProviderFactory*)this_;
if (--this_ptr->ref_count == 0)
delete this_ptr;
return 0;
}
uint32_t ONNXRUNTIME_API_STATUSCALL AddRefMkldnn(void* this_) {
uint32_t ONNXRUNTIME_API_CALL AddRefMkldnn(void* this_) {
MkldnnProviderFactory* this_ptr = (MkldnnProviderFactory*)this_;
++this_ptr->ref_count;
return 0;

View file

@ -10,20 +10,20 @@
private: \
const ONNXRuntimeAllocatorInteface* vtable_ = &table_; \
std::atomic_int ref_count_; \
static void* ONNXRUNTIME_API_STATUSCALL Alloc_(void* this_ptr, size_t size) { \
static void* ONNXRUNTIME_API_CALL Alloc_(void* this_ptr, size_t size) { \
return ((CLASS_NAME*)this_ptr)->Alloc(size); \
} \
static void ONNXRUNTIME_API_STATUSCALL Free_(void* this_ptr, void* p) { \
static void ONNXRUNTIME_API_CALL Free_(void* this_ptr, void* p) { \
return ((CLASS_NAME*)this_ptr)->Free(p); \
} \
static const ONNXRuntimeAllocatorInfo* ONNXRUNTIME_API_STATUSCALL Info_(const void* this_ptr) { \
static const ONNXRuntimeAllocatorInfo* ONNXRUNTIME_API_CALL Info_(const void* this_ptr) { \
return ((const CLASS_NAME*)this_ptr)->Info(); \
} \
static uint32_t ONNXRUNTIME_API_STATUSCALL AddRef_(void* this_) { \
static uint32_t ONNXRUNTIME_API_CALL AddRef_(void* this_) { \
CLASS_NAME* this_ptr = (CLASS_NAME*)this_; \
return ++this_ptr->ref_count_; \
} \
static uint32_t ONNXRUNTIME_API_STATUSCALL Release_(void* this_) { \
static uint32_t ONNXRUNTIME_API_CALL Release_(void* this_) { \
CLASS_NAME* this_ptr = (CLASS_NAME*)this_; \
uint32_t ret = --this_ptr->ref_count_; \
if (ret == 0) \

View file

@ -13,7 +13,7 @@ typedef const char* PATH_TYPE;
#endif
//empty
static inline void ONNXRUNTIME_API_STATUSCALL MyLoggingFunction(void*, ONNXRuntimeLoggingLevel, const char*, const char*, const char*, const char*) {
static inline void ONNXRUNTIME_API_CALL MyLoggingFunction(void*, ONNXRuntimeLoggingLevel, const char*, const char*, const char*, const char*) {
}
template <bool use_customer_logger>
class CApiTestImpl : public ::testing::Test {

View file

@ -7,31 +7,31 @@
#include "core/session/onnxruntime_cxx_api.h"
#include <assert.h>
#define ONNXRUNTIME_ALLOCATOR_IMPL_BEGIN(CLASS_NAME) \
class CLASS_NAME { \
private: \
const ONNXRuntimeAllocatorInteface* vtable_ = &table_; \
std::atomic_int ref_count_; \
static void* ONNXRUNTIME_API_STATUSCALL Alloc_(void* this_ptr, size_t size) { \
return ((CLASS_NAME*)this_ptr)->Alloc(size); \
} \
static void ONNXRUNTIME_API_STATUSCALL Free_(void* this_ptr, void* p) { \
return ((CLASS_NAME*)this_ptr)->Free(p); \
} \
static const ONNXRuntimeAllocatorInfo* ONNXRUNTIME_API_STATUSCALL Info_(const void* this_ptr) { \
return ((const CLASS_NAME*)this_ptr)->Info(); \
} \
static uint32_t ONNXRUNTIME_API_STATUSCALL AddRef_(void* this_) { \
CLASS_NAME* this_ptr = (CLASS_NAME*)this_; \
return ++this_ptr->ref_count_; \
} \
static uint32_t ONNXRUNTIME_API_STATUSCALL Release_(void* this_) { \
CLASS_NAME* this_ptr = (CLASS_NAME*)this_; \
uint32_t ret = --this_ptr->ref_count_; \
if (ret == 0) \
delete this_ptr; \
return 0; \
} \
#define ONNXRUNTIME_ALLOCATOR_IMPL_BEGIN(CLASS_NAME) \
class CLASS_NAME { \
private: \
const ONNXRuntimeAllocatorInteface* vtable_ = &table_; \
std::atomic_int ref_count_; \
static void* ONNXRUNTIME_API_CALL Alloc_(void* this_ptr, size_t size) { \
return ((CLASS_NAME*)this_ptr)->Alloc(size); \
} \
static void ONNXRUNTIME_API_CALL Free_(void* this_ptr, void* p) { \
return ((CLASS_NAME*)this_ptr)->Free(p); \
} \
static const ONNXRuntimeAllocatorInfo* ONNXRUNTIME_API_CALL Info_(const void* this_ptr) { \
return ((const CLASS_NAME*)this_ptr)->Info(); \
} \
static uint32_t ONNXRUNTIME_API_CALL AddRef_(void* this_) { \
CLASS_NAME* this_ptr = (CLASS_NAME*)this_; \
return ++this_ptr->ref_count_; \
} \
static uint32_t ONNXRUNTIME_API_CALL Release_(void* this_) { \
CLASS_NAME* this_ptr = (CLASS_NAME*)this_; \
uint32_t ret = --this_ptr->ref_count_; \
if (ret == 0) \
delete this_ptr; \
return 0; \
} \
static ONNXRuntimeAllocatorInteface table_;
#define ONNXRUNTIME_ALLOCATOR_IMPL_END \