When libiberty defines psignal, it doesn't use the canonical signature.
This came up as a problem in a configuration where libiberty wants to
define psignal itself, but the build environment's <signal.h> declares
it too.  

This was a --with-newlib configuration using the newlib trunk, where newlib
does define psignal (and strsignal, among other things), but libiberty's
configure thinks it knows exactly what newlib does and doesn't define
without checking.  This hard-coding seems unwise to me, exactly because of
the potential for cases like this, where newlib's set of available
functions changes over time.

I think the fragility of that hard-coding ought to be addressed somehow.
But regardless, this change alleviates the immediate problem, and is
otherwise harmless.


Thanks,
Roland


libiberty/
2011-10-18  Roland McGrath  <mcgra...@google.com>

        * strsignal.c (psignal): Use const second in parameter type.
        * functions.texi: Updated.

diff --git a/libiberty/functions.texi b/libiberty/functions.texi
index c9df186..2945c61 100644
--- a/libiberty/functions.texi
+++ b/libiberty/functions.texi
@@ -1097,7 +1097,7 @@ documented.
 @end deftypefn
 
 @c strsignal.c:541
-@deftypefn Supplemental void psignal (int @var{signo}, char *@var{message})
+@deftypefn Supplemental void psignal (int @var{signo}, const char 
*@var{message})
 
 Print @var{message} to the standard error, followed by a colon,
 followed by the description of the signal specified by @var{signo},
diff --git a/libiberty/strsignal.c b/libiberty/strsignal.c
index 666b1b4..3b56d16 100644
--- a/libiberty/strsignal.c
+++ b/libiberty/strsignal.c
@@ -538,7 +538,7 @@ strtosigno (const char *name)
 
 /*
 
-@deftypefn Supplemental void psignal (int @var{signo}, char *@var{message})
+@deftypefn Supplemental void psignal (int @var{signo}, const char 
*@var{message})
 
 Print @var{message} to the standard error, followed by a colon,
 followed by the description of the signal specified by @var{signo},
@@ -551,7 +551,7 @@ followed by a newline.
 #ifndef HAVE_PSIGNAL
 
 void
-psignal (int signo, char *message)
+psignal (int signo, const char *message)
 {
   if (signal_names == NULL)
     {

Reply via email to