libzypp: zypp-core/Globals.h File Reference

libzypp 17.36.6

Macros
Globals.h File Reference

Provides API related macros. More...

`#include <zypp-core/APIConfig.h>`
`#include <zypp-core/base/Easy.h>`

Go to the source code of this file.

## Macros
#define | LEGACY(CL)
| Legacy code we still support.
#define | ZYPP_DECL_EXPORT
| Generic helper definitions for shared library support.
#define | ZYPP_DECL_IMPORT
#define | ZYPP_DECL_HIDDEN
#define | ZYPP_API ZYPP_DECL_IMPORT
#define | ZYPP_TESTS ZYPP_DECL_IMPORT
#define | ZYPP_LOCAL
#define | ZYPP_API_DEPTESTOMATIC ZYPP_API
#define | ZYPP_DEPRECATED __attribute__ ((deprecated))
| The ZYPP_DEPRECATED macro can be used to trigger compile-time warnings with gcc >= 3.2 when deprecated functions are used.

## Detailed Description

Provides API related macros.

Definition in file Globals.h.

## Macro Definition Documentation

## ◆ LEGACY

#define LEGACY | ( |  | CL | ) |

Value:
( CL < 100 && LIBZYPP_VERSION_MAJOR <= CL ) || ( CL < 10000 && LIBZYPP_SOVERSION <= CL ) || LIBZYPP_VERSION <= CL

Legacy code we still support.

Deprecated items we can't drop immediately because YAST/PK still refer to them or they break binary compatibility, should be enclosed in `#if LEGACY(#)` where # is either a major number(<=99), a soversion [<=9999] or numversion [<=999999].

Definition at line 36 of file Globals.h.

## ◆ ZYPP_DECL_EXPORT

#define ZYPP_DECL_EXPORT

Generic helper definitions for shared library support.

See also
  e.g. http://gcc.gnu.org/wiki/Visibility
  extern "C" ZYPP_API void function(int a);
  class ZYPP_API SomeClass
  {
  int c;
  ZYPP_LOCAL void privateMethod(); // Only for use within this DSO
  public:
  Person(int _c) : c(_c) { }
  static void foo(int a);
  };
  a
  unsigned short a
  Definition mediablocklist.cc:0
  ZYPP_LOCAL
  #define ZYPP_LOCAL
  Definition Globals.h:71
  ZYPP_API
  #define ZYPP_API
  Definition Globals.h:69
  };

Definition at line 59 of file Globals.h.

## ◆ ZYPP_DECL_IMPORT

#define ZYPP_DECL_IMPORT

Definition at line 60 of file Globals.h.

## ◆ ZYPP_DECL_HIDDEN

#define ZYPP_DECL_HIDDEN

Definition at line 61 of file Globals.h.

## ◆ ZYPP_API

#define ZYPP_API ZYPP_DECL_IMPORT
| related

Definition at line 69 of file Globals.h.

## ◆ ZYPP_TESTS

#define ZYPP_TESTS ZYPP_DECL_IMPORT

Definition at line 70 of file Globals.h.

## ◆ ZYPP_LOCAL

#define ZYPP_LOCAL

Definition at line 71 of file Globals.h.

## ◆ ZYPP_API_DEPTESTOMATIC

#define ZYPP_API_DEPTESTOMATIC ZYPP_API

Definition at line 77 of file Globals.h.

## ◆ ZYPP_DEPRECATED

#define ZYPP_DEPRECATED __attribute__ ((deprecated))

The ZYPP_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 is used at the very end of the function declaration, right before the semicolon, unless it's pure virtual:

int deprecatedFunc() const ZYPP_DEPRECATED; virtual int deprecatedPureVirtualFunc() const ZYPP_DEPRECATED = 0;

Functions which are implemented inline are handled differently: the ZYPP_DEPRECATED macro is used at the front, right before the return type, but after "static" or "virtual":

ZYPP_DEPRECATED void deprecatedFuncA() { .. } virtual ZYPP_DEPRECATED int deprecatedFuncB() { .. } static ZYPP_DEPRECATED bool deprecatedFuncC() { .. }

You can also mark whole structs or classes as deprecated, by inserting the ZYPP_DEPRECATED macro after the struct/class keyword, but before the name of the struct/class:

class ZYPP_DEPRECATED DeprecatedClass { }; struct ZYPP_DEPRECATED DeprecatedStruct { };

However, deprecating a struct/class doesn't create a warning for gcc versions <= 3.3 (haven't tried 3.4 yet). If you want to deprecate a class, also deprecate all member functions as well (which will cause warnings).

Definition at line 112 of file Globals.h.