Bug 579623 - CDT doesn't add __attribute__ to pointer operators in declarations
Summary: CDT doesn't add __attribute__ to pointer operators in declarations
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-core (show other bugs)
Version: 10.3.3   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-04-07 11:29 EDT by Oleg Petrov CLA
Modified: 2022-04-07 11:29 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Oleg Petrov CLA 2022-04-07 11:29:51 EDT
Using CDT Core 7.2.100.202105180159

CDT ignores (accepts but does not use) __attribute__'s after pointer operator in declarations:

int * __attribute__((__aligned__(1))) p1;
is parsed as
int *p1;

As far as I know, it is because result of __attribute_decl_seq() in consumePointerOperators() in GNUCSourceParser is not assigned to anything.

Moreover, if a qualifier comes after an attribute (GCC allows free order for all of these after pointer operator), that qualifier is considered an identifier, and declaration becomes a problem. Example of problematic declaration:

int * __attribute__((__aligned__(2))) const p2;

I think a case for __attribute__ should be added to the switch in consumePointerOperators. Then __attribute_decl_seq call at start is not needed.