aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/cc/msvc.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2020-06-26 10:30:51 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2020-06-26 10:30:51 +0200
commit64429b9e46c988256a1d196aa0159ba71744b332 (patch)
treedfb68d968c34fceb74c9472cf440a605a2eaaa23 /libbuild2/cc/msvc.cxx
parent038e93a15109d006fe82121c6bb8848338ee4abe (diff)
Handle #import in MSVC /showIncludes output
Diffstat (limited to 'libbuild2/cc/msvc.cxx')
-rw-r--r--libbuild2/cc/msvc.cxx22
1 files changed, 16 insertions, 6 deletions
diff --git a/libbuild2/cc/msvc.cxx b/libbuild2/cc/msvc.cxx
index 8887555..20239c7 100644
--- a/libbuild2/cc/msvc.cxx
+++ b/libbuild2/cc/msvc.cxx
@@ -119,13 +119,17 @@ namespace build2
}
}
- // Sense whether this is a diagnostics line returning the postion of the
- // NNNN code in XNNNN and npos otherwise.
+ // Sense whether this is a diagnostics line returning in the first half of
+ // pair the position of the NNNN code in XNNNN and npos otherwise. If the
+ // first half is not npos then the second half is the start of the last
+ // path component before first `:`.
//
- size_t
+ // foo\bar.h: fatal error C1083: ...
+ //
+ pair<size_t, size_t>
msvc_sense_diag (const string& l, char f)
{
- size_t p (l.find (':'));
+ size_t c (l.find (": ")), p (c);
// Note that while the C-numbers seems to all be in the ' CNNNN:' form,
// the D ones can be ' DNNNN :', for example:
@@ -149,7 +153,13 @@ namespace build2
}
}
- return p;
+ if (p != string::npos)
+ {
+ c = path::traits_type::rfind_separator (l, c);
+ c = c != string::npos ? c + 1 : 0;
+ }
+
+ return make_pair (p, c);
}
// Filter cl.exe and link.exe noise.
@@ -167,7 +177,7 @@ namespace build2
{
diag_stream_lock () << l << endl;
- if (msvc_sense_diag (l, 'D') != string::npos)
+ if (msvc_sense_diag (l, 'D').first != string::npos)
continue;
}