From patchwork Tue Oct 18 16:49:11 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roland McGrath X-Patchwork-Id: 120463 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 4BF42B71BC for ; Wed, 19 Oct 2011 03:49:36 +1100 (EST) Received: (qmail 13776 invoked by alias); 18 Oct 2011 16:49:32 -0000 Received: (qmail 13767 invoked by uid 22791); 18 Oct 2011 16:49:31 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RP_MATCHES_RCVD, SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (74.125.121.67) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 18 Oct 2011 16:49:17 +0000 Received: from wpaz21.hot.corp.google.com (wpaz21.hot.corp.google.com [172.24.198.85]) by smtp-out.google.com with ESMTP id p9IGnFOJ021895 for ; Tue, 18 Oct 2011 09:49:15 -0700 Received: from pzk36 (pzk36.prod.google.com [10.243.19.164]) by wpaz21.hot.corp.google.com with ESMTP id p9IGfmYE016436 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Tue, 18 Oct 2011 09:49:14 -0700 Received: by pzk36 with SMTP id 36so2748990pzk.11 for ; Tue, 18 Oct 2011 09:49:13 -0700 (PDT) Received: by 10.68.59.10 with SMTP id v10mr6319013pbq.16.1318956553843; Tue, 18 Oct 2011 09:49:13 -0700 (PDT) Received: by 10.68.59.10 with SMTP id v10mr6318995pbq.16.1318956553709; Tue, 18 Oct 2011 09:49:13 -0700 (PDT) Received: from frobland.mtv.corp.google.com.google.com ([2620:0:1000:1b01:be30:5bff:fed3:d2a]) by mx.google.com with ESMTPS id ml4sm9009443pbc.0.2011.10.18.09.49.12 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 18 Oct 2011 09:49:12 -0700 (PDT) Date: Tue, 18 Oct 2011 09:49:11 -0700 Message-Id: From: Roland McGrath To: gcc-patches@gcc.gnu.org Subject: [PATCH] libiberty: fix psignal parameter type X-System-Of-Record: true Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org 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 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 * 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) {