Subject: lib/35489: Build fails with -DNDEBUG
To: None <lib-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: Andreas Wiese <aw-netbsd@instandbesetzt.net>
List: netbsd-bugs
Date: 01/26/2007 19:15:05
>Number:         35489
>Category:       lib
>Synopsis:       netbsd-4 build fails with -DNDEBUG
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jan 26 19:15:05 +0000 2007
>Originator:     Andreas Wiese
>Release:        NetBSD 4.0_BETA2
>Organization:
	BSD-Crew Dresden
>Environment:
System: NetBSD schroeder.lan.instandbesetzt.net 4.99.8 NetBSD 4.99.8 (SCHRO=
EDER) #0: Thu Jan 11 21:37:15 CET 2007 root@schroeder.lan.instandbesetzt.ne=
t:/usr/obj/sys/arch/i386/compile/SCHROEDER i386
Architecture: i386
Machine: i386
>Description:
I just tried to build netbsd-4 with -DNDEBUG in $CFLAGS (would someone
please tell me if this isn't such a good idea at all?) and building
fails with the following:

#v+
    compile  libevent/event.o
cc1: warnings being treated as errors
/usr/netbsd4/src/lib/libevent/event.c: In function 'event_queue_insert':
/usr/netbsd4/src/lib/libevent/event.c:758: warning: unused variable
'tmp'

*** Failed target:  event.o
*** Failed command: /usr/netbsd4/tooldir/bin/i386--netbsdelf-gcc -pipe
-O2 -march=3Dk6-2 -DNDEBUG -Wall -Wstrict-prototypes -Wmissing-prototypes
-Wpointer-arith -Wno-sign-compare -Wno-traditional -Wreturn-type
-Wswitch -Wshadow -Werror -DHAVE_CONFIG_H -nostdinc -isystem
/usr/netbsd4/destdir/usr/include -c
/usr/netbsd4/src/lib/libevent/event.c -o event.o
*** Error code 1
[...]
#v-

That's following:

#v+
   757          case EVLIST_TIMEOUT: {
   758                  struct event *tmp =3D RB_INSERT(event_tree, &base->=
timetree, ev);
   759                  assert(tmp =3D=3D NULL);
   760                  break;
   761          }
#v-

(BTW: what do these braces do there?)

I think this affects -current too. =20

>How-To-Repeat:
echo "CFLAGS +=3D -DNDEBUG" >> /etc/mk.conf

>Fix:
--- event.c.old 2007-01-26 18:21:54.000000000 +0100
+++ event.c     2007-01-26 18:22:34.000000000 +0100
@@ -755,7 +755,10 @@
                TAILQ_INSERT_TAIL(&signalqueue, ev, ev_signal_next);
                break;
        case EVLIST_TIMEOUT: {
-               struct event *tmp =3D RB_INSERT(event_tree,
                &base->timetree, ev);
+#ifndef NDEBUG
+               struct event *tmp =3D
+#endif
+               RB_INSERT(event_tree, &base->timetree, ev);
                assert(tmp =3D=3D NULL);
                break;
        }

HAND & LG -- aw
np: Tagtraum (Seelenpuzzle) -- 03. Regenschirm
--=20
Hey da draussen, kann mich irgendjemand h=F6ren? / Die Idee, da=DF alles me=
hr ist,
k=F6nnt Ihr nicht zerst=F6ren / Ich werd' mich weiter gegen Euch und Euer L=
eben
wehren / Solang ich jung bin werd' ich mit dem Regeln brechen nicht aufh=F6=
ren
  -- Tagtraum / =BBRegenschirm=AB

--W/nzBZO5zC0uMSeA
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (NetBSD)

iQIVAwUBRbo6VSCslUm6YF9JAQJ6Tg/+OXqxi6ToHrKdUeYfLMQKKNDCds177pfU
DYSuY70izF+4lNu4Ph3M7oMNfDjnTjn6INBb6LJhTU1OaehyvjSeRySp4L/oWxyM
66Nj6JJe0U5mXt1QgpjWBxNQabdJn/sQUelKAndcSy6apHqtYGOLsUl2g2OoL5zc
anR3A+tRa1YvuUkT0EUCjAwtsiepEotg4UtFGX+c0Cd4CSLYTlwwE0RTDYz/E5mA
TZMI6K77rU1l2Xj3fJWtXuUPakytvtew0WiJeQn1pjg8mVAn9z73rl7OdZPZfCxw
EzpcME/B+ApOl8CR9dqf6W2w+IULGN0trS1kDGLXSIrXoWB5eqWk9q4SMdk+7Ynj
RWsia8TAaevIe3+xsk/WqgCLJFtIm4Cdnl+q+zbtmon0CqUHWLsjlXMbV69K8D0L
B555CpwJat2G20x8EXmkL9vwbNX91ZcN2P3EvYX8QqgUCxkm2OHDdjDM1I8yqIsO
bri2ex/2h4yxTzIqsJvvXxnCIjqSgZ+AtWWwBXHJemc64/q04GP038xVjxUiGbjX
hmjZ5VEwgzBQcWk52ff0O5uPwOZ2sp1KmpNoazWnzjUWFiYeXW8cfY6RousHYHxs
5alFi10lJqqO7B2knYT4k+BTCpKkYgSm20Pw52eUs9hDSpcJu5QFhvlqgDDeczql
0yR1eLv2rkA=
=7d95
-----END PGP SIGNATURE-----

--W/nzBZO5zC0uMSeA--

>Unformatted:
 --W/nzBZO5zC0uMSeA
 Content-Type: text/plain; charset=iso-8859-1
 Content-Disposition: inline
 Content-Transfer-Encoding: quoted-printable