1 ///////////////////////////////////////////////////////////////////////////////
3 /// \file tuklib_common.h
4 /// \brief Common definitions for tuklib modules
6 // Author: Lasse Collin
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, 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
29 #define TUKLIB_CAT_X(a, b) a ## b
30 #define TUKLIB_CAT(a, b) TUKLIB_CAT_X(a, b)
33 # define TUKLIB_SYMBOL(sym) TUKLIB_CAT(TUKLIB_SYMBOL_PREFIX, sym)
36 #ifndef TUKLIB_DECLS_BEGIN
38 # define TUKLIB_DECLS_BEGIN extern "C" {
40 # define TUKLIB_DECLS_BEGIN
44 #ifndef TUKLIB_DECLS_END
46 # define TUKLIB_DECLS_END }
48 # define TUKLIB_DECLS_END
52 #if defined(__GNUC__) && defined(__GNUC_MINOR__)
53 # define TUKLIB_GNUC_REQ(major, minor) \
54 ((__GNUC__ == (major) && __GNUC_MINOR__ >= (minor)) \
55 || __GNUC__ > (major))
57 # define TUKLIB_GNUC_REQ(major, minor) 0
60 #if TUKLIB_GNUC_REQ(2, 5)
61 # define tuklib_attr_noreturn __attribute__((__noreturn__))
63 # define tuklib_attr_noreturn
66 #if (defined(_WIN32) && !defined(__CYGWIN__)) \
67 || defined(__OS2__) || defined(__MSDOS__)
68 # define TUKLIB_DOSLIKE 1