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 - [rename-refactoring] NB rename a macro and all ifdefs that references this macro
Summary: [rename-refactoring] NB rename a macro and all ifdefs that references this macro
Status: NEW
Alias: None
Product: cnd
Classification: Unclassified
Component: Editor (show other bugs)
Version: 7.2.1
Hardware: Macintosh Mac OS X
: P3 normal (vote)
Assignee: Vladimir Voskresensky
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-12-17 15:19 UTC by gugawag
Modified: 2014-11-19 16:26 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.