summaryrefslogtreecommitdiffstats
path: root/vm/Common.h
diff options
context:
space:
mode:
authorAndy McFadden <fadden@android.com>2009-08-05 15:20:27 -0700
committerAndy McFadden <fadden@android.com>2009-08-05 15:26:34 -0700
commitd51370ff814e88b63baa3b1f5300b6560330c12d (patch)
tree4a477ad4583c757ccbcdc92377f43198d750324f /vm/Common.h
parentf5adaabbfa043bbf3db757e8715c89d2674a7b7c (diff)
downloadandroid_dalvik-d51370ff814e88b63baa3b1f5300b6560330c12d.tar.gz
android_dalvik-d51370ff814e88b63baa3b1f5300b6560330c12d.tar.bz2
android_dalvik-d51370ff814e88b63baa3b1f5300b6560330c12d.zip
Switch to <stdbool.h> in the VM.
We were using an enum that made the compiler unhappy on MacOS X. This switches us to using <stdbool.h> when it's available. The size of a "bool" is either sizeof(_Bool) or sizeof(enum bool), and the assembly sources dislike ambiguity, so this also changes gDvm.debuggerActive to always be a single byte. The ARM and x86 code was already assuming that -- held over from when enums were variable-width, and never fixed because we get the right answer on little-endian platforms -- so it doesn't look like we need to change anything in mterp.
Diffstat (limited to 'vm/Common.h')
-rw-r--r--vm/Common.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/vm/Common.h b/vm/Common.h
index 4b357e2e1..d0c021d50 100644
--- a/vm/Common.h
+++ b/vm/Common.h
@@ -97,11 +97,15 @@ typedef union JValue {
} JValue;
/*
- * Some systems might have this in <stdbool.h>.
+ * The <stdbool.h> definition uses _Bool, a type known to the compiler.
*/
-#ifndef __bool_true_false_are_defined
+#ifdef HAVE_STDBOOL_H
+# include <stdbool.h> /* C99 */
+#else
+# ifndef __bool_true_false_are_defined
typedef enum { false=0, true=!false } bool;
-#define __bool_true_false_are_defined 1
+# define __bool_true_false_are_defined 1
+# endif
#endif
#define NELEM(x) ((int) (sizeof(x) / sizeof((x)[0])))