Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for include .hxx file #155 #156

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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