diff --git a/cpp/find_warnings.py b/cpp/find_warnings.py index 35e05b9..b7e11b6 100644 --- a/cpp/find_warnings.py +++ b/cpp/find_warnings.py @@ -182,8 +182,7 @@ def _read_and_parse_includes(self): module = self._get_module(node) filename = module.filename _, ext = os.path.splitext(filename) - if ext.lower() != '.hxx': - included_files[filename] = node, module + included_files[filename] = node, module if is_cpp_file(filename): self._add_warning( "should not #include C++ source file '{}'".format( diff --git a/test/a.hxx b/test/a.hxx new file mode 100644 index 0000000..c048748 --- /dev/null +++ b/test/a.hxx @@ -0,0 +1,8 @@ +#ifndef _A_H_ +#define _A_H_ + +#include "b.hxx" + +void myFunc(int a); + +#endif diff --git a/test/b.hxx b/test/b.hxx new file mode 100644 index 0000000..c234721 --- /dev/null +++ b/test/b.hxx @@ -0,0 +1,14 @@ +#ifndef _B_H_ +#define _B_H_ + +namespace Name1 { +class ABC { +public: + ABC(): int1(0) {} + int getInt() { return int1; } +private: + int int1; +}; +} + +#endif diff --git a/test/expected.txt b/test/expected.txt index 525f5dd..03bc172 100644 --- a/test/expected.txt +++ b/test/expected.txt @@ -1,3 +1,4 @@ +test/a.hxx:4: 'b.hxx' does not need to be #included test/baz.h:1: 'bar.h' does not need to be #included; use a forward declaration instead test/baz.h:2: 'bar_bis.h' does not need to be #included; use a forward declaration instead test/cxx.cxx:1: 'cxx' not found in any directly #included header @@ -18,6 +19,7 @@ test/foo.h:87: 'string' already #included on line 3 test/foo.h:113: 'not-used.h' does not need to be #included test/foo.h:150: 'AR' not used test/foo.h:221: unable to find 'dir//bar.h' +test/foo.h:307: 'foo.hxx' does not need to be #included; use a forward declaration instead test/foo.h:234 'Colon' has virtual methods without a virtual dtor test/foo.h:20: static data 'd' test/foo.h:101: static data 'ptof'