From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9691 invoked by alias); 21 Dec 2012 11:50:17 -0000 Received: (qmail 9683 invoked by uid 22791); 21 Dec 2012 11:50:16 -0000 X-SWARE-Spam-Status: No, hits=-5.4 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_HI,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from cantor2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 21 Dec 2012 11:50:11 +0000 Received: from relay1.suse.de (unknown [195.135.220.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 4D447A52B1; Fri, 21 Dec 2012 12:50:10 +0100 (CET) Date: Fri, 21 Dec 2012 11:50:00 -0000 From: Richard Biener To: gcc-patches@gcc.gnu.org Cc: ebotcazou@adacore.com, laurent@guerby.net Subject: [PATCH] Include gmp.h from system.h to fix PR54659 Message-ID: User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2012-12/txt/msg01308.txt.bz2 The following patch includes gmp.h from system.h (where it belongs, as a system header). This makes sure the libintl kludge we put in place with --disable-nls doesn't wreck the gmp header (well, hopefully, earlier fix to be reverted?). This runs into issues with Ada which basically does (ugh) #ifdef __cplusplus extern "C" { #endif #include "system.h" #endif __cplusplus } #endif which of course wrecks any system header doing __cplusplus conditional stuff (such as gmp.h including iosfwd). The patch un-kludges this by wrapping system.h inside extern "C++" when compiling with the C++ frontend. But - really - Ada people - can you fix that on your side please? (CCed people doing r176210) Go frontend is left untouched (it also includes gmp.h) Bootstrap and regtest running on x86_64-unknown-linux-gnu. Comments? Ok?(!?) Thanks, Richard. 2012-12-21 Richard Biener PR bootstrap/54659 * system.h: Wrap inside extern "C++" when __cplusplus. Include gmp.h. * tree-ssa-loop-niter.c: Do not include gmp.h here. * double-int.h: Likewise. * realmpfr.h: Likewise. fortran/ * gfortran.h: Do not include gmp.h here. Index: gcc/system.h =================================================================== *** gcc/system.h (revision 194659) --- gcc/system.h (working copy) *************** along with GCC; see the file COPYING3. *** 24,29 **** --- 24,34 ---- #ifndef GCC_SYSTEM_H #define GCC_SYSTEM_H + /* Undo extern "C" wrappings done by including files (Ada). */ + #ifdef __cplusplus + extern "C++" { + #endif + /* We must include stdarg.h before stdio.h. */ #include *************** extern int vsnprintf(char *, size_t, con *** 638,643 **** --- 643,650 ---- #include #endif + #include + /* Get libiberty declarations. */ #include "libiberty.h" *************** helper_const_non_const_cast (const char *** 1051,1054 **** --- 1058,1065 ---- #define DEBUG_VARIABLE #endif + #ifdef __cplusplus + } + #endif + #endif /* ! GCC_SYSTEM_H */ Index: gcc/tree-ssa-loop-niter.c =================================================================== *** gcc/tree-ssa-loop-niter.c (revision 194659) --- gcc/tree-ssa-loop-niter.c (working copy) *************** along with GCC; see the file COPYING3. *** 38,44 **** #include "flags.h" #include "diagnostic-core.h" #include "tree-inline.h" - #include "gmp.h" #define SWAP(X, Y) do { affine_iv *tmp = (X); (X) = (Y); (Y) = tmp; } while (0) --- 38,43 ---- Index: gcc/double-int.h =================================================================== *** gcc/double-int.h (revision 194659) --- gcc/double-int.h (working copy) *************** along with GCC; see the file COPYING3. *** 20,29 **** #ifndef DOUBLE_INT_H #define DOUBLE_INT_H - #ifndef GENERATOR_FILE - #include - #endif - /* A large integer is currently represented as a pair of HOST_WIDE_INTs. It therefore represents a number with precision of 2 * HOST_BITS_PER_WIDE_INT bits (it is however possible that the --- 20,25 ---- Index: gcc/fortran/gfortran.h =================================================================== *** gcc/fortran/gfortran.h (revision 194659) --- gcc/fortran/gfortran.h (working copy) *************** gfc_intrinsic_sym; *** 1699,1705 **** EXPR_COMPCALL Function (or subroutine) call of a procedure pointer component or type-bound procedure. */ - #include #include #include #define GFC_RND_MODE GMP_RNDN --- 1699,1704 ---- Index: gcc/realmpfr.h =================================================================== *** gcc/realmpfr.h (revision 194659) --- gcc/realmpfr.h (working copy) *************** *** 22,28 **** #ifndef GCC_REALGMP_H #define GCC_REALGMP_H - #include #include #include #include "real.h" --- 22,27 ----