Commit 8c94c75a by Mark Mitchell Committed by Mark Mitchell

parser.c (cp_parser_primary_expression): Don't complain about floating-point…

parser.c (cp_parser_primary_expression): Don't complain about floating-point literals in integral constant expressions...

	* parser.c (cp_parser_primary_expression): Don't complain about
	floating-point literals in integral constant expressions when
	!pedantic.

	* gjavah.c (print_field_info): Mark static data members of
	floating-point type with "__extension__".

From-SVN: r94527
parent ddf2a54a
2005-01-31 Mark Mitchell <mark@codesourcery.com>
* parser.c (cp_parser_primary_expression): Don't complain about
floating-point literals in integral constant expressions when
!pedantic.
2005-02-01 Alexandre Oliva <aoliva@redhat.com> 2005-02-01 Alexandre Oliva <aoliva@redhat.com>
* parser.c (cp_parser_template_id): Revert comment patch too. * parser.c (cp_parser_template_id): Revert comment patch too.
......
...@@ -2682,7 +2682,8 @@ cp_parser_primary_expression (cp_parser *parser, ...@@ -2682,7 +2682,8 @@ cp_parser_primary_expression (cp_parser *parser,
constant expression if they are cast to an integral or constant expression if they are cast to an integral or
enumeration type. */ enumeration type. */
if (TREE_CODE (token->value) == REAL_CST if (TREE_CODE (token->value) == REAL_CST
&& parser->integral_constant_expression_p) && parser->integral_constant_expression_p
&& pedantic)
{ {
/* CAST_P will be set even in invalid code like "int(2.7 + /* CAST_P will be set even in invalid code like "int(2.7 +
...)". Therefore, we have to check that the next token ...)". Therefore, we have to check that the next token
......
2005-01-31 Mark Mitchell <mark@codesourcery.com>
* gjavah.c (print_field_info): Mark static data members of
floating-point type with "__extension__".
2005-02-01 Ranjit Mathew <rmathew@hotmail.com> 2005-02-01 Ranjit Mathew <rmathew@hotmail.com>
PR java/9157 PR java/9157
......
...@@ -768,8 +768,6 @@ print_field_info (FILE *stream, JCF* jcf, int name_index, int sig_index, ...@@ -768,8 +768,6 @@ print_field_info (FILE *stream, JCF* jcf, int name_index, int sig_index,
print_cxx_classname (stream, "#define ", jcf, jcf->this_class, 1); print_cxx_classname (stream, "#define ", jcf, jcf->this_class, 1);
fputs ("_", stream); fputs ("_", stream);
} }
else
fputs ("static ", stream);
if ((flags & ACC_FINAL) && current_field_value > 0) if ((flags & ACC_FINAL) && current_field_value > 0)
{ {
...@@ -783,7 +781,7 @@ print_field_info (FILE *stream, JCF* jcf, int name_index, int sig_index, ...@@ -783,7 +781,7 @@ print_field_info (FILE *stream, JCF* jcf, int name_index, int sig_index,
jint num; jint num;
int most_negative = 0; int most_negative = 0;
if (! flag_jni) if (! flag_jni)
fputs ("const jint ", stream); fputs ("static const jint ", stream);
print_field_name (stream, jcf, name_index, 0); print_field_name (stream, jcf, name_index, 0);
fputs (flag_jni ? " " : " = ", stream); fputs (flag_jni ? " " : " = ", stream);
num = JPOOL_INT (jcf, current_field_value); num = JPOOL_INT (jcf, current_field_value);
...@@ -805,7 +803,7 @@ print_field_info (FILE *stream, JCF* jcf, int name_index, int sig_index, ...@@ -805,7 +803,7 @@ print_field_info (FILE *stream, JCF* jcf, int name_index, int sig_index,
jlong num; jlong num;
int most_negative = 0; int most_negative = 0;
if (! flag_jni) if (! flag_jni)
fputs ("const jlong ", stream); fputs ("static const jlong ", stream);
print_field_name (stream, jcf, name_index, 0); print_field_name (stream, jcf, name_index, 0);
fputs (flag_jni ? " " : " = ", stream); fputs (flag_jni ? " " : " = ", stream);
num = JPOOL_LONG (jcf, current_field_value); num = JPOOL_LONG (jcf, current_field_value);
...@@ -826,7 +824,11 @@ print_field_info (FILE *stream, JCF* jcf, int name_index, int sig_index, ...@@ -826,7 +824,11 @@ print_field_info (FILE *stream, JCF* jcf, int name_index, int sig_index,
{ {
jfloat fnum = JPOOL_FLOAT (jcf, current_field_value); jfloat fnum = JPOOL_FLOAT (jcf, current_field_value);
if (! flag_jni) if (! flag_jni)
fputs ("const jfloat ", stream); /* ISO C++ does not allow initialization of a static
data member of floating-point type. Thus, this
code is making use of an undocumented GNU C++
extension. */
fputs ("__extension__ static const jfloat ", stream);
print_field_name (stream, jcf, name_index, 0); print_field_name (stream, jcf, name_index, 0);
jni_print_float (stream, fnum); jni_print_float (stream, fnum);
} }
...@@ -835,7 +837,11 @@ print_field_info (FILE *stream, JCF* jcf, int name_index, int sig_index, ...@@ -835,7 +837,11 @@ print_field_info (FILE *stream, JCF* jcf, int name_index, int sig_index,
{ {
jdouble dnum = JPOOL_DOUBLE (jcf, current_field_value); jdouble dnum = JPOOL_DOUBLE (jcf, current_field_value);
if (! flag_jni) if (! flag_jni)
fputs ("const jdouble ", stream); /* ISO C++ does not allow initialization of a static
data member of floating-point type. Thus, this
code is making use of an undocumented GNU C++
extension. */
fputs ("__extension__ static const jdouble ", stream);
print_field_name (stream, jcf, name_index, 0); print_field_name (stream, jcf, name_index, 0);
jni_print_double (stream, dnum); jni_print_double (stream, dnum);
} }
......
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