| Summary: | Use of two sequential macros in C++ code formats incorrectly | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Tools] CDT | Reporter: | Geoff Alexander <gdlxn> | ||||
| Component: | cdt-editor | Assignee: | Marco Stornelli <marco.stornelli> | ||||
| Status: | RESOLVED FIXED | QA Contact: | Anton Leherbauer <aleherb+eclipse> | ||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | cdtdoug, gdlxn, jonah, yevshif, zeratul976 | ||||
| Version: | 8.0 | ||||||
| Target Milestone: | 9.8.0 | ||||||
| Hardware: | PC | ||||||
| OS: | Linux | ||||||
| See Also: |
https://git.eclipse.org/r/138425 https://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=d1bd979a00673bcb6fcaa001200ee32cf3def041 |
||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
|
Description
Geoff Alexander
Created attachment 205779 [details]
Eclipse workspace containing small example illustrating the problem
Build Identifier: 20110916-0149
We sometimes have two sequential macro usages as in the following code:
public:
inline bool operator!=(const Term& r) const {
LLTP_ASSERT1((_type == function) || (_type == variable));
LLTP_ASSERT1((r._type == function) || (r._type == variable));
return !(*this == r);
}
Under Eclipse CDT 8.0 this formats incorrectly on the first format:
public:
inline bool operator!=(const Term& r) const {
LLTP_ASSERT1((_type == function) || (_type == variable)); LLTP_ASSERT1((r._type == function) || (r._type == variable));
return !(*this == r);
}
A second format gives
public:
inline bool operator!=(const Term& r) const {
LLTP_ASSERT1((_type == function) || (_type == variable));LLTP_ASSERT1((r._type == function) || (r._type == variable));
return !(*this == r);
}
I've attached an Eclipse workspace containing a small example illustrating the problem.
Looks like the problem is related to the macro having an empty expansion. Thanks Nathan. Based on your comment, I'm able to work around the problem by using the # Symbols tab of the C/C++ General -> Paths and Symbols preferences to ensure that the problematic macros aren't empty. However, even though I'm able to work around the problem, I still think that this problem should be fixed. Agreed - this is a bug in the formatter. New Gerrit change created: https://git.eclipse.org/r/138425 Gerrit change https://git.eclipse.org/r/138425 was merged to [master]. Commit: http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=d1bd979a00673bcb6fcaa001200ee32cf3def041 Thank you for the fix Marco! |