[PATCH] D57086: Ignore trailing NullStmts in StmtExprs for GCC compatibility

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 17 17:22:53 PDT 2019


rsmith added a comment.

In D57086#1546386 <https://reviews.llvm.org/D57086#1546386>, @aaron.ballman wrote:

> In D57086#1535873 <https://reviews.llvm.org/D57086#1535873>, @domdom wrote:
>
> > Something I should ask, it seems like GCC only ignores the NullStmts at the end if it's in C mode. Should clang match this behaviour exactly?
>
>
> I can't think of a reason that this should only happen in C mode, can you @rsmith?


No, I can't think of such a reason either. When we've seen such weirdnesses before (eg, `break` or `continue` in a statement expression in a `for` loop increment expression) we generally try to pick a behavior that's consistent across languages, and warn on the cases where we give a different behavior from GCC as a result.


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

https://reviews.llvm.org/D57086





More information about the cfe-commits mailing list