From 64935e99b7f22fb761b90b9e57b6aab3c348830f Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 20 Nov 2017 18:49:54 +0200 Subject: Handle case when compiler-reported header does not exist This, for example, happens when compiling under wine with file wlantypes.h included as WlanTypes.h. --- build2/cc/compile.cxx | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'build2/cc/compile.cxx') diff --git a/build2/cc/compile.cxx b/build2/cc/compile.cxx index 49ff453..6022fb6 100644 --- a/build2/cc/compile.cxx +++ b/build2/cc/compile.cxx @@ -2172,7 +2172,22 @@ namespace build2 // if (!cache) { - f.realize (); + // While we can reasonably expect this path to exit, things do + // go south from time to time (like compiling under wine with + // file wlantypes.h included as WlanTypes.h). + // + try + { + f.realize (); + } + catch (const invalid_path&) + { + fail << "invalid header path '" << f << "'"; + } + catch (const system_error& e) + { + fail << "invalid header path '" << f << "': " << e; + } if (!so_map.empty ()) { -- cgit v1.1