liblzma: Update project maintainers in lzma.h.
[xz.git] / src / common / tuklib_common.h
blobb1f531ea4a68cdd2d7a250ae5603ee1f4ed88641
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 /// \file tuklib_common.h
4 /// \brief Common definitions for tuklib modules
5 //
6 // Author: Lasse Collin
7 //
8 // This file has been put into the public domain.
9 // You can do whatever you want with this file.
11 ///////////////////////////////////////////////////////////////////////////////
13 #ifndef TUKLIB_COMMON_H
14 #define TUKLIB_COMMON_H
16 // The config file may be replaced by a package-specific file.
17 // It should include at least stddef.h, stdbool.h, inttypes.h, and limits.h.
18 #include "tuklib_config.h"
20 // TUKLIB_SYMBOL_PREFIX is prefixed to all symbols exported by
21 // the tuklib modules. If you use a tuklib module in a library,
22 // you should use TUKLIB_SYMBOL_PREFIX to make sure that there
23 // are no symbol conflicts in case someone links your library
24 // into application that also uses the same tuklib module.
25 #ifndef TUKLIB_SYMBOL_PREFIX
26 # define TUKLIB_SYMBOL_PREFIX
27 #endif
29 #define TUKLIB_CAT_X(a, b) a ## b
30 #define TUKLIB_CAT(a, b) TUKLIB_CAT_X(a, b)
32 #ifndef TUKLIB_SYMBOL
33 # define TUKLIB_SYMBOL(sym) TUKLIB_CAT(TUKLIB_SYMBOL_PREFIX, sym)
34 #endif
36 #ifndef TUKLIB_DECLS_BEGIN
37 # ifdef __cplusplus
38 # define TUKLIB_DECLS_BEGIN extern "C" {
39 # else
40 # define TUKLIB_DECLS_BEGIN
41 # endif
42 #endif
44 #ifndef TUKLIB_DECLS_END
45 # ifdef __cplusplus
46 # define TUKLIB_DECLS_END }
47 # else
48 # define TUKLIB_DECLS_END
49 # endif
50 #endif
52 #if defined(__GNUC__) && defined(__GNUC_MINOR__)
53 # define TUKLIB_GNUC_REQ(major, minor) \
54 ((__GNUC__ == (major) && __GNUC_MINOR__ >= (minor)) \
55 || __GNUC__ > (major))
56 #else
57 # define TUKLIB_GNUC_REQ(major, minor) 0
58 #endif
60 #if TUKLIB_GNUC_REQ(2, 5)
61 # define tuklib_attr_noreturn __attribute__((__noreturn__))
62 #else
63 # define tuklib_attr_noreturn
64 #endif
66 #if (defined(_WIN32) && !defined(__CYGWIN__)) \
67 || defined(__OS2__) || defined(__MSDOS__)
68 # define TUKLIB_DOSLIKE 1
69 #endif
71 #endif