Home » Language IDEs » C / C++ IDE (CDT) » Eclipse CDT Code Analysis says error, g++ and cl.exe are OK with it(How to set the Code Analysis properly?)
| | | | | | | | | | | | |
Re: Eclipse CDT Code Analysis says error, g++ and cl.exe are OK with it [message #777180 is a reply to message #776809] |
Tue, 10 January 2012 01:28 |
Hermann Vosseler Messages: 10 Registered: July 2009 |
Junior Member |
|
|
Axel Mueller wrote on Mon, 09 January 2012 04:56The internal code analysis CODAN is bases on the indexer. So if the index is not complete you will get false CODAN errors. Sometimes the index is not complete due to missing include paths or predefined symbols which can be fixed.
In your case the indexer does not know which function to use because there are several function with the same name but different signature i.e. different parameter types.
... while the compiler certainly knows, based on the rules of the language. Otherwise there would be an ambiguity and thus an compiler error.
Generally speaking, CODAN is a very promising feature, just it doesn't seem to be "there yet". We all know that the rules of C++ can be quite intricate in all gory details. As it stands currently, CODAN doesn't seem to implement all of C++ and thus misses quite frequently things which are prefectly legal or also fails to warn on things where it should.
Just to give one very blatant example:
There is the warning "your class has virtual functions but is lacking a virtual dtor". We all agree that such a warning would be a very good thing.
Unfortunately:
- CODAN gives a false positive if your class is derived from an ABC, which defines exactly that virtual dtor
- CODAN fails to warn, when you don't declare your overriden function as "virtual", but fail to define that virtual dtor in the base class.
Of course we can start arguing about style now, but thats besides the pont.
Anyway, I think CODAN is going to be come a killer feature, once it gets most
aspects of the language right. We just need to be a bit more patient (or help with implementing what's missing?)
-- Ichthyo
|
|
| | |
Re: Eclipse CDT Code Analysis says error, g++ and cl.exe are OK with it [message #883593 is a reply to message #779110] |
Fri, 08 June 2012 22:00 |
|
I found two cases where I was getting incorrect CODAN errors.
1. if i use this syntax to declare a method:
void myfunc( myClass & classArg );
if i take out one of the spaces either side of the '&' errors go away
2. include files not found:
if CODAN says a reference in a headr file cannot be found, when it is found by
the compiler, i just include that header specifically in the offending file.
ANgus
|
|
|
Re: Eclipse CDT Code Analysis says error, g++ and cl.exe are OK with it [message #912777 is a reply to message #777294] |
Fri, 14 September 2012 07:06 |
Jan Pohanka Messages: 29 Registered: June 2011 |
Junior Member |
|
|
Axel Mueller wrote on Tue, 10 January 2012 03:37
Yeah, you are right. Unfortunately, there are still open issues. Therefore I have disabled some checks (e.g. virtual dtor!) and CODAN is only active when I open a file in the editor. In the Problems View I usually filter out the CODAN messages.
But work is continuing and you should see much better results with the next release in June (if you are brave you can already use a nightly build).
Thank you Axel for this information. I was not aware of the possibility of filtering codan messages in the problems view. It is much better to use problems view now.
However, as we all probably agree CODAN code analysis still is not perfect (and I'm wondering if it ever be) especially for larger Makefile projects (eg. linux kernel, qt projects, ...) so I'd like to be able to distinguish the CODAN errors from compile errors even in editor view. Is there a way how to do it? I have found only severity settings (error, warning, info). This closed bug (https://bugs.eclipse.org/bugs/show_bug.cgi?id=329430) informs about some icons used to distinguish the problems, but in Eclipse Indigo I see only red underlines and red rectangles in the bar for both compiler and CODAN errors.
I think that editor should be useful even for non indexed project...
with best regards
Jan
|
|
|
Re: Eclipse CDT Code Analysis says error, g++ and cl.exe are OK with it [message #912838 is a reply to message #912777] |
Fri, 14 September 2012 09:22 |
Axel Mueller Messages: 1973 Registered: July 2009 |
Senior Member |
|
|
Jan Pohanka wrote on Fri, 14 September 2012 09:06
However, as we all probably agree CODAN code analysis still is not perfect (and I'm wondering if it ever be) especially for larger Makefile projects (eg. linux kernel, qt projects, ...) so I'd like to be able to distinguish the CODAN errors from compile errors even in editor view. Is there a way how to do it? I have found only severity settings (error, warning, info). This closed bug (https://bugs.eclipse.org/bugs/show_bug.cgi?id=329430) informs about some icons used to distinguish the problems, but in Eclipse Indigo I see only red underlines and red rectangles in the bar for both compiler and CODAN errors.
I think that editor should be useful even for non indexed project...
with best regards
Jan
As you can see from the above mentioned bug report I did foresee problems with the CODAN icons in the editor. Unfortunately, I was ignored. I proposed then another enhancement https://bugs.eclipse.org/bugs/show_bug.cgi?id=368221
An option to use different colors for CODAN errors in the editor. You can add your vote if you like.
Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
|
|
| |
Re: Eclipse CDT Code Analysis says error, g++ and cl.exe are OK with it [message #1023966 is a reply to message #912861] |
Mon, 25 March 2013 15:02 |
slajerek . Messages: 20 Registered: April 2010 |
Junior Member |
|
|
I do believe that CDT Code Analysis should be switched off by default. I spent a lot of time figuring out what's wrong with my project. Of course, the code analysis was wrong, hopefully I found this and switched off that broken feature completely. But my precious time was lost and it took me an hour or so. I assume every C++ developer has to go down this path, which in overall gives years of time effort lost.
Why developers of Eclipse are keeping features that certainly are broken (such as code analysis) set default to on? It's really annoying. From my perspective I do not care, but if something is telling me that I have an error in my code, which compiles, is written perfectly fine, but some analysis went wrong - then that feature should be called experimental and removed (in my example that was reference to a type which was defined, included but Eclipse have not found it for some reason and assumed it as "?"). Certainly, the CDT Code Analysis is such feature and I ALWAYS have problems with it, thus please tell me why it's in Eclipse's stable branch and turned on by default?
[Updated on: Mon, 25 March 2013 15:05] Report message to a moderator
|
|
| |
Goto Forum:
Current Time: Wed Sep 18 04:55:27 GMT 2024
Powered by FUDForum. Page generated in 0.05052 seconds
|