aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/cc
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2024-10-23 09:59:56 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2024-10-23 09:59:56 +0200
commit19666c308b9010cc550409e09a7d2284f120a313 (patch)
treec94cb358b04c5df625a0b41a68ae50954877c9f3 /libbuild2/cc
parent9cf2dbda0d6a7006a5425c19973bb0a7286392f6 (diff)
Fix bug in compiledb parsing logic (GH issue #441)
Also improve diagnostics around invalid compiledb format.
Diffstat (limited to 'libbuild2/cc')
-rw-r--r--libbuild2/cc/compiledb.cxx11
1 files changed, 6 insertions, 5 deletions
diff --git a/libbuild2/cc/compiledb.cxx b/libbuild2/cc/compiledb.cxx
index 7414eb2..ccf08a9 100644
--- a/libbuild2/cc/compiledb.cxx
+++ b/libbuild2/cc/compiledb.cxx
@@ -708,14 +708,16 @@ namespace build2
}
catch (const json::invalid_json_input& e)
{
- location l (path, line, e.column);
- fail (l) << "invalid compilation database json input: " << e;
state_ = state::failed;
+
+ location l (path, line, e.column);
+ fail (l) << "invalid compilation database json input: " << e <<
+ info << "remove this file if it was produced by a different tool";
}
catch (const io_error& e)
{
- fail << "unable to read " << path << ": " << e;
state_ = state::failed;
+ fail << "unable to read " << path << ": " << e;
}
}
@@ -1076,9 +1078,8 @@ namespace build2
}
catch (const io_error& e)
{
- fail << "unable to write to " << path << ": " << e;
state_ = state::failed;
- return;
+ fail << "unable to write to " << path << ": " << e;
}
// If this operation has failed, then our state may not be accurate