]> andersk Git - splint.git/blobdiff - src/llmain.c
Updating for cert move
[splint.git] / src / llmain.c
index cc3652c58f17c40fcc6c5d5057251b3e85bc8e36..ab163dece79a45e93d207c0961c5c46ddcb6e907 100644 (file)
@@ -560,6 +560,7 @@ int main (int argc, char *argv[])
   bool first_time = TRUE;
   bool showhelp = FALSE;
   bool allhelp = TRUE;
+  bool expsuccess;
   tsource *sourceFile = (tsource *) 0;
  
   fileIdList dercfiles;
@@ -1293,47 +1294,52 @@ int main (int argc, char *argv[])
       summarizeErrors (); 
     }
 
-  if (!context_getFlag (FLG_QUIET))
-    {
-      cstring specErrors = cstring_undefined;
+  
+  {
+    bool isQuiet = context_getFlag (FLG_QUIET);
+    cstring specErrors = cstring_undefined;
 # ifndef NOLCL
-      int nspecErrors = lclNumberErrors ();
+    int nspecErrors = lclNumberErrors ();
 # endif
+    
+    expsuccess = TRUE;
 
-      if (context_neednl ())
-       fprintf (g_msgstream, "\n");
+    if (context_neednl ())
+      fprintf (g_msgstream, "\n");
     
 # ifndef NOLCL
-      if (nspecErrors > 0)
-       {
-         if (nspecErrors == context_getLCLExpect ())
-           {
-             specErrors = 
-               message ("%d spec error%p found, as expected\n       ", 
-                        nspecErrors);
-           }
-         else
-           {
-             if (context_getLCLExpect () > 0)
-               {
-                 specErrors = 
-                   message ("%d spec error%p found, expected %d\n       ", 
-                            nspecErrors,
-                            (int) context_getLCLExpect ());
-               }
-             else
-               {
-                 specErrors = message ("%d spec error%p found\n       ",
-                                       nspecErrors);
-               }
-           }
-       }
-      else
+    if (nspecErrors > 0)
+      {
+       if (nspecErrors == context_getLCLExpect ())
+         {
+           specErrors = 
+             message ("%d spec error%p found, as expected\n       ", 
+                      nspecErrors);
+         }
+       else
+         {
+           if (context_getLCLExpect () > 0)
+             {
+               specErrors = 
+                 message ("%d spec error%p found, expected %d\n       ", 
+                          nspecErrors,
+                          (int) context_getLCLExpect ());
+             }
+           else
+             {
+               specErrors = message ("%d spec error%p found\n       ",
+                                     nspecErrors);
+               expsuccess = FALSE;
+             }
+         }
+      }
+    else
        {
          if (context_getLCLExpect () > 0)
            {
              specErrors = message ("No spec errors found, expected %d\n       ", 
                                    (int) context_getLCLExpect ());
+             expsuccess = FALSE;
            }
        }
 # endif
@@ -1342,25 +1348,36 @@ int main (int argc, char *argv[])
        {
          if (context_numErrors () == context_getExpect ())
            {
-             llmsg (message ("Finished LCLint checking --- "
-                             "%s%d code error%p found, as expected",
-                             specErrors, context_numErrors ()));
+             if (!isQuiet) {
+               llmsg (message ("Finished LCLint checking --- "
+                               "%s%d code error%p found, as expected",
+                               specErrors, context_numErrors ()));
+             }
            }
          else
            {
              if (context_getExpect () > 0)
                {
-                 llmsg (message 
-                        ("Finished LCLint checking --- "
-                         "%s%d code error%p found, expected %d",
-                         specErrors, context_numErrors (), 
-                         (int) context_getExpect ()));
+                 if (!isQuiet) {
+                   llmsg (message 
+                          ("Finished LCLint checking --- "
+                           "%s%d code error%p found, expected %d",
+                           specErrors, context_numErrors (), 
+                           (int) context_getExpect ()));
+                 }
+
+                 expsuccess = FALSE;
                }
              else
                {
-                 llmsg (message ("Finished LCLint checking --- "
-                                 "%s%d code error%p found", 
-                                 specErrors, context_numErrors ()));
+                 
+                 if (!isQuiet) {
+                   llmsg (message ("Finished LCLint checking --- "
+                                   "%s%d code error%p found", 
+                                   specErrors, context_numErrors ()));
+                 }
+
+                 expsuccess = FALSE;
                }
            }
        }
@@ -1368,42 +1385,50 @@ int main (int argc, char *argv[])
        {
          if (context_getExpect () > 0)
            {
-             llmsg (message
-                    ("Finished LCLint checking --- "
-                     "%sno code errors found, expected %d", 
-                     specErrors,
-                     (int) context_getExpect ()));
+             if (!isQuiet) {
+               llmsg (message
+                      ("Finished LCLint checking --- "
+                       "%sno code errors found, expected %d", 
+                       specErrors,
+                       (int) context_getExpect ()));
+             }
+
+             expsuccess = FALSE;
            }
          else
            {
              if (context_getLinesProcessed () > 0)
                {
-                 llmsg (message ("Finished LCLint checking --- %sno code errors found", 
-                                     specErrors));
+                 if (!isQuiet) {
+                   llmsg (message ("Finished LCLint checking --- %sno code errors found", 
+                                   specErrors));
+                 }
                }
              else
                {
-                 llmsg (message ("Finished LCLint checking --- %sno code processed", 
-                                     specErrors));
+                 if (!isQuiet) {
+                   llmsg (message ("Finished LCLint checking --- %sno code processed", 
+                                   specErrors));
+                 }
                }
            }
        }
 
       cstring_free (specErrors);
-    }
-
+  }
+  
   if (context_getFlag (FLG_STATS))
     {
       clock_t ttime = clock () - before;
       int specLines = context_getSpecLinesProcessed ();
-
+      
       rstime = clock ();
-
+      
       if (specLines > 0)
        {
          fprintf (g_msgstream, "%d spec, ", specLines);
        }
-
+      
 # ifndef CLOCKS_PER_SEC
       fprintf (g_msgstream, "%d source lines in %ld time steps (steps/sec unknown)\n", 
               context_getLinesProcessed (), 
@@ -1422,11 +1447,11 @@ int main (int argc, char *argv[])
   if (context_getFlag (FLG_TIMEDIST))
     {
       clock_t ttime = clock () - before;
-
+      
       if (ttime > 0)
        {
          char *msg = (char *) dmalloc (256 * sizeof (*msg));
-
+         
          if (anylcl)
            {
              sprintf (msg, 
@@ -1448,12 +1473,12 @@ int main (int argc, char *argv[])
                       (100.0 * (double) (cptime - pptime) / ttime),
                       (100.0 * (double) (rstime - cptime) / ttime));
            }
-
+         
          llgenindentmsgnoloc (cstring_fromCharsO (msg));
        }
     }
 
-  llexit (LLSUCCESS);
+  llexit (expsuccess ? LLSUCCESS : LLFAILURE);
 }
 
 /*
@@ -1981,6 +2006,8 @@ cleanupFiles (void)
 /*@exits@*/ void
 llexit (int status)
 {
+  DPRINTF (("llexit: %d", status));
+
 # ifdef WIN32
   if (status == LLFAILURE) 
     {
This page took 0.041143 seconds and 4 git commands to generate.