From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.devel Subject: Re: attribute warn_unused_result Date: Thu, 03 Feb 2011 11:33:03 -0800 Organization: UCLA Computer Science Department Message-ID: <4D4B02EF.1080708@cs.ucla.edu> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1296762490 23122 80.91.229.12 (3 Feb 2011 19:48:10 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 3 Feb 2011 19:48:10 +0000 (UTC) Cc: Eli Zaretskii , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Feb 03 20:48:05 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Pl59x-000502-5L for ged-emacs-devel@m.gmane.org; Thu, 03 Feb 2011 20:48:05 +0100 Original-Received: from localhost ([127.0.0.1]:56561 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pl59w-0007S7-G2 for ged-emacs-devel@m.gmane.org; Thu, 03 Feb 2011 14:48:04 -0500 Original-Received: from [140.186.70.92] (port=45119 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pl58F-0006BE-2q for emacs-devel@gnu.org; Thu, 03 Feb 2011 14:46:22 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pl4wH-0000I8-0W for emacs-devel@gnu.org; Thu, 03 Feb 2011 14:33:58 -0500 Original-Received: from smtp.cs.ucla.edu ([131.179.128.62]:39661) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pl4wE-0008Fb-TA; Thu, 03 Feb 2011 14:33:55 -0500 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id 5522939E80DC; Thu, 3 Feb 2011 11:33:06 -0800 (PST) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Original-Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KJsnY9+L0rXp; Thu, 3 Feb 2011 11:33:04 -0800 (PST) Original-Received: from [131.179.64.200] (Penguin.CS.UCLA.EDU [131.179.64.200]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id 784EB39E8083; Thu, 3 Feb 2011 11:33:04 -0800 (PST) User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101208 Thunderbird/3.1.7 In-Reply-To: X-Enigmail-Version: 1.1.2 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 131.179.128.62 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:135514 Archived-At: On 02/03/11 10:53, Stefan Monnier wrote: > So, for each such case, we should think about it and if we indeed want > to ignore the return value, we should put an explicit cast to that > effect (which should hopefully be understood by gcc to silence the > warning). Gnulib's ignore-value module is designed for that. I installed the following: it suppresses the first warning in Eli's list that really ought to be suppressed. We can suppress the others as they come up. (I'm omitting auto-regenerated changes in this email.) =3D=3D=3D modified file 'ChangeLog' --- ChangeLog 2011-01-31 23:54:50 +0000 +++ ChangeLog 2011-02-03 19:26:58 +0000 @@ -1,3 +1,9 @@ +2011-02-03 Paul Eggert + + allow C code to suppress warnings about ignored return values + * Makefile.in (GNULIB_MODULES): Add ignore-value. + * configure, lib/Makefile.in, lib/gnulib.mk, m4/gl-comp.m4: Regenerate. + 2011-01-31 Chong Yidong =20 * configure.in: Test existence of xaw3d library, not just the =3D=3D=3D modified file 'Makefile.in' --- Makefile.in 2011-01-30 23:34:18 +0000 +++ Makefile.in 2011-02-03 19:14:20 +0000 @@ -330,7 +330,7 @@ # Update modules from gnulib, for maintainers, who should have it in # $(gnulib_srcdir) (relative to $(srcdir) and should have build tools # as per $(gnulib_srcdir)/DEPENDENCIES. -GNULIB_MODULES =3D dtoastr getopt-gnu mktime strftime +GNULIB_MODULES =3D dtoastr getopt-gnu ignore-value mktime strftime GNULIB_TOOL_FLAGS =3D \ --import --no-changelog --no-vc-files --makefile-name=3Dgnulib.mk sync-from-gnulib: $(gnulib_srcdir) =3D=3D=3D modified file 'src/ChangeLog' --- src/ChangeLog 2011-02-03 13:46:03 +0000 +++ src/ChangeLog 2011-02-03 19:25:14 +0000 @@ -1,3 +1,16 @@ +2011-02-03 Paul Eggert + + allow C code to suppress warnings about ignored return values + + We need to go through the code and for each such warning, either + fix the code to pay attention to the returned value, or tell GCC + that we really do want to ignore the returned value. Here is one + example of how to do the latter. + * sysdep.c: Include . + (sys_subshell): Suppress an undesirable warning about not checking + the returned value of 'write', as there's nothing useful one can + do with that returned value. + 2011-02-03 Jan Dj=E4rv =20 * xterm.c (x_connection_closed): Remove all calls that calls =3D=3D=3D modified file 'src/sysdep.c' --- src/sysdep.c 2011-01-25 04:08:28 +0000 +++ src/sysdep.c 2011-02-03 19:16:45 +0000 @@ -31,6 +31,8 @@ #endif /* HAVE_LIMITS_H */ #include =20 +#include + #include "lisp.h" #include "sysselect.h" #include "blockinput.h" @@ -263,7 +265,7 @@ init_baud_rate (int fd) { int emacs_ospeed; -=20 + if (noninteractive) emacs_ospeed =3D 0; else @@ -578,7 +580,7 @@ write (1, "Can't execute subshell", 22); #else /* not WINDOWSNT */ execlp (sh, sh, (char *) 0); - write (1, "Can't execute subshell", 22); + ignore_value (write (1, "Can't execute subshell", 22)); _exit (1); #endif /* not WINDOWSNT */ #endif /* not MSDOS */ @@ -3058,4 +3060,3 @@ } =20 #endif /* !defined (WINDOWSNT) */ -