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

Bug 323972

Summary: Formatting issue with #define
Product: [Tools] CDT Reporter: BB <bjoern.kiefer>
Component: cdt-editorAssignee: Project Inbox <cdt-editor-inbox>
Status: RESOLVED WORKSFORME QA Contact: Anton Leherbauer <aleherb+eclipse>
Severity: major    
Priority: P3 CC: ghislain.viguier, marco.stornelli, zeratul976
Version: 7.0   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description BB CLA 2010-08-30 10:30:35 EDT
I found a formatting issue.
Copy the following code into the C++ Editor and press (ctrl+shift+f). 


#include <iostream>
#include <string>

//#define OUTPUT_STREAM std::cout
#define OUTPUT_STREAM true && std::cout

int main(int argc, char **argv) {
	OUTPUT_STREAM << "test" << std::endl;
	// This line moves
	// This line moves
} // This line moves


The result after the formatting is not well and looks like this:

#include <iostream>
#include <string>

//#define OUTPUT_STREAM std::cout
#define OUTPUT_STREAM true && std::cout

int main(int argc, char **argv) {
	OUTPUT_STREAM << "test" << std::endl;
	// This line moves
			// This line moves
		} // This line moves


If I comment out the second define and uncomment the first define, the formatting looks good:

#include <iostream>
#include <string>

#define OUTPUT_STREAM std::cout
//#define OUTPUT_STREAM true && std::cout

int main(int argc, char **argv) {
	OUTPUT_STREAM << "test" << std::endl;
	// This line moves
	// This line moves
} // This line moves
Comment 1 Marco Stornelli CLA 2019-04-13 02:38:43 EDT
This bug report should be closed because we can't reproduce with CDT 9.7.