- int flag0 : 1; /* Some flags */
- tree decl; /* Tied decl/or WFL */
- tree solv; /* What to solve */
- tree wfl; /* Where thing to resolve where found */
- tree misc; /* Miscellaneous info (optional). */
- tree enclosing; /* The enclosing (current) class */
- tree *patch; /* Address of a location to patch */
- struct _jdep *next; /* Linked list */
-} jdep;
-
-
-#define JDEP_DECL(J) ((J)->decl)
-#define JDEP_DECL_WFL(J) ((J)->decl)
-#define JDEP_KIND(J) ((J)->kind)
-#define JDEP_SOLV(J) ((J)->solv)
-#define JDEP_WFL(J) ((J)->wfl)
-#define JDEP_MISC(J) ((J)->misc)
-#define JDEP_ENCLOSING(J) ((J)->enclosing)
-#define JDEP_CLASS(J) ((J)->class)
-#define JDEP_APPLY_PATCH(J,P) (*(J)->patch = (P))
-#define JDEP_GET_PATCH(J) ((J)->patch)
-#define JDEP_CHAIN(J) ((J)->next)
-#define JDEP_TO_RESOLVE(J) ((J)->solv)
-#define JDEP_RESOLVED_DECL(J) ((J)->solv)
-#define JDEP_RESOLVED(J, D) ((J)->solv = D)
-#define JDEP_RESOLVED_P(J) \
- (!(J)->solv || TREE_CODE ((J)->solv) != POINTER_TYPE)
-
-typedef struct _jdeplist {
- jdep *first;
- jdep *last;
- struct _jdeplist *next;
-} jdeplist;
-
-#endif /* JC1_LITE */
-
-#define CLASSD_FIRST(CD) ((CD)->first)
-#define CLASSD_LAST(CD) ((CD)->last)
-#define CLASSD_CHAIN(CD) ((CD)->next)
-
-#define JDEP_INSERT(L,J) \
- { \
- if (!(L)->first) \
- (L)->last = (L)->first = (J); \
- else \
- { \
- JDEP_CHAIN ((L)->last) = (J); \
- (L)->last = (J); \
- } \
- }
-
-/* if TYPE can't be resolved, obtain something suitable for its
- resolution (TYPE is saved in SAVE before being changed). and set
- CHAIN to 1. Otherwise, type is set to something usable. CHAIN is
- usually used to determine that a new DEP must be installed on TYPE.
- Note that when compiling java.lang.Object, references to Object are
- java.lang.Object. */
-#define SET_TYPE_FOR_RESOLUTION(TYPE, SAVE, CHAIN) \
- { \
- tree returned_type; \
- (CHAIN) = 0; \
- if (TREE_TYPE (ctxp->current_parsed_class) == object_type_node \
- && TREE_CODE (TYPE) == EXPR_WITH_FILE_LOCATION \
- && EXPR_WFL_NODE (TYPE) == unqualified_object_id_node) \
- (TYPE) = object_type_node; \
- else \
- { \
- if (unresolved_type_p (type, &returned_type)) \
- { \
- if (returned_type) \
- (TYPE) = returned_type; \
- else \
- { \
- (SAVE) = (TYPE); \
- (TYPE) = obtain_incomplete_type (TYPE); \
- CHAIN = 1; \
- } \
- } \
- } \
- }
-/* Promote a type if it won't be registered as a patch */
-#define PROMOTE_RECORD_IF_COMPLETE(TYPE, IS_INCOMPLETE) \
- { \
- if (!(IS_INCOMPLETE) && TREE_CODE (TYPE) == RECORD_TYPE) \
- (TYPE) = promote_type (TYPE); \
- }
-
-/* Insert a DECL in the current block */
-#define BLOCK_CHAIN_DECL(NODE) \
- { \
- TREE_CHAIN ((NODE)) = \
- BLOCK_EXPR_DECLS (GET_CURRENT_BLOCK (current_function_decl)); \
- BLOCK_EXPR_DECLS (GET_CURRENT_BLOCK (current_function_decl)) = (NODE); \
- }
-
-/* Return the current block, either found in the body of the currently
- declared function or in the current static block being defined. */
-#define GET_CURRENT_BLOCK(F) ((F) ? DECL_FUNCTION_BODY ((F)) : \
- current_static_block)
-
-/* For an artificial BLOCK (created to house a local variable declaration not
- at the start of an existing block), the parent block; otherwise NULL. */
-#define BLOCK_EXPR_ORIGIN(NODE) BLOCK_ABSTRACT_ORIGIN(NODE)
-
-/* Merge an other line to the source line number of a decl. Used to
- remember function's end. */
-#define DECL_SOURCE_LINE_MERGE(DECL,NO) DECL_SOURCE_LINE(DECL) |= (NO << 16)
-
-/* Retrieve those two info separately. */
-#define DECL_SOURCE_LINE_FIRST(DECL) (DECL_SOURCE_LINE(DECL) & 0x0000ffff)
-#define DECL_SOURCE_LINE_LAST(DECL) (DECL_SOURCE_LINE(DECL) >> 16)
-
-/* Retrieve line/column from a WFL. */
-#define EXPR_WFL_GET_LINECOL(V,LINE,COL) \
- { \
- (LINE) = (V) >> 12; \
- (COL) = (V) & 0xfff; \
- }
-/* Add X to the column number information */
-#define EXPR_WFL_ADD_COL(V, X) \
- (V) = (((V) & 0xfffff000) | ((((V) & 0xfff) + (X)) & 0xfff))
-
-/* Build a WFL for expression nodes */
-#define BUILD_EXPR_WFL(NODE, WFL) \
- build_expr_wfl ((NODE), input_filename, EXPR_WFL_LINENO ((WFL)), \
- EXPR_WFL_COLNO ((WFL)))
-
-#define EXPR_WFL_QUALIFICATION(WFL) TREE_OPERAND ((WFL), 2)
-#define QUAL_WFL(NODE) TREE_PURPOSE (NODE)
-#define QUAL_RESOLUTION(NODE) TREE_VALUE (NODE)
-#define QUAL_DECL_TYPE(NODE) GET_SKIP_TYPE (NODE)
-
-#define GET_SKIP_TYPE(NODE) \
- (TREE_CODE (TREE_TYPE (NODE)) == POINTER_TYPE ? \
- TREE_TYPE (TREE_TYPE (NODE)): TREE_TYPE (NODE))
-
-/* Handy macros for the walk operation */
-#define COMPLETE_CHECK_OP(NODE, N) \
-{ \
- TREE_OPERAND ((NODE), (N)) = \
- java_complete_tree (TREE_OPERAND ((NODE), (N))); \
- if (TREE_OPERAND ((NODE), (N)) == error_mark_node) \
- return error_mark_node; \
-}
-#define COMPLETE_CHECK_OP_0(NODE) COMPLETE_CHECK_OP(NODE, 0)
-#define COMPLETE_CHECK_OP_1(NODE) COMPLETE_CHECK_OP(NODE, 1)
-#define COMPLETE_CHECK_OP_2(NODE) COMPLETE_CHECK_OP(NODE, 2)
-
-/* Building invocations: append(ARG) and StringBuffer(ARG) */
-#define BUILD_APPEND(ARG) \
- ((JSTRING_TYPE_P (TREE_TYPE (ARG)) || JPRIMITIVE_TYPE_P (TREE_TYPE (ARG))) \
- ? build_method_invocation (wfl_append, \
- ARG ? build_tree_list (NULL, (ARG)) : NULL_TREE)\
- : build_method_invocation (wfl_append, \
- ARG ? build_tree_list (NULL, \
- build1 (CONVERT_EXPR, \
- object_type_node,\
- (ARG))) \
- : NULL_TREE))
-#define BUILD_STRING_BUFFER(ARG) \
- build_new_invocation (wfl_string_buffer, \
- (ARG ? build_tree_list (NULL, (ARG)) : NULL_TREE))
-
-/* For exception handling, build diverse function calls */
-#define BUILD_ASSIGN_EXCEPTION_INFO(WHERE, TO) \
- { \
- (WHERE) = build (MODIFY_EXPR, void_type_node, (TO), \
- soft_exceptioninfo_call_node); \
- TREE_SIDE_EFFECTS (WHERE) = 1; \
- }
-
-#define BUILD_THROW(WHERE, WHAT) \
- { \
- (WHERE) = \
- build (CALL_EXPR, void_type_node, \
- build_address_of (throw_node[exceptions_via_longjmp ? 1 : 0]), \
- build_tree_list (NULL_TREE, (WHAT)), NULL_TREE); \
- TREE_SIDE_EFFECTS ((WHERE)) = 1; \
- }
-
-/* Set wfl_operator for the most accurate error location */
-#define SET_WFL_OPERATOR(WHICH, NODE, WFL) \
- EXPR_WFL_LINECOL (WHICH) = \
- (TREE_CODE (WFL) == EXPR_WITH_FILE_LOCATION ? \
- EXPR_WFL_LINECOL (WFL) : EXPR_WFL_LINECOL (NODE))
-
-#define PATCH_METHOD_RETURN_ERROR() \
- { \
- if (ret_decl) \
- *ret_decl = NULL_TREE; \
- return error_mark_node; \
- }
-
-/* Convenient macro to check. Assumes that CLASS is a CLASS_DECL. */
-#define CHECK_METHODS(CLASS) \
- { \
- if (CLASS_INTERFACE ((CLASS))) \
- java_check_abstract_methods ((CLASS)); \
- else \
- java_check_regular_methods ((CLASS)); \
- }
-
-/* Using and reseting the @deprecated tag flag */
-#define CHECK_DEPRECATED(DECL) \
- { \
- if (ctxp->deprecated) \
- DECL_DEPRECATED (DECL) = 1; \
- ctxp->deprecated = 0; \
- }
-
-/* Register an import */
-#define REGISTER_IMPORT(WHOLE, NAME) \
-{ \
- IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P ((NAME)) = 1; \
- node = build_tree_list ((WHOLE), (NAME)); \
- TREE_CHAIN (node) = ctxp->import_list; \
- ctxp->import_list = node; \
-}
-
-/* Macro to access the osb (opening square bracket) count */
-#define CURRENT_OSB(C) (C)->osb_number [(C)->osb_depth]
-
-/* Macro for the xreferencer */
-#define DECL_END_SOURCE_LINE(DECL) DECL_FRAME_SIZE (DECL)
-#define DECL_INHERITED_SOURCE_LINE(DECL) (DECL_CHECK (DECL)->decl.u2.i)
-
-/* Parser context data structure. */
-struct parser_ctxt {
-
- char *filename; /* Current filename */
- FILE *finput; /* Current file input stream */
- struct parser_ctxt *next;
-
- char marker_begining; /* Marker. Should be a sub-struct */
- struct java_line *p_line, *c_line; /* Previous and current line */
- java_lc elc; /* Error's line column info */
- unicode_t unget_utf8_value; /* An unget utf8 value */
- int ccb_indent; /* Keep track of {} indent, lexer */
- int first_ccb_indent1; /* First { at ident level 1 */
- int last_ccb_indent1; /* Last } at ident level 1 */
- int parser_ccb_indent; /* Keep track of {} indent, parser */
- int osb_depth; /* Current depth of [ in an expression */
- int osb_limit; /* Limit of this depth */
- int *osb_number; /* Keep track of ['s */
- int lineno; /* Current lineno */
- char marker_end; /* End marker. Should be a sub-struct */
-
- /* The flags section */
-
- /* Indicates a context used for saving the parser status. The
- context must be popped when the status is restored. */
- unsigned saved_data_ctx:1;
- /* Indicates that a context already contains saved data and that the
- next save operation will require a new context to be created. */
- unsigned saved_data:1;
- /* Integral literal overflow */
- unsigned minus_seen:1;
- /* Report error when true */
- unsigned java_error_flag:1;
- /* @deprecated tag seen */
- unsigned deprecated:1;
- /* Flag to report certain errors (fix this documentation. FIXME) */
- unsigned class_err:1;
-
- /* This section is defined only if we compile jc1 */
-#ifndef JC1_LITE
- tree modifier_ctx [11]; /* WFL of modifiers */
- tree current_class; /* Current class */
- tree current_function_decl; /* Current function decl, save/restore */
-
- struct JCF *current_jcf; /* CU jcf */
-
- int prevent_ese; /* Prevent expression statement error */
-
- int formal_parameter_number; /* Number of parameters found */
- int interface_number; /* # itfs declared to extend an itf def */
-
- tree package; /* Defined package ID */
-
- /* Those two list are saved accross file traversal */
- tree incomplete_class; /* List of non-complete classes */
- tree gclass_list; /* All classes seen from source code */
-
- /* These two lists won't survive file traversal */
- tree class_list; /* List of classes in a CU */
- jdeplist *classd_list; /* Classe dependencies in a CU */
-
- tree current_parsed_class; /* Class currently parsed */
- tree current_parsed_class_un; /* Curr. parsed class unqualified name */
-
- tree non_static_initialized; /* List of non static initialized fields */
- tree static_initialized; /* List of static non final initialized */
- tree instance_initializers; /* List of instancei initializers stmts */
-
- tree import_list; /* List of import */
- tree import_demand_list; /* List of import on demand */
-
- tree current_loop; /* List of the currently nested
- loops/switches */
- tree current_labeled_block; /* List of currently nested
- labeled blocks. */
-
- int pending_block; /* Pending block to close */
-
- int explicit_constructor_p; /* >0 when processing an explicit
- constructor. This flag is used to trap
- illegal argument usage during an
- explicit constructor invocation. */
-#endif /* JC1_LITE */
-};
-
-/* A set of macros to push/pop/access the currently parsed class. */
-#define GET_CPC_LIST() ctxp->current_parsed_class
-
-/* Currently class being parsed is an inner class if an enclosing
- class has been already pushed. This truth value is only valid prior
- an inner class is pushed. After, use FIXME. */
-#define CPC_INNER_P() GET_CPC_LIST ()
-
-/* Get the currently parsed class DECL_TYPE node. */
-#define GET_CPC() TREE_VALUE (GET_CPC_LIST ())
-
-/* Get the currently parsed class unqualified IDENTIFIER_NODE. */
-#define GET_CPC_UN() TREE_PURPOSE (GET_CPC_LIST ())
-
-/* Get a parsed class unqualified IDENTIFIER_NODE from its CPC node. */
-#define GET_CPC_UN_NODE(N) TREE_PURPOSE (N)
-
-/* Get the currently parsed class DECL_TYPE from its CPC node. */
-#define GET_CPC_DECL_NODE(N) TREE_VALUE (N)
-
-/* The currently parsed enclosing currently parsed TREE_LIST node. */
-#define GET_ENCLOSING_CPC() TREE_CHAIN (GET_CPC_LIST ())
-
-/* Get the next enclosing context. */
-#define GET_NEXT_ENCLOSING_CPC(C) TREE_CHAIN (C)
-
-/* The DECL_TYPE node of the enclosing currently parsed
- class. NULL_TREE if the currently parsed class isn't an inner
- class. */
-#define GET_ENCLOSING_CPC_CONTEXT() (GET_ENCLOSING_CPC () ? \
- TREE_VALUE (GET_ENCLOSING_CPC ()) : \
- NULL_TREE)
-
-/* Make sure that innerclass T sits in an appropriate enclosing
- context. */
-#define INNER_ENCLOSING_SCOPE_CHECK(T) \
- (INNER_CLASS_TYPE_P ((T)) && !ANONYMOUS_CLASS_P ((T)) \
- && ((current_this \
- /* We have a this and it's not the right one */ \
- && (DECL_CONTEXT (TYPE_NAME ((T))) \
- != TYPE_NAME (TREE_TYPE (TREE_TYPE (current_this)))) \
- && !inherits_from_p (TREE_TYPE (TREE_TYPE (current_this)), \
- TREE_TYPE (DECL_CONTEXT (TYPE_NAME (T))))) \
- /* We don't have a this. */ \
- || !current_this))
-
-/* Push macro. First argument to PUSH_CPC is a DECL_TYPE, second
- argument is the unqualified currently parsed class name. */
-#define PUSH_CPC(C,R) { \
- ctxp->current_parsed_class = \
- tree_cons ((R), (C), GET_CPC_LIST ()); \
- }
-
-/* In case of an error, push an error. */
-#define PUSH_ERROR() PUSH_CPC (error_mark_node, error_mark_node)
-
-/* Pop macro. Before we pop, we link the current inner class decl (if any)
- to its enclosing class. */
-#define POP_CPC() { \
- link_nested_class_to_enclosing (); \
- ctxp->current_parsed_class = \
- TREE_CHAIN (GET_CPC_LIST ()); \
- }
-
-#define DEBUG_CPC() \
- do \
- { \
- tree tmp = ctxp->current_parsed_class; \
- while (tmp) \
- { \
- fprintf (stderr, "%s ", \
- IDENTIFIER_POINTER (TREE_PURPOSE (tmp))); \
- tmp = TREE_CHAIN (tmp); \
- } \
- } \
- while (0);
-
-/* Access to the various initializer statement lists */
-#define CPC_INITIALIZER_LIST(C) ((C)->non_static_initialized)
-#define CPC_STATIC_INITIALIZER_LIST(C) ((C)->static_initialized)
-#define CPC_INSTANCE_INITIALIZER_LIST(C) ((C)->instance_initializers)
-
-/* Access to the various initializer statements */
-#define CPC_INITIALIZER_STMT(C) (TREE_PURPOSE (CPC_INITIALIZER_LIST (C)))
-#define CPC_STATIC_INITIALIZER_STMT(C) \
- (TREE_PURPOSE (CPC_STATIC_INITIALIZER_LIST (C)))
-#define CPC_INSTANCE_INITIALIZER_STMT(C) \
- (TREE_PURPOSE (CPC_INSTANCE_INITIALIZER_LIST (C)))
-
-/* Set various initializer statements */
-#define SET_CPC_INITIALIZER_STMT(C,S) \
- if (CPC_INITIALIZER_LIST (C)) \
- TREE_PURPOSE (CPC_INITIALIZER_LIST (C)) = (S);
-#define SET_CPC_STATIC_INITIALIZER_STMT(C,S) \
- if (CPC_STATIC_INITIALIZER_LIST (C)) \
- TREE_PURPOSE (CPC_STATIC_INITIALIZER_LIST (C)) = (S);
-#define SET_CPC_INSTANCE_INITIALIZER_STMT(C,S) \
- if (CPC_INSTANCE_INITIALIZER_LIST(C)) \
- TREE_PURPOSE (CPC_INSTANCE_INITIALIZER_LIST (C)) = (S);
-
-#ifndef JC1_LITE
-void java_complete_class PARAMS ((void));
-void java_check_circular_reference PARAMS ((void));
-void java_fix_constructors PARAMS ((void));
-void java_layout_classes PARAMS ((void));
-void java_reorder_fields PARAMS ((void));
-tree java_method_add_stmt PARAMS ((tree, tree));
-void java_expand_switch PARAMS ((tree));
-int java_report_errors PARAMS ((void));
-extern tree do_resolve_class PARAMS ((tree, tree, tree, tree));
-#endif
-char *java_get_line_col PARAMS ((char *, int, int));
-extern void reset_report PARAMS ((void));