]> andersk Git - splint.git/commitdiff
Fixed loading of rc files, warnrc and showscan.
authorevans1629 <evans1629>
Sun, 30 Dec 2001 20:16:04 +0000 (20:16 +0000)
committerevans1629 <evans1629>
Sun, 30 Dec 2001 20:16:04 +0000 (20:16 +0000)
17 files changed:
config.h
config.hin
configure
configure.ac
src/Headers/osd.h
src/fileTable.c
src/llerror.c
src/llmain.c
src/osd.c
src/uentry.c
test/Makefile.am
test/Makefile.in
test/ansireserved.expect
test/mergenull.c [new file with mode: 0644]
test/mergenull.expect [new file with mode: 0644]
test/utypes.c [new file with mode: 0644]
test/utypes.expect [new file with mode: 0644]

index 036fdccf4c2e4477525428e6cc02e4e0d182ac2f..312e2d7b72e52c097c38af0acaee0708958f0d03 100644 (file)
--- a/config.h
+++ b/config.h
@@ -9,10 +9,10 @@
 /* Splint's imports directory */
 #define DEFAULT_LCLIMPORTDIR ".:/usr/local/share/splint/imports:/af10/evans/LCLintDev/imports"
 
-/* gcc's private include directory */
-#define GCC_INCLUDE_DIR "/usr/lib/gcc-lib/i386-linux/2.7.2.1/include"
+/* system include directory */
+#define GCC_INCLUDE_DIR "/usr/include"
 
-/* the system's main include directory */
+/* alternate include directory */
 #define GCC_INCLUDE_DIR2 "/usr/local/include"
 
 /* String describing who compiled this binary and how */
 /* Splint's version number */
 #define LCL_PARSE_VERSION "Splint 3.0.0.20"
 
-/* Splint's version number and release date */
-#define LCL_VERSION "Splint 3.0.0.20 --- 5 October 2001"
-
 /* Define to disable support LCL files */
 /* #undef NOLCL */
 
+/* Splint's version number and release date */
+#define SPLINT_VERSION "Splint 3.0.0.20 --- 29 December 2001"
+
 /* The system's main include directory */
 #define SYSTEM_LIBDIR "/usr/local/include"
 
index ae5ab5a7f2f775bb83dc3831d00cedbaba5499b1..3cff033573d475a24858fe5ff02da08911d2a60a 100644 (file)
@@ -8,10 +8,10 @@
 /* Splint's imports directory */
 #undef DEFAULT_LCLIMPORTDIR
 
-/* gcc's private include directory */
+/* system include directory */
 #undef GCC_INCLUDE_DIR
 
-/* the system's main include directory */
+/* alternate include directory */
 #undef GCC_INCLUDE_DIR2
 
 /* String describing who compiled this binary and how */
 /* Splint's version number */
 #undef LCL_PARSE_VERSION
 
-/* Splint's version number and release date */
-#undef LCL_VERSION
-
 /* Define to disable support LCL files */
 #undef NOLCL
 
+/* Splint's version number and release date */
+#undef SPLINT_VERSION
+
 /* The system's main include directory */
 #undef SYSTEM_LIBDIR
 
index e2df344b07f6a9351f0807ca92c70e4a0b585817..12e6d76eb1b3310d8a373c2624994104ea278f64 100755 (executable)
--- a/configure
+++ b/configure
@@ -2950,7 +2950,8 @@ if test x$ac_cv_c_compiler_gnu = xyes; then
 
 # This breaks on gcc-3.0 on redhat fixing drl 11-15-2001
 #  GCC_INCLUDE_DIR=`LANGUAGE= LANG= $CC -v 2>&1 | sed -e '/^gcc/ d' -e 's/.* \(.*\)specs/\1include/'`
- GCC_INCLUDE_DIR=/usr/lib/gcc-lib/i386-linux/2.7.2.1/include
+GCC_INCLUDE_DIR=/usr/include
+# was /usr/lib/gcc-lib/i386-linux/2.7.2.1/include
 #  GCC_INCLUDE_DIR=`LANGUAGE= LANG= $CC -v 2>&1 | sed -n -e '/^gcc/ d' -e 's/.* \(.*\)specs/\1include/p'`
 
 cat >>confdefs.h <<EOF
@@ -2981,7 +2982,7 @@ EOF
 LCL_PARSE_VERSION="Splint 3.0.0.20"
 
 cat >>confdefs.h <<EOF
-#define LCL_VERSION "$LCL_PARSE_VERSION --- `cat $srcdir/src/DATE`"
+#define SPLINT_VERSION "$LCL_PARSE_VERSION --- `cat $srcdir/src/DATE`"
 EOF
 
 cat >>confdefs.h <<EOF
@@ -3077,7 +3078,7 @@ DEFS=-DHAVE_CONFIG_H
 : ${CONFIG_STATUS=./config.status}
 ac_clean_files_save=$ac_clean_files
 ac_clean_files="$ac_clean_files $CONFIG_STATUS"
-{ echo "$as_me:3080: creating $CONFIG_STATUS" >&5
+{ echo "$as_me:3081: creating $CONFIG_STATUS" >&5
 echo "$as_me: creating $CONFIG_STATUS" >&6;}
 cat >$CONFIG_STATUS <<_ACEOF
 #! $SHELL
@@ -3253,7 +3254,7 @@ cat >>$CONFIG_STATUS <<\EOF
     echo "$ac_cs_version"; exit 0 ;;
   --he | --h)
     # Conflict between --help and --header
-    { { echo "$as_me:3256: error: ambiguous option: $1
+    { { echo "$as_me:3257: error: ambiguous option: $1
 Try \`$0 --help' for more information." >&5
 echo "$as_me: error: ambiguous option: $1
 Try \`$0 --help' for more information." >&2;}
@@ -3272,7 +3273,7 @@ Try \`$0 --help' for more information." >&2;}
     ac_need_defaults=false;;
 
   # This is an error.
-  -*) { { echo "$as_me:3275: error: unrecognized option: $1
+  -*) { { echo "$as_me:3276: error: unrecognized option: $1
 Try \`$0 --help' for more information." >&5
 echo "$as_me: error: unrecognized option: $1
 Try \`$0 --help' for more information." >&2;}
@@ -3324,7 +3325,7 @@ do
   "test/Makefile" ) CONFIG_FILES="$CONFIG_FILES test/Makefile" ;;
   "default-1" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;;
   "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h:config.hin" ;;
-  *) { { echo "$as_me:3327: error: invalid argument: $ac_config_target" >&5
+  *) { { echo "$as_me:3328: error: invalid argument: $ac_config_target" >&5
 echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
    { (exit 1); exit 1; }; };;
   esac
@@ -3570,7 +3571,7 @@ done; }
   esac
 
   if test x"$ac_file" != x-; then
-    { echo "$as_me:3573: creating $ac_file" >&5
+    { echo "$as_me:3574: creating $ac_file" >&5
 echo "$as_me: creating $ac_file" >&6;}
     rm -f "$ac_file"
   fi
@@ -3588,7 +3589,7 @@ echo "$as_me: creating $ac_file" >&6;}
       -) echo $tmp/stdin ;;
       [\\/$]*)
          # Absolute (can't be DOS-style, as IFS=:)
-         test -f "$f" || { { echo "$as_me:3591: error: cannot find input file: $f" >&5
+         test -f "$f" || { { echo "$as_me:3592: error: cannot find input file: $f" >&5
 echo "$as_me: error: cannot find input file: $f" >&2;}
    { (exit 1); exit 1; }; }
          echo $f;;
@@ -3601,7 +3602,7 @@ echo "$as_me: error: cannot find input file: $f" >&2;}
            echo $srcdir/$f
          else
            # /dev/null tree
-           { { echo "$as_me:3604: error: cannot find input file: $f" >&5
+           { { echo "$as_me:3605: error: cannot find input file: $f" >&5
 echo "$as_me: error: cannot find input file: $f" >&2;}
    { (exit 1); exit 1; }; }
          fi;;
@@ -3662,7 +3663,7 @@ for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue
   * )   ac_file_in=$ac_file.in ;;
   esac
 
-  test x"$ac_file" != x- && { echo "$as_me:3665: creating $ac_file" >&5
+  test x"$ac_file" != x- && { echo "$as_me:3666: creating $ac_file" >&5
 echo "$as_me: creating $ac_file" >&6;}
 
   # First look for the input files in the build tree, otherwise in the
@@ -3673,7 +3674,7 @@ echo "$as_me: creating $ac_file" >&6;}
       -) echo $tmp/stdin ;;
       [\\/$]*)
          # Absolute (can't be DOS-style, as IFS=:)
-         test -f "$f" || { { echo "$as_me:3676: error: cannot find input file: $f" >&5
+         test -f "$f" || { { echo "$as_me:3677: error: cannot find input file: $f" >&5
 echo "$as_me: error: cannot find input file: $f" >&2;}
    { (exit 1); exit 1; }; }
          echo $f;;
@@ -3686,7 +3687,7 @@ echo "$as_me: error: cannot find input file: $f" >&2;}
            echo $srcdir/$f
          else
            # /dev/null tree
-           { { echo "$as_me:3689: error: cannot find input file: $f" >&5
+           { { echo "$as_me:3690: error: cannot find input file: $f" >&5
 echo "$as_me: error: cannot find input file: $f" >&2;}
    { (exit 1); exit 1; }; }
          fi;;
@@ -3803,7 +3804,7 @@ cat >>$CONFIG_STATUS <<\EOF
   rm -f $tmp/in
   if test x"$ac_file" != x-; then
     if cmp -s $ac_file $tmp/config.h 2>/dev/null; then
-      { echo "$as_me:3806: $ac_file is unchanged" >&5
+      { echo "$as_me:3807: $ac_file is unchanged" >&5
 echo "$as_me: $ac_file is unchanged" >&6;}
     else
       ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
index 90d7f0d2f7a91d9109c49c4a178e7d217acf68e6..9f4d37eb5c5a45b52b49bc186d89b4e9245f49f7 100644 (file)
@@ -104,13 +104,14 @@ if test x$ac_cv_c_compiler_gnu = xyes; then
 
 # This breaks on gcc-3.0 on redhat fixing drl 11-15-2001
 #  GCC_INCLUDE_DIR=`LANGUAGE= LANG= $CC -v 2>&1 | sed -e '/^gcc/ d' -e 's/.* \(.*\)specs/\1include/'`
- GCC_INCLUDE_DIR=/usr/lib/gcc-lib/i386-linux/2.7.2.1/include
+GCC_INCLUDE_DIR=/usr/include
+# was /usr/lib/gcc-lib/i386-linux/2.7.2.1/include
 #  GCC_INCLUDE_DIR=`LANGUAGE= LANG= $CC -v 2>&1 | sed -n -e '/^gcc/ d' -e 's/.* \(.*\)specs/\1include/p'`
   AC_DEFINE_UNQUOTED(GCC_INCLUDE_DIR, "$GCC_INCLUDE_DIR",
-                     [gcc's private include directory])
+                     [system include directory])
 fi
 AC_DEFINE_UNQUOTED(GCC_INCLUDE_DIR2, "$myprefix/include",
-                   [the system's main include directory])
+                   [alternate include directory])
 
 # These used to be in local_constants.h
 AC_DEFINE_UNQUOTED(SYSTEM_LIBDIR, "$myprefix/include",
@@ -123,7 +124,7 @@ AC_DEFINE_UNQUOTED(DEFAULT_LCLIMPORTDIR, ".$PATH_SEPARATOR$myprefix/share/splint
 
 # These used to be in herald.h
 LCL_PARSE_VERSION="AC_PACKAGE_NAME AC_PACKAGE_VERSION"
-AC_DEFINE_UNQUOTED(LCL_VERSION,
+AC_DEFINE_UNQUOTED(SPLINT_VERSION,
                    "$LCL_PARSE_VERSION --- `cat $srcdir/src/DATE`",
                    [Splint's version number and release date])
 AC_DEFINE_UNQUOTED(LCL_PARSE_VERSION, "$LCL_PARSE_VERSION",
index c7e2fbfff5bad3f80fff6c32e1861c2bc58ad115..11e7d61c9df64acf0f77097e184c49f6482f85cc 100644 (file)
@@ -93,6 +93,7 @@ extern cstring osd_fixDefine (cstring);
 extern bool osd_fileIsReadable (cstring);
 
 extern bool osd_isConnectChar (char) /*@*/ ;
+extern /*@observer@*/ cstring osd_getCurrentDirectory (void) /*@*/ ;
 
 # ifdef WIN32
 extern int osd_getPid (void) ;
index 9b57d952227af8667e1d026359a8229d764d280f..f7f3e92afc9f9bcd828386add2e8deee404ba5d3 100644 (file)
@@ -89,6 +89,7 @@ fileTable_getIndex (fileTable ft, cstring s)
   cstring abspath;
   if (ft == NULL) return NOT_FOUND;
   abspath = osd_absolutePath (cstring_undefined, s);
+  DPRINTF (("Absolute path: %s: %s", s, abspath));
   res = cstringTable_lookup (ft->htable, abspath);
   cstring_free (abspath);
   return res;
@@ -257,6 +258,7 @@ fileTable_internAddEntry (fileTable ft, /*@only@*/ ftentry e)
 
   ft->nspace--;
 
+  DPRINTF (("Adding: %s", e->fname));
   cstringTable_insert (ft->htable, e->fname, ft->nentries);
   ft->elements[ft->nentries] = e;
 
@@ -555,9 +557,14 @@ fileTable_exists (fileTable ft, cstring s)
   int tindex = fileTable_getIndex (ft, s);
 
   if (tindex == NOT_FOUND)
-    return FALSE;
+    {
+      DPRINTF (("Not found: %s", s));
+      return FALSE;
+    }
   else
-    return TRUE;
+    {
+      return TRUE;
+    }
 }
 
 fileId
index 8a589c7f1c6f5db47a28da9712f863e09fe45c1b..db6372ecb100fe9cf82d7d4826007be90310eac6 100644 (file)
@@ -98,6 +98,7 @@ static bool s_needsPrepare = TRUE;
 void prepareMessage (void)
 {
   DPRINTF (("Prepare message: %s", bool_unparse (context_loadingLibrary ())));
+  showHerald ();
 
   if ((context_isPreprocessing () || context_loadingLibrary ())
       && s_needsPrepare
index f8f5a6413fc0c81227d17a634d82acaaa2d33675..ed9072cf459bd94556cb61563ff86ba95d3a71f1 100644 (file)
@@ -91,8 +91,14 @@ static void cleanupFiles (void);
 static void showHelp (void);
 static void interrupt (int p_i);
 
+static bool readOptionsFile (cstring p_fname,
+                            cstringSList *p_passThroughArgs,
+                            bool p_report) 
+   /*@modifies fileSystem, internalState, *p_passThroughArgs@*/ ;
+   
 static void loadrc (FILE *p_rcfile, cstringSList *p_passThroughArgs)
-     /*@ensures closed p_rcfile@*/ ;
+   /*@modifies *p_passThroughArgs@*/
+   /*@ensures closed p_rcfile@*/ ;
 
 static void describeVars (void);
 static bool specialFlagsHelp (char *p_next);
@@ -778,34 +784,31 @@ int main (int argc, char *argv[])
        
        if (*thisarg == '-' || *thisarg == '+')
          {
+           bool set = (*thisarg == '+');
+           flagcode opt;
+
            thisarg++;
+           opt = identifyFlag (cstring_fromChars (thisarg));
 
-           if (mstring_equal (thisarg, "nof"))
+           if (opt == FLG_NOF)
              {
                nof = TRUE;
              }
-           else if (mstring_equal (thisarg, "f"))
+           else if (opt == FLG_SHOWSCAN || opt == FLG_WARNRC)
+             {
+               /*
+               ** Need to set it immediately, so rc file scan is displayed
+               */
+
+               context_userSetFlag (opt, set);
+             }
+           else if (opt == FLG_OPTF)
              {
                if (++i < argc)
                  {
                    defaultf = FALSE;
                    fname = cstring_fromChars (argv[i]);
-                   rcfile = fileTable_openFile (context_fileTable (), fname, "r");
-
-                   if (rcfile != NULL)
-                     {
-                       fileloc oloc = g_currentloc;
-                       
-                       g_currentloc = fileloc_createRc (cstring_fromChars (fname));
-                       loadrc (rcfile, &passThroughArgs);
-                       fileloc_reallyFree (g_currentloc); 
-                       g_currentloc = oloc;
-                     }
-                   else 
-                     {
-                       showHerald ();
-                       lldiagmsg (message ("Options file not found: %s", fname));
-                     }
+                   readOptionsFile (fname, &passThroughArgs, TRUE);
                  }
                else
                  llfatalerror
@@ -818,94 +821,72 @@ int main (int argc, char *argv[])
              }
          }
       }
-    
-    if (cstring_isUndefined (fname))
-      {
-       if (!cstring_isEmpty (home)) {
-         fname = message ("%s%h%s", home, CONNECTCHAR,
-                          cstring_fromChars (RCFILE));
-         cstring_markOwned (fname);
-       }
-      }
-
+        
     setCodePoint ();
 
     if (!nof && defaultf)
       {
-       if (!cstring_isEmpty (fname)) 
-         {
-           rcfile = fileTable_openFile (context_fileTable (), fname, "r");
-           
-           if (rcfile != NULL)
-             {
-               fileloc oloc = g_currentloc;
-               
-               g_currentloc = fileloc_createRc (fname);
-               loadrc (rcfile, &passThroughArgs);
-               fileloc_reallyFree (g_currentloc);
-               g_currentloc = oloc;
-             }
-         }
-       
-# if defined(MSDOS) || defined(OS2)
-       fname = message ("%s",cstring_fromChars (RCFILE));
-# else
-       fname = message ("./%s", cstring_fromChars (RCFILE));
-# endif
-       
-       rcfile = fileTable_openFile (context_fileTable (), fname, "r");
-
        /*
-       ** If no RCFILE, try ALTRCFILE
+       ** No explicit rc file, first try reading ~/.splintrc
        */
 
-       if (rcfile == NULL)
-         {
-           cstring_free (fname);
-# if defined(MSDOS) || defined(OS2)
-           fname = message ("%s", cstring_fromChars (ALTRCFILE));
-# else
-           fname = message ("./%s", cstring_fromChars (ALTRCFILE));
-# endif
-           rcfile = fileTable_openFile (context_fileTable (), fname, "r");
-         }
-       else
+       if (cstring_isUndefined (fname))
          {
-           /*
-           ** Warn if ALTRCFILE also exists
-           */
-           cstring afname;
-           FILE *arcfile;
-           
-# if defined(MSDOS) || defined(OS2)
-           afname = message ("%s", cstring_fromChars (ALTRCFILE));
-# else
-           afname = message ("./%s", cstring_fromChars (ALTRCFILE));
-# endif
-           arcfile = fileTable_openFile (context_fileTable (), afname, "r");
-           
-           if (arcfile != NULL)
+           if (!cstring_isEmpty (home)) 
              {
-               voptgenerror (FLG_WARNRC,
-                             message ("Found both %s and %s files.  Using %s file only.",
-                                      fname, afname, fname),
-                             g_currentloc);
+               bool readhomerc, readaltrc;
+               cstring homename, altname;
+
+               homename = message ("%s%h%s", home, CONNECTCHAR,
+                                cstring_fromChars (RCFILE));
+               readhomerc = readOptionsFile (homename, &passThroughArgs, FALSE);
                
-               fileTable_closeFile (context_fileTable (), arcfile);
+               /*
+               ** Try ~/.lclintrc also for historical accuracy
+               */
+               
+               altname = message ("%s%h%s", home, CONNECTCHAR,
+                                cstring_fromChars (ALTRCFILE));
+               readaltrc = readOptionsFile (altname, &passThroughArgs, FALSE);
+
+               if (readhomerc && readaltrc)
+                 {
+
+                   voptgenerror 
+                     (FLG_WARNRC,
+                      message ("Found both %s and %s files. Using both files, "
+                               "but recommend using only %s to avoid confusion.",
+                               homename, altname, homename),
+                      g_currentloc);
+                 }
              }
          }
        
-       if (rcfile != NULL)
-         {
-           fileloc oloc = g_currentloc;
-
-           g_currentloc = fileloc_createRc (cstring_fromChars (fname));
-           loadrc (rcfile, &passThroughArgs);
-           fileloc_reallyFree (g_currentloc);
-           g_currentloc = oloc;
-         }
+       /*
+       ** Next, read .splintrc in the current working directory
+       */
+       
+       {
+         cstring rcname = message ("%s%s",osd_getCurrentDirectory (), cstring_fromChars (RCFILE));
+         cstring altname = message ("%s%s",osd_getCurrentDirectory (), cstring_fromChars (ALTRCFILE));
+         bool readrc, readaltrc;
+         
+         readrc = readOptionsFile (rcname, &passThroughArgs, FALSE);
+         readaltrc = readOptionsFile (altname, &passThroughArgs, FALSE);
+         
+         if (readrc && readaltrc)
+           {
+             voptgenerror (FLG_WARNRC,
+                           message ("Found both %s and %s files. Using both files, "
+                                    "but recommend using only %s to avoid confusion.",
+                                    rcname, altname, rcname),
+                           g_currentloc);
+             
+           }
 
-       sfree (fname); 
+         cstring_free (rcname);
+         cstring_free (altname);
+       }
       }
   }
   
@@ -1020,8 +1001,9 @@ int main (int argc, char *argv[])
              opt = identifyFlag (flagname);
              DPRINTF (("Flag: %s", flagcode_unparse (opt)));
 
-             if (flagcode_isSkip (opt))
+             if (flagcode_isSkip (opt) || opt == FLG_SHOWSCAN || opt == FLG_WARNRC)
                {
+                 /* showscan already processed */
                  DPRINTF (("Skipping!"));
                }
              else if (flagcode_isInvalid (opt))
@@ -1158,7 +1140,8 @@ int main (int argc, char *argv[])
     }
 
   setCodePoint ();  
-
+  showHerald (); 
+  
   /*
   ** create lists of C and LCL files
   */
@@ -1215,8 +1198,6 @@ int main (int argc, char *argv[])
        }
     } end_cstringSList_elements;
   
-    showHerald (); /*@i723 move earlier? */
-  
   if (showhelp)
     {
       if (allhelp)
@@ -2264,6 +2245,55 @@ llexit (int status)
   exit ((status == LLSUCCESS) ? EXIT_SUCCESS : EXIT_FAILURE);
 }
 
+bool readOptionsFile (cstring fname, cstringSList *passThroughArgs, bool report)
+{
+  bool res = FALSE;
+
+  if (fileTable_exists (context_fileTable (), fname))
+    {
+      if (report)
+       {
+         voptgenerror
+           (FLG_WARNRC, 
+            message ("Multiple attempts to read options file: %s", fname),
+            g_currentloc);
+       }
+    }
+  else
+    {
+      FILE *innerf = fileTable_openFile (context_fileTable (), fname, "r");
+      
+      if (innerf != NULL)
+       {
+         fileloc fc = g_currentloc;
+         g_currentloc = fileloc_createRc (fname);
+
+         if (context_getFlag (FLG_SHOWSCAN))
+           {
+             lldiagmsg (message ("< reading options from %s >", 
+                                 fileloc_outputFilename (g_currentloc)));
+           }
+         
+         loadrc (innerf, passThroughArgs);
+         fileloc_reallyFree (g_currentloc);
+         g_currentloc = fc;
+         res = TRUE;
+       }
+      else 
+       {
+         if (report)
+           {
+             voptgenerror
+               (FLG_WARNRC, 
+                message ("Cannot open options file: %s", fname),
+                g_currentloc);
+           }
+       }
+    }
+
+  return res;
+}
+
 /*
 ** This shouldn't be necessary, but Apple Darwin can't handle '"''s.
 */
@@ -2274,7 +2304,7 @@ loadrc (/*:open:*/ FILE *rcfile, cstringSList *passThroughArgs)
 {
   char *s = mstring_create (MAX_LINE_LENGTH);
   char *os = s;
-
+  
   DPRINTF (("Pass through: %s", cstringSList_unparse (*passThroughArgs)));
 
   s = os;
@@ -2499,26 +2529,7 @@ loadrc (/*:open:*/ FILE *rcfile, cstringSList *passThroughArgs)
                            }
                          else if (opt == FLG_OPTF)
                            {
-                             FILE *innerf = fileTable_openFile (context_fileTable (), extra, "r");
-                             cstring_markOwned (extra);
-                             
-                             if (innerf != NULL)
-                               {
-                                 fileloc fc = g_currentloc;
-                                 g_currentloc = fileloc_createRc (extra);
-                                 loadrc (innerf, passThroughArgs);
-                                 fileloc_reallyFree (g_currentloc);
-                                 g_currentloc = fc;
-                               }
-                             else 
-                               {
-                                 showHerald ();
-                                 voptgenerror
-                                   (FLG_BADFLAG, 
-                                    message ("Options file not found: %s", 
-                                             extra),
-                                    g_currentloc);
-                               }
+                             (void) readOptionsFile (extra, passThroughArgs, TRUE);
                            }
                          else if (opt == FLG_INIT)
                            {
index 1ea84efcd2da608cc0413bee3f40cbe83485109d..1f9a2d7864adacdb5d50b82a07a805da98f1ebab 100644 (file)
--- a/src/osd.c
+++ b/src/osd.c
@@ -1087,5 +1087,14 @@ cstring osd_outputPath (cstring filename)
 # endif
 }
 
+cstring osd_getCurrentDirectory ()
+{
+# if defined(MSDOS) || defined(OS2)
+  return cstring_makeLiteralTemp ("");
+# else
+  return cstring_makeLiteralTemp ("./");
+# endif
+}
+
 
 
index 7bba3f167e3ba664b42c209962a0d7a3f2e33115..8f235224ae5295897c38bfed0e6a26913a95f4d7 100644 (file)
@@ -43,6 +43,8 @@ static bool uentry_isReallySpecified (uentry p_e) /*@*/ ;
 static void uentry_checkIterArgs (uentry p_ue);
 static cstring uentry_dumpAux (uentry p_v, bool p_isParam);
 
+static void uentry_showWhereLastKind (uentry p_spec) /*@*/ ; 
+
 static void uentry_combineModifies (uentry p_ue, /*@owned@*/ sRefSet p_sr) 
      /*@modifies p_ue@*/ ;
 
@@ -6822,9 +6824,9 @@ KindConformanceError (/*@unique@*/ uentry old, uentry unew, bool mustConform)
                                    uentry_getName (unew),
                                    ekind_unparseLong (unew->ukind),
                                    unew->utype),
-                          uentry_whereDeclared (unew)))
+                          uentry_whereLast (unew)))  /* evans 2001-12-30: was uentry_whereDeclared */
                        {
-                         uentry_showWhereLast (old);
+                         uentry_showWhereLastKind (old);
                        }
                    }
                  else
@@ -6841,9 +6843,9 @@ KindConformanceError (/*@unique@*/ uentry old, uentry unew, bool mustConform)
                                uentry_getName (unew),
                                ekind_unparseLong (unew->ukind),
                                unew->utype),
-                      uentry_whereDeclared (unew)))
+                      uentry_whereLast (unew))) /* evans 2001-12-30: was uentry_whereDeclared */
                    {
-                     uentry_showWhereLast (old);
+                     uentry_showWhereLastKind (old);
                    }
                }
            }
@@ -6851,15 +6853,18 @@ KindConformanceError (/*@unique@*/ uentry old, uentry unew, bool mustConform)
            {
              llassert (uentry_isDeclared (unew));
 
+             DPRINTF (("Old: \n\t%s", uentry_unparseFull (old)));
+             DPRINTF (("New: \n\t%s", uentry_unparseFull (unew)));
+
              if (optgenerror
                  (FLG_INCONDEFS,
                   message ("%s %q inconsistently redeclared as %s",
                            ekind_capName (old->ukind),
                            uentry_getName (unew),
                            ekind_unparseLong (unew->ukind)),
-                  uentry_whereDeclared (unew)))
+                  uentry_whereLast (unew))) /* evans 2001-12-30: was uentry_whereDeclared */
                {
-                 uentry_showWhereLast (old);
+                 uentry_showWhereLastKind (old);
                }
            }
        }
@@ -6883,7 +6888,7 @@ uentry_showWhereLast (uentry spec)
     {
       if (fileloc_isDefined (spec->whereDefined)
          && !fileloc_isLib (spec->whereDefined)
-         && !fileloc_isPreproc (spec->whereDefined))
+         /*!! && !fileloc_isPreproc (spec->whereDefined) */ )
        {
          llgenindentmsg (message ("Previous definition of %q: %t", 
                                   uentry_getName (spec),
@@ -6919,6 +6924,54 @@ uentry_showWhereLast (uentry spec)
     }
 }
 
+static void
+uentry_showWhereLastKind (uentry spec)
+{
+  if (uentry_isValid (spec))
+    {
+      if (fileloc_isDefined (spec->whereDefined)
+         && !fileloc_isLib (spec->whereDefined)
+         /*!! && !fileloc_isPreproc (spec->whereDefined) */ )
+       {
+         llgenindentmsg (message ("Previous definition of %q as %s: %t", 
+                                  uentry_getName (spec),
+                                  ekind_unparseLong (spec->ukind),
+                                  uentry_getType (spec)),
+                         uentry_whereDefined (spec));
+       }
+      else if (uentry_isDeclared (spec))
+       {
+         llgenindentmsg (message ("Previous declaration of %q as %s: %t", 
+                                  uentry_getName (spec),
+                                  ekind_unparseLong (spec->ukind),
+                                  uentry_getType (spec)),
+                         uentry_whereDeclared (spec));
+       }
+      else if (uentry_isSpecified (spec))
+       {
+         if (uentry_hasName (spec))
+           {
+             llgenindentmsg (message ("Specification of %q as %s: %t", 
+                                      uentry_getName (spec),
+                                      ekind_unparseLong (spec->ukind),
+                                      uentry_getType (spec)),
+                             uentry_whereSpecified (spec));
+           }
+         else
+           {
+             llgenindentmsg (message ("Specification as %s: %t",
+                                      ekind_unparseLong (spec->ukind),
+                                      uentry_getType (spec)),
+                             uentry_whereSpecified (spec));
+           }
+       }
+      else
+       {
+         /* nothing to show */
+       }
+    }
+}
+
 void
 uentry_showDefSpecInfo (uentry ce, fileloc fwhere)
 {
index a7bf2ab52619a230127d25f588678aa4f639329d..b6fbfa56c368cce3aa2bb2f03567586a43f3837d 100644 (file)
@@ -17,15 +17,15 @@ unexport LCLIMPORTDIR
 ### This is horrible!  Can't we make top_builddir absolute?
 SPLINTNEST = ../$(top_builddir)/src/splint$(EXEEXT)
 
-SPLINTPNEST = @$(SPLINTNEST)
-SPLINTP   = @$(SPLINT)
+SPLINTPNEST = @$(SPLINTNEST) -nof
+SPLINTP   = @$(SPLINT) -nof
 
 # Make sure .splintrc files are not used so test results do not
 # depend on local settings.
-SPLINTRN  = $(SPLINTP) -nof -hints -booltype "bool"
+SPLINTRN  = $(SPLINTP) -hints -booltype "bool"
 SPLINTR   = $(SPLINTRN) -exportlocal +debugfcnconstraint
 
-SPLINTRNNEST  = $(SPLINTPNEST) -nof -hints -booltype "bool"
+SPLINTRNNEST  = $(SPLINTPNEST) -hints -booltype "bool"
 SPLINTRNEST   = $(SPLINTRNNEST) -exportlocal +debugfcnconstraint
 
 ## Currently disabled tests:
@@ -33,12 +33,8 @@ SPLINTRNEST   = $(SPLINTRNNEST) -exportlocal +debugfcnconstraint
 ##  nullret nullassign warnuse
 
 ###
-### !!! 
-### These tests have been temporarily removed because of problems with the new build process:
-###   fileio tainted mergestate metastate \
-###   tests2.2 tests2.2a tests2.4 tests2.5 
-###  
-###   maxset strchr for
+### rcfiles not included becuase file names will not match exactly
+###
 
 UNITTESTS = \
   help \
@@ -53,10 +49,10 @@ UNITTESTS = \
   funcpointer glob globals impabstract init inparam internal iter keep libs \
   linked lintcomments list macros macrosef merge mergenull modifies modtest moduncon \
   mongoincludes mystrncat noeffect null observer oldstyle outglob outparam \
-  postnotnull preds prefixes printflike rc rcfiles refcounts release repexpose \
+  postnotnull preds prefixes printflike rc refcounts release repexpose \
   returned sharing slovaknames specclauses special stack staticarray strings \
   structassign typequals ud ulstypes union unreachable unsignedcompare \
-  unused ullint void
+  unused ullint utypes void
 UNITEXPECTS = $(addsuffix .expect, $(UNITTESTS))
 
 INTEGTESTS = db1 db2 db3
@@ -75,8 +71,8 @@ version:
 
 .PHONY: help
 help:
-       -@$(SPLINTP)
-       -@LARCH_PATH=/dev/null; $(SPLINT) empty.lcl
+       -@$(SPLINT)
+       -@LARCH_PATH=/dev/null; $(SPLINT) -nof empty.lcl
        -@$(SPLINTP) -help
        -@$(SPLINTP) -asdf
        -@$(SPLINTP) +boolint +boolint 
@@ -728,6 +724,16 @@ ullint:
        ${SPLINTRN} ullint.c -expect 5
        ${SPLINTRN} ullint.c +charint +charintliteral -expect 2
 
+###
+### 2001-12-30: Poor warnings reported by Peter Deutsch
+###
+
+.PHONY: utypes
+utypes:
+       ${SPLINTRN} utypes.c -expect 6
+
+###
+
 .PHONY: void
 void:
        ${SPLINTRN} void.c -expect 2
index 24a6ba8b0ac028a32ed41daca5fc3eeb5e09bdf6..bbd2857a9cc3c66a9c2c3fd2ce1f7f6106a89d66 100644 (file)
@@ -90,25 +90,21 @@ SPLINT = $(top_builddir)/src/splint$(EXEEXT)
 ### This is horrible!  Can't we make top_builddir absolute?
 SPLINTNEST = ../$(top_builddir)/src/splint$(EXEEXT)
 
-SPLINTPNEST = @$(SPLINTNEST)
-SPLINTP = @$(SPLINT)
+SPLINTPNEST = @$(SPLINTNEST) -nof
+SPLINTP = @$(SPLINT) -nof
 
 # Make sure .splintrc files are not used so test results do not
 # depend on local settings.
-SPLINTRN = $(SPLINTP) -nof -hints -booltype "bool"
+SPLINTRN = $(SPLINTP) -hints -booltype "bool"
 SPLINTR = $(SPLINTRN) -exportlocal +debugfcnconstraint
 
-SPLINTRNNEST = $(SPLINTPNEST) -nof -hints -booltype "bool"
+SPLINTRNNEST = $(SPLINTPNEST) -hints -booltype "bool"
 SPLINTRNEST = $(SPLINTRNNEST) -exportlocal +debugfcnconstraint
 
 
 ###
-### !!! 
-### These tests have been temporarily removed because of problems with the new build process:
-###   fileio tainted mergestate metastate \
-###   tests2.2 tests2.2a tests2.4 tests2.5 
-###  
-###   maxset strchr for
+### rcfiles not included becuase file names will not match exactly
+###
 UNITTESTS = \
   help \
   fileio tainted mergestate metastate sizeof buffertest \
@@ -122,10 +118,10 @@ UNITTESTS = \
   funcpointer glob globals impabstract init inparam internal iter keep libs \
   linked lintcomments list macros macrosef merge mergenull modifies modtest moduncon \
   mongoincludes mystrncat noeffect null observer oldstyle outglob outparam \
-  postnotnull preds prefixes printflike rc rcfiles refcounts release repexpose \
+  postnotnull preds prefixes printflike rc refcounts release repexpose \
   returned sharing slovaknames specclauses special stack staticarray strings \
   structassign typequals ud ulstypes union unreachable unsignedcompare \
-  unused ullint void
+  unused ullint utypes void
 
 UNITEXPECTS = $(addsuffix .expect, $(UNITTESTS))
 
@@ -907,8 +903,8 @@ version:
 
 .PHONY: help
 help:
-       -@$(SPLINTP)
-       -@LARCH_PATH=/dev/null; $(SPLINT) empty.lcl
+       -@$(SPLINT)
+       -@LARCH_PATH=/dev/null; $(SPLINT) -nof empty.lcl
        -@$(SPLINTP) -help
        -@$(SPLINTP) -asdf
        -@$(SPLINTP) +boolint +boolint 
@@ -1537,6 +1533,16 @@ ullint:
        ${SPLINTRN} ullint.c -expect 5
        ${SPLINTRN} ullint.c +charint +charintliteral -expect 2
 
+###
+### 2001-12-30: Poor warnings reported by Peter Deutsch
+###
+
+.PHONY: utypes
+utypes:
+       ${SPLINTRN} utypes.c -expect 6
+
+###
+
 .PHONY: void
 void:
        ${SPLINTRN} void.c -expect 2
index b7e08a8077b3473b429f7828b748c1f99d94ada2..0bde7dd4f1e39ff5abf3a6cbcddf57a531122f91 100644 (file)
@@ -54,11 +54,11 @@ ansireserved.c:9: Name EVANS is reserved for future ANSI library extensions.
     <errno.h>. (See ANSI, Section 4.13.1)
 ansireserved.c:1:5: Name decimal_point is reserved for the standard library
 ansireserved.c:2:5: Function srand inconsistently declared as variable: int
-   load file ansi.lcd:897:1: Specification of srand:
+   load file ansi.lcd:897:1: Specification of srand as function:
    [function (unsigned int) returns void]
 ansireserved.c:2:5: Name srand is reserved for the standard library
 ansireserved.c:3:5: Function labs inconsistently declared as variable: int
-   load file ansi.lcd:919:1: Specification of labs:
+   load file ansi.lcd:919:1: Specification of labs as function:
    [function (long int) returns long int]
 ansireserved.c:3:5: Name labs is reserved for the standard library
 ansireserved.c:4:5: Name _x is in the implementation name space (any identifier
diff --git a/test/mergenull.c b/test/mergenull.c
new file mode 100644 (file)
index 0000000..0026126
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+** Added 2001-12-29
+** Test for branchstate bug reported by Jon Wilson
+*/
+
+typedef /*@null@*/ struct s_foo *foo;
+
+struct s_foo {
+  foo p;
+} ;
+
+void f (foo a)
+{
+  while ( a != NULL ) {
+    foo temp = a->p ;
+    a->p = NULL ;
+    a = temp ;
+  }
+}
+  
diff --git a/test/mergenull.expect b/test/mergenull.expect
new file mode 100644 (file)
index 0000000..2b06c77
--- /dev/null
@@ -0,0 +1,2 @@
+
+Finished checking --- no warnings
diff --git a/test/utypes.c b/test/utypes.c
new file mode 100644 (file)
index 0000000..38cda60
--- /dev/null
@@ -0,0 +1,27 @@
+/* Define short names for the unsigned types. */
+typedef unsigned char byte;
+typedef unsigned char uchar;
+typedef unsigned short ushort;
+typedef unsigned int uint;
+typedef unsigned long ulong;
+
+/* Since sys/types.h often defines one or more of these (depending on */
+/* the platform), we have to take steps to prevent name clashes. */
+/*** NOTE: This requires that you include std.h *before* any other ***/
+/*** header file that includes sys/types.h. ***/
+#define bool bool_          /* (maybe not needed) */
+#define uchar uchar_
+#define uint uint_
+#define ushort ushort_
+#define ulong ulong_
+#include <sys/types.h>
+#undef bool
+#undef uchar
+#undef uint
+#undef ushort
+#undef ulong
+
+void f (unsigned int width)
+{
+  uint src_bytes = width >> 3;
+}
diff --git a/test/utypes.expect b/test/utypes.expect
new file mode 100644 (file)
index 0000000..008e619
--- /dev/null
@@ -0,0 +1,17 @@
+
+utypes.c:16: Include file <sys/types.h> matches the name of a POSIX library,
+    but the POSIX library is not being used.  Consider using +posixlib or
+    +posixstrictlib to select the POSIX library, or -warnposix to suppress this
+    message.
+utypes.c:3:23: Variable uchar inconsistently redeclared as datatype
+   utypes.c:13: Previous definition of uchar as variable: ?
+utypes.c:4:24: Variable ushort inconsistently redeclared as datatype
+   utypes.c:15: Previous definition of ushort as variable: ?
+utypes.c:5:22: Variable uint inconsistently redeclared as datatype
+   utypes.c:14: Previous definition of uint as variable: ?
+utypes.c:6:23: Variable ulong inconsistently redeclared as datatype
+   utypes.c:16: Previous definition of ulong as variable: ?
+utypes.c: (in function f)
+utypes.c:26:8: Variable src_bytes declared but not used
+
+Finished checking --- 6 code warnings, as expected
This page took 0.093437 seconds and 5 git commands to generate.