This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 223940

Summary: [rename-refactoring] NB rename a macro and all ifdefs that references this macro
Product: cnd Reporter: gugawag
Component: EditorAssignee: Vladimir Voskresensky <vv159170>
Status: NEW ---    
Severity: normal CC: gugawag
Priority: P3    
Version: 7.2.1   
Hardware: Macintosh   
OS: Mac OS X   
Issue Type: DEFECT Exception Reporter:

Description gugawag 2012-12-17 15:19:19 UTC
Build: 201210100934 (Same result in NB 7.3 Beta 2 Build 201211062253)

NB refactoring support renames a macro inside a module and the references of ifdefs, leading to a behavioral change of the code.


Reproducible: Always

Steps to Reproduce:

1. Create a header file named h1.h with the following code:

#define MACRO1

#ifdef MACRO1
        int c = 20;
#endif

2. Create a C file with the following code:

#include <stdio.h>
#include "h1.h"

extern int c;

int main(){
    #ifdef MACRO2
        printf("%d", c);
    #endif
    printf("%d", 13);
    return 0;
}

output: 13

3. Apply the Rename to the MACRO1 inside h1 to MACRO2, and NB also rename the #ifdef dependence:

#define MACRO2 //refactored

#ifdef MACRO2 //changed also
        int c = 20;
#endif


4. The new output: 2013
Comment 1 Ondrej Vrabec 2012-12-17 15:32:29 UTC
gugawag: file cnd bugs against the cnd product
Comment 2 gugawag 2012-12-17 15:33:27 UTC
Sorry me :(. I will change the other ones.