summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2005-02-01 06:58:27 +0000
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2005-02-01 06:58:27 +0000
commitb68a9fcfe44faba1dbce4943dfc57461dc39c86d (patch)
treee8f7f02f5415bb65aea3439c2bb6dfc0a6b67b42
parent382c7ba6cd64a3fe6c2a671319f04eb04f6a775d (diff)
downloadppe42-gcc-b68a9fcfe44faba1dbce4943dfc57461dc39c86d.tar.gz
ppe42-gcc-b68a9fcfe44faba1dbce4943dfc57461dc39c86d.zip
* 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__". git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@94527 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/parser.c3
-rw-r--r--gcc/java/ChangeLog5
-rw-r--r--gcc/java/gjavah.c18
4 files changed, 25 insertions, 7 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 2ed087fee35..e964d83063c 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+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>
* parser.c (cp_parser_template_id): Revert comment patch too.
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 13fdd4b1f33..7450f1838d4 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -2682,7 +2682,8 @@ cp_parser_primary_expression (cp_parser *parser,
constant expression if they are cast to an integral or
enumeration type. */
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 +
...)". Therefore, we have to check that the next token
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index 9126d9dd0b4..287a8ccb4f6 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,8 @@
+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>
PR java/9157
diff --git a/gcc/java/gjavah.c b/gcc/java/gjavah.c
index 1f25ce62610..9db37d38a9b 100644
--- a/gcc/java/gjavah.c
+++ b/gcc/java/gjavah.c
@@ -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);
fputs ("_", stream);
}
- else
- fputs ("static ", stream);
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,
jint num;
int most_negative = 0;
if (! flag_jni)
- fputs ("const jint ", stream);
+ fputs ("static const jint ", stream);
print_field_name (stream, jcf, name_index, 0);
fputs (flag_jni ? " " : " = ", stream);
num = JPOOL_INT (jcf, current_field_value);
@@ -805,7 +803,7 @@ print_field_info (FILE *stream, JCF* jcf, int name_index, int sig_index,
jlong num;
int most_negative = 0;
if (! flag_jni)
- fputs ("const jlong ", stream);
+ fputs ("static const jlong ", stream);
print_field_name (stream, jcf, name_index, 0);
fputs (flag_jni ? " " : " = ", stream);
num = JPOOL_LONG (jcf, current_field_value);
@@ -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);
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);
jni_print_float (stream, fnum);
}
@@ -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);
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);
jni_print_double (stream, dnum);
}
OpenPOWER on IntegriCloud