aboutsummaryrefslogtreecommitdiff
path: root/dep.cc
diff options
context:
space:
mode:
authorDan Willemsen <dwillemsen@google.com>2017-02-22 14:31:16 -0800
committerDan Willemsen <dwillemsen@google.com>2017-02-22 22:41:57 -0800
commite41c7556c22bda359c2b97cd98d59082110add95 (patch)
treef839deb8477c133f430ad142bbbdb4cabec661df /dep.cc
parentf8e155865652181a504d7400afd25f35cf158472 (diff)
Add --color_warnings to make warnings/errors like clang
This adds new (WARN|KATI_WARN|ERROR)_LOC log macro variants that take a location as the first argument, and will prefix that location information to the warning/error lines. When --color_warnings is enabled, it reformats them to have a standard warning:/error: infix, and adds colors in order to match the warnings/errors produced by clang.
Diffstat (limited to 'dep.cc')
-rw-r--r--dep.cc19
1 files changed, 10 insertions, 9 deletions
diff --git a/dep.cc b/dep.cc
index 4aebae0..75dff76 100644
--- a/dep.cc
+++ b/dep.cc
@@ -156,16 +156,18 @@ struct RuleMerger {
if (rules.empty()) {
is_double_colon = r->is_double_colon;
} else if (is_double_colon != r->is_double_colon) {
- ERROR("%s:%d: *** target file `%s' has both : and :: entries.",
- LOCF(r->loc), output.c_str());
+ ERROR_LOC(r->loc, "*** target file `%s' has both : and :: entries.",
+ output.c_str());
}
if (primary_rule && !r->cmds.empty() &&
!IsSuffixRule(output) && !r->is_double_colon) {
- WARN("%s:%d: warning: overriding commands for target `%s'",
- LOCF(r->cmd_loc()), output.c_str());
- WARN("%s:%d: warning: ignoring old commands for target `%s'",
- LOCF(primary_rule->cmd_loc()), output.c_str());
+ WARN_LOC(r->cmd_loc(),
+ "warning: overriding commands for target `%s'",
+ output.c_str());
+ WARN_LOC(primary_rule->cmd_loc(),
+ "warning: ignoring old commands for target `%s'",
+ output.c_str());
primary_rule = r;
}
if (!primary_rule && !r->cmds.empty()) {
@@ -274,8 +276,7 @@ class DepBuilder {
if (targets.empty()) {
suffix_rules_.clear();
} else {
- WARN("%s:%d: kati doesn't support .SUFFIXES with prerequisites",
- LOCF(loc));
+ WARN_LOC(loc, "kati doesn't support .SUFFIXES with prerequisites");
}
}
@@ -296,7 +297,7 @@ class DepBuilder {
};
for (const char** p = kUnsupportedBuiltinTargets; *p; p++) {
if (GetRuleInputs(Intern(*p), &targets, &loc)) {
- WARN("%s:%d: kati doesn't support %s", LOCF(loc), *p);
+ WARN_LOC(loc, "kati doesn't support %s", *p);
}
}
}