Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(46)

Unified Diff: src/base/compiler-specific.h

Issue 526223002: Use Chrome compatible naming for compiler specifics. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: mips Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/ast-value-factory.cc ('k') | src/base/cpu.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/base/compiler-specific.h
diff --git a/src/base/compiler-specific.h b/src/base/compiler-specific.h
new file mode 100644
index 0000000000000000000000000000000000000000..475a32c2c1032b0e31f275e25849b6aa9f4d5f42
--- /dev/null
+++ b/src/base/compiler-specific.h
@@ -0,0 +1,58 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef V8_BASE_COMPILER_SPECIFIC_H_
+#define V8_BASE_COMPILER_SPECIFIC_H_
+
+#include "include/v8config.h"
+
+// Annotate a variable indicating it's ok if the variable is not used.
+// (Typically used to silence a compiler warning when the assignment
+// is important for some other reason.)
+// Use like:
+// int x ALLOW_UNUSED = ...;
+#if V8_HAS_ATTRIBUTE_UNUSED
+#define ALLOW_UNUSED __attribute__((unused))
+#else
+#define ALLOW_UNUSED
+#endif
+
+
+// Annotate a virtual method indicating it must be overriding a virtual
+// method in the parent class.
+// Use like:
+// virtual void bar() OVERRIDE;
+#if V8_HAS_CXX11_OVERRIDE
+#define OVERRIDE override
+#else
+#define OVERRIDE /* NOT SUPPORTED */
+#endif
+
+
+// Annotate a virtual method indicating that subclasses must not override it,
+// or annotate a class to indicate that it cannot be subclassed.
+// Use like:
+// class B FINAL : public A {};
+// virtual void bar() FINAL;
+#if V8_HAS_CXX11_FINAL
+#define FINAL final
+#elif V8_HAS___FINAL
+#define FINAL __final
+#elif V8_HAS_SEALED
+#define FINAL sealed
+#else
+#define FINAL /* NOT SUPPORTED */
+#endif
+
+
+// Annotate a function indicating the caller must examine the return value.
+// Use like:
+// int foo() WARN_UNUSED_RESULT;
+#if V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT
+#define WARN_UNUSED_RESULT __attribute__((warn_unused_result))
+#else
+#define WARN_UNUSED_RESULT /* NOT SUPPORTED */
+#endif
+
+#endif // V8_BASE_COMPILER_SPECIFIC_H_
« no previous file with comments | « src/ast-value-factory.cc ('k') | src/base/cpu.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698