[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: attribute warn_unused_result
From: |
Paul Eggert |
Subject: |
Re: attribute warn_unused_result |
Date: |
Thu, 03 Feb 2011 11:33:03 -0800 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101208 Thunderbird/3.1.7 |
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.)
=== 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 <address@hidden>
+
+ 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 <address@hidden>
* configure.in: Test existence of xaw3d library, not just the
=== 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 = dtoastr getopt-gnu mktime strftime
+GNULIB_MODULES = dtoastr getopt-gnu ignore-value mktime strftime
GNULIB_TOOL_FLAGS = \
--import --no-changelog --no-vc-files --makefile-name=gnulib.mk
sync-from-gnulib: $(gnulib_srcdir)
=== 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 <address@hidden>
+
+ 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 <ignore-value.h>.
+ (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ärv <address@hidden>
* xterm.c (x_connection_closed): Remove all calls that calls
=== 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 <unistd.h>
+#include <ignore-value.h>
+
#include "lisp.h"
#include "sysselect.h"
#include "blockinput.h"
@@ -263,7 +265,7 @@
init_baud_rate (int fd)
{
int emacs_ospeed;
-
+
if (noninteractive)
emacs_ospeed = 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 @@
}
#endif /* !defined (WINDOWSNT) */
-
- attribute warn_unused_result, Eli Zaretskii, 2011/02/03
- Re: attribute warn_unused_result, Stefan Monnier, 2011/02/03
- Re: attribute warn_unused_result,
Paul Eggert <=
- Re: attribute warn_unused_result, Chad Brown, 2011/02/03
- Re: attribute warn_unused_result, Eli Zaretskii, 2011/02/03
- Re: attribute warn_unused_result, Paul Eggert, 2011/02/03
- Re: attribute warn_unused_result, Lennart Borgman, 2011/02/03
- Re: attribute warn_unused_result, Eli Zaretskii, 2011/02/04
- Re: attribute warn_unused_result, Chong Yidong, 2011/02/05
- Re: attribute warn_unused_result, Paul Eggert, 2011/02/03
- Re: attribute warn_unused_result, Eli Zaretskii, 2011/02/04
- Re: attribute warn_unused_result, Paul Eggert, 2011/02/04
- Re: attribute warn_unused_result, Stefan Monnier, 2011/02/04