From 4caf866b3d452c738cb276e805e48e4f1ccd2eba Mon Sep 17 00:00:00 2001 From: evans1629 Date: Sun, 20 Apr 2003 22:45:10 +0000 Subject: [PATCH] Making fixes for Microsoft Visual C++ compiler. Moved portab.h into osd.h (and removed portab.h) removed empty constraintOutput.c --- lib/standard.h | 15 ------ src/Headers/basic.h | 5 ++ src/Headers/bool.h | 12 +++++ src/Headers/cpplib.h | 61 +++++++++++----------- src/Headers/forwardTypes.h | 5 ++ src/Headers/lclMisc.h | 2 - src/Headers/osd.h | 102 ++++++++++++++++++++++++++++++++++++ src/Headers/portab.h | 104 ------------------------------------- src/constraintOutput.c | 34 ------------ src/cpplib.c | 9 ++++ src/cscanner.l | 2 +- src/cscannerHelp.c | 1 + src/fileTable.c | 22 ++++++-- src/fileloc.c | 3 +- src/flags.c | 5 +- src/flags.def | 8 +-- src/general.c | 15 +----- src/help.c | 1 + src/imports.c | 1 - src/lcllib.c | 1 - src/llmain.c | 4 +- src/message.c | 6 ++- src/osd.c | 1 - src/stateInfo.c | 9 ++++ src/uentry.c | 7 +-- src/usymtab_interface.c | 4 +- test/preds.expect | 8 +-- 27 files changed, 217 insertions(+), 230 deletions(-) delete mode 100644 src/Headers/portab.h delete mode 100644 src/constraintOutput.c diff --git a/lib/standard.h b/lib/standard.h index f3eb80a..ee6185f 100644 --- a/lib/standard.h +++ b/lib/standard.h @@ -1263,18 +1263,3 @@ typedef /*@unsignedintegraltype@*/ uintmax_t; /*@constant size_t INTPTR_MIN@*/ /*@constant size_t INTPTR_MAX@*/ - -/*drl 3/5/2003 - added the __func__ identifier from C99 - This won't follow the same semantics as - __func__ in C99 - - FWIW C99 says that __func__ should have the value of the - lexically enclosing function - e.g. in the function foo __func__ == "foo" - in bar __func__ == "bar" - - We're just having the value be constant here and picking - an arbitary value. -*/ -const char __func__[] = "function-name"; diff --git a/src/Headers/basic.h b/src/Headers/basic.h index d6ba7ff..5fd921a 100644 --- a/src/Headers/basic.h +++ b/src/Headers/basic.h @@ -21,7 +21,12 @@ # include # include + +# ifndef WIN32 +/* Microsoft VC++ still doesn't support ISO C99... */ # include +# endif + # include # include # include diff --git a/src/Headers/bool.h b/src/Headers/bool.h index fd05907..d0e0be5 100644 --- a/src/Headers/bool.h +++ b/src/Headers/bool.h @@ -7,6 +7,17 @@ # define BOOL_H +# ifdef WIN32 +# ifndef FALSE +/*@constant bool FALSE=false@*/ +# define FALSE 0 +# endif + +# ifndef TRUE +/*@constant bool TRUE=true@*/ +# define TRUE (!FALSE) +# endif +# else # ifndef FALSE /*@constant bool FALSE=false@*/ # define FALSE false @@ -16,6 +27,7 @@ /*@constant bool TRUE=true@*/ # define TRUE true # endif +# endif extern /*@observer@*/ cstring bool_unparse (bool p_b) /*@*/ ; extern /*@observer@*/ cstring bool_dump (bool p_b) /*@*/ ; diff --git a/src/Headers/cpplib.h b/src/Headers/cpplib.h index c4778b1..e00c063 100644 --- a/src/Headers/cpplib.h +++ b/src/Headers/cpplib.h @@ -417,37 +417,38 @@ extern bool cppReader_isPedantic (cppReader *) /*@*/; /* different flavors of hash nodes --- also used in keyword table */ enum node_type { T_NONE = 0, - T_DEFINE = 1, /* the `#define' keyword */ - T_INCLUDE, /* the `#include' keyword */ - T_INCLUDE_NEXT, /* the `#include_next' keyword */ - T_IFDEF, /* the `#ifdef' keyword */ - T_IFNDEF, /* the `#ifndef' keyword */ - T_IF, /* the `#if' keyword */ - T_ELSE, /* `#else' */ - T_PRAGMA, /* `#pragma' */ - T_ELIF, /* `#elif' */ - T_UNDEF, /* `#undef' */ - T_LINE, /* `#line' */ - T_ERROR, /* `#error' */ - T_WARNING, /* `#warning' */ - T_ENDIF, /* `#endif' */ - T_IDENT, /* `#ident', used on system V. */ - T_SPECLINE, /* special symbol `__LINE__' */ - T_DATE, /* `__DATE__' */ - T_FILE, /* `__FILE__' */ - T_BASE_FILE, /* `__BASE_FILE__' */ - T_INCLUDE_LEVEL, /* `__INCLUDE_LEVEL__' */ - T_VERSION, /* `__VERSION__' */ - T_SIZE_TYPE, /* `__SIZE_TYPE__' */ - T_PTRDIFF_TYPE, /* `__PTRDIFF_TYPE__' */ - T_WCHAR_TYPE, /* `__WCHAR_TYPE__' */ - T_USER_LABEL_PREFIX_TYPE, /* `__USER_LABEL_PREFIX__' */ - T_REGISTER_PREFIX_TYPE, /* `__REGISTER_PREFIX__' */ - T_TIME, /* `__TIME__' */ - T_CONST, /* Constant value, used by `__STDC__' */ - T_MACRO, /* macro defined by `#define' */ + T_DEFINE = 1, /* the #define keyword */ + T_INCLUDE, /* the #include keyword */ + T_INCLUDE_NEXT, /* the #include_next keyword */ + T_IFDEF, /* the #ifdef keyword */ + T_IFNDEF, /* the #ifndef keyword */ + T_IF, /* the #if keyword */ + T_ELSE, /* #else */ + T_PRAGMA, /* #pragma */ + T_ELIF, /* #elif */ + T_UNDEF, /* #undef */ + T_LINE, /* #line */ + T_ERROR, /* #error */ + T_WARNING, /* #warning */ + T_ENDIF, /* #endif */ + T_IDENT, /* #ident, used on system V. */ + T_SPECLINE, /* special symbol __LINE__ */ + T_DATE, /* __DATE__ */ + T_FILE, /* __FILE__ */ + T_BASE_FILE, /* __BASE_FILE__ */ + T_INCLUDE_LEVEL, /* __INCLUDE_LEVEL__ */ + T_FUNC, /* __func__ */ + T_VERSION, /* __VERSION__ */ + T_SIZE_TYPE, /* __SIZE_TYPE__ */ + T_PTRDIFF_TYPE, /* __PTRDIFF_TYPE__ */ + T_WCHAR_TYPE, /* __WCHAR_TYPE__ */ + T_USER_LABEL_PREFIX_TYPE, /* __USER_LABEL_PREFIX__ */ + T_REGISTER_PREFIX_TYPE, /* __REGISTER_PREFIX__ */ + T_TIME, /* __TIME__ */ + T_CONST, /* Constant value, used by __STDC__ */ + T_MACRO, /* macro defined by #define */ T_DISABLED, /* macro temporarily turned off for rescan */ - T_SPEC_DEFINED, /* special `defined' macro for use in #if statements */ + T_SPEC_DEFINED, /* special defined macro for use in #if statements */ T_PCSTRING, /* precompiled string (hashval is KEYDEF *) */ T_UNUSED /* Used for something not defined. */ } ; diff --git a/src/Headers/forwardTypes.h b/src/Headers/forwardTypes.h index aef68f5..b55a8d2 100644 --- a/src/Headers/forwardTypes.h +++ b/src/Headers/forwardTypes.h @@ -3,6 +3,11 @@ # include "lclForwardTypes.h" +# ifdef WIN32 +/* Microsoft doesn't support ISO C99 yet */ +typedef int bool; +# endif + abst_typedef /*@null@*/ struct s_sRef *sRef; abst_typedef /*@null@*/ struct s_uentry *uentry; typedef struct s_hashNode *hashNode; diff --git a/src/Headers/lclMisc.h b/src/Headers/lclMisc.h index 7b64163..0c4ecd9 100644 --- a/src/Headers/lclMisc.h +++ b/src/Headers/lclMisc.h @@ -3,8 +3,6 @@ typedef unsigned int bits; typedef long unsigned Handle; - -extern char *FormatInt (int p_i) /*@*/ ; extern bool firstWord (char *p_s, char *p_w); # endif diff --git a/src/Headers/osd.h b/src/Headers/osd.h index bf9387c..1f176b9 100644 --- a/src/Headers/osd.h +++ b/src/Headers/osd.h @@ -103,6 +103,108 @@ extern int osd_getPid (void) ; extern int /*pid_t*/ osd_getPid (void) ; # endif +# ifdef WIN32 +/* Win32 doesn't support ISO C99 correctly... */ +# define snprintf _snprintf +# endif + +/* +** Win32 convention? +*/ + +# if defined(__IBMC__) && defined(OS2) +# define S_IFMT (unsigned short)0xFFFF +# endif + +# if defined (OS2) || defined (MSDOS) || defined (WIN32) +/*@constant observer cstring INCLUDEPATH_VAR@*/ +# define INCLUDEPATH_VAR cstring_makeLiteralTemp ("INCLUDE") +# else +/*@constant observer cstring INCLUDEPATH_VAR@*/ +# define INCLUDEPATH_VAR cstring_makeLiteralTemp ("CPATH") +# endif + +#if defined (VMS) + +/* +** VMS is here, but hasn't been tested for many releases. Not sure if this works. +*/ + +/* +** Connection string inserted between directory and filename to make a +** full path name. +*/ + +# define CONNECTSTR ":" +# define CONNECTCHAR ':' + +/* Directory separator character for search list. */ +/*@constant static char PATH_SEPARATOR; @*/ +# define PATH_SEPARATOR ':' + +# elif defined(MSDOS) || defined(OS2) || defined(WIN32) + +/* Connection string inserted between directory and filename to make a */ +/* full path name. */ + +/*@constant observer char *CONNECTSTR@*/ +# define CONNECTSTR "\\" + +/*@constant char CONNECTCHAR@*/ +# define CONNECTCHAR '\\' + +# define HASALTCONNECTCHAR + +/*@constant char ALTCONNECTCHAR@*/ +# define ALTCONNECTCHAR '/' + +/* Directory separator character for search list. */ + +/*@constant char PATH_SEPARATOR; @*/ +# define PATH_SEPARATOR ';' + +#else +/* Connection string inserted between directory and filename to make a */ +/* full path name. */ + +/*@constant observer char *CONNECTSTR@*/ +# define CONNECTSTR "/" + +/*@constant char CONNECTCHAR; @*/ +# define CONNECTCHAR '/' + +/* Directory separator character for search list. */ +/*@constant char PATH_SEPARATOR; @*/ +# define PATH_SEPARATOR ':' + +#endif + + +# ifdef P_tmpdir + +# if defined(OS2) && defined(__IBMC__) +/*@constant observer char *DEFAULT_TMPDIR; @*/ +# define DEFAULT_TMPDIR "." +# else +/*@constant observer char *DEFAULT_TMPDIR; @*/ +# define DEFAULT_TMPDIR P_tmpdir +# endif +# else +# ifdef WIN32 +/*@constant observer char *DEFAULT_TMPDIR; @*/ +# define DEFAULT_TMPDIR "\\WINDOWS\\TEMP\\" +# else +/*@constant observer char *DEFAULT_TMPDIR; @*/ +# define DEFAULT_TMPDIR "/tmp/" +# endif /* WIN32 */ + +# endif /* P_tmpdir */ + +# else +# error "Multiple include" +# endif + + # else # error "Multiple include" # endif diff --git a/src/Headers/portab.h b/src/Headers/portab.h deleted file mode 100644 index 2b1a936..0000000 --- a/src/Headers/portab.h +++ /dev/null @@ -1,104 +0,0 @@ -/* -** Copyright (c) Massachusetts Institute of Technology 1994, 1995, 1996. -** See ../LICENSE for license information. -*/ - -# ifndef PORTAB_H -# define PORTAB_H - -/* -** Win32 convention? -*/ - -# if defined(__IBMC__) && defined(OS2) -# define S_IFMT (unsigned short)0xFFFF -# endif - -# if defined (OS2) || defined (MSDOS) || defined (WIN32) -/*@constant observer cstring INCLUDEPATH_VAR@*/ -# define INCLUDEPATH_VAR cstring_makeLiteralTemp ("INCLUDE") -# else -/*@constant observer cstring INCLUDEPATH_VAR@*/ -# define INCLUDEPATH_VAR cstring_makeLiteralTemp ("CPATH") -# endif - -#if defined (VMS) - -/* -** VMS is here, but hasn't been tested for many releases. Not sure if this works. -*/ - -/* -** Connection string inserted between directory and filename to make a -** full path name. -*/ - -# define CONNECTSTR ":" -# define CONNECTCHAR ':' - -/* Directory separator character for search list. */ -/*@constant static char PATH_SEPARATOR; @*/ -# define PATH_SEPARATOR ':' - -# elif defined(MSDOS) || defined(OS2) || defined(WIN32) - -/* Connection string inserted between directory and filename to make a */ -/* full path name. */ - -/*@constant observer char *CONNECTSTR@*/ -# define CONNECTSTR "\\" - -/*@constant char CONNECTCHAR@*/ -# define CONNECTCHAR '\\' - -# define HASALTCONNECTCHAR - -/*@constant char ALTCONNECTCHAR@*/ -# define ALTCONNECTCHAR '/' - -/* Directory separator character for search list. */ - -/*@constant char PATH_SEPARATOR; @*/ -# define PATH_SEPARATOR ';' - -#else -/* Connection string inserted between directory and filename to make a */ -/* full path name. */ - -/*@constant observer char *CONNECTSTR@*/ -# define CONNECTSTR "/" - -/*@constant char CONNECTCHAR; @*/ -# define CONNECTCHAR '/' - -/* Directory separator character for search list. */ -/*@constant char PATH_SEPARATOR; @*/ -# define PATH_SEPARATOR ':' - -#endif - - -# ifdef P_tmpdir - -# if defined(OS2) && defined(__IBMC__) -/*@constant observer char *DEFAULT_TMPDIR; @*/ -# define DEFAULT_TMPDIR "." -# else -/*@constant observer char *DEFAULT_TMPDIR; @*/ -# define DEFAULT_TMPDIR P_tmpdir -# endif -# else -# ifdef WIN32 -/*@constant observer char *DEFAULT_TMPDIR; @*/ -# define DEFAULT_TMPDIR "\\WINDOWS\\TEMP\\" -# else -/*@constant observer char *DEFAULT_TMPDIR; @*/ -# define DEFAULT_TMPDIR "/tmp/" -# endif /* WIN32 */ - -# endif /* P_tmpdir */ - -# else -# error "Multiple include" -# endif - diff --git a/src/constraintOutput.c b/src/constraintOutput.c deleted file mode 100644 index 1b3ab26..0000000 --- a/src/constraintOutput.c +++ /dev/null @@ -1,34 +0,0 @@ -/* -** Splint - annotation-assisted static program checker -** Copyright (C) 1994-2003 University of Virginia, -** Massachusetts Institute of Technology -** -** This program is free software; you can redistribute it and/or modify it -** under the terms of the GNU General Public License as published by the -** Free Software Foundation; either version 2 of the License, or (at your -** option) any later version. -** -** This program is distributed in the hope that it will be useful, but -** WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** General Public License for more details. -** -** The GNU General Public License is available from http://www.gnu.org/ or -** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -** MA 02111-1307, USA. -** -** For information on splint: info@splint.org -** To report a bug: splint-bug@splint.org -** For more information: http://www.splint.org -*/ - -/* -** constraintOutput.c -*/ - -# include "splintMacros.nf" -# include "basic.h" -# include "portab.h" - - - diff --git a/src/cpplib.c b/src/cpplib.c index 40ac023..d1534ad 100644 --- a/src/cpplib.c +++ b/src/cpplib.c @@ -3461,6 +3461,14 @@ special_symbol (hashNode hp, cppReader *pfile) quote_string (pfile, string); return; } + case T_FUNC: /* added in ISO C99 */ + { + /* We don't know the actual name of the function, but it doesn't matter */ + char *string = "** function-name **"; + cpplib_reserve (pfile, 3 + 4 * strlen (string)); + quote_string (pfile, string); + return; + } case T_INCLUDE_LEVEL: true_indepth = 0; @@ -3698,6 +3706,7 @@ initialize_builtins (cppReader *pfile) cpplib_installBuiltin ("__DATE__", ctype_string, -1, T_DATE, 0, NULL, -1); cpplib_installBuiltin ("__FILE__", ctype_string, -1, T_FILE, 0, NULL, -1); cpplib_installBuiltin ("__BASE_FILE__", ctype_string, -1, T_BASE_FILE, 0, NULL, -1); + cpplib_installBuiltin ("__func__", ctype_string, -1, T_FUNC, 0, NULL, -1); cpplib_installBuiltin ("__INCLUDE_LEVEL__", ctype_int, -1, T_INCLUDE_LEVEL, 0, NULL, -1); cpplib_installBuiltin ("__VERSION__", ctype_string, -1, T_VERSION, 0, NULL, -1); #ifndef NO_BUILTIN_SIZE_TYPE diff --git a/src/cscanner.l b/src/cscanner.l index 625126d..3b2befb 100644 --- a/src/cscanner.l +++ b/src/cscanner.l @@ -85,7 +85,7 @@ ULSuffix ({U}{L}|{L}{U}) # include "cscannerHelp.h" # include "cgrammar.h" # include "cgrammar_tokens.h" -# include "portab.h" +# include "osd.h" /*@notfunction@*/ # define yyinput() (incColumn (), getc (yyin)) diff --git a/src/cscannerHelp.c b/src/cscannerHelp.c index ece76d9..3d325d2 100644 --- a/src/cscannerHelp.c +++ b/src/cscannerHelp.c @@ -33,6 +33,7 @@ # include "cscannerHelp.h" # include "cscanner.h" # include "cgrammar_tokens.h" +# include "portab.h" static int lminput (void); static int s_tokLength = 0; diff --git a/src/fileTable.c b/src/fileTable.c index 46722ba..ffec6d2 100644 --- a/src/fileTable.c +++ b/src/fileTable.c @@ -53,6 +53,9 @@ # include "llmain.h" # include "portab.h" +# ifdef WIN32 +# include +# else # if defined(__IBMC__) && defined(OS2) # include # include @@ -61,6 +64,7 @@ # define S_IWUSR S_IWRITE # define S_IXUSR S_IEXEC # endif +# endif /*@access fileId*/ @@ -1012,9 +1016,13 @@ fileTable_addOpen (fileTable ft, /*@observer@*/ FILE *f, /*@only@*/ cstring fnam FILE *fileTable_createFile (fileTable ft, cstring fname) { # ifdef WIN32 - int fdesc = open (cstring_toCharsSafe (fname), O_WRONLY | O_CREAT | O_TRUNC | O_EXCL); /* not supported by VS.net: , S_IRUSR | S_IWUSR); */ + int fdesc = _open (cstring_toCharsSafe (fname), + O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, + _S_IWRITE | S_IREAD); # else - int fdesc = open (cstring_toCharsSafe (fname), O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, S_IRUSR | S_IWUSR); + int fdesc = open (cstring_toCharsSafe (fname), + O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, + S_IRUSR | S_IWUSR); # endif if (fdesc == -1) @@ -1047,7 +1055,15 @@ FILE *fileTable_createFile (fileTable ft, cstring fname) FILE *fileTable_createMacrosFile (fileTable ft, cstring fname) { - int fdesc = open (cstring_toCharsSafe (fname), O_RDWR | O_CREAT | O_TRUNC | O_EXCL, S_IRUSR | S_IWUSR); +# ifdef WIN32 + int fdesc = _open (cstring_toCharsSafe (fname), + O_RDWR | O_CREAT | O_TRUNC | O_EXCL, + _S_IREAD | _S_IWRITE); +# else + int fdesc = open (cstring_toCharsSafe (fname), + O_RDWR | O_CREAT | O_TRUNC | O_EXCL, + S_IRUSR | S_IWUSR); +# endif if (fdesc == -1) { diff --git a/src/fileloc.c b/src/fileloc.c index ad82ba5..461659b 100644 --- a/src/fileloc.c +++ b/src/fileloc.c @@ -26,7 +26,7 @@ */ /* * Modified by Herbert 04/19/97: - * - added new include file portab.h. + * - added new include file portab.h (now in osd.h) * - added new private function fileloc_filenameForCpp() to handle * filenames belonging to "#line" statements for OS/2 and MSDOS. It * gets called by fileloc_lineMarker() and fileloc_previousLineMarker() @@ -36,7 +36,6 @@ # include "splintMacros.nf" # include "basic.h" # include "osd.h" -# include "portab.h" static /*@only@*/ fileloc fileloc_createPrim (flkind p_kind, fileId p_fid, int p_line, int p_col) /*@*/ ; diff --git a/src/flags.c b/src/flags.c index e8b3ceb..b9874fe 100644 --- a/src/flags.c +++ b/src/flags.c @@ -31,6 +31,7 @@ # include "portab.h" # include "rcfiles.h" # include "lslinit.h" +# include "llmain.h" /* ** from the CC man page: @@ -145,12 +146,12 @@ static /*@observer@*/ cstring argcode_unparse (argcode arg) } # ifdef WIN32 /* Make Microsoft VC++ happy */ -# pragma warning (disable:4715) +# pragma warning (disable:4715) # endif } # ifdef WIN32 -# pragma warning (enable:4715) +/* # pragma warning (enable:4715) */ # endif typedef struct { diff --git a/src/flags.def b/src/flags.def index 404b0c2..a41648d 100644 --- a/src/flags.def +++ b/src/flags.def @@ -381,14 +381,14 @@ static flaglist flags = FK_BOOL, FK_NONE, regStringFlag, ARG_STRING, "boolfalse", FLG_BOOLFALSE, - "set name of boolean false (default FALSE)", + "set name of boolean false (default false)", NULL, 0, 0 }, { FK_BOOL, FK_NONE, regStringFlag, ARG_STRING, "booltrue", FLG_BOOLTRUE, - "set name of boolean true (default TRUE)", + "set name of boolean true (default true)", NULL, 0, 0 }, { @@ -406,10 +406,10 @@ static flaglist flags = FK_BOOL, FK_OPS, modeFlag, "boolcompare", FLG_BOOLCOMPARE, - "comparison between bools (dangerous because of multiple TRUE values)", + "comparison between bools (dangerous because of multiple true values)", "Two bool values are compared directly using a C primitive. This " "may produce unexpected results since all non-zero values are " - "considered TRUE, so different TRUE values may not be equal. " + "considered true, so different true values may not be equal. " "The file bool.h (included in splint/lib) provides bool_equal " "for safe bool comparisons.", 0, 0 }, diff --git a/src/general.c b/src/general.c index 9724200..da2bb57 100644 --- a/src/general.c +++ b/src/general.c @@ -27,6 +27,7 @@ # include "splintMacros.nf" # include "basic.h" + # undef malloc # undef realloc # undef calloc @@ -35,7 +36,7 @@ # include "dmalloc.h" # endif -# include "portab.h" +# include "osd.h" /* ** redefine undef'd memory ops @@ -187,18 +188,6 @@ void *direalloc (/*@out@*/ /*@null@*/ void *x, size_t size, /*@=mustdefine@*/ -char *FormatInt (int i) -{ - char temp[255]; /* assume the integer has at most 254 digits */ - char *outs; - int sres = snprintf (temp, 255, "%i", i); - check (sres >= 0 && sres <= 255); - outs = (char *) dmalloc (sizeof (*outs) * (1 + strlen (temp))); - strcpy (outs, temp); - - return (outs); -} - bool firstWord (char *s, char *w) { llassert (s != NULL); diff --git a/src/help.c b/src/help.c index eee5ffb..c467995 100644 --- a/src/help.c +++ b/src/help.c @@ -30,6 +30,7 @@ # include "help.h" # include "osd.h" # include "portab.h" +# include "llmain.h" # include "version.h" static void diff --git a/src/imports.c b/src/imports.c index c6c4441..9af14d9 100644 --- a/src/imports.c +++ b/src/imports.c @@ -41,7 +41,6 @@ # include "lslparse.h" # include "lh.h" # include "llmain.h" -# include "portab.h" void outputLCSFile (char *path, char *msg, char *specname) diff --git a/src/lcllib.c b/src/lcllib.c index 300ab7a..205cbe4 100644 --- a/src/lcllib.c +++ b/src/lcllib.c @@ -46,7 +46,6 @@ # include "lcllib.h" # include "llmain.h" -# include "portab.h" /*@-incondefs@*/ /*@-redecl@*/ extern /*:open:*/ /*@dependent@*/ FILE *yyin; diff --git a/src/llmain.c b/src/llmain.c index 5a38916..739fc96 100644 --- a/src/llmain.c +++ b/src/llmain.c @@ -52,7 +52,6 @@ # include "basic.h" # include "osd.h" # include "help.h" - # include "gram.h" # include "lclscan.h" # include "scanline.h" @@ -71,9 +70,8 @@ # include "Headers/version.h" /* Visual C++ finds the wrong version.h */ # include "lcllib.h" # include "cgrammar.h" +# include "rcfiles.h" # include "llmain.h" -# include "portab.h" - extern /*@external@*/ int yydebug; static void cleanupFiles (void); diff --git a/src/message.c b/src/message.c index 1c9c231..5512989 100644 --- a/src/message.c +++ b/src/message.c @@ -246,8 +246,10 @@ message (/*@temp@*/ char *fmt, ...) ret = mstring_concatFree (ret, GETPRINTF ("%.2lf", va_arg (pvar, double))); break; case XBOOL: - ret = mstring_concatFree1 (ret, cstring_toCharsSafe - (bool_unparse (va_arg (pvar, bool)))); + ret = mstring_concatFree1 + (ret, cstring_toCharsSafe + (bool_unparse (bool_fromInt ((va_arg (pvar, int)))))); + /* va_arg should not use bool type */ break; case XUENTRY: ret = mstring_concatFree (ret, cstring_toCharsSafe diff --git a/src/osd.c b/src/osd.c index da780fc..b429d3f 100644 --- a/src/osd.c +++ b/src/osd.c @@ -62,7 +62,6 @@ # include "splintMacros.nf" # include "basic.h" # include "osd.h" -# include "portab.h" /* from stat.h */ /*@ignore@*/ diff --git a/src/stateInfo.c b/src/stateInfo.c index 79e0049..6d80a88 100644 --- a/src/stateInfo.c +++ b/src/stateInfo.c @@ -25,6 +25,15 @@ # include "splintMacros.nf" # include "basic.h" +# ifdef WIN32 +/* +** Make Microsoft VC++ happy: its control checking produces too +** many spurious warnings. +*/ + +# pragma warning (disable:4715) +# endif + static /*@observer@*/ cstring stateAction_unparse (stateAction p_sa) /*@*/ ; void stateInfo_free (/*@only@*/ stateInfo a) diff --git a/src/uentry.c b/src/uentry.c index 6d364fb..d951a30 100644 --- a/src/uentry.c +++ b/src/uentry.c @@ -5801,19 +5801,14 @@ uentry_getMods (uentry l) } # ifdef WIN32 /* Make Microsoft VC++ happy */ -# pragma warning (disable:4715) +# pragma warning (disable : 4715) # endif } -# ifdef WIN32 -# pragma warning (enable:4715) -# endif - ekind uentry_getKind (uentry e) { llassert (uentry_isValid (e)); - return (e->ukind); } diff --git a/src/usymtab_interface.c b/src/usymtab_interface.c index f55a388..a8ac125 100644 --- a/src/usymtab_interface.c +++ b/src/usymtab_interface.c @@ -1012,8 +1012,8 @@ doDeclareType (typeNode t, bool priv) case TK_UNION: default: { - llfatalbug (message ("declareType ERROR: unknown kind: %q", - cstring_fromCharsO (FormatInt ((int)t->kind)))); + llfatalbug (message ("declareType: unknown kind: %d", + (int) t->kind)); } } } diff --git a/test/preds.expect b/test/preds.expect index 9a8315d..a1f1576 100644 --- a/test/preds.expect +++ b/test/preds.expect @@ -16,8 +16,8 @@ preds.c:25:7: Test expression for if not bool, type char: (c = 'a') preds.c:30:7: Use of == with bool variables (risks inconsistency because of multiple true values): b1 == b2 Two bool values are compared directly using a C primitive. This may produce - unexpected results since all non-zero values are considered TRUE, so - different TRUE values may not be equal. The file bool.h (included in + unexpected results since all non-zero values are considered true, so + different true values may not be equal. The file bool.h (included in splint/lib) provides bool_equal for safe bool comparisons. (Use -boolcompare to inhibit warning) preds.c:35:7: Test expression for if not bool, type char: c @@ -56,8 +56,8 @@ preds.c:25:7: Test expression for if not bool, type char: (c = 'a') preds.c:30:7: Use of == with bool variables (risks inconsistency because of multiple true values): b1 == b2 Two bool values are compared directly using a C primitive. This may produce - unexpected results since all non-zero values are considered TRUE, so - different TRUE values may not be equal. The file bool.h (included in + unexpected results since all non-zero values are considered true, so + different true values may not be equal. The file bool.h (included in splint/lib) provides bool_equal for safe bool comparisons. (Use -boolcompare to inhibit warning) preds.c:35:7: Test expression for if not bool, type char: c -- 2.45.0