diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2019-09-05 15:49:11 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2019-09-05 15:49:11 +0200 |
commit | 8b1a039732458f38015e8b5b11332517391b34e2 (patch) | |
tree | c7531504816aa23f26087ddd2f891bc00e1510b0 | |
parent | 5344acce78702871fba6506a3bd0d05750d90037 (diff) |
Improve /showIncludes parsing to handle internal (debug?) builds of MSVC
-rw-r--r-- | libbuild2/cc/compile-rule.cxx | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/libbuild2/cc/compile-rule.cxx b/libbuild2/cc/compile-rule.cxx index 8cebef0..450fbe9 100644 --- a/libbuild2/cc/compile-rule.cxx +++ b/libbuild2/cc/compile-rule.cxx @@ -1600,14 +1600,26 @@ namespace build2 // // Plus, it seems the quote character could to be multi-byte. // - size_t p1 (l.find (':', p + 5)); - size_t p2 (l.rfind (':')); + // Plus, in some internal (debug?) builds the second <translated> part + // may have the "No such file or directory (c:\...\p0prepro.c:1722)" + // form. + + // Find first leading ':' that's followed by a space. + // + size_t p1 (p + 4); // 1083 + while ((p1 = l.find (':', p1 + 1)) != string::npos && l[p1 + 1] != ' ') + ; + + // Find first trailing ':' that's followed by a space. + // + size_t p2 (l.size ()); + while ((p2 = l.rfind (':', p2 - 1)) != string::npos && l[p2 + 1] != ' ') + ; if (p1 != string::npos && p2 != string::npos && - (p2 - p1) > 4 && // At least ": 'x':". - l[p1 + 1] == ' ' && - l[p2 + 1] == ' ') + (p2 - p1) > 4 ) // At least ": 'x':". + { p1 += 3; // First character of the path. p2 -= 1; // One past last character of the path. |