add an option (--warn=error) to treat warnings as errors

This commit is contained in:
Bill Currie 2001-06-28 23:15:10 +00:00
parent 9c2398d923
commit f2bb7ace41
3 changed files with 12 additions and 0 deletions

View File

@ -541,6 +541,7 @@ int ReuseString (const char *str);
typedef struct {
int cow; // copy on write for constants
int version; // maximum progs version to support (eg, 6 for id)
int warn_error; // treat warnings as errors
} options_t;
extern options_t options;

View File

@ -100,6 +100,11 @@ warning (expr_t *e, const char *fmt, ...)
va_list args;
string_t file = s_file;
int line = pr_source_line;
if (options.warn_error) {
options.warn_error = 0; // only want to do this once
error (e, "warnings treated as errors");
}
va_start (args, fmt);
if (e) {

View File

@ -853,6 +853,7 @@ Options: \n\
-V, --version output version information and exit\n\
--cow allow assignment to initialized globals\n\
--id only support id (progs version 6) features\n\
--warn=error treat warnings as errors\n\
");
return 1;
}
@ -880,6 +881,11 @@ Options: \n\
options.version = PROG_ID_VERSION;
}
// FIXME eww, really must go to getopt
if (CheckParm ("--warn=error")) {
options.warn_error = 1;
}
if (strcmp (sourcedir, ".")) {
printf ("Source directory: %s\n", sourcedir);
}