Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 332257

Summary: renaming a macro doesn't change its usage within another macro
Product: [Tools] CDT Reporter: Matt Hargett <matt>
Component: cdt-refactoringAssignee: Project Inbox <cdt-refactoring-inbox>
Status: NEW --- QA Contact: Jonah Graham <jonah>
Severity: normal    
Priority: P3 CC: cdtdoug, yevshif
Version: 8.0   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
tarball of the source tree that reproduces this bug, from the open source project "cgreen" none

Description Matt Hargett CLA 2010-12-09 17:16:30 EST
Build Identifier: 201012031515

For the following code from the open source project cgreen:

#define expect(f, ...) expect_(get_test_reporter(), #f, __FILE__, __LINE__, (Constraint *)__VA_ARGS__ +0, (Constraint *)0)

void expect_(TestReporter *test_reporter, const char *function, const char *test_file, int test_line, ...);

#define where(parameter, constraint) where_(#parameter, constraint)
Constraint *where_(const char *parameter, Constraint *constraint);

Ensure(single_item_breadcrumb_does_calls_walker_only_once) {
    expect(mock_walker, where(name, is_equal_to_string("Hello")));
}

Renaming the macro where() on the first line does not correctly update the name in the expect() statement on the next to last line.

Reproducible: Always

Steps to Reproduce:
1. unpack the attached tarball and add it to a new C++ project
2. opens mocks.h
3. select the where() macro delcaration and press alt+shift+R
4. change the name to when() and press Enter

result:
compilation will fail because the instances of where() in breadcrumb_tests.c and a few other places are not correctly renamed.

expected result:
rename refactoring should correctly update all instances of the symbol name so that compilation and behaviour of the code continues without a problem.
Comment 1 Matt Hargett CLA 2010-12-09 17:17:00 EST
Created attachment 184909 [details]
tarball of the source tree that reproduces this bug, from the open source project "cgreen"
Comment 2 Matt Hargett CLA 2010-12-09 17:18:43 EST
It's worth noting that if I go iunto breadcrumb_tests.c, and select the instance of when() that wasn't renamed correctly, and then press alt+shift+R, CDT *does* correctly rename all the instances in the file.
Comment 3 Matt Hargett CLA 2011-05-20 15:32:31 EDT
Verified this problem is still present in build ID  201105160958.
Comment 4 Matt Hargett CLA 2011-05-20 15:33:14 EDT
Verified this problem still exists in build id 201105160958.
Comment 5 Matt Hargett CLA 2013-02-20 17:14:09 EST
still happening in Version: 8.2.0.201302052218