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 <rguent...@suse.de> 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 <stdarg.h> *************** extern int vsnprintf(char *, size_t, con *** 638,643 **** --- 643,650 ---- #include <dlfcn.h> #endif + #include <gmp.h> + /* 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 <gmp.h> - #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 <gmp.h> #include <mpfr.h> #include <mpc.h> #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 <gmp.h> #include <mpfr.h> #include <mpc.h> #include "real.h" --- 22,27 ----