Skip to content

Commit

Permalink
Fix for include .hxx file myint#155
Browse files Browse the repository at this point in the history
  • Loading branch information
dyadav7 committed May 24, 2020
1 parent aa73d06 commit ff8d958
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
3 changes: 1 addition & 2 deletions cpp/find_warnings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
8 changes: 8 additions & 0 deletions test/a.hxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#ifndef _A_H_
#define _A_H_

#include "b.hxx"

void myFunc(int a);

#endif
14 changes: 14 additions & 0 deletions test/b.hxx
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions test/expected.txt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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'
Expand Down

0 comments on commit ff8d958

Please sign in to comment.