ART: Enable Clang's -Wdeprecated

Replace throw() with noexcept.

Add default copy constructors and copy assignment constructors for
cases with destructors, as the implicit definition is deprecated.

Change-Id: Ice306a3f510b072b00bec4d4360f7c8055135c9d
diff --git a/build/Android.common_build.mk b/build/Android.common_build.mk
index 91b6620..8b4be82 100644
--- a/build/Android.common_build.mk
+++ b/build/Android.common_build.mk
@@ -138,6 +138,9 @@
 # Enable warning of wrong unused annotations.
 art_clang_cflags += -Wused-but-marked-unused
 
+# Enable warning for deprecated language features.
+art_clang_cflags += -Wdeprecated
+
 
 # GCC-only warnings.
 art_gcc_cflags := -Wunused-but-set-parameter
diff --git a/build/Android.gtest.mk b/build/Android.gtest.mk
index 86cc5ad..6714480 100644
--- a/build/Android.gtest.mk
+++ b/build/Android.gtest.mk
@@ -257,7 +257,7 @@
 LOCAL_ADDITIONAL_DEPENDENCIES += art/build/Android.gtest.mk
 $(eval $(call set-target-local-clang-vars))
 $(eval $(call set-target-local-cflags-vars,debug))
-LOCAL_CLANG_CFLAGS += -Wno-used-but-marked-unused  # gtest issue
+LOCAL_CLANG_CFLAGS += -Wno-used-but-marked-unused -Wno-deprecated  # gtest issue
 include $(BUILD_SHARED_LIBRARY)
 
 include $(CLEAR_VARS)
@@ -272,7 +272,7 @@
 LOCAL_LDLIBS += -ldl -lpthread
 LOCAL_MULTILIB := both
 LOCAL_CLANG := $(ART_HOST_CLANG)
-LOCAL_CLANG_CFLAGS += -Wno-used-but-marked-unused  # gtest issue
+LOCAL_CLANG_CFLAGS += -Wno-used-but-marked-unused -Wno-deprecated  # gtest issue
 LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common_build.mk
 LOCAL_ADDITIONAL_DEPENDENCIES += art/build/Android.gtest.mk
 include $(BUILD_HOST_SHARED_LIBRARY)
@@ -425,7 +425,7 @@
     LOCAL_MODULE_PATH_32 := $$(ART_TARGET_NATIVETEST_OUT)/$$(ART_TARGET_ARCH_32)
     LOCAL_MODULE_PATH_64 := $$(ART_TARGET_NATIVETEST_OUT)/$$(ART_TARGET_ARCH_64)
     LOCAL_MULTILIB := both
-    LOCAL_CLANG_CFLAGS += -Wno-used-but-marked-unused  # gtest issue
+    LOCAL_CLANG_CFLAGS += -Wno-used-but-marked-unused -Wno-deprecated  # gtest issue
     include $$(BUILD_EXECUTABLE)
     library_path :=
     2nd_library_path :=
@@ -464,7 +464,7 @@
     LOCAL_MULTILIB := both
     LOCAL_MODULE_STEM_32 := $$(art_gtest_name)32
     LOCAL_MODULE_STEM_64 := $$(art_gtest_name)64
-    LOCAL_CLANG_CFLAGS += -Wno-used-but-marked-unused  # gtest issue
+    LOCAL_CLANG_CFLAGS += -Wno-used-but-marked-unused -Wno-deprecated  # gtest issue
     include $$(BUILD_HOST_EXECUTABLE)
 
     ART_TEST_HOST_GTEST_$$(art_gtest_name)_RULES :=
diff --git a/cmdline/unit.h b/cmdline/unit.h
index 6b53b18..ad6a03d 100644
--- a/cmdline/unit.h
+++ b/cmdline/unit.h
@@ -24,6 +24,7 @@
   // Avoid 'Conditional jump or move depends on uninitialised value(s)' errors
   // when running valgrind by specifying a user-defined constructor.
   Unit() {}
+  Unit(const Unit&) = default;
   ~Unit() {}
   bool operator==(Unit) const {
     return true;
diff --git a/compiler/elf_builder.h b/compiler/elf_builder.h
index 9ab3602..124ed03 100644
--- a/compiler/elf_builder.h
+++ b/compiler/elf_builder.h
@@ -40,6 +40,7 @@
     section_.sh_addralign = align;
     section_.sh_entsize = entsize;
   }
+  ElfSectionBuilder(const ElfSectionBuilder&) = default;
 
   ~ElfSectionBuilder() {}
 
@@ -144,6 +145,7 @@
     : ElfSectionBuilder<Elf_Word, Elf_Sword, Elf_Shdr>(sec_name, type, flags, link, info, align,
                                                        entsize) {
   }
+  ElfRawSectionBuilder(const ElfRawSectionBuilder&) = default;
 
   ~ElfRawSectionBuilder() {}
 
diff --git a/compiler/utils/array_ref.h b/compiler/utils/array_ref.h
index b1b0ee5..ff5a77c 100644
--- a/compiler/utils/array_ref.h
+++ b/compiler/utils/array_ref.h
@@ -89,6 +89,8 @@
       : array_(v.data()), size_(v.size()) {
   }
 
+  ArrayRef(const ArrayRef&) = default;
+
   // Assignment operators.
 
   ArrayRef& operator=(const ArrayRef& other) {
diff --git a/runtime/base/allocator.h b/runtime/base/allocator.h
index 2d67c8b..07daa7e 100644
--- a/runtime/base/allocator.h
+++ b/runtime/base/allocator.h
@@ -114,12 +114,12 @@
 
   // Used internally by STL data structures.
   template <class U>
-  TrackingAllocatorImpl(const TrackingAllocatorImpl<U, kTag>& alloc) throw() {
+  TrackingAllocatorImpl(const TrackingAllocatorImpl<U, kTag>& alloc) noexcept {
     UNUSED(alloc);
   }
 
   // Used internally by STL data structures.
-  TrackingAllocatorImpl() throw() {
+  TrackingAllocatorImpl() noexcept {
     static_assert(kTag < kAllocatorTagCount, "kTag must be less than kAllocatorTagCount");
   }
 
diff --git a/runtime/base/arena_containers.h b/runtime/base/arena_containers.h
index e6fe6c0..d6c4a54 100644
--- a/runtime/base/arena_containers.h
+++ b/runtime/base/arena_containers.h
@@ -67,6 +67,7 @@
  public:
   // Not tracking allocations, ignore the supplied kind and arbitrarily provide kArenaAllocSTL.
   explicit ArenaAllocatorAdapterKindImpl(ArenaAllocKind kind ATTRIBUTE_UNUSED) {}
+  ArenaAllocatorAdapterKindImpl(const ArenaAllocatorAdapterKindImpl&) = default;
   ArenaAllocatorAdapterKindImpl& operator=(const ArenaAllocatorAdapterKindImpl&) = default;
   ArenaAllocKind Kind() { return kArenaAllocSTL; }
 };
diff --git a/runtime/gc_root.h b/runtime/gc_root.h
index 4164bbd..2f4da3f 100644
--- a/runtime/gc_root.h
+++ b/runtime/gc_root.h
@@ -54,6 +54,7 @@
   explicit RootInfo(RootType type, uint32_t thread_id = 0)
      : type_(type), thread_id_(thread_id) {
   }
+  RootInfo(const RootInfo&) = default;
   virtual ~RootInfo() {
   }
   RootType GetType() const {
diff --git a/runtime/handle_scope.h b/runtime/handle_scope.h
index a836578..271312e 100644
--- a/runtime/handle_scope.h
+++ b/runtime/handle_scope.h
@@ -133,6 +133,8 @@
      : MutableHandle<T>(handle), obj_(obj) {
   }
 
+  HandleWrapper(const HandleWrapper&) = default;
+
   ~HandleWrapper() {
     *obj_ = MutableHandle<T>::Get();
   }
diff --git a/runtime/oat.h b/runtime/oat.h
index 120de6d..de95fef 100644
--- a/runtime/oat.h
+++ b/runtime/oat.h
@@ -156,6 +156,8 @@
 
   ~OatMethodOffsets();
 
+  OatMethodOffsets& operator=(const OatMethodOffsets&) = default;
+
   uint32_t code_offset_;
 };
 
@@ -169,6 +171,8 @@
 
   ~OatQuickMethodHeader();
 
+  OatQuickMethodHeader& operator=(const OatQuickMethodHeader&) = default;
+
   // The offset in bytes from the start of the mapping table to the end of the header.
   uint32_t mapping_table_offset_;
   // The offset in bytes from the start of the vmap table to the end of the header.
diff --git a/runtime/oat_file.h b/runtime/oat_file.h
index 2b9ef9d..73a8c8e 100644
--- a/runtime/oat_file.h
+++ b/runtime/oat_file.h
@@ -134,8 +134,11 @@
     OatMethod(const uint8_t* base, const uint32_t code_offset)
         : begin_(base), code_offset_(code_offset) {
     }
+    OatMethod(const OatMethod&) = default;
     ~OatMethod() {}
 
+    OatMethod& operator=(const OatMethod&) = default;
+
     // A representation of an invalid OatMethod, used when an OatMethod or OatClass can't be found.
     // See ClassLinker::FindOatMethodFor.
     static const OatMethod Invalid() {
diff --git a/runtime/safe_map.h b/runtime/safe_map.h
index f9d81dc..402c7e9 100644
--- a/runtime/safe_map.h
+++ b/runtime/safe_map.h
@@ -44,6 +44,7 @@
   typedef typename ::std::map<K, V, Comparator, Allocator>::value_type value_type;
 
   SafeMap() = default;
+  SafeMap(const SafeMap&) = default;
   explicit SafeMap(const key_compare& cmp, const allocator_type& allocator = allocator_type())
     : map_(cmp, allocator) {
   }