Apply PIE to nghttpx
[platform/upstream/nghttp2.git] / third-party / mruby / include / mruby / common.h
1 /*
2 **"common.h - mruby common platform definition"
3 **
4 ** See Copyright Notice in mruby.h
5 */
6
7 #ifndef MRUBY_COMMON_H
8 #define MRUBY_COMMON_H
9
10 #ifdef __APPLE__
11   #ifndef __TARGETCONDITIONALS__
12   #include "TargetConditionals.h"
13   #endif
14 #endif
15
16 #ifdef __cplusplus
17 #ifdef MRB_ENABLE_CXX_ABI
18 #define MRB_BEGIN_DECL
19 #define MRB_END_DECL
20 #else
21 # define MRB_BEGIN_DECL extern "C" {
22 # define MRB_END_DECL }
23 #endif
24 #else
25 /** Start declarations in C mode */
26 # define MRB_BEGIN_DECL
27 /** End declarations in C mode */
28 # define MRB_END_DECL
29 #endif
30
31 /**
32  * Shared compiler macros
33  */
34 MRB_BEGIN_DECL
35
36 /** Declare a function that never returns. */
37 #if defined __STDC_VERSION__ && __STDC_VERSION__ >= 201112L
38 # define mrb_noreturn _Noreturn
39 #elif defined __GNUC__ && !defined __STRICT_ANSI__
40 # define mrb_noreturn __attribute__((noreturn))
41 #elif defined _MSC_VER
42 # define mrb_noreturn __declspec(noreturn)
43 #else
44 # define mrb_noreturn
45 #endif
46
47 /** Mark a function as deprecated. */
48 #if defined __GNUC__ && !defined __STRICT_ANSI__
49 # define mrb_deprecated __attribute__((deprecated))
50 #elif defined _MSC_VER
51 # define mrb_deprecated __declspec(deprecated)
52 #else
53 # define mrb_deprecated
54 #endif
55
56 /** Declare a function as always inlined. */
57 #if defined(_MSC_VER)
58 # define MRB_INLINE static __inline
59 #else
60 # define MRB_INLINE static inline
61 #endif
62
63
64 /** Declare a public MRuby API function. */
65 #if defined(MRB_BUILD_AS_DLL)
66 #if defined(MRB_CORE) || defined(MRB_LIB)
67 # define MRB_API __declspec(dllexport)
68 #else
69 # define MRB_API __declspec(dllimport)
70 #endif
71 #else
72 # define MRB_API extern
73 #endif
74
75 MRB_END_DECL
76
77 #endif  /* MRUBY_COMMON_H */