From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20947 invoked by alias); 17 Feb 2010 11:25:27 -0000 Received: (qmail 20930 invoked by uid 22791); 17 Feb 2010 11:25:26 -0000 X-SWARE-Spam-Status: No, hits=-6.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,SPF_PASS,WEIRD_PORT X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 17 Feb 2010 11:25:22 +0000 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o1HBPKOG017630 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 17 Feb 2010 06:25:20 -0500 Received: from Gift.redhat.com (vpn2-10-201.ams2.redhat.com [10.36.10.201]) by int-mx04.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o1HBPIjJ018410 for ; Wed, 17 Feb 2010 06:25:19 -0500 From: Nick Clifton To: sid@sourceware.org Subject: RFA: Fix basename function detection in cgen-cpu configure script Date: Wed, 17 Feb 2010 11:25:00 -0000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Mailing-List: contact sid-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: sid-owner@sourceware.org X-SW-Source: 2010-q1/txt/msg00007.txt.bz2 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 * 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])