On Mon, 14 Sep 2020, Marek Polacek via Gcc-patches wrote: > so I followed suit. In the C++ FE this was rather easy, because > finish_parenthesized_expr already set TREE_NO_WARNING. In the C FE > it was trickier; I've added a NOP_EXPR to discern between the non-() > and () versions.
This sort of thing is normally handled for C via original_code in c_expr. I suppose that doesn't work in this case because the code dealing with parenthesized expressions has a special case for sizeof: if (expr.original_code != C_MAYBE_CONST_EXPR && expr.original_code != SIZEOF_EXPR) expr.original_code = ERROR_MARK; Handling this in some way via c_expr seems better to me than generating NOP_EXPR. I suppose you could invent a PAREN_SIZEOF_EXPR used by (sizeof foo) and ((sizeof foo)) etc. as an original_code setting (and handled the same as SIZEOF_EXPR by whatever other warnings look for SIZEOF_EXPR there), or else add fields to c_expr to allow more such information to be tracked there. -- Joseph S. Myers jos...@codesourcery.com