2 ** @file common.h - mruby common platform definition"
4 ** See Copyright Notice in mruby.h
11 #ifndef __TARGETCONDITIONALS__
12 #include "TargetConditionals.h"
17 #ifdef MRB_ENABLE_CXX_ABI
18 #define MRB_BEGIN_DECL
21 # define MRB_BEGIN_DECL extern "C" {
22 # define MRB_END_DECL }
25 /** Start declarations in C mode */
26 # define MRB_BEGIN_DECL
27 /** End declarations in C mode */
32 * Shared compiler macros
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)
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)
53 # define mrb_deprecated
56 /** Declare a function as always inlined. */
57 #if defined _MSC_VER && _MSC_VER < 1900
59 # define inline __inline
62 #define MRB_INLINE static inline
64 /** Declare a public MRuby API function. */
66 #if defined(MRB_BUILD_AS_DLL)
67 #if defined(MRB_CORE) || defined(MRB_LIB)
68 # define MRB_API __declspec(dllexport)
70 # define MRB_API __declspec(dllimport)
73 # define MRB_API extern
77 /** Declare mingw versions */
78 #if defined(__MINGW32__) || defined(__MINGW64__)
80 # if defined(__MINGW64_VERSION_MAJOR)
81 # define MRB_MINGW64_VERSION (__MINGW64_VERSION_MAJOR * 1000 + __MINGW64_VERSION_MINOR)
82 # elif defined(__MINGW32_MAJOR_VERSION)
83 # define MRB_MINGW32_VERSION (__MINGW32_MAJOR_VERSION * 1000 + __MINGW32_MINOR_VERSION)
89 #endif /* MRUBY_COMMON_H */