ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-dev: Re: [Wireshark-dev] #ifdef mess

From: Joerg Mayer <jmayer@xxxxxxxxx>
Date: Wed, 30 Mar 2016 00:48:38 +0200
On Tue, Mar 29, 2016 at 03:34:38PM +0100, João Valverde wrote:
> On 28-03-2016 23:30, Joerg Mayer wrote:
> >I've been meaning to write this mail for some years now but finally got around to it.
> >
> >Earlier today I committed 30900b443b85a7e760d703ca3d6efe61df4fe623, which I'm
> >incredibly unproud of because of readablity:
> >
> >  static void
> >-get_reordercap_runtime_info(GString *str _U_)
> >+get_reordercap_runtime_info(
> >+#if defined(HAVE_LIBZ) && !defined(_WIN32)
> >+    GString *str)
> >+#else
> >+   GString *str _U_)
> >+#endif
> >  {
> >
> >It fixes the error at hand, but that is about all the good I can say about it.
> 
> It's only an error because -Werror=used-but-marked-unused was
> enabled. Since the semantics of _U_ are *possibly* unused variable,
> neither the warning nor the #ifdef should exist IMO.

I don't follow your logic here. Couldn't we by the same logic just remove the _U_
and then blame the resulting warning turning erro on the unused warning? The idea
or turning on many warnings is to find coding/logic bugs. Blaming the problem on
turning on the warning is like shooting the messenger, i.e. plain wrong.

IMO the root cause isn't this or that warning - it's that we have many #ifdef paths
in our normal code. I won't have the time to really look into this until the end
of April, but it looks like either nobody cares about this or I didn't manage to
get the idea what really bugs me across, so I probably have to demonstrate the
idea with a specific patch.

Thanks!
  Jörg
-- 
Joerg Mayer                                           <jmayer@xxxxxxxxx>
We are stuck with technology when what we really want is just stuff that
works. Some say that should read Microsoft instead of technology.