Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src: fix NODE_DEPRECATED macro with old compilers #1626

Merged
merged 1 commit into from
May 5, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 23 additions & 4 deletions src/node.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,33 @@
#include "v8.h" // NOLINT(build/include_order)
#include "node_version.h" // NODE_MODULE_VERSION

#if defined(__GNUC__)
# define NODE_DEPRECATED(message, declarator) \
#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)
# define NODE_DEPRECATED(message, declarator) \
# define NODE_DEPRECATED(message, declarator) \
__declspec(deprecated) declarator
#else
# define NODE_DEPRECATED(message, declarator) \
# define NODE_DEPRECATED(message, declarator) \
declarator
#endif

Expand Down