summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author David Srbecky <dsrbecky@google.com> 2018-10-18 12:26:34 +0100
committer David Srbecky <dsrbecky@google.com> 2018-10-18 12:43:06 +0100
commit50b47432f8df853b8479179154382ef30bdf30c9 (patch)
treeec702341b889cc43cc75625ddad8c1bebeff3c2f
parentf06ca50f0aff5167f767b09f624c60186290a623 (diff)
Move cpp-define related static_assert to runtime.
The runtime is build with both debug and non-debug configs, so checking it there covers more cases. Test: Check this caches cases which previously passed. Change-Id: I543547e517b79289438b19ed9e18f5a6d0b74172
-rw-r--r--runtime/Android.bp2
-rw-r--r--runtime/arch/arch_test.cc6
-rw-r--r--runtime/runtime.cc5
-rw-r--r--tools/cpp-define-generator/asm_defines.cc2
4 files changed, 7 insertions, 8 deletions
diff --git a/runtime/Android.bp b/runtime/Android.bp
index 33ad987ad6..bedeaf7803 100644
--- a/runtime/Android.bp
+++ b/runtime/Android.bp
@@ -379,6 +379,7 @@ libart_cc_defaults {
],
header_libs: [
"art_cmdlineparser_headers",
+ "cpp-define-generator-definitions",
"libnativehelper_header_only",
"jni_platform_headers",
],
@@ -639,7 +640,6 @@ art_cc_test {
],
header_libs: [
"art_cmdlineparser_headers", // For parsed_options_test.
- "cpp-define-generator-definitions",
],
include_dirs: [
"external/zlib",
diff --git a/runtime/arch/arch_test.cc b/runtime/arch/arch_test.cc
index dcc3affb6b..12ad84b2dd 100644
--- a/runtime/arch/arch_test.cc
+++ b/runtime/arch/arch_test.cc
@@ -17,17 +17,11 @@
#include <stdint.h>
#include "art_method-inl.h"
-#include "asm_defines.h"
#include "base/callee_save_type.h"
#include "entrypoints/quick/callee_save_frame.h"
#include "common_runtime_test.h"
#include "quick/quick_method_frame_info.h"
-// Static asserts to check the values of generated #defines for assembly.
-#define ASM_DEFINE(NAME, EXPR) static_assert((NAME) == (EXPR), "Unexpected value of " #NAME);
-#include "asm_defines.def"
-#undef ASM_DEFINE
-
namespace art {
class ArchTest : public CommonRuntimeTest {
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index b3a2bdd936..4d77b9d993 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -165,6 +165,11 @@
#include <android/set_abort_message.h>
#endif
+// Static asserts to check the values of generated assembly-support macros.
+#define ASM_DEFINE(NAME, EXPR) static_assert((NAME) == (EXPR), "Unexpected value of " #NAME);
+#include "asm_defines.def"
+#undef ASM_DEFINE
+
namespace art {
// If a signal isn't handled properly, enable a handler that attempts to dump the Java stack.
diff --git a/tools/cpp-define-generator/asm_defines.cc b/tools/cpp-define-generator/asm_defines.cc
index c105c1a7ce..b79e1ae26e 100644
--- a/tools/cpp-define-generator/asm_defines.cc
+++ b/tools/cpp-define-generator/asm_defines.cc
@@ -31,6 +31,6 @@
#define ASM_DEFINE(NAME, EXPR) \
void AsmDefineHelperFor_##NAME() { \
asm volatile("\n.ascii \">>" #NAME " %0 %1<<\"" \
- :: "i" (static_cast<int64_t>(EXPR)), "i" (EXPR < 0 ? 1 : 0)); \
+ :: "i" (static_cast<int64_t>(EXPR)), "i" ((EXPR) < 0 ? 1 : 0)); \
}
#include "asm_defines.def"