public inbox for sid@sourceware.org
 help / color / mirror / Atom feed
* RFA: Fix basename function detection in cgen-cpu configure script
@ 2010-02-17 11:25 Nick Clifton
  0 siblings, 0 replies; only message in thread
From: Nick Clifton @ 2010-02-17 11:25 UTC (permalink / raw)
  To: sid

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])

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-02-17 11:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-17 11:25 RFA: Fix basename function detection in cgen-cpu configure script Nick Clifton

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).