[PATCH] D93630: [Attr] Apply GNU-style attributes to expression statements

2021-02-11 Thread Valeriy Savchenko via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG81a970772384: [Attr] Apply GNU-style attributes to expression statements (authored by vsavchenko). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D93630/new/

[PATCH] D93630: [Attr] Apply GNU-style attributes to expression statements

2021-02-10 Thread Valeriy Savchenko via Phabricator via cfe-commits
vsavchenko added a comment. In D93630#2554186 , @aaron.ballman wrote: > In D93630#2506604 , @aaron.ballman > wrote: > >> In D93630#2504758 , @vsavchenko >> wrote: >> >>> I

[PATCH] D93630: [Attr] Apply GNU-style attributes to expression statements

2021-02-10 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision. aaron.ballman added a comment. This revision is now accepted and ready to land. In D93630#2506604 , @aaron.ballman wrote: > In D93630#2504758 , @vsavchenko > wrote: > >> I'll

[PATCH] D93630: [Attr] Apply GNU-style attributes to expression statements

2021-01-29 Thread Valeriy Savchenko via Phabricator via cfe-commits
vsavchenko updated this revision to Diff 320092. vsavchenko added a comment. Add check for extension Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D93630/new/ https://reviews.llvm.org/D93630 Files: clang/include/clang/Basic/Features.def clang/l

[PATCH] D93630: [Attr] Apply GNU-style attributes to expression statements

2021-01-28 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added inline comments. Comment at: clang/include/clang/Basic/Features.def:256 EXTENSION(pragma_clang_attribute_external_declaration, true) +EXTENSION(statement_attributes_with_gnu_syntax, true) EXTENSION(gnu_asm, LangOpts.GNUAsm) People seem to occasionally

[PATCH] D93630: [Attr] Apply GNU-style attributes to expression statements

2021-01-27 Thread Valeriy Savchenko via Phabricator via cfe-commits
vsavchenko updated this revision to Diff 319516. vsavchenko added a comment. Herald added a subscriber: dexonsmith. Add extension for backward compatibility checks Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D93630/new/ https://reviews.llvm.org/D9

[PATCH] D93630: [Attr] Apply GNU-style attributes to expression statements

2021-01-21 Thread Valeriy Savchenko via Phabricator via cfe-commits
vsavchenko updated this revision to Diff 318159. vsavchenko added a comment. Add more tests Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D93630/new/ https://reviews.llvm.org/D93630 Files: clang/lib/Parse/ParseStmt.cpp clang/test/Parser/stmt-at

[PATCH] D93630: [Attr] Apply GNU-style attributes to expression statements

2021-01-19 Thread Valeriy Savchenko via Phabricator via cfe-commits
vsavchenko added a comment. In D93630#2506604 , @aaron.ballman wrote: > In D93630#2504758 , @vsavchenko > wrote: > >> I'll clean up the tests! But, unfortunately, I couldn't proceed with GCC >> folks. I asked a

[PATCH] D93630: [Attr] Apply GNU-style attributes to expression statements

2021-01-19 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. In D93630#2504758 , @vsavchenko wrote: > I'll clean up the tests! But, unfortunately, I couldn't proceed with GCC > folks. I asked around and I'm not allowed to do that (company rules). Ah, that's unfortunate. When I get

[PATCH] D93630: [Attr] Apply GNU-style attributes to expression statements

2021-01-19 Thread Valeriy Savchenko via Phabricator via cfe-commits
vsavchenko added inline comments. Comment at: clang/test/Parser/stmt-attributes.c:5 + + __attribute__((unknown_attribute));// expected-warning {{unknown attribute 'unknown_attribute' ignored}} + __attribute__((unknown_attribute)) {} // expected-warning {{u

[PATCH] D93630: [Attr] Apply GNU-style attributes to expression statements

2021-01-19 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/test/Parser/stmt-attributes.c:5 + + __attribute__((unknown_attribute));// expected-warning {{unknown attribute 'unknown_attribute' ignored}} + __attribute__((unknown_attribute)) {} // expected-warning

[PATCH] D93630: [Attr] Apply GNU-style attributes to expression statements

2021-01-18 Thread Valeriy Savchenko via Phabricator via cfe-commits
vsavchenko added inline comments. Comment at: clang/test/Parser/stmt-attributes.c:5 + + __attribute__((unknown_attribute));// expected-warning {{unknown attribute 'unknown_attribute' ignored}} + __attribute__((unknown_attribute)) {} // expected-warning {{u

[PATCH] D93630: [Attr] Apply GNU-style attributes to expression statements

2021-01-18 Thread Valeriy Savchenko via Phabricator via cfe-commits
vsavchenko added a comment. In D93630#2490034 , @aaron.ballman wrote: > In D93630#2486574 , @aaron.ballman > wrote: > >> I'm going to see if I can run the patch against our internal corpus here at >> work to see

[PATCH] D93630: [Attr] Apply GNU-style attributes to expression statements

2021-01-11 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. In D93630#2486574 , @aaron.ballman wrote: > I'm going to see if I can run the patch against our internal corpus here at > work to see if it shakes out any breakages to real world code. I've not tried > this before, so I ha

[PATCH] D93630: [Attr] Apply GNU-style attributes to expression statements

2021-01-08 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. In D93630#2480070 , @vsavchenko wrote: > In D93630#2479757 , @aaron.ballman > wrote: > >> There are attributes like `nomerge` which are both a declaration and a >> statement attribut

[PATCH] D93630: [Attr] Apply GNU-style attributes to expression statements

2021-01-05 Thread Valeriy Savchenko via Phabricator via cfe-commits
vsavchenko added a comment. In D93630#2479757 , @aaron.ballman wrote: > In D93630#2479343 , @vsavchenko > wrote: > >> In D93630#2479260 , @aaron.ballman >> wrote: >> >>> I

[PATCH] D93630: [Attr] Apply GNU-style attributes to expression statements

2021-01-05 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. In D93630#2479343 , @vsavchenko wrote: > In D93630#2479260 , @aaron.ballman > wrote: > >> In D93630#2478977 , @vsavchenko >> wrote: >> >>> I

[PATCH] D93630: [Attr] Apply GNU-style attributes to expression statements

2021-01-05 Thread Valeriy Savchenko via Phabricator via cfe-commits
vsavchenko added a comment. In D93630#2479260 , @aaron.ballman wrote: > In D93630#2478977 , @vsavchenko > wrote: > >> I guess I want to clarify one point here, after this patch the parser **will >> not assume** t

[PATCH] D93630: [Attr] Apply GNU-style attributes to expression statements

2021-01-05 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. In D93630#2478977 , @vsavchenko wrote: > I guess I want to clarify one point here, after this patch the parser **will > not assume** that statement always follows statement attributes. We simply > turn off the assumption t

[PATCH] D93630: [Attr] Apply GNU-style attributes to expression statements

2021-01-05 Thread Valeriy Savchenko via Phabricator via cfe-commits
vsavchenko added a comment. I guess I want to clarify one point here, after this patch the parser **will not assume** that statement always follows statement attributes. We simply turn off the assumption that what follows is a declaration, parser will simply determine whether it is a statement

[PATCH] D93630: [Attr] Apply GNU-style attributes to expression statements

2021-01-05 Thread Valeriy Savchenko via Phabricator via cfe-commits
vsavchenko added inline comments. Comment at: clang/lib/Parse/ParseStmt.cpp:213 ParsedStmtContext()) && -(GNUAttributeLoc.isValid() || isDeclarationStatement())) { +((GNUAttributeLoc.isValid() && !Attrs.back().isStmtAttr()) || + isDeclaration

[PATCH] D93630: [Attr] Apply GNU-style attributes to expression statements

2021-01-04 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. In D93630#2470048 , @vsavchenko wrote: > In D93630#2468853 , @aaron.ballman > wrote: > >> Yeah, I kind of figured that might be the cause. I'm not 100% convinced (one >> way or the o

[PATCH] D93630: [Attr] Apply GNU-style attributes to expression statements

2020-12-23 Thread Valeriy Savchenko via Phabricator via cfe-commits
vsavchenko added a comment. In D93630#2468853 , @aaron.ballman wrote: > Yeah, I kind of figured that might be the cause. I'm not 100% convinced (one > way or the other) if the suppress attribute should get a GNU spelling. The > `[[]]` spellings are avai

[PATCH] D93630: [Attr] Apply GNU-style attributes to expression statements

2020-12-23 Thread Valeriy Savchenko via Phabricator via cfe-commits
vsavchenko updated this revision to Diff 313550. vsavchenko added a comment. Refine condition for statement attributes Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D93630/new/ https://reviews.llvm.org/D93630 Files: clang/lib/Parse/ParseStmt.cpp

[PATCH] D93630: [Attr] Apply GNU-style attributes to expression statements

2020-12-22 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. In D93630#2468241 , @vsavchenko wrote: > In D93630#2468197 , @aaron.ballman > wrote: > >> However, taking a step back -- what attributes would need this functionality >> (and couldn'

[PATCH] D93630: [Attr] Apply GNU-style attributes to expression statements

2020-12-22 Thread Valeriy Savchenko via Phabricator via cfe-commits
vsavchenko updated this revision to Diff 313362. vsavchenko added a comment. Maintain previous behavior unless preceeded by a statement attribute Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D93630/new/ https://reviews.llvm.org/D93630 Files: cla

[PATCH] D93630: [Attr] Apply GNU-style attributes to expression statements

2020-12-22 Thread Valeriy Savchenko via Phabricator via cfe-commits
vsavchenko added a comment. In D93630#2468197 , @aaron.ballman wrote: > However, taking a step back -- what attributes would need this functionality > (and couldn't be written on something within the expression statement)? It is still good old `suppress

[PATCH] D93630: [Attr] Apply GNU-style attributes to expression statements

2020-12-22 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. In D93630#2468168 , @vsavchenko wrote: > @aaron.ballman I totally agree, but I also would like to understand. > `__attribute__` is a GNU extension, right? Correct. > Then why does it affect the grammar of C? I always thou

[PATCH] D93630: [Attr] Apply GNU-style attributes to expression statements

2020-12-22 Thread Valeriy Savchenko via Phabricator via cfe-commits
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 situatio

[PATCH] D93630: [Attr] Apply GNU-style attributes to expression statements

2020-12-22 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman requested changes to this revision. aaron.ballman added a comment. This revision now requires changes to proceed. Thank you for working on this, it's a problem that's annoyed me for a while but I've never found a satisfactory solution to. Unfortunately, it causes us to reject valid

[PATCH] D93630: [Attr] Apply GNU-style attributes to expression statements

2020-12-22 Thread Valeriy Savchenko via Phabricator via cfe-commits
vsavchenko updated this revision to Diff 313316. vsavchenko added a comment. Herald added a subscriber: arphaman. Fix block.c test Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D93630/new/ https://reviews.llvm.org/D93630 Files: clang/lib/Parse/Pa

[PATCH] D93630: [Attr] Apply GNU-style attributes to expression statements

2020-12-21 Thread Valeriy Savchenko via Phabricator via cfe-commits
vsavchenko created this revision. Herald added a subscriber: jdoerfert. vsavchenko requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. Before this commit, expression statements could not be annotated with statement attributes. Whenever parser