Soletta™ Framework
Framework for making IoT devices

Full online documentation | C API Index
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
sol-macros.h
Go to the documentation of this file.
1 /*
2  * This file is part of the Soletta (TM) Project
3  *
4  * Copyright (C) 2015 Intel Corporation. All rights reserved.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 
19 #pragma once
20 
167 #if __GNUC__ >= 4
168 #define SOL_API __attribute__((visibility("default")))
169 #define SOL_ATTR_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
170 #define SOL_ATTR_CONST __attribute__((__const__))
171 #define SOL_ATTR_PRINTF(fmt, arg) __attribute__((format(printf, fmt, arg)))
172 #define SOL_ATTR_SCANF(fmt, arg) __attribute__((format(scanf, fmt, arg)))
173 #define SOL_ATTR_STRFTIME(fmt) __attribute__((format(strftime, fmt, 0)))
174 #define SOL_ATTR_NO_INSTRUMENT __attribute__((no_instrument_function))
175 #define SOL_ATTR_NON_NULL(...) __attribute__((nonnull(__VA_ARGS__)))
176 #define SOL_ATTR_SECTION(secname) __attribute__((section(secname)))
177 #define SOL_ATTR_USED __attribute__((__used__))
178 #define SOL_ATTR_UNUSED __attribute__((__unused__))
179 #define SOL_ATTR_SENTINEL __attribute__((sentinel))
180 #define SOL_ATTR_NO_RETURN __attribute__((noreturn))
181 #define SOL_ATTR_PURE __attribute__((pure))
182 #define SOL_LIKELY(x) __builtin_expect(!!(x), 1)
183 #define SOL_UNLIKELY(x) __builtin_expect(!!(x), 0)
184 #define SOL_UNREACHABLE() __builtin_unreachable()
185 #else
186 #define SOL_API
187 #define SOL_ATTR_WARN_UNUSED_RESULT
188 #define SOL_ATTR_CONST
189 #define SOL_ATTR_PRINTF(fmt, arg)
190 #define SOL_ATTR_SCANF(fmt, arg)
191 #define SOL_ATTR_STRFTIME(fmt)
192 #define SOL_ATTR_NO_INSTRUMENT
193 #define SOL_ATTR_NON_NULL(...)
194 #define SOL_ATTR_SECTION(secname)
195 #define SOL_ATTR_USED
196 #define SOL_ATTR_UNUSED
197 #define SOL_ATTR_SENTINEL
198 #define SOL_ATTR_NO_RETURN
199 #define SOL_ATTR_PURE
200 #define SOL_LIKELY(x)
201 #define SOL_UNLIKELY(x)
202 #define SOL_UNREACHABLE() ((void)0)
203 #endif
204 
205 #ifdef __cplusplus
206 #define SOL_STATIC_ARRAY_SIZE(n) n
207 #else
208 #define SOL_STATIC_ARRAY_SIZE(n) static n
209 #endif
210