Matteo Martincigh | bc2e210 | 2019-07-24 14:56:13 +0100 | [diff] [blame^] | 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) |
| 11 | |
| 12 | // Correct dynamic backend interface |
| 13 | extern "C" |
| 14 | { |
| 15 | const char* GetBackendId(); |
| 16 | void GetVersion(uint32_t* outMajor, uint32_t* outMinor); |
| 17 | void* BackendFactory(); |
| 18 | } |
| 19 | |
| 20 | #elif defined(INVALID_TEST_DYNAMIC_BACKEND_1) |
| 21 | |
| 22 | // Wrong external linkage: expected C-style name mangling |
| 23 | extern const char* GetBackendId(); |
| 24 | extern void GetVersion(uint32_t* outMajor, uint32_t* outMinor); |
| 25 | extern void* BackendFactory(); |
| 26 | |
| 27 | #else |
| 28 | |
| 29 | extern "C" |
| 30 | { |
| 31 | |
| 32 | #if defined(INVALID_TEST_DYNAMIC_BACKEND_2) |
| 33 | |
| 34 | // Invalid interface: missing "GetBackendId()" |
| 35 | void GetVersion(uint32_t* outMajor, uint32_t* outMinor); |
| 36 | void* BackendFactory(); |
| 37 | |
| 38 | #elif defined(INVALID_TEST_DYNAMIC_BACKEND_3) |
| 39 | |
| 40 | // Invalid interface: missing "GetVersion()" |
| 41 | const char* GetBackendId(); |
| 42 | void* BackendFactory(); |
| 43 | |
| 44 | #elif defined(INVALID_TEST_DYNAMIC_BACKEND_4) |
| 45 | |
| 46 | // Invalid interface: missing "BackendFactory()" |
| 47 | const char* GetBackendId(); |
| 48 | void GetVersion(uint32_t* outMajor, uint32_t* outMinor); |
| 49 | |
| 50 | #elif defined(INVALID_TEST_DYNAMIC_BACKEND_5) || \ |
| 51 | defined(INVALID_TEST_DYNAMIC_BACKEND_6) || \ |
| 52 | defined(INVALID_TEST_DYNAMIC_BACKEND_7) |
| 53 | |
| 54 | // The interface is correct, the corresponding invalid changes are in the TestDynamicBackend.cpp file |
| 55 | const char* GetBackendId(); |
| 56 | void GetVersion(uint32_t* outMajor, uint32_t* outMinor); |
| 57 | void* BackendFactory(); |
| 58 | |
| 59 | #else |
| 60 | |
| 61 | #error "Invalid or missing configuration macro for the TestDynamicBackend object" |
| 62 | |
| 63 | #endif |
| 64 | |
| 65 | } |
| 66 | |
| 67 | #endif |