Bug 426892 - [Refactoring] Renaming a macro to a pointer shouldn't be allowed
Summary: [Refactoring] Renaming a macro to a pointer shouldn't be allowed
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-29 09:14 EST by Gustavo Wagner CLA
Modified: 2020-09-04 15:17 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-29 09:14:46 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 identifier_0
float gvar_0 = -1;
void f_0() {
    int var_0 = -1;
    var_0 = 100;
}
float f_1(float var_0) {
    return gvar_0;
}
==================================

Now, let's rename the macro "identifier_0" to "*identifier_0"
Applying the refactoring:
========== Refactored ============
#define *identifier_0
float gvar_0 = -1;
void f_0() {
    int var_0 = -1;
    var_0 = 100;
}
float f_1(float var_0) {
    return gvar_0;
}
=================================

The tool shouldn't allow to apply invalid transformations like this. Notice that now the program has a compilation error. It would be good if it was possible to prevent the use of invalid names when renaming.

Thanks in advance.
Comment 1 Gustavo Wagner CLA 2014-01-29 11:51:00 EST
Correcting:
* Now, let's rename the macro "identifier_0" to "*identifier_0"
Comment 2 Gustavo Wagner CLA 2014-01-29 11:56:01 EST
Ignore this. Sorry.
(In reply to Gustavo Wagner from comment #1)
> Correcting:
> * Now, let's rename the macro "identifier_0" to "*identifier_0"