ART: Fix dexdump & dexlist

Use art_defaults for these tools. Fix up tidy and non-tidy errors.

Bug: 32619234
Test: WITH_TIDY=1 mmma art
Change-Id: I0f40f91cd7ec8584002609839dec6a3e74926a22
diff --git a/build/Android.bp b/build/Android.bp
index 5f66308..5f64c2d 100644
--- a/build/Android.bp
+++ b/build/Android.bp
@@ -21,7 +21,6 @@
     "bugprone-lambda-function-name",
     "bugprone-unused-raii",  // Protect scoped things like MutexLock.
     "bugprone-virtual-near-miss",
-    "modernize-redundant-void-arg",
     "modernize-use-bool-literals",
     "modernize-use-nullptr",
     "performance-faster-string-find",
diff --git a/dexdump/Android.bp b/dexdump/Android.bp
index 3e576c8..d15bbda 100644
--- a/dexdump/Android.bp
+++ b/dexdump/Android.bp
@@ -17,12 +17,12 @@
 
 cc_defaults {
     name: "dexdump_defaults",
+    defaults: ["art_defaults"],
     srcs: [
         "dexdump_cfg.cc",
         "dexdump_main.cc",
         "dexdump.cc",
     ],
-    cflags: ["-Wall", "-Werror"],
 }
 
 art_cc_binary {
diff --git a/dexdump/dexdump.cc b/dexdump/dexdump.cc
index 95d88be..2cf0567 100644
--- a/dexdump/dexdump.cc
+++ b/dexdump/dexdump.cc
@@ -1800,18 +1800,18 @@
   // Iterate over all classes.
   char* package = nullptr;
   const u4 classDefsSize = pDexFile->GetHeader().class_defs_size_;
-  for (u4 i = 0; i < classDefsSize; i++) {
-    dumpClass(pDexFile, i, &package);
+  for (u4 j = 0; j < classDefsSize; j++) {
+    dumpClass(pDexFile, j, &package);
   }  // for
 
   // Iterate over all method handles.
-  for (u4 i = 0; i < pDexFile->NumMethodHandles(); ++i) {
-    dumpMethodHandle(pDexFile, i);
+  for (u4 j = 0; j < pDexFile->NumMethodHandles(); ++j) {
+    dumpMethodHandle(pDexFile, j);
   }  // for
 
   // Iterate over all call site ids.
-  for (u4 i = 0; i < pDexFile->NumCallSiteIds(); ++i) {
-    dumpCallSite(pDexFile, i);
+  for (u4 j = 0; j < pDexFile->NumCallSiteIds(); ++j) {
+    dumpCallSite(pDexFile, j);
   }  // for
 
   // Free the last package allocated.
diff --git a/dexdump/dexdump_main.cc b/dexdump/dexdump_main.cc
index f4a3866..cf0d113 100644
--- a/dexdump/dexdump_main.cc
+++ b/dexdump/dexdump_main.cc
@@ -37,7 +37,7 @@
 /*
  * Shows usage.
  */
-static void usage(void) {
+static void usage() {
   LOG(ERROR) << "Copyright (C) 2007 The Android Open Source Project\n";
   LOG(ERROR) << gProgName << ": [-a] [-c] [-d] [-e] [-f] [-h] [-i] [-j] [-l layout] [-o outfile]"
                   " dexfile...\n";
@@ -64,7 +64,7 @@
   gOptions.verbose = true;
 
   // Parse all arguments.
-  while (1) {
+  while (true) {
     const int ic = getopt(argc, argv, "acdefghijl:o:");
     if (ic < 0) {
       break;  // done
diff --git a/dexlist/Android.bp b/dexlist/Android.bp
index bd521ac..217a024 100644
--- a/dexlist/Android.bp
+++ b/dexlist/Android.bp
@@ -14,18 +14,14 @@
 
 art_cc_binary {
     name: "dexlist",
+    defaults: ["art_defaults"],
     host_supported: true,
     srcs: ["dexlist.cc"],
-    cflags: ["-Wall", "-Werror"],
     shared_libs: [
         "libdexfile",
         "libartbase",
         "libbase"
     ],
-    // TODO: fix b/72216369 and remove the need for this.
-    include_dirs: [
-        "art/runtime"  // dex utils.
-    ],
 }
 
 art_cc_test {
diff --git a/dexlist/dexlist.cc b/dexlist/dexlist.cc
index c2514a1..23be19d 100644
--- a/dexlist/dexlist.cc
+++ b/dexlist/dexlist.cc
@@ -197,7 +197,7 @@
 /*
  * Shows usage.
  */
-static void usage(void) {
+static void usage() {
   LOG(ERROR) << "Copyright (C) 2007 The Android Open Source Project\n";
   LOG(ERROR) << gProgName << ": [-m p.c.m] [-o outfile] dexfile...";
   LOG(ERROR) << "";
@@ -212,7 +212,7 @@
   memset(&gOptions, 0, sizeof(gOptions));
 
   // Parse all arguments.
-  while (1) {
+  while (true) {
     const int ic = getopt(argc, argv, "o:m:");
     if (ic < 0) {
       break;  // done