Software APIs
sw
device
lib
base
freestanding
stddef.h
Go to the documentation of this file.
1
// Copyright lowRISC contributors (OpenTitan project).
2
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
3
// SPDX-License-Identifier: Apache-2.0
4
5
#ifndef OPENTITAN_SW_DEVICE_LIB_BASE_FREESTANDING_STDDEF_H_
6
#define OPENTITAN_SW_DEVICE_LIB_BASE_FREESTANDING_STDDEF_H_
7
8
#include <
stdalign.h
>
9
#include <
stdint.h
>
10
11
/**
12
* @file
13
* @brief C library Common definitions (Freestanding)
14
*
15
* This header implements the stdint.h standard header, as required by C11 S4p6.
16
* This header is specified in detail in S7.19 of the same.
17
*
18
* See https://github.com/riscv/riscv-elf-psabi-doc/blob/master/riscv-elf.md
19
* for the RISC-V specifics this file conforms to.
20
*/
21
22
/**
23
* @internal
24
* GCC's built-in defines do not include a type with the maximum alignment, but
25
* does include a define with the maximum alignment value. Since the only
26
* requirement of `max_align_t` is that it be some type such that its alignment
27
* is maximal, we simply use a one-byte struct whose alignment is forced to be
28
* the maximum.
29
*/
30
typedef
struct
{
31
alignas
(__BIGGEST_ALIGNMENT__) uint8_t __nonce;
/**< @private **/
32
}
max_align_t
;
33
34
typedef
__PTRDIFF_TYPE__ ptrdiff_t;
35
typedef
__SIZE_TYPE__ size_t;
36
typedef
__WCHAR_TYPE__ wchar_t;
37
38
#define NULL ((void *)0)
/**< @hideinitializer */
39
#define offsetof(type, member) \
40
__builtin_offsetof(type, member)
/**< @hideinitializer */
41
42
#endif // OPENTITAN_SW_DEVICE_LIB_BASE_FREESTANDING_STDDEF_H_
Return to
OpenTitan Documentation