Commit 06d84d69 by Tom Tromey Committed by Tom Tromey

gjavah.c (print_field_info): Changed how most negative number is printed.

	* gjavah.c (print_field_info): Changed how most negative number is
	printed.

From-SVN: r24323
parent 68b04813
1998-12-15 Tom Tromey <tromey@cygnus.com>
* gjavah.c (print_field_info): Changed how most negative number is
printed.
Mon Dec 14 18:49:29 1998 Per Bothner <bothner@cygnus.com> Mon Dec 14 18:49:29 1998 Per Bothner <bothner@cygnus.com>
* parse.y (fold_constant_for_init): New function. * parse.y (fold_constant_for_init): New function.
......
...@@ -307,39 +307,39 @@ DEFUN(print_field_info, (stream, jcf, name_index, sig_index, flags), ...@@ -307,39 +307,39 @@ DEFUN(print_field_info, (stream, jcf, name_index, sig_index, flags),
case CONSTANT_Integer: case CONSTANT_Integer:
{ {
jint num; jint num;
int most_negative = 0;
fputs (" static const jint ", out); fputs (" static const jint ", out);
print_name (out, jcf, name_index); print_name (out, jcf, name_index);
fputs (" = ", out); fputs (" = ", out);
num = JPOOL_INT (jcf, current_field_value); num = JPOOL_INT (jcf, current_field_value);
/* We single out the most negative number to print in /* We single out the most negative number to print
hex. That avoids later warnings from g++. */ specially. This avoids later warnings from g++. */
if (num == 0x80000000) if (num == 0x80000000)
{ {
strcpy (buffer, "0x"); most_negative = 1;
format_uint (buffer + 2, (jlong) (uint32) num, 16); ++num;
} }
else format_int (buffer, (jlong) num, 10);
format_int (buffer, (jlong) num, 10); fprintf (out, "%sL%s;\n", buffer, most_negative ? " - 1" : "");
fprintf (out, "%sL;\n", buffer);
} }
break; break;
case CONSTANT_Long: case CONSTANT_Long:
{ {
jlong num; jlong num;
int most_negative = 0;
fputs (" static const jlong ", out); fputs (" static const jlong ", out);
print_name (out, jcf, name_index); print_name (out, jcf, name_index);
fputs (" = ", out); fputs (" = ", out);
num = JPOOL_LONG (jcf, current_field_value); num = JPOOL_LONG (jcf, current_field_value);
/* We single out the most negative number to print in /* We single out the most negative number to print
hex. That avoids later warnings from g++. */ specially.. This avoids later warnings from g++. */
if (num == 0x8000000000000000LL) if (num == 0x8000000000000000LL)
{ {
strcpy (buffer, "0x"); most_negative = 1;
format_uint (buffer + 2, num, 16); ++num;
} }
else format_int (buffer, num, 10);
format_int (buffer, num, 10); fprintf (out, "%sLL%s;\n", buffer, most_negative ? " - 1" :"");
fprintf (out, "%sLL;\n", buffer);
} }
break; break;
case CONSTANT_Float: case CONSTANT_Float:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment