]> andersk Git - splint.git/blobdiff - src/cpplib.c
Fixed problem with NULL being changed.
[splint.git] / src / cpplib.c
index db2265e22c0e4fe1493a35d57561b865b27575d5..d927c7b7193e74e891b6c73fe50eed8bff43fa31 100644 (file)
@@ -70,7 +70,11 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 # include <fcntl.h>
 # if defined (WIN32) || defined (OS2) && defined (__IBMC__)
 # include <io.h>
+/* SMF */
+# ifndef BCC32
 # include <sys/utime.h>                /* for __DATE__ and __TIME__ */
+# endif
+
 # include <time.h>
 # else
 # ifndef VMS
@@ -356,6 +360,8 @@ static void cppReader_scanBuffer (cppReader *p_pfile);
 
 # if defined (WIN32) || defined (OS2) && defined (__IBMC__)
 
+/* SMF */
+# ifndef BCC32
 /*
 ** WIN32 (at least the VC++ include files) does not define mode_t.
 */
@@ -363,10 +369,11 @@ static void cppReader_scanBuffer (cppReader *p_pfile);
 /*@-incondefs@*/ /*@-czechtypes@*/
 typedef unsigned int mode_t;
 /*@=incondefs@*/ /*@=czechtypes@*/
+# endif
 
 # endif
 
-static int file_size_and_mode (int p_fd, /*@out@*/ mode_t *p_mode_pointer,
+static int file_size_and_mode (int p_fd, /*@out@*/ __mode_t *p_mode_pointer,
                               /*@out@*/ size_t *p_size_pointer);
 static int safe_read (int p_desc, /*@out@*/ char *p_ptr, int p_len);
 
@@ -1823,7 +1830,7 @@ collect_expansion (cppReader *pfile, char *buf, char *limit,
       llfatalbug (cstring_makeLiteral ("Maximum definition size exceeded."));
     }
 
-  return defn;
+  /*@i1@*/ return defn; /* Spurious warning here */
 }
 
 /*
@@ -1887,7 +1894,6 @@ collect_expansionLoc (fileloc loc, char *buf, char *limit,
   defn->pattern = NULL;
   defn->nargs = nargs;
   defn->predefined = NULL;
-
   exp_p = defn->expansion = (char *) defn + sizeof (*defn);
 
   defn->line = 0;
@@ -2170,7 +2176,7 @@ collect_expansionLoc (fileloc loc, char *buf, char *limit,
       llfatalbug (cstring_makeLiteral ("Maximum definition size exceeded."));
     }
 
-  return defn;
+  /*@i1@*/ return defn; /* Spurious warning here */
 }
 
 /*
@@ -2838,7 +2844,7 @@ do_defineAux (cppReader *pfile, struct directive *keyword,
       else if (hp->type == T_CONST)
        ok = !CPPOPTIONS (pfile)->done_initializing;
       else {
-       BADBRANCH;
+       ok = FALSE; /* Redefining anything else is bad. */
       }
 
       /* Print the warning if it's not ok.  */
@@ -3751,7 +3757,9 @@ initialize_builtins (cppReader *pfile)
   /*drl 1/9/2001/ try to define the right symbol for the architecture
     We use autoconf to determine the target cpu 
    */
+# ifndef S_SPLINT_S
   cpplib_installBuiltin ("__" TARGET_CPU, ctype_int, -1, T_CONST, 2, NULL, -1);
+# endif
 
   /*drl 1/2/2002  set some flags based on uname
     I'd like to be able to do this with autoconf macro instead...
@@ -6204,6 +6212,8 @@ get_next:
                      if (cc == '\n')
                        {
                          /* Backslash newline is replaced by nothing at all.  */
+                         pfile->lineno++; /* 2003-11-03: AMiller suggested adding this, but
+                                             its not clear why it is needed. */
                          cppReader_adjustWritten (pfile, -1);
                          pfile->lineno++;
                        }
@@ -6669,7 +6679,7 @@ get_next:
 
         case '\\':
          c2 = cppReader_peekC (pfile);
-         //! allow other stuff here if a flag is set?
+         /* allow other stuff here if a flag is set? */
          DPRINTF (("Got continuation!"));
          if (c2 != '\n')
            goto randomchar;
@@ -7063,7 +7073,7 @@ finclude (cppReader *pfile, int f,
          bool system_header_p,
          /*@dependent@*/ struct file_name_list *dirptr)
 {
-  mode_t st_mode;
+  __mode_t st_mode;
   size_t st_size;
   long i;
   int length = 0;
@@ -7266,14 +7276,14 @@ cppCleanup (/*@special@*/ cppReader *pfile)
 */
 
 static int
-file_size_and_mode (int fd, mode_t *mode_pointer, size_t *size_pointer)
+file_size_and_mode (int fd, __mode_t *mode_pointer, size_t *size_pointer)
 {
   struct stat sbuf;
 
   if (fstat (fd, &sbuf) < 0) {
     *mode_pointer = 0;
     *size_pointer = 0;
-    return (-1);
+    /*@i2@*/ return (-1); /* Spurious warnings! */
   }
 
   if (mode_pointer != NULL)
@@ -7286,7 +7296,7 @@ file_size_and_mode (int fd, mode_t *mode_pointer, size_t *size_pointer)
       *size_pointer = (size_t) sbuf.st_size;
     }
 
-  return 0;
+  /*@i4@*/ return 0; /* spurious warnings here */
 }
 
 /* Read LEN bytes at PTR from descriptor DESC, for file FILENAME,
This page took 0.038026 seconds and 4 git commands to generate.