diff options
-rw-r--r-- | gcc/java/ChangeLog | 21 | ||||
-rw-r--r-- | gcc/java/class.c | 6 | ||||
-rw-r--r-- | gcc/java/java-tree.h | 5 | ||||
-rw-r--r-- | gcc/java/jcf-dump.c | 9 | ||||
-rw-r--r-- | gcc/java/jcf-write.c | 6 | ||||
-rw-r--r-- | gcc/java/jcf.h | 3 | ||||
-rw-r--r-- | gcc/java/parse.h | 9 | ||||
-rw-r--r-- | gcc/java/parse.y | 8 |
8 files changed, 54 insertions, 13 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index e82fda9..922a67d 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,24 @@ +2002-02-17 Tom Tromey <tromey@redhat.com> + + * java-tree.h (TYPE_STRICTFP): New macro. + (struct lang_type) [strictfp]: New field. + (CLASS_STRICTFP): New macro. + (METHOD_STRICTFP): New macro. + (struct lang_decl) [strictfp]: New field. + * parse.y (method_header): Disallow strictfp constructor or + abstract method. + (STRICT_TK): Move before MODIFIER_TK. + * parse.h (CLASS_MODIFIERS): Added ACC_STRICT. + (METHOD_MODIFIERS): Likewise. + (INTERFACE_MODIFIERS): Likewise. + * jcf-write.c (get_access_flags): Likewise. + * class.c (set_class_decl_access_flags): Recognize ACC_STRICT. + (add_method_1): Likewise. + (get_access_flags_from_decl): Likewise. + * jcf-dump.c (print_access_flags): Print in standard order. Also, + recognize strictfp flag. + * jcf.h (ACC_STRICT): New define. + 2002-02-12 David Billinghurst <Davod.Billinghurst@riotinto.com> * class.c(build_utf8_ref): Move declaration of decl_size diff --git a/gcc/java/class.c b/gcc/java/class.c index 5a799fe..e9cc58c 100644 --- a/gcc/java/class.c +++ b/gcc/java/class.c @@ -425,6 +425,7 @@ set_class_decl_access_flags (access_flags, class_decl) if (access_flags & ACC_STATIC) CLASS_STATIC (class_decl) = 1; if (access_flags & ACC_PRIVATE) CLASS_PRIVATE (class_decl) = 1; if (access_flags & ACC_PROTECTED) CLASS_PROTECTED (class_decl) = 1; + if (access_flags & ACC_STRICT) CLASS_STRICTFP (class_decl) = 1; } /* Return length of inheritance chain of CLAS, where java.lang.Object is 0, @@ -719,6 +720,7 @@ add_method_1 (handle_class, access_flags, name, function_type) if (access_flags & ACC_SYNCHRONIZED) METHOD_SYNCHRONIZED (fndecl) = 1; if (access_flags & ACC_ABSTRACT) METHOD_ABSTRACT (fndecl) = 1; if (access_flags & ACC_TRANSIENT) METHOD_TRANSIENT (fndecl) = 1; + if (access_flags & ACC_STRICT) METHOD_STRICTFP (fndecl) = 1; return fndecl; } @@ -1223,6 +1225,8 @@ get_access_flags_from_decl (decl) access_flags |= ACC_PRIVATE; if (CLASS_PROTECTED (decl)) access_flags |= ACC_PROTECTED; + if (CLASS_STRICTFP (decl)) + access_flags |= ACC_STRICT; return access_flags; } if (TREE_CODE (decl) == FUNCTION_DECL) @@ -1245,6 +1249,8 @@ get_access_flags_from_decl (decl) access_flags |= ACC_ABSTRACT; if (METHOD_TRANSIENT (decl)) access_flags |= ACC_TRANSIENT; + if (METHOD_STRICTFP (decl)) + access_flags |= ACC_STRICT; return access_flags; } abort (); diff --git a/gcc/java/java-tree.h b/gcc/java/java-tree.h index 0c2e566..dc5fd35 100644 --- a/gcc/java/java-tree.h +++ b/gcc/java/java-tree.h @@ -942,6 +942,7 @@ struct lang_decl unsigned int init_final : 1; /* Nonzero all finals are initialized */ unsigned int fixed_ctor : 1; unsigned int init_calls_this : 1; + unsigned int strictfp : 1; }; /* init_test_table hash table entry structure. */ @@ -990,6 +991,7 @@ struct lang_decl_var #define TYPE_IMPORT_DEMAND_LIST(T) (TYPE_LANG_SPECIFIC(T)->import_demand_list) #define TYPE_PRIVATE_INNER_CLASS(T) (TYPE_LANG_SPECIFIC(T)->pic) #define TYPE_PROTECTED_INNER_CLASS(T) (TYPE_LANG_SPECIFIC(T)->poic) +#define TYPE_STRICTFP(T) (TYPE_LANG_SPECIFIC(T)->strictfp) struct lang_type { @@ -1009,6 +1011,7 @@ struct lang_type tree import_demand_list; /* Imported types, in the CU of this class */ unsigned pic:1; /* Private Inner Class. */ unsigned poic:1; /* Protected Inner Class. */ + unsigned strictfp:1; /* `strictfp' class. */ }; #ifdef JAVA_USE_HANDLES @@ -1249,6 +1252,7 @@ struct rtx_def * java_lang_expand_expr PARAMS ((tree, rtx, enum machine_mode, #define METHOD_NATIVE(DECL) (DECL_LANG_SPECIFIC(DECL)->native) #define METHOD_ABSTRACT(DECL) DECL_LANG_FLAG_5 (DECL) #define METHOD_TRANSIENT(DECL) DECL_LANG_FLAG_6 (DECL) +#define METHOD_STRICTFP(DECL) (DECL_LANG_SPECIFIC (DECL)->strictfp) #define JAVA_FILE_P(NODE) TREE_LANG_FLAG_2 (NODE) #define CLASS_FILE_P(NODE) TREE_LANG_FLAG_3 (NODE) @@ -1291,6 +1295,7 @@ struct rtx_def * java_lang_expand_expr PARAMS ((tree, rtx, enum machine_mode, #define CLASS_STATIC(DECL) DECL_LANG_FLAG_7 (DECL) #define CLASS_PRIVATE(DECL) (TYPE_PRIVATE_INNER_CLASS (TREE_TYPE (DECL))) #define CLASS_PROTECTED(DECL) (TYPE_PROTECTED_INNER_CLASS (TREE_TYPE (DECL))) +#define CLASS_STRICTFP(DECL) (TYPE_STRICTFP (TREE_TYPE (DECL))) /* @deprecated marker flag on methods, fields and classes */ diff --git a/gcc/java/jcf-dump.c b/gcc/java/jcf-dump.c index fefee03..756e43d 100644 --- a/gcc/java/jcf-dump.c +++ b/gcc/java/jcf-dump.c @@ -363,8 +363,12 @@ DEFUN (print_access_flags, (stream, flags, context), if (flags & ACC_PUBLIC) fprintf (stream, " public"); if (flags & ACC_PRIVATE) fprintf (stream, " private"); if (flags & ACC_PROTECTED) fprintf (stream, " protected"); + if (flags & ACC_ABSTRACT) fprintf (stream, " abstract"); if (flags & ACC_STATIC) fprintf (stream, " static"); if (flags & ACC_FINAL) fprintf (stream, " final"); + if (flags & ACC_TRANSIENT) fprintf (stream, " transient"); + if (flags & ACC_VOLATILE) fprintf (stream, " volatile"); + if (flags & ACC_NATIVE) fprintf (stream, " native"); if (flags & ACC_SYNCHRONIZED) { if (context == 'c') @@ -372,11 +376,8 @@ DEFUN (print_access_flags, (stream, flags, context), else fprintf (stream, " synchronized"); } - if (flags & ACC_VOLATILE) fprintf (stream, " volatile"); - if (flags & ACC_TRANSIENT) fprintf (stream, " transient"); - if (flags & ACC_NATIVE) fprintf (stream, " native"); if (flags & ACC_INTERFACE) fprintf (stream, " interface"); - if (flags & ACC_ABSTRACT) fprintf (stream, " abstract"); + if (flags & ACC_STRICT) fprintf (stream, " strictfp"); } diff --git a/gcc/java/jcf-write.c b/gcc/java/jcf-write.c index 334465e..bdaebba 100644 --- a/gcc/java/jcf-write.c +++ b/gcc/java/jcf-write.c @@ -1,5 +1,5 @@ /* Write out a Java(TM) class file. - Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of GNU CC. @@ -685,6 +685,8 @@ get_access_flags (decl) if (ANONYMOUS_CLASS_P (TREE_TYPE (decl)) || LOCAL_CLASS_P (TREE_TYPE (decl))) flags |= ACC_PRIVATE; + if (CLASS_STRICTFP (decl)) + flags |= ACC_STRICT; } else abort (); @@ -699,6 +701,8 @@ get_access_flags (decl) flags |= ACC_SYNCHRONIZED; if (METHOD_ABSTRACT (decl)) flags |= ACC_ABSTRACT; + if (METHOD_STRICTFP (decl)) + flags |= ACC_STRICT; } if (isfield) { diff --git a/gcc/java/jcf.h b/gcc/java/jcf.h index 434dce1..ef7669e 100644 --- a/gcc/java/jcf.h +++ b/gcc/java/jcf.h @@ -1,6 +1,6 @@ /* Utility macros to read Java(TM) .class files and byte codes. - Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -207,6 +207,7 @@ typedef struct JCF { #define ACC_NATIVE 0x0100 #define ACC_INTERFACE 0x0200 #define ACC_ABSTRACT 0x0400 +#define ACC_STRICT 0x0800 #define ACC_VISIBILITY (ACC_PUBLIC | ACC_PRIVATE | ACC_PROTECTED) diff --git a/gcc/java/parse.h b/gcc/java/parse.h index 1cc4b0b..1d8bb05 100644 --- a/gcc/java/parse.h +++ b/gcc/java/parse.h @@ -1,5 +1,5 @@ /* Language parser definitions for the GNU compiler for the Java(TM) language. - Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. Contributed by Alexandre Petit-Bianco (apbianco@cygnus.com) This file is part of GNU CC. @@ -73,12 +73,13 @@ extern tree stabilize_reference PARAMS ((tree)); #define YYNOT_TWICE if (ctxp->prevent_ese != lineno) /* Accepted modifiers */ -#define CLASS_MODIFIERS ACC_PUBLIC|ACC_ABSTRACT|ACC_FINAL +#define CLASS_MODIFIERS ACC_PUBLIC|ACC_ABSTRACT|ACC_FINAL|ACC_STRICT #define FIELD_MODIFIERS ACC_PUBLIC|ACC_PROTECTED|ACC_PRIVATE|ACC_FINAL| \ ACC_STATIC|ACC_TRANSIENT|ACC_VOLATILE #define METHOD_MODIFIERS ACC_PUBLIC|ACC_PROTECTED|ACC_PRIVATE|ACC_ABSTRACT| \ - ACC_STATIC|ACC_FINAL|ACC_SYNCHRONIZED|ACC_NATIVE -#define INTERFACE_MODIFIERS ACC_PUBLIC|ACC_ABSTRACT + ACC_STATIC|ACC_FINAL|ACC_SYNCHRONIZED|ACC_NATIVE| \ + ACC_STRICT +#define INTERFACE_MODIFIERS ACC_PUBLIC|ACC_ABSTRACT|ACC_STRICT #define INTERFACE_INNER_MODIFIERS ACC_PUBLIC|ACC_PROTECTED|ACC_ABSTRACT|ACC_STATIC #define INTERFACE_METHOD_MODIFIERS ACC_PUBLIC|ACC_ABSTRACT #define INTERFACE_FIELD_MODIFIERS ACC_PUBLIC|ACC_STATIC|ACC_FINAL diff --git a/gcc/java/parse.y b/gcc/java/parse.y index 59559d3..b3e9189 100644 --- a/gcc/java/parse.y +++ b/gcc/java/parse.y @@ -482,8 +482,8 @@ static tree src_parse_roots[1]; %token PUBLIC_TK PRIVATE_TK PROTECTED_TK %token STATIC_TK FINAL_TK SYNCHRONIZED_TK %token VOLATILE_TK TRANSIENT_TK NATIVE_TK -%token PAD_TK ABSTRACT_TK MODIFIER_TK -%token STRICT_TK +%token PAD_TK ABSTRACT_TK STRICT_TK +%token MODIFIER_TK /* Keep those two in order, too */ %token DECR_TK INCR_TK @@ -4543,7 +4543,8 @@ method_header (flags, type, mdecl, throws) ABSTRACT_CHECK (flags, ACC_STATIC, id, "Static"); ABSTRACT_CHECK (flags, ACC_FINAL, id, "Final"); ABSTRACT_CHECK (flags, ACC_NATIVE, id, "Native"); - ABSTRACT_CHECK (flags, ACC_SYNCHRONIZED,id, "Synchronized"); + ABSTRACT_CHECK (flags, ACC_SYNCHRONIZED, id, "Synchronized"); + ABSTRACT_CHECK (flags, ACC_STRICT, id, "Strictfp"); if (!CLASS_ABSTRACT (TYPE_NAME (this_class)) && !CLASS_INTERFACE (TYPE_NAME (this_class))) parse_error_context @@ -4569,6 +4570,7 @@ method_header (flags, type, mdecl, throws) JCONSTRUCTOR_CHECK (flags, ACC_FINAL, id, "final"); JCONSTRUCTOR_CHECK (flags, ACC_NATIVE, id, "native"); JCONSTRUCTOR_CHECK (flags, ACC_SYNCHRONIZED, id, "synchronized"); + JCONSTRUCTOR_CHECK (flags, ACC_STRICT, id, "strictfp"); } /* If we found error here, we don't consider it's OK to tread the method definition as a constructor, for the rest of this |