diff options
| author | Paul Eggert | 2011-02-03 11:29:35 -0800 |
|---|---|---|
| committer | Paul Eggert | 2011-02-03 11:29:35 -0800 |
| commit | 67342916c9fd6fffe142539a3aba4601d005e839 (patch) | |
| tree | a12c72452490d3f1763f4033bccdff3aa857f7e0 | |
| parent | 90b750f4e227844e0eb2368193f13631876d0664 (diff) | |
| download | emacs-67342916c9fd6fffe142539a3aba4601d005e839.tar.gz emacs-67342916c9fd6fffe142539a3aba4601d005e839.zip | |
allow C code to suppress warnings about ignored return values
| -rw-r--r-- | ChangeLog | 6 | ||||
| -rw-r--r-- | Makefile.in | 2 | ||||
| -rwxr-xr-x | configure | 91 | ||||
| -rw-r--r-- | lib/Makefile.in | 4 | ||||
| -rw-r--r-- | lib/gnulib.mk | 8 | ||||
| -rw-r--r-- | m4/gl-comp.m4 | 4 | ||||
| -rw-r--r-- | src/ChangeLog | 13 | ||||
| -rw-r--r-- | src/sysdep.c | 7 |
8 files changed, 84 insertions, 51 deletions
| @@ -1,3 +1,9 @@ | |||
| 1 | 2011-02-03 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | allow C code to suppress warnings about ignored return values | ||
| 4 | * Makefile.in (GNULIB_MODULES): Add ignore-value. | ||
| 5 | * configure, lib/Makefile.in, lib/gnulib.mk, m4/gl-comp.m4: Regenerate. | ||
| 6 | |||
| 1 | 2011-01-31 Chong Yidong <cyd@stupidchicken.com> | 7 | 2011-01-31 Chong Yidong <cyd@stupidchicken.com> |
| 2 | 8 | ||
| 3 | * configure.in: Test existence of xaw3d library, not just the | 9 | * configure.in: Test existence of xaw3d library, not just the |
diff --git a/Makefile.in b/Makefile.in index e3d2849940c..e8206a6f012 100644 --- a/Makefile.in +++ b/Makefile.in | |||
| @@ -330,7 +330,7 @@ DOS_gnulib_comp.m4 = gl-comp.m4 | |||
| 330 | # Update modules from gnulib, for maintainers, who should have it in | 330 | # Update modules from gnulib, for maintainers, who should have it in |
| 331 | # $(gnulib_srcdir) (relative to $(srcdir) and should have build tools | 331 | # $(gnulib_srcdir) (relative to $(srcdir) and should have build tools |
| 332 | # as per $(gnulib_srcdir)/DEPENDENCIES. | 332 | # as per $(gnulib_srcdir)/DEPENDENCIES. |
| 333 | GNULIB_MODULES = dtoastr getopt-gnu mktime strftime | 333 | GNULIB_MODULES = dtoastr getopt-gnu ignore-value mktime strftime |
| 334 | GNULIB_TOOL_FLAGS = \ | 334 | GNULIB_TOOL_FLAGS = \ |
| 335 | --import --no-changelog --no-vc-files --makefile-name=gnulib.mk | 335 | --import --no-changelog --no-vc-files --makefile-name=gnulib.mk |
| 336 | sync-from-gnulib: $(gnulib_srcdir) | 336 | sync-from-gnulib: $(gnulib_srcdir) |
| @@ -5826,6 +5826,7 @@ $as_echo "$ac_cv_safe_to_define___extensions__" >&6; } | |||
| 5826 | # Code from module getopt-gnu: | 5826 | # Code from module getopt-gnu: |
| 5827 | # Code from module getopt-posix: | 5827 | # Code from module getopt-posix: |
| 5828 | # Code from module gettext-h: | 5828 | # Code from module gettext-h: |
| 5829 | # Code from module ignore-value: | ||
| 5829 | # Code from module include_next: | 5830 | # Code from module include_next: |
| 5830 | # Code from module intprops: | 5831 | # Code from module intprops: |
| 5831 | # Code from module mktime: | 5832 | # Code from module mktime: |
| @@ -10597,7 +10598,7 @@ _ACEOF | |||
| 10597 | if ac_fn_c_try_link "$LINENO"; then : | 10598 | if ac_fn_c_try_link "$LINENO"; then : |
| 10598 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XawScrollbarSetThumb in -lXaw3d" >&5 | 10599 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XawScrollbarSetThumb in -lXaw3d" >&5 |
| 10599 | $as_echo_n "checking for XawScrollbarSetThumb in -lXaw3d... " >&6; } | 10600 | $as_echo_n "checking for XawScrollbarSetThumb in -lXaw3d... " >&6; } |
| 10600 | if test "${ac_cv_lib_Xaw3d_XawScrollbarSetThumb+set}" = set; then : | 10601 | if ${ac_cv_lib_Xaw3d_XawScrollbarSetThumb+:} false; then : |
| 10601 | $as_echo_n "(cached) " >&6 | 10602 | $as_echo_n "(cached) " >&6 |
| 10602 | else | 10603 | else |
| 10603 | ac_check_lib_save_LIBS=$LIBS | 10604 | ac_check_lib_save_LIBS=$LIBS |
| @@ -10631,7 +10632,7 @@ LIBS=$ac_check_lib_save_LIBS | |||
| 10631 | fi | 10632 | fi |
| 10632 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xaw3d_XawScrollbarSetThumb" >&5 | 10633 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xaw3d_XawScrollbarSetThumb" >&5 |
| 10633 | $as_echo "$ac_cv_lib_Xaw3d_XawScrollbarSetThumb" >&6; } | 10634 | $as_echo "$ac_cv_lib_Xaw3d_XawScrollbarSetThumb" >&6; } |
| 10634 | if test "x$ac_cv_lib_Xaw3d_XawScrollbarSetThumb" = x""yes; then : | 10635 | if test "x$ac_cv_lib_Xaw3d_XawScrollbarSetThumb" = xyes; then : |
| 10635 | emacs_cv_xaw3d=yes | 10636 | emacs_cv_xaw3d=yes |
| 10636 | else | 10637 | else |
| 10637 | emacs_cv_xaw3d=no | 10638 | emacs_cv_xaw3d=no |
| @@ -14330,6 +14331,48 @@ $as_echo "#define __GETOPT_PREFIX rpl_" >>confdefs.h | |||
| 14330 | fi | 14331 | fi |
| 14331 | 14332 | ||
| 14332 | 14333 | ||
| 14334 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 | ||
| 14335 | $as_echo_n "checking for inline... " >&6; } | ||
| 14336 | if ${ac_cv_c_inline+:} false; then : | ||
| 14337 | $as_echo_n "(cached) " >&6 | ||
| 14338 | else | ||
| 14339 | ac_cv_c_inline=no | ||
| 14340 | for ac_kw in inline __inline__ __inline; do | ||
| 14341 | cat confdefs.h - <<_ACEOF >conftest.$ac_ext | ||
| 14342 | /* end confdefs.h. */ | ||
| 14343 | #ifndef __cplusplus | ||
| 14344 | typedef int foo_t; | ||
| 14345 | static $ac_kw foo_t static_foo () {return 0; } | ||
| 14346 | $ac_kw foo_t foo () {return 0; } | ||
| 14347 | #endif | ||
| 14348 | |||
| 14349 | _ACEOF | ||
| 14350 | if ac_fn_c_try_compile "$LINENO"; then : | ||
| 14351 | ac_cv_c_inline=$ac_kw | ||
| 14352 | fi | ||
| 14353 | rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext | ||
| 14354 | test "$ac_cv_c_inline" != no && break | ||
| 14355 | done | ||
| 14356 | |||
| 14357 | fi | ||
| 14358 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 | ||
| 14359 | $as_echo "$ac_cv_c_inline" >&6; } | ||
| 14360 | |||
| 14361 | case $ac_cv_c_inline in | ||
| 14362 | inline | yes) ;; | ||
| 14363 | *) | ||
| 14364 | case $ac_cv_c_inline in | ||
| 14365 | no) ac_val=;; | ||
| 14366 | *) ac_val=$ac_cv_c_inline;; | ||
| 14367 | esac | ||
| 14368 | cat >>confdefs.h <<_ACEOF | ||
| 14369 | #ifndef __cplusplus | ||
| 14370 | #define inline $ac_val | ||
| 14371 | #endif | ||
| 14372 | _ACEOF | ||
| 14373 | ;; | ||
| 14374 | esac | ||
| 14375 | |||
| 14333 | 14376 | ||
| 14334 | GNULIB_MKTIME=0; | 14377 | GNULIB_MKTIME=0; |
| 14335 | GNULIB_NANOSLEEP=0; | 14378 | GNULIB_NANOSLEEP=0; |
| @@ -14404,48 +14447,6 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext | |||
| 14404 | fi | 14447 | fi |
| 14405 | 14448 | ||
| 14406 | 14449 | ||
| 14407 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 | ||
| 14408 | $as_echo_n "checking for inline... " >&6; } | ||
| 14409 | if ${ac_cv_c_inline+:} false; then : | ||
| 14410 | $as_echo_n "(cached) " >&6 | ||
| 14411 | else | ||
| 14412 | ac_cv_c_inline=no | ||
| 14413 | for ac_kw in inline __inline__ __inline; do | ||
| 14414 | cat confdefs.h - <<_ACEOF >conftest.$ac_ext | ||
| 14415 | /* end confdefs.h. */ | ||
| 14416 | #ifndef __cplusplus | ||
| 14417 | typedef int foo_t; | ||
| 14418 | static $ac_kw foo_t static_foo () {return 0; } | ||
| 14419 | $ac_kw foo_t foo () {return 0; } | ||
| 14420 | #endif | ||
| 14421 | |||
| 14422 | _ACEOF | ||
| 14423 | if ac_fn_c_try_compile "$LINENO"; then : | ||
| 14424 | ac_cv_c_inline=$ac_kw | ||
| 14425 | fi | ||
| 14426 | rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext | ||
| 14427 | test "$ac_cv_c_inline" != no && break | ||
| 14428 | done | ||
| 14429 | |||
| 14430 | fi | ||
| 14431 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 | ||
| 14432 | $as_echo "$ac_cv_c_inline" >&6; } | ||
| 14433 | |||
| 14434 | case $ac_cv_c_inline in | ||
| 14435 | inline | yes) ;; | ||
| 14436 | *) | ||
| 14437 | case $ac_cv_c_inline in | ||
| 14438 | no) ac_val=;; | ||
| 14439 | *) ac_val=$ac_cv_c_inline;; | ||
| 14440 | esac | ||
| 14441 | cat >>confdefs.h <<_ACEOF | ||
| 14442 | #ifndef __cplusplus | ||
| 14443 | #define inline $ac_val | ||
| 14444 | #endif | ||
| 14445 | _ACEOF | ||
| 14446 | ;; | ||
| 14447 | esac | ||
| 14448 | |||
| 14449 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5 | 14450 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5 |
| 14450 | $as_echo_n "checking for stdbool.h that conforms to C99... " >&6; } | 14451 | $as_echo_n "checking for stdbool.h that conforms to C99... " >&6; } |
| 14451 | if ${ac_cv_header_stdbool_h+:} false; then : | 14452 | if ${ac_cv_header_stdbool_h+:} false; then : |
| @@ -14888,6 +14889,8 @@ fi | |||
| 14888 | # Code from module gettext-h: | 14889 | # Code from module gettext-h: |
| 14889 | 14890 | ||
| 14890 | 14891 | ||
| 14892 | # Code from module ignore-value: | ||
| 14893 | |||
| 14891 | # Code from module include_next: | 14894 | # Code from module include_next: |
| 14892 | # Code from module intprops: | 14895 | # Code from module intprops: |
| 14893 | # Code from module mktime: | 14896 | # Code from module mktime: |
diff --git a/lib/Makefile.in b/lib/Makefile.in index 7cd98417463..e50f9b31ef3 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in | |||
| @@ -24,7 +24,7 @@ | |||
| 24 | # the same distribution terms as the rest of that program. | 24 | # the same distribution terms as the rest of that program. |
| 25 | # | 25 | # |
| 26 | # Generated by gnulib-tool. | 26 | # Generated by gnulib-tool. |
| 27 | # 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 | 27 | # 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 |
| 28 | 28 | ||
| 29 | VPATH = @srcdir@ | 29 | VPATH = @srcdir@ |
| 30 | pkgdatadir = $(datadir)/@PACKAGE@ | 30 | pkgdatadir = $(datadir)/@PACKAGE@ |
| @@ -483,7 +483,7 @@ MOSTLYCLEANFILES = core *.stackdump arg-nonnull.h arg-nonnull.h-t \ | |||
| 483 | unistd.h-t warn-on-use.h warn-on-use.h-t | 483 | unistd.h-t warn-on-use.h warn-on-use.h-t |
| 484 | noinst_LIBRARIES = libgnu.a | 484 | noinst_LIBRARIES = libgnu.a |
| 485 | DEFAULT_INCLUDES = -I. -I../src -I$(top_srcdir)/src | 485 | DEFAULT_INCLUDES = -I. -I../src -I$(top_srcdir)/src |
| 486 | libgnu_a_SOURCES = dtoastr.c gettext.h | 486 | libgnu_a_SOURCES = dtoastr.c gettext.h ignore-value.h |
| 487 | libgnu_a_LIBADD = $(gl_LIBOBJS) | 487 | libgnu_a_LIBADD = $(gl_LIBOBJS) |
| 488 | libgnu_a_DEPENDENCIES = $(gl_LIBOBJS) | 488 | libgnu_a_DEPENDENCIES = $(gl_LIBOBJS) |
| 489 | EXTRA_libgnu_a_SOURCES = ftoastr.c getopt.c getopt1.c mktime.c \ | 489 | EXTRA_libgnu_a_SOURCES = ftoastr.c getopt.c getopt1.c mktime.c \ |
diff --git a/lib/gnulib.mk b/lib/gnulib.mk index ea6759e4532..af628c8d300 100644 --- a/lib/gnulib.mk +++ b/lib/gnulib.mk | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | # the same distribution terms as the rest of that program. | 9 | # the same distribution terms as the rest of that program. |
| 10 | # | 10 | # |
| 11 | # Generated by gnulib-tool. | 11 | # Generated by gnulib-tool. |
| 12 | # 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 | 12 | # 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 |
| 13 | 13 | ||
| 14 | 14 | ||
| 15 | MOSTLYCLEANFILES += core *.stackdump | 15 | MOSTLYCLEANFILES += core *.stackdump |
| @@ -111,6 +111,12 @@ libgnu_a_SOURCES += gettext.h | |||
| 111 | 111 | ||
| 112 | ## end gnulib module gettext-h | 112 | ## end gnulib module gettext-h |
| 113 | 113 | ||
| 114 | ## begin gnulib module ignore-value | ||
| 115 | |||
| 116 | libgnu_a_SOURCES += ignore-value.h | ||
| 117 | |||
| 118 | ## end gnulib module ignore-value | ||
| 119 | |||
| 114 | ## begin gnulib module intprops | 120 | ## begin gnulib module intprops |
| 115 | 121 | ||
| 116 | 122 | ||
diff --git a/m4/gl-comp.m4 b/m4/gl-comp.m4 index e5121918903..4bd213cdbd5 100644 --- a/m4/gl-comp.m4 +++ b/m4/gl-comp.m4 | |||
| @@ -34,6 +34,7 @@ AC_DEFUN([gl_EARLY], | |||
| 34 | # Code from module getopt-gnu: | 34 | # Code from module getopt-gnu: |
| 35 | # Code from module getopt-posix: | 35 | # Code from module getopt-posix: |
| 36 | # Code from module gettext-h: | 36 | # Code from module gettext-h: |
| 37 | # Code from module ignore-value: | ||
| 37 | # Code from module include_next: | 38 | # Code from module include_next: |
| 38 | # Code from module intprops: | 39 | # Code from module intprops: |
| 39 | # Code from module mktime: | 40 | # Code from module mktime: |
| @@ -76,6 +77,8 @@ AC_DEFUN([gl_INIT], | |||
| 76 | # Code from module gettext-h: | 77 | # Code from module gettext-h: |
| 77 | AC_SUBST([LIBINTL]) | 78 | AC_SUBST([LIBINTL]) |
| 78 | AC_SUBST([LTLIBINTL]) | 79 | AC_SUBST([LTLIBINTL]) |
| 80 | # Code from module ignore-value: | ||
| 81 | AC_REQUIRE([AC_C_INLINE]) | ||
| 79 | # Code from module include_next: | 82 | # Code from module include_next: |
| 80 | # Code from module intprops: | 83 | # Code from module intprops: |
| 81 | # Code from module mktime: | 84 | # Code from module mktime: |
| @@ -248,6 +251,7 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 248 | lib/getopt1.c | 251 | lib/getopt1.c |
| 249 | lib/getopt_int.h | 252 | lib/getopt_int.h |
| 250 | lib/gettext.h | 253 | lib/gettext.h |
| 254 | lib/ignore-value.h | ||
| 251 | lib/intprops.h | 255 | lib/intprops.h |
| 252 | lib/mktime-internal.h | 256 | lib/mktime-internal.h |
| 253 | lib/mktime.c | 257 | lib/mktime.c |
diff --git a/src/ChangeLog b/src/ChangeLog index aee41f57ac2..a65fc5730df 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,16 @@ | |||
| 1 | 2011-02-03 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | allow C code to suppress warnings about ignored return values | ||
| 4 | |||
| 5 | We need to go through the code and for each such warning, either | ||
| 6 | fix the code to pay attention to the returned value, or tell GCC | ||
| 7 | that we really do want to ignore the returned value. Here is one | ||
| 8 | example of how to do the latter. | ||
| 9 | * sysdep.c: Include <ignore-value.h>. | ||
| 10 | (sys_subshell): Suppress an undesirable warning about not checking | ||
| 11 | the returned value of 'write', as there's nothing useful one can | ||
| 12 | do with that returned value. | ||
| 13 | |||
| 1 | 2011-02-03 Jan Djärv <jan.h.d@swipnet.se> | 14 | 2011-02-03 Jan Djärv <jan.h.d@swipnet.se> |
| 2 | 15 | ||
| 3 | * xterm.c (x_connection_closed): Remove all calls that calls | 16 | * xterm.c (x_connection_closed): Remove all calls that calls |
diff --git a/src/sysdep.c b/src/sysdep.c index 5f82d2d534c..53b7f39171e 100644 --- a/src/sysdep.c +++ b/src/sysdep.c | |||
| @@ -31,6 +31,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 31 | #endif /* HAVE_LIMITS_H */ | 31 | #endif /* HAVE_LIMITS_H */ |
| 32 | #include <unistd.h> | 32 | #include <unistd.h> |
| 33 | 33 | ||
| 34 | #include <ignore-value.h> | ||
| 35 | |||
| 34 | #include "lisp.h" | 36 | #include "lisp.h" |
| 35 | #include "sysselect.h" | 37 | #include "sysselect.h" |
| 36 | #include "blockinput.h" | 38 | #include "blockinput.h" |
| @@ -263,7 +265,7 @@ void | |||
| 263 | init_baud_rate (int fd) | 265 | init_baud_rate (int fd) |
| 264 | { | 266 | { |
| 265 | int emacs_ospeed; | 267 | int emacs_ospeed; |
| 266 | 268 | ||
| 267 | if (noninteractive) | 269 | if (noninteractive) |
| 268 | emacs_ospeed = 0; | 270 | emacs_ospeed = 0; |
| 269 | else | 271 | else |
| @@ -578,7 +580,7 @@ sys_subshell (void) | |||
| 578 | write (1, "Can't execute subshell", 22); | 580 | write (1, "Can't execute subshell", 22); |
| 579 | #else /* not WINDOWSNT */ | 581 | #else /* not WINDOWSNT */ |
| 580 | execlp (sh, sh, (char *) 0); | 582 | execlp (sh, sh, (char *) 0); |
| 581 | write (1, "Can't execute subshell", 22); | 583 | ignore_value (write (1, "Can't execute subshell", 22)); |
| 582 | _exit (1); | 584 | _exit (1); |
| 583 | #endif /* not WINDOWSNT */ | 585 | #endif /* not WINDOWSNT */ |
| 584 | #endif /* not MSDOS */ | 586 | #endif /* not MSDOS */ |
| @@ -3058,4 +3060,3 @@ system_process_attributes (Lisp_Object pid) | |||
| 3058 | } | 3060 | } |
| 3059 | 3061 | ||
| 3060 | #endif /* !defined (WINDOWSNT) */ | 3062 | #endif /* !defined (WINDOWSNT) */ |
| 3061 | |||