Index: include/v8config.h |
diff --git a/include/v8config.h b/include/v8config.h |
index 834f9c50ec07794ee5eaf22696bc7664bca8b7a8..631ad0d0479cb915a153a57778d98a83b21460ef 100644 |
--- a/include/v8config.h |
+++ b/include/v8config.h |
@@ -187,6 +187,7 @@ |
// supported |
// V8_HAS_ATTRIBUTE_DEPRECATED - __attribute__((deprecated)) supported |
// V8_HAS_ATTRIBUTE_NOINLINE - __attribute__((noinline)) supported |
+// V8_HAS_ATTRIBUTE_UNUSED - __attribute__((unused)) supported |
// V8_HAS_ATTRIBUTE_VISIBILITY - __attribute__((visibility)) supported |
// V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT - __attribute__((warn_unused_result)) |
// supported |
@@ -216,6 +217,7 @@ |
# define V8_HAS_ATTRIBUTE_ALWAYS_INLINE (__has_attribute(always_inline)) |
# define V8_HAS_ATTRIBUTE_DEPRECATED (__has_attribute(deprecated)) |
# define V8_HAS_ATTRIBUTE_NOINLINE (__has_attribute(noinline)) |
+# define V8_HAS_ATTRIBUTE_UNUSED (__has_attribute(unused)) |
# define V8_HAS_ATTRIBUTE_VISIBILITY (__has_attribute(visibility)) |
# define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT \ |
(__has_attribute(warn_unused_result)) |
@@ -247,6 +249,7 @@ |
# define V8_HAS_ATTRIBUTE_DEPRECATED (V8_GNUC_PREREQ(3, 4, 0)) |
# define V8_HAS_ATTRIBUTE_DEPRECATED_MESSAGE (V8_GNUC_PREREQ(4, 5, 0)) |
# define V8_HAS_ATTRIBUTE_NOINLINE (V8_GNUC_PREREQ(3, 4, 0)) |
+# define V8_HAS_ATTRIBUTE_UNUSED (V8_GNUC_PREREQ(2, 95, 0)) |
# define V8_HAS_ATTRIBUTE_VISIBILITY (V8_GNUC_PREREQ(4, 3, 0)) |
# define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT \ |
(!V8_CC_INTEL && V8_GNUC_PREREQ(4, 1, 0)) |
@@ -334,6 +337,14 @@ declarator __attribute__((deprecated)) |
#endif |
+// A macro to mark variables or types as unused, avoiding compiler warnings. |
+#if V8_HAS_ATTRIBUTE_UNUSED |
+# define V8_UNUSED __attribute__((unused)) |
+#else |
+# define V8_UNUSED |
+#endif |
+ |
+ |
// Annotate a function indicating the caller must examine the return value. |
// Use like: |
// int foo() V8_WARN_UNUSED_RESULT; |