From 19666c308b9010cc550409e09a7d2284f120a313 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 23 Oct 2024 09:59:56 +0200 Subject: Fix bug in compiledb parsing logic (GH issue #441) Also improve diagnostics around invalid compiledb format. --- libbuild2/cc/compiledb.cxx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'libbuild2') 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 -- cgit v1.1