From: Nick Clifton <nickc@redhat.com>
To: sid@sourceware.org
Subject: RFA: Fix basename function detection in cgen-cpu configure script
Date: Wed, 17 Feb 2010 11:25:00 -0000 [thread overview]
Message-ID: <m3tytggl41.fsf@redhat.com> (raw)
Hi Guys,
The port of SID to the MIPS[1] target is failing to build in an
integrated source tree (one with include/libiberty.h) on a 32-bit
host, because of this compile time error:
/usr/include/string.h:602: error: new declaration 'const char* basename(const char*)'
.../include/libiberty.h:106: error: ambiguates old declaration 'char* basename(const char*)'
I traced this down to the fact that HAVE_DECL_BASENAME is defined to 0
in the config.h file in the sid/component/cgen-cpu build directory.
This macro should be defined to 1, but the test run by the configure
script is failing to compile because of this error:
conftest.cc:41: error: overloaded function with no contextual type information
This is line 41 of the conftest.cc file:
char *(*pfn) = (char *(*)) basename ;
The error is happening because G++ now complains about function
pointer casts without parameter type information. To fix the problem
it is necessary to add a parameter type like this:
char *(*pfn)(char *) = (char *(*)(char *)) basename ;
The patch below makes this change and allows SID to be built for the
mips64vrel-elf toolchain.
OK to apply ?
Cheers
Nick
[1] I have only tested a SID build for a mips64vrel-elf toolchain. I
suspect that the problem exists for other toolchains however.
sid/ChangeLog
2010-02-17 Nick Clifton <nickc@redhat.com>
* acinclude.m4 (gcc_AC_CHECK_DECL): Add parameter type to function
pointer cast, in order to allow compilation by newer versions of
g++.
* configure: Regenerate.
Index: component/cgen-cpu/acinclude.m4
===================================================================
RCS file: /cvs/src/src/sid/component/cgen-cpu/acinclude.m4,v
retrieving revision 1.2
diff -c -3 -p -r1.2 acinclude.m4
*** component/cgen-cpu/acinclude.m4 4 Jun 2005 03:23:02 -0000 1.2
--- component/cgen-cpu/acinclude.m4 17 Feb 2010 11:17:35 -0000
*************** AC_DEFUN([gcc_AC_CHECK_DECL],
*** 9,15 ****
AC_CACHE_VAL(gcc_cv_have_decl_$1,
[AC_TRY_COMPILE([$4],
[#ifndef $1
! char *(*pfn) = (char *(*)) $1 ;
#endif], eval "gcc_cv_have_decl_$1=yes", eval "gcc_cv_have_decl_$1=no")])
if eval "test \"`echo '$gcc_cv_have_decl_'$1`\" = yes"; then
AC_MSG_RESULT(yes) ; ifelse([$2], , :, [$2])
--- 9,15 ----
AC_CACHE_VAL(gcc_cv_have_decl_$1,
[AC_TRY_COMPILE([$4],
[#ifndef $1
! char *(*pfn)(char *) = (char *(*)(char *)) $1 ;
#endif], eval "gcc_cv_have_decl_$1=yes", eval "gcc_cv_have_decl_$1=no")])
if eval "test \"`echo '$gcc_cv_have_decl_'$1`\" = yes"; then
AC_MSG_RESULT(yes) ; ifelse([$2], , :, [$2])
reply other threads:[~2010-02-17 11:25 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m3tytggl41.fsf@redhat.com \
--to=nickc@redhat.com \
--cc=sid@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).