diff --git a/src/node.h b/src/node.h index 5962c32d5b46ab..afb75ccd27797d 100644 --- a/src/node.h +++ b/src/node.h @@ -42,7 +42,26 @@ #include "v8.h" // NOLINT(build/include_order) #include "node_version.h" // NODE_MODULE_VERSION -#if defined(__GNUC__) +#define IOJS_MAKE_VERSION(major, minor, patch) \ + ((major) * 0x1000 + (minor) * 0x100 + (patch)) + +#ifdef __clang__ +# define IOJS_CLANG_AT_LEAST(major, minor, patch) \ + (IOJS_MAKE_VERSION(major, minor, patch) <= \ + IOJS_MAKE_VERSION(__clang_major__, __clang_minor__, __clang_patchlevel__)) +#else +# define IOJS_CLANG_AT_LEAST(major, minor, patch) (0) +#endif + +#ifdef __GNUC__ +# define IOJS_GNUC_AT_LEAST(major, minor, patch) \ + (IOJS_MAKE_VERSION(major, minor, patch) <= \ + IOJS_MAKE_VERSION(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)) +#else +# define IOJS_GNUC_AT_LEAST(major, minor, patch) (0) +#endif + +#if IOJS_CLANG_AT_LEAST(2, 9, 0) || IOJS_GNUC_AT_LEAST(4, 5, 0) # define NODE_DEPRECATED(message, declarator) \ __attribute__((deprecated(message))) declarator #elif defined(_MSC_VER)