forked from project-chip/connectedhomeip
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMTRDefines.h
110 lines (92 loc) · 3.45 KB
/
MTRDefines.h
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/**
*
* Copyright (c) 2022 Project CHIP Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#import <Foundation/Foundation.h>
#pragma mark - Overridable options
/**
* @define `MTR_NO_AVAILABILITY`
* Turns off availability annotations, to allow compiling a version of
* Matter.framework for "local use", not as a system framework.
*/
#ifndef MTR_NO_AVAILABILITY
#define MTR_NO_AVAILABILITY 0
#endif
/**
* @define `MTR_ENABLE_PROVISIONAL`
* Makes provisional spec features available for evaluation / testing purposes.
* The usual API / ABI stability guarantees DO NOT APPLY to provisional features.
*/
#ifndef MTR_ENABLE_PROVISIONAL
#define MTR_ENABLE_PROVISIONAL 0
#endif
/**
* @define `MTR_ENABLE_UNSTABLE_API`
* Makes unstbale APIs available for evaluation / testing purposes.
* The usual API / ABI stability guarantees DO NOT APPLY to unstable APIs.
*/
#ifndef MTR_ENABLE_UNSTABLE_API
#define MTR_ENABLE_UNSTABLE_API 0
#endif
#pragma mark - Attribute macros
#define MTR_EXPORT __attribute__((visibility("default")))
#ifdef __cplusplus
#define MTR_EXTERN extern "C"
#else
#define MTR_EXTERN extern
#endif
#if __has_attribute(__swift_attr__)
#define MTR_SWIFT_DISFAVORED_OVERLOAD __attribute__((__swift_attr__("@_disfavoredOverload")))
#else
#define MTR_SWIFT_DISFAVORED_OVERLOAD
#endif
#pragma mark - Availability / deprecation
// clang-format off
#define _MTR_IMPLICIT_EXPORT \
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Wignored-attributes\"")\
MTR_EXPORT \
_Pragma("clang diagnostic pop")
// clang-format on
#define _MTR_DEPRECATED _MTR_IMPLICIT_EXPORT MTR_SWIFT_DISFAVORED_OVERLOAD
#define _MTR_UNAVAILABLE _MTR_IMPLICIT_EXPORT NS_UNAVAILABLE
// clang-format off
#if MTR_NO_AVAILABILITY
#define MTR_DEPRECATED(...) _MTR_DEPRECATED
#define MTR_DEPRECATED_WITH_REPLACEMENT(...) _MTR_DEPRECATED
#define MTR_AVAILABLE(...) _MTR_IMPLICIT_EXPORT
#else
#define MTR_DEPRECATED(...) _MTR_DEPRECATED API_DEPRECATED(__VA_ARGS__)
#define MTR_DEPRECATED_WITH_REPLACEMENT(...) _MTR_DEPRECATED API_DEPRECATED_WITH_REPLACEMENT(__VA_ARGS__)
#define MTR_AVAILABLE(...) _MTR_IMPLICIT_EXPORT API_AVAILABLE(__VA_ARGS__)
#endif // MTR_NO_AVAILABILITY
// clang-format on
#define MTR_NEWLY_DEPRECATED(message) _MTR_IMPLICIT_EXPORT
#define MTR_NEWLY_AVAILABLE _MTR_IMPLICIT_EXPORT
#if MTR_ENABLE_PROVISIONAL
#define MTR_PROVISIONALLY_AVAILABLE MTR_NEWLY_AVAILABLE
#else
#define MTR_PROVISIONALLY_AVAILABLE _MTR_UNAVAILABLE
#endif
#if MTR_ENABLE_UNSTABLE_API
#define MTR_UNSTABLE_API MTR_NEWLY_AVAILABLE
#else
#define MTR_UNSTABLE_API _MTR_UNAVAILABLE
#endif
#pragma mark - Types
typedef NSData * MTRTLVBytes;
typedef NSData * MTRCSRDERBytes;
typedef NSData * MTRCertificateDERBytes;
typedef NSData * MTRCertificateTLVBytes;