Bug 249566 - [Quick Fix] allow to correct type casts
Summary: [Quick Fix] allow to correct type casts
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-codan (show other bugs)
Version: 5.0.1   Edit
Hardware: Other Linux
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: CDT Codan Inbox CLA
QA Contact: Elena Laskavaia CLA
URL:
Whiteboard:
Keywords: helpwanted
Depends on: 352071 255323
Blocks:
  Show dependency tree
 
Reported: 2008-10-03 01:31 EDT by anil_gm CLA
Modified: 2020-09-04 15:25 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description anil_gm CLA 2008-10-03 01:31:40 EDT
It will be nice to see eclipse automatically correcting the type casting issues...The compiler exactly reports the error with the type cast; the editor should provide auto correction option to fix these kind of issues...Right now it shows "no suggestions"...

To be clear...

char* string;
string = malloc();  // This needs a type cast: string = (char *) malloc();

The editor should allow to automatically insert the type info...
Comment 1 anil_gm CLA 2008-11-13 22:09:28 EST
Is it going to be fixed...priority 3???? Just try porting a C project to C++ and you will see importance of this...Not always the complex issues are high priority ones...
Comment 2 Markus Schorn CLA 2008-11-14 04:21:38 EST
We are missing a piece of infrastructure to do verification on c/c++ code beyond what's necessary for indexing.
Comment 3 Andrew Gvozdev CLA 2008-11-14 06:43:11 EST
It is possible to rely on error parser markers to implement quick fixes. But I'd rather not encourage type casts that way.
Comment 4 Markus Schorn CLA 2008-11-14 07:20:25 EST
(In reply to comment #3)
> It is possible to rely on error parser markers to implement quick fixes. But
> I'd rather not encourage type casts that way.

Hmm, with error parsers it will be hard to deal with different compilers in
different versions using different langugages. Also it will be non-trivial to find the correct spot for the correction.
Also, it would be nice to have the quick-fixes available without the need to compile the code.

Doing a parser based solution does not per se prevent the implementation of error-parser based quick-fixes, however it might be confusing to users to have two different paths to solve the same problem?
Comment 5 Andrew Gvozdev CLA 2008-11-14 08:46:11 EST
(In reply to comment #4)
I agree that parser based solution is more attractive. Perhaps I underestimate easiness of implementing necessary infrastructure.

There is still a niche for error parser quick fixes, for example we've implemented quick fixes for Flexelint warnings and for our own custom build system errors/warnings.
Comment 6 Andrew Gvozdev CLA 2010-05-07 09:21:59 EDT
It should be appropriate to handle with codan, changing component.
Comment 7 Tomasz Wesolowski CLA 2011-07-14 15:19:37 EDT
I've opened bug 352071 for a more complete checker for casts and I'm working on it. I plan to add quick fixes (the case you mentioned and more) afterwards.