public inbox for java-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
To: gcc-patches@gcc.gnu.org
Cc: java-patches@gcc.gnu.org
Subject: [java, libjava] Allow C++ compilation with Solaris headers
Date: Tue, 09 Aug 2011 15:40:00 -0000	[thread overview]
Message-ID: <yddfwlbq6xa.fsf@manam.CeBiTec.Uni-Bielefeld.DE> (raw)

While testing the patches to finally fix

PR libstdc++-v3/1773	__cplusplus defined to 1, should be 199711L

I came across two build failures when testing on i386-pc-solaris2.11:

/vol/gcc/src/hg/trunk/solaris/gcc/java/jcf-dump.c: In function 'void print_constant(std::FILE*, JCF*, int, int)':
/vol/gcc/src/hg/trunk/solaris/gcc/java/jcf-dump.c:793:33: error: call of overloaded 'frexp(uint32&, int*)' is ambiguous
/vol/gcc/src/hg/trunk/solaris/gcc/java/jcf-dump.c:793:33: note: candidates are:
/var/gcc/gcc-4.7.0-20110805/11-gcc/./prev-gcc/include-fixed/iso/math_iso.h:216:21: note: long double std::frexp(long double, int*)
/var/gcc/gcc-4.7.0-20110805/11-gcc/./prev-gcc/include-fixed/iso/math_iso.h:186:15: note: float std::frexp(float, int*)
/var/gcc/gcc-4.7.0-20110805/11-gcc/./prev-gcc/include-fixed/iso/math_iso.h:86:15: note: double std::frexp(double, int*)
/vol/gcc/src/hg/trunk/solaris/gcc/java/jcf-dump.c:836:33: error: call of overloaded 'frexp(long long unsigned int&, int*)' is ambiguous
/vol/gcc/src/hg/trunk/solaris/gcc/java/jcf-dump.c:836:33: note: candidates are:
/var/gcc/gcc-4.7.0-20110805/11-gcc/./prev-gcc/include-fixed/iso/math_iso.h:216:21: note: long double std::frexp(long double, int*)
/var/gcc/gcc-4.7.0-20110805/11-gcc/./prev-gcc/include-fixed/iso/math_iso.h:186:15: note: float std::frexp(float, int*)
/var/gcc/gcc-4.7.0-20110805/11-gcc/./prev-gcc/include-fixed/iso/math_iso.h:86:15: note: double std::frexp(double, int*)

/vol/gcc/src/hg/trunk/solaris/libjava/exception.cc: In function 'void std::abort()':
/vol/gcc/src/hg/trunk/solaris/libjava/exception.cc:28:10: error: 'void std::abort()' was declared 'extern' and later 'static' [-fpermissive]
/var/gcc/gcc-4.7.0-20110805/11-gcc/./gcc/include-fixed/iso/stdlib_iso.h:132:13: error: previous declaration of 'void std::abort()' [-fpermissive]

The following patch fixes both and allows the bootstrap to complete
without regressions.

Ok for mainline?

	Rainer


2011-08-07  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	gcc/java:
	* jcf-dump.c (print_constant): Cast first frexp arg.

	libjava:
	* exception.cc (std::abort): Remove static.

diff --git a/gcc/java/jcf-dump.c b/gcc/java/jcf-dump.c
--- a/gcc/java/jcf-dump.c
+++ b/gcc/java/jcf-dump.c
@@ -790,7 +790,7 @@ print_constant (FILE *out, JCF *jcf, int
 	      /* Normal; add the implicit bit.  */
 	      mantissa |= ((uint32)1 << 23);
 	    
-	    f = frexp (mantissa, &dummy);
+	    f = frexp ((float) mantissa, &dummy);
 	    f = ldexp (f, exponent + 1);
 	    fprintf (out, "%.10g", f);
 	  }
@@ -833,7 +833,7 @@ print_constant (FILE *out, JCF *jcf, int
 	      /* Normal; add the implicit bit.  */
 	      mantissa |= ((uint64)1 << 52);
 
-	    d = frexp (mantissa, &dummy);
+	    d = frexp ((double) mantissa, &dummy);
 	    d = ldexp (d, exponent + 1);
 	    fprintf (out, "%.20g", d);
 	  }
diff --git a/libjava/exception.cc b/libjava/exception.cc
--- a/libjava/exception.cc
+++ b/libjava/exception.cc
@@ -1,6 +1,7 @@
 // Functions for Exception Support for Java.
 
-/* Copyright (C) 1998, 1999, 2001, 2002, 2006, 2010  Free Software Foundation
+/* Copyright (C) 1998, 1999, 2001, 2002, 2006, 2010, 2011
+   Free Software Foundation
 
    This file is part of libgcj.
 
@@ -24,7 +25,7 @@ details.  */
 // stdlib.h's abort().
 namespace std
 {
-  static __attribute__ ((__noreturn__)) void
+  __attribute__ ((__noreturn__)) void
   abort ()
   {
     ::abort ();

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

             reply	other threads:[~2011-08-09  9:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-09 15:40 Rainer Orth [this message]
2011-08-09 17:33 ` Tom Tromey

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=yddfwlbq6xa.fsf@manam.CeBiTec.Uni-Bielefeld.DE \
    --to=ro@cebitec.uni-bielefeld.de \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=java-patches@gcc.gnu.org \
    /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).