-
Notifications
You must be signed in to change notification settings - Fork 58
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
Dealing with defines #56
Labels
Comments
Thanks for reporting this. I don't have time to look at this in the near term, but, I've added you as a collaborator to this repository. |
christarazi
added a commit
to christarazi/cppclean
that referenced
this issue
Sep 18, 2017
This change modifies WarningHunter._determine_uses()._add_use() to take in a full VariableDeclaration object instead of Type. This allows us to check for the initial_value attribute of a VariableDeclaration object which may contain a symbol from an included file (e.g. a #define). This change also exports Define objects in order to capture their value and check if they are being used. To fully implement the issue rasied in myint#56, inline constructor member initializer lists need to be supported.
Hi, The same goes if you have for example: string.h using MyString = std::string; main.cpp #include "string.h"
void run() {
MyString hello("Hello world");
} |
myint
pushed a commit
that referenced
this issue
Mar 31, 2018
…nes with values (#128) * Implement preliminary solution to #56 for exporting defines This change modifies WarningHunter._determine_uses()._add_use() to take in a full VariableDeclaration object instead of Type. This allows us to check for the initial_value attribute of a VariableDeclaration object which may contain a symbol from an included file (e.g. a #define). This change also exports Define objects in order to capture their value and check if they are being used. To fully implement the issue rasied in #56, inline constructor member initializer lists need to be supported. * Implement basic support for ctor initializer lists This change adds basic support for initializing variables (initial_value attribute of VariableDeclaration) inside ctor initializer lists. It only supports one parameter for a given member. The ctor must also be inline defined. In other words, a ctor with its definition outside the class is not supported. Below is an example of what's supported: ``` class Foo { public: Foo() : foo(1) {} private: int foo; }; ``` In this case, the `initial_value` of `foo` is set to `1`. Whereas, the following is not supported, and will be ignored: ``` class Foo { public: Foo() : bar(1, 2, 3, 4) {} private: Bar bar; }; ``` This ctor is defined outside the class, and thus not supported: ``` class Foo { public: Foo(); private: Bar bar; }; Foo:Foo() : bar(1) {} ``` * Add tests for ctor initializer lists * Fix travis ci errors * Fix using explicit python3 type This fixes the broken build for Python 2. * Fix inconsistency with usage of local variable
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If one includes a header where a macro is defined,
cppclean
will not be able to detect that the header can actually be needed. This may be clearer with the following dummy example.Example:
foo.h
bar.h
Running
cppclean
gives:This may be something to add to the "planned" features, unless this requires some analysis that this tool is not meant to achieve. If that's the case, this may be worth noting somewhere in the documentation/help message.
The text was updated successfully, but these errors were encountered: