]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Mark AC_TYPE_SIGNAL as obsolete.
authorEric Blake <ebb9@byu.net>
Mon, 9 Jun 2008 12:25:35 +0000 (06:25 -0600)
committerEric Blake <ebb9@byu.net>
Mon, 9 Jun 2008 12:25:35 +0000 (06:25 -0600)
* lib/autoconf/types.m4 (AC_TYPE_SIGNAL): Switch to AU_DEFUN.
* doc/autoconf.texi (Function Portability): Update documentation.
(Particular Types): Move AC_TYPE_SIGNAL...
(Obsolete Macros): ...here, and mention why.

Signed-off-by: Eric Blake <ebb9@byu.net>
ChangeLog
doc/autoconf.texi
lib/autoconf/types.m4

index 85cc8cdf0068c5966ad517ae5b2ff290448f593b..8288f1223a0327a625250e4b3226a1fede055a58 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2008-06-09  Eric Blake  <ebb9@byu.net>
 
+       Mark AC_TYPE_SIGNAL as obsolete.
+       * lib/autoconf/types.m4 (AC_TYPE_SIGNAL): Switch to AU_DEFUN.
+       * doc/autoconf.texi (Function Portability): Update documentation.
+       (Particular Types): Move AC_TYPE_SIGNAL...
+       (Obsolete Macros): ...here, and mention why.
+
        Allow lib64 as a default X library location.
        * lib/autoconf/libs.m4 (_AC_PATH_X_XMKMF): Add lib64.
        * NEWS: Mention the change.
index cef2d3bd134023bf35a14617f41896a96b22b709..43a84bc4bf977c46c519fbe8bcb5f8b3bdf57a8d 100644 (file)
@@ -4352,6 +4352,7 @@ NextStep).
 @item @code{signal} handler
 @c @fuindex signal
 @prindex @code{signal}
+@prindex @code{sigaction}
 Normally @code{signal} takes a handler function with a return type of
 @code{void}, but some old systems required @code{int} instead.  Any
 actual @code{int} value returned is not used; this is only a
@@ -4359,8 +4360,12 @@ difference in the function prototype demanded.
 
 All systems we know of in current use return @code{void}.  The
 @code{int} was to support K&R C, where of course @code{void} is not
-available.  @code{AC_TYPE_SIGNAL} (@pxref{Particular Types}) can be
-used to establish the correct type in all cases.
+available.  The obsolete macro @code{AC_TYPE_SIGNAL}
+(@pxref{AC_TYPE_SIGNAL}) can be used to establish the correct type in
+all cases.
+
+In most cases, it is more robust to use @code{sigaction} when it is
+available, rather than @code{signal}.
 
 @item @code{snprintf}
 @c @fuindex snprintf
@@ -6222,28 +6227,6 @@ Define @code{pid_t} to a suitable type, if standard headers do not
 define it.
 @end defmac
 
-@anchor{AC_TYPE_SIGNAL}
-@defmac AC_TYPE_SIGNAL
-@acindex{TYPE_SIGNAL}
-@cvindex RETSIGTYPE
-@hdrindex{signal.h}
-If @file{signal.h} declares @code{signal} as returning a pointer to a
-function returning @code{void}, define @code{RETSIGTYPE} to be
-@code{void}; otherwise, define it to be @code{int}.
-
-Define signal handlers as returning type @code{RETSIGTYPE}:
-
-@example
-@group
-RETSIGTYPE
-hup_handler ()
-@{
-@dots{}
-@}
-@end group
-@end example
-@end defmac
-
 @anchor{AC_TYPE_SIZE_T}
 @defmac AC_TYPE_SIZE_T
 @acindex{TYPE_SIZE_T}
@@ -19220,7 +19203,8 @@ issue.
 
 @defmac AC_RETSIGTYPE
 @acindex{RETSIGTYPE}
-Replaced by @code{AC_TYPE_SIGNAL} (@pxref{AC_TYPE_SIGNAL}).
+Replaced by @code{AC_TYPE_SIGNAL} (@pxref{AC_TYPE_SIGNAL}), which itself
+is obsolete when assuming C89 or better.
 @end defmac
 
 @defmac AC_RSH
@@ -19480,6 +19464,31 @@ AC_RUN_IFELSE(
 @xref{Runtime}.
 @end defmac
 
+@anchor{AC_TYPE_SIGNAL}
+@defmac AC_TYPE_SIGNAL
+@acindex{TYPE_SIGNAL}
+@cvindex RETSIGTYPE
+@hdrindex{signal.h}
+If @file{signal.h} declares @code{signal} as returning a pointer to a
+function returning @code{void}, define @code{RETSIGTYPE} to be
+@code{void}; otherwise, define it to be @code{int}.  These days, it is
+portable to assume C89, and that signal handlers return @code{void},
+without needing to use this macro or @code{RETSIGTYPE}.
+
+When targetting older K&R C, it is possible to define signal handlers as
+returning type @code{RETSIGTYPE}, and omit a return statement:
+
+@example
+@group
+RETSIGTYPE
+hup_handler ()
+@{
+@dots{}
+@}
+@end group
+@end example
+@end defmac
+
 @defmac AC_UID_T
 @acindex{UID_T}
 Replaced by @code{AC_TYPE_UID_T} (@pxref{AC_TYPE_UID_T}).
index 866bdca50cf7d3d609385e1c244862e9eef04380..50a489c49351d07e9a42c682e22767d5d83c1fd0 100644 (file)
@@ -1,8 +1,8 @@
 # This file is part of Autoconf.                       -*- Autoconf -*-
 # Type related macros: existence, sizeof, and structure members.
 #
-# Copyright (C) 2000, 2001, 2002, 2004, 2005, 2006, 2007 Free Software
-# Foundation, Inc.
+# Copyright (C) 2000, 2001, 2002, 2004, 2005, 2006, 2007, 2008 Free
+# Software Foundation, Inc.
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -693,8 +693,10 @@ AC_DEFUN([_AC_TYPE_UNSIGNED_INT],
 # AC_TYPE_SIGNAL
 # --------------
 # Note that identifiers starting with SIG are reserved by ANSI C.
-AN_FUNCTION([signal],  [AC_TYPE_SIGNAL])
-AC_DEFUN([AC_TYPE_SIGNAL],
+# C89 requires signal handlers to return void; only K&R returned int;
+# modern code does not need to worry about using this macro (not to
+# mention that sigaction is better than signal).
+AU_DEFUN([AC_TYPE_SIGNAL],
 [AC_CACHE_CHECK([return type of signal handlers], ac_cv_type_signal,
 [AC_COMPILE_IFELSE(
 [AC_LANG_PROGRAM([#include <sys/types.h>
@@ -706,7 +708,8 @@ AC_DEFUN([AC_TYPE_SIGNAL],
 AC_DEFINE_UNQUOTED(RETSIGTYPE, $ac_cv_type_signal,
                   [Define as the return type of signal handlers
                    (`int' or `void').])
-])
+], [your code may safely assume C89 semantics that RETSIGTYPE is void.
+Remove this warning and the `AC_CACHE_CHECK' when you adjust the code.])
 
 
 ## ------------------------ ##