aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-05-17 14:41:06 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-05-17 14:41:06 +0200
commit23a1ab205c777330453a8137557cd02754533748 (patch)
tree8be2f682a9cd43b369753ebef717ebf09af6ab62
parentdc8a5de2d9f264cb17c9cdb19e43030689e94ca5 (diff)
Lazily diagnose relative -I paths
-rw-r--r--build2/cc/compile.cxx12
1 files changed, 9 insertions, 3 deletions
diff --git a/build2/cc/compile.cxx b/build2/cc/compile.cxx
index 57803a5..32b5f6e 100644
--- a/build2/cc/compile.cxx
+++ b/build2/cc/compile.cxx
@@ -664,9 +664,14 @@ namespace build2
l6 ([&]{trace << "-I '" << d << "'";});
- // If we are relative or not inside our project root, then ignore.
+ if (d.relative ())
+ fail << "relative -I directory " << d
+ << " in variable " << var.name
+ << " for target " << t;
+
+ // If we are not inside our project root, then ignore.
//
- if (d.relative () || !d.sub (out_root))
+ if (!d.sub (out_root))
continue;
// If the target directory is a sub-directory of the include
@@ -1071,7 +1076,8 @@ namespace build2
// then, well, we will just have to get rid of quoted includes
// (which are generally a bad idea, anyway).
//
- // @@ Detect/handle relative paths in -I and error out?
+ // Note that we detect and diagnose relative -I directories lazily
+ // when building the include prefix map.
//
rels = relative (src.path ());