Make art_test_common_defaults inherit art_defaults.

To take art_defaults closer to a true global defaults used by
everything in the ART module. This also means we unify the compiler
flags for various test-only things that didn't inherit art_defaults
explicitly.

Also some code cleanups in tests that were uncovered by the extra
compiler warnings.

#codehealth

Test: Run-tests, gtests, libcore tests and libjdwp tests for host and
  device on master-art
Test: mmm art/libnativeloader/
Bug: 204364566
Change-Id: I618881ca618c32c40f26b4d354f48d5f9c42fc12
diff --git a/libartbase/base/logging_test.cc b/libartbase/base/logging_test.cc
index 540b9a7..1fa3209 100644
--- a/libartbase/base/logging_test.cc
+++ b/libartbase/base/logging_test.cc
@@ -26,6 +26,7 @@
 
 namespace art {
 
+[[noreturn]]
 static void SimpleAborter(const char* msg) {
   LOG(FATAL_WITHOUT_ABORT) << msg;
   _exit(1);
diff --git a/runtime/jit/jit_memory_region_test.cc b/runtime/jit/jit_memory_region_test.cc
index 2049611..21cb988 100644
--- a/runtime/jit/jit_memory_region_test.cc
+++ b/runtime/jit/jit_memory_region_test.cc
@@ -39,6 +39,7 @@
 // These globals are only set in child processes.
 void* gAddrToFaultOn = nullptr;
 
+[[noreturn]]
 void handler(int ATTRIBUTE_UNUSED, siginfo_t* info, void* ATTRIBUTE_UNUSED) {
   CHECK_EQ(info->si_addr, gAddrToFaultOn);
   exit(kReturnFromFault);
diff --git a/test/Android.bp b/test/Android.bp
index f3fb289..c90b336 100644
--- a/test/Android.bp
+++ b/test/Android.bp
@@ -35,6 +35,18 @@
 // Properties common to `art_test_defaults` and `art_standalone_test_defaults`.
 art_module_cc_defaults {
     name: "art_test_common_defaults",
+    defaults: ["art_defaults"],
+
+    // Override flags from art_defaults:
+    cflags: [
+        // gmock.h has incorrect unused markers.
+        "-Wno-used-but-marked-unused",
+        // gtest.h compares signed and unsigned.
+        "-Wno-sign-compare",
+        // gtest.h includes cxxabi.h which fails on this check.
+        "-Wno-deprecated-dynamic-exception-spec",
+    ],
+
     target: {
         darwin: {
             enabled: false,
@@ -148,7 +160,6 @@
     // eventually.
     host_supported: false,
     test_config_template: ":art-gtests-target-standalone-template",
-    min_sdk_version: "S",
 }
 
 // Properties common to `art_gtest_defaults` and `art_standalone_gtest_defaults`.
@@ -233,7 +244,6 @@
         // (including the Release ART APEX).
         "art_standalone_test_defaults",
         "art_gtest_common_defaults",
-        "art_defaults",
     ],
 
     test_suites: [
@@ -511,10 +521,7 @@
 
 art_cc_defaults {
     name: "libnativebridgetest-defaults",
-    defaults: [
-        "art_test_defaults",
-        "art_defaults",
-    ],
+    defaults: ["art_test_defaults"],
     header_libs: ["libnativebridge-headers"],
     srcs: ["115-native-bridge/nativebridge.cc"],
 }
@@ -540,10 +547,7 @@
 
 cc_defaults {
     name: "libartagent-defaults",
-    defaults: [
-        "art_test_internal_library_defaults",
-        "art_defaults",
-    ],
+    defaults: ["art_test_internal_library_defaults"],
     shared_libs: [
         "libbacktrace",
         "libbase",
@@ -581,11 +585,7 @@
 
 art_cc_defaults {
     name: "libtiagent-base-defaults",
-    defaults: [
-        "art_test_internal_library_defaults",
-        "art_defaults",
-        // Not derived from libartagent-defaults for NDK.
-    ],
+    defaults: ["art_test_internal_library_defaults"],
     srcs: [
         // These are the ART-independent parts.
         "ti-agent/agent_common.cc",
@@ -847,10 +847,7 @@
 
 cc_defaults {
     name: "libarttest-defaults",
-    defaults: [
-        "art_test_internal_library_defaults",
-        "art_defaults",
-    ],
+    defaults: ["art_test_internal_library_defaults"],
     srcs: [
         "004-JniTest/jni_test.cc",
         "004-ReferenceMap/stack_walk_refmap_jni.cc",
diff --git a/test/odsign/Android.bp b/test/odsign/Android.bp
index 3677a99..f156d53 100644
--- a/test/odsign/Android.bp
+++ b/test/odsign/Android.bp
@@ -35,6 +35,7 @@
 
 cc_library_shared {
     name: "libOdsignTestAppJni",
+    defaults: ["art_defaults"],
     srcs: ["jni/**/*.cc"],
     shared_libs: [
         "libnativehelper_compat_libc++",
@@ -43,10 +44,6 @@
     static_libs: [
         "libbase_ndk",
     ],
-    cflags: [
-        "-Wall",
-        "-Werror",
-    ],
     stl: "c++_static",
     sdk_version: "current",
 }