NetBSD Problem Report #35489

From aw-netbsd@instandbesetzt.net  Fri Jan 26 19:14:24 2007
Return-Path: <aw-netbsd@instandbesetzt.net>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id 99D9F63B8AD
	for <gnats-bugs@gnats.NetBSD.org>; Fri, 26 Jan 2007 19:14:24 +0000 (UTC)
Message-Id: <20070126172854.GA25387@schroeder.lan.instandbesetzt.net>
Date: Fri, 26 Jan 2007 18:28:54 +0100
From: Andreas Wiese <aw-netbsd@instandbesetzt.net>
To: gnats-bugs@NetBSD.org
Subject: Build fails with -DNDEBUG
X-Send-Pr-Version: 3.95

>Number:         35489
>Category:       lib
>Synopsis:       netbsd-4 build fails with -DNDEBUG
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jan 26 19:15:05 +0000 2007
>Closed-Date:    Fri Jan 26 20:21:54 +0000 2007
>Last-Modified:  Fri Jan 26 21:55:01 +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--

>Release-Note:

>Audit-Trail:
From: Christian Biere <cbiere@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: PR/35489 CVS commit: src/lib/libevent
Date: Fri, 26 Jan 2007 19:34:30 +0000 (UTC)

 Module Name:	src
 Committed By:	cbiere
 Date:		Fri Jan 26 19:34:30 UTC 2007

 Modified Files:
 	src/lib/libevent: event.c

 Log Message:
 Avoid a warning about an unused variable if compiling with -DNDEBUG.
 Reported by Andreas Wiese in PR lib/35489.


 To generate a diff of this commit:
 cvs rdiff -r1.7 -r1.8 src/lib/libevent/event.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: Christian Biere <christianbiere@gmx.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: lib/35489: Build fails with -DNDEBUG
Date: Fri, 26 Jan 2007 21:00:53 +0100

 Andreas Wiese wrote:
 > #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-

 Thanks, I've committed a similar fix.

 > (BTW: what do these braces do there?)

 They introduce a new block scope allowing to declare variables. Otherwise,
 you'd have to put it after 'switch (x) {' where it's unnecessarily visible
 beyond the necessary scope.

 -- 
 Christian

State-Changed-From-To: open->closed
State-Changed-By: cbiere@netbsd.org
State-Changed-When: Fri, 26 Jan 2007 20:21:54 +0000
State-Changed-Why:
Fixed in CVS.


From: Andreas Wiese <aw-netbsd@instandbesetzt.net>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: lib/35489: Build fails with -DNDEBUG
Date: Fri, 26 Jan 2007 21:08:50 +0100

 --XsQoSWH+UP9D9v3l
 Content-Type: text/plain; charset=iso-8859-1
 Content-Disposition: inline
 Content-Transfer-Encoding: quoted-printable

 Christian Biere wrote:
 >  Andreas Wiese wrote:
 [snip...]
 >  > (BTW: what do these braces do there?)
 > =20
 >  They introduce a new block scope allowing to declare variables. Otherwis=
 e,
 >  you'd have to put it after 'switch (x) {' where it's unnecessarily visib=
 le
 >  beyond the necessary scope.
 > =20

 Oh, yeah, thanks.  Should've been clear.  I'm definitely doing too much
 Ruby ;)

 HAND & LG -- aw
 np: P!nk (Try This) -- 10. Humble Neighborhoods
 --=20
 Die Uhr schl=E4gt.  Alle.
   -- Stanislav J. Lec

 --XsQoSWH+UP9D9v3l
 Content-Type: application/pgp-signature
 Content-Disposition: inline

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

 iQIVAwUBRbpf0SCslUm6YF9JAQJc8xAAx4zVLgeZB2TsQIc841KGsAkRdpjwG0kv
 NAUtfOjv/waD7jKTDmCytFfhNKjCk9i+pxAENY97ZfX8x8Sj3MFIFII1L8oo8JgY
 NHoB64he2j2pD3Xk1qIDl21Ikr+ybUzwguV2/07z/WL5vmvKMM9ZXbdHDOeXPmFm
 NR7bRcRp7nfNFKCKNMihZ8pmm8V1kzggiAcPlRm6T9t4rPnkV6j0qPGSOJsWcdTP
 OP/Vx+Wa+J3bJpMZ+y3BBSHLSbBPnz4hsTu6zEL7XPISSZIGyS6LP5FLSRu5Pllw
 QyzfQMA+sBEkVdxD7FeAb8t0X4+JByftRCD78PIDDJUWUdazOWhjmpT/BxIBwOmB
 fX4Cd+USMG1q7yPlPHTEpXqE3mTk0VSt4scU59PAkCuFctQ2guDh0cItvYQIjtAJ
 J8i9ycxprweVpLdhpSUfYY6UgvNC17fOIr+kHCjjfUTW/wONae+Aq7NvNmDwjqd7
 Op90OdusVQ6Ok6tMqLZvjJ1J3pjRMhL0u4dLu2A22lPqm0nEvPptsELopCS7LxJu
 eEOjG1nuqd3yAzpJOh2MwYiLnsBWlBpykqACzMQmp+Ue+xB+P8JXRTVPD9o5GxuT
 QR45bAoYkNUNucl7alxxQFlb9qYzPGma741srKfO8CKEoc9K1TnfkfpgJXv2aY24
 RbqX2JtN2zg=
 =sJSm
 -----END PGP SIGNATURE-----

 --XsQoSWH+UP9D9v3l--

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

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.