You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While working on #107238, I noticed that these attributes (and their "or null" counterparts) are DeclOrTypeAttr attributes which are intended to be C-only. However, there's no code in processTypeAttrs() in SemaType.cpp to handle these attributes, and so it wasn't clear that we had the right restrictions for checking the language mode.
This led me to discover some odd inconsistencies with how we handle the type form of the attribute: https://godbolt.org/z/WhjYE1xTY
#define __counted_by(f) __attribute__((counted_by(f)))
int foo;
int y = (int __counted_by(foo))12;
int * __counted_by(foo) ptr;
gives:
<source>:4:14: warning: 'counted_by' attribute ignored when parsing type [-Wignored-attributes]
4 | int y = (int __counted_by(foo))12;
| ^~~~~~~~~~~~~~~~~
<source>:1:40: note: expanded from macro '__counted_by'
1 | #define __counted_by(f) __attribute__((counted_by(f)))
| ^~~~~~~~~~~~~
<source>:6:7: error: 'counted_by' attribute only applies to non-static data members
6 | int * __counted_by(foo) ptr;
| ^
<source>:1:40: note: expanded from macro '__counted_by'
1 | #define __counted_by(f) __attribute__((counted_by(f)))
| ^
1 warning and 1 error generated.
Compiler returned: 1
The text was updated successfully, but these errors were encountered:
While working on https://github.com//pull/107238, I noticed that these attributes (and their "or null" counterparts) are `DeclOrTypeAttr` attributes which are intended to be C-only. However, there's no code in `processTypeAttrs()` in `SemaType.cpp` to handle these attributes, and so it wasn't clear that we had the right restrictions for checking the language mode.
This led me to discover some odd inconsistencies with how we handle the type form of the attribute: https://godbolt.org/z/WhjYE1xTY
#define __counted_by(f) __attribute__((counted_by(f)))
int foo;
int y = (int __counted_by(foo))12;
int * __counted_by(foo) ptr;
gives:
<source>:4:14: warning: 'counted_by' attribute ignored when parsing type [-Wignored-attributes]
4 | int y = (int __counted_by(foo))12;
| ^~~~~~~~~~~~~~~~~
<source>:1:40: note: expanded from macro '__counted_by'
1 | #define __counted_by(f) __attribute__((counted_by(f)))
| ^~~~~~~~~~~~~
<source>:6:7: error: 'counted_by' attribute only applies to non-static data members
6 | int * __counted_by(foo) ptr;
| ^
<source>:1:40: note: expanded from macro '__counted_by'
1 | #define __counted_by(f) __attribute__((counted_by(f)))
| ^
1 warning and 1 error generated.
Compiler returned: 1
While working on #107238, I noticed that these attributes (and their "or null" counterparts) are
DeclOrTypeAttr
attributes which are intended to be C-only. However, there's no code inprocessTypeAttrs()
inSemaType.cpp
to handle these attributes, and so it wasn't clear that we had the right restrictions for checking the language mode.This led me to discover some odd inconsistencies with how we handle the type form of the attribute: https://godbolt.org/z/WhjYE1xTY
gives:
The text was updated successfully, but these errors were encountered: