summaryrefslogtreecommitdiffstats
path: root/runtime/base/macros.h
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2014-10-22 22:06:39 -0700
committerIan Rogers <irogers@google.com>2014-10-22 22:21:57 -0700
commitcf7f19135f0e273f7b0136315633c2abfc715343 (patch)
treeffa4d9efd9c45f4b6789acc1f534bb9327052b7e /runtime/base/macros.h
parentaea6888b056be21adf762e066c7f33b8939b8a06 (diff)
downloadart-cf7f19135f0e273f7b0136315633c2abfc715343.tar.gz
art-cf7f19135f0e273f7b0136315633c2abfc715343.tar.bz2
art-cf7f19135f0e273f7b0136315633c2abfc715343.zip
C++11 related clean-up of DISALLOW_..
Move DISALLOW_COPY_AND_ASSIGN to delete functions. By no having declarations with no definitions this prompts better warning messages so deal with these by correcting the code. Add a DISALLOW_ALLOCATION and use for ValueObject and mirror::Object. Make X86 assembly operand types ValueObjects to fix compilation errors. Tidy the use of iostream and ostream. Avoid making cutils a dependency via mutex-inl.h for tests that link against libart. Push tracing dependencies into appropriate files and mutex.cc. x86 32-bit host symbols size is increased for libarttest, avoid copying this in run-test 115 by using symlinks and remove this test's higher than normal ulimit. Fix the RunningOnValgrind test in RosAllocSpace to not use GetHeap as it returns NULL when the heap is under construction by Runtime. Change-Id: Ia246f7ac0c11f73072b30d70566a196e9b78472b
Diffstat (limited to 'runtime/base/macros.h')
-rw-r--r--runtime/base/macros.h26
1 files changed, 16 insertions, 10 deletions
diff --git a/runtime/base/macros.h b/runtime/base/macros.h
index c80d35e42..febea61b8 100644
--- a/runtime/base/macros.h
+++ b/runtime/base/macros.h
@@ -68,22 +68,28 @@ struct CompileAssert {
#define ART_FRIEND_TEST(test_set_name, individual_test)\
friend class test_set_name##_##individual_test##_Test
-// DISALLOW_COPY_AND_ASSIGN disallows the copy and operator= functions.
-// It goes in the private: declarations in a class.
+// DISALLOW_COPY_AND_ASSIGN disallows the copy and operator= functions. It goes in the private:
+// declarations in a class.
#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
- TypeName(const TypeName&); \
- void operator=(const TypeName&)
+ TypeName(const TypeName&) = delete; \
+ void operator=(const TypeName&) = delete
-// A macro to disallow all the implicit constructors, namely the
-// default constructor, copy constructor and operator= functions.
+// A macro to disallow all the implicit constructors, namely the default constructor, copy
+// constructor and operator= functions.
//
-// This should be used in the private: declarations for a class
-// that wants to prevent anyone from instantiating it. This is
-// especially useful for classes containing only static methods.
+// This should be used in the private: declarations for a class that wants to prevent anyone from
+// instantiating it. This is especially useful for classes containing only static methods.
#define DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \
- TypeName(); \
+ TypeName() = delete; \
DISALLOW_COPY_AND_ASSIGN(TypeName)
+// A macro to disallow new and delete operators for a class. It goes in the private: declarations.
+#define DISALLOW_ALLOCATION() \
+ public: \
+ ALWAYS_INLINE void operator delete(void*, size_t) { UNREACHABLE(); } \
+ private: \
+ void* operator new(size_t) = delete
+
// The arraysize(arr) macro returns the # of elements in an array arr.
// The expression is a compile-time constant, and therefore can be
// used in defining new arrays, for example. If you use arraysize on