2 ** Splint - annotation-assisted static program checker
3 ** Copyright (C) 1994-2002 University of Virginia,
4 ** Massachusetts Institute of Technology
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.
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.
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.
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://www.splint.org
28 # include "lclintMacros.nf"
33 ** from the CC man page:
35 ** -Idir Search for #include files whose names do not begin with a
36 ** slash (/) in the following order: (1) in the directory of
37 ** the dir argument, (2) in the directories specified by -I
38 ** options, (3) in the standard directory (/usr/include).
41 /* needed for string literals literals */
45 /*@null@*/ /*@observer@*/ char *name;
46 /*@null@*/ /*@observer@*/ char *describe;
49 static flagcatinfo categories[] =
51 { FK_ABSTRACT, "abstract", "abstraction violations, representation access" } ,
52 { FK_ALIAS, "aliasing", "unexpected or dangerous aliasing" } ,
53 { FK_USE, "alluse", "all declarations are used" } ,
54 { FK_ANSI, "ansi", "violations of constraints imposed by ANSI/ISO standard" } ,
55 { FK_ARRAY, "arrays", "special checking involving arrays" } ,
56 { FK_BOOL, "booleans", "checking and naming of boolean types" } ,
57 { FK_COMMENTS, "comments", "interpretation of semantic comments" } ,
58 { FK_COMPLETE, "complete", "completely defined, used, or specified system" } ,
59 { FK_CONTROL, "controlflow", "suspicious control structures" } ,
60 { FK_DEBUG, "debug", "flags for debugging lclint" } ,
61 { FK_DECL, "declarations", "consistency of declarations" } ,
62 { FK_DEF, "definition", "undefined storage errors" } ,
63 { FK_DIRECT, "directories", "set directores" } ,
64 { FK_DISPLAY, "display", "control what is displayed" } ,
65 { FK_EFFECT, "effect", "statements with no effects" } ,
66 { FK_ERRORS, "errors", "control expected errors, summary reporting" } ,
67 { FK_EXPORT, "export", "control what may be exported" } ,
68 { FK_EXPOSURE, "exposure", "representation exposure" } ,
69 { FK_FILES, "files", "control system files" } ,
70 { FK_FORMAT, "format", "control format of warning messages" } ,
71 { FK_GLOBALS, "globals", "use of global and file static variables" },
72 { FK_HEADERS, "headers", "control inclusion and generation of header files" },
73 { FK_HELP, "help", "on-line help" },
74 { FK_IMPLICIT, "implicit", "control implicit annotations and interpretations" } ,
75 { FK_INIT, "initializations", "initialization files" } ,
76 { FK_ITER, "iterators", "checking iterator definitions and uses" } ,
77 { FK_LEAK, "leaks", "memory leaks" } ,
78 { FK_LIBS, "libraries", "loading and dumping of user and standard libraries" } ,
79 { FK_LIMITS, "limits", "violations of set limits" } ,
80 { FK_MACROS, "macros", "expansion, definition and use of macros" },
81 { FK_MEMORY, "memory", "memory management" } ,
82 { FK_MODIFIES, "modification", "modification errors" } ,
83 { FK_NAMES, "names", "naming conventions and limits" } ,
84 { FK_NULL, "null", "misuses of null pointers" } ,
85 { FK_NUMBERS, "numbers", "control type-checking of numeric types" } ,
86 { FK_OPS, "operations", "checking of primitive operations" } ,
87 { FK_PARAMS, "parameters", "function and macro parameters" } ,
88 { FK_SPEED, "performance", "speeding up checking" } ,
89 { FK_POINTER, "pointers", "pointers" } ,
90 { FK_PRED, "predicates", "condition test expressions" } ,
91 { FK_PREFIX, "prefixes", "set naming prefixes and control checking" } ,
92 { FK_PREPROC, "preproc", "defines and undefines for the preprocessor" } ,
93 { FK_PROTOS, "prototypes", "function prototypes" } ,
94 { FK_DEAD, "released", "using storage that has been deallocated" } ,
95 { FK_IGNORERET, "returnvals", "ignored return values" },
96 { FK_SECURITY, "security", "possible security vulnerability" },
97 { FK_SPEC, "specifications", "checks involving .lcl specifications" } ,
98 { FK_SUPPRESS, "suppress", "local and global suppression of messages" } ,
99 { FK_TYPEEQ, "typeequivalence", "control what types are equivalent" } ,
100 { FK_BEHAVIOR, "undefined", "code with undefined or implementation-defined behavior" } ,
101 { FK_UNRECOG, "unrecognized", "unrecognized identifiers" } ,
102 { FK_UNSPEC, "unconstrained", "checking in the presence of unconstrained functions" } ,
103 { FK_WARNUSE, "warnuse", "use of possibly problematic function" } ,
104 { FK_SYNTAX, NULL, NULL } ,
105 { FK_TYPE, NULL, NULL } ,
106 { FK_SECRET, NULL, NULL } ,
107 { FK_OBSOLETE, NULL, NULL } ,
108 { FK_NONE, NULL, NULL } /* must be last */
121 bool isSpecial; /* setting this flag may set other flags (or values) */
122 bool isIdem; /* idempotent - always sets to TRUE */
123 bool isGlobal; /* cannot be set locally (using control comments) */
124 bool isModeFlag; /* set by modes */
126 /*@observer@*/ char *flag;
128 /*@observer@*/ /*@null@*/ char *desc;
134 typedef fflag flaglist[];
136 # include "flags.def"
138 /*@iter allFlags (yield observer fflag f); @*/
139 # define allFlags(m_f) \
140 { /*@+enumint@*/ flagcode m_i; for (m_i = 0; m_i < NUMFLAGS; m_i++) { fflag m_f = flags[m_i]; /*@=enumint@*/
141 # define end_allFlags }}
143 static bn_mstring mode_names[] =
145 "weak", "standard", "checks", "strict", NULL,
148 /*@iter allModes (yield bn_mstring modename)@*/
149 # define allModes(m_m) \
150 { int m_ii = 0; while (mstring_isDefined (mode_names[m_ii])) \
151 { bn_mstring m_m = mode_names[m_ii]; m_ii++;
153 # define end_allModes }}
157 static cstring describeFlagCode (flagcode p_flag) /*@*/ ;
158 static cstringSList sortedFlags (void) /*@*/ ;
159 static /*@observer@*/ cstring categoryName (flagkind p_kind) /*@*/ ;
161 static flagcode flags_identifyFlagAux (cstring p_s, bool p_quiet) /*@modifies g_msgstream@*/ ;
164 static /*@unused@*/ cstring listModes (void) /*@*/ ;
167 bool flagcode_isSpecialFlag (flagcode f)
169 return (flags[f].isSpecial);
172 bool flagcode_isGlobalFlag (flagcode f)
174 return (flags[f].isGlobal);
177 bool flagcode_isIdemFlag (flagcode f)
179 return (flags[f].isIdem);
182 bool flagcode_isModeFlag (flagcode f)
184 return (flags[f].isModeFlag);
187 bool flagcode_isNameChecksFlag (flagcode f)
189 return (flags[f].main == FK_NAMES);
193 ** Internal consistency check on the flags.
196 void flags_initMod ()
201 if (flags[code].code != code)
204 "*** ERROR: inconsistent flag %s / %d / %d",
206 flags[code].code, code);
208 llbug (message ("*** ERROR: inconsistent flag %s / %d / %d",
209 cstring_fromChars (flags[code].flag),
210 flags[code].code, code));
223 char *buf = mstring_create (128);
227 if (f.nreported > 0 || f.nsuppressed > 0)
229 int nrep = f.nreported;
230 int nsup = f.nsuppressed;
231 cstring fs = cstring_fill (cstring_fromChars (f.flag), 23);
235 llmsgplain (cstring_makeLiteral
236 ("\nError Type Reported Suppressed\n"
237 "=================== ======== ========="));
241 sprintf (buf, "%s%7d %9d", cstring_toCharsSafe (fs), nrep, nsup);
247 llmsg (cstring_copy (cstring_fromChars (buf)));
253 cstring ts = cstring_fill (cstring_makeLiteralTemp ("Total"), 23);
255 llmsglit (" ======== =========");
257 sprintf (buf, "%s%7d %9d", cstring_toCharsSafe (ts), sumrep, sumsup);
259 llmsgplain (cstring_copy (cstring_fromChars (buf)));
268 flagcode_recordError (flagcode f)
270 if (f != INVALID_FLAG)
272 if (f == FLG_WARNFLAGS)
274 ; /* don't count these */
278 flags[f].nreported = flags[f].nreported + 1;
283 llcontbug (message ("flagcode_recordError: invalid flag: %d", (int) f));
288 flagcode_recordSuppressed (flagcode f)
290 llassertprint (f != INVALID_FLAG, ("flagcode: %s", flagcode_unparse (f)));
292 flags[f].nsuppressed = flags[f].nsuppressed + 1;
296 flagcode_numReported (flagcode f)
298 llassert (f != INVALID_FLAG);
300 return (flags[f].nreported);
303 /*@observer@*/ cstring
304 flagcodeHint (flagcode f)
306 llassert (f != INVALID_FLAG);
308 if (mstring_isDefined (flags[f].hint))
310 return (cstring_fromChars (flags[f].hint));
314 return (cstring_fromChars (flags[f].desc));
318 static int categorySize (flagkind kind) /*@*/
325 if (f.main == kind || f.sub == kind)
334 flagkind identifyCategory (cstring s)
338 for (i = 0; categories[i].kind != FK_NONE; i++)
340 if (mstring_isDefined (categories[i].name))
342 if (cstring_equalLit (s, categories[i].name))
344 return categories[i].kind;
352 static /*@observer@*/ cstring categoryName (flagkind kind)
356 for (i = 0; categories[i].kind != FK_NONE; i++)
358 if (categories[i].kind == kind)
360 return (cstring_fromChars (categories[i].name));
364 return (cstring_makeLiteralTemp ("<No Category>"));
367 static int categoryIndex (flagkind kind)
371 for (i = 0; categories[i].kind != FK_NONE; i++)
373 if (categories[i].kind == kind)
382 void printCategory (flagkind kind)
384 int index = categoryIndex (kind);
386 llassert (index >= 0);
388 llmsg (message ("%s (%d flags)\n\3%s\n\n",
389 cstring_fromChars (categories[index].name),
391 cstring_fromChars (categories[index].describe)));
395 if (f.main == kind || f.sub == kind)
397 llmsg (message (" %s\n\6%q", cstring_fromChars (f.flag),
398 describeFlagCode (f.code)));
404 listAllCategories (void)
408 for (i = 0; categories[i].kind != FK_NONE; i++)
410 flagkind kind = categories[i].kind ;
412 if (categories[i].describe != NULL)
414 llmsg (message ("%s (%d flags)\n\3%s",
417 cstring_fromChars (categories[i].describe)));
423 printAllFlags (bool desc, bool full)
427 cstringSList fl = sortedFlags ();
429 cstringSList_elements (fl, el)
431 llmsg (message ("%q\n\n", describeFlag (el)));
432 } end_cstringSList_elements ;
434 cstringSList_free (fl);
440 if (f.code != INVALID_FLAG && f.main != FK_OBSOLETE)
442 if (mstring_isDefined (f.desc))
446 llmsg (message ("%s --- %s", cstring_fromChars (f.flag),
447 cstring_fromChars (f.desc)));
456 describeFlagCode (flagcode flag)
458 cstring ret = cstring_undefined;
461 if (flagcode_isInvalid (flag))
463 return (cstring_makeLiteral ("<invalid>"));
466 context_resetAllFlags ();
469 ret = cstring_copy (cstring_fromChars (f.desc));
472 if (f.sub != FK_NONE)
474 ret = message ("%q\nCategories: %s, %s",
476 categoryName (f.main),
477 categoryName (f.sub));
481 if (f.main != FK_NONE)
483 cstring cname = categoryName (f.main);
485 if (cstring_isDefined (cname))
487 ret = message ("%q\nCategory: %s",
499 context_setMode (cstring_fromChars (mname));
503 ret = message ("%q\nMode Settings: %s %s",
504 ret, cstring_fromChars (mname),
505 cstring_makeLiteralTemp
506 (context_getFlag (flag) ? "+" : "-"));
511 ret = message ("%q, %s %s",
512 ret, cstring_fromChars (mname),
513 cstring_makeLiteralTemp
514 (context_getFlag (flag) ? "+" : "-"));
520 ret = message ("%q\nDefault Setting: %s",
522 cstring_makeLiteralTemp
523 (context_getFlag (flag) ? "+" : "-"));
528 ret = message("%q\nSet globally only", ret);
532 ret = message("%q\nSet locally", ret);
541 if (flag == FLG_COMMENTCHAR)
543 ret = message("%q\nCharacter Argument. Default: %h",
544 ret, (char) context_getValue (flag));
548 ret = message("%q\nNumeric Argument. Default: %d",
550 context_getValue (flag));
554 if (cstring_isDefined (context_getString (flag)))
556 ret = message("%q\nString Argument. Default: %s",
558 context_getString (flag));
562 ret = message("%q\nString Argument. No default.", ret);
567 if (mstring_isDefined (f.hint))
569 ret = message("%q\n\3%s", ret, cstring_fromChars (f.hint));
576 describeFlag (cstring flagname)
578 cstring oflagname = cstring_copy (flagname);
579 flagcode f = flags_identifyFlag (flagname);
581 if (flagcode_isSkip (f))
583 cstring_free (oflagname);
584 return cstring_undefined;
586 else if (flagcode_isValid (f))
588 if (cstring_equal (flagname, oflagname))
590 cstring_free (oflagname);
591 return (message ("%s\n\3%q", flagname, describeFlagCode (f)));
595 return (message ("%q (standardized name: %s)\n\3%q",
596 oflagname, flagname, describeFlagCode (f)));
601 if (isMode (flagname))
603 cstring_free (oflagname);
606 (message ("%s: predefined mode (see User's Guide for information)",
611 return (message ("%q: <invalid flag>", oflagname));
619 cstringSList s = cstringSList_new ();
625 s = cstringSList_add (s, cstring_fromChars (f.flag));
629 cstringSList_alphabetize (s);
634 void printAlphaFlags ()
636 cstringSList fl = sortedFlags ();
638 cstringSList_printSpaced (fl, 3, 1, context_getLineLen () - 25);
639 cstringSList_free (fl);
642 /*@observer@*/ cstring
643 flagcode_unparse (flagcode code)
645 if (code == INVALID_FLAG)
647 return cstring_makeLiteralTemp ("<invalid flag>");
650 return cstring_fromChars (flags[code].flag);
654 ** Transforms a flag into its cannonical form.
656 ** The following transformations are made:
662 ** parameter -> param
663 ** unrecognized -> unrecog
665 ** declaration -> decl
666 ** globalias -> (no change)
674 ** unconstrained -> unspec
681 canonicalizeFlag (cstring s)
684 static bn_mstring transform[] =
690 "parameter", "param",
691 "unrecognized", "unrecog",
693 "declaration", "decl",
701 "unconstrained", "uncon",
711 while ((current = transform[i]) != NULL)
713 if (cstring_containsLit (s, current))
715 cstring_replaceLit (s, current, transform[i+1]);
720 /* remove whitespace, -'s, and _'s */
721 cstring_stripChars (s, " -_");
725 flags_identifyFlag (cstring s)
727 return flags_identifyFlagAux (s, FALSE);
731 flags_identifyFlagQuiet (cstring s)
733 return flags_identifyFlagAux (s, TRUE);
737 flags_identifyFlagAux (cstring s, bool quiet)
739 if (cstring_length (s) == 0) {
740 /* evs 2000-06-25: A malformed flag. */
744 if (cstring_firstChar (s) == 'I')
746 return FLG_INCLUDEPATH; /* no space after -I */
749 if (cstring_firstChar (s) == 'S')
751 return FLG_SPECPATH; /* no space after -S */
754 if (cstring_firstChar (s) == 'D')
756 return FLG_DEFINE; /* no space after -D */
759 if (cstring_firstChar (s) == 'U')
761 return FLG_UNDEFINE; /* no space after -D */
764 canonicalizeFlag (s);
768 if (cstring_equal (cstring_fromChars (f.flag), s))
778 if (cstring_equalLit (s, "pred"))
783 if (cstring_equalLit (s, "modobserverstrict"))
785 return FLG_MODOBSERVERUNCON;
788 if (cstring_equalLit (s, "czechnames"))
793 if (cstring_equalLit (s, "slovaknames"))
798 if (cstring_equalLit (s, "czechoslovaknames"))
800 return FLG_CZECHOSLOVAK;
803 if (cstring_equalLit (s, "globunspec")
804 || cstring_equalLit (s, "globuncon"))
806 return FLG_GLOBUNSPEC;
809 if (cstring_equalLit (s, "modglobsunspec")
810 || cstring_equalLit (s, "modglobsuncon")
811 || cstring_equalLit (s, "modglobsnomods"))
813 return FLG_MODGLOBSUNSPEC;
816 if (cstring_equalLit (s, "export"))
818 return FLG_EXPORTANY;
821 if (cstring_equalLit (s, "macrospec"))
823 return FLG_MACRODECL;
826 if (cstring_equalLit (s, "ansireservedlocal"))
828 return FLG_ANSIRESERVEDLOCAL;
831 if (cstring_equalLit (s, "warnposix"))
833 return FLG_WARNPOSIX;
836 if (cstring_equalLit (s, "defuse"))
841 if (cstring_equalLit (s, "macroundef"))
843 return FLG_MACROUNDEF;
846 if (cstring_equalLit (s, "showcol"))
851 if (cstring_equalLit (s, "intbool"))
856 if (cstring_equalLit (s, "intchar"))
861 if (cstring_equalLit (s, "intenum"))
867 ** For our European friends...
870 if (cstring_equalLit (s, "isolib"))
875 if (cstring_equalLit (s, "isostrictlib"))
877 return FLG_STRICTLIB;
880 if (cstring_equalLit (s, "ansistrictlib"))
882 return FLG_STRICTLIB;
885 if (cstring_equalLit (s, "skipisoheaders"))
887 return FLG_SKIPANSIHEADERS;
890 if (cstring_equalLit (s, "isoreserved"))
892 return FLG_ANSIRESERVED;
895 if (cstring_equalLit (s, "isoreservedinternal"))
897 return FLG_ANSIRESERVEDLOCAL;
900 if (cstring_equalLit (s, "isolimits"))
902 return FLG_ANSILIMITS;
909 if (cstring_equalLit (s, "accessunspec"))
915 ("accessunspec flag is no longer supported. It has been replaced by accessmodule, accessfile and "
916 "accessfunction to provide more precise control of accessibility "
917 "of representations. For more information, "
918 "see lclint -help accessmodule"));
923 else if (cstring_equalLit (s, "staticmods"))
929 ("staticmods flag is obsolete. You probably "
930 "want impcheckmodstatics. For more information, "
931 "see lclint -help impcheckmodstatics"));
936 else if (cstring_equalLit (s, "bool"))
941 (cstring_makeLiteral ("bool flag is obsolete. It never really "
942 "made sense in the first place."));
947 else if (cstring_equalLit (s, "shiftsigned"))
952 (cstring_makeLiteral ("shiftsigned flag is obsolete. You probably "
953 "want bitwisesigned, shiftnegative or shiftsize."));
958 else if (cstring_equalLit (s, "ansi"))
963 (cstring_makeLiteral ("ansi flag is obsolete. You probably "
964 "want noparams and/or oldstyle."));
969 else if (cstring_equalLit (s, "stdio"))
975 ("stdio flag is obsolete. You may "
976 "want strictlib or one of the gloabls "
977 "checking flags. For more information, "
978 "see lclint -help strictlib or lclint -help flags globals"));
989 void setValueFlag (flagcode opt, cstring arg)
997 case FLG_INDENTSPACES:
999 case FLG_EXTERNALNAMELEN:
1000 case FLG_INTERNALNAMELEN:
1001 case FLG_CONTROLNESTDEPTH:
1002 case FLG_STRINGLITERALLEN:
1003 case FLG_NUMSTRUCTFIELDS:
1004 case FLG_NUMENUMMEMBERS:
1005 case FLG_INCLUDENEST:
1007 int val = cstring_toPosInt (arg);
1014 ("Flag %s must be followed by a positive number number. "
1016 flagcode_unparse (opt), arg));
1020 context_setValueAndFlag (opt, val);
1024 case FLG_COMMENTCHAR:
1026 if (cstring_length (arg) != 1)
1030 ("Flag %s should be followed by a single character. Followed by %s",
1031 flagcode_unparse (opt), arg));
1035 context_setCommentMarkerChar (cstring_firstChar (arg));
1043 void setStringFlag (flagcode opt, /*@only@*/ cstring arg)
1049 if (cstring_lastChar (arg) == CONNECTCHAR)
1051 context_setString (opt, arg);
1055 context_setString (opt, cstring_appendChar (arg, CONNECTCHAR));
1061 context_setString (opt, arg);
1070 cstring s = cstring_makeLiteral ("Flag ");
1071 cstringSList sflags = sortedFlags ();
1075 s = message ("%q%9s", s, cstring_fromChars (modename));
1078 s = message ("%q\n", s);
1080 cstringSList_elements (sflags, flagname)
1082 flagcode code = flags_identifyFlag (flagname);
1083 fflag currentflag = flags[code];
1085 if (mstring_isDefined (currentflag.desc) && flagcode_isModeFlag (code))
1087 s = message ("%q\n%27s", s,
1088 cstring_fromChars (currentflag.flag));
1092 context_setMode (cstring_fromChars (modename));
1094 if (context_getFlag (code))
1096 s = message ("%q%9s", s, cstring_makeLiteralTemp ("+"));
1100 s = message ("%q%9s", s, cstring_makeLiteralTemp (" "));
1103 context_resetModeFlags ();
1106 } end_cstringSList_elements;
1108 cstringSList_free (sflags);
1110 s = cstring_appendChar (s, '\n');
1116 static /*@unused@*/ cstring
1119 cstring s = cstring_makeLiteral ("\t");
1124 if (i != 0 && (i % 4 == 0))
1126 s = message ("%q\n\t%15s", s, cstring_fromChars (modename));
1130 s = message ("%q%15s", s, cstring_fromChars (modename));
1144 if (mstring_isDefined (modename))
1146 if (cstring_equalLit (s, modename))
1156 extern bool flagcode_hasArgument (flagcode f)
1158 return (flags[f].argtype != ARG_NONE);
1161 extern bool flagcode_hasValue (flagcode f)
1163 return (flags[f].argtype == ARG_VALUE);
1166 extern bool flagcode_hasString (flagcode f)
1168 return (flags[f].argtype == ARG_STRING);
1171 extern int flagcode_valueIndex (flagcode f)
1173 /*@unchecked@*/ static bool initialized = FALSE;
1175 /*@unchecked@*/ static flagcode valueFlags[NUMVALUEFLAGS];
1183 if (flagcode_hasValue (code))
1185 llassert (nv < NUMVALUEFLAGS);
1186 DPRINTF (("Value flag: %s [%d]", flagcode_unparse (code), (int) code));
1187 valueFlags[nv] = code;
1192 llassertprint (nv == NUMVALUEFLAGS,
1193 ("Number of value flags: %d (expected %d)",
1194 nv, (int) NUMVALUEFLAGS));
1198 for (i = 0; i < NUMVALUEFLAGS; i++)
1200 /* static valueFlags must be defined */
1201 /*@-usedef@*/ if (f == valueFlags[i]) /*@=usedef@*/
1207 fprintf (stderr, "Cannot find value flag: %d", (int) f);
1208 exit (EXIT_FAILURE);
1209 /* Cannot do this...might call recursively...
1210 llfatalbug (message ("Cannot fine value flag: %d", (int) f));
1215 extern int flagcode_stringIndex (flagcode f)
1217 /*@unchecked@*/ static bool initialized = FALSE;
1218 /*@unchecked@*/ static flagcode stringFlags[NUMSTRINGFLAGS];
1228 if (flagcode_hasString (code))
1230 llassertprint (nv < NUMSTRINGFLAGS, ("Incorrect number of string flags: %d (need at least %d)", NUMSTRINGFLAGS, nv));
1231 stringFlags[nv] = code;
1236 llassertprint (nv == NUMSTRINGFLAGS,
1237 ("number of string flags: %d (expected %d)",
1238 nv, NUMSTRINGFLAGS));
1242 for (i = 0; i < NUMSTRINGFLAGS; i++)
1244 /*@-usedef@*/ if (f == stringFlags[i]) /*@=usedef@*/
1250 llbug (message ("Bad string flag: %s", flagcode_unparse (f)));
1254 bool flagcode_isNamePrefixFlag (flagcode f)
1258 case FLG_MACROVARPREFIX:
1260 case FLG_ENUMPREFIX:
1261 case FLG_FILESTATICPREFIX:
1262 case FLG_GLOBPREFIX:
1263 case FLG_TYPEPREFIX:
1264 case FLG_EXTERNALPREFIX:
1265 case FLG_LOCALPREFIX:
1266 case FLG_UNCHECKEDMACROPREFIX:
1267 case FLG_CONSTPREFIX:
1268 case FLG_ITERPREFIX:
1269 case FLG_DECLPARAMPREFIX: