Zephyr API Documentation
4.0.0-rc2
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
types.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2017 Linaro Limited
3
*
4
* SPDX-License-Identifier: Apache-2.0
5
*/
6
7
#ifndef ZEPHYR_INCLUDE_ZEPHYR_TYPES_H_
8
#define ZEPHYR_INCLUDE_ZEPHYR_TYPES_H_
9
10
#include <stddef.h>
11
#include <
stdint.h
>
12
13
#ifdef __cplusplus
14
extern
"C"
{
15
#endif
16
17
/*
18
* A type with strong alignment requirements, similar to C11 max_align_t. It can
19
* be used to force alignment of data structures allocated on the stack or as
20
* return * type for heap allocators.
21
*/
22
typedef
union
{
23
long
long
thelonglong;
24
long
double
thelongdouble;
25
uintmax_t
theuintmax_t;
26
size_t
thesize_t;
27
uintptr_t
theuintptr_t;
28
void
*thepvoid;
29
void (*thepfunc)(void);
30
} z_max_align_t;
31
32
/*
33
* Thread local variables are declared with different keywords depending on
34
* which C/C++ standard that is used. C++11 and C23 uses "thread_local" whilst
35
* C11 uses "_Thread_local". Previously the GNU "__thread" keyword was used
36
* which is the same in both gcc and g++.
37
*/
38
#ifndef Z_THREAD_LOCAL
39
#if defined(__cplusplus) && (__cplusplus) >= 201103L
/* C++11 */
40
#define Z_THREAD_LOCAL thread_local
41
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__) >= 202311L
/* C23 */
42
#define Z_THREAD_LOCAL thread_local
43
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__) >= 201112L
/* C11 */
44
#define Z_THREAD_LOCAL _Thread_local
45
#else
/* Default back to old behavior which used the GNU keyword. */
46
#define Z_THREAD_LOCAL __thread
47
#endif
48
#endif
/* Z_THREAD_LOCAL */
49
50
#ifdef __cplusplus
51
/* Zephyr requires an int main(void) signature with C linkage for the application main if present */
52
extern
int
main(
void
);
53
#endif
54
55
#ifdef __cplusplus
56
}
57
#endif
58
59
#endif
/* ZEPHYR_INCLUDE_ZEPHYR_TYPES_H_ */
stdint.h
uintptr_t
__UINTPTR_TYPE__ uintptr_t
Definition
stdint.h:105
uintmax_t
__UINT64_TYPE__ uintmax_t
Definition
stdint.h:92
zephyr
types.h
Generated on Sat Nov 9 2024 00:03:13 for Zephyr API Documentation by
1.12.0