diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2024-10-23 09:59:56 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2024-10-23 09:59:56 +0200 |
commit | 19666c308b9010cc550409e09a7d2284f120a313 (patch) | |
tree | c94cb358b04c5df625a0b41a68ae50954877c9f3 | |
parent | 9cf2dbda0d6a7006a5425c19973bb0a7286392f6 (diff) |
Fix bug in compiledb parsing logic (GH issue #441)
Also improve diagnostics around invalid compiledb format.
-rw-r--r-- | libbuild2/cc/compiledb.cxx | 11 |
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 |