]> andersk Git - splint.git/commitdiff
Added code to support CSV output (-csv flag).
authorevans1629 <evans1629>
Thu, 12 Dec 2002 23:42:45 +0000 (23:42 +0000)
committerevans1629 <evans1629>
Thu, 12 Dec 2002 23:42:45 +0000 (23:42 +0000)
26 files changed:
src/Headers/annotationInfo.h
src/Headers/basic.h
src/Headers/cpplib.h
src/Headers/flag_codes.h
src/Headers/flags.h
src/Headers/globals.h
src/Headers/symtable.h
src/annotationInfo.c
src/checking.c
src/constraintGeneration.c
src/cppexp.c
src/cpplib.c
src/cprim.c
src/fileTable.c
src/flags.c
src/flags.def
src/functionClauseList.c
src/globals.c
src/inputStream.c
src/llerror.c
src/llmain.c
src/lslinit.c
src/message.c
src/osd.c
src/symtable.c
src/usymtab.c

index 1e1dac74350a7630c3e306f2e6b715a3505373a9..7c8b63ae1c2fb8e5a82dd1cccc6796879f46d6d6 100644 (file)
@@ -48,8 +48,8 @@ annotationInfo_create (/*@only@*/ cstring p_name,
                       /*@only@*/ mtContextNode p_context,
                       int p_value, /*@only@*/ fileloc p_loc) /*@*/ ;
 
-extern /*@observer@*/ cstring annotationInfo_unparse (annotationInfo p_ainfo);
-extern /*@observer@*/ fileloc annotationInfo_getLoc (annotationInfo p_ainfo) /*@*/ ;
+extern /*@observer@*/ cstring annotationInfo_unparse (annotationInfo p_a);
+extern /*@observer@*/ fileloc annotationInfo_getLoc (annotationInfo p_a) /*@*/ ;
 
 extern void annotationInfo_free (/*@only@*/ annotationInfo) ;
 
index f894e913803313de9fced5173582df9dc1c2e003..3ad11cb6f08423c903c38b117be68cfc377ac0e5 100644 (file)
@@ -9,6 +9,7 @@
 
 # ifdef HAVE_CONFIG_H
 # ifdef WIN32
+
 /* Win32 uses its own hand-generated config file */
 # include "../../winconfig.h"
 # else 
index cdefe6b40107a60cc809b1d97513f8976a94f23c..1633d67353cc8ca9c577e6d385ca189388728e9f 100644 (file)
@@ -222,8 +222,7 @@ cpplib_createDefinition (/*@dependent@*/ cstring p_def, fileloc p_loc,
 
 extern void cpplib_reserve (/*@sef@*/ cppReader *, /*@sef@*/ size_t);
 #define cpplib_reserve(PFILE, N) \
-  (cpplib_getWritten (PFILE) + (N) > (PFILE)->token_buffer_size \
-   && (cppReader_growBuffer (PFILE, (N)), 0))
+  (((cpplib_getWritten (PFILE) + (N) > (PFILE)->token_buffer_size)) ? cppReader_growBuffer (PFILE, (N)) : (void) 0)
 
 /* Append string STR (of length N) to PFILE's output buffer.
    Assume there is enough space. */
index 8f5531abd933ec82ab4b51396463444f0649f2fe..5f403b461202af06915722079e34b94016d8e195 100644 (file)
@@ -30,7 +30,7 @@ typedef enum
 # define NUMVALUEFLAGS       14
 
 /*@constant int NUMSTRINGFLAGS; @*/
-# define NUMSTRINGFLAGS      27
+# define NUMSTRINGFLAGS      28
 
 /*@iter allFlagCodes (yield flagcode f); @*/
 # define allFlagCodes(m_code) \
index 925113452417e4ea80f3e04e0a7d3163b8301abd..e441ade43a05d5d77a5465474f5d64cadbb70ec5 100644 (file)
@@ -49,6 +49,8 @@ extern /*@observer@*/ cstring flagcode_unparse (flagcode p_code) /*@*/ ;
 extern int flagcode_valueIndex (flagcode p_f) /*@*/ ;
 extern int flagcode_stringIndex (flagcode p_f) /*@*/ ;
 
+extern int flagcode_priority (flagcode p_code) /*@*/ ;
+
 extern bool flagcode_equal (flagcode p_code1, flagcode p_code2) /*@*/ ;
 # define flagcode_equal(c1, c2) ((c1) == (c2))
 
index 5b30848e873b91a593ffea13fd7b258d226ad7f7..4022c45514865e2ab930a9f524a588710110f05c 100644 (file)
@@ -21,6 +21,9 @@ extern /*@owned@*/ fileloc g_currentloc;
 /* stream for error messages */
 /*@unchecked@*/ extern /*@relnull@*/ /*@dependent@*/ /*:open:*/ FILE *g_errorstream; 
 
+/* stream for error messages */
+/*@unchecked@*/ extern /*@null@*/ /*@dependent@*/ /*:open:*/ FILE *g_csvstream; 
+
 /*@-ansireserved@*/
 /* This macro is defined by flex. */
 /*@constant external int ECHO@*/
index e9a72a932f44d5f3a899e509899c200f251e67bb..ee0140990a1f9ac5531968f3b3820eed15027da9 100644 (file)
@@ -183,7 +183,7 @@ extern void varInfo_free (/*@only@*/ varInfo p_v);
 
 extern /*@only@*/ lslOpSet 
   symtable_opsWithLegalDomain (symtable p_tab, /*@temp@*/ /*@null@*/ nameNode p_n, 
-                              sortSetList p_argSorts, sort p_qual);
+                              sortSetList p_argSorts, sort p_q);
 extern /*@observer@*/ sigNodeSet 
   symtable_possibleOps (symtable p_tab, nameNode p_n);
 extern bool symtable_opExistsWithArity(symtable p_tab, nameNode p_n, int p_arity);
index 26e7bcc3ca06e067a8aa216dd68f71bbfa6e520d..75d36fc4ef7c81e308f3383ea54792bd65945d2c 100644 (file)
@@ -43,26 +43,26 @@ annotationInfo annotationInfo_create (cstring name,
   return res;
 }
 
-void annotationInfo_free (annotationInfo ainfo)
+void annotationInfo_free (annotationInfo a)
 {
-  if (annotationInfo_isDefined (ainfo))
+  if (annotationInfo_isDefined (a))
     {
-      cstring_free (ainfo->name);
-      fileloc_free (ainfo->loc);
-      mtContextNode_free (ainfo->context); /* evans 2002-01-03 */
-      sfree (ainfo);
+      cstring_free (a->name);
+      fileloc_free (a->loc);
+      mtContextNode_free (a->context); /* evans 2002-01-03 */
+      sfree (a);
     }
 }
 
-cstring annotationInfo_getName (annotationInfo ainfo)
+cstring annotationInfo_getName (annotationInfo a)
 {
-  llassert (annotationInfo_isDefined (ainfo));
-  return ainfo->name;
+  llassert (annotationInfo_isDefined (a));
+  return a->name;
 }
 
-/*@observer@*/ cstring annotationInfo_unparse (annotationInfo ainfo)
+/*@observer@*/ cstring annotationInfo_unparse (annotationInfo a)
 {
-  return annotationInfo_getName (ainfo);
+  return annotationInfo_getName (a);
 }
 
 /*@observer@*/ metaStateInfo annotationInfo_getState (annotationInfo a) /*@*/ 
@@ -71,10 +71,10 @@ cstring annotationInfo_getName (annotationInfo ainfo)
   return a->state;
 }
 
-/*@observer@*/ fileloc annotationInfo_getLoc (annotationInfo ainfo) /*@*/ 
+/*@observer@*/ fileloc annotationInfo_getLoc (annotationInfo a) /*@*/ 
 {
-  llassert (annotationInfo_isDefined (ainfo));
-  return ainfo->loc;
+  llassert (annotationInfo_isDefined (a));
+  return a->loc;
 }
 
 int annotationInfo_getValue (annotationInfo a) /*@*/ 
@@ -146,21 +146,21 @@ bool annotationInfo_matchesContextRef (annotationInfo a, sRef sr)
     }
 }
 
-cstring annotationInfo_dump (annotationInfo ainfo)
+cstring annotationInfo_dump (annotationInfo a)
 {
-  llassert (annotationInfo_isDefined (ainfo));
-  return ainfo->name;
+  llassert (annotationInfo_isDefined (a));
+  return a->name;
 }
 
 /*@observer@*/ annotationInfo annotationInfo_undump (char **s)
 {
   cstring mname = reader_readUntil (s, '.');
-  annotationInfo ainfo;
+  annotationInfo a;
   
   llassert (cstring_isDefined (mname));
-  ainfo = context_lookupAnnotation (mname);
+  a = context_lookupAnnotation (mname);
 
-  if (annotationInfo_isUndefined (ainfo))
+  if (annotationInfo_isUndefined (a))
     {
       llfatalerrorLoc
        (message ("Library uses undefined annotation %s.  Must use same -mts flags as when library was created.",
@@ -169,7 +169,7 @@ cstring annotationInfo_dump (annotationInfo ainfo)
   else
     {
       cstring_free (mname);
-      return ainfo;
+      return a;
     }
 
   BADBRANCHRET (annotationInfo_undefined);
index 6fe1b2337e8d298661b2b94a0d85c1bd64b8f564..6731b095baeac4bfc1ef1820bd7df7ac16579d1a 100644 (file)
@@ -41,7 +41,7 @@
 
 static /*@only@*/ cstring printBadArgs (sortSetList p_args);
 static /*@only@*/ sortSet 
-  standardOperators (/*@null@*/ nameNode p_n, sortSetList p_argSorts, sort p_qual);
+  standardOperators (/*@null@*/ nameNode p_n, sortSetList p_argSorts, sort p_q);
 static bool isStandardOperator (/*@null@*/ nameNode p_n);
 static void assignSorts (termNode p_t, sort p_s);
 
@@ -543,7 +543,7 @@ static bool isStandardOperator (/*@null@*/ nameNode n)
 }
 
 static /*@only@*/ sortSet
-standardOperators (/*@null@*/ nameNode n, sortSetList argSorts, /*@unused@*/ sort qual)
+standardOperators (/*@null@*/ nameNode n, sortSetList argSorts, /*@unused@*/ sort q)
 {
   sortSet argSet;
   sortSet ret = sortSet_new ();
index dfb737ddbb3f29464cf8bb5651efd7ec0c29ebad..e43f9f507f94b9dd133fca526358db7d7fcd6b8e 100644 (file)
@@ -2242,7 +2242,7 @@ constraintList checkCall (/*@dependent@*/ exprNode fcn, exprNodeList arglist)
        preconditions = constraintList_makeNew();
     }
   
-  // drl remember to remove this code before you make a pslint release.
+  /*@i523@ drl remember to remove this code before you make a splint release. */
   /*
   if (context_getFlag (FLG_IMPLICTCONSTRAINT) )
     {
index 588eaf10cb62290629d84293c02dd2dc91bf8a8b..3dda026e40122a77f8f41127f2a2345a3e242e53 100644 (file)
@@ -1305,7 +1305,7 @@ cppReader_parseExpression (cppReader *pfile)
        {
          struct operation *new_stack;
          size_t old_size = size_fromInt ((char *) limit - (char *) stack);
-         size_t new_size = 2 * old_size;
+         size_t new_size = (size_t) (2 * old_size);
 
          if (stack != init_stack)
            {
index 08e8f976bc6e08da3b729ecc8ba827c605a00f96..7abb0d15f96b6dc66e1a8d4f763e3ba8d319c1b9 100644 (file)
@@ -7609,7 +7609,7 @@ void cpplib_initializeReader (cppReader *pfile) /* Must be done after library is
            nlist->got_name_map = 0;
            nlist->next = NULL;
 
-           if (opts->first_system_include == NULL)
+           /*@i2523@*/ if (opts->first_system_include == NULL)
              {
                opts->first_system_include = nlist;
              }
@@ -7624,7 +7624,7 @@ void cpplib_initializeReader (cppReader *pfile) /* Must be done after library is
   cppReader_appendIncludeChain (pfile, opts->after_include,
                                opts->last_after_include);
 
-  if (opts->first_system_include == NULL)
+  /*@i523@*/ if (opts->first_system_include == NULL)
     {
       opts->first_system_include = opts->after_include;
     }
index 3f4879421c7eb8f4cd1bb17b1a91c46cc022f989..6dd1be1038346a9203657a76d78865fcffc14249 100644 (file)
@@ -243,6 +243,7 @@ cprim_closeEnoughAux (cprim c1, cprim c2, bool deep)
              || (cprim_isAnyChar (c2) && context_msgCharInt ())) {
            return TRUE;
          }
+         /*@fallthrough@*/ 
        default:
          ;
        }
index 7c2f6068526171ea59bb2820bbf3573681e19850..701e5f58ee5b362d20d9475ef01a9559be932773 100644 (file)
@@ -1011,7 +1011,11 @@ fileTable_addOpen (fileTable ft, /*@observer@*/ FILE *f, /*@only@*/ cstring fnam
 
 FILE *fileTable_createFile (fileTable ft, cstring fname)
 {
-  int fdesc = open (cstring_toCharsSafe (fname), O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, S_IRUSR | S_IWUSR);
+# ifdef WIN32
+   int fdesc = open (cstring_toCharsSafe (fname), O_WRONLY | O_CREAT | O_TRUNC | O_EXCL); /* not supported by VS.net: , S_IRUSR | S_IWUSR); */
+# else
+   int fdesc = open (cstring_toCharsSafe (fname), O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, S_IRUSR | S_IWUSR);
+# endif
 
   if (fdesc == -1)
     {
index 4763a50a9e9499348612f5a19074b759ee89d192..118f52199adbfde6fd6d7a429c1749e4cfb16ac1 100644 (file)
@@ -1671,7 +1671,7 @@ flags_processFlags (bool inCommandLine,
          cstring flagname = cstring_fromChars (thisarg + 1); /* skip '-' or '+' */
          flagcode opt = flags_identifyFlag (flagname);
 
-         DPRINTF (("Flag: %s", flagcode_unparse (opt)));
+         DPRINTF (("Flag [%s]: %s", flagname, flagcode_unparse (opt)));
          
          if (flagcode_isInvalid (opt))
            {
@@ -1959,3 +1959,12 @@ flags_processFlags (bool inCommandLine,
 
   cstringSList_free (fl); /* evans 2002-07-12: why wasn't this reported!?? */
 }
+
+int flagcode_priority (/*@unused@*/ flagcode code)
+{
+  /*
+  ** For now, we do a really simple prioritization: all are 1
+  */
+
+  return 1;
+}
index 28976cc523f9d0470570c3ebf09073d51d551f1a..dbab4dee1617d18e98cab969586f5edaeeb61f9d 100644 (file)
@@ -54,7 +54,7 @@
 /*@notfunction@*/
 # define globalExtraArgFlag     FALSE, FALSE, TRUE,  FALSE, ARG_SPECIAL
 /*@notfunction@*/
-# define globalFileFlag         FALSE, FALSE, TRUE,  FALSE, ARG_FILE
+# define globalFileFlag         FALSE, TRUE,  TRUE,  FALSE, ARG_FILE
 /*@=namechecks@*/
 
 /*
@@ -3277,6 +3277,20 @@ static flaglist flags =
     "show location information for load files",
     NULL, 0, 0
   },
+  {
+    FK_FORMAT, FK_DISPLAY, globalFileFlag,
+    "csv",
+    FLG_CSV,
+    "produce comma-separated values (CSV) warnings output file",
+    NULL, 0, 0
+  },
+  {
+    FK_FORMAT, FK_DISPLAY, plainFlag,
+    "csvoverwrite",
+    FLG_CSVOVERWRITE,
+    "overwrite exisiting CVS output file",
+    NULL, 0, 0
+  },
   {
     FK_FORMAT, FK_DISPLAY, plainFlag,
     "parenfileformat",
index c05d8b0e5afe2c65c83b874a16316c58dd0d2987..f35d6a544607a2eb5c379ba422c00bdb17eb2332 100644 (file)
@@ -198,7 +198,7 @@ functionClauseList_getImplictConstraints (functionClauseList s)
              else
                {
                  llassert (FALSE);
-                 // fix this
+                 /*@i2523 fix this */
                }
            }
        }
index 38504c3334846fcb50f3e8c6d4f6ac081bf13746..845b48efe11703cf0d8aea559aa2d05f65532596 100644 (file)
@@ -46,6 +46,7 @@ int g_prevCodeLine = 0;
 FILE *g_warningstream = NULL;
 FILE *g_messagestream = NULL;
 FILE *g_errorstream = NULL;
+FILE *g_csvstream = NULL;
 
 /*
 ** These were in llmain.c.  Most should not be globals...
index c77990b3d7314f477d10216ebd1d15b126295810..95b102afdfc33aeb6b9ca42c8448ba156e231e0d 100644 (file)
@@ -103,7 +103,7 @@ inputStream_create (cstring name, cstring suffix, bool echo)
 
   oname = s->name;
   s->name = fileLib_cleanName (s->name);
-  cstring_free (oname); /* evans 2002-07-12: why no error without this?! */
+  /*@i523@*/ cstring_free (oname); /* evans 2002-07-12: why no error without this?! */
 
   s->lineNo = 0;
   s->charNo = 0;
@@ -114,7 +114,7 @@ inputStream_create (cstring name, cstring suffix, bool echo)
   s->stringSourceTail = NULL;
   s->buffer[0] = '\0';
 
-  return s;
+  /*@i523@*/ return s;
 }
 
 extern /*@only@*/ inputStream 
index 16ab4312970e39fe527dbf89f49d21957ac39cba..150046f7e4ec5861dc5b9e1cdd0fd8302ed60816 100644 (file)
@@ -49,13 +49,21 @@ static int mcount = 0;
 static /*@only@*/ cstring saveOneMessage = cstring_undefined;
 static /*@only@*/ fileloc lastparseerror = fileloc_undefined;
 static /*@only@*/ fileloc lastbug = fileloc_undefined;
-static bool llgenerrorreal (char *p_srcFile, int p_srcLine, 
-                           /*@only@*/ cstring p_s, fileloc p_fl, bool p_iserror, bool p_indent)
+static bool llgenerrorreal (flagcode p_code, 
+                           char *p_srcFile, int p_srcLine, 
+                           /*@only@*/ cstring p_s,
+                           /*@temp@*/ cstring p_addtext,
+                           fileloc p_fl, bool p_iserror, bool p_indent)
                  /*@modifies g_warningstream@*/ ;
-static bool llgenerroraux (char *p_srcFile, int p_srcLine, 
-                          /*@only@*/ cstring p_s, fileloc p_fl, bool p_iserror, bool p_indent)
+static bool llgenerroraux (flagcode p_code, char *p_srcFile, int p_srcLine, 
+                          /*@only@*/ cstring p_s,
+                          /*@temp@*/ cstring p_addtext,
+                          fileloc p_fl, bool p_iserror, bool p_indent)
                  /*@modifies g_warningstream@*/ ;
 
+static void generateCSV (flagcode p_code, cstring p_s, cstring p_addtext, fileloc p_fl) 
+     /*@modifies g_csvstream@*/ ;
+
 static void printError (FILE *p_stream, /*@only@*/ cstring p_sc)
    /*@globals lastfileloclen @*/
    /*@modifies *p_stream@*/ ;
@@ -842,12 +850,15 @@ llgentypeerroraux (char *srcFile, int srcLine,
     }
   else
     {
-      if (llgenerroraux (srcFile, srcLine, s, fl, TRUE, FALSE))
+      if (hcode != INVALID_FLAG && hcode != ocode)
+       {
+         code = hcode;
+       }
+      
+      if (llgenerroraux (ocode, srcFile, srcLine, s, flagcodeHint (code), fl, TRUE, FALSE))
        {
-         if (hcode != INVALID_FLAG && hcode != ocode)
+         if (code != ocode) 
            {
-             code = hcode;
-
              if (context_flagOn (code, fl))
                {
                  /* The flag is alreay set, something buggy in the flag code */
@@ -858,7 +869,7 @@ llgentypeerroraux (char *srcFile, int srcLine,
                {
                  llshowhint (code);
                }
-           }
+         } 
          else
            {
              llsuppresshint ('-', code);
@@ -899,7 +910,7 @@ xllgenformattypeerror (char *srcFile, int srcLine,
 bool
 xllgenerror (char *srcFile, int srcLine, flagcode o, /*@only@*/ cstring s, fileloc fl)
 {
-  if (llgenerroraux (srcFile, srcLine, s, fl, TRUE, FALSE))
+  if (llgenerroraux (o, srcFile, srcLine, s, flagcodeHint (o), fl, TRUE, FALSE))
     {
       llnosuppresshint (o);
       flagcode_recordError (o);
@@ -920,7 +931,7 @@ xllgenhinterror (char *srcFile, int srcLine,
 {
   if (!context_suppressFlagMsg (o, fl))
     {
-      if (llgenerroraux (srcFile, srcLine, s, fl, TRUE, FALSE))
+      if (llgenerroraux (o, srcFile, srcLine, s, hint, fl, TRUE, FALSE))
        {
          flagcode_recordError (o);
 
@@ -950,14 +961,17 @@ xllgenhinterror (char *srcFile, int srcLine,
 }
 
 static bool
-llrealerror (char *srcFile, int srcLine, /*@only@*/ cstring s, fileloc fl)
+llrealerror (flagcode code, char *srcFile, int srcLine, /*@only@*/ cstring s, /*@temp@*/ cstring addtext, fileloc fl)
 {
-  return (llgenerrorreal (srcFile, srcLine, s, fl, TRUE, FALSE));
+  return (llgenerrorreal (code, srcFile, srcLine, s, addtext, fl, TRUE, FALSE));
 }
 
 static bool
-llgenerroraux (char *srcFile, int srcLine,
-              /*@only@*/ cstring s, fileloc fl, bool iserror, bool indent)
+llgenerroraux (flagcode code,
+              char *srcFile, int srcLine,
+              /*@only@*/ cstring s, 
+              cstring addtext,
+              fileloc fl, bool iserror, bool indent)
 {
   if (context_inSuppressZone (fl))
     {
@@ -965,7 +979,7 @@ llgenerroraux (char *srcFile, int srcLine,
       return FALSE;
     }
   
-  if (llgenerrorreal (srcFile, srcLine, s, fl, iserror, indent)) {
+  if (llgenerrorreal (code, srcFile, srcLine, s, addtext, fl, iserror, indent)) {
     return TRUE;
   } else {
     return FALSE;
@@ -978,7 +992,7 @@ xllforceerror (char *srcFile, int srcLine,
 {
   flagcode_recordError (code);
 
-  if (llgenerrorreal (srcFile, srcLine, s, fl, TRUE, FALSE)) {
+  if (llgenerrorreal (code, srcFile, srcLine, s, cstring_undefined, fl, TRUE, FALSE)) {
     closeMessage ();
     return TRUE;
   } else {
@@ -986,9 +1000,34 @@ xllforceerror (char *srcFile, int srcLine,
   }
 }
 
+static void generateCSV (flagcode code, cstring s, cstring addtext, fileloc fl)
+{
+
+  if (g_csvstream != NULL) {
+    /* Warning, Flag Code, Flag Name, Priority, File, Line, Column, Warning Text, Additional Text */
+    fprintf (g_csvstream, "%d,%d,%s,%d,%s,%d,%d,\"%s\"",
+            context_numErrors (),
+            (int) code, /* flag code */
+            cstring_toCharsSafe (flagcode_unparse (code)), /* flag name */
+            flagcode_priority (code), /* priority */
+            cstring_toCharsSafe (fileloc_outputFilename (fl)),
+            fileloc_lineno (fl),
+            fileloc_column (fl),
+            cstring_toCharsSafe (s));
+
+    if (cstring_isDefined (addtext)) {
+      fprintf (g_csvstream, ",\"%s\"\n", cstring_toCharsSafe (addtext));
+    } else {
+      fprintf (g_csvstream, "\n");
+    }
+  }
+}
+
 static bool
-llgenerrorreal (char *srcFile, int srcLine, 
-               /*@only@*/ cstring s, fileloc fl, bool iserror, bool indent)
+llgenerrorreal (flagcode code, char *srcFile, int srcLine, 
+               /*@only@*/ cstring s, 
+               cstring addtext,
+               fileloc fl, bool iserror, bool indent)
 {
   cstring flstring;
 
@@ -1148,6 +1187,8 @@ llgenerrorreal (char *srcFile, int srcLine,
   flstring = fileloc_unparse (fl);
   lastfileloclen = cstring_length (flstring);
 
+  generateCSV (code, s, addtext, fl);
+
   if (indent)
     {
       printError (g_warningstream, message ("   %q: %q", flstring, s));
@@ -1158,6 +1199,7 @@ llgenerrorreal (char *srcFile, int srcLine,
     }
 
   showSourceLoc (srcFile, srcLine);
+            
   return TRUE;
 }
 
@@ -1624,6 +1666,7 @@ void genppllerrorhint (flagcode code, /*@only@*/ cstring s,
     {
       if (context_getFlag (code))
        {
+         generateCSV (code, s, hint, g_currentloc);
          prepareMessage ();
          context_clearPreprocessing ();
          llerror (code, s);
@@ -1711,7 +1754,7 @@ bool xlloptgenerror (char *srcFile, int srcLine,
 {
   DPRINTF (("xllopt: %s", s));
 
-  if (llrealerror (srcFile, srcLine, s, loc))
+  if (llrealerror (o, srcFile, srcLine, s, flagcodeHint (o), loc))
     {
       DPRINTF (("Here we are!"));
       llsuppresshint ('-', o);
@@ -1744,7 +1787,7 @@ bool xoptgenerror2 (char *srcFile, int srcLine,
        }
       else
        {
-         if (llrealerror (srcFile, srcLine, s, loc))
+         if (llrealerror (f1, srcFile, srcLine, s, flagcodeHint (f1), loc))
            {
              llsuppresshint2 ('-', f1, f2);
              flagcode_recordError (f2);
@@ -1779,7 +1822,7 @@ bool xoptgenerror2n (char *srcFile, int srcLine,
        }
       else
        {
-         if (llrealerror (srcFile, srcLine, s, loc))
+         if (llrealerror (f1, srcFile, srcLine, s, flagcodeHint (f2), loc))
            {
              llsuppresshint ('+', f2);
              flagcode_recordError (f2);
@@ -1796,7 +1839,7 @@ bool xoptgenerror2n (char *srcFile, int srcLine,
 bool xllnoptgenerror (char *srcFile, int srcLine,
                      flagcode o, /*@only@*/ cstring s, fileloc loc)
 {
-  if (llrealerror (srcFile, srcLine, s, loc))
+  if (llrealerror (o, srcFile, srcLine, s, flagcodeHint (o), loc))
     {
       llsuppresshint ('+', o);
       flagcode_recordError (o);
@@ -1867,19 +1910,23 @@ void xllparseerror (char *srcFile, int srcLine, cstring s)
 }
 
 bool xfsgenerror (char *srcFile, int srcLine,
-                  flagSpec fs, /*@only@*/ cstring s, fileloc fl) 
+                 flagSpec fs, /*@only@*/ cstring s, fileloc fl) 
 {
   if (flagSpec_isOn (fs, fl))
     {
-      if (llgenerroraux (srcFile, srcLine, s, fl, TRUE, FALSE))
+      flagcode firston = flagSpec_getFirstOn (fs, fl);
+
+      if (llgenerroraux (firston, srcFile, srcLine, s, 
+                        flagcodeHint (firston),
+                        fl, TRUE, FALSE))
        {
-         llsuppresshint ('-', flagSpec_getFirstOn (fs, fl));
-         flagcode_recordError (flagSpec_getFirstOn (fs, fl));
+         llsuppresshint ('-', firston);
+         flagcode_recordError (firston);
          return TRUE;
        }
       else
        {
-         flagcode_recordSuppressed (flagSpec_getFirstOn (fs, fl));
+         flagcode_recordSuppressed (firston);
          return FALSE;
        }
     }
index 8b177b16577e755f3407b335d58b31528914c77f..fa9b8fe1ba8f8b574b66069b747715d4354ca483 100644 (file)
@@ -673,7 +673,29 @@ int main (int argc, char *argv[])
                      argc - 1, argv + 1);
 
   showHerald (); 
-  
+
+  if (context_getFlag (FLG_CSV)) {
+    cstring fname = context_getString (FLG_CSV);
+
+    if (cstring_isDefined (fname)) {
+      if (osd_fileExists (fname) && !context_getFlag (FLG_CSVOVERWRITE)) {
+       lldiagmsg (message ("Specified CSV output file already exists (use +csvoverwrite to automatically overwrite): %s",
+                           fname));
+      } else {
+       g_csvstream = fopen (cstring_toCharsSafe (fname), "w");
+       
+       DPRINTF (("Creating: %s", fname));
+       if (g_csvstream == NULL) {
+         lldiagmsg (message ("Cannot open file for CSV output: %s", fname));
+       } else {
+         displayScan (message ("Starting CSV output file: %s", context_getString (FLG_CSV)));
+         fprintf (g_csvstream, 
+                  "Warning, Flag Code, Flag Name, Priority, File, Line, Column, Warning Text, Additional Text\n");
+       }
+      }
+    }
+  }
+
 # ifdef DOANNOTS
   initAnnots ();
 # endif
@@ -928,12 +950,16 @@ int main (int argc, char *argv[])
 # endif
 
   cleanupFiles ();
-
+  
+  if (g_csvstream != NULL) {
+    displayScan (message ("Closing CSV file: %s", context_getString (FLG_CSV)));
+    check (fclose (g_csvstream) == 0);
+  }
+  
   if (context_getFlag (FLG_SHOWSUMMARY))
     {
       summarizeErrors (); 
     }
-
   
   {
     bool isQuiet = context_getFlag (FLG_QUIET);
index 64d69195e149cb474951e0a5af61fc0fe603d7ca..f1174116417c36e13fc662c34e951b8ac6fbc8c6 100644 (file)
@@ -37,6 +37,8 @@
 # include "syntable.h"
 # include "lslinit.h"
 # include "lclinit.h"
+# include "lclscan.h"
+# include "lclscanline.h"
 
 /* needed to parse init files */
 # include "shift.h"
index 41757a5d070f666bab31005f000fa483a4ce7a62..de50dab5c86bdfd7bd9eeb27385850f65d8fd94e 100644 (file)
@@ -40,9 +40,16 @@ typedef enum
   XPERCENT, XCTYPE, XPLURAL, XREPREFIX, XFILELOC, XPOINTER
 } ccode;
 
-/* char *s, anytype v */
+/*@function void GETPRINTF (char *p_s, anytype p_v) modifies strbuf@*/
+
 /*@notfunction@*/
+# ifndef WIN32
+  /* ISO requires this, but not all implementations (e.g., Microsoft's) provide it */
 # define GETPRINTF(s,v) (snprintf (strbuf, 64, s, v), mstring_copy (strbuf))
+# else
+  /* MS provides _snprintf instead */
+# define GETPRINTF(s,v) (_snprintf (strbuf, 64, s, v), mstring_copy (strbuf))
+# endif
 
 /*
 ** returns control code indicated by *c, and
index 3d75cf64ea2ba65085664ac4049da2373be931b3..68e90c8c0e447afaab576664437e79fab9015f6f 100644 (file)
--- a/src/osd.c
+++ b/src/osd.c
@@ -1126,7 +1126,7 @@ cstring osd_outputPath (cstring filename)
         {
           /* Give up if the result gets to be longer
              than the absolute path name.  */
-          if (rel_buffer + filename_len <= rel_buf_p + 3)
+          /*@i423@*/ if (rel_buffer + filename_len <= rel_buf_p + 3)
            {
              sfree (rel_buffer);
              return cstring_copy (filename);
index 636183f166a123ded105ff0f813348469b172197..7c0c92f1fe17305247f2c40cf24238a6a1328a46 100644 (file)
@@ -1043,7 +1043,7 @@ parseLine (char *line, inputStream srce, mapping map)
          llassert (lineptr != NULL);
          lineptr = strchr (lineptr + 1, ' ');  /* go past namestr */
          llassert (lineptr != NULL);
-         col = 5 + lineptr - line;     /* 5 for initial "%LCL "*/
+         col = 5 + ((int) (lineptr - line));   /* 5 for initial "%LCL "*/
 
          lclbug (message ("%q: Imported files contains unknown base sort",
                           fileloc_unparseRawCol (importfile, inputStream_thisLineNumber (srce), col)));
@@ -1107,7 +1107,7 @@ parseLine (char *line, inputStream srce, mapping map)
       llassert (lineptr != NULL);
       lineptr = strchr (lineptr + 1, ' ');     /* go past namestr */
       llassert (lineptr != NULL);
-      col = 5 + lineptr - line;        /* 5 for initial "%LCL "*/
+      col = 5 + ((int) (lineptr - line));      /* 5 for initial "%LCL "*/
 
       if (sort_isNoSort (bsort))
        {
@@ -1158,7 +1158,7 @@ parseLine (char *line, inputStream srce, mapping map)
       lineptr = strchr (lineptr + 1, ' ');     /* go past namestr */
       llassert (lineptr != NULL);
       
-      col = 5 + lineptr - line;        /* 5 for initial "%LCL "*/
+      col = 5 + ((int) (lineptr - line));      /* 5 for initial "%LCL "*/
 
       if (sort_isNoSort (bsort))
        {
@@ -1340,7 +1340,7 @@ parseLine (char *line, inputStream srce, mapping map)
       lineptr = strchr (lineptr + 1, ' ');     /* go past namestr */
       llassert (lineptr != NULL);
 
-      col = 5 + lineptr - line;        /* 5 for initial "%LCL "*/
+      col = 5 + ((int) (lineptr - line));      /* 5 for initial "%LCL "*/
       if (sort_isNoSort (bsort))
        {
          lclplainerror (message ("%q: unknown base sort\n",
@@ -2093,7 +2093,7 @@ domainMatches (ltokenList domain, sortSetList argSorts)
 
 /*@only@*/ lslOpSet
   symtable_opsWithLegalDomain (symtable tab, /*@temp@*/ /*@null@*/ nameNode n,
-                              sortSetList argSorts, sort qual)
+                              sortSetList argSorts, sort q)
 {
  /* handles nil qual */
   lslOpSet ops = lslOpSet_new ();
@@ -2114,7 +2114,7 @@ domainMatches (ltokenList domain, sortSetList argSorts)
            {
              rangeSort = sigNode_rangeSort (sig);
              
-             if ((qual == 0) || (sort_equal (rangeSort, qual)))
+             if ((q == NULL) || (sort_equal (rangeSort, q)))
                {
                  if (domainMatches (sig->domain, argSorts))
                    {
index 1f70646bd04a921e858c5e6ca1601f015c1dca00..cf207a3e0234b5744c14273fc8a8cb905c085966 100644 (file)
@@ -350,7 +350,8 @@ usymtab_destroyMod (void) /*@modifies utab, globtab, filetab@*/ /*@globals kille
   DPRINTF (("Destroy usymtab [%p]: %d", utab, utab->nentries));
   usymtab_freeAux (utab);
   utab = usymtab_undefined;
-}
+  /*@-globstate@*/ 
+} /*@=globstate@*/
 
 void
 usymtab_initGlobalMarker () /*@globals globtab@*/
@@ -5408,7 +5409,7 @@ void usymtab_free ()
   dbgfree = TRUE;
   usymtab_freeAux (utab);
   utab = usymtab_undefined;
-}
+/*@i523@*/ }
 
 static int usymtab_lexicalLevel (void) /*@globals utab@*/
 {
This page took 0.101395 seconds and 5 git commands to generate.