1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
/* This file is part of the KDE libraries
Copyright (c) 2002-2003 KDE Team
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef _KDE_MACROS_H_
#define _KDE_MACROS_H_
/**
* The KDE_NO_EXPORT macro marks the symbol of the given variable
* to be hidden. A hidden symbol is stripped during the linking step,
* so it can't be used from outside the resulting library, which is similiar
* to static. However, static limits the visibility to the current
* compilation unit. hidden symbols can still be used in multiple compilation
* units.
*
* \code
* int KDE_NO_EXPORT foo;
* int KDE_EXPORT bar;
* \end
*/
#if __GNUC__ - 0 > 3 || (__GNUC__ - 0 == 3 && __GNUC_MINOR__ - 0 > 2)
#define KDE_NO_EXPORT __attribute__ ((visibility("hidden")))
#define KDE_EXPORT __attribute__ ((visibility("visible")))
#else
#define KDE_NO_EXPORT
#define KDE_EXPORT
#endif
/**
* The KDE_PACKED can be used to hint the compiler that a particular
* structure or class should not contain unnecessary paddings.
*/
#ifdef __GNUC__
#define KDE_PACKED __attribute__((__packed__))
#else
#define KDE_PACKED
#endif
/**
* The KDE_DEPRECATED macro can be used to trigger compile-time warnings
* with gcc >= 3.2 when deprecated functions are used.
*
* For non-inline functions, the macro gets inserted at the very end of the
* function declaration, right before the semicolon:
*
* \code
* DeprecatedConstructor() KDE_DEPRECATED;
* void deprecatedFunctionA() KDE_DEPRECATED;
* int deprecatedFunctionB() const KDE_DEPRECATED;
* \endcode
*
* Functions which are implemented inline are handled differently: for them,
* the KDE_DEPRECATED macro is inserted at the front, right before the return
* type, but after "static" or "virtual":
*
* \code
* KDE_DEPRECATED void deprecatedInlineFunctionA() { .. }
* virtual KDE_DEPRECATED int deprecatedInlineFunctionB() { .. }
* static KDE_DEPRECATED bool deprecatedInlineFunctionC() { .. }
* \end
*
* You can also mark whole structs or classes as deprecated, by inserting the
* KDE_DEPRECATED macro after the struct/class keyword, but before the
* name of the struct/class:
*
* \code
* class KDE_DEPRECATED DeprecatedClass { };
* struct KDE_DEPRECATED DeprecatedStruct { };
* \endcode
*
* \note
* It does not make much sense to use the KDE_DEPRECATED keyword for a Qt signal
* or a slot; this is because signals and slots always get referenced by the
* code generated by moc.
*
* \par
* Also note that it is not possible to use KDE_DEPRECATED for classes which
* use the k_dcop keyword (to indicate a DCOP interface declaration); this is
* because the dcopidl program would choke on the unexpected declaration
* syntax.
*/
#if __GNUC__ - 0 > 3 || (__GNUC__ - 0 == 3 && __GNUC_MINOR__ - 0 >= 2)
# define KDE_DEPRECATED __attribute__ ((deprecated))
#else
# define KDE_DEPRECATED
#endif
#endif // _KDE_MACROS_H_
|