• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef ABCKIT_MOCK_GLOBAL_VALUES
17 #define ABCKIT_MOCK_GLOBAL_VALUES
18 
19 #include <cstdint>
20 #include <cstring>
21 
22 // NOLINTNEXTLINE(readability-identifier-naming)
23 extern const char *DEFAULT_PATH;
24 extern const size_t DEFAULT_PATH_SIZE;
25 // NOLINTNEXTLINE(readability-identifier-naming)
26 extern const char *DEFAULT_CONST_CHAR;
27 extern const size_t DEFAULT_CONST_CHAR_SIZE;
28 extern const bool DEFAULT_BOOL;
29 extern const uint8_t DEFAULT_U8;
30 extern const uint16_t DEFAULT_U16;
31 extern const uint32_t DEFAULT_U32;
32 extern const int32_t DEFAULT_I32;
33 extern const uint64_t DEFAULT_U64;
34 extern const int64_t DEFAULT_I64;
35 extern const size_t DEFAULT_SIZE_T;
36 
37 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage, cppcoreguidelines-pro-type-cstyle-cast)
38 #define DEFAULT_ENUM_ABCKIT_ISA_TYPE (enum AbckitInst())
39 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
40 #define DEFAULT_ENUM_ISA_TYPE AbckitIsaType::ABCKIT_ISA_TYPE_UNSUPPORTED
41 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
42 #define DEFAULT_ENUM_ISA_DYNAMIC_CONDITION_TYPE \
43     AbckitIsaApiDynamicConditionCode::ABCKIT_ISA_API_DYNAMIC_CONDITION_CODE_CC_NONE
44 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
45 #define DEFAULT_ENUM_ISA_API_DYNAMIC_OPCODE AbckitIsaApiDynamicOpcode::ABCKIT_ISA_API_DYNAMIC_OPCODE_INVALID
46 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
47 #define DEFAULT_ENUM_ISA_STATIC_CONDITION_CODE \
48     AbckitIsaApiStaticConditionCode::ABCKIT_ISA_API_STATIC_CONDITION_CODE_CC_NONE
49 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
50 #define DEFAULT_ENUM_TYPE_ID AbckitTypeId::ABCKIT_TYPE_ID_INVALID
51 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
52 #define DEFAULT_ENUM_ISA_API_STATIC_OPCODE AbckitIsaApiStaticOpcode::ABCKIT_ISA_API_STATIC_OPCODE_INVALID
53 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
54 #define DEFAULT_TYPE_ID AbckitTypeId::ABCKIT_TYPE_ID_INVALID
55 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
56 #define DEFAULT_TARGET AbckitTarget::ABCKIT_TARGET_UNKNOWN
57 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
58 #define DEFAULT_LITERAL_TAG AbckitLiteralTag::ABCKIT_LITERAL_TAG_INVALID
59 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
60 #define DEFAULT_FILE (reinterpret_cast<AbckitFile *>(0xdeadffff))
61 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
62 #define DEFAULT_GRAPH (reinterpret_cast<AbckitGraph *>(0xdeadeeee))
63 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
64 #define DEFAULT_VOID (reinterpret_cast<void *>(0xdead0001))
65 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
66 #define DEFAULT_CB (reinterpret_cast<void *>(0xdead0002))
67 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
68 #define DEFAULT_CORE_MODULE (reinterpret_cast<AbckitCoreModule *>(0xdead0003))
69 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
70 #define DEFAULT_STRING (reinterpret_cast<AbckitString *>(0xdead0005))
71 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
72 #define DEFAULT_CORE_NAMESPACE (reinterpret_cast<AbckitCoreNamespace *>(0xdead0006))
73 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
74 #define DEFAULT_CORE_IMPORT_DESCRIPTOR (reinterpret_cast<AbckitCoreImportDescriptor *>(0xdead0006))
75 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
76 #define DEFAULT_CORE_EXPORT_DESCRIPTOR (reinterpret_cast<AbckitCoreExportDescriptor *>(0xdead0007))
77 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
78 #define DEFAULT_CORE_CLASS (reinterpret_cast<AbckitCoreClass *>(0xdead0008))
79 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
80 #define DEFAULT_CORE_ANNOTATION_INTERFACE (reinterpret_cast<AbckitCoreAnnotationInterface *>(0xdead0009))
81 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
82 #define DEFAULT_CORE_ANNOTATION_INTERFACE_FIELD (reinterpret_cast<AbckitCoreAnnotationInterfaceField *>(0xdead0010))
83 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
84 #define DEFAULT_VALUE (reinterpret_cast<AbckitValue *>(0xdead0011))
85 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
86 #define DEFAULT_CORE_FUNCTION (reinterpret_cast<AbckitCoreFunction *>(0xdead0012))
87 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
88 #define DEFAULT_CORE_ANNOTATION (reinterpret_cast<AbckitCoreAnnotation *>(0xdead0013))
89 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
90 #define DEFAULT_CORE_ANNOTATION_ELEMENT (reinterpret_cast<AbckitCoreAnnotationElement *>(0xdead0014))
91 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
92 #define DEFAULT_DOUBLE (static_cast<double>(0xdead0016))
93 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
94 #define DEFAULT_LITERAL_ARRAY (reinterpret_cast<AbckitLiteralArray *>(0xdead0017))
95 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
96 #define DEFAULT_LITERAL (reinterpret_cast<AbckitLiteral *>(0xdead0018))
97 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
98 #define DEFAULT_FLOAT (static_cast<float>(0xdead0020))
99 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
100 #define DEFAULT_TYPE (reinterpret_cast<AbckitType *>(0xdead0021))
101 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
102 #define DEFAULT_FILE_VERSION (reinterpret_cast<AbckitFileVersion>(0xdead0022))
103 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
104 #define DEFAULT_BB (reinterpret_cast<AbckitBasicBlock *>(0xdead0023))
105 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
106 #define DEFAULT_INST (reinterpret_cast<AbckitInst *>(0xdead0024))
107 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
108 #define DEFAULT_ABCKIT_TYPE (reinterpret_cast<AbckitType *>(0xdead0026))
109 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
110 #define DEFAULT_ARKTS_MODULE (reinterpret_cast<AbckitArktsModule *>(0xdead00027))
111 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
112 #define DEFAULT_JS_MODULE (reinterpret_cast<AbckitJsModule *>(0xdead00028))
113 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
114 #define DEFAULT_NAMESPACE (reinterpret_cast<AbckitArktsNamespace *>(0xdead00029))
115 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
116 #define DEFAULT_ARKTS_IMPORT_DESCRIPTOR (reinterpret_cast<AbckitArktsImportDescriptor *>(0xdead00030))
117 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
118 #define DEFAULT_JS_IMPORT_DESCRIPTOR (reinterpret_cast<AbckitJsImportDescriptor *>(0xdead00031))
119 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
120 #define DEFAULT_ARKTS_FUNCTION (reinterpret_cast<AbckitArktsFunction *>(0xdead00032))
121 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
122 #define DEFAULT_JS_FUNCTION (reinterpret_cast<AbckitJsFunction *>(0xdead00033))
123 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
124 #define DEFAULT_ARKTS_EXPORT_DESCRIPTOR (reinterpret_cast<AbckitArktsExportDescriptor *>(0xdead00034))
125 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
126 #define DEFAULT_JS_EXPORT_DESCRIPTOR (reinterpret_cast<AbckitJsExportDescriptor *>(0xdead00035))
127 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
128 #define DEFAULT_ARKTS_CLASS (reinterpret_cast<AbckitArktsClass *>(0xdead0036))
129 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
130 #define DEFAULT_JS_CLASS (reinterpret_cast<AbckitJsClass *>(0xdead0037))
131 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
132 #define DEFAULT_ANNOTATION (reinterpret_cast<AbckitArktsAnnotation *>(0xdead0038))
133 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
134 #define DEFAULT_ANNOTATION_ELEMENT (reinterpret_cast<AbckitArktsAnnotationElement *>(0xdead0039))
135 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
136 #define DEFAULT_ANNOTATION_INTERFACE (reinterpret_cast<AbckitArktsAnnotationInterface *>(0xdead00040))
137 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
138 #define DEFAULT_ANNOTATION_INTERFACE_FIELD (reinterpret_cast<AbckitArktsAnnotationInterfaceField *>(0xdead0041))
139 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
140 #define DEFAULT_STRUCT_ARKTS_V1_EXTERNAL_MODULE_CREATE_PARAMS \
141     const struct AbckitArktsV1ExternalModuleCreateParams {    \
142         DEFAULT_CONST_CHAR;                                   \
143     }
144 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
145 #define DEFAULT_STRUCT_ARKTS_IMPORT_FROM_DYNAMIC_CREATE_PARAMS \
146     (reinterpret_cast<const struct AbckitArktsImportFromDynamicModuleCreateParams *>(0xdead0039))
147 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
148 #define DEFAULT_STRUCT_ARKTS_DYNAMIC_MODULE_EXPORT_CREATE_PARAMS \
149     (reinterpret_cast<const struct AbckitArktsDynamicModuleExportCreateParams *>(0xdead0039))
150 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
151 #define DEFAULT_STRUCT_ARKTS_ANNOTATION_INTERFACE_CREATE_PARAMS \
152     (reinterpret_cast<const struct AbckitArktsAnnotationInterfaceCreateParams *>(0xdead0039))
153 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
154 #define DEFAULT_STRUCT_ARKTS_ANNOTATION_CREATE_PARAMS \
155     (reinterpret_cast<const struct AbckitArktsAnnotationCreateParams *>(0xdead0039))
156 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
157 #define DEFAULT_STRUCT_ARKTS_ANNOTATION_INTERFACE_FIELD_CREATE_PARAMS \
158     (reinterpret_cast<const struct AbckitArktsAnnotationInterfaceFieldCreateParams *>(0xdead0039))
159 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
160 #define DEFAULT_STRUCT_ARKTS_ANNOTATION_ELEMENT_CREATE_PARAMS \
161     (reinterpret_cast<const struct AbckitArktsAnnotationElementCreateParams *>(0xdead0039))
162 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage, cppcoreguidelines-pro-type-cstyle-cast)
163 #define DEFAULT_ENUM_BITSIZE AbckitBitImmSize::BITSIZE_0
164 
165 // CC-OFFNXT(G.PRE.02) code readability
166 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
167 #define DEFAULT_LAMBDA(T) []([[maybe_unused]] const T &elem) { return true; }
168 
169 #endif  // ABCKIT_MOCK_GLOBAL_VALUES
170