-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
Qt Creator 2.8.0-beta
-
None
-
a341094a684fa304a2da1003aa8edd1d9226c58d
Hi,
after this change:
https://codereview.qt-project.org/#change,58405
I started seeing some issues with macros. If macro has multiple arguments, and you place comments between them, they cause false errors to appear
here is the code:
#define MACRO_NUM_1 (17) #define MACRO_NUM_2 (21) bool someFunct(void *a, const char *b, struct somethingElse *c, struct somethingElse *d) { /* do something and Always return True */ return true; } extern struct somethingElse *someExternStruct; #define MACRO1(a) /* comment */\ ( __builtin_expect(!!(a), 0) ) #define MACRO2(a, /* comment breaker 2 */\ b) /* comment */\ ( __builtin_expect(!!(a == b), 0) ) #define MACRO3(a,/* comment breaker 1 */ \ b,/* comment breaker 1 */\ c) /* comment that */ \ (void)(MACRO2(a, MACRO_NUM_1) &&\ MACRO1(MACRO_NUM_2) &&\ someFunct(b, c,\ someExternStruct,\ somethingUnknown ## a ## _p)) #define NSS_TUHWIF_REF_INTERRUPT 10 int main() { int * pointer; MACRO3(UNKNOWN_MACRO, pointer, "NSS_TUHWIF_REF_INTERRUPT"); }
in pictures you can see two errors. One is caused by two comments:
/* comment breaker 1 */
if you remove this comments, then another type of error appears, caused by:
/* comment breaker 2 */
This one highlights line below then main macro call as error, even if it is comment.
Regards
Petar
| For Gerrit Dashboard: QTCREATORBUG-9535 | ||||||
|---|---|---|---|---|---|---|
| # | Subject | Branch | Project | Status | CR | V |
| 108154,11 | C++: Fix preprocessing of comments within function-like macro | 3.4 | qt-creator/qt-creator | Status: MERGED | +2 | 0 |