Issue a warning if no output file is specified.
This commit is contained in:
8
ispc.cpp
8
ispc.cpp
@@ -389,7 +389,13 @@ Globals::Globals() {
|
||||
// SourcePos
|
||||
|
||||
SourcePos::SourcePos(const char *n, int fl, int fc, int ll, int lc) {
|
||||
name = n ? n : m->module->getModuleIdentifier().c_str();
|
||||
name = n;
|
||||
if (name == NULL) {
|
||||
if (m != NULL)
|
||||
name = m->module->getModuleIdentifier().c_str();
|
||||
else
|
||||
name = "(unknown)";
|
||||
}
|
||||
first_line = fl;
|
||||
first_column = fc;
|
||||
last_line = ll != 0 ? ll : fl;
|
||||
|
||||
6
main.cpp
6
main.cpp
@@ -37,6 +37,7 @@
|
||||
|
||||
#include "ispc.h"
|
||||
#include "module.h"
|
||||
#include "util.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <llvm/Support/PrettyStackTrace.h>
|
||||
@@ -354,6 +355,11 @@ int main(int Argc, char *Argv[]) {
|
||||
if (debugSet && !optSet)
|
||||
g->opt.level = 0;
|
||||
|
||||
if (outFileName == NULL && headerFileName == NULL)
|
||||
Warning(SourcePos(), "Warning: no output file or header file name "
|
||||
"specified. Program will be compiled and warnings/errors will "
|
||||
"be issued, but no output will be generated.");
|
||||
|
||||
return Module::CompileAndOutput(file, arch, cpu, target, generatePIC,
|
||||
ot, outFileName, headerFileName);
|
||||
}
|
||||
|
||||
4
util.cpp
4
util.cpp
@@ -267,7 +267,7 @@ Error(SourcePos p, const char *fmt, ...) {
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
lPrint("Error", p, fmt, args);
|
||||
++m->errorCount;
|
||||
if (m != NULL) ++m->errorCount;
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
@@ -292,7 +292,7 @@ Warning(SourcePos p, const char *fmt, ...) {
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
lPrint(g->warningsAsErrors ? "Error" : "Warning", p, fmt, args);
|
||||
if (g->warningsAsErrors)
|
||||
if (g->warningsAsErrors && m != NULL)
|
||||
++m->errorCount;
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user