Asterisk - The Open Source Telephony Project GIT-master-7e7a603
compiler.h
Go to the documentation of this file.
1/*
2 * Asterisk -- An open source telephony toolkit.
3 *
4 * Copyright (C) 1999 - 2005, Digium, Inc.
5 *
6 * Mark Spencer <markster@digium.com>
7 *
8 * See http://www.asterisk.org for more information about
9 * the Asterisk project. Please do not directly contact
10 * any of the maintainers of this project for assistance;
11 * the project provides a web site, mailing lists and IRC
12 * channels for your use.
13 *
14 * This program is free software, distributed under the terms of
15 * the GNU General Public License Version 2. See the LICENSE file
16 * at the top of the source tree.
17 */
18
19/*! \file
20 * \brief Compiler-specific macros and other items
21 */
22
23#ifndef _ASTERISK_COMPILER_H
24#define _ASTERISK_COMPILER_H
25
26#ifdef HAVE_ATTRIBUTE_always_inline
27#define force_inline __attribute__((always_inline)) inline
28#else
29#define force_inline inline
30#endif
31
32#ifdef HAVE_ATTRIBUTE_pure
33#define attribute_pure __attribute__((pure))
34#else
35#define attribute_pure
36#endif
37
38#ifdef HAVE_ATTRIBUTE_const
39#define attribute_const __attribute__((const))
40#else
41#define attribute_const
42#endif
43
44#ifdef HAVE_ATTRIBUTE_deprecated
45#define attribute_deprecated __attribute__((deprecated))
46#else
47#define attribute_deprecated
48#endif
49
50#ifdef HAVE_ATTRIBUTE_unused
51#define attribute_unused __attribute__((unused))
52#else
53#define attribute_unused
54#endif
55
56#ifdef HAVE_ATTRIBUTE_malloc
57#define attribute_malloc __attribute__((malloc))
58#else
59#define attribute_malloc
60#endif
61
62#ifdef HAVE_ATTRIBUTE_sentinel
63#define attribute_sentinel __attribute__((sentinel))
64#else
65#define attribute_sentinel
66#endif
67
68#ifdef HAVE_ATTRIBUTE_warn_unused_result
69#define attribute_warn_unused_result __attribute__((warn_unused_result))
70#else
71#define attribute_warn_unused_result
72#endif
73
74#ifdef HAVE_ATTRIBUTE_may_alias
75#define attribute_may_alias __attribute__((may_alias))
76#else
77#define attribute_may_alias
78#endif
79
80#ifdef HAVE_ATTRIBUTE_noreturn
81#define attribute_noreturn __attribute__((noreturn))
82#else
83#define attribute_noreturn
84#endif
85
86/* Some older version of GNU gcc (3.3.5 on OpenBSD 4.3 for example) dont like 'NULL' as sentinel */
87#define SENTINEL ((char *)NULL)
88
89#endif /* _ASTERISK_COMPILER_H */