TEMU
4.4
The Terma Emulator
Attributes.h
Go to the documentation of this file.
1
//===-- temu-c/Attributes.h - Compiler attributes ---------------*- C++ -*-===//
2
//
3
// TEMU: The Terma Emulator
4
// (c) Terma 2016
5
// Authors: Mattias Holm <maho (at) terma.com>
6
//
7
//===----------------------------------------------------------------------===//
8
9
//
10
// This header allows the user to control the emission of deprecation
11
// warnings and unused argument warnings (which tend to be common due
12
// to interfaces being general purpose). To omit the standard
13
// attributes simply redefine them before you include this header.
14
//
15
16
#
ifndef
__has_feature
17
#
define
__has_feature
(
x
)
0
18
#
endif
19
20
#
ifndef
TEMU_DEPRECATED
21
#
define
TEMU_DEPRECATED
__attribute__
(
(
deprecated
)
)
22
#
endif
23
24
/*
25
Unused is used on unused parameters, this instead of using the old
26
style trick (void)param; Unused parameters are fairly common in TEMU
27
based code as interfaces will by necesity force function signatures
28
in a way that is beyond the influence of API user.
29
*/
30
#
ifndef
TEMU_UNUSED
31
#
define
TEMU_UNUSED
__attribute__
(
(
unused
)
)
32
#
endif
33
34
/* GCC does support nonnull, but it must be used on the function iteslf
35
giving the nonnull parameter indices in a list.
36
This is not what we indend here. TEMU_NONNULL should be used on the
37
parameters directly, this usage is supported by clang, so we get
38
some additional checking in clang this way.
39
40
Ofcourse, the purpose of the attribute is to document the API in a
41
somewhat concise way, so in either case we should try to used the
42
attribute even if it does not have a meaning in GCC.
43
*/
44
#
ifndef
TEMU_NONNULL
45
#
ifdef
__clang__
46
#
define
TEMU_NONNULL
__attribute__
(
(
nonnull
)
)
47
#
else
48
#
define
TEMU_NONNULL
49
#
endif
50
#
endif
51
52
#
ifndef
TEMU_API
53
#
define
TEMU_API
__attribute__
(
(
visibility
(
"default"
)
)
)
54
#
endif
55
56
#
ifndef
TEMU_INTERNAL
57
#
define
TEMU_INTERNAL
__attribute__
(
(
visibility
(
"hidden"
)
)
)
58
#
endif
59
60
#
ifndef
TEMU_MAYBE_UNUSED
61
#
define
TEMU_MAYBE_UNUSED
__attribute__
(
(
unused
)
)
62
#
endif
__has_feature
#define __has_feature(x)
Definition:
Attributes.h:17
temu-c
Support
Attributes.h
Generated by
1.8.17