]> andersk Git - splint.git/blob - src/context.c
*** empty log message ***
[splint.git] / src / context.c
1 /*
2 ** LCLint - annotation-assisted static program checker
3 ** Copyright (C) 1994-2001 University of Virginia,
4 **         Massachusetts Institute of Technology
5 **
6 ** This program is free software; you can redistribute it and/or modify it
7 ** under the terms of the GNU General Public License as published by the
8 ** Free Software Foundation; either version 2 of the License, or (at your
9 ** option) any later version.
10 ** 
11 ** This program is distributed in the hope that it will be useful, but
12 ** WITHOUT ANY WARRANTY; without even the implied warranty of
13 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 ** General Public License for more details.
15 ** 
16 ** The GNU General Public License is available from http://www.gnu.org/ or
17 ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
18 ** MA 02111-1307, USA.
19 **
20 ** For information on lclint: lclint-request@cs.virginia.edu
21 ** To report a bug: lclint-bug@cs.virginia.edu
22 ** For more information: http://lclint.cs.virginia.edu
23 */
24 /*
25 ** context.c
26 */
27 /*
28  * Modified by Herbert 04/19/97:
29  * - added include for new header portab.h containing OS dependent stuff.
30  * - changed occurrances of '/' as path delimiters to macro from portab.h
31  * - changed the handling of the tmp directory -- will no longer always be
32  *   ".", if possible, environment variables "TMP" or, if not set, "TMP", 
33  *   or, if not set "." will be used.
34  */
35
36 # include "lclintMacros.nf"
37 # include "llbasic.h"
38 # include "mtincludes.h"
39
40 # ifndef NOLCL
41 # include "usymtab_interface.h"
42 # endif
43
44 # include "exprChecks.h"
45 # include "filelocStack.h"
46 # include "fileIdList.h"
47 # include "llmain.h"
48 # include "intSet.h"
49 # include "osd.h"
50 # include "portab.h"
51
52 extern /*@external@*/ int yydebug;
53 extern /*@external@*/ int mtdebug;
54
55 typedef struct
56
57   cstring file; 
58   typeIdSet daccess ; 
59 } maccesst;
60
61 typedef enum { 
62   CX_ERROR,
63
64   CX_GLOBAL, CX_INNER, 
65   CX_FUNCTION, CX_FCNHEADER, CX_FCNDECLARATION,
66   CX_MACROFCN, CX_MACROCONST, CX_UNKNOWNMACRO, 
67   CX_ITERDEF, CX_ITEREND,
68   CX_LCL, CX_LCLLIB, CX_MT
69 } kcontext;
70
71 static struct
72 {
73   int linesprocessed;
74   int speclinesprocessed;
75
76   flagMarkerList markers;
77
78   /*
79   **  used to record state where a macro must match a function name
80   **   (i.e., no params were listed in the macro definition
81   */
82
83   bool macroMissingParams BOOLBITS;
84   bool preprocessing BOOLBITS;
85   bool incommandline BOOLBITS;
86   bool insuppressregion  BOOLBITS;
87   bool inDerivedFile BOOLBITS;
88   bool instandardlib  BOOLBITS;
89   bool inimport  BOOLBITS;
90   bool inheader  BOOLBITS;
91   bool inmacrocache  BOOLBITS;
92   bool protectVars  BOOLBITS;
93   bool neednl  BOOLBITS;
94   bool showfunction  BOOLBITS;
95   bool savedFlags  BOOLBITS;
96   bool justpopped  BOOLBITS;
97   bool anyExports BOOLBITS;
98
99   flagcode library;
100
101   ynm isNullGuarded;
102   fileloc saveloc;
103   fileloc pushloc;
104
105   clauseStack clauses; 
106   clause inclause;
107
108   int numerrors;
109
110   filelocStack locstack;
111   fileTable ftab;
112   cstring msgAnnote;
113   /*@observer@*/ sRef aliasAnnote;
114   /*@observer@*/ sRef aliasAnnoteAls;
115   messageLog  msgLog;
116
117   macrocache  mc;
118   /*@observer@*/ sRefSet mods;
119
120   /* file access types */
121   typeIdSet facct;   
122
123   /* local access types (this function) */
124   typeIdSet acct;  
125
126   /* no access types (@noaccess) */
127   typeIdSet nacct; 
128
129   /*@observer@*/ globSet globs;
130   /*@only@*/ globSet globs_used;
131   
132   int nmods;
133   int maxmods;
134   /*@reldef@*/ maccesst *moduleaccess; /* Not defined is nmods == 0. */
135   
136   kcontext kind;
137   kcontext savekind;
138
139   ctype boolType;
140
141   bool flags[NUMFLAGS];
142   bool saveflags[NUMFLAGS];
143   bool setGlobally[NUMFLAGS];
144   bool setLocally[NUMFLAGS];
145
146   int values[NUMVALUEFLAGS];
147   int counters[NUMVALUEFLAGS];
148
149   o_cstring strings[NUMSTRINGFLAGS];
150   sRefSetList modrecs; /*@i32 ???? what is this for? */
151
152   metaStateTable stateTable; /* User-defined state information. */
153   annotationTable annotTable; /* User-defined annotations table. */
154   union 
155     {
156       bool glob;
157       int  cdepth;
158       /*@dependent@*/ /*@exposed@*/ uentry  fcn;
159     } cont;
160 } gc;
161
162 static /*@exposed@*/ cstring context_exposeString (flagcode p_flag) ;
163 static void context_restoreFlagSettings (void) /*@modifies gc@*/ ;
164 static void context_saveFlagSettings (void) /*@modifies gc@*/ ;
165 static void context_exitClauseAux (exprNode p_pred, exprNode p_tbranch)
166    /*@modifies gc@*/ ;
167 static void context_exitClauseSimp (void)  /*@modifies gc@*/ ;
168 static void context_exitClausePlain (void) /*@modifies gc@*/ ;
169 static void context_setJustPopped (void) /*@modifies gc.justpopped@*/ ;
170 static void context_setValue (flagcode p_flag, int p_val) /*@modifies gc.flags@*/ ;
171 static void context_setFlag (flagcode p_f, bool p_b)
172   /*@modifies gc.flags@*/ ;
173
174 static void
175   context_setFlagAux (flagcode p_f, bool p_b, bool p_inFile, bool p_isRestore)
176   /*@modifies gc.flags@*/ ;
177
178 static void context_restoreFlag (flagcode p_f) /*@modifies gc.flags@*/ ;
179
180 /*@+enumindex@*/ 
181
182 cstring context_unparseFlagMarkers ()
183 {
184   return (flagMarkerList_unparse (gc.markers));
185 }
186
187 void context_setPreprocessing (void)
188 {
189   llassert (!gc.preprocessing);
190   gc.preprocessing = TRUE;
191 }
192
193 void context_clearPreprocessing (void)
194 {
195   llassert (gc.preprocessing);
196   gc.preprocessing = FALSE;
197 }
198
199 bool context_isPreprocessing (void)
200 {
201   return gc.preprocessing;
202 }
203
204 bool context_loadingLibrary (void)
205 {
206   return (fileloc_isLib (g_currentloc));
207 }
208
209 bool context_inXHFile (void)
210 {
211   return (fileloc_isXHFile (g_currentloc));
212 }
213
214 void context_setInCommandLine (void)
215 {
216   llassert (!gc.incommandline);
217   gc.incommandline = TRUE;
218 }
219
220 void context_clearInCommandLine (void)
221 {
222   llassert (gc.incommandline);
223   gc.incommandline = FALSE;
224 }
225
226 bool context_isInCommandLine (void)
227 {
228   return gc.incommandline;
229 }
230
231 static
232 void pushClause (clause c) /*@modifies gc.clauses, gc.inclause@*/
233 {
234   gc.inclause = c;
235   clauseStack_push (gc.clauses, c);
236
237   if (clause_isConditional (c)
238       && context_getFlag (FLG_CONTROLNESTDEPTH))
239     {
240       int maxdepth = context_getValue (FLG_CONTROLNESTDEPTH);
241       int depth = clauseStack_controlDepth (gc.clauses);
242       
243       if (depth == maxdepth + 1)
244         {
245           voptgenerror 
246             (FLG_CONTROLNESTDEPTH,
247              message ("Maximum control nesting depth "
248                       "(%d) exceeded",
249                       maxdepth),
250              g_currentloc);
251         }
252     }
253 }
254
255 static
256 clause topClause (clauseStack s) /*@*/
257 {
258   if (clauseStack_isEmpty (s)) return NOCLAUSE;
259   return ((clause) clauseStack_top (s));
260 }
261
262 void
263 context_addMacroCache (/*@only@*/ cstring def)
264 {
265   DPRINTF (("macro cache: %s", def));
266   macrocache_addEntry (gc.mc, fileloc_copy (g_currentloc), def);
267 }
268
269 void
270 context_addComment (/*@only@*/ cstring def)
271 {
272   DPRINTF (("macro comment: %s", def));
273   macrocache_addComment (gc.mc, fileloc_copy (g_currentloc), def);
274 }
275
276 /*
277 ** returns TRUE is fl is in ignore region, or region where -code
278 **
279 ** the logic is fuzzy...
280 */
281
282 static bool
283 context_inSuppressFlagZone (fileloc fl, flagcode code)
284 {
285   ynm ret = flagMarkerList_suppressError (gc.markers, code, fl);
286   bool res = FALSE;
287   
288   if (ynm_isMaybe (ret))
289     {
290       /*
291       ** whas is dis?
292       */
293
294       if (gc.savedFlags)
295         {
296           res = !gc.saveflags[code];
297         }
298       else
299         {
300           res = !context_getFlag (code);
301         }
302     }
303   else
304     {
305       res = ynm_toBoolStrict (ret);
306     }
307   
308     return res;
309 }
310
311 static bool
312 context_suppressSystemMsg (fileloc fl)
313 {
314   if (context_getFlag (FLG_SYSTEMDIRERRORS))
315     {
316       return FALSE;
317     }
318   else
319     {
320       return (fileloc_isSystemFile (fl));
321     }
322 }
323
324 bool 
325 context_suppressFlagMsg (flagcode flag, fileloc fl)
326 {
327   if (context_suppressSystemMsg (fl))
328     {
329       return TRUE;
330     }
331
332   /* want same object compare here */
333
334   if (fileloc_equal (fl, g_currentloc) || gc.inDerivedFile)
335     {
336       return (!context_getFlag (flag)
337               || context_inSuppressRegion ()
338               || context_inSuppressZone (fl)
339               || (gc.inDerivedFile && context_inSuppressFlagZone (fl, flag)));
340     }
341   else
342     {
343       return (context_inSuppressFlagZone (fl, flag));
344     }
345 }
346
347 bool 
348 context_suppressNotFlagMsg (flagcode flag, fileloc fl)
349 {
350   
351   if (context_suppressSystemMsg (fl))
352     {
353       return TRUE;
354     }
355
356   /*@access fileloc@*/ 
357   if (fl == g_currentloc)
358     /*@noaccess fileloc@*/
359     {
360       return (context_getFlag (flag) || context_inSuppressRegion ());
361     }
362   else
363     {
364       /* for now... */
365       return (context_getFlag (flag) || context_inSuppressRegion ());
366     }
367 }
368
369 bool
370 context_inSuppressZone (fileloc fl) 
371 {
372   if (context_suppressSystemMsg (fl))
373     {
374       return TRUE;
375     }
376
377   return (flagMarkerList_inIgnore (gc.markers, fl));
378 }
379
380 bool
381 context_inSuppressRegion (void)
382 {
383   return (gc.insuppressregion);
384 }
385
386 void
387 context_enterSuppressRegion (void)
388 {
389   if (gc.insuppressregion)
390     {
391       gc.insuppressregion = FALSE;      /* get this msg! */
392       llmsg (message
393              ("%q: New ignore errors region entered while in ignore errors region",
394               fileloc_unparse (g_currentloc)));
395     }
396   
397   gc.insuppressregion = TRUE;
398   flagMarkerList_add (gc.markers, flagMarker_createIgnoreOn (g_currentloc));
399 }
400
401 static void
402 context_addFlagMarker (flagcode code, ynm set)
403 {
404   flagMarkerList_add (gc.markers,
405                       flagMarker_createLocalSet (code, set, g_currentloc));
406 }
407
408 void
409 context_enterSuppressLine (int count)
410 {
411   fileloc nextline = fileloc_copy (g_currentloc);
412
413   flagMarkerList_add (gc.markers,
414                       flagMarker_createIgnoreCount (count, g_currentloc));
415
416   fileloc_nextLine (nextline);
417   flagMarkerList_add (gc.markers,
418                       flagMarker_createIgnoreOff (nextline));
419   fileloc_free (nextline);
420 }
421
422 void context_checkSuppressCounts (void)
423 {
424   if (context_getFlag (FLG_SUPCOUNTS))
425     {
426       flagMarkerList_checkSuppressCounts (gc.markers);
427     }
428 }
429
430 void context_incLineno (void)
431 {
432   gc.linesprocessed++;
433   incLine ();
434 }
435
436 void
437 context_exitSuppressRegion (void)
438 {
439   if (!gc.insuppressregion)
440     {
441       llerrorlit (FLG_SYNTAX, 
442                   "End ignore errors in region while not ignoring errors");
443     }
444
445     gc.insuppressregion = FALSE;
446   flagMarkerList_add (gc.markers, flagMarker_createIgnoreOff (g_currentloc));
447 }
448
449 void
450 context_enterMTfile (void)
451 {
452   gc.kind = CX_MT;
453 }
454
455 void
456 context_exitMTfile (void)
457 {
458   llassert (gc.kind == CX_MT);
459   gc.kind = CX_GLOBAL;
460 }
461
462 # ifndef NOLCL
463 void
464 context_enterLCLfile (void)
465 {
466   gc.kind = CX_LCL;
467   gc.facct = typeIdSet_emptySet ();
468 }
469 # endif
470
471 static void
472 addModuleAccess (/*@only@*/ cstring fname, typeIdSet mods)
473 {
474   int i;
475
476   for (i = 0; i < gc.nmods; i++)
477     {
478       if (cstring_equal (gc.moduleaccess[i].file, fname))
479         {
480           gc.moduleaccess[i].daccess = typeIdSet_union (gc.moduleaccess[i].daccess, mods);
481           cstring_free (fname);
482           return;
483         }
484     }
485   
486   if (gc.nmods == gc.maxmods)
487     {
488       maccesst *oldmods;
489       
490       gc.maxmods = gc.maxmods + DEFAULTMAXMODS;      
491       oldmods = gc.moduleaccess;
492       
493       gc.moduleaccess = (maccesst *) dmalloc (sizeof (*gc.moduleaccess) * (gc.maxmods));
494       
495       for (i = 0; i < gc.nmods; i++)
496         {
497           gc.moduleaccess[i] = oldmods[i];
498         }
499       
500       sfree (oldmods);
501     }
502   
503   gc.moduleaccess[gc.nmods].file = fname;
504   gc.moduleaccess[gc.nmods].daccess = mods;
505   
506   gc.nmods++;
507 }
508
509 static void
510 insertModuleAccess (cstring fname, typeId t)
511 {
512   int i;
513   
514   for (i = 0; i < gc.nmods; i++)
515     {
516       if (cstring_equal (gc.moduleaccess[i].file, fname))
517         {
518           gc.moduleaccess[i].daccess = typeIdSet_insert (gc.moduleaccess[i].daccess, t);
519           break;
520         }
521     }
522   
523     addModuleAccess (cstring_copy (fname), typeIdSet_single (t));
524 }
525
526 # ifndef NOLCL
527 void
528 context_exitLCLfile (void)
529 {
530   if (gc.kind != CX_LCLLIB)
531     {
532       cstring lclname =  
533         fileLib_withoutExtension (fileName (currentFile ()), LCL_EXTENSION);
534       
535       addModuleAccess (fileLib_removePath (lclname), gc.facct);
536       cstring_free (lclname);
537     }
538   
539   gc.kind = CX_LCL;
540   gc.kind = CX_GLOBAL;
541   gc.facct = typeIdSet_emptySet ();
542 }
543 # endif
544
545 void
546 context_dumpModuleAccess (FILE *fout)
547 {
548   int i = 0;
549
550   for (i = 0; i < gc.nmods; i++)
551     {
552       cstring td = typeIdSet_dump (gc.moduleaccess[i].daccess);
553
554       fprintf (fout, "%s#%s@\n", 
555                cstring_toCharsSafe (gc.moduleaccess[i].file), 
556                cstring_toCharsSafe (td));
557       
558       cstring_free (td);
559     }
560 }
561
562 bool context_usingPosixLibrary ()
563 {
564   return (gc.library == FLG_POSIXLIB 
565           || gc.library == FLG_POSIXSTRICTLIB
566           || gc.library == FLG_UNIXLIB
567           || gc.library == FLG_UNIXSTRICTLIB);
568 }
569
570 bool context_usingAnsiLibrary ()
571 {
572   return (gc.library != FLG_NOLIB);
573 }
574
575 flagcode context_getLibrary ()
576 {
577   return gc.library;
578 }
579
580 void context_setLibrary (flagcode code)
581 {
582   gc.library = code;
583 }
584
585 /*@observer@*/ cstring context_selectedLibrary ()
586 {
587   switch (gc.library)
588     {
589     case FLG_STRICTLIB:
590       return cstring_makeLiteralTemp (LLSTRICTLIBS_NAME);
591     case FLG_POSIXLIB:
592       return cstring_makeLiteralTemp (LLPOSIXLIBS_NAME);
593     case FLG_POSIXSTRICTLIB:
594       return cstring_makeLiteralTemp (LLPOSIXSTRICTLIBS_NAME);
595     case FLG_UNIXLIB:
596       return cstring_makeLiteralTemp (LLUNIXLIBS_NAME);    
597     case FLG_UNIXSTRICTLIB:
598       return cstring_makeLiteralTemp (LLUNIXSTRICTLIBS_NAME);
599     case FLG_ANSILIB:
600       return cstring_makeLiteralTemp (LLSTDLIBS_NAME);
601     BADDEFAULT;
602     }
603 }
604   
605
606 void
607 context_loadModuleAccess (FILE *in)
608 {
609   char *s = mstring_create (MAX_DUMP_LINE_LENGTH);
610   char *lasts = s;
611   char *name = mstring_create (MAX_NAME_LENGTH);
612   char *oname = name;
613 # ifndef NOFREE
614   char *os = s;
615 # endif
616
617   while ((reader_readLine (in, s, MAX_DUMP_LINE_LENGTH) != NULL )
618          && *s == ';')
619     {
620       ;
621     }
622
623   while (s != NULL && *s != ';' && *s != '\0')
624     {
625       name = oname;
626       
627       while (*s != '#' && *s != '\0')
628         {
629           *name++ = *s++;
630         }
631
632       *name = '\0';
633
634       if (*s != '#')
635         {
636           llcontbug (message ("context_loadModuleAccess: bad library line: %s\n", 
637                               cstring_fromChars (s)));
638           break;
639         }
640
641       s++;
642
643       addModuleAccess (cstring_copy (cstring_fromChars (oname)), 
644                        typeIdSet_undump (&s)); 
645
646       (void) reader_readLine (in, s, MAX_DUMP_LINE_LENGTH);
647       llassert (s != lasts);
648       lasts = s;
649     }
650
651   sfree (oname);
652 # ifndef NOFREE
653   sfree (os);
654 # endif
655 }
656
657 typeIdSet context_fileAccessTypes (void)
658 {
659   return gc.facct;
660 }
661
662 void
663 context_resetModeFlags (void)
664 {
665   
666   allFlagCodes (code)
667     {
668       if (flagcode_isModeFlag (code))
669         {
670           context_setFlag (code, FALSE);
671         }
672     } end_allFlagCodes;
673
674   }
675
676 /*
677 ** resetAllFlags
678 **
679 ** Set all flags to FALSE, except for a few which are
680 ** true by default.
681 **
682 ** Set all values and strings to appropriate defaults.
683 ** Set all counters to 0.
684 */
685
686 static void
687 conext_resetAllCounters (void)
688 {
689   int i;
690
691   for (i = 0; i < NUMVALUEFLAGS; i++)
692     {
693       gc.counters[i] = 0;
694     }
695 }
696
697 void
698 context_resetAllFlags (void)
699 {
700   allFlagCodes (code)
701     {
702       gc.flags[code] = FALSE;
703
704       if (flagcode_hasValue (code))
705         {
706           int val = 0;
707           
708           /*@-loopswitchbreak@*/
709           switch (code)
710             {
711             case FLG_LIMIT: 
712               val = DEFAULT_LIMIT; break;
713             case FLG_BUGSLIMIT:
714               val = DEFAULT_BUGSLIMIT; break;
715             case FLG_LINELEN: 
716               val = DEFAULT_LINELEN; break;
717             case FLG_INDENTSPACES: 
718               val = DEFAULT_INDENTSPACES; break;
719             case FLG_EXTERNALNAMELEN:
720               val = DEFAULT_EXTERNALNAMELEN; break;
721             case FLG_INTERNALNAMELEN:
722               val = DEFAULT_INTERNALNAMELEN; break;
723             case FLG_COMMENTCHAR: 
724               val = (int) DEFAULT_COMMENTCHAR; break;
725             case FLG_CONTROLNESTDEPTH:
726               val = (int) DEFAULT_CONTROLNESTDEPTH; break;
727             case FLG_STRINGLITERALLEN:
728               val = (int) DEFAULT_STRINGLITERALLEN; break;
729             case FLG_INCLUDENEST:
730               val = (int) DEFAULT_INCLUDENEST; break;
731             case FLG_NUMSTRUCTFIELDS:
732               val = (int) DEFAULT_NUMSTRUCTFIELDS; break;
733             case FLG_NUMENUMMEMBERS:
734               val = (int) DEFAULT_NUMENUMMEMBERS; break;
735             case FLG_EXPECT:
736             case FLG_LCLEXPECT:
737               break;
738             default:
739               llbug (message ("Bad value flag: %s", flagcode_unparse (code)));
740             }
741           /*@=loopswitchbreak@*/          
742
743           context_setValue (code, val);
744         }
745       else if (flagcode_hasString (code))
746         {
747           cstring val = cstring_undefined;
748           
749           switch (code)
750             { /*@-loopswitchbreak@*/
751             case FLG_LARCHPATH:
752               {
753                 cstring larchpath = osd_getEnvironmentVariable (LARCH_PATH);
754                 
755                 if (cstring_isDefined (larchpath))
756                   {
757                     val = cstring_copy (larchpath);
758                   }
759                 else
760                   {
761                     val = cstring_makeLiteral (DEFAULT_LARCHPATH);
762                   }
763                 
764                 break;
765               }
766             case FLG_LCLIMPORTDIR:
767               {
768                 val = cstring_copy (osd_getEnvironment (cstring_makeLiteralTemp (LCLIMPORTDIR), cstring_makeLiteralTemp (DEFAULT_LCLIMPORTDIR)));
769                 break;
770               }
771             case FLG_TMPDIR: 
772 # if defined(OS2) || defined(MSDOS) || defined(WIN32)
773               {
774                 char *env = osd_getEnvironmentVariable ("TMP");
775
776                 if (env == NULL)
777                   {
778                     env = osd_getEnvironmentVariable ("TEMP");
779                   }
780
781                 val = cstring_makeLiteral (env != NULL ? env : DEFAULT_TMPDIR);
782               }
783 # else
784               val = cstring_makeLiteral (DEFAULT_TMPDIR);
785 # endif /* !defined(OS2) && !defined(MSDOS) */
786
787               break;
788             case FLG_BOOLTYPE:
789               val = cstring_makeLiteral (DEFAULT_BOOLTYPE); break;
790             case FLG_BOOLFALSE:
791               val = cstring_makeLiteral ("FALSE"); break;
792             case FLG_BOOLTRUE:
793               val = cstring_makeLiteral ("TRUE"); break;
794             case FLG_MACROVARPREFIX: 
795               val = cstring_makeLiteral ("m_"); break;
796             case FLG_SYSTEMDIRS:
797               val = cstring_makeLiteral (DEFAULT_SYSTEMDIR); break;
798             default:
799               break;
800             } /*@=loopswitchbreak@*/
801           
802           context_setString (code, val);
803         }
804       else
805         { 
806           ; /* nothing to set */
807         }
808     } end_allFlagCodes;
809   
810   /*
811   ** These flags are true by default.
812   */
813
814   /*@i34 move this into flags.def */
815     
816   gc.flags[FLG_MODIFIES] = TRUE;
817   gc.flags[FLG_NESTCOMMENT] = TRUE;
818   gc.flags[FLG_GLOBALS] = TRUE;
819   gc.flags[FLG_FULLINITBLOCK] = TRUE;
820   gc.flags[FLG_LIKELYBOOL] = TRUE;
821   gc.flags[FLG_ZEROPTR] = TRUE;
822   gc.flags[FLG_NUMLITERAL] = TRUE;
823   gc.flags[FLG_DUPLICATEQUALS] = TRUE;
824   gc.flags[FLG_SKIPANSIHEADERS] = TRUE;
825   gc.flags[FLG_SKIPPOSIXHEADERS] = TRUE;
826   gc.flags[FLG_SYSTEMDIREXPAND] = TRUE;
827   gc.flags[FLG_UNRECOGCOMMENTS] = TRUE;
828   gc.flags[FLG_UNRECOGFLAGCOMMENTS] = TRUE;
829   gc.flags[FLG_CASTFCNPTR] = TRUE;
830   gc.flags[FLG_DOLCS] = TRUE;
831   gc.flags[FLG_USEVARARGS] = TRUE;
832   gc.flags[FLG_MAINTYPE] = TRUE;
833   gc.flags[FLG_SPECMACROS] = TRUE;
834   gc.flags[FLG_REDEF] = TRUE;
835   gc.flags[FLG_MACRONEXTLINE] = TRUE;
836
837   gc.flags[FLG_SIZEOFFORMALARRAY] = TRUE;
838   gc.flags[FLG_FIXEDFORMALARRAY] = TRUE;
839
840   gc.flags[FLG_WARNUSE] = TRUE;
841   gc.flags[FLG_PREDASSIGN] = TRUE;
842   gc.flags[FLG_MODOBSERVER] = TRUE;
843   gc.flags[FLG_MACROVARPREFIXEXCLUDE] = TRUE;
844   gc.flags[FLG_EXTERNALNAMECASEINSENSITIVE] = TRUE;
845
846   gc.flags[FLG_PARAMIMPTEMP] = TRUE;
847   gc.flags[FLG_RETIMPONLY] = TRUE;
848   gc.flags[FLG_GLOBIMPONLY] = TRUE;
849   gc.flags[FLG_STRUCTIMPONLY] = TRUE;
850   gc.flags[FLG_PREPROC] = TRUE;
851   gc.flags[FLG_NAMECHECKS] = TRUE;
852   gc.flags[FLG_FORMATCODE] = TRUE;
853   gc.flags[FLG_FORMATTYPE] = TRUE;
854   gc.flags[FLG_BADFLAG] = TRUE;
855   gc.flags[FLG_WARNFLAGS] = TRUE;
856   gc.flags[FLG_FILEEXTENSIONS] = TRUE;
857   gc.flags[FLG_WARNUNIXLIB] = TRUE;
858   gc.flags[FLG_WARNPOSIX] = TRUE;
859   gc.flags[FLG_SHOWCOL] = TRUE;
860   gc.flags[FLG_SHOWFUNC] = TRUE;
861   gc.flags[FLG_SUPCOUNTS] = TRUE;
862   gc.flags[FLG_HINTS] = TRUE;
863   gc.flags[FLG_SYNTAX] = TRUE;
864   gc.flags[FLG_TYPE] = TRUE;
865   gc.flags[FLG_INCOMPLETETYPE] = TRUE;
866   gc.flags[FLG_ABSTRACT] = TRUE;
867   gc.flags[FLG_ITER] = TRUE;
868   gc.flags[FLG_CONTROL] = TRUE;
869   gc.flags[FLG_UNRECOG] = TRUE;
870   gc.flags[FLG_SYSTEMUNRECOG] = TRUE;
871   gc.flags[FLG_LINTCOMMENTS] = TRUE;
872   gc.flags[FLG_ACCESSCZECH] = TRUE;
873   gc.flags[FLG_ACCESSMODULE] = TRUE;
874   gc.flags[FLG_ACCESSFILE] = TRUE;
875   gc.flags[FLG_MACROVARPREFIX] = TRUE;
876
877   gc.flags[FLG_ANNOTATIONERROR] = TRUE;
878   gc.flags[FLG_COMMENTERROR] = TRUE;
879
880   /*
881   ** Changed for version 2.4.
882   */
883
884   gc.flags[FLG_GNUEXTENSIONS] = TRUE;
885
886   /*
887   ** On by default for Win32, but not Unix (to support MS/VC++ error message format).
888   */
889
890 # ifdef WIN32
891   gc.flags[FLG_PARENFILEFORMAT] = TRUE;
892 # endif
893 }
894
895 /*
896 ** C is way-lame, and you can initialize an array to a constant except where
897 ** it is declared.  Hence, a macro is used to set the modeflags.
898 */
899
900 /*@notfunction@*/
901 # define SETFLAGS() \
902   { int i = 0; while (modeflags[i] != INVALID_FLAG) { \
903       if (!flagcode_isModeFlag (modeflags[i])) \
904         { llbug (message ("not a mode flag: %s", \
905                           flagcode_unparse (modeflags[i]))); } \
906       else { context_setFlag (modeflags[i], TRUE); }  i++; }}
907
908 void
909 context_setMode (cstring s)
910 {
911   intSet setflags = intSet_new ();
912   
913   allFlagCodes (code)
914     {
915       if (flagcode_isModeFlag (code))
916         {
917           if (gc.setGlobally[code])
918             {
919               (void) intSet_insert (setflags, (int) code);
920             }
921         }
922     } end_allFlagCodes;
923   
924   if (!intSet_isEmpty (setflags))
925     {
926       cstring rflags = cstring_undefined;
927       int num = 0;
928
929       intSet_elements (setflags, el)
930         {
931           if (cstring_isUndefined (rflags))
932             {
933               rflags = cstring_copy (flagcode_unparse ((flagcode) (el)));
934             }
935           else
936             {
937               rflags = message ("%q, %s", rflags, 
938                                 flagcode_unparse ((flagcode) el));
939             }
940
941           num++;
942           if (num > 4 && intSet_size (setflags) > 6)
943             {
944               rflags = message ("%q, (%d others) ...", rflags, 
945                                 intSet_size (setflags) - num);
946               break;
947             }
948         } end_intSet_elements ;
949       
950       voptgenerror (FLG_WARNFLAGS,
951                     message ("Setting mode %s after setting mode flags will "
952                              "override set values of flags: %s",
953                              s, rflags),
954                     g_currentloc);
955
956       cstring_free (rflags);
957     }
958
959   intSet_free (setflags);
960
961   context_resetModeFlags ();
962
963   if (cstring_equalLit (s, "standard"))
964     {
965       flagcode modeflags[] = 
966         {
967           FLG_ENUMINT, FLG_MACROMATCHNAME,
968           FLG_MACROUNDEF, FLG_RELAXQUALS, 
969           FLG_USEALLGLOBS, FLG_CHECKSTRICTGLOBALS,
970           FLG_CHECKSTRICTGLOBALIAS,
971           FLG_CHECKEDGLOBALIAS,
972           FLG_CHECKMODGLOBALIAS,
973           FLG_PREDBOOLOTHERS, FLG_PREDBOOLINT,
974           FLG_PARAMUNUSED, FLG_VARUNUSED, FLG_FUNCUNUSED, 
975           FLG_TYPEUNUSED,
976           FLG_CONSTUNUSED, FLG_ENUMMEMUNUSED, FLG_FIELDUNUSED,
977           FLG_PTRNUMCOMPARE, FLG_BOOLCOMPARE, FLG_MUTREP, 
978           FLG_NOEFFECT, FLG_IMPTYPE,
979           FLG_RETVALOTHER, FLG_RETVALBOOL, FLG_RETVALINT,
980           FLG_SPECUNDEF, FLG_INCONDEFS, FLG_INCONDEFSLIB, FLG_MISPLACEDSHAREQUAL,
981           FLG_MATCHFIELDS,
982           FLG_FORMATCONST,
983           FLG_MACROPARAMS, FLG_MACROASSIGN, FLG_SEFPARAMS, 
984           FLG_MACROSTMT, FLG_MACROPARENS, 
985           FLG_MACROFCNDECL,
986           FLG_MACROCONSTDECL,
987           FLG_MACROREDEF, FLG_INFLOOPS, FLG_UNREACHABLE, 
988           FLG_NORETURN, FLG_CASEBREAK, FLG_MISSCASE, FLG_USEDEF, 
989           FLG_FIRSTCASE,
990           FLG_NESTEDEXTERN, 
991           FLG_NUMLITERAL,
992           FLG_ZEROBOOL,
993           /* memchecks flags */
994           FLG_NULLDEREF, 
995           FLG_NULLSTATE, FLG_NULLASSIGN,
996           FLG_NULLPASS, FLG_NULLRET,        
997
998           FLG_COMPDEF, FLG_COMPMEMPASS, FLG_UNIONDEF,
999           FLG_RETSTACK,
1000
1001           /* memtrans flags */
1002           FLG_EXPOSETRANS,
1003           FLG_OBSERVERTRANS,
1004           FLG_DEPENDENTTRANS,
1005           FLG_NEWREFTRANS,
1006           FLG_ONLYTRANS,
1007           FLG_OWNEDTRANS,
1008           FLG_FRESHTRANS,
1009           FLG_SHAREDTRANS,
1010           FLG_TEMPTRANS,
1011           FLG_KEPTTRANS,
1012           FLG_REFCOUNTTRANS,
1013           FLG_STATICTRANS,
1014           FLG_UNKNOWNTRANS,
1015           FLG_KEEPTRANS,
1016           FLG_IMMEDIATETRANS,
1017
1018           FLG_EXPORTLOCAL,
1019
1020           FLG_USERELEASED, FLG_ALIASUNIQUE, FLG_MAYALIASUNIQUE,
1021           FLG_MUSTFREE, FLG_MUSTDEFINE, FLG_GLOBSTATE, 
1022           FLG_COMPDESTROY, FLG_MUSTNOTALIAS,
1023           FLG_MEMIMPLICIT,
1024           FLG_BRANCHSTATE, 
1025           FLG_STATETRANSFER, FLG_STATEMERGE,
1026           FLG_EVALORDER, FLG_SHADOW, FLG_READONLYSTRINGS,
1027           FLG_EXITARG,
1028           FLG_IMPCHECKEDSPECGLOBALS,
1029           FLG_MODGLOBS, FLG_WARNLINTCOMMENTS,
1030           FLG_IFEMPTY, FLG_REALCOMPARE,
1031           FLG_BOOLOPS, FLG_PTRNEGATE,
1032           FLG_SHIFTSIGNED,
1033           FLG_BUFFEROVERFLOWHIGH,
1034           FLG_BUFFEROVERFLOW,
1035           INVALID_FLAG 
1036         } ;
1037
1038       SETFLAGS ();
1039     }
1040   else if (cstring_equalLit (s, "weak"))
1041     {
1042       flagcode modeflags[] = 
1043         { 
1044           FLG_BOOLINT, FLG_CHARINT, FLG_FLOATDOUBLE,
1045           FLG_ENUMINT, FLG_RELAXQUALS, FLG_FORWARDDECL, 
1046           FLG_CHARINDEX, FLG_ABSTVOIDP, FLG_USEALLGLOBS, 
1047           FLG_CHARUNSIGNEDCHAR,
1048           FLG_PREDBOOLOTHERS, 
1049           FLG_VARUNUSED, FLG_FUNCUNUSED, 
1050           FLG_TYPEUNUSED,
1051           FLG_CHECKSTRICTGLOBALS, FLG_MACROMATCHNAME,
1052           FLG_RETVALOTHER,
1053           FLG_IFEMPTY, 
1054           FLG_RETSTACK, FLG_PTRNEGATE,
1055           FLG_STATETRANSFER, FLG_STATEMERGE,
1056           FLG_LONGUNSIGNEDINTEGRAL,
1057           FLG_LONGUNSIGNEDUNSIGNEDINTEGRAL,
1058           FLG_NUMLITERAL,
1059           FLG_CHARINTLITERAL,
1060           FLG_ZEROBOOL,
1061           FLG_BUFFEROVERFLOWHIGH,
1062           INVALID_FLAG 
1063           } ;
1064
1065       SETFLAGS ();
1066     }
1067   else if (cstring_equalLit (s, "checks"))
1068     {
1069       flagcode modeflags[] = 
1070         { 
1071           FLG_EXPORTLOCAL, FLG_IMPTYPE,
1072           FLG_STATETRANSFER, FLG_STATEMERGE,
1073           FLG_CHECKSTRICTGLOBALIAS,
1074           FLG_CHECKEDGLOBALIAS,
1075           FLG_CHECKMODGLOBALIAS,
1076           FLG_UNCHECKEDGLOBALIAS,
1077           FLG_FORMATCONST,
1078           FLG_EXITARG, FLG_PTRNUMCOMPARE, 
1079           FLG_BOOLCOMPARE, FLG_MACROUNDEF, 
1080           FLG_MUSTMOD, FLG_ALLGLOBALS,
1081           FLG_PREDBOOLOTHERS, FLG_PREDBOOLPTR, FLG_PREDBOOLINT,
1082           FLG_USEALLGLOBS, FLG_MUTREP, FLG_RETALIAS, 
1083           FLG_RETEXPOSE, FLG_ASSIGNEXPOSE, FLG_CASTEXPOSE,
1084           FLG_FUNCUNUSED, FLG_GLOBALSIMPMODIFIESNOTHING,
1085           FLG_TYPEUNUSED, FLG_FIELDUNUSED, FLG_PARAMUNUSED, FLG_VARUNUSED,
1086           FLG_CONSTUNUSED, FLG_ENUMMEMUNUSED,
1087           FLG_NOEFFECT, FLG_EXPORTHEADER, FLG_EXPORTHEADERVAR,
1088           FLG_RETVALOTHER, FLG_RETVALBOOL, FLG_RETVALINT,
1089           FLG_SPECUNDEF, FLG_IMPCHECKMODINTERNALS,
1090           FLG_DECLUNDEF, FLG_INCONDEFS, FLG_INCONDEFSLIB, 
1091           FLG_MISPLACEDSHAREQUAL, FLG_REDUNDANTSHAREQUAL,
1092           FLG_MATCHFIELDS, 
1093           FLG_MACROPARAMS,
1094           FLG_MACROASSIGN,
1095           FLG_DECLPARAMMATCH,
1096           FLG_FCNDEREF,
1097           FLG_FIRSTCASE,
1098           FLG_SEFPARAMS, FLG_SEFUNSPEC, FLG_MACROSTMT, FLG_MACROPARENS, 
1099           FLG_MACROCONSTDECL,
1100           FLG_MACROFCNDECL,
1101           FLG_MACROREDEF, 
1102           FLG_INFLOOPS, FLG_INFLOOPSUNCON,
1103           FLG_UNREACHABLE, 
1104           FLG_NORETURN, FLG_CASEBREAK, FLG_MISSCASE,
1105           FLG_EVALORDER, FLG_USEDEF, 
1106
1107           FLG_NESTEDEXTERN, 
1108
1109           /* memchecks flags */
1110
1111           FLG_NULLSTATE, FLG_NULLDEREF, FLG_NULLASSIGN,
1112           FLG_NULLPASS, FLG_NULLRET,
1113
1114           FLG_COMPDEF, FLG_COMPMEMPASS, FLG_UNIONDEF, FLG_RETSTACK,       
1115
1116           /* memtrans flags */
1117           FLG_EXPOSETRANS,
1118           FLG_OBSERVERTRANS,
1119           FLG_DEPENDENTTRANS,
1120           FLG_NEWREFTRANS,
1121           FLG_ONLYTRANS,
1122           FLG_OWNEDTRANS,
1123           FLG_FRESHTRANS,
1124           FLG_SHAREDTRANS,
1125           FLG_TEMPTRANS,
1126           FLG_KEPTTRANS,
1127           FLG_REFCOUNTTRANS,
1128           FLG_STATICTRANS,
1129           FLG_UNKNOWNTRANS,
1130           FLG_STATICINITTRANS,
1131           FLG_UNKNOWNINITTRANS,
1132           FLG_KEEPTRANS,
1133           FLG_IMMEDIATETRANS,
1134           FLG_ONLYUNQGLOBALTRANS,
1135           FLG_USERELEASED, FLG_ALIASUNIQUE, FLG_MAYALIASUNIQUE,
1136           FLG_MUSTFREE, FLG_MUSTDEFINE, FLG_GLOBSTATE, 
1137           FLG_COMPDESTROY, FLG_MUSTNOTALIAS,
1138           FLG_MEMIMPLICIT,
1139           FLG_BRANCHSTATE, 
1140           FLG_NULLPOINTERARITH,
1141           FLG_SHADOW, FLG_DEPARRAYS,
1142           FLG_REDECL, FLG_READONLYSTRINGS, FLG_READONLYTRANS,
1143           FLG_LOOPLOOPBREAK, FLG_SWITCHLOOPBREAK, FLG_MODGLOBS,
1144           FLG_CHECKSTRICTGLOBALS, FLG_IMPCHECKEDSPECGLOBALS,
1145           FLG_MACROMATCHNAME, FLG_WARNLINTCOMMENTS,
1146           FLG_INCLUDENEST, FLG_ANSIRESERVED, FLG_CPPNAMES, 
1147           FLG_NOPARAMS, FLG_IFEMPTY, FLG_WHILEEMPTY, FLG_REALCOMPARE,
1148           FLG_BOOLOPS, FLG_SHIFTSIGNED,
1149           FLG_BUFFEROVERFLOWHIGH, FLG_BUFFEROVERFLOW,
1150           INVALID_FLAG } ;
1151
1152       SETFLAGS ();
1153     }
1154   else if (cstring_equalLit (s, "strict"))
1155     {
1156       flagcode modeflags[] = 
1157         { 
1158           FLG_CHECKSTRICTGLOBALIAS,
1159           FLG_CHECKEDGLOBALIAS,
1160           FLG_CHECKMODGLOBALIAS,
1161           FLG_UNCHECKEDGLOBALIAS,
1162           FLG_MODFILESYSTEM,
1163           FLG_MACROMATCHNAME,
1164           FLG_FORMATCONST,
1165           FLG_STATETRANSFER, FLG_STATEMERGE,
1166           FLG_MACROUNDEF, FLG_MUTREP, FLG_MUSTMOD,
1167           FLG_ALLGLOBALS, FLG_IMPTYPE,
1168           FLG_MODNOMODS, FLG_MODGLOBSUNSPEC, FLG_MODSTRICTGLOBSUNSPEC,
1169           FLG_GLOBUNSPEC, FLG_SIZEOFTYPE,
1170           FLG_EXPORTHEADER, FLG_EXPORTHEADERVAR,
1171           FLG_NOPARAMS, FLG_OLDSTYLE, FLG_EXITARG, 
1172           FLG_RETSTACK,
1173           FLG_FCNDEREF,
1174           FLG_ONLYUNQGLOBALTRANS,
1175           FLG_GLOBALSIMPMODIFIESNOTHING,
1176           FLG_PREDBOOLOTHERS, FLG_PREDBOOLPTR, FLG_PREDBOOLINT,
1177           FLG_INTERNALGLOBS, FLG_INTERNALGLOBSNOGLOBS,
1178           FLG_USEALLGLOBS, FLG_RETALIAS, 
1179           FLG_MODGLOBS, FLG_MODGLOBSUNSPEC, FLG_MODGLOBSUNCHECKED,
1180           FLG_RETEXPOSE, FLG_ASSIGNEXPOSE, FLG_CASTEXPOSE,
1181           FLG_NOEFFECTUNCON, FLG_EVALORDERUNCON,
1182           FLG_FUNCUNUSED,
1183           FLG_EXPORTITER, FLG_EXPORTCONST,
1184           FLG_TYPEUNUSED, FLG_FIELDUNUSED, FLG_PARAMUNUSED, FLG_TOPUNUSED,
1185           FLG_CONSTUNUSED, FLG_ENUMMEMUNUSED,
1186           FLG_VARUNUSED, 
1187           FLG_NULLPOINTERARITH, FLG_POINTERARITH, 
1188           FLG_PTRNUMCOMPARE, 
1189           FLG_BOOLCOMPARE, FLG_NOEFFECT, 
1190           FLG_RETVALINT, FLG_RETVALBOOL, FLG_RETVALOTHER, 
1191           FLG_ANSIRESERVED, FLG_ANSIRESERVEDLOCAL, FLG_CPPNAMES,
1192           FLG_RETVALBOOL, FLG_RETVALINT, FLG_SPECUNDEF, 
1193           FLG_DECLUNDEF, FLG_STRICTOPS, FLG_INCONDEFS, 
1194           FLG_MISPLACEDSHAREQUAL, FLG_REDUNDANTSHAREQUAL,
1195           FLG_INCONDEFSLIB, FLG_MATCHFIELDS, FLG_EXPORTMACRO, FLG_EXPORTVAR, 
1196           FLG_EXPORTFCN, FLG_EXPORTTYPE, FLG_EXPORTLOCAL, FLG_MACROPARAMS, 
1197           FLG_MACROASSIGN,
1198           FLG_SEFPARAMS, FLG_SEFUNSPEC, FLG_MACROSTMT, FLG_MACROPARENS, 
1199           FLG_MACROFCNDECL,
1200           FLG_MACROCONSTDECL,
1201           FLG_MACROREDEF, FLG_MACROEMPTY,
1202           FLG_INFLOOPS, FLG_INFLOOPSUNCON,
1203           FLG_UNREACHABLE, 
1204           FLG_NORETURN, FLG_CASEBREAK, FLG_MISSCASE, FLG_USEDEF,
1205           FLG_EVALORDER,
1206           FLG_MODUNCON, FLG_MODUNCONNOMODS, FLG_MODINTERNALSTRICT,
1207           FLG_MODOBSERVERUNCON,
1208
1209           FLG_NESTEDEXTERN, 
1210           FLG_FIRSTCASE,
1211
1212           /* memchecks flags */
1213           FLG_NULLSTATE, FLG_NULLDEREF, FLG_NULLASSIGN,
1214           FLG_NULLPASS, FLG_NULLRET,
1215
1216           FLG_COMPDEF, FLG_COMPMEMPASS, FLG_UNIONDEF,
1217
1218           /* memtrans flags */
1219           FLG_EXPOSETRANS,
1220           FLG_OBSERVERTRANS,
1221           FLG_DEPENDENTTRANS,
1222           FLG_NEWREFTRANS,
1223           FLG_ONLYTRANS,
1224           FLG_OWNEDTRANS,
1225           FLG_FRESHTRANS,
1226           FLG_SHAREDTRANS,
1227           FLG_TEMPTRANS,
1228           FLG_KEPTTRANS,
1229           FLG_REFCOUNTTRANS,
1230           FLG_STATICTRANS,
1231           FLG_UNKNOWNTRANS,
1232           FLG_KEEPTRANS,
1233           FLG_IMMEDIATETRANS,
1234           FLG_STATICINITTRANS,
1235           FLG_UNKNOWNINITTRANS,
1236
1237           FLG_USERELEASED, FLG_ALIASUNIQUE, FLG_MAYALIASUNIQUE,
1238           FLG_MUSTFREE, FLG_MUSTDEFINE, FLG_GLOBSTATE, 
1239           FLG_COMPDESTROY, FLG_MUSTNOTALIAS,
1240           FLG_MEMIMPLICIT,
1241           FLG_BRANCHSTATE, 
1242
1243           FLG_DECLPARAMNAME, FLG_DECLPARAMMATCH,
1244
1245           FLG_SHADOW, FLG_DEPARRAYS, 
1246           FLG_STRICTDESTROY, FLG_STRICTUSERELEASED, FLG_STRICTBRANCHSTATE,
1247           FLG_REDECL, FLG_READONLYSTRINGS, FLG_READONLYTRANS,
1248           FLG_LOOPLOOPBREAK, FLG_LOOPSWITCHBREAK, FLG_SWITCHLOOPBREAK,
1249           FLG_SWITCHSWITCHBREAK, FLG_LOOPLOOPCONTINUE,
1250           FLG_CHECKSTRICTGLOBALS, FLG_IMPCHECKEDSPECGLOBALS,
1251           FLG_ALLGLOBALS, FLG_IMPCHECKEDSTRICTGLOBALS,
1252           FLG_IMPCHECKEDSTRICTSTATICS,
1253           FLG_IMPCHECKEDSTRICTSPECGLOBALS,
1254           FLG_IMPCHECKMODINTERNALS,
1255           FLG_WARNMISSINGGLOBALS, FLG_WARNMISSINGGLOBALSNOGLOBS,
1256           FLG_WARNLINTCOMMENTS, FLG_ANSIRESERVEDLOCAL,
1257           FLG_INCLUDENEST, FLG_STRINGLITERALLEN,
1258           FLG_NUMSTRUCTFIELDS, FLG_NUMENUMMEMBERS,
1259           FLG_CONTROLNESTDEPTH,
1260           FLG_FORBLOCK, FLG_WHILEBLOCK,
1261           FLG_FOREMPTY, FLG_WHILEEMPTY,
1262           FLG_IFEMPTY, FLG_IFBLOCK,
1263           FLG_ELSEIFCOMPLETE,
1264           FLG_REALCOMPARE, FLG_BOOLOPS,
1265           FLG_SYSTEMDIRERRORS, FLG_UNUSEDSPECIAL,
1266
1267           FLG_SHIFTSIGNED, FLG_BITWISEOPS,
1268           FLG_BUFFEROVERFLOWHIGH, FLG_BUFFEROVERFLOW,
1269           INVALID_FLAG
1270         } ;
1271
1272       SETFLAGS ();
1273     }
1274   else
1275     {
1276       llcontbug (message ("context_setMode: bad mode: %s", s));
1277      }
1278 }
1279
1280 bool
1281 context_isSpecialFile (cstring fname)
1282 {
1283   cstring ext = fileLib_getExtension (fname);
1284   
1285   return (cstring_equalLit (ext, ".y") 
1286           || cstring_equalLit (ext, ".l")
1287           || cstring_equalLit (fname, "lex.yy.c"));
1288 }
1289
1290 bool
1291 context_isSystemDir (cstring dir)
1292 {
1293   cstring sysDirs = context_exposeString (FLG_SYSTEMDIRS);
1294   char *thisdir = cstring_toCharsSafe (sysDirs);
1295   char *nextdir = strchr (thisdir, SEPCHAR);
1296
1297   if (nextdir != NULL)
1298     {
1299       *nextdir = '\0';
1300       nextdir += 1;
1301     }
1302
1303   while (thisdir != NULL)
1304     {
1305       DPRINTF (("Test: %s / %s", dir, thisdir));
1306
1307       if (cstring_equalCanonicalPrefix (dir, thisdir))
1308         {
1309           if (nextdir != NULL)
1310             {
1311               *(nextdir - 1) = SEPCHAR;
1312             }
1313           
1314           return TRUE;
1315         }
1316
1317       if (nextdir != NULL)
1318         {
1319           *(nextdir - 1) = SEPCHAR;
1320         }
1321
1322       if (nextdir != NULL)
1323         {
1324           thisdir = nextdir;
1325           nextdir = strchr (thisdir, SEPCHAR);
1326           
1327           if (nextdir != NULL)
1328             {
1329               *nextdir = '\0';
1330               nextdir += 1;
1331             } 
1332         }
1333       else
1334         {
1335           break;
1336         }
1337     } 
1338
1339   DPRINTF (("Returns FALSE"));
1340   return FALSE;
1341 }
1342
1343 void
1344 context_addFileAccessType (typeId t)
1345 {
1346   cstring base;
1347
1348   if (context_inFunctionLike ())
1349     {
1350       gc.acct = typeIdSet_insert (gc.acct, t);
1351     }
1352   
1353   gc.facct = typeIdSet_insert (gc.facct, t);
1354   
1355   base = fileloc_getBase (g_currentloc);
1356   insertModuleAccess (base, t);
1357   DPRINTF (("Add file access: %s / %s", typeIdSet_unparse (gc.facct),
1358             typeIdSet_unparse (gc.acct)));
1359 }
1360
1361 void
1362 context_removeFileAccessType (typeId t)
1363 {
1364   if (gc.kind == CX_FUNCTION || gc.kind == CX_MACROFCN 
1365       || gc.kind == CX_UNKNOWNMACRO)
1366     {
1367       gc.acct = typeIdSet_removeFresh (gc.acct, t);
1368     }
1369   
1370   gc.facct = typeIdSet_removeFresh (gc.facct, t);
1371   gc.nacct = typeIdSet_insert (gc.nacct, t);
1372 }
1373
1374 void context_enterFunctionHeader (void)
1375 {
1376   llassert (gc.kind == CX_GLOBAL);
1377   DPRINTF (("Enter function decl"));
1378   gc.kind = CX_FCNHEADER;
1379 }
1380
1381 void context_exitFunctionHeader (void)
1382 {
1383   DPRINTF (("Exit function decl"));
1384   gc.kind = CX_GLOBAL;
1385 }
1386
1387 bool context_inFunctionHeader (void)
1388 {
1389   return (gc.kind == CX_FCNHEADER);
1390 }
1391
1392 void context_enterFunctionDeclaration (uentry e)
1393 {
1394   DPRINTF (("Enter function decl"));
1395   llassert (gc.savekind == CX_ERROR);
1396   gc.savekind = gc.kind;
1397   gc.kind = CX_FCNDECLARATION;
1398   gc.cont.fcn = e;
1399 }
1400
1401 void context_exitFunctionDeclaration (void)
1402 {
1403   DPRINTF (("Exit function decl"));
1404   llassert (gc.savekind != CX_ERROR);
1405   llassert (gc.kind == CX_FCNDECLARATION);
1406   gc.kind = gc.savekind;
1407   gc.cont.fcn = uentry_undefined;
1408   gc.savekind = CX_ERROR;
1409 }
1410
1411 bool context_inFunctionDeclaration (void)
1412 {
1413   return (gc.kind == CX_FCNDECLARATION);
1414 }
1415
1416
1417 void
1418 context_enterMacro (/*@observer@*/ uentry e)
1419 {
1420   context_enterFunction (e);
1421   gc.kind = CX_MACROFCN;
1422 }
1423
1424 void
1425 context_enterUnknownMacro (/*@dependent@*/ uentry e)
1426 {
1427   llassert (uentry_isFunction (e));
1428   context_enterFunction (e);
1429   gc.kind = CX_UNKNOWNMACRO;
1430 }
1431
1432 void context_enterAndClause (exprNode e)
1433 {
1434   
1435   usymtab_trueBranch (guardSet_copy (exprNode_getGuards (e)));
1436   pushClause (ANDCLAUSE);
1437 }
1438
1439 void context_enterOrClause (exprNode e)
1440 {
1441   usymtab_trueBranch (guardSet_invert (exprNode_getGuards (e)));
1442   pushClause (ORCLAUSE);
1443 }
1444
1445 bool context_inDeepLoop (void)
1446 {
1447   bool inLoop = FALSE;
1448
1449   clauseStack_elements (gc.clauses, el)
1450     {
1451       if (clause_isLoop (el))
1452         {
1453           if (inLoop)
1454             {
1455               return TRUE;
1456             }
1457
1458           inLoop = TRUE;
1459         }
1460     } end_clauseStack_elements;
1461
1462   return FALSE;
1463 }
1464
1465 bool context_inDeepSwitch (void)
1466 {
1467   bool inLoop = FALSE;
1468
1469   clauseStack_elements (gc.clauses, el)
1470     {
1471       if (clause_isSwitch (el))
1472         {
1473           if (inLoop)
1474             {
1475               return TRUE;
1476             }
1477
1478           inLoop = TRUE;
1479         }
1480     } end_clauseStack_elements;
1481
1482   return FALSE;
1483 }
1484
1485 bool context_inDeepLoopSwitch (void)
1486 {
1487   bool inLoop = FALSE;
1488
1489   clauseStack_elements (gc.clauses, el)
1490     {
1491       if (clause_isBreakable (el))
1492         {
1493           if (inLoop)
1494             {
1495               return TRUE;
1496             }
1497
1498           inLoop = TRUE;
1499         }
1500     } end_clauseStack_elements;
1501
1502   return FALSE;
1503 }
1504
1505 clause context_breakClause (void)
1506 {
1507   clauseStack_elements (gc.clauses, el)
1508     {
1509       if (clause_isSwitch (el))
1510         {
1511           return el;
1512         }
1513       else if (clause_isLoop (el))
1514         {
1515           return el;
1516         }
1517       else
1518         {
1519           ;
1520         }
1521     } end_clauseStack_elements;
1522
1523   return NOCLAUSE;
1524 }
1525
1526 clause context_nextBreakClause (void)
1527 {
1528   bool hasOne = FALSE;
1529
1530   clauseStack_elements (gc.clauses, el)
1531     {
1532       if (clause_isBreakable (el))
1533         {
1534           if (hasOne)
1535             {
1536               return el;
1537             }
1538           else
1539             {
1540               hasOne = TRUE;
1541             }
1542         }
1543     } end_clauseStack_elements;
1544
1545   return NOCLAUSE;
1546 }
1547   
1548 bool context_inConditional (void)
1549 {
1550   clauseStack_elements (gc.clauses, el)
1551     {
1552       /*
1553       ** Should also include TRUECLAUSE and FALSECLAUSE, but need
1554       ** to distinguish if from ? for this
1555       */
1556
1557       if (clause_isBreakable (el) && (el != DOWHILECLAUSE))
1558         {
1559           return TRUE;
1560         }
1561     } end_clauseStack_elements;
1562
1563   return FALSE;
1564 }
1565
1566 void context_exitAndClause (exprNode pred, exprNode tbranch)
1567 {
1568   context_setJustPopped ();
1569   
1570   llassert (gc.inclause == ANDCLAUSE);
1571   
1572   usymtab_popAndBranch (pred, tbranch);
1573   clauseStack_pop (gc.clauses);
1574   gc.inclause = topClause (gc.clauses);
1575 }
1576
1577 void context_exitOrClause (exprNode pred, exprNode tbranch)
1578 {
1579   context_setJustPopped ();
1580   
1581   llassert (gc.inclause == ORCLAUSE);
1582   
1583   usymtab_popOrBranch (pred, tbranch);
1584   clauseStack_pop (gc.clauses);
1585   gc.inclause = topClause (gc.clauses);
1586 }
1587
1588 static void context_enterCondClauseAux (clause cl)
1589      /*@modifies gc@*/
1590 {
1591   pushClause (cl);
1592 }
1593
1594 static void context_enterTrueAux (exprNode e, clause cl)
1595    /*@modifies gc@*/
1596 {
1597   usymtab_trueBranch (guardSet_copy (exprNode_getGuards (e)));
1598   pushClause (cl);
1599 }
1600
1601 void context_enterIterClause (void)
1602 {
1603   context_enterTrueAux (exprNode_undefined, ITERCLAUSE);
1604 }
1605
1606 void context_enterDoWhileClause (void)
1607 {
1608   pushClause (DOWHILECLAUSE);
1609 }
1610
1611 void context_enterWhileClause (exprNode e)
1612 {
1613   context_enterTrueAux (e, WHILECLAUSE);
1614 }
1615
1616 void context_enterForClause (exprNode e)
1617 {
1618   context_enterTrueAux (e, FORCLAUSE);
1619 }
1620
1621 void context_enterTrueClause (exprNode e)
1622 {
1623   context_enterTrueAux (e, TRUECLAUSE);
1624 }
1625
1626 void context_enterSwitch (exprNode e)
1627 {
1628   
1629   usymtab_switchBranch (e);
1630   context_enterCondClauseAux (SWITCHCLAUSE);
1631 }
1632
1633 void context_exitSwitch (exprNode e, bool allpaths)
1634 {
1635     usymtab_exitSwitch (e, allpaths);
1636   
1637   while (clause_isCase (clauseStack_top (gc.clauses)))
1638     {
1639       clauseStack_pop (gc.clauses);
1640     }
1641   
1642   context_exitClauseSimp ();
1643 }
1644
1645 void context_enterCaseClause (exprNode e)
1646 {
1647   bool branch = FALSE;
1648  
1649   DPRINTF (("Enter case clause!"));
1650
1651   branch = usymtab_newCase (exprNode_undefined, e);
1652   
1653   if (branch)
1654     {
1655       context_enterCondClauseAux (CASECLAUSE);
1656     }
1657 }
1658
1659 static void context_enterFalseClauseAux (exprNode e, clause cl)
1660      /*@modifies gc@*/
1661 {
1662   usymtab_altBranch (guardSet_invert (exprNode_getGuards (e)));
1663   gc.inclause = cl;
1664   clauseStack_switchTop (gc.clauses, cl);
1665 }
1666
1667 void context_enterFalseClause (exprNode e)
1668 {
1669   
1670   context_enterFalseClauseAux (e, FALSECLAUSE);
1671 }
1672
1673 void
1674 context_enterConstantMacro (/*@exposed@*/ /*@dependent@*/ uentry e)
1675 {
1676   gc.kind = CX_MACROCONST;
1677   gc.cont.fcn = e;
1678   gc.showfunction = context_getFlag (FLG_SHOWFUNC);
1679
1680   gc.acct = typeIdSet_subtract (typeIdSet_union (gc.facct, uentry_accessType (e)), 
1681                                 gc.nacct);
1682
1683   
1684   usymtab_enterScope ();
1685   sRef_enterFunctionScope ();
1686
1687   gc.globs = globSet_undefined;
1688   globSet_clear (gc.globs_used);
1689   gc.mods = sRefSet_undefined;
1690 }
1691
1692 uentry context_getHeader (void)
1693 {
1694   if (!(context_inFunctionLike () || (gc.kind == CX_MACROCONST)))
1695     {
1696       llfatalbug (message ("context_getHeader: bad call: %q",
1697                            context_unparse ()));
1698     }
1699
1700   return (gc.cont.fcn);
1701 }
1702
1703 void
1704 context_setFunctionDefined (fileloc loc)
1705 {
1706   switch (gc.kind)
1707     {
1708     case CX_UNKNOWNMACRO:
1709     case CX_FUNCTION:
1710     case CX_MACROFCN:
1711       uentry_setFunctionDefined (gc.cont.fcn, loc);
1712       break;
1713     default:
1714       /* (not a bug because of parse errors) */
1715       break;
1716     }
1717 }
1718
1719 void
1720 context_enterFunction (/*@exposed@*/ uentry e)
1721 {
1722   gc.kind = CX_FUNCTION;
1723   gc.cont.fcn = e;
1724
1725   DPRINTF (("Enter function: %s", uentry_unparse (e)));
1726
1727   if (uentry_hasAccessType (e))
1728     {
1729       gc.acct = typeIdSet_subtract (typeIdSet_union (gc.facct, uentry_accessType (e)), 
1730                                     gc.nacct);
1731     }
1732   else
1733     {
1734       gc.acct = gc.facct;
1735     }
1736
1737   DPRINTF (("Enter function: %s / %s", uentry_unparse (e), 
1738             typeIdSet_unparse (gc.acct)));
1739
1740   gc.showfunction = context_getFlag (FLG_SHOWFUNC);
1741   
1742   gc.globs = uentry_getGlobs (e);
1743   globSet_clear (gc.globs_used);
1744   gc.mods = uentry_getMods (e);
1745
1746   usymtab_enterFunctionScope (e);
1747   sRef_enterFunctionScope ();
1748 }
1749
1750 static bool context_checkStrictGlobals (void)
1751 {
1752   return (context_getFlag (FLG_CHECKSTRICTGLOBALS));
1753 }
1754
1755 static bool context_hasGlobs (void)
1756 {
1757   if (context_inFunctionLike ())
1758     {
1759       return (uentry_hasGlobs (gc.cont.fcn));
1760     }
1761   else
1762     {
1763       return (FALSE);
1764     }
1765 }
1766
1767 static bool context_checkCheckedGlobals (void)
1768 {
1769   return (context_getFlag (FLG_GLOBALS)
1770           && (context_getFlag (FLG_GLOBUNSPEC)
1771               || context_hasGlobs ()));
1772 }
1773
1774 static bool context_checkUnknownGlobals (void)
1775 {
1776   /* should be uentry_hasGlobs ? */
1777
1778   return (context_getFlag (FLG_ALLGLOBALS)
1779           && (context_getFlag (FLG_GLOBUNSPEC)
1780               || context_hasGlobs ()));
1781 }      
1782
1783 static bool context_checkUncheckedGlobals (void)
1784 {
1785   return (FALSE);
1786 }      
1787
1788 bool 
1789 context_checkExport (uentry e)
1790 {
1791   if (!gc.anyExports) return FALSE;
1792
1793   if (uentry_isFunction (e)
1794       || (uentry_isVariable (e) && ctype_isFunction (uentry_getType (e))))
1795     {
1796       return context_maybeSet (FLG_EXPORTFCN);
1797     }
1798   else if (uentry_isExpandedMacro (e))
1799     {
1800       return context_maybeSet (FLG_EXPORTMACRO);
1801     }
1802   else if (uentry_isVariable (e))
1803     {
1804       return context_maybeSet (FLG_EXPORTVAR);
1805     }
1806   else if (uentry_isEitherConstant (e))
1807     {
1808       return context_maybeSet (FLG_EXPORTCONST);
1809     }
1810   else if (uentry_isIter (e) || uentry_isEndIter (e))
1811     {
1812       return context_maybeSet (FLG_EXPORTITER);
1813     }
1814   else if (uentry_isDatatype (e))
1815     {
1816       return context_maybeSet (FLG_EXPORTTYPE);
1817     }
1818   else
1819     {
1820       BADEXIT;
1821     }
1822 }
1823               
1824 bool
1825 context_checkGlobUse (uentry glob)
1826 {
1827   
1828   if (uentry_isCheckedStrict (glob))
1829     {
1830       return context_checkStrictGlobals ();
1831     }
1832   else if (uentry_isChecked (glob))
1833     {
1834       return context_checkCheckedGlobals ();
1835     }
1836   else if (uentry_isCheckedUnknown (glob) || uentry_isCheckMod (glob))
1837     {
1838       return context_checkUnknownGlobals ();
1839     }
1840   else 
1841     {
1842       llassert (uentry_isUnchecked (glob));
1843
1844       return context_checkUncheckedGlobals ();
1845     }
1846 }
1847
1848 bool
1849 context_checkAliasGlob (uentry glob)
1850 {
1851   if (uentry_isCheckedStrict (glob))
1852     {
1853       return gc.flags[FLG_CHECKSTRICTGLOBALIAS];
1854     }
1855   else if (uentry_isChecked (glob))
1856     {
1857       return gc.flags[FLG_CHECKEDGLOBALIAS];
1858     }
1859   else if (uentry_isCheckMod (glob))
1860     {
1861       return gc.flags[FLG_CHECKMODGLOBALIAS];
1862     }
1863   else 
1864     {
1865       llassert (uentry_isUnchecked (glob) || uentry_isCheckedUnknown (glob));
1866
1867       return gc.flags[FLG_UNCHECKEDGLOBALIAS];
1868     }
1869 }
1870
1871 bool context_checkInternalUse (void)
1872 {
1873   if (context_hasGlobs ())
1874     {
1875       return (gc.flags[FLG_INTERNALGLOBS]);
1876     }
1877   else
1878     {
1879       return (gc.flags[FLG_INTERNALGLOBSNOGLOBS]);
1880     }
1881 }
1882
1883 bool
1884 context_checkGlobMod (sRef el)
1885 {
1886   uentry ue = sRef_getUentry (el);
1887
1888   /* no: llassert (sRef_isFileOrGlobalScope (el)); also check local statics */
1889
1890   if (uentry_isCheckedModify (ue)
1891       || (!uentry_isUnchecked (ue) && (gc.flags[FLG_ALLGLOBALS])))
1892     {
1893       if (context_hasMods ())
1894         {
1895           return (gc.flags[FLG_MODGLOBS]);
1896         }
1897       else
1898         {
1899           if (uentry_isCheckedStrict (ue))
1900             {
1901               return (gc.flags[FLG_MODGLOBSUNSPEC]);
1902             }
1903           else
1904             {
1905               return (gc.flags[FLG_MODSTRICTGLOBSUNSPEC]);
1906             }
1907         }
1908     }
1909   else
1910     {
1911       if (context_hasMods ())
1912         {
1913           return (gc.flags[FLG_MODGLOBSUNCHECKED]);
1914         }
1915       else
1916         {
1917           return FALSE;
1918         }
1919     }
1920 }
1921
1922 void
1923 context_usedGlobal (/*@exposed@*/ sRef el)
1924 {
1925   if (!globSet_member (gc.globs_used, el))
1926     {
1927       /* 
1928       ** The first time a global is used in a function, we need
1929       ** to clear the derived sRefs, since they were set for the
1930       ** previous function.
1931       */
1932
1933       sRef_clearDerived (el);
1934       gc.globs_used = globSet_insert (gc.globs_used, el);
1935     }
1936 }
1937
1938 /*@observer@*/ sRefSet
1939 context_modList (void)
1940 {
1941   return gc.mods;
1942 }
1943
1944 bool
1945 context_globAccess (sRef s)
1946 {
1947   llassert (sRef_isFileOrGlobalScope (s) || sRef_isKindSpecial (s));
1948   return (globSet_member (gc.globs, s));
1949 }
1950
1951 bool
1952 context_hasAccess (typeId t)
1953 {
1954   if (context_inFunctionLike ())
1955     {
1956       DPRINTF (("Access %d / %s",
1957                 t, typeIdSet_unparse (gc.acct)));
1958       return (typeIdSet_member (gc.acct, t));
1959     }
1960   else
1961     {
1962       return (context_hasFileAccess (t));
1963     }
1964 }
1965
1966 bool
1967 context_hasFileAccess (typeId t)
1968 {
1969   return (typeIdSet_member (gc.facct, t));
1970 }
1971
1972 /*@only@*/ cstring
1973 context_unparseAccess (void)
1974 {
1975   return (message ("%q / %q", typeIdSet_unparse (gc.acct),
1976                    typeIdSet_unparse (gc.facct)));
1977 }
1978
1979 /*@only@*/ cstring
1980 context_unparseClauses (void)
1981 {
1982   return (clauseStack_unparse (gc.clauses));
1983 }
1984
1985 bool
1986 context_couldHaveAccess (typeId t)
1987 {
1988   if (gc.kind == CX_FUNCTION || gc.kind == CX_MACROFCN || gc.kind == CX_UNKNOWNMACRO)
1989     {
1990       return (typeIdSet_member (gc.acct, t));
1991     }
1992   else
1993     {
1994       return (typeIdSet_member (gc.facct, t)); 
1995     }
1996 }
1997
1998 ctype
1999 context_getRetType (void)
2000 {
2001   ctype f = ctype_undefined;
2002
2003   if (gc.kind == CX_FUNCTION || gc.kind == CX_MACROFCN)
2004     {
2005       f = uentry_getType (gc.cont.fcn);
2006     }
2007   else if (gc.kind == CX_UNKNOWNMACRO)
2008     {
2009       return ctype_unknown;
2010     }
2011   else
2012     {
2013       llcontbuglit ("context_getRetType: not in a function context");
2014       return ctype_unknown;
2015     }
2016
2017   if (!ctype_isFunction (f))
2018     {
2019       if (ctype_isKnown (f))
2020         {
2021           llbuglit ("context_getRetType: not a function");
2022         }
2023
2024       return ctype_unknown;
2025     }
2026   return (ctype_getReturnType (f));
2027 }    
2028
2029 bool
2030 context_hasMods (void)
2031 {
2032   if (context_inFunctionLike ())
2033     {
2034       return (uentry_hasMods (gc.cont.fcn));
2035     }
2036   else
2037     {
2038       return FALSE;
2039     }
2040 }
2041
2042 void
2043 context_exitAllClauses (void)
2044 {  
2045   while (!clauseStack_isEmpty (gc.clauses))
2046     {
2047       clause el = clauseStack_top (gc.clauses);
2048       gc.inclause = el;
2049
2050       if (clause_isNone (el))
2051         {
2052           usymtab_quietExitScope (g_currentloc);
2053           clauseStack_pop (gc.clauses);
2054         }
2055       else
2056         {
2057           context_exitClausePlain ();
2058         }
2059     }
2060
2061   clauseStack_clear (gc.clauses);  
2062   gc.inclause = NOCLAUSE;
2063 }
2064
2065 void
2066 context_exitAllClausesQuiet (void)
2067 {  
2068   while (!clauseStack_isEmpty (gc.clauses))
2069     {
2070       clause el = clauseStack_top (gc.clauses);
2071       gc.inclause = el;
2072
2073       usymtab_quietExitScope (g_currentloc);
2074       clauseStack_pop (gc.clauses);
2075     }
2076
2077   clauseStack_clear (gc.clauses);  
2078   gc.inclause = NOCLAUSE;
2079 }
2080
2081 static
2082 void context_exitClauseSimp (void)
2083 {
2084   
2085   context_setJustPopped ();
2086   clauseStack_pop (gc.clauses);
2087   gc.inclause = topClause (gc.clauses);
2088 }
2089
2090 static
2091 void context_exitCaseClause (void)
2092 {
2093   context_setJustPopped ();
2094   usymtab_popCaseBranch ();
2095   clauseStack_pop (gc.clauses);
2096   gc.inclause = topClause (gc.clauses);
2097 }
2098
2099 static
2100 void context_exitClauseAux (exprNode pred, exprNode tbranch)
2101 {
2102   context_setJustPopped ();
2103   /*@i32 was makeAlt */
2104   usymtab_popTrueBranch (pred, tbranch, gc.inclause);
2105   clauseStack_pop (gc.clauses);
2106   gc.inclause = topClause (gc.clauses);
2107 }
2108
2109 void context_exitTrueClause (exprNode pred, exprNode tbranch)
2110 {
2111   DPRINTF (("Exit true clause: %s", exprNode_unparse (tbranch)));
2112
2113   if (gc.inclause != TRUECLAUSE)
2114     {
2115       llparseerror (cstring_makeLiteral
2116                     ("Likely parse error.  Conditional clauses are inconsistent."));
2117       return;
2118     }
2119   
2120   context_setJustPopped ();  
2121   usymtab_popTrueBranch (pred, tbranch, TRUECLAUSE);
2122   clauseStack_pop (gc.clauses);
2123   gc.inclause = topClause (gc.clauses);  
2124 }
2125
2126 void context_exitIterClause (exprNode body)
2127 {
2128   llassert (gc.inclause == ITERCLAUSE);
2129
2130   context_setJustPopped ();
2131
2132   if (context_getFlag (FLG_LOOPEXEC))
2133     {
2134       usymtab_popTrueExecBranch (exprNode_undefined, body, ITERCLAUSE);
2135     }
2136   else
2137     {
2138       usymtab_popTrueBranch (exprNode_undefined, body, ITERCLAUSE);
2139     }
2140
2141   clauseStack_pop (gc.clauses);
2142   gc.inclause = topClause (gc.clauses);
2143 }
2144
2145 static void context_popCase (void) {
2146   /*
2147   ** If we are exiting an outer clause, sometimes still in a switch case.
2148   **
2149   ** e.g.: 
2150   **
2151   ** switch(a)
2152   ** {
2153   **   case 1:
2154   **     while (c>3)
2155   **       {
2156   **         case 3: ++c;
2157   **       }
2158   ** }     
2159   */
2160
2161   DPRINTF (("Popping case clause: %s",
2162             clauseStack_unparse (gc.clauses)));
2163   
2164   if (gc.inclause == CASECLAUSE) {
2165     context_exitCaseClause ();
2166   }
2167 }
2168
2169 void context_exitWhileClause (exprNode pred, exprNode body)
2170 {
2171   guardSet invGuards = guardSet_invert (exprNode_getGuards (pred));
2172
2173   context_popCase (); 
2174
2175   if (gc.inclause != WHILECLAUSE) {
2176     DPRINTF (("Clause: %s / %s", clause_unparse (gc.inclause),
2177               clauseStack_unparse (gc.clauses)));
2178   }
2179
2180   llassert (gc.inclause == WHILECLAUSE);
2181
2182   context_setJustPopped ();
2183
2184   
2185   /*
2186   ** predicate must be false after while loop (unless there are breaks)
2187   */
2188
2189   if (context_getFlag (FLG_LOOPEXEC))
2190     {
2191       usymtab_popTrueExecBranch (pred, body, WHILECLAUSE);
2192     }
2193   else
2194     {
2195       usymtab_popTrueBranch (pred, body, WHILECLAUSE);
2196     }
2197
2198   
2199   usymtab_addGuards (invGuards);
2200   guardSet_free (invGuards);
2201
2202   clauseStack_pop (gc.clauses);
2203   gc.inclause = topClause (gc.clauses);  
2204 }
2205
2206 void context_exitDoWhileClause (exprNode pred)
2207 {
2208   guardSet invGuards = guardSet_invert (exprNode_getGuards (pred));
2209
2210   if (gc.inclause == CASECLAUSE) {
2211     /* handle Duff's device */
2212     clauseStack_pop (gc.clauses);
2213     gc.inclause = topClause (gc.clauses);
2214   }
2215
2216   llassert (gc.inclause == DOWHILECLAUSE);
2217
2218   context_setJustPopped ();
2219
2220     
2221   usymtab_addGuards (invGuards);
2222   guardSet_free (invGuards);
2223
2224   clauseStack_pop (gc.clauses);
2225   gc.inclause = topClause (gc.clauses);  
2226 }
2227
2228 void context_exitForClause (exprNode forPred, exprNode body)
2229 {
2230   guardSet invGuards = guardSet_invert (exprNode_getForGuards (forPred));
2231
2232   llassert (gc.inclause == FORCLAUSE);
2233   context_setJustPopped ();
2234
2235   /*
2236   ** predicate must be false after while loop (unless there are breaks)
2237   */
2238
2239   if (context_getFlag (FLG_LOOPEXEC))
2240     {
2241       usymtab_popTrueExecBranch (forPred, body, FORCLAUSE);
2242     }
2243   else
2244     {
2245       usymtab_popTrueBranch (forPred, body, FORCLAUSE);
2246     }
2247
2248   usymtab_addGuards (invGuards);
2249   guardSet_free (invGuards);
2250   clauseStack_pop (gc.clauses);
2251   gc.inclause = topClause (gc.clauses);
2252 }
2253
2254 static void context_exitClausePlain (void)
2255 {
2256   llassert (gc.inclause != NOCLAUSE);
2257   
2258   if (gc.inclause == FALSECLAUSE)
2259     {
2260       context_exitClause (exprNode_undefined, exprNode_undefined, exprNode_undefined);
2261     }
2262   else
2263     {
2264       context_exitClauseAux (exprNode_undefined, exprNode_undefined);
2265     }
2266 }
2267
2268 void context_exitClause (exprNode pred, exprNode tbranch, exprNode fbranch)
2269 {
2270   context_setJustPopped ();
2271   
2272   if (gc.inclause == FALSECLAUSE)
2273     {
2274       usymtab_popBranches (pred, tbranch, fbranch, FALSE, FALSECLAUSE);
2275       
2276       llassert (clauseStack_top (gc.clauses) == FALSECLAUSE);
2277
2278       clauseStack_pop (gc.clauses);
2279       gc.inclause = topClause (gc.clauses);
2280     }
2281   else
2282     {
2283       context_exitTrueClause (pred, tbranch);
2284     }
2285 }
2286
2287 void
2288 context_returnFunction (void)
2289 {
2290   usymtab_checkFinalScope (TRUE);
2291 }
2292
2293 void
2294 context_exitFunction (void)
2295 {    
2296   if (!context_inFunction () && !context_inMacroConstant () 
2297       && !context_inMacroUnknown () 
2298       && !context_inIterDef () && !context_inIterEnd ())
2299     {
2300       /*
2301       ** not a bug because of parse errors
2302       */
2303     }
2304   else
2305     {
2306       if (context_inMacro () && usymtab_inFunctionScope ())
2307         {
2308           usymtab_exitScope (exprNode_undefined);
2309         }
2310       
2311       if (uentry_hasGlobs (gc.cont.fcn))
2312         {
2313           exprChecks_checkUsedGlobs (gc.globs, gc.globs_used);
2314         }
2315       
2316             
2317       if (uentry_hasMods (gc.cont.fcn))
2318         {
2319           if (context_getFlag (FLG_MUSTMOD))
2320             {
2321               exprNode_checkAllMods (gc.mods, gc.cont.fcn);
2322             }
2323         }
2324
2325       DPRINTF (("Exit function: %s", uentry_unparse (gc.cont.fcn)));
2326
2327       /*
2328       ** clear file static modifies
2329       */
2330       
2331       /* do this first to get unused error messages */
2332
2333       usymtab_exitScope (exprNode_undefined);
2334       sRef_exitFunctionScope ();
2335       
2336       gc.showfunction = FALSE;
2337       gc.kind = CX_GLOBAL;
2338       gc.cont.glob = TRUE;
2339       gc.acct = gc.facct; 
2340       gc.globs = globSet_new ();
2341       globSet_clear (gc.globs_used);
2342       gc.mods = sRefSet_new ();
2343     }
2344
2345   llassert (clauseStack_isEmpty (gc.clauses));
2346   llassert (gc.inclause == NOCLAUSE);
2347 }
2348
2349 void
2350 context_quietExitFunction (void)
2351 {
2352   while (gc.kind == CX_INNER)
2353     { 
2354       context_exitInnerPlain ();
2355     }
2356
2357   if (!context_inFunction () && !context_inMacroConstant () && !context_inMacroUnknown () 
2358       && !context_inIterDef () && !context_inIterEnd ())
2359     {
2360     }
2361   else
2362     {
2363       usymtab_quietExitScope (g_currentloc);
2364
2365       gc.showfunction = FALSE;
2366       gc.kind = CX_GLOBAL;
2367       gc.cont.glob = TRUE;
2368       gc.acct = gc.facct; 
2369       gc.globs = globSet_new ();
2370       globSet_clear (gc.globs_used);
2371       gc.mods = sRefSet_new ();
2372
2373       sRef_exitFunctionScope ();
2374     }
2375 }
2376
2377 /*@observer@*/ uentryList
2378 context_getParams (void)
2379 {
2380   if (context_inFunctionLike ())
2381     {
2382       return (uentry_getParams (gc.cont.fcn));
2383     }
2384   else
2385     {
2386       llcontbug (message ("context_getParams: not in function: %q", context_unparse ()));
2387       return uentryList_undefined;
2388     }
2389 }
2390
2391 /*@observer@*/ globSet
2392 context_getUsedGlobs (void)
2393 {
2394   llassert (gc.kind == CX_FUNCTION || gc.kind == CX_MACROFCN 
2395             || gc.kind == CX_UNKNOWNMACRO || gc.kind == CX_ITERDEF);
2396
2397   return (gc.globs_used);
2398 }
2399
2400 cstring
2401 context_moduleName ()
2402 {
2403   return (fileloc_getBase (g_currentloc));
2404 }
2405
2406 /*@observer@*/ globSet
2407 context_getGlobs (void)
2408 {
2409   llassert (gc.kind == CX_FUNCTION || gc.kind == CX_MACROFCN 
2410             || gc.kind == CX_UNKNOWNMACRO || gc.kind == CX_ITERDEF);
2411
2412   return (gc.globs);
2413 }
2414
2415 void
2416 context_addBoolAccess (void)
2417 {
2418   cstring bname = context_getString (FLG_BOOLTYPE);
2419   typeIdSet boolt = typeIdSet_single (usymtab_getTypeId (bname));
2420   
2421   addModuleAccess (cstring_copy (bname), boolt);
2422
2423   /* for sys/types (perhaps, this is bogus!) */ 
2424   addModuleAccess (cstring_makeLiteral ("types"), boolt); 
2425 }
2426
2427 # if 0
2428 bool
2429 context_canAccessBool (void)
2430 {
2431   return TRUE;
2432 }
2433 # endif
2434
2435 /*
2436   static typeId boolType = typeId_invalid;
2437
2438   if (typeId_isInvalid (boolType))
2439     { 
2440       boolType = usymtab_getTypeId (context_getBoolName ());
2441     }
2442
2443   if (typeId_isInvalid (boolType)) {
2444     return FALSE;
2445   } else {
2446     return (typeIdSet_member (gc.acct, boolType));
2447   }
2448 }
2449 */
2450
2451 /* evs 2000-07-25: old version - replaced */
2452
2453 ctype
2454 context_boolImplementationType () {
2455   /* For now, this is bogus! */
2456   return ctype_int;
2457 }
2458
2459 bool
2460 context_canAccessBool (void)
2461 {
2462   static typeId boolType = typeId_invalid;
2463
2464   if (typeId_isInvalid (boolType))
2465     { 
2466       boolType = usymtab_getTypeId (context_getBoolName ());
2467     }
2468
2469   if (!typeId_isInvalid (boolType))
2470     { 
2471       return context_hasAccess (boolType);
2472     }
2473   else 
2474     {
2475       ;
2476     }
2477
2478   return FALSE; 
2479 }
2480
2481 void
2482 context_setMessageAnnote (/*@only@*/ cstring s)
2483 {
2484   llassert (cstring_isUndefined (gc.msgAnnote));
2485     gc.msgAnnote = s;
2486 }
2487
2488 bool
2489 context_hasMessageAnnote (void)
2490 {
2491   return (cstring_isDefined (gc.msgAnnote));
2492 }
2493
2494 void
2495 context_clearMessageAnnote (void)
2496 {
2497   if (cstring_isDefined (gc.msgAnnote))
2498     {
2499       cstring_free (gc.msgAnnote);
2500       gc.msgAnnote = cstring_undefined;
2501     }
2502 }
2503
2504 /*@only@*/ cstring
2505 context_getMessageAnnote (void)
2506 {
2507   cstring st = gc.msgAnnote;
2508
2509     gc.msgAnnote = cstring_undefined;
2510   return st;
2511 }
2512
2513 void
2514 context_setAliasAnnote (/*@observer@*/ sRef s, /*@observer@*/ sRef t)
2515 {
2516     llassert (sRef_isInvalid (gc.aliasAnnote));
2517   llassert (!sRef_sameName (s, t));
2518   gc.aliasAnnote = s;
2519   gc.aliasAnnoteAls = t;
2520 }
2521
2522 bool
2523 context_hasAliasAnnote (void)
2524 {
2525   return (sRef_isValid (gc.aliasAnnote));
2526 }
2527
2528 void
2529 context_clearAliasAnnote (void)
2530 {
2531   gc.aliasAnnote = sRef_undefined;
2532 }
2533
2534 cstring
2535 context_getAliasAnnote (void)
2536 {
2537   sRef ret = gc.aliasAnnote;
2538   sRef als = gc.aliasAnnoteAls;
2539
2540   llassert (sRef_isValid (ret) && sRef_isValid (als));
2541
2542   gc.aliasAnnote = sRef_undefined;
2543   return (message ("%q aliases %q", sRef_unparse (als), sRef_unparse (ret)));
2544 }
2545
2546 void
2547 context_recordFileModifies (sRefSet mods)
2548 {
2549   gc.modrecs = sRefSetList_add (gc.modrecs, mods);
2550 }
2551
2552 void
2553 context_recordFileGlobals (globSet mods)
2554 {
2555   DPRINTF (("Recording file globals: %s", globSet_unparse (mods)));
2556   /*@access globSet@*/ context_recordFileModifies (mods); /*@noaccess globSet@*/
2557 }
2558
2559 void
2560 context_setCommentMarkerChar (char c)
2561 {
2562   llassert (c != '\0');
2563
2564   context_setValue (FLG_COMMENTCHAR, (int) c);
2565 }
2566
2567 char
2568 context_getCommentMarkerChar (void)
2569 {
2570   return ((char) context_getValue (FLG_COMMENTCHAR));
2571 }
2572
2573 static void
2574 context_setValue (flagcode flag, int val)
2575 {
2576   int index = flagcode_valueIndex (flag);
2577
2578   llassert (index >= 0 && index <= NUMVALUEFLAGS);
2579
2580   switch (flag)
2581     {
2582     case FLG_LINELEN:
2583       if (val <= 0)
2584         {
2585           
2586           llerror_flagWarning (message ("Value for %s must be a positive "
2587                                     "number (given %d)",
2588                                     flagcode_unparse (flag), val));
2589           return;
2590         }
2591       if (flag == FLG_LINELEN && val < MINLINELEN)
2592         {
2593           llerror_flagWarning (message ("Value for %s must be at least %d (given %d)",
2594                                     flagcode_unparse (flag), 
2595                                     MINLINELEN, val));
2596           val = MINLINELEN;
2597         }
2598       break;
2599
2600     case FLG_INCLUDENEST:
2601     case FLG_CONTROLNESTDEPTH:
2602     case FLG_STRINGLITERALLEN:
2603     case FLG_NUMSTRUCTFIELDS:
2604     case FLG_NUMENUMMEMBERS:      
2605     case FLG_INDENTSPACES:
2606       if (val < 0)
2607         {
2608           
2609           llerror_flagWarning (message ("Value for %s must be a non-negative "
2610                                     "number (given %d)",
2611                                     flagcode_unparse (flag), val));
2612           return;
2613         }
2614
2615       break;
2616     default:
2617       break;
2618     }
2619     
2620   gc.values[index] = val;
2621 }
2622
2623 void
2624 context_setValueAndFlag (flagcode flag, int val)
2625 {
2626   gc.flags[flag] = TRUE;
2627   context_setValue (flag, val);
2628 }
2629
2630 int
2631 context_getValue (flagcode flag)
2632 {
2633   int index = flagcode_valueIndex (flag);
2634
2635   llassert (index >= 0 && index <= NUMVALUEFLAGS);
2636   return (gc.values[index]);
2637 }
2638
2639 int
2640 context_getCounter (flagcode flag)
2641 {
2642   int index = flagcode_valueIndex (flag);
2643
2644   llassert (index >= 0 && index <= NUMVALUEFLAGS);
2645   return (gc.counters[index]);
2646 }
2647
2648 void
2649 context_incCounter (flagcode flag)
2650 {
2651   int index = flagcode_valueIndex (flag);
2652
2653   llassert (index >= 0 && index <= NUMVALUEFLAGS);
2654   /* check limit */
2655   gc.counters[index]++;
2656 }
2657
2658 void
2659 context_decCounter (flagcode flag)
2660 {
2661   int index = flagcode_valueIndex (flag);
2662
2663   llassert (index >= 0 && index <= NUMVALUEFLAGS);
2664   gc.counters[index]--;
2665 }
2666
2667 bool context_showFunction (void)
2668 {
2669   return (gc.showfunction);
2670 }
2671
2672 void
2673 context_setString (flagcode flag, cstring val)
2674 {
2675   int index = flagcode_stringIndex (flag);
2676
2677   llassert (index >= 0 && index <= NUMSTRINGFLAGS);
2678
2679   if (flag == FLG_SYSTEMDIRS)
2680     {
2681       llassert (cstring_isDefined (val));
2682
2683       if (cstring_firstChar (val) == '\"')
2684         {
2685           cstring oval = val;
2686           cstring tval = cstring_copy (cstring_suffix (val, 1));
2687         
2688           if (cstring_lastChar (tval) != '\"')
2689             {
2690               int n = cstring_length (tval) - 1;
2691
2692               while (isspace ((int) cstring_getChar (tval, n)))
2693                 {
2694                   n--;
2695                 }
2696
2697               if (cstring_getChar (tval, n) != '\"')
2698                 {
2699                   llerror_flagWarning (message ("Setting -systemdirs to string with unmatching quotes: %s", val));
2700                 }
2701               else
2702                 {
2703                   cstring otval = tval;
2704                   tval = cstring_prefix (tval, n);
2705                   cstring_free (otval);
2706                 }
2707             }
2708           
2709           val = cstring_copy (cstring_clip (tval, cstring_length (tval) - 1));
2710           DPRINTF (("val = %s", val));
2711           cstring_free (tval);
2712           cstring_free (oval);
2713         }
2714     }
2715
2716   if (flag == FLG_TMPDIR)
2717     {
2718       llassert (cstring_isDefined (val));
2719       
2720       if (cstring_length (val) == 0)
2721         {
2722           cstring_free (val);
2723           val = message (".%s", cstring_makeLiteralTemp (CONNECTSTR));
2724         }
2725       else if (cstring_lastChar (val) != CONNECTCHAR)
2726         {
2727           val = cstring_appendChar (val, CONNECTCHAR);
2728         }
2729       else
2730         {
2731           ;
2732         }
2733     }
2734
2735   if (cstring_length (val) >= 1
2736       && cstring_firstChar (val) == '"')
2737     {
2738       llerror_flagWarning (message
2739                        ("setting %s to string beginning with \".  You probably "
2740                         "don't meant to have the \"'s.",
2741                         flagcode_unparse (flag)));
2742     }
2743
2744   if (flag == FLG_BOOLTYPE)
2745     {
2746
2747     }
2748
2749   gc.strings[index] = val;
2750 }
2751
2752 static /*@exposed@*/ cstring
2753 context_exposeString (flagcode flag)
2754 {
2755   int index = flagcode_stringIndex (flag);
2756
2757   llassert (index >= 0 && index <= NUMSTRINGFLAGS);
2758   return (gc.strings[index]);
2759 }
2760
2761 cstring
2762 context_getString (flagcode flag)
2763 {
2764   return (context_exposeString (flag));
2765 }
2766
2767 void
2768 context_resetErrors (void)
2769 {
2770   gc.numerrors = 0;
2771 }
2772
2773 void context_initMod (void)
2774    /*@globals undef gc; @*/
2775 {
2776   gc.kind = CX_GLOBAL;
2777   gc.savekind = CX_ERROR;
2778   gc.instandardlib = FALSE;
2779   gc.numerrors = 0;
2780   gc.neednl = FALSE;
2781   gc.linesprocessed = 0;
2782   gc.speclinesprocessed = 0;
2783   gc.insuppressregion = FALSE;
2784   gc.macroMissingParams = FALSE;
2785   gc.preprocessing = FALSE;
2786   gc.incommandline = FALSE;
2787   gc.mc = macrocache_create ();
2788   gc.nmods = 0;
2789   gc.maxmods = DEFAULTMAXMODS;
2790   gc.moduleaccess = (maccesst *) dmalloc (sizeof (*gc.moduleaccess) * (gc.maxmods));
2791   
2792   gc.library = FLG_ANSILIB;
2793
2794   gc.locstack = filelocStack_new ();
2795   gc.modrecs = sRefSetList_undefined;
2796   gc.anyExports = FALSE;
2797
2798   gc.ftab = fileTable_create ();
2799   gc.msgLog = messageLog_new ();
2800   gc.inimport = FALSE;
2801   gc.inDerivedFile = FALSE;
2802   gc.inheader = FALSE;
2803   gc.markers = flagMarkerList_new ();
2804   gc.cont.glob = TRUE;
2805   gc.showfunction = FALSE;
2806   gc.msgAnnote = cstring_undefined;
2807   gc.aliasAnnote = sRef_undefined;
2808   gc.aliasAnnoteAls = sRef_undefined;
2809   gc.boolType = ctype_bool;
2810   gc.mods = sRefSet_new ();
2811
2812   gc.saveloc = fileloc_undefined;
2813
2814   gc.inmacrocache = FALSE;
2815   gc.inclause = NOCLAUSE;
2816   gc.clauses = clauseStack_new ();
2817   gc.globs = globSet_new ();
2818   gc.nacct = typeIdSet_emptySet ();
2819   gc.acct = typeIdSet_emptySet ();
2820   gc.facct = typeIdSet_emptySet ();
2821   gc.savedFlags = FALSE;
2822   gc.pushloc = fileloc_undefined;
2823   gc.protectVars = FALSE;
2824   gc.justpopped = FALSE;
2825   gc.isNullGuarded = NO;
2826   gc.globs_used = globSet_undefined;
2827   
2828   allFlagCodes (code)
2829     {
2830       gc.setGlobally[code] = FALSE;
2831       gc.setLocally[code] = FALSE;
2832     } end_allFlagCodes ;
2833
2834   usymtab_initMod ();
2835
2836   context_resetAllFlags ();
2837   conext_resetAllCounters ();
2838   context_setMode (DEFAULT_MODE);
2839
2840   gc.stateTable = metaStateTable_create ();
2841   gc.annotTable = annotationTable_create ();
2842
2843   DPRINTF (("Annotations: \n%s",
2844             cstring_toCharsSafe (annotationTable_unparse (gc.annotTable))));
2845   DPRINTF (("State: \n%s",
2846             cstring_toCharsSafe (metaStateTable_unparse (gc.stateTable))));
2847
2848 }
2849
2850 ctype
2851 context_typeofZero (void)
2852 {
2853   ctype ct = ctype_int;
2854
2855   if (context_getFlag (FLG_ZEROPTR))
2856     {
2857       ct = ctype_makeConj (ct, ctype_voidPointer);
2858     }
2859   
2860   if (context_getFlag (FLG_ZEROBOOL)) {
2861     ct = ctype_makeConj (ct, ctype_bool); 
2862   }
2863
2864   return ct;
2865 }
2866
2867 ctype
2868 context_typeofOne (void)
2869 {
2870   ctype ct = ctype_int;
2871
2872   /* 1 is on longer a bool (was before 2.4)
2873      if (!context_getFlag (FLG_ABSTRACTBOOL))
2874      {
2875      ct = ctype_makeConj (ct, ctype_bool);
2876      }
2877      */
2878
2879   return (ct);
2880 }
2881
2882 /*@only@*/ cstring
2883 context_unparse (void)
2884 {
2885   cstring s;
2886
2887   switch (gc.kind)
2888     {
2889     case CX_LCL:
2890       s = message ("LCL File: %q", fileloc_unparse (g_currentloc));
2891       break;
2892     case CX_LCLLIB:
2893       s = message ("LCL Lib File: %q", fileloc_unparse (g_currentloc));
2894       break;
2895     case CX_GLOBAL:
2896       s = message ("Global Context:%q", fileloc_unparse (g_currentloc));
2897       break;
2898     case CX_INNER:
2899       s = message ("Inner Context:%q", fileloc_unparse (g_currentloc));
2900       break;
2901     case CX_FUNCTION:
2902       s = message ("Function %q :%q \n\taccess %q\n\tmodifies %q",
2903                    uentry_unparse (gc.cont.fcn),
2904                    fileloc_unparse (g_currentloc),
2905                    typeIdSet_unparse (gc.acct),
2906                    sRefSet_unparse (gc.mods));
2907       break;
2908     case CX_MACROFCN:
2909       s = message ("Function Macro %q", uentry_unparse (gc.cont.fcn));
2910       break;
2911     case CX_UNKNOWNMACRO:
2912       s = message ("Forward Specified Macro %q", uentry_unparse (gc.cont.fcn));
2913       break;
2914     case CX_MACROCONST:
2915       s = message ("Constant Macro %q", uentry_unparse (gc.cont.fcn));
2916       break;
2917     case CX_ITERDEF:
2918       s = message ("Iter definition %q", uentry_unparse (gc.cont.fcn));
2919       break;
2920     case CX_ITEREND:
2921       s = message ("Iter end %q", uentry_unparse (gc.cont.fcn));
2922       break;
2923     default:
2924       s = message ("Un-unparseable context: %d", (int) gc.kind);
2925       break;
2926     }
2927   
2928   s = message ("%q\naccess: %q", s, context_unparseAccess ());
2929   return (s);
2930 }
2931
2932 extern ctype
2933 context_currentFunctionType (void)
2934 {
2935   if (gc.kind == CX_FUNCTION || gc.kind == CX_MACROFCN)
2936     {
2937             return (uentry_getType (gc.cont.fcn));
2938     }
2939   else if (gc.kind == CX_INNER)
2940     {
2941       llcontbuglit ("context_currentFunctionType: inner context");
2942       do { context_exitInnerPlain (); } while (gc.kind == CX_INNER);
2943       return (context_currentFunctionType ());
2944     }
2945   else
2946     {
2947       llcontbuglit ("context_currentFunctionType: not in function");
2948       return (ctype_undefined);
2949     }
2950 }
2951
2952 void
2953 context_enterInnerContext (void)
2954 {
2955   if (gc.kind == CX_GLOBAL)
2956     {
2957       gc.kind = CX_INNER;
2958       gc.cont.cdepth = 1;
2959     }
2960   else if (gc.kind == CX_INNER)
2961     {
2962       gc.cont.cdepth++;
2963     }
2964   else
2965     {
2966       ;
2967     }
2968
2969   
2970   usymtab_enterScope ();
2971   pushClause (NOCLAUSE);
2972 }
2973
2974 void
2975 context_exitInnerPlain (void) /*@modifies gc;@*/
2976 {
2977   context_exitInner (exprNode_undefined);
2978 }
2979
2980 void
2981 context_exitInner (exprNode exp)
2982 {
2983   
2984   llassertprint (gc.inclause == NOCLAUSE || gc.inclause == CASECLAUSE,
2985                  ("inclause = %s", clause_nameTaken (gc.inclause)));
2986
2987   clauseStack_removeFirst (gc.clauses, NOCLAUSE);
2988   gc.inclause = topClause (gc.clauses);
2989
2990   if (gc.kind == CX_INNER)
2991     {
2992       if (--gc.cont.cdepth == 0)
2993         {
2994           gc.kind = CX_GLOBAL;
2995           gc.cont.glob = TRUE;
2996         }
2997     }
2998   else 
2999     {
3000       if (gc.kind == CX_GLOBAL)
3001         {
3002           llcontbuglit ("Attempt to exit global context");
3003           return;
3004         }
3005     }
3006
3007     usymtab_exitScope (exp);
3008 }
3009
3010
3011 void
3012 context_enterStructInnerContext (void)
3013 {
3014   if (gc.kind == CX_GLOBAL)
3015     {
3016       gc.kind = CX_INNER;
3017       gc.cont.cdepth = 1;
3018     }
3019   else if (gc.kind == CX_INNER)
3020     {
3021       gc.cont.cdepth++;
3022     }
3023   else
3024     {
3025       ;
3026     }
3027
3028   usymtab_enterScope ();
3029 }
3030
3031 void
3032 context_exitStructInnerContext (void)
3033 {
3034   if (gc.kind == CX_INNER)
3035     {
3036       if (--gc.cont.cdepth == 0)
3037         {
3038           gc.kind = CX_GLOBAL;
3039           gc.cont.glob = TRUE;
3040         }
3041     }
3042   else 
3043     {
3044       if (gc.kind == CX_GLOBAL)
3045         {
3046           llcontbuglit ("Attempt to exit global context");
3047           return;
3048         }
3049     }
3050
3051   usymtab_exitScope (exprNode_undefined);
3052 }
3053
3054 void
3055 context_exitInnerSafe (void)
3056 {
3057   
3058   if (gc.kind == CX_INNER)
3059     {
3060       if (--gc.cont.cdepth == 0)
3061         {
3062           gc.cont.cdepth++;
3063         }
3064     }
3065   else if (gc.kind == CX_GLOBAL)
3066     {
3067       llcontbuglit ("Attempt to exit global context");
3068       return;
3069     }
3070   else
3071     {
3072       if (usymtab_inDeepScope ())
3073         {
3074           usymtab_exitScope (exprNode_undefined);
3075         }
3076     }
3077 }
3078
3079 static
3080 void setModuleAccess (void)
3081 {
3082   gc.facct = typeIdSet_emptySet ();
3083
3084   if (fileId_isValid (currentFile ()))
3085     {
3086       cstring baseName = fileloc_getBase (g_currentloc);
3087       
3088       if (context_getFlag (FLG_ACCESSFILE))
3089         {
3090           if (usymtab_existsType (baseName))
3091             {
3092               gc.facct = typeIdSet_insert (gc.facct, 
3093                                            usymtab_getTypeId (baseName));
3094             }
3095           else 
3096             {
3097               ;
3098             }
3099         }
3100       
3101       if (context_getFlag (FLG_ACCESSMODULE))
3102         {
3103           int i;
3104           bool hasaccess = FALSE;
3105           
3106           for (i = 0; i < gc.nmods; i++)
3107             {
3108               if (cstring_equal (baseName, gc.moduleaccess[i].file))
3109                 {
3110                   gc.facct = typeIdSet_union (gc.facct, gc.moduleaccess[i].daccess);
3111
3112                   hasaccess = TRUE;
3113                   break;
3114                 }
3115             }
3116         }
3117       
3118       gc.acct = gc.facct;
3119       gc.inheader = fileId_isHeader (currentFile ());
3120     }
3121   else
3122     {
3123       llcontbuglit ("Current file not defined\n");
3124       gc.facct = typeIdSet_emptySet ();
3125       gc.acct = gc.facct;
3126       gc.inheader = FALSE;
3127     }
3128   
3129   /* 17 Jan 1995: forgot to clear nacct */
3130   
3131   gc.nacct = typeIdSet_emptySet ();
3132 }
3133
3134 static void
3135 context_enterFileAux (void)
3136 {
3137   setModuleAccess ();
3138 }
3139
3140 void
3141 context_enterFile (void)
3142 {
3143   context_enterFileAux ();
3144   usymtab_enterFile ();
3145 }
3146
3147 void
3148 context_enterMacroFile (void)
3149 {
3150   context_enterFileAux ();
3151 }
3152
3153 bool 
3154 context_inFunction (void)
3155 {
3156   kcontext ck = gc.kind;
3157   
3158   return ((ck == CX_FUNCTION) || (ck == CX_MACROFCN) || (ck == CX_INNER));
3159 }
3160
3161 bool 
3162 context_inFunctionLike (void)
3163 {
3164   return (gc.kind == CX_FUNCTION || gc.kind == CX_MACROFCN 
3165           || gc.kind == CX_FCNDECLARATION
3166           || gc.kind == CX_UNKNOWNMACRO || gc.kind == CX_ITERDEF);
3167 }
3168
3169 bool 
3170 context_inRealFunction (void)
3171 {
3172   kcontext ck = gc.kind;
3173   
3174   return ((ck == CX_FUNCTION) || (ck == CX_MACROFCN));
3175 }
3176   
3177 void
3178 context_processAllMacros (void)
3179 {
3180   usymtab_enterFile ();
3181
3182   gc.inmacrocache = TRUE; 
3183   macrocache_processUndefinedElements (gc.mc);
3184   cleanupMessages ();  
3185   usymtab_exitFile ();
3186
3187   gc.inmacrocache = FALSE;
3188   macrocache_finalize ();
3189 }
3190
3191 /*
3192 ** this happens once at the end of each C file
3193 **
3194 ** check each Macro that was defined in current file.c or current file.h
3195 **
3196 */
3197
3198 static void
3199 context_processMacros (void)
3200 {
3201   if (fileId_isValid (currentFile ()))
3202     {
3203       fileloc lastfl;
3204       cstring cbase = fileLib_removePathFree (fileLib_removeAnyExtension (fileName (currentFile ())));
3205       
3206       gc.inmacrocache = TRUE;
3207
3208       DPRINTF (("Processing macros: %s", cbase));
3209       lastfl = macrocache_processFileElements (gc.mc, cbase);
3210       DPRINTF (("Processing macros: %s", fileloc_unparse (lastfl)));
3211
3212       cstring_free (cbase);
3213       
3214       if (fileloc_isDefined (lastfl))
3215         {
3216           g_currentloc = fileloc_update (g_currentloc, lastfl);
3217           cleanupMessages ();
3218         }
3219
3220       gc.inmacrocache = FALSE;
3221     }
3222 }
3223
3224 bool
3225 context_processingMacros (void)
3226 {
3227   return (gc.inmacrocache);
3228 }
3229
3230 void
3231 context_exitCFile (void)
3232 {
3233   if (gc.kind != CX_GLOBAL)
3234     {
3235       llfatalerrorLoc
3236         (cstring_makeLiteral ("File ended outside global scope"));
3237     }
3238
3239   if (gc.insuppressregion)
3240     {
3241      /* gack...don't reverse the order of these lines! ;-> */
3242       gc.insuppressregion = FALSE;
3243       llerrorlit (FLG_SYNTAX, 
3244                   "File ended in ignore errors region, "
3245                   "possible missing /*@end*/");
3246     }
3247
3248   /* fix up parse errors */
3249
3250   while (!usymtab_inFileScope ())
3251     {
3252       usymtab_quietExitScope (g_currentloc);
3253     }
3254
3255   /*
3256   ** Clear the file-specific modifies information.
3257   */
3258   
3259   sRefSetList_elements (gc.modrecs, mods)
3260     {
3261       sRefSet_clearStatics (mods);
3262     } end_sRefSetList_elements ;
3263   
3264   sRefSetList_clear (gc.modrecs);
3265   
3266   context_processMacros ();
3267   cleanupMessages (); 
3268   
3269   usymtab_exitFile ();
3270   
3271   gc.inDerivedFile = FALSE;
3272   filelocStack_clear (gc.locstack);
3273   
3274   gc.nacct = typeIdSet_emptySet (); /* empty noaccess */
3275   
3276   gc.cont.glob = TRUE;
3277   
3278   if (gc.savedFlags)
3279     {
3280       context_restoreFlagSettings ();
3281       gc.savedFlags = FALSE;
3282     }
3283   
3284   /*
3285     DPRINTF (("After exiting file: "));
3286     usymtab_printAll ();
3287   */
3288 }
3289
3290 void
3291 context_exitMacroCache (void)
3292 {
3293   if (gc.kind != CX_GLOBAL)
3294     {
3295       if (context_inMacro ()) 
3296         /* this is okay, file could end without newline in macro */
3297         {
3298           DPRINTF (("Still in macro: %s",
3299                     context_unparse ()));
3300           context_exitFunction ();
3301         }
3302       else
3303         {
3304           llcontbug (message ("context_exitMacroCache: outside global scope: %q", 
3305                               context_unparse ()));
3306           gc.kind = CX_GLOBAL; 
3307         }
3308     }
3309
3310   /*
3311   ** no longer valid here
3312   ** if (gc.insuppressregion)
3313   **   {
3314   **     gc.insuppressregion = FALSE;
3315   **     llerror ("File ended in ignore errors region, possible missing @");
3316   **   }
3317   */
3318
3319   gc.cont.glob = TRUE;
3320 }
3321
3322 void
3323 context_saveLocation (void)
3324 {
3325   /* was llassert (fileloc_isUndefined (gc.saveloc)) */
3326       fileloc_free (gc.saveloc);
3327     
3328
3329   gc.saveloc = fileloc_copy (g_currentloc);
3330   }
3331
3332 fileloc
3333 context_getSaveLocation (void)
3334 {
3335   fileloc fl = gc.saveloc;
3336
3337     gc.saveloc = fileloc_undefined;
3338   return fl;
3339 }
3340
3341 /*@observer@*/ cstring
3342 context_inFunctionName (void)
3343 {
3344   if (gc.kind == CX_FUNCTION
3345       || gc.kind == CX_MACROFCN || gc.kind == CX_UNKNOWNMACRO 
3346       || gc.kind == CX_MACROCONST 
3347       || gc.kind == CX_ITERDEF || gc.kind == CX_ITEREND)
3348     {
3349       return (uentry_rawName (gc.cont.fcn));
3350     }
3351   else
3352     {
3353       llcontbuglit ("context_inFunctionName: not in function");
3354       return (cstring_undefined);
3355     }
3356 }
3357
3358 void
3359 context_userSetFlag (flagcode f, bool b)
3360 {
3361   DPRINTF (("set flag: %s", flagcode_unparse (f)));
3362
3363   if (f == FLG_NEVERINCLUDE && b)
3364     {
3365       if (gc.flags[FLG_EXPORTHEADER])
3366         {
3367           llerror_flagWarning (cstring_makeLiteral
3368                            ("setting +neverinclude after +exportheader.  "
3369                             "Turning off exportheader, since headers are not checked "
3370                             "when +neverinclude is used."));
3371
3372           gc.flags[FLG_EXPORTHEADER] = FALSE;
3373         }
3374     }
3375   else 
3376     {
3377       if (f == FLG_EXPORTHEADER && b)
3378         {
3379           if (gc.flags[FLG_NEVERINCLUDE])
3380             {
3381               llerror_flagWarning (cstring_makeLiteral
3382                                ("setting +exportheader after +neverinclude.  "
3383                                 "Not setting exportheader, since headers are not checked "
3384                                 "when +neverinclude is used."));
3385               gc.flags[FLG_EXPORTHEADER] = FALSE;
3386               return;
3387             }
3388         }
3389     }
3390   
3391   if (context_getFlag (FLG_WARNFLAGS) && f != FLG_NOF && f != FLG_OPTF)
3392     {
3393       bool lastsetting = context_getFlag (f);
3394       
3395       if (bool_equal (lastsetting, b)
3396           && !flagcode_isSpecialFlag (f) 
3397           && !flagcode_isIdemFlag (f)
3398           && !flagcode_hasArgument (f))
3399         {
3400           llerror_flagWarning (message ("setting %s%s redundant with current value", 
3401                                     cstring_makeLiteralTemp (b ? "+" : "-"),
3402                                     flagcode_unparse (f)));
3403         }
3404     }
3405
3406   if (flagcode_isWarnUseFlag (f) && b)
3407     {
3408       if (!context_getFlag (FLG_WARNUSE))
3409         {
3410           llerror_flagWarning (message ("flag +%s is canceled by -warnuse",
3411                                     flagcode_unparse (f)));
3412           
3413         }
3414     }
3415
3416
3417   if (flagcode_isLibraryFlag (f)) 
3418     {
3419       if (gc.library != FLG_ANSILIB
3420           && gc.library != f)
3421         {
3422           llerror_flagWarning (message ("selecting library %s after library %s was "
3423                                         "selected (only one library may be used)",
3424                                         flagcode_unparse (f),
3425                                         flagcode_unparse (gc.library)));
3426         }
3427
3428       if (f == FLG_UNIXLIB)
3429         {
3430           if (context_getFlag (FLG_WARNUNIXLIB))
3431             {
3432               llerror_flagWarning (cstring_makeLiteral
3433                                    ("selecting unix library.  Unix library is "
3434                                     "ad hoc addition to POSIX library.  Recommend "
3435                                     "use +posixlib to select POSIX library instead. "
3436                                     "Use -warnunixlib to suppress this message."));
3437             }
3438         }
3439       
3440       gc.library = f;
3441     }
3442
3443   if (flagcode_isNameChecksFlag (f) && b && !context_maybeSet (FLG_NAMECHECKS))
3444     {
3445       llerror_flagWarning (message
3446                            ("setting +%s will not produce warnings with -namechecks. Must set +namechecks also.",
3447                             flagcode_unparse (f)));
3448     }
3449
3450   gc.setGlobally[f] = TRUE;
3451   context_setFlag (f, b);
3452 }
3453
3454 void
3455 context_fileSetFlag (flagcode f, ynm set)
3456 {
3457   if (!gc.savedFlags)
3458     {
3459       context_saveFlagSettings ();
3460     }
3461
3462   if (ynm_isOff (set))
3463     {
3464       context_setFlagAux (f, FALSE, TRUE, FALSE);
3465     }
3466   else if (ynm_isOn (set))
3467     {
3468       context_setFlagAux (f, TRUE, TRUE, FALSE);
3469       gc.setLocally[f] = TRUE;
3470     }
3471   else
3472     {
3473       context_restoreFlag (f);
3474     }
3475 }
3476
3477 static void
3478 context_restoreFlag (flagcode f)
3479 {
3480   
3481   if (!gc.savedFlags)
3482     {
3483       voptgenerror 
3484         (FLG_SYNTAX,
3485          message ("Attempt to restore flag %s when no file scope flags "
3486                   "have been set.",
3487                   flagcode_unparse (f)),
3488          g_currentloc);
3489     }
3490   else
3491     {
3492       context_addFlagMarker (f, MAYBE);
3493       context_setFlagAux (f, gc.saveflags[f], FALSE, TRUE);
3494     }
3495
3496   }
3497
3498 static void
3499 context_setFlag (flagcode f, bool b)
3500 {
3501   context_setFlagAux (f, b, FALSE, FALSE);
3502 }
3503
3504 void
3505 context_setFlagTemp (flagcode f, bool b)
3506 {
3507   DPRINTF (("Set flag temp: %s / %s", flagcode_unparse (f), bool_unparse (b)));
3508   gc.flags[f] = b;
3509 }
3510
3511 /*@notfunction@*/
3512 # define DOSET(ff,b) \
3513    do { if (inFile) { gc.setLocally[ff] = TRUE; \
3514                       context_addFlagMarker (ff, ynm_fromBool (b)); } \
3515         DPRINTF (("set flag: %s / %s", flagcode_unparse (ff), bool_unparse (b))); \
3516         gc.flags[ff] = b; } while (FALSE)
3517
3518 static void
3519   context_setFlagAux (flagcode f, bool b, bool 
3520                       inFile, /*@unused@*/ bool isRestore)
3521 {
3522   DPRINTF (("set flag: %s / %s", flagcode_unparse (f), bool_unparse (b)));
3523
3524   if (f == FLG_USESTDERR) 
3525     {
3526       if (b) {
3527         g_msgstream = stderr;
3528       } else {
3529         g_msgstream = stdout;
3530       }
3531     }
3532
3533   /*
3534   ** Removed test for special flags.
3535   */
3536
3537   if (flagcode_isIdemFlag (f))
3538     {
3539       DOSET (f, TRUE);
3540     }
3541   else
3542     {
3543       DOSET (f, b);
3544     }
3545
3546   if (f >= FLG_ITS4MOSTRISKY && f <= FLG_ITS4LOWRISK)
3547     {
3548       if (b) /* Turing higher level on, turns on all lower levels */
3549         {
3550           switch (f)
3551             {
3552             case FLG_ITS4MOSTRISKY:
3553               DOSET (FLG_ITS4VERYRISKY, b);
3554               /*@fallthrough@*/ 
3555             case FLG_ITS4VERYRISKY:
3556               DOSET (FLG_ITS4RISKY, b);
3557               /*@fallthrough@*/ 
3558             case FLG_ITS4RISKY:
3559               DOSET (FLG_ITS4MODERATERISK, b);
3560               /*@fallthrough@*/ 
3561             case FLG_ITS4MODERATERISK:
3562               DOSET (FLG_ITS4LOWRISK, b);
3563               /*@fallthrough@*/ 
3564             case FLG_ITS4LOWRISK:
3565               break;
3566               BADDEFAULT;
3567             }
3568         }
3569       else /* Turning level off, turns off all higher levels */
3570         {
3571           switch (f)
3572             {
3573             case FLG_ITS4LOWRISK:
3574               DOSET (FLG_ITS4MODERATERISK, b);
3575               /*@fallthrough@*/ 
3576             case FLG_ITS4MODERATERISK:
3577               DOSET (FLG_ITS4RISKY, b);
3578               /*@fallthrough@*/ 
3579             case FLG_ITS4RISKY:
3580               DOSET (FLG_ITS4VERYRISKY, b);
3581               /*@fallthrough@*/ 
3582             case FLG_ITS4VERYRISKY:
3583               DOSET (FLG_ITS4MOSTRISKY, b);
3584               /*@fallthrough@*/ 
3585             case FLG_ITS4MOSTRISKY:
3586               break;
3587               BADDEFAULT;
3588             }
3589         }
3590     }
3591   
3592   switch (f)
3593     {     
3594     case FLG_ALLEMPTY:
3595       DOSET (FLG_ALLEMPTY, b);
3596       DOSET (FLG_IFEMPTY, b);
3597       DOSET (FLG_WHILEEMPTY, b);
3598       DOSET (FLG_FOREMPTY, b);
3599       break;
3600     case FLG_PREDBOOL:
3601       DOSET (FLG_PREDBOOL, b);
3602       DOSET (FLG_PREDBOOLINT, b);
3603       DOSET (FLG_PREDBOOLPTR, b);
3604       DOSET (FLG_PREDBOOLOTHERS, b);
3605       break;
3606     case FLG_GLOBALIAS:
3607       DOSET (FLG_CHECKSTRICTGLOBALIAS, b);
3608       DOSET (FLG_CHECKEDGLOBALIAS, b);
3609       DOSET (FLG_CHECKMODGLOBALIAS, b);
3610       DOSET (FLG_UNCHECKEDGLOBALIAS, b);
3611       break;
3612     case FLG_ALLBLOCK:
3613       DOSET (FLG_ALLBLOCK, b);
3614       DOSET (FLG_IFBLOCK, b);
3615       DOSET (FLG_WHILEBLOCK, b);
3616       DOSET (FLG_FORBLOCK, b);
3617       break;
3618     case FLG_GRAMMAR:
3619       if (b)
3620         {
3621           yydebug = 1;
3622           mtdebug = 1;
3623         }
3624       else
3625         {
3626           yydebug = 0;
3627           mtdebug = 0;
3628         }
3629       
3630       DOSET (FLG_GRAMMAR, b);
3631       break;
3632     case FLG_CODEIMPONLY:
3633       DOSET (FLG_CODEIMPONLY, b);
3634       DOSET (FLG_GLOBIMPONLY, b);
3635       DOSET (FLG_RETIMPONLY, b);
3636       DOSET (FLG_STRUCTIMPONLY, b);
3637       break;
3638     case FLG_SPECALLIMPONLY:
3639       DOSET (FLG_SPECALLIMPONLY, b);
3640       DOSET (FLG_SPECGLOBIMPONLY, b);
3641       DOSET (FLG_SPECRETIMPONLY, b);
3642       DOSET (FLG_SPECSTRUCTIMPONLY, b);
3643       break;
3644     case FLG_ALLIMPONLY:
3645       DOSET (FLG_ALLIMPONLY, b);
3646       DOSET (FLG_GLOBIMPONLY, b);
3647       DOSET (FLG_RETIMPONLY, b);
3648       DOSET (FLG_STRUCTIMPONLY, b);
3649       DOSET (FLG_SPECGLOBIMPONLY, b);
3650       DOSET (FLG_SPECRETIMPONLY, b);
3651       DOSET (FLG_SPECSTRUCTIMPONLY, b);
3652       break;
3653     case FLG_ANSILIMITS: 
3654       DOSET (FLG_ANSILIMITS, b);
3655       DOSET (FLG_CONTROLNESTDEPTH, b);
3656       DOSET (FLG_STRINGLITERALLEN, b);
3657       DOSET (FLG_INCLUDENEST, b);
3658       DOSET (FLG_NUMSTRUCTFIELDS, b);
3659       DOSET (FLG_NUMENUMMEMBERS, b);
3660       
3661       if (b)
3662         {
3663           context_setValue (FLG_CONTROLNESTDEPTH, DEFAULT_CONTROLNESTDEPTH);
3664           context_setValue (FLG_STRINGLITERALLEN, DEFAULT_STRINGLITERALLEN);
3665           context_setValue (FLG_INCLUDENEST, DEFAULT_INCLUDENEST);
3666           context_setValue (FLG_NUMSTRUCTFIELDS, DEFAULT_NUMSTRUCTFIELDS);
3667           context_setValue (FLG_NUMENUMMEMBERS, DEFAULT_NUMENUMMEMBERS);
3668         }
3669       break;
3670     case FLG_EXTERNALNAMELEN:
3671       DOSET (FLG_DISTINCTEXTERNALNAMES, TRUE);
3672       DOSET (FLG_EXTERNALNAMELEN, TRUE);
3673       break;
3674     case FLG_INTERNALNAMELEN:
3675       DOSET (FLG_DISTINCTINTERNALNAMES, TRUE);
3676       DOSET (FLG_INTERNALNAMELEN, TRUE);
3677       break;
3678     case FLG_EXTERNALNAMECASEINSENSITIVE:
3679       DOSET (FLG_EXTERNALNAMECASEINSENSITIVE, b);
3680       
3681       if (b && !gc.flags[FLG_DISTINCTEXTERNALNAMES])
3682         {
3683           DOSET (FLG_DISTINCTEXTERNALNAMES, TRUE);
3684           context_setValue (FLG_EXTERNALNAMELEN, 0);
3685         }
3686       break;
3687     case FLG_INTERNALNAMECASEINSENSITIVE:
3688       DOSET (FLG_INTERNALNAMECASEINSENSITIVE, b);
3689       
3690       if (b && !gc.flags[FLG_DISTINCTINTERNALNAMES])
3691         {
3692           DOSET (FLG_DISTINCTINTERNALNAMES, TRUE);
3693           context_setValue (FLG_INTERNALNAMELEN, 0);
3694         }
3695       break;
3696     case FLG_INTERNALNAMELOOKALIKE:
3697       DOSET (FLG_INTERNALNAMELOOKALIKE, b);
3698       
3699       if (b && !gc.flags[FLG_DISTINCTINTERNALNAMES])
3700         {
3701           DOSET (FLG_DISTINCTINTERNALNAMES, TRUE);
3702           context_setValue (FLG_INTERNALNAMELEN, 0);
3703         }
3704       break;
3705     case FLG_MODUNSPEC:
3706       DOSET (FLG_MODNOMODS, b);
3707       DOSET (FLG_MODGLOBSUNSPEC, b);
3708       DOSET (FLG_MODSTRICTGLOBSUNSPEC, b);
3709       break;
3710     case FLG_EXPORTANY: 
3711       DOSET (FLG_EXPORTVAR, b);
3712       DOSET (FLG_EXPORTFCN, b);
3713       DOSET (FLG_EXPORTTYPE, b);
3714       DOSET (FLG_EXPORTMACRO, b);
3715       DOSET (FLG_EXPORTCONST, b);
3716       gc.anyExports = TRUE;
3717       break;
3718     case FLG_REPEXPOSE:
3719       DOSET (FLG_RETEXPOSE, b); 
3720       DOSET (FLG_ASSIGNEXPOSE, b); 
3721       DOSET (FLG_CASTEXPOSE, b); 
3722       break;
3723     case FLG_RETVAL:
3724       DOSET (FLG_RETVALBOOL, b);
3725       DOSET (FLG_RETVALINT, b);
3726       DOSET (FLG_RETVALOTHER, b);
3727       break;
3728     case FLG_PARTIAL:
3729       if (b)
3730         {
3731           DOSET (FLG_EXPORTLOCAL, FALSE);
3732           DOSET (FLG_DECLUNDEF, FALSE);
3733           DOSET (FLG_SPECUNDEF, FALSE);
3734           DOSET (FLG_TOPUNUSED, FALSE);
3735         }
3736       break;
3737     case FLG_DEEPBREAK:
3738       DOSET (FLG_LOOPLOOPBREAK, b);
3739       DOSET (FLG_LOOPSWITCHBREAK, b);
3740       DOSET (FLG_SWITCHLOOPBREAK, b);
3741       DOSET (FLG_SWITCHSWITCHBREAK, b);
3742       DOSET (FLG_LOOPLOOPCONTINUE, b);
3743       DOSET (FLG_DEEPBREAK, b);
3744       break;
3745     case FLG_ACCESSALL:
3746       DOSET (FLG_ACCESSMODULE, b);
3747       DOSET (FLG_ACCESSFILE, b);
3748       DOSET (FLG_ACCESSCZECH, b);
3749       break;
3750     case FLG_ALLMACROS:
3751       DOSET (FLG_ALLMACROS, b);
3752       DOSET (FLG_FCNMACROS, b);
3753       DOSET (FLG_CONSTMACROS, b);
3754       break;
3755     case FLG_CZECH:
3756       if (b) { DOSET (FLG_ACCESSCZECH, b); }
3757       DOSET (FLG_CZECHFUNCTIONS, b);
3758       DOSET (FLG_CZECHVARS, b);
3759       DOSET (FLG_CZECHCONSTANTS, b);
3760       DOSET (FLG_CZECHTYPES, b);
3761       break;
3762     case FLG_SLOVAK:
3763       if (b) { DOSET (FLG_ACCESSSLOVAK, b); }
3764       DOSET (FLG_SLOVAKFUNCTIONS, b);
3765       DOSET (FLG_SLOVAKVARS, b);
3766       DOSET (FLG_SLOVAKCONSTANTS, b);
3767       DOSET (FLG_SLOVAKTYPES, b);
3768       break;
3769     case FLG_CZECHOSLOVAK:
3770       if (b) { DOSET (FLG_ACCESSCZECHOSLOVAK, b); }
3771       DOSET (FLG_CZECHOSLOVAKFUNCTIONS, b);
3772       DOSET (FLG_CZECHOSLOVAKVARS, b);
3773       DOSET (FLG_CZECHOSLOVAKCONSTANTS, b);
3774       DOSET (FLG_CZECHOSLOVAKTYPES, b);
3775       break;
3776     case FLG_NULL:
3777       DOSET (FLG_NULLSTATE, b);
3778       DOSET (FLG_NULLDEREF, b);
3779       DOSET (FLG_NULLASSIGN, b);
3780       DOSET (FLG_NULLPASS, b);
3781       DOSET (FLG_NULLRET, b);
3782       break;
3783     case FLG_MEMCHECKS:
3784       DOSET (FLG_NULLSTATE, b);
3785       DOSET (FLG_NULLDEREF, b);
3786       DOSET (FLG_NULLASSIGN, b);
3787       DOSET (FLG_NULLPASS, b);
3788       DOSET (FLG_NULLRET, b);
3789       DOSET (FLG_COMPDEF, b);
3790       DOSET (FLG_COMPMEMPASS, b);
3791       DOSET (FLG_UNIONDEF, b);
3792       DOSET (FLG_MEMTRANS, b);
3793       DOSET (FLG_USERELEASED, b);
3794       DOSET (FLG_ALIASUNIQUE, b);
3795       DOSET (FLG_MAYALIASUNIQUE, b);
3796       DOSET (FLG_MUSTFREE, b);
3797       DOSET (FLG_MUSTDEFINE, b);
3798       DOSET (FLG_GLOBSTATE, b); 
3799       DOSET (FLG_COMPDESTROY, b);
3800       DOSET (FLG_MUSTNOTALIAS, b);
3801       DOSET (FLG_MEMIMPLICIT, b);
3802       DOSET (FLG_BRANCHSTATE, b); 
3803       /*@fallthrough@*/ /* also sets memtrans flags */
3804     case FLG_MEMTRANS:
3805       DOSET (FLG_MEMTRANS, b);
3806       DOSET (FLG_EXPOSETRANS, b);
3807       DOSET (FLG_OBSERVERTRANS, b);
3808       DOSET (FLG_DEPENDENTTRANS, b);
3809       DOSET (FLG_NEWREFTRANS, b);
3810       DOSET (FLG_ONLYTRANS, b);
3811       DOSET (FLG_OWNEDTRANS, b);
3812       DOSET (FLG_FRESHTRANS, b);
3813       DOSET (FLG_SHAREDTRANS, b);
3814       DOSET (FLG_TEMPTRANS, b);
3815       DOSET (FLG_KEPTTRANS, b);
3816       DOSET (FLG_REFCOUNTTRANS, b);
3817       DOSET (FLG_STATICTRANS, b);
3818       DOSET (FLG_UNKNOWNTRANS, b);
3819       DOSET (FLG_KEEPTRANS, b);
3820       DOSET (FLG_IMMEDIATETRANS, b);
3821       break;
3822       
3823     default:
3824       break;
3825     }
3826
3827   if (b && !gc.anyExports
3828       && (f == FLG_EXPORTVAR || f == FLG_EXPORTFCN
3829           || f == FLG_EXPORTTYPE || f == FLG_EXPORTMACRO
3830           || f == FLG_EXPORTCONST
3831           || f == FLG_EXPORTANY))
3832     {
3833       gc.anyExports = TRUE;
3834     }
3835 }
3836
3837 bool 
3838 context_maybeSet (flagcode d)
3839 {
3840   return (gc.flags[d] || gc.setLocally[d]);
3841 }
3842
3843 bool
3844 context_getFlag (flagcode d)
3845 {
3846   return (gc.flags[d]);
3847 }
3848
3849 bool
3850 context_flagOn (flagcode f, fileloc loc)
3851 {
3852   return (!context_suppressFlagMsg (f, loc));
3853 }
3854
3855 static void context_saveFlagSettings (void)
3856 {
3857   gc.savedFlags = TRUE;
3858   llassert (sizeof (gc.saveflags) == sizeof (gc.flags));
3859   memcpy (gc.saveflags, gc.flags, sizeof (gc.flags));
3860 }
3861
3862 static void context_restoreFlagSettings (void)
3863 {
3864   llassert (sizeof (gc.saveflags) == sizeof (gc.flags));
3865   memcpy (gc.flags, gc.saveflags, sizeof (gc.flags));
3866   gc.savedFlags = FALSE;
3867 }
3868
3869 void context_setFilename (fileId fid, int lineno) 
3870    /*@globals fileloc g_currentloc;@*/
3871    /*@modifies g_currentloc@*/
3872 {
3873   if (fileId_baseEqual (currentFile (), fid))
3874     {
3875       setLine (lineno);
3876       return;
3877     }
3878   else
3879     {
3880       fileloc_setColumn (g_currentloc, 0);
3881
3882       if (fileloc_isSpecialFile (g_currentloc))
3883         {
3884           gc.inDerivedFile = TRUE;
3885         }
3886
3887       if (filelocStack_popPushFile (gc.locstack, g_currentloc))
3888         {
3889           int maxdepth = context_getValue (FLG_INCLUDENEST);
3890
3891           if (filelocStack_size (gc.locstack) > maxdepth)
3892             {
3893               int depth = filelocStack_includeDepth (gc.locstack);
3894               
3895               if (depth > maxdepth)
3896                 {
3897                   if (optgenerror 
3898                       (FLG_INCLUDENEST,
3899                        message ("Maximum include nesting depth "
3900                                 "(%d, current depth %d) exceeded",
3901                                 maxdepth,
3902                                 depth),
3903                        filelocStack_nextTop (gc.locstack)))
3904                     {
3905                       filelocStack_printIncludes (gc.locstack);
3906                     }
3907                 }
3908             }
3909         }
3910       
3911       g_currentloc = fileloc_create (fid, lineno, 1);
3912       gc.inheader = fileId_isHeader (currentFile ());
3913
3914       context_enterFileAux ();
3915     }
3916 }
3917
3918 void context_enterIterDef (/*@observer@*/ uentry le)
3919 {
3920     context_enterMacro (le);
3921   gc.acct = typeIdSet_subtract (gc.facct, gc.nacct);
3922   gc.kind = CX_ITERDEF;
3923 }
3924
3925 void context_enterIterEnd (/*@observer@*/ uentry le)
3926 {
3927     context_enterMacro (le);
3928   gc.kind = CX_ITEREND;
3929 }
3930
3931 void 
3932 context_destroyMod (void) 
3933    /*@globals killed gc@*/
3934 {
3935   setCodePoint ();
3936   ctype_destroyMod ();
3937   setCodePoint ();
3938   usymtab_free ();
3939   setCodePoint ();
3940   fileTable_free (gc.ftab);
3941   filelocStack_free (gc.locstack);
3942   setCodePoint ();
3943   gc.ftab = fileTable_undefined;
3944
3945   macrocache_free (gc.mc);
3946   sfree (gc.moduleaccess);
3947   setCodePoint ();
3948
3949   fileloc_free (gc.saveloc); gc.saveloc = fileloc_undefined;
3950   fileloc_free (gc.pushloc); gc.pushloc = fileloc_undefined;
3951
3952   setCodePoint ();
3953   sRefSetList_free (gc.modrecs);
3954   setCodePoint ();
3955   flagMarkerList_free (gc.markers); 
3956   setCodePoint ();
3957   messageLog_free (gc.msgLog);
3958   setCodePoint ();
3959   clauseStack_free (gc.clauses);
3960   setCodePoint ();
3961   
3962   cstring_free (gc.msgAnnote);
3963   globSet_free (gc.globs_used);
3964   metaStateTable_free (gc.stateTable);
3965   annotationTable_free (gc.annotTable);
3966 }
3967
3968 /*
3969 ** Flag shortcuts.
3970 */
3971
3972 bool context_msgBoolInt (void)
3973 {
3974   return gc.flags [FLG_BOOLINT];
3975 }
3976
3977 bool context_msgCharInt (void)
3978 {
3979   return gc.flags [FLG_CHARINT];
3980 }
3981
3982 bool context_msgEnumInt (void)
3983 {
3984   return gc.flags [FLG_ENUMINT];
3985 }
3986
3987 bool context_msgPointerArith (void) 
3988 {
3989   return gc.flags [FLG_POINTERARITH];
3990 }
3991
3992 bool context_msgStrictOps (void) 
3993 {
3994   return gc.flags [FLG_STRICTOPS];
3995 }
3996
3997 # ifndef NOLCL
3998 bool context_msgLh (void)           
3999 {
4000   return gc.flags [FLG_DOLH];
4001 }
4002 # endif
4003
4004 void context_pushLoc (void) 
4005 {
4006   fileloc_free (gc.pushloc);
4007   gc.pushloc = gc.saveloc;
4008   gc.saveloc = fileloc_undefined;
4009 }
4010
4011 void context_popLoc (void) 
4012 {
4013   gc.saveloc = fileloc_update (gc.saveloc, gc.pushloc);
4014 }
4015
4016 bool context_inGlobalScope (void)
4017 {
4018   return (usymtab_inFileScope() || usymtab_inGlobalScope ());
4019 }
4020
4021 bool context_inInnerScope (void)
4022 {
4023   return (gc.kind == CX_INNER);
4024 }
4025
4026 void context_setProtectVars (void)
4027 {
4028   gc.protectVars = TRUE;
4029 }
4030
4031 bool context_anyErrors (void)
4032 {
4033   return (gc.numerrors > 0);
4034 }
4035
4036 void context_hasError (void)
4037 {
4038   gc.numerrors++;
4039 }
4040
4041 int context_numErrors (void)
4042 {
4043   return gc.numerrors;
4044 }
4045
4046 bool context_neednl (void)
4047 {
4048   return gc.neednl;
4049 }
4050
4051 void context_setNeednl (void)
4052 {
4053   gc.neednl = TRUE;
4054 }
4055
4056 int context_getExpect (void)
4057 {
4058   return (context_getValue (FLG_EXPECT));
4059 }
4060
4061 # ifndef NOLCL
4062 int context_getLCLExpect (void)
4063 {
4064   return (context_getValue (FLG_LCLEXPECT));
4065 }
4066 # endif
4067
4068 int context_getLimit (void)
4069 {
4070   return (context_getValue (FLG_LIMIT));
4071 }
4072
4073 bool context_unlimitedMessages (void)
4074 {
4075   return (context_getLimit () < 0);
4076 }
4077
4078 void context_releaseVars (void)
4079 {
4080   llassert (gc.protectVars);
4081   gc.protectVars = FALSE;
4082 }
4083
4084 void context_sizeofReleaseVars (void)
4085 {
4086   /* If there is a nested sizeof, this might not hold:
4087      llassert (gc.protectVars);
4088      */
4089
4090   gc.protectVars = FALSE;
4091 }
4092
4093 bool context_inProtectVars (void)
4094 {
4095   return (gc.protectVars);
4096 }
4097
4098 void context_hideShowscan (void) 
4099 {
4100   gc.flags[FLG_SHOWSCAN] = FALSE;
4101 }
4102
4103 void context_unhideShowscan (void)
4104 {
4105   gc.flags[FLG_SHOWSCAN] = TRUE;
4106 }
4107
4108 bool context_inHeader (void)
4109 {
4110   return (gc.inheader);
4111 }
4112
4113 fileTable context_fileTable (void)
4114 {
4115   return gc.ftab;
4116 }
4117
4118 cstring context_tmpdir (void)
4119 {
4120   return (context_getString (FLG_TMPDIR));
4121 }
4122
4123 messageLog context_messageLog (void)
4124 {
4125   return gc.msgLog;
4126 }
4127
4128 bool context_inMacroFunction (void)
4129 {
4130   return (gc.kind == CX_MACROFCN);
4131 }
4132
4133 bool context_inMacroConstant (void)
4134 {   
4135   return (gc.kind == CX_MACROCONST);
4136 }
4137
4138 bool context_inMacroUnknown (void)
4139 {   
4140   return (gc.kind == CX_UNKNOWNMACRO);
4141 }
4142
4143 void context_setShownFunction (void)
4144 {
4145   gc.showfunction = FALSE;
4146 }
4147
4148 bool context_doDump (void)
4149 {   
4150   return cstring_isNonEmpty (context_getString (FLG_DUMP));
4151 }
4152
4153 bool context_doMerge (void)
4154 {
4155   return cstring_isNonEmpty (context_getString (FLG_MERGE));
4156 }
4157
4158 cstring context_getDump (void)
4159 {           
4160   return context_getString (FLG_DUMP);
4161 }
4162
4163 cstring context_getMerge (void)
4164 {
4165   return context_getString (FLG_MERGE);
4166 }
4167
4168 # ifndef NOLCL
4169 bool context_inLCLLib (void)
4170 {   
4171   return (gc.kind == CX_LCLLIB);
4172 }
4173
4174 bool context_inImport (void)
4175 {
4176   return (gc.inimport);
4177 }
4178
4179 void context_enterImport (void)
4180
4181   gc.inimport = TRUE;
4182 }
4183
4184 void context_leaveImport (void)
4185
4186   gc.inimport = FALSE;
4187 }
4188 # endif
4189
4190 bool context_inMacro (void) 
4191 {
4192   return (gc.kind == CX_MACROFCN || gc.kind == CX_MACROCONST 
4193           || gc.kind == CX_UNKNOWNMACRO
4194           || gc.kind == CX_ITERDEF || gc.kind == CX_ITEREND);
4195 }
4196
4197 bool context_inIterDef (void)
4198 {
4199   return (gc.kind == CX_ITERDEF);
4200 }
4201
4202 bool context_inIterEnd (void)
4203 {
4204   return (gc.kind == CX_ITEREND);
4205 }
4206
4207 int context_getLinesProcessed (void)    
4208 {
4209   return (gc.linesprocessed);
4210 }
4211
4212 int context_getSpecLinesProcessed (void)    
4213 {
4214   return (gc.speclinesprocessed);
4215 }
4216
4217 # ifndef NOLCL
4218 void context_processedSpecLine (void)
4219 {
4220   gc.speclinesprocessed++;
4221 }
4222
4223 void context_resetSpecLines (void)    
4224 {
4225   gc.speclinesprocessed = 0;
4226 }
4227 # endif
4228
4229 bool context_inGlobalContext (void)
4230 {
4231   return (gc.kind == CX_GLOBAL);
4232 }
4233
4234 void context_setFileId (fileId s)
4235 {
4236   g_currentloc = fileloc_updateFileId (g_currentloc, s); 
4237 }
4238
4239 bool context_setBoolName (void)
4240 {
4241   return (!cstring_equalLit (context_getString (FLG_BOOLTYPE),
4242                              DEFAULT_BOOLTYPE));
4243 }
4244
4245 cstring context_printBoolName (void)
4246 {
4247   if (context_setBoolName ()) 
4248     {
4249       return context_getBoolName ();
4250     }
4251   else
4252     {
4253       return cstring_makeLiteralTemp ("boolean");
4254     }
4255 }
4256
4257 cstring context_getBoolName (void)
4258 {
4259   return (context_getString (FLG_BOOLTYPE));
4260 }
4261
4262 cstring context_getFalseName (void)
4263 {
4264   return (context_getString (FLG_BOOLFALSE));
4265 }
4266
4267 cstring context_getTrueName (void)
4268 {
4269   return (context_getString (FLG_BOOLTRUE));
4270 }
4271
4272 cstring context_getLarchPath (void)
4273 {
4274   return (context_getString (FLG_LARCHPATH));
4275 }
4276
4277 cstring context_getLCLImportDir (void)
4278 {
4279   return (context_getString (FLG_LCLIMPORTDIR));
4280 }
4281
4282 static void context_setJustPopped (void)
4283 {
4284   gc.justpopped = TRUE;
4285 }
4286
4287 void context_clearJustPopped (void)
4288 {
4289   gc.justpopped = FALSE;
4290 }
4291
4292 bool context_justPopped (void)
4293 {
4294   return (gc.justpopped);
4295 }
4296
4297 void context_setMacroMissingParams (void)
4298 {
4299   gc.macroMissingParams = TRUE;
4300 }
4301
4302 void context_resetMacroMissingParams (void)
4303 {
4304   gc.macroMissingParams = FALSE;
4305 }
4306
4307 bool context_isMacroMissingParams (void)
4308 {
4309   return (gc.macroMissingParams);
4310 }
4311
4312 void context_showFilelocStack (void) 
4313 {
4314   filelocStack_printIncludes (gc.locstack);
4315 }
4316
4317 metaStateTable context_getMetaStateTable (void) 
4318 {
4319   return gc.stateTable;
4320 }
4321
4322 metaStateInfo context_lookupMetaStateInfo (cstring key)
4323 {
4324   return metaStateTable_lookup (gc.stateTable, key);
4325 }
4326
4327 /*@null@*/ annotationInfo context_lookupAnnotation (cstring annot) 
4328 {
4329   annotationInfo ainfo;
4330
4331   ainfo = annotationTable_lookup (gc.annotTable, annot);
4332
4333   return ainfo;
4334 }
4335
4336 void context_addAnnotation (annotationInfo ainfo)
4337 {
4338   if (annotationTable_contains (gc.annotTable, annotationInfo_getName (ainfo)))
4339     {
4340       voptgenerror 
4341         (FLG_SYNTAX,
4342          message ("Duplicate annotation declaration: %s", annotationInfo_getName (ainfo)),
4343          annotationInfo_getLoc (ainfo));
4344
4345       annotationInfo_free (ainfo);
4346     }
4347   else
4348     {
4349       annotationTable_insert (gc.annotTable, ainfo);
4350     }
4351 }
4352
4353 void context_addMetaState (cstring mname, metaStateInfo msinfo)
4354 {
4355   if (metaStateTable_contains (gc.stateTable, mname))
4356     {
4357       voptgenerror 
4358         (FLG_SYNTAX,
4359          message ("Duplicate metastate declaration: %s", mname),
4360          metaStateInfo_getLoc (msinfo));
4361       cstring_free (mname);
4362       metaStateInfo_free (msinfo);
4363     }
4364   else
4365     {
4366       DPRINTF (("Adding meta state: %s", mname));
4367       metaStateTable_insert (gc.stateTable, mname, msinfo); 
4368     }
4369 }
4370
4371 valueTable context_createValueTable (sRef s)
4372 {
4373   if (metaStateTable_size (gc.stateTable) > 0)
4374     {
4375       valueTable res = valueTable_create (metaStateTable_size (gc.stateTable));
4376       /*@i32 should use smaller value... */
4377       DPRINTF (("Value table for: %s", sRef_unparse (s)));
4378       
4379       metaStateTable_elements (gc.stateTable, msname, msi)
4380         {
4381           mtContextNode context = metaStateInfo_getContext (msi);
4382
4383           if (mtContextNode_matchesRefStrict (context, s))
4384             {
4385               DPRINTF (("Create: %s", metaStateInfo_unparse (msi)));
4386               llassert (cstring_equal (msname, metaStateInfo_getName (msi)));
4387               
4388               valueTable_insert 
4389                 (res,
4390                  cstring_copy (metaStateInfo_getName (msi)),
4391                  stateValue_createImplicit (metaStateInfo_getDefaultValue (msi, s),
4392                                             stateInfo_undefined));
4393             }
4394           else
4395             {
4396               DPRINTF (("No match: %s", metaStateInfo_unparse (msi)));
4397             }
4398         } 
4399       end_metaStateTable_elements ;
4400       
4401       DPRINTF (("Value table: %s", valueTable_unparse (res)));
4402       return res;
4403     }
4404   else
4405     {
4406       return valueTable_undefined;
4407     }
4408 }
4409
4410 valueTable context_createGlobalMarkerValueTable ()
4411 {
4412   if (metaStateTable_size (gc.stateTable) > 0)
4413     {
4414       valueTable res = valueTable_create (metaStateTable_size (gc.stateTable));
4415       /*@i32 should use smaller value... */
4416       
4417       metaStateTable_elements (gc.stateTable, msname, msi)
4418         {
4419           /*@i23 only add global...*/
4420           DPRINTF (("Create: %s", metaStateInfo_unparse (msi)));
4421           llassert (cstring_equal (msname, metaStateInfo_getName (msi)));
4422           
4423           valueTable_insert (res,
4424                              cstring_copy (metaStateInfo_getName (msi)),
4425                              stateValue_create (metaStateInfo_getDefaultGlobalValue (msi),
4426                                                 stateInfo_undefined));
4427         } 
4428       end_metaStateTable_elements ;
4429       
4430       DPRINTF (("Value table: %s", valueTable_unparse (res)));
4431       return res;
4432     }
4433   else
4434     {
4435       return valueTable_undefined;
4436     }
4437 }
4438
4439
4440
This page took 0.404942 seconds and 5 git commands to generate.