aboutsummaryrefslogtreecommitdiff
path: root/src/backends/backendsCommon/test/TestDynamicBackend.hpp
blob: 599ca1663663640873ae9a4daf907fb79eafeedf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
//
// Copyright © 2017 Arm Ltd. All rights reserved.
// SPDX-License-Identifier: MIT
//

#pragma once

#include <cstdint>

#if defined(VALID_TEST_DYNAMIC_BACKEND)

// Correct dynamic backend interface
extern "C"
{
const char* GetBackendId();
void GetVersion(uint32_t* outMajor, uint32_t* outMinor);
void* BackendFactory();
}

#elif defined(INVALID_TEST_DYNAMIC_BACKEND_1)

// Wrong external linkage: expected C-style name mangling
extern const char* GetBackendId();
extern void GetVersion(uint32_t* outMajor, uint32_t* outMinor);
extern void* BackendFactory();

#else

extern "C"
{

#if defined(INVALID_TEST_DYNAMIC_BACKEND_2)

// Invalid interface: missing "GetBackendId()"
void GetVersion(uint32_t* outMajor, uint32_t* outMinor);
void* BackendFactory();

#elif defined(INVALID_TEST_DYNAMIC_BACKEND_3)

// Invalid interface: missing "GetVersion()"
const char* GetBackendId();
void* BackendFactory();

#elif defined(INVALID_TEST_DYNAMIC_BACKEND_4)

// Invalid interface: missing "BackendFactory()"
const char* GetBackendId();
void GetVersion(uint32_t* outMajor, uint32_t* outMinor);

#elif defined(INVALID_TEST_DYNAMIC_BACKEND_5) || \
      defined(INVALID_TEST_DYNAMIC_BACKEND_6) || \
      defined(INVALID_TEST_DYNAMIC_BACKEND_7)

// The interface is correct, the corresponding invalid changes are in the TestDynamicBackend.cpp file
const char* GetBackendId();
void GetVersion(uint32_t* outMajor, uint32_t* outMinor);
void* BackendFactory();

#else

#error "Invalid or missing configuration macro for the TestDynamicBackend object"

#endif

}

#endif