diff options
-rw-r--r-- | .gitlab-ci.yml | 9 | ||||
-rwxr-xr-x | deheader | 16 | ||||
-rw-r--r-- | tools/ci/samples/test14.cpp | 14 | ||||
-rw-r--r-- | tools/ci/samples/test14.h | 6 |
4 files changed, 39 insertions, 6 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7bdbd1a..d62666f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -182,6 +182,15 @@ test12_h: tags: - docker +test14_cpp: + stage: build + script: + - ./tools/ci/jobs/deheader.sh "g++-5" "" test14.cpp + - ./tools/ci/jobs/deheaderok.sh + image: debian:unstable + tags: + - docker + # reports success: @@ -1286,14 +1286,13 @@ class InclusionMap: allow_parse_includes = self.check_block(sourcefile, cnt, compiler, "", defines + " " + std, maker, verbosity, showerrs, subdir) conditions.append((c, allow_parse_includes)) elif match_preproc("else", line) is not False: - allow_parse_includes = not allow_parse_includes + if self.get_prev_flag(conditions) == True: + allow_parse_includes = not allow_parse_includes + else: + allow_parse_includes = False elif match_preproc("endif", line) is not False: conditions.pop() - if len(conditions) == 0: - allow_parse_includes = True - else: - sz = len(conditions) - allow_parse_includes = conditions[sz - 1][1] + allow_parse_includes = self.get_prev_flag(conditions) else: f = match_preproc("include", line) if f is not False: @@ -1322,6 +1321,11 @@ class InclusionMap: for ref in trimmedcount: if trimmedcount[ref] > 1: print("deheader: %s has more than one inclusion of %s" % (sourcefile, ref)) + def get_prev_flag(self, conditions): + if len(conditions) == 0: + return True + else: + return conditions[len(conditions) - 1][1] def forget(self, sourcefile, header): "Forget a header dependency." self.depends_on[sourcefile].remove(header) diff --git a/tools/ci/samples/test14.cpp b/tools/ci/samples/test14.cpp new file mode 100644 index 0000000..5632789 --- /dev/null +++ b/tools/ci/samples/test14.cpp @@ -0,0 +1,14 @@ +#include "test14.h" + +#ifdef QQQ +#ifdef ZZZ +#include <vector> +#else +#include <string> +#endif +#endif + +int function1() +{ + return 0; +} diff --git a/tools/ci/samples/test14.h b/tools/ci/samples/test14.h new file mode 100644 index 0000000..c36b0ab --- /dev/null +++ b/tools/ci/samples/test14.h @@ -0,0 +1,6 @@ +#ifndef TEST14 +#define TEST14 + +int function1(); + +#endif // TEST14
\ No newline at end of file |