libzypp  17.38.17
Globals.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
12 #ifndef ZYPP_GLOBALS_H
13 #define ZYPP_GLOBALS_H
14 
15 #include <zypp-core/APIConfig.h> // LIBZYPP_ version defines for the LEGACY macro
16 #include <zypp-core/base/Easy.h> // some macros used almost everywhere
17 
27 #ifndef LIBZYPP_VERSION_MAJOR
28 #error Missing APIConfig.h include (LIBZYPP_VERSION_MAJOR)
29 #endif
30 #ifndef LIBZYPP_SOVERSION
31 #error Missing APIConfig.h include (LIBZYPP_SOVERSION)
32 #endif
33 #ifndef LIBZYPP_VERSION
34 #error Missing APIConfig.h include (LIBZYPP_VERSION)
35 #endif
36 #if defined(ZYPPNG) && ZYPPNG
37 // NG never compiles legacy-compat code, regardless of version numbers.
38 # define LEGACY(CL) 0
39 #else
40 # define LEGACY(CL) ( CL < 100 && LIBZYPP_VERSION_MAJOR <= CL ) || ( CL < 10000 && LIBZYPP_SOVERSION <= CL ) || LIBZYPP_VERSION <= CL
41 #endif
42 
59 #if __GNUC__ >= 4
60  #define ZYPP_DECL_EXPORT __attribute__ ((visibility ("default")))
61  #define ZYPP_DECL_IMPORT __attribute__ ((visibility ("default")))
62  #define ZYPP_DECL_HIDDEN __attribute__ ((visibility ("hidden")))
63 #else
64  #define ZYPP_DECL_EXPORT
65  #define ZYPP_DECL_IMPORT
66  #define ZYPP_DECL_HIDDEN
67 #endif
68 
69 #ifdef ZYPP_DLL //defined if zypp is compiled as DLL
70  #define ZYPP_API ZYPP_DECL_EXPORT
71  #define ZYPP_TESTS ZYPP_DECL_EXPORT
72  #define ZYPP_LOCAL ZYPP_DECL_HIDDEN
73 #else
74  #define ZYPP_API ZYPP_DECL_IMPORT
75  #define ZYPP_TESTS ZYPP_DECL_IMPORT
76  #define ZYPP_LOCAL
77 #endif
78 
79 // A small set of internal symbols offered to the deptestomatic
80 // tool (package libzypp-testsuite-tools) to load and evaluate
81 // solver testcases.
82 #define ZYPP_API_DEPTESTOMATIC ZYPP_API
83 
115 #ifndef NDEBUG
116  #ifndef ZYPP_DEPRECATED
117  #define ZYPP_DEPRECATED __attribute__ ((deprecated))
118  #endif
119 #else
120  #ifndef ZYPP_DEPRECATED
121  #define ZYPP_DEPRECATED
122  #endif
123 #endif
124 
145 #ifdef ZYPPNG
146  #define ZYPP_DEFINE_GLOBAL_CONSTANT(type, name, ...) \
147  inline constexpr type name { __VA_ARGS__ };
148  #define ZYPP_DEFINE_GLOBAL_CONSTEXPR(type, name, ...) \
149  inline constexpr type name { __VA_ARGS__ };
150 #else
151  #define ZYPP_DEFINE_GLOBAL_CONSTANT(type, name, ...) \
152  static const type name { __VA_ARGS__ };
153  #define ZYPP_DEFINE_GLOBAL_CONSTEXPR(type, name, ...) \
154  static constexpr type name { __VA_ARGS__ };
155 #endif
156 
157 #endif