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

fix: compilation of native modules on windows with older msvc versions #21960

Merged
merged 1 commit into from Jan 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions patches/v8/.patches
Expand Up @@ -8,3 +8,4 @@ workaround_an_undefined_symbol_error.patch
do_not_export_private_v8_symbols_on_windows.patch
revert_cleanup_switch_offset_of_to_offsetof_where_possible.patch
objects_fix_memory_leak_in_prototypeusers_add.patch
fix_build_deprecated_attirbute_for_older_msvc_versions.patch
@@ -0,0 +1,43 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Deepak Mohan <hop2deep@gmail.com>
Date: Tue, 28 Jan 2020 15:48:03 -0800
Subject: fix: usage of c++ [[deprecated]] attirbute for older msvc versions

VS 2015 update 3 has a bug where [[deprecated]] attribute cannot
be applied to constructor declarations, this is fixed in 2017 and
higher versions, but native module compiling with this version
will have an issue.

diff --git a/include/v8config.h b/include/v8config.h
index 40d23c35c186e4def1fcf59c28527de292d9fd7a..7d1ef7b5bf0ff6693b8a04afc1e319219c14e230 100644
--- a/include/v8config.h
+++ b/include/v8config.h
@@ -388,10 +388,13 @@
# define V8_NOINLINE /* NOT SUPPORTED */
#endif

-
// A macro (V8_DEPRECATED) to mark classes or functions as deprecated.
#if defined(V8_DEPRECATION_WARNINGS)
-# define V8_DEPRECATED(message) [[deprecated(message)]]
+# if defined(_MSC_VER) && _MSC_VER <= 1900
+# define V8_DEPRECATED(message) __declspec(deprecated(message))
+# else
+# define V8_DEPRECATED(message) [[deprecated(message)]]
+# endif
#else
# define V8_DEPRECATED(message)
#endif
@@ -399,7 +402,11 @@

// A macro (V8_DEPRECATE_SOON) to make it easier to see what will be deprecated.
#if defined(V8_IMMINENT_DEPRECATION_WARNINGS)
-# define V8_DEPRECATE_SOON(message) [[deprecated(message)]]
+# if defined(_MSC_VER) && _MSC_VER <= 1900
+# define V8_DEPRECATE_SOON(message) __declspec(deprecated(message))
+# else
+# define V8_DEPRECATE_SOON(message) [[deprecated(message)]]
+# endif
#else
# define V8_DEPRECATE_SOON(message)
#endif