public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <rguenther@suse.de>
To: gcc-patches@gcc.gnu.org
Cc: ebotcazou@adacore.com, laurent@guerby.net
Subject: [PATCH] Include gmp.h from system.h to fix PR54659
Date: Fri, 21 Dec 2012 11:50:00 -0000	[thread overview]
Message-ID: <alpine.LNX.2.00.1212211241460.6889@zhemvz.fhfr.qr> (raw)


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  <rguenther@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 ----

             reply	other threads:[~2012-12-21 11:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-21 11:50 Richard Biener [this message]
2012-12-21 12:18 ` Eric Botcazou
2012-12-21 12:23   ` Richard Biener
2012-12-21 12:33     ` Eric Botcazou
2012-12-21 13:03       ` Richard Biener

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LNX.2.00.1212211241460.6889@zhemvz.fhfr.qr \
    --to=rguenther@suse.de \
    --cc=ebotcazou@adacore.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=laurent@guerby.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).