blob: 599ca1663663640873ae9a4daf907fb79eafeedf [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
10#if defined(VALID_TEST_DYNAMIC_BACKEND)
11
12// Correct dynamic backend interface
13extern "C"
14{
15const char* GetBackendId();
16void GetVersion(uint32_t* outMajor, uint32_t* outMinor);
17void* BackendFactory();
18}
19
20#elif defined(INVALID_TEST_DYNAMIC_BACKEND_1)
21
22// Wrong external linkage: expected C-style name mangling
23extern const char* GetBackendId();
24extern void GetVersion(uint32_t* outMajor, uint32_t* outMinor);
25extern void* BackendFactory();
26
27#else
28
29extern "C"
30{
31
32#if defined(INVALID_TEST_DYNAMIC_BACKEND_2)
33
34// Invalid interface: missing "GetBackendId()"
35void GetVersion(uint32_t* outMajor, uint32_t* outMinor);
36void* BackendFactory();
37
38#elif defined(INVALID_TEST_DYNAMIC_BACKEND_3)
39
40// Invalid interface: missing "GetVersion()"
41const char* GetBackendId();
42void* BackendFactory();
43
44#elif defined(INVALID_TEST_DYNAMIC_BACKEND_4)
45
46// Invalid interface: missing "BackendFactory()"
47const char* GetBackendId();
48void 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
55const char* GetBackendId();
56void GetVersion(uint32_t* outMajor, uint32_t* outMinor);
57void* BackendFactory();
58
59#else
60
61#error "Invalid or missing configuration macro for the TestDynamicBackend object"
62
63#endif
64
65}
66
67#endif