ArmNN
 20.08
TestDynamicBackend.hpp
Go to the documentation of this file.
1 //
2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #pragma once
7 
8 #include <cstdint>
9 
10 #if defined(VALID_TEST_DYNAMIC_BACKEND_1) || \
11  defined(VALID_TEST_DYNAMIC_BACKEND_2) || \
12  defined(VALID_TEST_DYNAMIC_BACKEND_3) || \
13  defined(VALID_TEST_DYNAMIC_BACKEND_4) || \
14  defined(VALID_TEST_DYNAMIC_BACKEND_5)
15 
16 // Correct dynamic backend interface
17 extern "C"
18 {
19 const char* GetBackendId();
20 void GetVersion(uint32_t* outMajor, uint32_t* outMinor);
21 void* BackendFactory();
22 }
23 
24 #elif defined(INVALID_TEST_DYNAMIC_BACKEND_1)
25 
26 // Wrong external linkage: expected C-style name mangling
27 extern const char* GetBackendId();
28 extern void GetVersion(uint32_t* outMajor, uint32_t* outMinor);
29 extern void* BackendFactory();
30 
31 #else
32 
33 extern "C"
34 {
35 
36 #if defined(INVALID_TEST_DYNAMIC_BACKEND_2)
37 
38 // Invalid interface: missing "GetBackendId()"
39 void GetVersion(uint32_t* outMajor, uint32_t* outMinor);
40 void* BackendFactory();
41 
42 #elif defined(INVALID_TEST_DYNAMIC_BACKEND_3)
43 
44 // Invalid interface: missing "GetVersion()"
45 const char* GetBackendId();
46 void* BackendFactory();
47 
48 #elif defined(INVALID_TEST_DYNAMIC_BACKEND_4)
49 
50 // Invalid interface: missing "BackendFactory()"
51 const char* GetBackendId();
52 void GetVersion(uint32_t* outMajor, uint32_t* outMinor);
53 
54 #elif defined(INVALID_TEST_DYNAMIC_BACKEND_5) || \
55  defined(INVALID_TEST_DYNAMIC_BACKEND_6) || \
56  defined(INVALID_TEST_DYNAMIC_BACKEND_7) || \
57  defined(INVALID_TEST_DYNAMIC_BACKEND_8) || \
58  defined(INVALID_TEST_DYNAMIC_BACKEND_9) || \
59  defined(INVALID_TEST_DYNAMIC_BACKEND_10) || \
60  defined(INVALID_TEST_DYNAMIC_BACKEND_11)
61 
62 // The interface is correct, the corresponding invalid changes are in the TestDynamicBackend.cpp file
63 const char* GetBackendId();
64 void GetVersion(uint32_t* outMajor, uint32_t* outMinor);
65 void* BackendFactory();
66 
67 #else
68 
69 #error "Invalid or missing configuration macro for the TestDynamicBackend object"
70 
71 #endif
72 
73 }
74 
75 #endif
const char * GetBackendId()
void * BackendFactory()
void GetVersion(uint32_t *outMajor, uint32_t *outMinor)