blob: 61a6eaf572aaf311b8f80b2b38820f416e774f42 [file] [log] [blame]
Matteo Martincighbc2e2102019-07-24 14:56:13 +01001//
2// Copyright © 2017 Arm Ltd. All rights reserved.
3// SPDX-License-Identifier: MIT
4//
5
6#pragma once
7
8#include <cstdint>
9
Matteo Martincighe54aa062019-08-05 14:12:11 +010010#if defined(VALID_TEST_DYNAMIC_BACKEND_1) || \
11 defined(VALID_TEST_DYNAMIC_BACKEND_2) || \
12 defined(VALID_TEST_DYNAMIC_BACKEND_3) || \
Matteo Martincigh0c2b2892019-08-05 14:12:11 +010013 defined(VALID_TEST_DYNAMIC_BACKEND_4) || \
14 defined(VALID_TEST_DYNAMIC_BACKEND_5)
Matteo Martincighbc2e2102019-07-24 14:56:13 +010015
16// Correct dynamic backend interface
17extern "C"
18{
19const char* GetBackendId();
20void GetVersion(uint32_t* outMajor, uint32_t* outMinor);
21void* BackendFactory();
22}
23
24#elif defined(INVALID_TEST_DYNAMIC_BACKEND_1)
25
26// Wrong external linkage: expected C-style name mangling
27extern const char* GetBackendId();
28extern void GetVersion(uint32_t* outMajor, uint32_t* outMinor);
29extern void* BackendFactory();
30
31#else
32
33extern "C"
34{
35
36#if defined(INVALID_TEST_DYNAMIC_BACKEND_2)
37
38// Invalid interface: missing "GetBackendId()"
39void GetVersion(uint32_t* outMajor, uint32_t* outMinor);
40void* BackendFactory();
41
42#elif defined(INVALID_TEST_DYNAMIC_BACKEND_3)
43
44// Invalid interface: missing "GetVersion()"
45const char* GetBackendId();
46void* BackendFactory();
47
48#elif defined(INVALID_TEST_DYNAMIC_BACKEND_4)
49
50// Invalid interface: missing "BackendFactory()"
51const char* GetBackendId();
52void GetVersion(uint32_t* outMajor, uint32_t* outMinor);
53
Matteo Martincigh0c2b2892019-08-05 14:12:11 +010054#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)
Matteo Martincighbc2e2102019-07-24 14:56:13 +010061
62// The interface is correct, the corresponding invalid changes are in the TestDynamicBackend.cpp file
63const char* GetBackendId();
64void GetVersion(uint32_t* outMajor, uint32_t* outMinor);
65void* BackendFactory();
66
67#else
68
69#error "Invalid or missing configuration macro for the TestDynamicBackend object"
70
71#endif
72
73}
74
75#endif