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