From d3c8a80cbdfd4c0164f89465a4278ec9b426ac4d Mon Sep 17 00:00:00 2001 From: johanknol Date: Tue, 19 Jun 2001 19:04:33 +0000 Subject: [PATCH] while emitting maps, we are inInitMode git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@906 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- src/SDCCast.c | 2 +- src/SDCCast.h | 1 + src/SDCCglue.c | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/SDCCast.c b/src/SDCCast.c index 1874a67d..1c65e5c9 100644 --- a/src/SDCCast.c +++ b/src/SDCCast.c @@ -1035,7 +1035,7 @@ gatherAutoInit (symbol * autoChain) symbol *newSym; // this can only be a constant - if (!IS_LITERAL(sym->ival->init.node->etype)) { + if (!inInitMode && !IS_LITERAL(sym->ival->init.node->etype)) { werror (E_CONST_EXPECTED); } diff --git a/src/SDCCast.h b/src/SDCCast.h index c469be9f..da757258 100644 --- a/src/SDCCast.h +++ b/src/SDCCast.h @@ -208,5 +208,6 @@ void addSymToBlock (symbol *, ast *); // exported variables extern set *operKeyReset; extern int noAlloc; +extern int inInitMode; #endif diff --git a/src/SDCCglue.c b/src/SDCCglue.c index 3fb48743..3ef90f22 100644 --- a/src/SDCCglue.c +++ b/src/SDCCglue.c @@ -1034,6 +1034,7 @@ emitStaticSeg (memmap * map, FILE * out) void emitMaps () { + inInitMode++; /* no special considerations for the following data, idata & bit & xdata */ emitRegularMap (data, TRUE, TRUE); @@ -1046,6 +1047,7 @@ emitMaps () emitRegularMap (code, TRUE, FALSE); emitStaticSeg (statsg, code->oFile); + inInitMode--; } /*-----------------------------------------------------------------*/ -- 2.30.2