1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/APIConfig.h
10 * \brief Provides API related macros.
12 #ifndef ZYPP_APICONFIG_H
13 #define ZYPP_APICONFIG_H
15 #include "zypp/base/Easy.h" // some macros used almost everywhere
17 #define LIBZYPP_VERSION_STRING "@VERSION@"
18 #define LIBZYPP_VERSION_MAJOR @LIBZYPP_MAJOR@
19 #define LIBZYPP_VERSION_MINOR @LIBZYPP_MINOR@
20 #define LIBZYPP_VERSION_PATCH @LIBZYPP_PATCH@
21 #define LIBZYPP_SOVERSION @LIBZYPP_SO_FIRST@
22 #define LIBZYPP_VERSION @LIBZYPP_NUMVERSION@
25 * Legacy code we still support.
27 * Deprecated items we can't drop immediately because YAST/PK still
28 * refer to them or they break binary compatibility, should be
29 * enclosed in `#if LEGACY(#)` where # is either a minor number(<=99),
30 * a soversion [<=9999] or numversion [<=999999].
33 #define LEGACY(CL) ( CL < 100 && LIBZYPP_VERSION_MAJOR <= CL ) || ( CL < 10000 && LIBZYPP_SOVERSION <= CL ) || LIBZYPP_VERSION <= CL
36 * Generic helper definitions for shared library support.
38 * \see e.g. http://gcc.gnu.org/wiki/Visibility
40 * extern "C" ZYPP_API void function(int a);
41 * class ZYPP_API SomeClass
44 * ZYPP_LOCAL void privateMethod(); // Only for use within this DSO
46 * Person(int _c) : c(_c) { }
47 * static void foo(int a);
52 #define ZYPP_DECL_EXPORT __attribute__ ((visibility ("default")))
53 #define ZYPP_DECL_IMPORT __attribute__ ((visibility ("default")))
54 #define ZYPP_DECL_HIDDEN __attribute__ ((visibility ("hidden")))
56 #define ZYPP_DECL_EXPORT
57 #define ZYPP_DECL_IMPORT
58 #define ZYPP_DECL_HIDDEN
61 #ifdef ZYPP_DLL //defined if zypp is compiled as DLL
62 #define ZYPP_API ZYPP_DECL_EXPORT
63 #define ZYPP_LOCAL ZYPP_DECL_HIDDEN
65 #define ZYPP_API ZYPP_DECL_IMPORT
70 * The ZYPP_DEPRECATED macro can be used to trigger compile-time warnings
71 * with gcc >= 3.2 when deprecated functions are used.
73 * For non-inline functions, the macro is used at the very end of the
74 * function declaration, right before the semicolon, unless it's pure
77 * int deprecatedFunc() const ZYPP_DEPRECATED;
78 * virtual int deprecatedPureVirtualFunc() const ZYPP_DEPRECATED = 0;
80 * Functions which are implemented inline are handled differently:
81 * the ZYPP_DEPRECATED macro is used at the front, right before the
82 * return type, but after "static" or "virtual":
84 * ZYPP_DEPRECATED void deprecatedFuncA() { .. }
85 * virtual ZYPP_DEPRECATED int deprecatedFuncB() { .. }
86 * static ZYPP_DEPRECATED bool deprecatedFuncC() { .. }
88 * You can also mark whole structs or classes as deprecated, by inserting
89 * the ZYPP_DEPRECATED macro after the struct/class keyword, but before
90 * the name of the struct/class:
92 * class ZYPP_DEPRECATED DeprecatedClass { };
93 * struct ZYPP_DEPRECATED DeprecatedStruct { };
95 * However, deprecating a struct/class doesn't create a warning for gcc
96 * versions <= 3.3 (haven't tried 3.4 yet). If you want to deprecate a class,
97 * also deprecate all member functions as well (which will cause warnings).
100 #if __GNUC__ - 0 > 3 || (__GNUC__ - 0 == 3 && __GNUC_MINOR__ - 0 >= 2)
101 #ifndef ZYPP_DEPRECATED
102 #define ZYPP_DEPRECATED __attribute__ ((deprecated))
105 #ifndef ZYPP_DEPRECATED
106 #define ZYPP_DEPRECATED
110 #endif //ZYPP_APICONFIG_H