Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
Loading...
Searching...
No Matches
attributes.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2015 Roc Streaming authors
3
*
4
* This Source Code Form is subject to the terms of the Mozilla Public
5
* License, v. 2.0. If a copy of the MPL was not distributed with this
6
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
7
*/
8
9
//! @file roc_core/attributes.h
10
//! @brief Compiler attributes.
11
12
#ifndef ROC_CORE_ATTRIBUTES_H_
13
#define ROC_CORE_ATTRIBUTES_H_
14
15
#include <hedley.h>
16
17
//! Explicitly specify a default visibility for a specific symbol.
18
#define ROC_ATTR_EXPORT HEDLEY_PUBLIC
19
20
//! Declares that the return operator is not reachable.
21
#define ROC_ATTR_UNREACHABLE_RETURN HEDLEY_UNREACHABLE_RETURN
22
23
//! Function never returns.
24
#define ROC_ATTR_NORETURN HEDLEY_NO_RETURN
25
26
//! Function gets printf-like arguments.
27
#define ROC_ATTR_PRINTF(fmt_pos, args_pos) HEDLEY_PRINTF_FORMAT(fmt_pos, args_pos)
28
29
#if HEDLEY_HAS_ATTRIBUTE(unused)
30
//! Function or variable is never used but no warning should be generated.
31
#define ROC_ATTR_UNUSED __attribute__((unused))
32
#else
33
//! Function or variable is never used but no warning should be generated.
34
#define ROC_ATTR_UNUSED
35
#endif
36
37
#if HEDLEY_HAS_ATTRIBUTE(packed)
38
//! Pack structure fields.
39
//! Place these before class or struct keyword.
40
#define ROC_ATTR_PACKED_BEGIN
41
//! Pack structure fields.
42
//! Place these between '}' and ';'.
43
#define ROC_ATTR_PACKED_END __attribute__((packed))
44
#else
45
//! Pack structure fields.
46
//! Place these before class or struct keyword.
47
#define ROC_ATTR_PACKED_BEGIN
48
//! Pack structure fields.
49
//! Place these between '}' and ';'.
50
#define ROC_ATTR_PACKED_END
51
#endif
52
53
#if HEDLEY_HAS_ATTRIBUTE(aligned)
54
//! The filed should have given alignment.
55
#define ROC_ATTR_ALIGNED(x) __attribute__((aligned(x)))
56
#endif
57
58
#if HEDLEY_HAS_ATTRIBUTE(no_sanitize)
59
//! Suppress undefined behavior sanitizer for a particular function.
60
#define ROC_ATTR_NO_SANITIZE_UB __attribute__((no_sanitize("undefined"
)))
61
#elif HEDLEY_HAS_ATTRIBUTE(no_sanitize_undefined)
62
//! Suppress undefined behavior sanitizer for a particular function.
63
#define ROC_ATTR_NO_SANITIZE_UB __attribute__((no_sanitize_undefined))
64
#else
65
//! Suppress undefined behavior sanitizer for a particular function.
66
#define ROC_ATTR_NO_SANITIZE_UB
67
#endif
68
69
#endif
// ROC_CORE_ATTRIBUTES_H_
roc_core
attributes.h
Generated by
1.9.7