Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: Re: [Wireshark-dev] SET_ADDRESS, if-else

From: Evan Huus <eapache@xxxxxxxxx>
Date: Sat, 7 Sep 2013 08:53:15 -0400
On Sat, Sep 7, 2013 at 6:16 AM, Martin Kaiser <lists@xxxxxxxxx> wrote:
Hi,

I just found that

if (...)
   SET_ADDRESS(...);
else
   SET_ADDRESS(...);

does not compile as this would expand to

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

and the compiler complains about else without if.

Is there anything useful we could do about this other that putting
another pair of brackets around the first SET_ADDRESS?

The usual trick in this situation is to wrap the macro in a "do { MY CODE } while (0)" so that it behaves syntactically like a normal function call. I have done this in r51819, so it should work now.

Cheers,
Evan