]> andersk Git - splint.git/blobdiff - src/cscanner.l
*** empty log message ***
[splint.git] / src / cscanner.l
index 1634b7d4e036e67e9f5f7c35990ce6759627b672..ad3c04c5a250d29374a99a30cbda3b5ca3ac1daa 100644 (file)
@@ -60,6 +60,7 @@ ULSuffix                ({U}{L}|{L}{U})
 */
 
 # include "lclintMacros.nf"
+# include <unistd.h>
 # include "basic.h"
 
 # include "cgrammar.h"
@@ -79,14 +80,7 @@ static char savechar = '\0';
 /*@notfunction@*/
 # define yyinput() (incColumn (), getc (yyin))
 
-/*@-noparams@*/
-/*@-incondefs@*/
-extern /*@external@*/ int read ();
-/*@=incondefs@*/
-/*@=noparams@*/
-
 static /*@owned@*/ cstring lastidprocessed = cstring_undefined;
-
 static int lminput (void);
 static int tokLength = 0;
 static bool inSpecPart = FALSE;
@@ -310,7 +304,9 @@ L\"(\\.|[^\\"])*\"([ \t\n]*\"(\\.|[^\\"])*\")* { RETURN_EXPR (processString ());
 "killed"                { return (processSpec (QKILLED)); }
 "nullterminated"        { return (processSpec (QNULLTERMINATED));}
 "MaxSet"                { return (processSpec (QMAXSET));}
-"MaxRead"                { return (processSpec (QMAXREAD));}
+"MaxRead"               { return (processSpec (QMAXREAD));}
+"maxSet"                { return (processSpec (QMAXSET));}
+"maxRead"               { return (processSpec (QMAXREAD));}
 
 {Letter}({Letter}|{Digit})* { int tok; 
                              context_saveLocation (); 
@@ -1237,7 +1233,6 @@ static bool processMacro (void)
       e2 = usymtab_lookupExpose (fname);
       ct = uentry_getType (e2);
 
-      
       if (uentry_isCodeDefined (e2) 
          && fileloc_isUser (uentry_whereDefined (e2)))
        {
@@ -1310,7 +1305,7 @@ static bool processMacro (void)
                      
                      uentry_showWhereSpecified (e2);
                      uentry_setType (e2, ctype_unknown);
-                     uentry_makeVarFunction (e2);
+                     uentry_makeConstantFunction (e2);
                      uentry_setDefined (e2, g_currentloc);
                      uentry_setFunctionDefined (e2, g_currentloc);
                      context_enterUnknownMacro (e2); 
@@ -1521,6 +1516,7 @@ static bool processMacro (void)
              && !uentry_isElipsisMarker (uentryList_getN 
                                          (specparams, paramno)))
            {
+             fileloc sloc = context_getSaveLocation ();
              uentry decl = uentryList_getN (specparams, paramno);
              sRef sr;
              
@@ -1528,7 +1524,7 @@ static bool processMacro (void)
 
                              
              uentry_setParam (param);
-             sr = sRef_makeParam (paramno, uentry_getType (param));
+             sr = sRef_makeParam (paramno, uentry_getType (param), stateInfo_makeLoc (sloc));
 
              if (sRef_getNullState (sr) == NS_ABSNULL)
                {
@@ -1545,12 +1541,12 @@ static bool processMacro (void)
                    }
                  else
                    {
-                     sRef_setNullState (sr, NS_UNKNOWN, g_currentloc);
+                     sRef_setNullState (sr, NS_UNKNOWN, sloc);
                    }
                }
 
              uentry_setSref (param, sr);
-             uentry_setDeclaredForceOnly (param, context_getSaveLocation ());
+             uentry_setDeclaredForceOnly (param, sloc);
 
              skipparam = isiter && uentry_isOut (uentryList_getN (specparams, paramno));
            }
@@ -1559,11 +1555,11 @@ static bool processMacro (void)
              fileloc sloc = context_getSaveLocation ();
 
              param = uentry_makeVariableSrefParam 
-               (paramname, ctype_unknown, sRef_makeParam (paramno, ctype_unknown));
+               (paramname, ctype_unknown, fileloc_copy (sloc), 
+                sRef_makeParam (paramno, ctype_unknown, stateInfo_makeLoc (sloc)));
              cstring_free (paramname);
 
              sRef_setPosNull  (uentry_getSref (param), sloc);
-
              uentry_setDeclaredForce (param, sloc);
 
              skipparam = FALSE;
@@ -1817,7 +1813,11 @@ static bool handleSpecial (char *yyt)
       
       if (!(fileId_isValid (fid)))
        {
-         if (isHeaderFile (fname))
+         if (context_inXHFile ())
+           {
+             fid = fileTable_addXHFile (context_fileTable (), fname);
+           }
+         else if (isHeaderFile (fname))
            {
              fid = fileTable_addHeaderFile (context_fileTable (), fname);
            }
@@ -2490,8 +2490,10 @@ static int processIdentifier (cstring id)
 {
   uentry le;
 
-  DPRINTF (("Process identifier: %s / %s / %s", id, fileloc_unparse (g_currentloc),
-           bool_unparse (context_inFunctionHeader ())));
+  if (context_getFlag (FLG_GRAMMAR))
+    {
+      lldiagmsg (message ("Process identifier: %s", id));
+    }
 
   context_clearJustPopped ();
   lastidprocessed = id; 
This page took 0.11178 seconds and 4 git commands to generate.