diff src/expr.h @ 67:d5fe306f1ab1

Fixed numerous bugs in macro handling
author lost
date Mon, 05 Jan 2009 05:40:33 +0000
parents 538e15927776
children 2fe5fd7d65a3
line wrap: on
line diff
--- a/src/expr.h	Mon Jan 05 05:40:16 2009 +0000
+++ b/src/expr.h	Mon Jan 05 05:40:33 2009 +0000
@@ -107,10 +107,10 @@
 #define lwasm_expr_is_simple(s) ((s) -> head == (s) -> tail)
 
 // is the expression constant?
-#define lwasm_expr_is_constant(s) (lwasm_expr_is_simple(s) && (s) -> head -> term -> term_type == LWASM_TERM_INT)
+#define lwasm_expr_is_constant(s) (lwasm_expr_is_simple(s) && (!((s) -> head) || (s) -> head -> term -> term_type == LWASM_TERM_INT))
 
 // get the constant value of an expression or 0 if not constant
-#define lwasm_expr_get_value(s) (lwasm_expr_is_constant(s) ? (s) -> head -> term -> value : 0)
+#define lwasm_expr_get_value(s) (lwasm_expr_is_constant(s) ? ((s) -> head ? (s) -> head -> term -> value : 0) : 0)
 
 #undef __expr_E__