X-Git-Url: http://andersk.mit.edu/gitweb/splint.git/blobdiff_plain/b37cf05e81a9ef7fc429327a75dfad628f86c809..15b3d2b27a3dce7a3b65e88fb0d1732e235117f4:/src/llmain.c diff --git a/src/llmain.c b/src/llmain.c index 38f9426..8340ea3 100644 --- a/src/llmain.c +++ b/src/llmain.c @@ -28,7 +28,7 @@ */ # include - +# include /* ** Ensure that WIN32 and _WIN32 are both defined or both undefined. */ @@ -76,9 +76,7 @@ # include "cgrammar.h" # include "llmain.h" # include "portab.h" -# include "cpp.h" -# include "mtreader.h" -# include + extern /*@external@*/ int yydebug; @@ -94,8 +92,8 @@ static void cleanupFiles (void); static void showHelp (void); static void interrupt (int p_i); -static void loadrc (/*@open@*/ FILE *p_rcfile, cstringSList *p_passThroughArgs) - /*@ensures closed p_rcfile@*/ ; +static void loadrc (FILE *p_rcfile, cstringSList *p_passThroughArgs) + /*@ensures closed p_rcfile@*/ ; static void describeVars (void); static bool specialFlagsHelp (char *p_next); @@ -488,9 +486,10 @@ static void handlePassThroughFlag (char *arg) if (open) { showHerald (); - llerror (FLG_BADFLAG, - message ("Unclosed quote in flag: %s", - cstring_fromChars (arg))); + voptgenerror (FLG_BADFLAG, + message ("Unclosed quote in flag: %s", + cstring_fromChars (arg)), + g_currentloc); } else { @@ -641,8 +640,7 @@ int main (int argc, char *argv[]) */ { - cstring incval = cstring_copy - (osd_getEnvironmentVariable (cstring_makeLiteralTemp (INCLUDE_VAR))); + cstring incval = cstring_copy (osd_getEnvironmentVariable (INCLUDEPATH_VAR)); cstring oincval = incval; if (cstring_isDefined (incval)) @@ -657,7 +655,7 @@ int main (int argc, char *argv[]) while (cstring_isDefined (incval)) { /*@access cstring@*/ - char *nextsep = strchr (incval, SEPCHAR); + char *nextsep = strchr (incval, PATH_SEPARATOR); if (nextsep != NULL) { @@ -678,7 +676,7 @@ int main (int argc, char *argv[]) cppAddIncludeDir (dir); } - *nextsep = SEPCHAR; + *nextsep = PATH_SEPARATOR; incval = cstring_fromChars (nextsep + 1); cstring_free (dir); } @@ -931,8 +929,10 @@ int main (int argc, char *argv[]) else { DPRINTF (("Error!")); - llgloberror (message ("Unrecognized option: %s", - cstring_fromChars (thisarg))); + voptgenerror (FLG_BADFLAG, + message ("Unrecognized option: %s", + cstring_fromChars (thisarg)), + g_currentloc); } } else @@ -978,7 +978,7 @@ int main (int argc, char *argv[]) g_localSpecPath = cstring_toCharsSafe (message ("%s%h%s", cstring_fromChars (g_localSpecPath), - SEPCHAR, + PATH_SEPARATOR, dir)); /*@=mustfree@*/ /*@switchbreak@*/ break; @@ -2020,13 +2020,18 @@ describeVars (void) llmsglit (" --- directory containing lcl standard library files " "(import with < ... >)");; - { - cstring dirs = context_getString (FLG_SYSTEMDIRS); - llmsg (message - ("systemdirs = %s (set by include envirnoment variable or -systemdirs)", - dirs)); + llmsg (message + ("include path = %q (set by environment variable %s and -I flags)", + cppReader_getIncludePath (), INCLUDEPATH_VAR)); - } + llmsglit (" --- path used to find #include'd files"); + + llmsg (message + ("systemdirs = %s (set by -systemdirs or envirnoment variable %s)", /*@i413223@*/ + context_getString (FLG_SYSTEMDIRS), + INCLUDEPATH_VAR)); + + llmsglit (" --- if file is found on this path, it is treated as a system file for error reporting"); } void @@ -2139,8 +2144,8 @@ llexit (int status) } void -loadrc (/*@open@*/ FILE *rcfile, cstringSList *passThroughArgs) - /*@ensures closed rcfile@*/ +loadrc (/*:open:*/ FILE *rcfile, cstringSList *passThroughArgs) + /*@ensures closed rcfile@*/ { char *s = mstring_create (MAX_LINE_LENGTH); char *os = s; @@ -2187,10 +2192,11 @@ loadrc (/*@open@*/ FILE *rcfile, cstringSList *passThroughArgs) else { showHerald (); - llerror (FLG_SYNTAX, - message ("Bad flag syntax (+ or - expected, " - "+ is assumed): %s", - cstring_fromChars (s))); + voptgenerror (FLG_BADFLAG, + message ("Bad flag syntax (+ or - expected, " + "+ is assumed): %s", + cstring_fromChars (s)), + g_currentloc); s--; set = TRUE; } @@ -2264,9 +2270,10 @@ loadrc (/*@open@*/ FILE *rcfile, cstringSList *passThroughArgs) } else { - llerror (FLG_BADFLAG, - message ("Unrecognized option: %s", - cstring_fromChars (thisflag))); + voptgenerror (FLG_BADFLAG, + message ("Unrecognized option: %s", + cstring_fromChars (thisflag)), + g_currentloc); } } else @@ -2278,8 +2285,9 @@ loadrc (/*@open@*/ FILE *rcfile, cstringSList *passThroughArgs) if (opt == FLG_HELP) { showHerald (); - llerror (FLG_BADFLAG, - message ("Cannot use help in rc files")); + voptgenerror (FLG_BADFLAG, + message ("Cannot use help in rc files"), + g_currentloc); } else if (flagcode_isPassThrough (opt)) /* -D or -U */ { @@ -2345,11 +2353,12 @@ loadrc (/*@open@*/ FILE *rcfile, cstringSList *passThroughArgs) if (cstring_isUndefined (extra)) { showHerald (); - llerror + voptgenerror (FLG_BADFLAG, message ("Flag %s must be followed by an argument", - flagcode_unparse (opt))); + flagcode_unparse (opt)), + g_currentloc); } else { @@ -2379,10 +2388,11 @@ loadrc (/*@open@*/ FILE *rcfile, cstringSList *passThroughArgs) else { showHerald (); - llerror - (FLG_SYNTAX, + voptgenerror + (FLG_BADFLAG, message ("Options file not found: %s", - extra)); + extra), + g_currentloc); } } else if (opt == FLG_INIT) @@ -2413,10 +2423,11 @@ loadrc (/*@open@*/ FILE *rcfile, cstringSList *passThroughArgs) } else { - llerror - (FLG_SYNTAX, + voptgenerror + (FLG_BADFLAG, message ("Unmatched \" in option string: %s", - extra)); + extra), + g_currentloc); } }