class.c (set_constant_value): When not emiting class files, then a String ConstantVal...
authorPer Bothner <per@bothner.com>
Fri, 31 Aug 2001 20:07:31 +0000 (13:07 -0700)
committerPer Bothner <bothner@gcc.gnu.org>
Fri, 31 Aug 2001 20:07:31 +0000 (13:07 -0700)
* class.c (set_constant_value):  When not emiting class files, then a
String ConstantValue is a utf8const_ptr_type.

From-SVN: r45333

gcc/java/ChangeLog
gcc/java/class.c

index b06dd57aa469b51c0e90440ff8691953e374bc76..2a89caeefdd09871ae655f494c0dd9b6dc3796a2 100644 (file)
@@ -1,3 +1,8 @@
+2001-08-31  Per Bothner  <per@bothner.com>
+
+       * class.c (set_constant_value):  When not emiting class files, then a
+       String ConstantValue is a utf8const_ptr_type.
+
 2001-08-30  Per Bothner  <per@bothner.com>
 
        * jcf-write.c (generate_classfile):  Check that field is primitive
index 9aa5366402891f8a684c74504298b1ed10b3f48e..6086fc0db76718a8194faf312d15bea5e6c4d937 100644 (file)
@@ -780,8 +780,10 @@ set_constant_value (field, constant)
       if (TREE_TYPE (constant) != TREE_TYPE (field)
          && ! (TREE_TYPE (constant) == int_type_node
                && INTEGRAL_TYPE_P (TREE_TYPE (field))
-               && TYPE_PRECISION (TREE_TYPE (field)) <= 32))
-       warning ("ConstantValue attribute of field '%s' has wrong type",
+               && TYPE_PRECISION (TREE_TYPE (field)) <= 32)
+         && ! (TREE_TYPE (constant) == utf8const_ptr_type
+               && TREE_TYPE (field) == string_ptr_type_node))
+       error ("ConstantValue attribute of field '%s' has wrong type",
               IDENTIFIER_POINTER (DECL_NAME (field)));
       if (FIELD_FINAL (field))
        DECL_FIELD_FINAL_IUD (field) = 1;