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