emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: STatus of MPS branch


From: Gerd Möllmann
Subject: Re: STatus of MPS branch
Date: Mon, 22 Apr 2024 06:58:15 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Helmut Eller <eller.helmut@gmail.com> writes:

> On Sun, Apr 21 2024, Gerd Möllmann wrote:
>
> I did this; GCC stopped complaining but otherwise it made no observable
> difference.

Thanks. I've done that now on the branch, too + a compile-time assertion
for clang.

> Without some change GCC emits lots of warnings of this kind:
> igc.c: In function ‘to_words’:
> igc.c:246:49: warning: suggest braces around empty body in an ‘else’ 
> statement [-Wempty-body]
>   246 |   igc_assert (nbytes % sizeof (mps_word_t) == 0);
>       |                                                 ^
>
> So maybe the macro should end with "else {}".

That would also not work. Something like

  if (x)
    igc_assert (y);
  else

would then be a syntax error. It would expand to

  if (x)
    if (...)
      ...
    else
     {
     }
 ;
 else

and the last else hangs in the air.

This is a situation where the code is definitely correct, and I find GCC
a bit over-eager, or maybe it's the compiler switches Emacs uses.

You could put a

#pragma GCC diagnostic ignored "-Wempty-body"

Or put "do { ... } while (0)" around what's currently the macro body,
i.e.

#define igc_assert(e) do { \
... original macro body here.
} while (0)

I'll reply to the rest in a different mail..



reply via email to

[Prev in Thread] Current Thread [Next in Thread]