xref: /php-src/ext/dom/lexbor/lexbor/core/def.h (revision bffab33a)
1 /*
2  * Copyright (C) 2018 Alexander Borisov
3  *
4  * Author: Alexander Borisov <borisov@lexbor.com>
5  */
6 
7 #ifndef LEXBOR_DEF_H
8 #define LEXBOR_DEF_H
9 
10 #define LEXBOR_STRINGIZE_HELPER(x) #x
11 #define LEXBOR_STRINGIZE(x) LEXBOR_STRINGIZE_HELPER(x)
12 
13 /* Format */
14 #ifdef _WIN32
15     #define LEXBOR_FORMAT_Z "%Iu"
16 #else
17     #define LEXBOR_FORMAT_Z "%zu"
18 #endif
19 
20 /* Deprecated */
21 #ifdef _MSC_VER
22     #define LXB_DEPRECATED(func) __declspec(deprecated) func
23 #elif defined(__GNUC__) || defined(__INTEL_COMPILER)
24     #define LXB_DEPRECATED(func) func __attribute__((deprecated))
25 #else
26     #define LXB_DEPRECATED(func) func
27 #endif
28 
29 /* Debug */
30 //#define LEXBOR_DEBUG(...) do {} while (0)
31 //#define LEXBOR_DEBUG_ERROR(...) do {} while (0)
32 
33 #define LEXBOR_MEM_ALIGN_STEP sizeof(void *)
34 
35 #ifndef LEXBOR_STATIC
36     #ifdef _WIN32
37         #ifdef LEXBOR_BUILDING
38             #define LXB_API __declspec(dllexport)
39         #else
40             #define LXB_API __declspec(dllimport)
41         #endif
42     #elif (defined(__SUNPRO_C)  || defined(__SUNPRO_CC))
43         #define LXB_API __global
44     #else
45         #if (defined(__GNUC__) && __GNUC__ >= 4) || defined(__INTEL_COMPILER)
46             #define LXB_API __attribute__ ((visibility("default")))
47         #else
48             #define LXB_API
49         #endif
50     #endif
51 #else
52     #define LXB_API
53 #endif
54 
55 #define LXB_EXTERN extern LXB_API
56 
57 #endif /* LEXBOR_DEF_H */
58