On Sun, Mar 01, 2009 at 04:04:07PM +0200, Kalle Olavi Niemitalo wrote:
> Falk Hueffner <f...@debian.org> writes:
> 
> > I can't imagine any sensible code whatsoever that triggers this
> > warning but does not have logical errors. Can you show how it is used?
> 
> Here are all the source lines from net-snmp 5.2.3-7etch4 that
> trigger this warning.
> 
> snmplib/data_list.c:108
>         netsnmp_assert("list key" == "is unique"); /* always fail */

Okay, I guess that doesn't fall under "sensible code"... ;-)

> include/net-snmp/library/snmp_assert.h #defines netsnmp_assert(x)
> either as assert(x) or as something that logs the expression if
> the assertion fails.  So, I guess the string literals are a way
> to include a description of a bug in the log when the bug has
> been detected by the surrounding "if" statement, rather than by
> the assertion itself.

The kinda obvious reasonable solution for this would be to have a
netsnmp_abort(msg) macro.

> In net-snmp 5.4.1~dfsg-6, these assertions have apparently been
> rewritten as netsnmp_assert(!"cache == valid") and similar.
> (There are also netsnmp_assert("bad mode in RO handler") and a
> few others without the ! operator.)

Which nicely illustrates that this still is not sensible, because
almost certainly this is a bug.

> But anyway, gcc is wrong to claim the result of the == comparisons
> is unspecified.

Yes.

  Falk



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to