Main Page   Alphabetical List   Compound List   File List   Compound Members   File Members  

flags.c File Reference

#include "lclintMacros.nf"
#include "basic.h"
#include "portab.h"
#include "flags.def"

Go to the source code of this file.

Compounds

struct  fflag
struct  flagcatinfo

Defines

#define allFlags(m_f)
#define end_allFlags   }}
#define allModes(m_m)
#define end_allModes   }}

Typedefs

typedef fflag flaglist []

Enumerations

enum  argcode { ARG_NONE, ARG_VALUE, ARG_STRING, ARG_SPECIAL }

Functions

bool flagcode_isSpecialFlag (flagcode f)
bool flagcode_isGlobalFlag (flagcode f)
bool flagcode_isIdemFlag (flagcode f)
bool flagcode_isModeFlag (flagcode f)
bool flagcode_isNameChecksFlag (flagcode f)
void flags_initMod ()
void summarizeErrors ()
void flagcode_recordError (flagcode f)
void flagcode_recordSuppressed (flagcode f)
int flagcode_numReported (flagcode f)
cstring flagcodeHint (flagcode f)
flagkind identifyCategory (cstring s)
void printCategory (flagkind kind)
void listAllCategories (void)
void printAllFlags (bool desc, bool full)
cstring describeFlag (cstring flagname)
void printAlphaFlags ()
cstring flagcode_name (flagcode code)
flagcode identifyFlag (cstring s)
void setValueFlag (flagcode opt, cstring arg)
void setStringFlag (flagcode opt, cstring arg)
cstring describeModes ()
bool isMode (cstring s)
bool flagcode_hasArgument (flagcode f)
bool flagcode_hasValue (flagcode f)
bool flagcode_hasString (flagcode f)
int flagcode_valueIndex (flagcode f)
int flagcode_stringIndex (flagcode f)
bool flagcode_isNamePrefixFlag (flagcode f)


Define Documentation

#define allFlags( m_f )
 

Initializer:

\
  {   flagcode m_i; for (m_i = 0; m_i < NUMFLAGS; m_i++) { fflag m_f = flags[m_i];

Definition at line 137 of file flags.c.

Referenced by identifyFlag(), printAllFlags(), printCategory(), and summarizeErrors().

#define allModes( m_m )
 

Initializer:

\
  { int m_ii = 0; while (mstring_isDefined (mode_names[m_ii])) \
      { bn_mstring m_m = mode_names[m_ii]; m_ii++;

Definition at line 147 of file flags.c.

Referenced by describeModes(), and isMode().

#define end_allFlags   }}
 

Definition at line 139 of file flags.c.

#define end_allModes   }}
 

Definition at line 151 of file flags.c.


Typedef Documentation

typedef fflag flaglist[]
 

Definition at line 132 of file flags.c.


Enumeration Type Documentation

enum argcode
 

Enumeration values:
ARG_NONE  
ARG_VALUE  
ARG_STRING  
ARG_SPECIAL  

Definition at line 109 of file flags.c.

00109              {
00110   ARG_NONE,
00111   ARG_VALUE,
00112   ARG_STRING,
00113   ARG_SPECIAL
00114 }


Function Documentation

cstring describeFlag ( cstring flagname )
 

Definition at line 564 of file flags.c.

Referenced by main().

00565 {
00566   cstring oflagname = cstring_copy (flagname);
00567   flagcode f = identifyFlag (flagname);
00568 
00569   if (flagcode_isSkip (f))
00570     {
00571       cstring_free (oflagname);
00572       return cstring_undefined;
00573     }
00574   else if (flagcode_isValid (f))
00575     {
00576       if (cstring_equal (flagname, oflagname))
00577         {
00578           cstring_free (oflagname);
00579           return (message ("%s\n\3%q", flagname, describeFlagCode (f)));
00580         }
00581       else
00582         {
00583           return (message ("%q (standardized name: %s)\n\3%q",
00584                            oflagname, flagname, describeFlagCode (f)));
00585         }
00586     }
00587   else
00588     {
00589       if (isMode (flagname))
00590         {
00591           cstring_free (oflagname);
00592 
00593           return
00594             (message ("%s: predefined mode (see User's Guide for information)",
00595                       flagname));
00596         }
00597       else
00598         {
00599           return (message ("%q: <invalid flag>", oflagname));
00600         }
00601     }
00602 }

cstring describeModes ( )
 

Definition at line 1013 of file flags.c.

01014 {
01015   cstring s = cstring_makeLiteral ("Flag                    ");
01016   cstringSList sflags = sortedFlags ();
01017 
01018   allModes (modename)
01019     {
01020       s = message ("%q%9s", s, cstring_fromChars (modename));
01021     } end_allModes;
01022   
01023   s = message ("%q\n", s);
01024 
01025   cstringSList_elements (sflags, flagname)
01026     {
01027       flagcode code = identifyFlag (flagname);
01028       fflag currentflag = flags[code];
01029       
01030       if (mstring_isDefined (currentflag.desc) && flagcode_isModeFlag (code))
01031         {
01032           s = message ("%q\n%27s", s, 
01033                        cstring_fromChars (currentflag.flag));
01034           
01035           allModes (modename)
01036             {
01037               context_setMode (cstring_fromChars (modename));
01038               
01039               if (context_getFlag (code))
01040                 {
01041                   s = message ("%q%9s", s, cstring_makeLiteralTemp ("+"));
01042                 }
01043               else
01044                 {
01045                   s = message ("%q%9s", s, cstring_makeLiteralTemp (" "));
01046                 }
01047 
01048               context_resetModeFlags ();
01049             } end_allModes;
01050         }
01051     } end_cstringSList_elements;
01052   
01053   cstringSList_free (sflags);
01054 
01055   s = cstring_appendChar (s, '\n');
01056 
01057   return (s);
01058 }

cstring flagcodeHint ( flagcode f )
 

Definition at line 292 of file flags.c.

00293 {
00294   llassert (f != INVALID_FLAG);
00295 
00296   if (mstring_isDefined (flags[f].hint))
00297     {
00298       return (cstring_fromChars (flags[f].hint));
00299     }
00300   else
00301     {
00302       return (cstring_fromChars (flags[f].desc));
00303     }
00304 }

bool flagcode_hasArgument ( flagcode f )
 

Definition at line 1099 of file flags.c.

Referenced by context_userSetFlag(), and main().

01100 {
01101   return (flags[f].argtype != ARG_NONE);
01102 }

bool flagcode_hasString ( flagcode f )
 

Definition at line 1109 of file flags.c.

Referenced by context_resetAllFlags(), flagcode_stringIndex(), and main().

01110 {
01111   return (flags[f].argtype == ARG_STRING);
01112 }

bool flagcode_hasValue ( flagcode f )
 

Definition at line 1104 of file flags.c.

Referenced by context_resetAllFlags(), flagcode_valueIndex(), and main().

01105 {
01106   return (flags[f].argtype == ARG_VALUE);
01107 }

bool flagcode_isGlobalFlag ( flagcode f )
 

Definition at line 165 of file flags.c.

00166 {
00167   return (flags[f].isGlobal);
00168 }

bool flagcode_isIdemFlag ( flagcode f )
 

Definition at line 170 of file flags.c.

Referenced by DOSET(), and context_userSetFlag().

00171 {
00172   return (flags[f].isIdem);
00173 }

bool flagcode_isModeFlag ( flagcode f )
 

Definition at line 175 of file flags.c.

Referenced by context_resetModeFlags(), context_setMode(), and describeModes().

00176 {
00177   return (flags[f].isModeFlag);
00178 }

bool flagcode_isNameChecksFlag ( flagcode f )
 

Definition at line 180 of file flags.c.

Referenced by flagMarkerList_suppressError().

00181 {
00182   return (flags[f].main == FK_NAMES);
00183 }

bool flagcode_isNamePrefixFlag ( flagcode f )
 

Definition at line 1192 of file flags.c.

01193 {
01194   switch (f)
01195     {
01196     case FLG_MACROVARPREFIX:
01197     case FLG_TAGPREFIX:
01198     case FLG_ENUMPREFIX:
01199     case FLG_FILESTATICPREFIX:
01200     case FLG_GLOBPREFIX:
01201     case FLG_TYPEPREFIX:
01202     case FLG_EXTERNALPREFIX:
01203     case FLG_LOCALPREFIX:
01204     case FLG_UNCHECKEDMACROPREFIX:
01205     case FLG_CONSTPREFIX:
01206     case FLG_ITERPREFIX:
01207     case FLG_DECLPARAMPREFIX:
01208       return TRUE;
01209     default:
01210       return FALSE;
01211     }
01212 }

bool flagcode_isSpecialFlag ( flagcode f )
 

Definition at line 160 of file flags.c.

Referenced by DOSET(), and context_userSetFlag().

00161 {
00162   return (flags[f].isSpecial);
00163 }

cstring flagcode_name ( flagcode code )
 

Definition at line 630 of file flags.c.

Referenced by context_userSetFlag(), and flagMarker_unparse().

00631 {
00632   return cstring_fromChars (flags[code].flag);
00633 }

int flagcode_numReported ( flagcode f )
 

Definition at line 284 of file flags.c.

00285 {
00286   llassert (f != INVALID_FLAG);
00287 
00288   return (flags[f].nreported);
00289 }

void flagcode_recordError ( flagcode f )
 

Definition at line 256 of file flags.c.

Referenced by llforceerror(), llgenerror(), llgenhinterror(), llgloberror(), llnoptgenerror(), lloptgenerror(), optgenerror2(), and optgenerror2n().

00257 {
00258   if (f != INVALID_FLAG)
00259     {
00260       if (f == FLG_WARNFLAGS)
00261         {
00262           ; /* don't count these */
00263         }
00264       else
00265         {
00266           flags[f].nreported = flags[f].nreported + 1;
00267         }
00268     }
00269   else
00270     {
00271       llcontbug (message ("flagcode_recordError: invalid flag: %d", (int) f));
00272     }
00273 }

void flagcode_recordSuppressed ( flagcode f )
 

Definition at line 276 of file flags.c.

Referenced by exprNode_fromUIO(), llgenerror(), llgenhinterror(), llnoptgenerror(), lloptgenerror(), optgenerror2(), and optgenerror2n().

00277 {
00278   llassertprint (f != INVALID_FLAG, ("flagcode: %s", flagcode_unparse (f)));
00279 
00280   flags[f].nsuppressed = flags[f].nsuppressed + 1;
00281 }

int flagcode_stringIndex ( flagcode f )
 

Definition at line 1153 of file flags.c.

Referenced by context_setString().

01154 {
01155   /*@unchecked@*/ static bool initialized = FALSE;
01156   /*@unchecked@*/ static flagcode stringFlags[NUMSTRINGFLAGS];
01157   int i;
01158 
01159 
01160   if (!initialized)
01161     {
01162       int nv = 0;
01163 
01164       allFlagCodes (code)
01165         {
01166           if (flagcode_hasString (code))
01167             {
01168               llassertprint (nv < NUMSTRINGFLAGS, ("Incorrect number of string flags: %d (need at least %d)", NUMSTRINGFLAGS, nv));
01169               stringFlags[nv] = code;
01170               nv++;
01171             }
01172         } end_allFlagCodes;
01173 
01174       llassertprint (nv == NUMSTRINGFLAGS,
01175                      ("number of string flags: %d (expected %d)",
01176                       nv, NUMSTRINGFLAGS));
01177       initialized = TRUE;
01178     }
01179 
01180   for (i = 0; i < NUMSTRINGFLAGS; i++)
01181     {
01182       /*@-usedef@*/ if (f == stringFlags[i]) /*@=usedef@*/
01183         {
01184           return i;
01185         }
01186     }
01187 
01188   llbug (message ("Bad string flag: %s", flagcode_unparse (f)));
01189   BADEXIT;
01190 }

int flagcode_valueIndex ( flagcode f )
 

Definition at line 1114 of file flags.c.

Referenced by context_decCounter(), context_getCounter(), context_getValue(), and context_incCounter().

01115 {
01116   /*@unchecked@*/ static bool initialized = FALSE;
01117   int i;
01118   /*@unchecked@*/ static flagcode valueFlags[NUMVALUEFLAGS];
01119 
01120   
01121   if (!initialized)
01122     {
01123       int nv = 0;
01124 
01125       allFlagCodes (code)
01126         {
01127           if (flagcode_hasValue (code))
01128             {
01129               llassert (nv < NUMVALUEFLAGS);
01130               valueFlags[nv] = code;
01131                       nv++;
01132             }
01133         } end_allFlagCodes;
01134 
01135       llassertprint (nv == NUMVALUEFLAGS,
01136                      ("number of value flags: %d (expected %d)",
01137                       nv, NUMVALUEFLAGS));
01138       initialized = TRUE;
01139     }
01140 
01141   for (i = 0; i < NUMVALUEFLAGS; i++)
01142     {
01143       /* static valueFlags must be defined */
01144       /*@-usedef@*/ if (f == valueFlags[i]) /*@=usedef@*/
01145         {
01146           return i;
01147         }
01148     }
01149 
01150   BADEXIT;
01151 }

void flags_initMod ( )
 

Definition at line 189 of file flags.c.

Referenced by main().

00190 {
00191   allFlagCodes (code)
00192     {
00193       /*@+enumint@*/
00194       if (flags[code].code != code)
00195         {
00196           llbug (message ("*** ERROR: inconsistent flag %s / %d / %d", 
00197                           cstring_fromChars (flags[code].flag),
00198                           flags[code].code, code));
00199         }
00200       /*@=enumint@*/
00201     } end_allFlagCodes;
00202 }

flagkind identifyCategory ( cstring s )
 

Definition at line 322 of file flags.c.

Referenced by main().

00323 {
00324   int i;
00325 
00326   for (i = 0; categories[i].kind != FK_NONE; i++)
00327     {
00328       if (mstring_isDefined (categories[i].name))
00329         {
00330           if (cstring_equalLit (s, categories[i].name))
00331             {
00332               return categories[i].kind;
00333             }
00334         }
00335     }
00336 
00337   return FK_NONE;
00338 }

flagcode identifyFlag ( cstring s )
 

Definition at line 707 of file flags.c.

Referenced by describeFlag(), describeModes(), and main().

00708 {
00709   if (cstring_length (s) == 0) {
00710     /* evs 2000-06-25: A malformed flag. */
00711     return INVALID_FLAG;
00712   }
00713 
00714   if (cstring_firstChar (s) == 'I')
00715     {
00716       return FLG_INCLUDEPATH; /* no space after -I */
00717     }
00718 
00719   if (cstring_firstChar (s) == 'S') 
00720     {
00721       return FLG_SPECPATH;    /* no space after -S */
00722     }
00723 
00724   if (cstring_firstChar (s) == 'D') 
00725     {
00726       return FLG_DEFINE;      /* no space after -D */
00727     }
00728 
00729   if (cstring_firstChar (s) == 'U') 
00730     {
00731       return FLG_UNDEFINE;    /* no space after -D */
00732     }
00733 
00734   canonicalizeFlag (s);
00735 
00736   allFlags (f)
00737     {
00738       if (cstring_equal (cstring_fromChars (f.flag), s))
00739         {
00740           return (f.code);
00741         }
00742     } end_allFlags;
00743 
00744   /*
00745   ** Synonyms
00746   */
00747 
00748   if (cstring_equalLit (s, "pred"))
00749     {
00750       return FLG_PREDBOOL;
00751     }
00752 
00753   if (cstring_equalLit (s, "modobserverstrict"))
00754     {
00755       return FLG_MODOBSERVERUNCON;
00756     }
00757 
00758   if (cstring_equalLit (s, "czechnames"))
00759     {
00760       return FLG_CZECH;
00761     }
00762 
00763   if (cstring_equalLit (s, "slovaknames"))
00764     {
00765       return FLG_SLOVAK;
00766     }
00767 
00768   if (cstring_equalLit (s, "czechoslovaknames"))
00769     {
00770       return FLG_CZECHOSLOVAK;
00771     }
00772 
00773   if (cstring_equalLit (s, "globunspec")
00774            || cstring_equalLit (s, "globuncon"))
00775     {
00776       return FLG_GLOBUNSPEC;
00777     }
00778 
00779   if (cstring_equalLit (s, "modglobsunspec")
00780            || cstring_equalLit (s, "modglobsuncon")
00781            || cstring_equalLit (s, "modglobsnomods"))
00782     {
00783       return FLG_MODGLOBSUNSPEC;
00784     }
00785 
00786   if (cstring_equalLit (s, "export"))
00787     {
00788       return FLG_EXPORTANY;
00789     }
00790 
00791   if (cstring_equalLit (s, "macrospec"))
00792     {
00793       return FLG_MACRODECL;
00794     }
00795   
00796   if (cstring_equalLit (s, "ansireservedlocal"))
00797     {
00798       return FLG_ANSIRESERVEDLOCAL;
00799     }
00800 
00801   if (cstring_equalLit (s, "warnposix"))
00802     {
00803       return FLG_WARNPOSIX;
00804     }
00805 
00806   if (cstring_equalLit (s, "defuse"))
00807     {
00808       return FLG_USEDEF;
00809     }
00810 
00811   if (cstring_equalLit (s, "macroundef"))
00812     {
00813       return FLG_MACROUNDEF;
00814     }
00815 
00816   if (cstring_equalLit (s, "showcol"))
00817     {
00818       return FLG_SHOWCOL;
00819     }
00820 
00821   if (cstring_equalLit (s, "intbool"))
00822     {
00823       return FLG_BOOLINT;
00824     }
00825 
00826   if (cstring_equalLit (s, "intchar"))
00827     {
00828       return FLG_CHARINT;
00829     }
00830 
00831   if (cstring_equalLit (s, "intenum"))
00832     {
00833       return FLG_ENUMINT;
00834     }
00835 
00836   /*
00837   ** For our European friends...
00838   */
00839 
00840   if (cstring_equalLit (s, "isolib"))
00841     {
00842       return FLG_ANSILIB;
00843     }
00844 
00845   if (cstring_equalLit (s, "isostrictlib"))
00846     {
00847       return FLG_STRICTLIB;
00848     }
00849 
00850   if (cstring_equalLit (s, "ansistrictlib"))
00851     {
00852       return FLG_STRICTLIB;
00853     }
00854 
00855   if (cstring_equalLit (s, "skipisoheaders"))
00856     {
00857       return FLG_SKIPANSIHEADERS;
00858     }
00859 
00860   if (cstring_equalLit (s, "isoreserved"))
00861     {
00862       return FLG_ANSIRESERVED;
00863     }
00864 
00865   if (cstring_equalLit (s, "isoreservedinternal"))
00866     {
00867       return FLG_ANSIRESERVEDLOCAL;
00868     }
00869 
00870   if (cstring_equalLit (s, "isolimits"))
00871     {
00872       return FLG_ANSILIMITS;
00873     }
00874 
00875   /*
00876   ** Obsolete Flags
00877   */
00878   
00879   if (cstring_equalLit (s, "accessunspec"))
00880     {
00881       flagWarning 
00882         (cstring_makeLiteralTemp
00883          ("accessunspec flag is not supported by LCLint version 2.0 or "
00884           "later.  It has been replaced by accessmodule, accessfile and "
00885           "accessfunction to provide more precise control of accessibility "
00886           "of representations.  For more information, "
00887           "see lclint -help accessmodule"));
00888       
00889       return SKIP_FLAG;
00890     }
00891 
00892   if (cstring_equalLit (s, "staticmods"))
00893     {
00894       flagWarning 
00895         (cstring_makeLiteralTemp
00896          ("staticmods flag is obsolete.  You probably "
00897           "want impcheckmodstatics.  For more information, "
00898           "see lclint -help impcheckmodstatics"));
00899       
00900       return SKIP_FLAG;
00901     }
00902 
00903   if (cstring_equalLit (s, "bool"))
00904     {
00905       flagWarning
00906         (cstring_makeLiteralTemp ("bool flag is obsolete.  It never really "
00907                                   "made sense in the first place."));
00908       
00909       return SKIP_FLAG;
00910     }
00911   
00912   if (cstring_equalLit (s, "ansi"))
00913     {
00914       flagWarning
00915         (cstring_makeLiteralTemp ("ansi flag is obsolete.  You probably "
00916                                   "want noparams and/or oldstyle."));
00917       
00918       return SKIP_FLAG;
00919     }
00920     
00921   if (cstring_equalLit (s, "stdio"))
00922     {
00923       flagWarning 
00924         (cstring_makeLiteralTemp
00925          ("stdio flag is obsolete.  You may "
00926           "want strictlib or one of the gloabls "
00927           "checking flags.  For more information, "
00928           "see lclint -help strictlib or lclint -help flags globals"));
00929       
00930       return SKIP_FLAG;
00931     }
00932 
00933   return INVALID_FLAG;
00934 }

bool isMode ( cstring s )
 

Definition at line 1083 of file flags.c.

Referenced by describeFlag(), and main().

01084 {
01085   allModes (modename)
01086     {
01087       if (mstring_isDefined (modename))
01088         {
01089           if (cstring_equalLit (s, modename))
01090             {
01091               return TRUE;
01092             }
01093         }
01094      } end_allModes;
01095 
01096   return FALSE;
01097 }

void listAllCategories ( void )
 

Definition at line 392 of file flags.c.

00393 {
00394   int i;
00395 
00396   for (i = 0; categories[i].kind != FK_NONE; i++)
00397     {
00398       flagkind kind = categories[i].kind ;
00399 
00400       if (categories[i].describe != NULL)
00401         {
00402           llmsg (message ("%s (%d flags)\n\3%s", 
00403                           categoryName (kind), 
00404                           categorySize (kind),
00405                           cstring_fromChars (categories[i].describe)));
00406         }
00407     }
00408 }

void printAllFlags ( bool desc,
bool full )
 

Definition at line 411 of file flags.c.

00412 {
00413   if (full)
00414     {
00415       cstringSList fl = sortedFlags ();
00416 
00417       cstringSList_elements (fl, el)
00418         {
00419           llmsg (message ("%q\n\n", describeFlag (el)));
00420         } end_cstringSList_elements ;
00421 
00422       cstringSList_free (fl);
00423     }
00424   else
00425     {
00426       allFlags (f)
00427         {
00428           if (f.code != INVALID_FLAG && f.main != FK_OBSOLETE)
00429             {
00430               if (mstring_isDefined (f.desc))
00431                 {
00432                   if (desc)
00433                     {
00434                       llmsg (message ("%s --- %s", cstring_fromChars (f.flag),
00435                                       cstring_fromChars (f.desc)));
00436                     }
00437                 }
00438             }
00439         } end_allFlags;
00440     }
00441 }

void printAlphaFlags ( )
 

Definition at line 622 of file flags.c.

00623 {
00624   cstringSList fl = sortedFlags ();
00625 
00626   cstringSList_printSpaced (fl, 3, 1, context_getLineLen () - 25); 
00627   cstringSList_free (fl);
00628 }

void printCategory ( flagkind kind )
 

Definition at line 370 of file flags.c.

Referenced by main().

00371 {
00372   int index = categoryIndex (kind);
00373 
00374   llassert (index >= 0);
00375 
00376   llmsg (message ("%s (%d flags)\n\3%s\n\n", 
00377                   cstring_fromChars (categories[index].name), 
00378                   categorySize (kind),
00379                   cstring_fromChars (categories[index].describe)));
00380 
00381   allFlags (f)
00382     {
00383       if (f.main == kind || f.sub == kind)
00384         {
00385           llmsg (message ("   %s\n\6%q", cstring_fromChars (f.flag), 
00386                           describeFlagCode (f.code)));
00387         }
00388     } end_allFlags;
00389 }

void setStringFlag ( flagcode opt,
cstring arg )
 

Definition at line 988 of file flags.c.

Referenced by main().

00989 {
00990   switch (opt)
00991     {
00992     case FLG_TMPDIR:
00993       {
00994         if (cstring_lastChar (arg) == CONNECTCHAR)
00995           {
00996             context_setString (opt, arg);
00997           }
00998         else
00999           {
01000             context_setString (opt, cstring_appendChar (arg, CONNECTCHAR));
01001           }
01002         break;
01003       }
01004     default:
01005       {
01006         context_setString (opt, arg);
01007         break;
01008       }
01009     }
01010 }

void setValueFlag ( flagcode opt,
cstring arg )
 

Definition at line 936 of file flags.c.

Referenced by main().

00937 {
00938   switch (opt)
00939     {
00940     case FLG_EXPECT:
00941     case FLG_LCLEXPECT:
00942     case FLG_LIMIT:  
00943     case FLG_LINELEN:
00944     case FLG_EXTERNALNAMELEN:
00945     case FLG_INTERNALNAMELEN:
00946     case FLG_CONTROLNESTDEPTH:
00947     case FLG_STRINGLITERALLEN:
00948     case FLG_NUMSTRUCTFIELDS:
00949     case FLG_NUMENUMMEMBERS:
00950     case FLG_INCLUDENEST:
00951       {
00952         int val = cstring_toPosInt (arg);
00953 
00954         if (val < 0)
00955           {
00956             llerror 
00957               (FLG_BADFLAG,
00958                message 
00959                ("Flag %s must be followed by a positive number number.  "
00960                 "Followed by %s",
00961                 flagcode_unparse (opt), arg));
00962           }
00963         else
00964           {
00965                     context_setValueAndFlag (opt, val);
00966           }
00967       }
00968       break;
00969     case FLG_COMMENTCHAR:
00970       {
00971         if (cstring_length (arg) != 1)
00972           {
00973             llfatalerrorLoc
00974               (message
00975                ("Flag %s should be followed by a single character.  Followed by %s",
00976                 flagcode_unparse (opt), arg));
00977           }
00978         else
00979           {
00980             context_setCommentMarkerChar (cstring_firstChar (arg));
00981           }
00982       }
00983       break;
00984     BADDEFAULT;
00985     }
00986 }

void summarizeErrors ( )
 

Definition at line 205 of file flags.c.

Referenced by main().

00206 {
00207   bool hadOne = FALSE;
00208   int sumrep = 0;
00209   int sumsup = 0;
00210 
00211   char *buf = mstring_create (128);
00212 
00213   allFlags (f)
00214     {
00215       if (f.nreported > 0 || f.nsuppressed > 0)
00216         {
00217           int nrep = f.nreported;
00218           int nsup = f.nsuppressed;
00219           cstring fs = cstring_fill (cstring_fromChars (f.flag), 23);
00220 
00221           if (!hadOne)
00222             {
00223               llmsgplain (cstring_makeLiteral
00224                           ("\nError Type                Reported  Suppressed\n"
00225                            "===================       ========  ========="));
00226               hadOne = TRUE;
00227             }
00228 
00229           sprintf (buf, "%s%7d   %9d", cstring_toCharsSafe (fs), nrep, nsup);
00230 
00231           sumrep += nrep;
00232           sumsup += nsup;
00233           
00234           cstring_free (fs);
00235           llmsg (cstring_copy (cstring_fromChars (buf)));
00236         }
00237     } end_allFlags;
00238 
00239   if (hadOne)
00240     {
00241       cstring ts = cstring_fill (cstring_makeLiteralTemp ("Total"), 23);
00242 
00243       llmsglit ("                          ========  =========");
00244 
00245       sprintf (buf, "%s%7d   %9d", cstring_toCharsSafe (ts), sumrep, sumsup);
00246       cstring_free (ts);
00247       llmsgplain (cstring_copy (cstring_fromChars (buf)));
00248     }
00249 
00250   sfree (buf);
00251 }


Generated at Fri Nov 3 18:57:59 2000 for LCLint by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000