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  <r...@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 via email to