aboutsummaryrefslogtreecommitdiff
path: root/gcc/java
diff options
context:
space:
mode:
authorRanjit Mathew <rmathew@hotmail.com>2005-02-01 18:38:12 +0000
committerRanjit Mathew <rmathew@gcc.gnu.org>2005-02-01 18:38:12 +0000
commitf619dcab0c25b63b139e174adc3152cb8af244c9 (patch)
treee38fe0622979bbd752ba983b3b6543b0eafdf504 /gcc/java
parentcc95a84509d3322010f4a1d3306fd8df7d14036a (diff)
downloadgcc-f619dcab0c25b63b139e174adc3152cb8af244c9.zip
gcc-f619dcab0c25b63b139e174adc3152cb8af244c9.tar.gz
gcc-f619dcab0c25b63b139e174adc3152cb8af244c9.tar.bz2
re PR java/19738 (gcjh generates invalid class member floating-point initialisers)
PR java/19738 * gjavah.c (jni_print_float): Do not emit floating-point initialiser for a static final field. (jni_print_double): Likewise. From-SVN: r94553
Diffstat (limited to 'gcc/java')
-rw-r--r--gcc/java/ChangeLog7
-rw-r--r--gcc/java/gjavah.c60
2 files changed, 40 insertions, 27 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index 50d79e5..64e12fe 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,10 @@
+2005-02-02 Ranjit Mathew <rmathew@hotmail.com>
+
+ PR java/19738
+ * gjavah.c (jni_print_float): Do not emit floating-point
+ initialiser for a static final field.
+ (jni_print_double): Likewise.
+
2005-02-01 Mark Mitchell <mark@codesourcery.com>
Revert:
diff --git a/gcc/java/gjavah.c b/gcc/java/gjavah.c
index 1f25ce6..e232a16 100644
--- a/gcc/java/gjavah.c
+++ b/gcc/java/gjavah.c
@@ -1,7 +1,7 @@
/* Program to write C++-suitable header files from a Java(TM) .class
file. This is similar to SUN's javah.
-Copyright (C) 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+Copyright (C) 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
This file is part of GCC.
@@ -281,19 +281,22 @@ jni_print_float (FILE *stream, jfloat f)
work in data initializers. FIXME. */
if (JFLOAT_FINITE (f))
{
- fputs (flag_jni ? " " : " = ", out);
- if (f.negative)
- putc ('-', stream);
- if (f.exponent)
- fprintf (stream, "0x1.%.6xp%+df",
- ((unsigned int)f.mantissa) << 1,
- f.exponent - JFLOAT_EXP_BIAS);
- else
- /* Exponent of 0x01 is -125; exponent of 0x00 is *also* -125,
- because the implicit leading 1 bit is no longer present. */
- fprintf (stream, "0x0.%.6xp%+df",
- ((unsigned int)f.mantissa) << 1,
- f.exponent + 1 - JFLOAT_EXP_BIAS);
+ if (flag_jni)
+ {
+ fputs (" ", out);
+ if (f.negative)
+ putc ('-', stream);
+ if (f.exponent)
+ fprintf (stream, "0x1.%.6xp%+df",
+ ((unsigned int)f.mantissa) << 1,
+ f.exponent - JFLOAT_EXP_BIAS);
+ else
+ /* Exponent of 0x01 is -125; exponent of 0x00 is *also* -125,
+ because the implicit leading 1 bit is no longer present. */
+ fprintf (stream, "0x0.%.6xp%+df",
+ ((unsigned int)f.mantissa) << 1,
+ f.exponent + 1 - JFLOAT_EXP_BIAS);
+ }
}
if (! flag_jni)
fputs (";\n", stream);
@@ -307,19 +310,22 @@ jni_print_double (FILE *stream, jdouble f)
work in data initializers. FIXME. */
if (JDOUBLE_FINITE (f))
{
- fputs (flag_jni ? " " : " = ", out);
- if (f.negative)
- putc ('-', stream);
- if (f.exponent)
- fprintf (stream, "0x1.%.5x%.8xp%+d",
- f.mantissa0, f.mantissa1,
- f.exponent - JDOUBLE_EXP_BIAS);
- else
- /* Exponent of 0x001 is -1022; exponent of 0x000 is *also* -1022,
- because the implicit leading 1 bit is no longer present. */
- fprintf (stream, "0x0.%.5x%.8xp%+d",
- f.mantissa0, f.mantissa1,
- f.exponent + 1 - JDOUBLE_EXP_BIAS);
+ if (flag_jni)
+ {
+ fputs (" ", out);
+ if (f.negative)
+ putc ('-', stream);
+ if (f.exponent)
+ fprintf (stream, "0x1.%.5x%.8xp%+d",
+ f.mantissa0, f.mantissa1,
+ f.exponent - JDOUBLE_EXP_BIAS);
+ else
+ /* Exponent of 0x001 is -1022; exponent of 0x000 is *also* -1022,
+ because the implicit leading 1 bit is no longer present. */
+ fprintf (stream, "0x0.%.5x%.8xp%+d",
+ f.mantissa0, f.mantissa1,
+ f.exponent + 1 - JDOUBLE_EXP_BIAS);
+ }
}
fputs (flag_jni ? "\n" : ";\n", stream);
}