aboutsummaryrefslogtreecommitdiff
path: root/func.cc
diff options
context:
space:
mode:
Diffstat (limited to 'func.cc')
-rw-r--r--func.cc26
1 files changed, 13 insertions, 13 deletions
diff --git a/func.cc b/func.cc
index 716cb2b..7d50219 100644
--- a/func.cc
+++ b/func.cc
@@ -466,8 +466,8 @@ void EvalFunc(const vector<Value*>& args, Evaluator* ev, string*) {
string* text = new string;
args[0]->Eval(ev, text);
if (ev->avoid_io()) {
- KATI_WARN("%s:%d: *warning*: $(eval) in a recipe is not recommended: %s",
- LOCF(ev->loc()), text->c_str());
+ KATI_WARN_LOC(ev->loc(), "*warning*: $(eval) in a recipe is not recommended: %s",
+ text->c_str());
}
vector<Stmt*> stmts;
Parse(*text, ev->loc(), &stmts);
@@ -494,7 +494,8 @@ static bool HasNoIoInShellScript(const string& cmd) {
}
static void ShellFuncImpl(const string& shell, const string& shellflag,
- const string& cmd, string* s, FindCommand** fc) {
+ const string& cmd, const Loc& loc, string* s,
+ FindCommand** fc) {
LOG("ShellFunc: %s", cmd.c_str());
#ifdef TEST_FIND_EMULATOR
@@ -505,11 +506,11 @@ static void ShellFuncImpl(const string& shell, const string& shellflag,
*fc = new FindCommand();
if ((*fc)->Parse(cmd)) {
#ifdef TEST_FIND_EMULATOR
- if (FindEmulator::Get()->HandleFind(cmd, **fc, &out2)) {
+ if (FindEmulator::Get()->HandleFind(cmd, **fc, loc, &out2)) {
need_check = true;
}
#else
- if (FindEmulator::Get()->HandleFind(cmd, **fc, s)) {
+ if (FindEmulator::Get()->HandleFind(cmd, **fc, loc, s)) {
return;
}
#endif
@@ -555,9 +556,9 @@ void ShellFunc(const vector<Value*>& args, Evaluator* ev, string* s) {
string cmd = args[0]->Eval(ev);
if (ev->avoid_io() && !HasNoIoInShellScript(cmd)) {
if (ev->eval_depth() > 1) {
- ERROR("%s:%d: kati doesn't support passing results of $(shell) "
- "to other make constructs: %s",
- LOCF(ev->loc()), cmd.c_str());
+ ERROR_LOC(ev->loc(), "kati doesn't support passing results of $(shell) "
+ "to other make constructs: %s",
+ cmd.c_str());
}
StripShellComment(&cmd);
*s += "$(";
@@ -571,7 +572,7 @@ void ShellFunc(const vector<Value*>& args, Evaluator* ev, string* s) {
string out;
FindCommand* fc = NULL;
- ShellFuncImpl(shell, shellflag, cmd, &out, &fc);
+ ShellFuncImpl(shell, shellflag, cmd, ev->loc(), &out, &fc);
if (ShouldStoreCommandResult(cmd)) {
CommandResult* cr = new CommandResult();
cr->op = (fc == NULL) ? CommandOp::SHELL : CommandOp::FIND,
@@ -595,8 +596,8 @@ void CallFunc(const vector<Value*>& args, Evaluator* ev, string* s) {
const StringPiece func_name = TrimSpace(func_name_buf);
Var* func = ev->LookupVar(Intern(func_name));
if (!func->IsDefined()) {
- KATI_WARN("%s:%d: *warning*: undefined user function: %s",
- ev->loc(), func_name.as_string().c_str());
+ KATI_WARN_LOC(ev->loc(), "*warning*: undefined user function: %s",
+ func_name.as_string().c_str());
}
vector<unique_ptr<SimpleVar>> av;
for (size_t i = 1; i < args.size(); i++) {
@@ -676,8 +677,7 @@ void WarningFunc(const vector<Value*>& args, Evaluator* ev, string*) {
StringPrintf("echo -e \"%s:%d: %s\" 2>&1", LOCF(ev->loc()), EchoEscape(a).c_str()));
return;
}
- printf("%s:%d: %s\n", LOCF(ev->loc()), a.c_str());
- fflush(stdout);
+ WARN_LOC(ev->loc(), "%s", a.c_str());
}
void ErrorFunc(const vector<Value*>& args, Evaluator* ev, string*) {