diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2018-05-26 15:59:02 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2018-05-26 15:59:02 +0200 |
commit | 2cb29a3cdff844baab3f2725f4c4ed07173ddefe (patch) | |
tree | 12c79f1c384e1e3232583f254d303753880c7906 /bpkg/diagnostics.cxx | |
parent | 50223ed214cd89de6c28bc63965438703cddfe4d (diff) |
Don't print empty location, zero line/column
Diffstat (limited to 'bpkg/diagnostics.cxx')
-rw-r--r-- | bpkg/diagnostics.cxx | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/bpkg/diagnostics.cxx b/bpkg/diagnostics.cxx index 9174c9f..400b352 100644 --- a/bpkg/diagnostics.cxx +++ b/bpkg/diagnostics.cxx @@ -54,7 +54,20 @@ namespace bpkg void location_prologue_base:: operator() (const diag_record& r) const { - r << loc_.file << ':' << loc_.line << ':' << loc_.column << ": "; + if (!loc_.empty ()) + { + r << loc_.file << ':'; + + if (loc_.line != 0) + { + r << loc_.line << ':'; + + if (loc_.column != 0) + r << loc_.column << ':'; + } + + r << ' '; + } if (type_ != nullptr) r << type_ << ": "; |