Add --werror flag to treat warnings as errors.
The specific need for it was so that tests in tests_errors can test to see if a desired diagnostic warning is issued (like ptrcast-lose-info does.)
This commit is contained in:
1
ispc.cpp
1
ispc.cpp
@@ -341,6 +341,7 @@ Globals::Globals() {
|
||||
runCPP = true;
|
||||
debugPrint = false;
|
||||
disableWarnings = false;
|
||||
warningsAsErrors = false;
|
||||
disableLineWrap = false;
|
||||
emitPerfWarnings = true;
|
||||
emitInstrumentation = false;
|
||||
|
||||
3
ispc.h
3
ispc.h
@@ -348,6 +348,9 @@ struct Globals {
|
||||
/** Indicates whether all warning messages should be surpressed. */
|
||||
bool disableWarnings;
|
||||
|
||||
/** Indicates whether warnings should be issued as errors. */
|
||||
bool warningsAsErrors;
|
||||
|
||||
/** Indicates whether line wrapping of error messages to the terminal
|
||||
width should be disabled. */
|
||||
bool disableLineWrap;
|
||||
|
||||
3
main.cpp
3
main.cpp
@@ -104,6 +104,7 @@ static void usage(int ret) {
|
||||
#endif // !ISPC_IS_WINDOWS
|
||||
printf(" [--target=<isa>]\t\t\tSelect target ISA. <isa>={%s}\n", Target::SupportedTargetISAs());
|
||||
printf(" [--version]\t\t\t\tPrint ispc version\n");
|
||||
printf(" [--werror]\t\t\tTreat warnings as errors\n");
|
||||
printf(" [--woff]\t\t\t\tDisable warnings\n");
|
||||
printf(" [--wno-perf]\t\t\tDon't issue warnings related to performance-related issues\n");
|
||||
printf(" <file to compile or \"-\" for stdin>\n");
|
||||
@@ -283,6 +284,8 @@ int main(int Argc, char *Argv[]) {
|
||||
g->disableWarnings = true;
|
||||
g->emitPerfWarnings = false;
|
||||
}
|
||||
else if (!strcmp(argv[i], "--werror"))
|
||||
g->warningsAsErrors = true;
|
||||
else if (!strcmp(argv[i], "--nowrap"))
|
||||
g->disableLineWrap = true;
|
||||
else if (!strcmp(argv[i], "--wno-perf") || !strcmp(argv[i], "-wno-perf"))
|
||||
|
||||
@@ -107,7 +107,7 @@ def run_tasks_from_queue(queue):
|
||||
# is this a test to make sure an error is issued?
|
||||
want_error = (filename.find("tests_errors") != -1)
|
||||
if want_error == True:
|
||||
ispc_cmd = "ispc --nowrap %s --arch=%s --target=%s" % \
|
||||
ispc_cmd = "ispc --werror --nowrap %s --arch=%s --target=%s" % \
|
||||
(filename, options.arch, options.target)
|
||||
sp = subprocess.Popen(shlex.split(ispc_cmd), stdin=None, stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE)
|
||||
|
||||
Reference in New Issue
Block a user