Rizin
unix-like reverse engineering framework and cli tools
tuklib_common.h
Go to the documentation of this file.
1 //
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.
10 //
12 
13 #ifndef TUKLIB_COMMON_H
14 #define TUKLIB_COMMON_H
15 
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"
19 
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
28 
29 #define TUKLIB_CAT_X(a, b) a ## b
30 #define TUKLIB_CAT(a, b) TUKLIB_CAT_X(a, b)
31 
32 #ifndef TUKLIB_SYMBOL
33 # define TUKLIB_SYMBOL(sym) TUKLIB_CAT(TUKLIB_SYMBOL_PREFIX, sym)
34 #endif
35 
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
43 
44 #ifndef TUKLIB_DECLS_END
45 # ifdef __cplusplus
46 # define TUKLIB_DECLS_END }
47 # else
48 # define TUKLIB_DECLS_END
49 # endif
50 #endif
51 
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
59 
60 #if TUKLIB_GNUC_REQ(2, 5)
61 # define tuklib_attr_noreturn __attribute__((__noreturn__))
62 #else
63 # define tuklib_attr_noreturn
64 #endif
65 
66 #if (defined(_WIN32) && !defined(__CYGWIN__)) \
67  || defined(__OS2__) || defined(__MSDOS__)
68 # define TUKLIB_DOSLIKE 1
69 #endif
70 
71 #endif