]> andersk Git - splint.git/blobdiff - src/cpplib.c
noexpand always false.
[splint.git] / src / cpplib.c
index edafd9e7534e0c25fcf91b53b512cd90a8771bd1..a18e1218508ead358c1919c33bf3ae358f2ae465 100644 (file)
@@ -1563,6 +1563,7 @@ collect_expansion (cppReader *pfile, char *buf, char *limit,
   defn->predefined = NULL;
 
   exp_p = defn->expansion = (char *) defn + sizeof (*defn);
+  *defn->expansion = '\0'; /* convince splint it is initialized */
 
   defn->line = 0;
   defn->rest_args = NULL;
@@ -1830,7 +1831,7 @@ collect_expansion (cppReader *pfile, char *buf, char *limit,
       llfatalbug (cstring_makeLiteral ("Maximum definition size exceeded."));
     }
 
-  /*@i1@*/ return defn; /* Spurious warning here */
+  return defn; /* Spurious warning here */
 }
 
 /*
@@ -2175,8 +2176,10 @@ collect_expansionLoc (fileloc loc, char *buf, char *limit,
     {
       llfatalbug (cstring_makeLiteral ("Maximum definition size exceeded."));
     }
-
-  /*@i1@*/ return defn; /* Spurious warning here */
+  
+  /*@-compdef@*/ /* defn->expansion defined? */
+  return defn; 
+  /*@=compdef@*/
 }
 
 /*
@@ -7073,7 +7076,7 @@ finclude (cppReader *pfile, int f,
          bool system_header_p,
          /*@dependent@*/ struct file_name_list *dirptr)
 {
-  mode_t st_mode;
+  mode_t st_mode; /* was __mode_t */
   size_t st_size;
   long i;
   int length = 0;
@@ -7283,12 +7286,16 @@ file_size_and_mode (int fd, mode_t *mode_pointer, size_t *size_pointer)
   if (fstat (fd, &sbuf) < 0) {
     *mode_pointer = 0;
     *size_pointer = 0;
+    /*@-compdestroy@*/ /* possibly spurious warnings here (or memory leak) */
     return (-1);
+    /*@=compdestroy@*/
   }
 
   if (mode_pointer != NULL)
     {
+      /*@-type@*/ /* confusion between __mode_t and mode_t types */
       *mode_pointer = sbuf.st_mode;
+      /*@=type@*/
     }
 
   if (size_pointer != NULL)
@@ -7296,7 +7303,9 @@ file_size_and_mode (int fd, mode_t *mode_pointer, size_t *size_pointer)
       *size_pointer = (size_t) sbuf.st_size;
     }
 
+  /*@-compdestroy@*/ /* possibly spurious warnings here (or memory leak) */
   return 0;
+  /*@=compdestroy@*/
 }
 
 /* Read LEN bytes at PTR from descriptor DESC, for file FILENAME,
@@ -7403,7 +7412,7 @@ parseMoveMark (struct parse_marker *pmark, cppReader *pfile)
     }
 
   pmark->position = pbuf->cur - pbuf->buf;
-  DPRINTF (("move mark: %s", pmark->position));
+  DPRINTF (("move mark: %d", pmark->position));
 }
 
 void cpplib_initializeReader (cppReader *pfile) /* Must be done after library is loaded. */
@@ -7856,7 +7865,6 @@ static bool cpp_shouldCheckMacro (cppReader *pfile, char *p) /*@modifies p*/
 {
   bool checkmacro = FALSE;
   bool hasParams = FALSE;
-  bool noexpand = FALSE;
   cstring sname;
   char c;
 
@@ -7932,17 +7940,6 @@ static bool cpp_shouldCheckMacro (cppReader *pfile, char *p) /*@modifies p*/
     }
   else
     {
-      if (noexpand)
-       {
-         checkmacro = TRUE;
-
-         if (!expectenditer)
-           {
-             noexpand = FALSE;
-           }
-       }
-      else
-       {
          if (usymtab_existsReal (sname))
            {
              uentry ue = usymtab_lookup (sname);
@@ -8097,7 +8094,6 @@ static bool cpp_shouldCheckMacro (cppReader *pfile, char *p) /*@modifies p*/
                  incLine ();
                }
            }
-       }
     }
 
   if (!checkmacro)
This page took 0.086687 seconds and 4 git commands to generate.