From patchwork Tue Dec 11 21:40:12 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Glisse X-Patchwork-Id: 205305 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 1ED692C0084 for ; Wed, 12 Dec 2012 08:40:24 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1355866825; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Date:From:To:Subject:Message-ID:User-Agent:MIME-Version: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=rSO2jVa 3y3vGM54FtG3hrYGPOQA=; b=UY9f75DNIhcybV/HtUge2hwN1Y9WN6X/GMTPCCy Fe37uYS78Gd7shYdroW8DEsIRij+/fAl4htAQNnc0UOOrfjBdWsfmiKHUPwC1eBK f5csMz9KZtsm1SNMFVZfSY/m72bNBu61QWw1vrJa6wmJlr0wS5KA+mpijyvUBp+V zwP4= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Date:From:To:Subject:Message-ID:User-Agent:MIME-Version:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=FCHW2cd1tjdHZAjKacX3uo5MkFK1Sd2T2RidyrLzV5myQtXUDKOGvOFAqSooo2 1a6bSdZvhiwXuUf1ER2jT+pwTUdCDLM9vkMF1eUH6TT/ciMXH5rYKoIj0muvWKfc ZH/Ro7dR+Pr6PTb+gvMW1z+guUGk5NDXwg432JtxahKqw=; Received: (qmail 11834 invoked by alias); 11 Dec 2012 21:40:21 -0000 Received: (qmail 11823 invoked by uid 22791); 11 Dec 2012 21:40:20 -0000 X-SWARE-Spam-Status: No, hits=-7.1 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail4-relais-sop.national.inria.fr (HELO mail4-relais-sop.national.inria.fr) (192.134.164.105) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 11 Dec 2012 21:40:14 +0000 Received: from stedding.saclay.inria.fr ([193.55.250.194]) by mail4-relais-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES128-SHA; 11 Dec 2012 22:40:12 +0100 Received: from glisse (helo=localhost) by stedding.saclay.inria.fr with local-esmtp (Exim 4.80) (envelope-from ) id 1TiXYi-0005WR-2w for gcc-patches@gcc.gnu.org; Tue, 11 Dec 2012 22:40:12 +0100 Date: Tue, 11 Dec 2012 22:40:12 +0100 (CET) From: Marc Glisse To: gcc-patches@gcc.gnu.org Subject: extern "C" fixes for sunCC Message-ID: User-Agent: Alpine 2.02 (DEB 1266 2009-07-14) MIME-Version: 1.0 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 Hello, this patch should help if we ever want to use sunCC to initiate a bootstrap, though I didn't test with sunCC. Note that using gmp_fprintf means we have to include stdio.h before gmp.h. I didn't investigate how, but this seems to already be the case :-) The reallocator cast is just a hack, but the point here is only to help sunCC, making gcc extern "C"-clean is a larger task... Passes bootstrap+testsuite on x86_64-linux using the system's gcc (graphite is enabled, don't know if this particular code is exercised). 2012-12-12 Marc Glisse PR bootstrap/50167 PR bootstrap/50177 libcpp/ * line-map.c (get_combined_adhoc_loc): Cast to extern "C" type. gcc/ * graphite-interchange.c (pdr_stride_in_loop): Use gmp_fprintf. * graphite-poly.c (debug_gmp_value): Likewise. Index: gcc/graphite-poly.c =================================================================== --- gcc/graphite-poly.c (revision 194404) +++ gcc/graphite-poly.c (working copy) @@ -48,26 +48,21 @@ along with GCC; see the file COPYING3. #include "graphite-poly.h" #define OPENSCOP_MAX_STRING 256 /* Print to STDERR the GMP value VAL. */ DEBUG_FUNCTION void debug_gmp_value (mpz_t val) { - char *str = mpz_get_str (0, 10, val); - void (*gmp_free) (void *, size_t); - - fprintf (stderr, "%s", str); - mp_get_memory_functions (NULL, NULL, &gmp_free); - (*gmp_free) (str, strlen (str) + 1); + gmp_fprintf (stderr, "%Zd", val); } /* Return the maximal loop depth in SCOP. */ int scop_max_loop_depth (scop_p scop) { int i; poly_bb_p pbb; int max_nb_loops = 0; Index: gcc/graphite-interchange.c =================================================================== --- gcc/graphite-interchange.c (revision 194404) +++ gcc/graphite-interchange.c (working copy) @@ -233,29 +233,22 @@ pdr_stride_in_loop (mpz_t stride, graphi aff = isl_aff_set_coefficient_si (aff, isl_dim_in, offset + offset - 1, 1); isl_int_init (islstride); isl_set_max (set, aff, &islstride); isl_int_get_gmp (islstride, stride); isl_int_clear (islstride); isl_aff_free (aff); isl_set_free (set); if (dump_file && (dump_flags & TDF_DETAILS)) { - char *str; - void (*gmp_free) (void *, size_t); - - fprintf (dump_file, "\nStride in BB_%d, DR_%d, depth %d:", - pbb_index (pbb), PDR_ID (pdr), (int) depth); - str = mpz_get_str (0, 10, stride); - fprintf (dump_file, " %s ", str); - mp_get_memory_functions (NULL, NULL, &gmp_free); - (*gmp_free) (str, strlen (str) + 1); + gmp_fprintf (dump_file, "\nStride in BB_%d, DR_%d, depth %d: %Zd ", + pbb_index (pbb), PDR_ID (pdr), (int) depth, stride); } } /* Sets STRIDES to the sum of all the strides of the data references accessed in LOOP at DEPTH. */ static void memory_strides_in_loop_1 (lst_p loop, graphite_dim_t depth, mpz_t strides) { int i, j; Index: libcpp/line-map.c =================================================================== --- libcpp/line-map.c (revision 194404) +++ libcpp/line-map.c (working copy) @@ -116,21 +116,22 @@ get_combined_adhoc_loc (struct line_maps slot = (struct location_adhoc_data **) htab_find_slot (set->location_adhoc_data_map.htab, &lb, INSERT); if (*slot == NULL) { if (set->location_adhoc_data_map.curr_loc >= set->location_adhoc_data_map.allocated) { char *orig_data = (char *) set->location_adhoc_data_map.data; long long offset; line_map_realloc reallocator - = set->reallocator ? set->reallocator : xrealloc; + = set->reallocator ? set->reallocator + : (line_map_realloc) xrealloc; if (set->location_adhoc_data_map.allocated == 0) set->location_adhoc_data_map.allocated = 128; else set->location_adhoc_data_map.allocated *= 2; set->location_adhoc_data_map.data = (struct location_adhoc_data *) reallocator (set->location_adhoc_data_map.data, set->location_adhoc_data_map.allocated * sizeof (struct location_adhoc_data)); offset = (char *) (set->location_adhoc_data_map.data) - orig_data;