Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id D234D431FBC; Tue, 1 Dec 2009 07:58:12 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Cv+35ZUvBVks; Tue, 1 Dec 2009 07:58:11 -0800 (PST) Received: from yoom.home.cworth.org (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id D2091431FAE; Tue, 1 Dec 2009 07:58:11 -0800 (PST) Received: by yoom.home.cworth.org (Postfix, from userid 1000) id 0CDA9254419; Tue, 1 Dec 2009 07:57:54 -0800 (PST) From: Carl Worth To: Jed Brown , Karl Wiberg , Dirk-Jan Binnema In-Reply-To: <87ws1h48up.fsf@59A2.org> References: <87skc5yd6v.wl%djcb@djcbsoftware.nl> <1873022c0911230311o77e55fdqa5464a2dd16ec265@mail.gmail.com> <87ws1h48up.fsf@59A2.org> Date: Tue, 01 Dec 2009 07:57:30 -0800 Message-ID: <87ljhmadqt.fsf@yoom.home.cworth.org> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Cc: "notmuch@notmuchmail org" , djcb@djcbsoftware.nl Subject: Re: [notmuch] [PATCH 1/2] * avoid gcc 4.4.1 compiler warnings due to ignored write return values X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2009 15:58:13 -0000 --=-=-= Content-Transfer-Encoding: quoted-printable On Mon, 23 Nov 2009 15:24:46 +0100, Jed Brown wrote: > >From the gcc man page: >=20 > -Wunused-value > Warn whenever a statement computes a result that is explicitly > not used. To suppress this warning cast the unused expression > to void. This includes an expression-statement or the left- > hand side of a comma expression that contains no side effects. > For example, an expression such as x[i,j] will cause a > warning, while x[(void)i,j] will not. >=20 > This warning is enabled by -Wall. >=20 > But I'm confused here because I don't currently see any warnings with > gcc-4.4.2. Actually this must be a bug because I get no warnings for > the blatantly unused >=20 > malloc(5); I'm guessing that the -Wunused-value warning doesn't consider values computed by function calls. > with -Wall -Wextra -pedantic. Anyway, if your system headers specify > __attribute__((warn_unused_result)) for write, then you could be running > into this bug/feature >=20 > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D35579 Yes, this is the attribute that's triggering the warnings. I poked around in the glibc headers to see how to get this warning myself, and I finally found: make CFLAGS=3D"-O -D_FORTIFY_SOURCE" That makes the warning appear even with gcc 4.3.4, (and the definitions in the headers suggest it will work with any gcc >=3D 4.1). So I've pushed the patch now, (with an updated commit message to reflect the above analysis). =2DCarl --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iD8DBQFLFTzr6JDdNq8qSWgRAmTkAJ9qjycQrHDuRLq54x4bGTM8Z+H34gCdEZz8 sK/IlLyJPop5emQ8MFAYoe8= =2r4t -----END PGP SIGNATURE----- --=-=-=--