Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Oct 2013 00:13:19 -0400 (EDT)
From:      Benjamin Kaduk <kaduk@MIT.EDU>
To:        sbruno@freebsd.org
Cc:        "freebsd-hackers@freebsd.org" <freebsd-hackers@freebsd.org>
Subject:   Re: gperf -- #define for if (0) ; else for
Message-ID:  <alpine.GSO.1.10.1310210011120.4934@multics.mit.edu>
In-Reply-To: <1382327705.2610.9.camel@localhost>
References:  <1382327705.2610.9.camel@localhost>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 20 Oct 2013, Sean Bruno wrote:

> I don't even know why this is a thing in our code base.  Its generating
> a lot of clang noise due to -Wdangling-else
>
> /usr/src/gnu/usr.bin/gperf/../../../contrib/gperf/src/search.cc:417:15:
> warning: add explicit braces to avoid dangling else [-Wdangling-else]
>              for (int i3 = imax; i3 >= 0; i3--)
>              ^
> /usr/src/gnu/usr.bin/gperf/../../../contrib/gperf/src/search.cc:39:22:
> note: expanded from macro 'for'
> #define for if (0) ; else for
>                     ^
>
> I see no reason to continue this and propose the removal of the line in
> contrib/gperf/src/search.cc
>
>     37
>     38 /* Assume ISO C++ 'for' scoping rule.  */
>     39 #define for if (0) ; else for

StackOverflow (!) [1] suggests that they're a workaround for a bug in old 
versions of Visual Studio.

Someone hand Sean the danish axe, please.

-Ben

[1]
  http://stackoverflow.com/questions/984878/what-is-the-possible-use-for-define-for-if-false-else-for



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?alpine.GSO.1.10.1310210011120.4934>