summaryrefslogtreecommitdiffstats
path: root/waflib/extras/c_dumbpreproc.py
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2018-11-24 13:44:02 +0100
committerDavid Robillard <d@drobilla.net>2018-11-24 13:44:02 +0100
commitd74de7f575a9ec49f96138c3c5251f28946c0c0e (patch)
treed9b620bfba1e7462df4ddb3f6225cc5216c0ca81 /waflib/extras/c_dumbpreproc.py
parentc6e874c2cc1c5c99a3859112e1bba0f07bcdb8ba (diff)
downloadganv-d74de7f575a9ec49f96138c3c5251f28946c0c0e.tar.gz
ganv-d74de7f575a9ec49f96138c3c5251f28946c0c0e.tar.bz2
ganv-d74de7f575a9ec49f96138c3c5251f28946c0c0e.zip
Squashed 'waflib/' changes from 6e726eb..5ea8f99
5ea8f99 Improve test output spacing 0e23b29 Raise exception when test suite fails to ensure non-zero exit status d6de073 Show run time of unit tests 5b65554 Add short configure option for ultra-strict flags 4687ba6 Use gtest-like test output 258903d Fix failure count in test group summaries da07e73 Fix verbose tests with Python 3 git-subtree-dir: waflib git-subtree-split: 5ea8f99f6e1246079c1fe6bb590c38a53aadd40d
Diffstat (limited to 'waflib/extras/c_dumbpreproc.py')
-rw-r--r--waflib/extras/c_dumbpreproc.py72
1 files changed, 0 insertions, 72 deletions
diff --git a/waflib/extras/c_dumbpreproc.py b/waflib/extras/c_dumbpreproc.py
deleted file mode 100644
index ce9e1a4..0000000
--- a/waflib/extras/c_dumbpreproc.py
+++ /dev/null
@@ -1,72 +0,0 @@
-#!/usr/bin/env python
-# encoding: utf-8
-# Thomas Nagy, 2006-2010 (ita)
-
-"""
-Dumb C/C++ preprocessor for finding dependencies
-
-It will look at all include files it can find after removing the comments, so the following
-will always add the dependency on both "a.h" and "b.h"::
-
- #include "a.h"
- #ifdef B
- #include "b.h"
- #endif
- int main() {
- return 0;
- }
-
-To use::
-
- def configure(conf):
- conf.load('compiler_c')
- conf.load('c_dumbpreproc')
-"""
-
-import re
-from waflib.Tools import c_preproc
-
-re_inc = re.compile(
- '^[ \t]*(#|%:)[ \t]*(include)[ \t]*[<"](.*)[>"]\r*$',
- re.IGNORECASE | re.MULTILINE)
-
-def lines_includes(node):
- code = node.read()
- if c_preproc.use_trigraphs:
- for (a, b) in c_preproc.trig_def:
- code = code.split(a).join(b)
- code = c_preproc.re_nl.sub('', code)
- code = c_preproc.re_cpp.sub(c_preproc.repl, code)
- return [(m.group(2), m.group(3)) for m in re.finditer(re_inc, code)]
-
-parser = c_preproc.c_parser
-class dumb_parser(parser):
- def addlines(self, node):
- if node in self.nodes[:-1]:
- return
- self.currentnode_stack.append(node.parent)
-
- # Avoid reading the same files again
- try:
- lines = self.parse_cache[node]
- except KeyError:
- lines = self.parse_cache[node] = lines_includes(node)
-
- self.lines = lines + [(c_preproc.POPFILE, '')] + self.lines
-
- def start(self, node, env):
- try:
- self.parse_cache = node.ctx.parse_cache
- except AttributeError:
- self.parse_cache = node.ctx.parse_cache = {}
-
- self.addlines(node)
- while self.lines:
- (x, y) = self.lines.pop(0)
- if x == c_preproc.POPFILE:
- self.currentnode_stack.pop()
- continue
- self.tryfind(y)
-
-c_preproc.c_parser = dumb_parser
-