while emitting maps, we are inInitMode
authorjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Tue, 19 Jun 2001 19:04:33 +0000 (19:04 +0000)
committerjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Tue, 19 Jun 2001 19:04:33 +0000 (19:04 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@906 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/SDCCast.c
src/SDCCast.h
src/SDCCglue.c

index 1874a67d0d8b3da7a0d769e15afc209970b7288b..1c65e5c9e8d1d76962d88487b19cb9b5ceeb07c8 100644 (file)
@@ -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);
          }
 
index c469be9f2bee35867745d7c4bc0a6dac008dbdda..da7572583f0f4e2097d6cf6325a17056da3b602c 100644 (file)
@@ -208,5 +208,6 @@ void addSymToBlock (symbol *, ast *);
 // exported variables 
 extern set *operKeyReset;
 extern int noAlloc;
+extern int inInitMode;
 
 #endif
index 3fb487436f341d886eef80f967024daa700f7e5c..3ef90f226a734238ceadc7a7d8f5b5b4018a7832 100644 (file)
@@ -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--;
 }
 
 /*-----------------------------------------------------------------*/