Fixing cpplint runtime/arrays, runtime/int, runtime/virtual issues

Change-Id: Ia2ff94d2fb69465df26aaf83df82614a483b26e0
diff --git a/Android.mk b/Android.mk
index 437513b..7c91396 100644
--- a/Android.mk
+++ b/Android.mk
@@ -334,14 +334,14 @@
 .PHONY: cpplint-art
 cpplint-art:
 	./art/tools/cpplint.py \
-	    --filter=-,+build/header_guard,+whitespace/braces,+whitespace/comma,+runtime/explicit,+whitespace/newline,+whitespace/parens,+build/namespaces,+readability/fn_size,+whitespace/operators,+readability/braces,+whitespace/indent,+whitespace/blank_line,+whitespace/end_of_line,+whitespace/labels,+whitespace/semicolon,+legal/copyright,+readability/casting,+readability/check,+readability/constructors \
+	    --filter=-,+build/header_guard,+whitespace/braces,+whitespace/comma,+runtime/explicit,+whitespace/newline,+whitespace/parens,+build/namespaces,+readability/fn_size,+whitespace/operators,+readability/braces,+whitespace/indent,+whitespace/blank_line,+whitespace/end_of_line,+whitespace/labels,+whitespace/semicolon,+legal/copyright,+readability/casting,+readability/check,+readability/constructors,+runtime/arrays,+runtime/int,+runtime/virtual \
 	    $(shell find art -name *.h -o -name *$(ART_CPP_EXTENSION) | grep -v art/compiler/llvm/generated/)
 
 # "mm cpplint-art-aspirational" to see warnings we would like to fix
 .PHONY: cpplint-art-aspirational
 cpplint-art-aspirational:
 	./art/tools/cpplint.py \
-	    --filter=-whitespace/comments,-whitespace/line_length,-build/include,-readability/function,-readability/streams,-readability/todo,-runtime/references \
+	    --filter=-whitespace/comments,-whitespace/line_length,-build/include,-readability/function,-readability/streams,-readability/todo,-runtime/references,-runtime/threadsafe_fn \
 	    $(shell find art -name *.h -o -name *$(ART_CPP_EXTENSION) | grep -v art/compiler/llvm/generated/)
 
 ########################################################################
diff --git a/compiler/elf_writer.h b/compiler/elf_writer.h
index ab436e4..0dfce6e 100644
--- a/compiler/elf_writer.h
+++ b/compiler/elf_writer.h
@@ -47,7 +47,7 @@
 
  protected:
   ElfWriter(const CompilerDriver& driver, File* elf_file);
-  ~ElfWriter();
+  virtual ~ElfWriter();
 
   virtual bool Write(std::vector<uint8_t>& oat_contents,
                      const std::vector<const DexFile*>& dex_files,
diff --git a/runtime/base/mutex.cc b/runtime/base/mutex.cc
index af45f3f..cb66240 100644
--- a/runtime/base/mutex.cc
+++ b/runtime/base/mutex.cc
@@ -32,7 +32,7 @@
 
 // This works on Mac OS 10.6 but hasn't been tested on older releases.
 struct __attribute__((__may_alias__)) darwin_pthread_mutex_t {
-  long padding0;
+  long padding0;  // NOLINT(runtime/int)
   int padding1;
   uint32_t padding2;
   int16_t padding3;
@@ -43,7 +43,7 @@
 };
 
 struct __attribute__((__may_alias__)) darwin_pthread_rwlock_t {
-  long padding0;
+  long padding0;  // NOLINT(runtime/int)
   pthread_mutex_t padding1;
   int padding2;
   pthread_cond_t padding3;
@@ -72,7 +72,7 @@
 
 #if ART_USE_FUTEXES
 static bool ComputeRelativeTimeSpec(timespec* result_ts, const timespec& lhs, const timespec& rhs) {
-  const long int one_sec = 1000 * 1000 * 1000;  // one second in nanoseconds.
+  const int32_t one_sec = 1000 * 1000 * 1000;  // one second in nanoseconds.
   result_ts->tv_sec = lhs.tv_sec - rhs.tv_sec;
   result_ts->tv_nsec = lhs.tv_nsec - rhs.tv_nsec;
   if (result_ts->tv_nsec < 0) {
diff --git a/runtime/jdwp/jdwp_event.cc b/runtime/jdwp/jdwp_event.cc
index 52dd782..546c637 100644
--- a/runtime/jdwp/jdwp_event.cc
+++ b/runtime/jdwp/jdwp_event.cc
@@ -1046,7 +1046,7 @@
    * "Wrap" the contents of the iovec with a JDWP/DDMS header.  We do
    * this by creating a new copy of the vector with space for the header.
    */
-  iovec wrapiov[iov_count+1];
+  iovec wrapiov[iov_count+1];  // NOLINT(runtime/arrays) iov_count < 10
   for (int i = 0; i < iov_count; i++) {
     wrapiov[i+1].iov_base = iov[i].iov_base;
     wrapiov[i+1].iov_len = iov[i].iov_len;
diff --git a/runtime/mirror/class.h b/runtime/mirror/class.h
index 9a506c2..1dd02c0 100644
--- a/runtime/mirror/class.h
+++ b/runtime/mirror/class.h
@@ -27,10 +27,10 @@
  * [This is an unlikely "natural" value, since it would be 30 non-ref instance
  * fields followed by 2 ref instance fields.]
  */
-#define CLASS_WALK_SUPER ((unsigned int)(3))
-#define CLASS_BITS_PER_WORD (sizeof(unsigned long int) * 8)
+#define CLASS_WALK_SUPER 3U
+#define CLASS_BITS_PER_WORD (sizeof(uint32_t) * 8)
 #define CLASS_OFFSET_ALIGNMENT 4
-#define CLASS_HIGH_BIT ((unsigned int)1 << (CLASS_BITS_PER_WORD - 1))
+#define CLASS_HIGH_BIT (1U << (CLASS_BITS_PER_WORD - 1))
 /*
  * Given an offset, return the bit number which would encode that offset.
  * Local use only.