From b7115659b34440495f55bf4f5c7adaeee735542a Mon Sep 17 00:00:00 2001 From: ehofman Date: Tue, 3 Jan 2006 17:40:49 +0000 Subject: [PATCH] Make the sgi code the default to prevent future problems. --- simgear/nasal/code.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/simgear/nasal/code.c b/simgear/nasal/code.c index 9e5907f6..52cbf5bd 100644 --- a/simgear/nasal/code.c +++ b/simgear/nasal/code.c @@ -200,12 +200,22 @@ void naFreeContext(struct Context* c) UNLOCK(); } -#if !defined(sgi) +#if 0 +/* + * This is the original code which might not work properly on all + * platforms since it allows one to work on the same variable in one + * statement without the prior knowledge how this will behave. + * + * e.g. ctx->opStack[ctx->opTop++] = ctx->opStack[ctx->opTop-1]; + * ^^^^^ ^^^^^ + */ # define PUSH(r) do { \ if(ctx->opTop >= MAX_STACK_DEPTH) ERR(ctx, "stack overflow"); \ ctx->opStack[ctx->opTop++] = r; \ - } while(0); + } while(0) + #else + # define PUSH(r) _PUSH((ctx), (r)) void _PUSH(struct Context* ctx, naRef r) { if(ctx->opTop >= MAX_STACK_DEPTH) ERR(ctx, "stack overflow");