diff options
Diffstat (limited to 'src/engine/SCons/Scanner')
-rw-r--r-- | src/engine/SCons/Scanner/C.py | 4 | ||||
-rw-r--r-- | src/engine/SCons/Scanner/CTests.py | 13 |
2 files changed, 17 insertions, 0 deletions
diff --git a/src/engine/SCons/Scanner/C.py b/src/engine/SCons/Scanner/C.py index c81417a..77b9525 100644 --- a/src/engine/SCons/Scanner/C.py +++ b/src/engine/SCons/Scanner/C.py @@ -38,6 +38,7 @@ import SCons.Node import SCons.Node.FS import SCons.Scanner import SCons.Util +import SCons.Warnings include_re = re.compile('^[ \t]*#[ \t]*include[ \t]+(<|")([\\w./\\\\]+)(>|")', re.M) @@ -114,6 +115,9 @@ def scan(node, env, target, fs = SCons.Node.FS.default_fs): if not n is None: nodes.append(n) + else: + SCons.Warnings.warn(SCons.Warnings.DependencyWarning, + "No dependency generated for file: %s (included from: %s) -- file not found" % (include[1], node)) node.found_includes[cpppath] = nodes # Schwartzian transform from the Python FAQ Wizard diff --git a/src/engine/SCons/Scanner/CTests.py b/src/engine/SCons/Scanner/CTests.py index f99af18..cc9e116 100644 --- a/src/engine/SCons/Scanner/CTests.py +++ b/src/engine/SCons/Scanner/CTests.py @@ -30,6 +30,7 @@ import sys import os import os.path import SCons.Node.FS +import SCons.Warnings test = TestCmd.TestCmd(workdir = '') @@ -230,11 +231,23 @@ class CScannerTestCase8(unittest.TestCase): class CScannerTestCase9(unittest.TestCase): def runTest(self): + SCons.Warnings.enableWarningClass(SCons.Warnings.DependencyWarning) + class TestOut: + def __call__(self, x): + self.out = x + + to = TestOut() + to.out = None + SCons.Warnings._warningOut = to test.write('fa.h','\n') fs = SCons.Node.FS.FS(test.workpath('')) s = SCons.Scanner.C.CScan(fs=fs) env = DummyEnvironment([]) deps = s.scan(fs.File('fa.cpp'), env, DummyTarget()) + + # Did we catch the warning associated with not finding fb.h? + assert to.out + deps_match(self, deps, [ 'fa.h' ]) test.unlink('fa.h') |