paludis  Version 1.4.0
attributes.hh
Go to the documentation of this file.
1 /* vim: set sw=4 sts=4 et foldmethod=syntax : */
2 
3 /*
4  * Copyright (c) 2005, 2006, 2007, 2008 Ciaran McCreesh
5  *
6  * This file is part of the Paludis package manager. Paludis is free software;
7  * you can redistribute it and/or modify it under the terms of the GNU General
8  * Public License version 2, as published by the Free Software Foundation.
9  *
10  * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
11  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13  * details.
14  *
15  * You should have received a copy of the GNU General Public License along with
16  * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
17  * Place, Suite 330, Boston, MA 02111-1307 USA
18  */
19 
20 #ifndef PALUDIS_GUARD_PALUDIS_ATTRIBUTES_HH
21 #define PALUDIS_GUARD_PALUDIS_ATTRIBUTES_HH 1
22 
23 /** \file
24  * Declare the PALUDIS_ATTRIBUTE macros.
25  *
26  * \ingroup g_utils
27  *
28  * \section Examples
29  *
30  * - None at this time.
31  */
32 
33 /** \def PALUDIS_ATTRIBUTE
34  * If we're using a recent GCC or ICC, expands to __attribute__, otherwise
35  * discards its arguments.
36  *
37  * \ingroup g_utils
38  */
39 
40 /** \def PALUDIS_VISIBLE
41  * Marker used to represent 'make visible', if visibility is enabled.
42  *
43  * \ingroup g_utils
44  */
45 
46 /** \def PALUDIS_HIDDEN
47  * Marker used to represent 'make hidden', if visibility is enabled.
48  *
49  * \ingroup g_utils
50  */
51 
52 #if (defined(__GNUC__) && ! defined(DOXYGEN))
53 # if defined(__ICC)
54 # define PALUDIS_ATTRIBUTE(x)
55 # else
56 # if ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
57 # define PALUDIS_ATTRIBUTE(x) __attribute__(x)
58 # define PALUDIS_CAN_USE_ATTRIBUTE 1
59 # else
60 # define PALUDIS_ATTRIBUTE(x)
61 # endif
62 # endif
63 #else
64 # define PALUDIS_ATTRIBUTE(x)
65 #endif
66 
67 #if (defined(PALUDIS_ENABLE_VISIBILITY) && ! defined(DOXYGEN))
68 # define PALUDIS_VISIBLE PALUDIS_ATTRIBUTE((visibility("default")))
69 # define PALUDIS_HIDDEN PALUDIS_ATTRIBUTE((visibility("hidden")))
70 #else
71 # define PALUDIS_VISIBLE
72 # define PALUDIS_HIDDEN
73 #endif
74 
75 #if defined(PALUDIS_HAVE_NOEXCEPT)
76 # define PALUDIS_NOEXCEPT(x) noexcept(x)
77 #else
78 # define PALUDIS_NOEXCEPT(x)
79 #endif
80 
81 #define PALUDIS_TLS static __thread
82 
83 #endif