OSDN Git Service

ART: Enable Clang's -Wdeprecated
authorAndreas Gampe <agampe@google.com>
Sat, 4 Apr 2015 04:28:42 +0000 (21:28 -0700)
committerAndreas Gampe <agampe@google.com>
Mon, 6 Apr 2015 21:03:17 +0000 (14:03 -0700)
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

12 files changed:
build/Android.common_build.mk
build/Android.gtest.mk
cmdline/unit.h
compiler/elf_builder.h
compiler/utils/array_ref.h
runtime/base/allocator.h
runtime/base/arena_containers.h
runtime/gc_root.h
runtime/handle_scope.h
runtime/oat.h
runtime/oat_file.h
runtime/safe_map.h

index 91b6620..8b4be82 100644 (file)
@@ -138,6 +138,9 @@ art_clang_cflags += -Wint-to-void-pointer-cast
 # 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
index 86cc5ad..6714480 100644 (file)
@@ -257,7 +257,7 @@ LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common_build.mk
 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_STATIC_LIBRARIES := libgtest_host
 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 @@ define define-art-gtest
     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 @@ test-art-target-gtest-$$(art_gtest_name): $$(ART_TEST_TARGET_GTEST_$$(art_gtest_
     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 :=
index 6b53b18..ad6a03d 100644 (file)
@@ -24,6 +24,7 @@ struct Unit {
   // 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;
index 9ab3602..124ed03 100644 (file)
@@ -40,6 +40,7 @@ class ElfSectionBuilder : public ValueObject {
     section_.sh_addralign = align;
     section_.sh_entsize = entsize;
   }
+  ElfSectionBuilder(const ElfSectionBuilder&) = default;
 
   ~ElfSectionBuilder() {}
 
@@ -144,6 +145,7 @@ class ElfRawSectionBuilder FINAL : public ElfSectionBuilder<Elf_Word, Elf_Sword,
     : ElfSectionBuilder<Elf_Word, Elf_Sword, Elf_Shdr>(sec_name, type, flags, link, info, align,
                                                        entsize) {
   }
+  ElfRawSectionBuilder(const ElfRawSectionBuilder&) = default;
 
   ~ElfRawSectionBuilder() {}
 
index b1b0ee5..ff5a77c 100644 (file)
@@ -89,6 +89,8 @@ class ArrayRef {
       : array_(v.data()), size_(v.size()) {
   }
 
+  ArrayRef(const ArrayRef&) = default;
+
   // Assignment operators.
 
   ArrayRef& operator=(const ArrayRef& other) {
index 2d67c8b..07daa7e 100644 (file)
@@ -114,12 +114,12 @@ class TrackingAllocatorImpl : public std::allocator<T> {
 
   // 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");
   }
 
index e6fe6c0..d6c4a54 100644 (file)
@@ -67,6 +67,7 @@ class ArenaAllocatorAdapterKindImpl<false> {
  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; }
 };
index 4164bbd..2f4da3f 100644 (file)
@@ -54,6 +54,7 @@ class RootInfo {
   explicit RootInfo(RootType type, uint32_t thread_id = 0)
      : type_(type), thread_id_(thread_id) {
   }
+  RootInfo(const RootInfo&) = default;
   virtual ~RootInfo() {
   }
   RootType GetType() const {
index a836578..271312e 100644 (file)
@@ -133,6 +133,8 @@ class HandleWrapper : public MutableHandle<T> {
      : MutableHandle<T>(handle), obj_(obj) {
   }
 
+  HandleWrapper(const HandleWrapper&) = default;
+
   ~HandleWrapper() {
     *obj_ = MutableHandle<T>::Get();
   }
index 120de6d..de95fef 100644 (file)
@@ -156,6 +156,8 @@ class PACKED(4) OatMethodOffsets {
 
   ~OatMethodOffsets();
 
+  OatMethodOffsets& operator=(const OatMethodOffsets&) = default;
+
   uint32_t code_offset_;
 };
 
@@ -169,6 +171,8 @@ class PACKED(4) OatQuickMethodHeader {
 
   ~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.
index 2b9ef9d..73a8c8e 100644 (file)
@@ -134,8 +134,11 @@ class OatFile FINAL {
     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() {
index f9d81dc..402c7e9 100644 (file)
@@ -44,6 +44,7 @@ class SafeMap {
   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) {
   }