On Wed, May 21, 2025 at 11:44:42PM +0200, Alejandro Colomar wrote:
> Does this sound good?
>
> diff --git i/gcc/c/c-parser.cc w/gcc/c/c-parser.cc
> index faa03c4903a2..733cb312341e 100644
> --- i/gcc/c/c-parser.cc
> +++ w/gcc/c/c-parser.cc
> @@ -78,16 +78,6 @@ along with GCC; see the file COPYING3. If not see
> #include "c-family/c-ubsan.h"
> #include "gcc-urlifier.h"
> ^L
> -#define c_parser_sizeof_expression(parser)
> \
> -(
> \
> - c_parser_sizeof_or_countof_expression (parser, RID_SIZEOF)
> \
> -)
> -
> -#define c_parser_countof_expression(parser)
> \
> -(
> \
> - c_parser_sizeof_or_countof_expression (parser, RID_COUNTOF)
> \
> -)
> -^L
> /* We need to walk over decls with incomplete struct/union/enum types
> after parsing the whole translation unit.
> In finish_decl(), if the decl is static, has incomplete
> @@ -1747,6 +1737,8 @@ static struct c_expr c_parser_binary_expression
> (c_parser *, struct c_expr *,
> tree);
> static struct c_expr c_parser_cast_expression (c_parser *, struct
> c_expr *);
> static struct c_expr c_parser_unary_expression (c_parser *);
> +static inline struct c_expr c_parser_sizeof_expression (c_parser *);
> +static inline struct c_expr c_parser_countof_expression (c_parser *);
I don't see the point of the above (unless they are defined after first
use, but then it would be better to define them before the first use).
> static struct c_expr c_parser_sizeof_or_countof_expression (c_parser *,
> enum rid);
> static struct c_expr c_parser_alignof_expression (c_parser *);
> @@ -10627,6 +10619,22 @@ c_parser_unary_expression (c_parser *parser)
>
> /* Parse a sizeof expression. */
>
> +static inline struct c_expr
> +c_parser_sizeof_expression (c_parser *parser)
> +{
> + return c_parser_sizeof_or_countof_expression (parser, RID_SIZEOF);
> +}
> +
> +/* Parse a _Countof expression. */
> +
> +static inline struct c_expr
> +c_parser_countof_expression (c_parser *parser)
> +{
> + return c_parser_sizeof_or_countof_expression (parser, RID_COUNTOF);
> +}
> +
> +/* Parse a sizeof or _Countof expression. */
> +
This looks good to me (but Joseph or Marek should have the final say in C
FE).
Jakub