Commit 29deaef5 authored by jochen's avatar jochen Committed by Commit bot

Introduce a new gyp flag to warn about to be deprecated APIs

This should help to keep syntax errors from creeping into v8.h

Also, I'll remove usages of to-be-deprecated APIs and turn this flag on
for standalone builds

BUG=4134
R=vogelheim@chromium.org
LOG=n

Review URL: https://codereview.chromium.org/1149633003

Cr-Commit-Position: refs/heads/master@{#28538}
parent 57ce9724
......@@ -145,10 +145,14 @@ ifeq ($(i18nsupport), off)
GYPFLAGS += -Dv8_enable_i18n_support=0
TESTFLAGS += --noi18n
endif
# deprecation_warnings=on
# deprecationwarnings=on
ifeq ($(deprecationwarnings), on)
GYPFLAGS += -Dv8_deprecation_warnings=1
endif
# imminentdeprecationwarnings=on
ifeq ($(imminentdeprecationwarnings), on)
GYPFLAGS += -Dv8_imminent_deprecation_warnings=1
endif
# asan=on
ifeq ($(asan), on)
GYPFLAGS += -Dasan=1 -Dclang=1
......
......@@ -59,6 +59,9 @@
# Enable compiler warnings when using V8_DEPRECATED apis.
'v8_deprecation_warnings%': 0,
# Enable compiler warnings when using V8_DEPRECATE_SOON apis.
'v8_imminent_deprecation_warnings%': 0,
# Set to 1 to enable DCHECKs in release builds.
'dcheck_always_on%': 0,
},
......@@ -88,6 +91,9 @@
['v8_deprecation_warnings==1', {
'defines': ['V8_DEPRECATION_WARNINGS',],
}],
['v8_imminent_deprecation_warnings==1', {
'defines': ['V8_IMMINENT_DEPRECATION_WARNINGS',],
}],
['v8_enable_i18n_support==1', {
'defines': ['V8_I18N_SUPPORT',],
}],
......
......@@ -43,6 +43,8 @@
'v8_enable_backtrace%': 0,
'v8_enable_i18n_support%': 1,
'v8_deprecation_warnings': 1,
# TODO(jochen): Turn this on.
'v8_imminent_deprecation_warnings': 0,
'msvs_multi_core_compile%': '1',
'mac_deployment_target%': '10.5',
'release_extra_cflags%': '',
......
......@@ -418,11 +418,11 @@ class WeakCallbackInfo {
V8_INLINE void* GetInternalField(int index) const;
V8_INLINE V8_DEPRECATE_SOON("use indexed version",
void* GetInternalField1()) const {
void* GetInternalField1() const) {
return internal_fields_[0];
}
V8_INLINE V8_DEPRECATE_SOON("use indexed version",
void* GetInternalField2()) const {
void* GetInternalField2() const) {
return internal_fields_[1];
}
......@@ -3104,8 +3104,8 @@ class V8_EXPORT Function : public Object {
int length = 0);
V8_DEPRECATE_SOON("Use maybe version",
Local<Object> NewInstance(int argc,
Handle<Value> argv[])) const;
Local<Object> NewInstance(int argc, Handle<Value> argv[])
const);
V8_WARN_UNUSED_RESULT MaybeLocal<Object> NewInstance(
Local<Context> context, int argc, Handle<Value> argv[]) const;
......
......@@ -313,22 +313,33 @@
#endif
// A macro to mark classes or functions as deprecated.
// A macro (V8_DEPRECATED) to mark classes or functions as deprecated.
#if defined(V8_DEPRECATION_WARNINGS) && V8_HAS_ATTRIBUTE_DEPRECATED_MESSAGE
# define V8_DEPRECATED(message, declarator) \
declarator __attribute__((deprecated(message)))
#define V8_DEPRECATED(message, declarator) \
declarator __attribute__((deprecated(message)))
#elif defined(V8_DEPRECATION_WARNINGS) && V8_HAS_ATTRIBUTE_DEPRECATED
# define V8_DEPRECATED(message, declarator) \
declarator __attribute__((deprecated))
#define V8_DEPRECATED(message, declarator) \
declarator __attribute__((deprecated))
#elif defined(V8_DEPRECATION_WARNINGS) && V8_HAS_DECLSPEC_DEPRECATED
# define V8_DEPRECATED(message, declarator) __declspec(deprecated) declarator
#define V8_DEPRECATED(message, declarator) __declspec(deprecated) declarator
#else
# define V8_DEPRECATED(message, declarator) declarator
#define V8_DEPRECATED(message, declarator) declarator
#endif
// a macro to make it easier to see what will be deprecated.
// A macro (V8_DEPRECATE_SOON) to make it easier to see what will be deprecated.
#if defined(V8_IMMINENT_DEPRECATION_WARNINGS) && \
V8_HAS_ATTRIBUTE_DEPRECATED_MESSAGE
#define V8_DEPRECATE_SOON(message, declarator) \
declarator __attribute__((deprecated(message)))
#elif defined(V8_IMMINENT_DEPRECATION_WARNINGS) && V8_HAS_ATTRIBUTE_DEPRECATED
#define V8_DEPRECATE_SOON(message, declarator) \
declarator __attribute__((deprecated))
#elif defined(V8_IMMINENT_DEPRECATION_WARNINGS) && V8_HAS_DECLSPEC_DEPRECATED
#define V8_DEPRECATE_SOON(message, declarator) __declspec(deprecated) declarator
#else
#define V8_DEPRECATE_SOON(message, declarator) declarator
#endif
// A macro to provide the compiler with branch prediction information.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment