Bug 425622 - Changing behavior when renaming macro-defined token
Summary: Changing behavior when renaming macro-defined token
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-refactoring (show other bugs)
Version: Next   Edit
Hardware: PC Mac OS X
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-13 21:49 EST by Gustavo Wagner CLA
Modified: 2020-09-04 15:19 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gustavo Wagner CLA 2014-01-13 21:49:42 EST
Eclipse IDE for C/C++ Developers
Version: Kepler Service Release 1
Build id: 20130919-0819


Reproducing the bug:


Consider the following code:
============== Original Version ===============
#define A // Id to be renamed
int main(int argc, char** argv) {
    int a;
#ifdef A
    a = 1;
#endif
#ifndef A
    a = 2;
#endif
    return a;
}
===============================================

Now, let's rename macro "A" to "not A"

============= Refactored Version ==============
#define not A // Invalid rename
int main(int argc, char** argv) {
    int a;
#ifdef A
    a = 1;
#endif
#ifndef A // Missing definition
    a = 2;
#endif
    return a;
}
===============================================

The change is not behavior-preserving: The refactoring tool did not update the following reference ("#ifdef A"). In fact, it doesn't make sense to have a "#ifdef not A" but the tool 1) Allows blank spaces while renaming and 2) didn't update all references.


Thanks in advance.