allow C code to suppress warnings about ignored return values
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 3 Feb 2011 19:29:35 +0000 (11:29 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 3 Feb 2011 19:29:35 +0000 (11:29 -0800)
ChangeLog
Makefile.in
configure
lib/Makefile.in
lib/gnulib.mk
m4/gl-comp.m4
src/ChangeLog
src/sysdep.c

index 178c8d8..7b693be 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2011-02-03  Paul Eggert  <eggert@cs.ucla.edu>
+
+       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  <cyd@stupidchicken.com>
 
        * configure.in: Test existence of xaw3d library, not just the
index e3d2849..e8206a6 100644 (file)
@@ -330,7 +330,7 @@ DOS_gnulib_comp.m4 = gl-comp.m4
 # 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)
index 624981c..a1ca4cf 100755 (executable)
--- a/configure
+++ b/configure
@@ -5826,6 +5826,7 @@ $as_echo "$ac_cv_safe_to_define___extensions__" >&6; }
   # Code from module getopt-gnu:
   # Code from module getopt-posix:
   # Code from module gettext-h:
+  # Code from module ignore-value:
   # Code from module include_next:
   # Code from module intprops:
   # Code from module mktime:
@@ -10597,7 +10598,7 @@ _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XawScrollbarSetThumb in -lXaw3d" >&5
 $as_echo_n "checking for XawScrollbarSetThumb in -lXaw3d... " >&6; }
-if test "${ac_cv_lib_Xaw3d_XawScrollbarSetThumb+set}" = set; then :
+if ${ac_cv_lib_Xaw3d_XawScrollbarSetThumb+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -10631,7 +10632,7 @@ LIBS=$ac_check_lib_save_LIBS
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xaw3d_XawScrollbarSetThumb" >&5
 $as_echo "$ac_cv_lib_Xaw3d_XawScrollbarSetThumb" >&6; }
-if test "x$ac_cv_lib_Xaw3d_XawScrollbarSetThumb" = x""yes; then :
+if test "x$ac_cv_lib_Xaw3d_XawScrollbarSetThumb" = xyes; then :
   emacs_cv_xaw3d=yes
 else
   emacs_cv_xaw3d=no
@@ -14330,6 +14331,48 @@ $as_echo "#define __GETOPT_PREFIX rpl_" >>confdefs.h
 fi
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5
+$as_echo_n "checking for inline... " >&6; }
+if ${ac_cv_c_inline+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_cv_c_inline=no
+for ac_kw in inline __inline__ __inline; do
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#ifndef __cplusplus
+typedef int foo_t;
+static $ac_kw foo_t static_foo () {return 0; }
+$ac_kw foo_t foo () {return 0; }
+#endif
+
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_c_inline=$ac_kw
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  test "$ac_cv_c_inline" != no && break
+done
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5
+$as_echo "$ac_cv_c_inline" >&6; }
+
+case $ac_cv_c_inline in
+  inline | yes) ;;
+  *)
+    case $ac_cv_c_inline in
+      no) ac_val=;;
+      *) ac_val=$ac_cv_c_inline;;
+    esac
+    cat >>confdefs.h <<_ACEOF
+#ifndef __cplusplus
+#define inline $ac_val
+#endif
+_ACEOF
+    ;;
+esac
+
 
   GNULIB_MKTIME=0;
   GNULIB_NANOSLEEP=0;
@@ -14404,48 +14447,6 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
   fi
 
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5
-$as_echo_n "checking for inline... " >&6; }
-if ${ac_cv_c_inline+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_c_inline=no
-for ac_kw in inline __inline__ __inline; do
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#ifndef __cplusplus
-typedef int foo_t;
-static $ac_kw foo_t static_foo () {return 0; }
-$ac_kw foo_t foo () {return 0; }
-#endif
-
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_c_inline=$ac_kw
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  test "$ac_cv_c_inline" != no && break
-done
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5
-$as_echo "$ac_cv_c_inline" >&6; }
-
-case $ac_cv_c_inline in
-  inline | yes) ;;
-  *)
-    case $ac_cv_c_inline in
-      no) ac_val=;;
-      *) ac_val=$ac_cv_c_inline;;
-    esac
-    cat >>confdefs.h <<_ACEOF
-#ifndef __cplusplus
-#define inline $ac_val
-#endif
-_ACEOF
-    ;;
-esac
-
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5
 $as_echo_n "checking for stdbool.h that conforms to C99... " >&6; }
 if ${ac_cv_header_stdbool_h+:} false; then :
@@ -14888,6 +14889,8 @@ fi
   # Code from module gettext-h:
 
 
+  # Code from module ignore-value:
+
   # Code from module include_next:
   # Code from module intprops:
   # Code from module mktime:
index 7cd9841..e50f9b3 100644 (file)
@@ -24,7 +24,7 @@
 # the same distribution terms as the rest of that program.
 #
 # Generated by gnulib-tool.
-# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --makefile-name=gnulib.mk --no-libtool --macro-prefix=gl --no-vc-files dtoastr getopt-gnu mktime strftime
+# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --makefile-name=gnulib.mk --no-libtool --macro-prefix=gl --no-vc-files dtoastr getopt-gnu ignore-value mktime strftime
 
 VPATH = @srcdir@
 pkgdatadir = $(datadir)/@PACKAGE@
@@ -483,7 +483,7 @@ MOSTLYCLEANFILES = core *.stackdump arg-nonnull.h arg-nonnull.h-t \
        unistd.h-t warn-on-use.h warn-on-use.h-t
 noinst_LIBRARIES = libgnu.a
 DEFAULT_INCLUDES = -I. -I../src -I$(top_srcdir)/src
-libgnu_a_SOURCES = dtoastr.c gettext.h
+libgnu_a_SOURCES = dtoastr.c gettext.h ignore-value.h
 libgnu_a_LIBADD = $(gl_LIBOBJS)
 libgnu_a_DEPENDENCIES = $(gl_LIBOBJS)
 EXTRA_libgnu_a_SOURCES = ftoastr.c getopt.c getopt1.c mktime.c \
index ea6759e..af628c8 100644 (file)
@@ -9,7 +9,7 @@
 # the same distribution terms as the rest of that program.
 #
 # Generated by gnulib-tool.
-# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --makefile-name=gnulib.mk --no-libtool --macro-prefix=gl --no-vc-files dtoastr getopt-gnu mktime strftime
+# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --makefile-name=gnulib.mk --no-libtool --macro-prefix=gl --no-vc-files dtoastr getopt-gnu ignore-value mktime strftime
 
 
 MOSTLYCLEANFILES += core *.stackdump
@@ -111,6 +111,12 @@ libgnu_a_SOURCES += gettext.h
 
 ## end   gnulib module gettext-h
 
+## begin gnulib module ignore-value
+
+libgnu_a_SOURCES += ignore-value.h
+
+## end   gnulib module ignore-value
+
 ## begin gnulib module intprops
 
 
index e512191..4bd213c 100644 (file)
@@ -34,6 +34,7 @@ AC_DEFUN([gl_EARLY],
   # Code from module getopt-gnu:
   # Code from module getopt-posix:
   # Code from module gettext-h:
+  # Code from module ignore-value:
   # Code from module include_next:
   # Code from module intprops:
   # Code from module mktime:
@@ -76,6 +77,8 @@ AC_DEFUN([gl_INIT],
   # Code from module gettext-h:
   AC_SUBST([LIBINTL])
   AC_SUBST([LTLIBINTL])
+  # Code from module ignore-value:
+  AC_REQUIRE([AC_C_INLINE])
   # Code from module include_next:
   # Code from module intprops:
   # Code from module mktime:
@@ -248,6 +251,7 @@ AC_DEFUN([gl_FILE_LIST], [
   lib/getopt1.c
   lib/getopt_int.h
   lib/gettext.h
+  lib/ignore-value.h
   lib/intprops.h
   lib/mktime-internal.h
   lib/mktime.c
index aee41f5..a65fc57 100644 (file)
@@ -1,3 +1,16 @@
+2011-02-03  Paul Eggert  <eggert@cs.ucla.edu>
+
+       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  <jan.h.d@swipnet.se>
 
        * xterm.c (x_connection_closed): Remove all calls that calls
index 5f82d2d..53b7f39 100644 (file)
@@ -31,6 +31,8 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #endif /* HAVE_LIMITS_H */
 #include <unistd.h>
 
+#include <ignore-value.h>
+
 #include "lisp.h"
 #include "sysselect.h"
 #include "blockinput.h"
@@ -263,7 +265,7 @@ void
 init_baud_rate (int fd)
 {
   int emacs_ospeed;
+
   if (noninteractive)
     emacs_ospeed = 0;
   else
@@ -578,7 +580,7 @@ sys_subshell (void)
        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 @@ system_process_attributes (Lisp_Object pid)
 }
 
 #endif /* !defined (WINDOWSNT) */
-