vsavchenko added a comment.

@aaron.ballman I totally agree, but I also would like to understand. 
`__attribute__` is a GNU extension, right?  Then why does it affect the grammar 
of C?  I always thought that attributes should be somewhat transparent for 
parsers, but it looks like in this situation all compilers automatically assume 
that `__attribute__` begins a declaration.
It is unclear to me why `*x;`, `[[unknown]] *x;` (dereference of x) and 
`__attribute__((unknown)) *x;` (declaration of `int *`) have different meanings.

Does it essentially mean that there is no way to implement statement attributes 
in C/Obj-C?
Because even if we introduce some heuristics for understanding that what we 
parsed is a declaration attribute -> what follows must be a declaration, 
attributes that can be applied to both declaration and statements will cause 
confusion.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93630/new/

https://reviews.llvm.org/D93630

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to