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