aboutsummaryrefslogtreecommitdiff
path: root/gcc/java/lex.h
AgeCommit message (Collapse)AuthorFilesLines
2005-06-25Update FSF address.Kelley Cook1-2/+2
From-SVN: r101309
2004-11-06lex.h (HAVE_ICONV): Undefine if we do not have HAVE_ICONV_H as well.Zack Weinberg1-1/+5
* lex.h (HAVE_ICONV): Undefine if we do not have HAVE_ICONV_H as well. Co-Authored-By: Gerald Pfeifer <gerald@pfeifer.com> From-SVN: r90168
2004-10-15boehm.c, [...]: Update copyright.Kazu Hirata1-1/+1
* boehm.c, builtins.c, java-except.h, jcf-io.c, jcf-path.c, jcf.h, lang-specs.h, lex.c, lex.h, resource.c, win32-host.c: Update copyright. From-SVN: r89100
2004-09-30Simplify lexer. Implement --enable-mapped-location support.Per Bothner1-78/+43
* jcf-parse.c (parse_class_file): Use linemap_line_start. (parse_source_file_1): Pass filename as extra parameter, so we can call linemap_add and set input_location here, rather than in both callers. (read_class): Pass copied filename to parse_source_file_1. Don't initialize wfl_operator - only needed for source compilation. (read_class, jcf_parse): Call linemap_add with LC_LEAVE. * lex.h: Remove a bunch of debugging macros. * lex.h (struct_java_line, struct java_error): Remove types. (JAVA_COLUMN_DELTA): Remove - use java_lexer.next_colums instead. (struct java_lc_s): Remove prev_col field. (struct java_lexer): New fields next_unicode, next_columns, and avail_unicode. New position field, and maybe token_start field. Don't need hit_eof field - use next_unicode == -1 instead. (JAVA_INTEGERAL_RANGE_ERROR): Rename to JAVA_RANGE_ERROR. (JAVA_RANGE_ERROR, JAVA_FLOAT_ANGE_ERROR): Update accordingly. * parse.h: Various changes for USE_MAPPED_LOCATION. (EXPR_WFL_EMIT_LINE_NOTE): XXX (BUILD_EXPR_WFL, EXPR_WFL_ADD_COL): Remove no-longer-used macros. (struct parser_ctxt): New file_start_location field. Remove p_line, c_line fields since we no longer save lines. Remove elc, lineno, and current_jcf fields - no longer used. * parse.y: Updates for USE_MAPPED_LOCATION and new lexer. Don't use EXPR_WFL_ADD_COL since that isn't trivial with source_location and is probably not needed anymore anyway. Use new expr_add_Location function. (SET_EXPR_LOCATION_FROM_TOKEN): New convenience macro. (java_pop_parser_context): Minor cleanup. (java_parser_context_save_global, java_parser_context_restore_global, java_pop_parser_context): Save/restore input_location as a unit. (issue_warning_error_from_context): If USE_MAPPED_LOCATION take a source_location instead of a wfl context node. (check_class_interface_creation): input_filename is not addressable. (create_artificial_method): Calling java_parser_context_save_global and java_parser_context_restore_global is overkill. Instead, temporarily set input_location from class decl. (java_layout_seen_class_methods): Set input_location from method decl. (fix_constructors): Make more robust if no EXPR_WITH_FILE_LOCATION. (finish_loop_body): Likewise. * lex.c: Updates for USE_MAPPED_LOCATION. Use build_unknwon_wfl. (java_sprint_unicode): Take a character, not index in line. (java_sneak_uncode): Replaced by java_peek_unicode. (java_unget_unicode): No longer used. (java_allocate_new_line. java_store_unicode): Removed, since we no longer remember "lines". (java_new_lexer): Update for new data structures. (java_read_char): Move unget_value checking to java_read_unicode. (java_get_unicode, java_peek_unicode, java_next_unicode): New more efficient functions that are used directly when lexing. (java_read_unicode_collapsing_terminators): No longer needed. (java_parse_end_comment, java_parse_escape_sequence, do_java_lex): Re-organize to use java_peek_unicode to avoid java_unget_unicode. (java_parse_escape_sequence): Rewrite to be simpler / more efficient. (do_java_lex): Lots of movings around to avoid java_unget_unicode, combine switch branches, and test for common token kinds earlier. (java_lex_error): Rewrite. * jv-scan.c (expand_location): New function, copied from tree.c. (main): Set ctxp->filename instead of setting input_filename directly. From-SVN: r88367
2004-08-05tree.h (force_fit_type): Return a tree, take three flags.Nathan Sidwell1-6/+0
* tree.h (force_fit_type): Return a tree, take three flags. * fold-const.c (force_fit_type): Set TREE_OVERFLOW and TREE_CONSTANT_OVERFLOW here. (int_const_binop, const_binop): Adjust. (size_int_type): Do sign extension here. (fold_convert_const, optimize_bit_field_compare, decode_field_reference, all_ones_mask_p, fold_div_compare, fold, fold_negate_const, fold_abs_const, fold_not_const): Adjust. * tree.c (size_in_bytes, int_fits_type_p): Adjust. * cp/cvt.c (cp_convert_to_pointer): Adjust force_fit_type call. * java/jcf-parse.c (get_constant): Adjust force_fit_type call. * java/lex.h (SET_LVAL_NODE_TYPE): Remove. * java/lex.c (java_perform_atof): Use SET_LVAL_NODE directly. (do_java_lex): Likewise. Adjust force_fit_type call. From-SVN: r85599
2004-06-21tree-alias-common.h (struct tree_alias_ops): Change ip and ip_partial to ↵Joseph Myers1-4/+4
unsigned int. * tree-alias-common.h (struct tree_alias_ops): Change ip and ip_partial to unsigned int. fortran: * trans.h (stmtblock_t): Change has_scope to unsigned int. java: * jcf.h (struct JCF): Change java_source, right_zip and finished to unsigned int. * lex.h (struct java_lexer): Change hit_eof, read_anything, byte_swap and use_fallback to unsigned int. * parse.h (struct _jdep): Change flag0 to unsigned int. From-SVN: r83430
2004-05-26lex.c (java_new_lexer): Set 'encoding'.Bryce McKinlay1-0/+3
* lex.c (java_new_lexer): Set 'encoding'. (java_read_char): Improve error message for unrecognized characters. * lex.h (struct java_lexer): New field 'encoding'. From-SVN: r82292
2003-12-03aclocal.m4 (AM_ICONV): Add explicit check for iconv.h.Zack Weinberg1-1/+1
* aclocal.m4 (AM_ICONV): Add explicit check for iconv.h. * config.in, configure.in: Regenerate. * cpphash.h, java/lex.h: Check both HAVE_ICONV and HAVE_ICONV_H before including iconv.h. From-SVN: r74234
2003-05-04Make-lang.in (java/parse.o, [...]): Depend on input.h.Nathan Sidwell1-0/+2
* Make-lang.in (java/parse.o, java/parse-scan.o): Depend on input.h. * lex.h: #include input.h. * jv-scan.c (input_filename): Remove. From-SVN: r66452
2003-05-02Makefile.in (TREE_H): Replace location.h with input.h.Nathan Sidwell1-1/+0
* Makefile.in (TREE_H): Replace location.h with input.h. (GTFILES) Remove location.h (gt-lists.h): Replace gt-location.h with gt-input.h * input.h (input_filename, input_line): Remove variables. (location_s, location_t): Move from location.h. (input_location): New. (input_filename, input_line): New #defines. * location.h: Remove. * tree.h: Replace location.h with input.h. (input_filename, input_line): Remove. * diagnostic.h: Replace location.h with input.h. * gcc.h (input_filename, input_filename_length): Remove declarations. * toplev.c (input_filename, input_line): Remove. (input_location): Define. (push_srcloc, pop_srcloc): Adjust. * diagnostic.c (diagnostic_report_current_module): Adjust. f: * lex.c (ffelex_file_pop_): Adjust file_stack member use. (ffelex_file_push_): Likewise. (ffelex_hash_): Likewise. java: * lex.h (input_lineno): Remove declaration. * parse-scan.y: #include input.h. (input_filename): Remove declaration. (input_location): Add definition. (input_line): Remove definition. From-SVN: r66378
2003-05-01input.h (lineno): Rename to ...Nathan Sidwell1-1/+1
* input.h (lineno): Rename to ... (input_line): ... here. * tree.h (lineno): Rename to ... (input_line): ... here. * scan.h (lineno): Rename to ... (input_line): ... here. * toplev.c (lineno): Rename to ... (input_line): ... here. (push_srcloc, pop_srcloc): Rename lineno to input_line. * c-common.c (c_expand_start_cond, fname_decl): Likewise. * c-decl.c (poplevel, pop_label_level, lookup_label, lookup_tag, store_parm_decls, c_expand_body_1): Likewise. * c-errors.c (pedwarn_c99): Likewise. * c-format.c (status_warning): Likewise. * c-lex.c (fe_file_change, cb_def_pragma, c_lex): Likewise. * c-opts.c (c_common_post_options, c_common_parse_file): Likewise. * c-parse.in (save_filename, maybe_type_qual, ifc): Likwise. * c-semantics.c (finish_stmt_tree, build_stmt, emit_local_var, gentrtl_goto_stmt, genrtl_expr_stmt_value, genrtl_decl_stmt, genrtl_if_stmt, genrtl_while_stmt, genrtl_do_stmt, genrtl_return_stmt, genrtl_for_stmt, build_break_stmt, build_continue_stmt, genrtl_switch_stmt, genrtl_asm_stmt, prep_stmt, find_reachable_label, expand_unreachable_stmt): Likewise. * coverage.c (create_coverage): Likewise. * diagnostic.c (pedwarn, sorry, error, fatal_error, internal_error, warning, diagnostic_report_current_module, inform): Likewise. * expr.c (expand_expr): Likewise. * integrate.c (expand_inline_function, output_inline_function): Likewise. * rtl-error.c (file_and_line_for_asm): Likewise. * tree-inline.c (find_alloca_call, find_builtin_longjmp_call, walk_tree): Likewise. * tree.c (make_node): Likewise. * ada, cp, f, java, objc, treelang: Likewise. ada * trans.c (build_unit_elab, set_lineno): Rename lineno to input_line. * utils.c (pushdecl, create_label_decl, begin_subprog_body, end_subprog_body): Likewise. * utils2.c (build_call_raise): Likewise. cp * class.c (finish_struct): Rename lineno to input_line. * decl.c (push_binding_level, pop_binding_level, suspend_binding_level, resume_binding_level, make_label_decl, use_label, start_function): Likewise. * decl2.c (warn_if_unknown_interface, start_static_initialization_or_destruction, generate_ctor_or_dtor_function, finish_file): Likewise. * error.c (cp_line_of, print_instantiation_full_context, print_instantiation_context): Likewise. * except.c (check_handlers_1, check_handlers): Likewise. * init.c (create_temporary_var): Likewise. * method.c (use_thunk, synthesize_method): Likewise. * parser.c (cp_lexer_set_source_position_from_token, cp_lexer_get_preprocessor_token): Likewise. * pt.c (push_tinst_level, pop_tinst_level, tsubst_friend_function, instantiate_class_template, tsubst_decl, tsubst, tsubst_expr, instantiate_decl): Likewise. * semantics.c (genrtl_try_block, finish_label_stmt, begin_class_definition, expand_body, genrtl_finish_function): Likewise. * tree.c (build_min_nt, build_min): Likewise. f * ansify.c (die_unless): Rename lineno to input_line. * com.c (ffecom_subscript_check_, ffecom_do_entry_, ffecom_gen_sfuncdef_, ffecom_start_progunit_, ffecom_sym_transform_, ffecom_sym_transform_assign_, bison_rule_pushlevel_, bison_rule_compstmt_, finish_function, store_parm_decls): Likewise. * intrin.c (ffeintrin_fulfill_generic): Likewise. * lex.c (ffelex_hash_, ffelex_include_, ffelex_next_line_, ffelex_file_fixed, ffelex_file_free): Likewise. * std.c (ffestd_exec_end): Likewise. * ste.c (ffeste_emit_line_note_, ffeste_start_block_, ffeste_start_stmt_): Likewise. * ste.h (ffeste_filelinenum, ffeste_set_line): Likewise. java * lex.h (lineno): Rename to ... (input_line): ... here * parse-scan.y (lineno): Rename to ... (input_line): ... here. (reset_report): Rename lineno to input_line. * check-init.c (check_init): Likewise. * class.c (push_class): Likewise. * decl.c (complete_start_java_method, end_java_method): Likewise. * expr.c (expand_byte_code): Likewise. * jcf-parse.c (give_name_to_class, parse_class_file): Likewise. * jcf-write.c (generate_bytecode_insns): Likewise. * lex.c (java_init_lex, java_allocate_new_line, do_java_lex): Likewise. * parse.h (YYNOT_TWICE): Likewise. * parse.y (empty_statement, expression_statement, java_pop_parser_context, java_parser_context_save_global, yyerror, register_fields, method_header, safe_layout_class, find_in_imports_on_demand, create_artificial_method, source_end_java_method, start_complete_expand_method, build_thisn_assign, java_complete_lhs, maybe_absorb_scoping_block): Likewise. objc * objc-act.c (objc_init): Rename lineno to input_line. (build_module_descriptor, build_selector_translation_table, build_protocol_template, build_method_prototype_list_template, build_category_template, build_selector_table, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template, add_instance_variable): Likewise. treelang * tree1.c (treelang_init): Rename lineno to input_line. From-SVN: r66333
2003-01-10Merge from pch-branch.Geoffrey Keating1-3/+4
From-SVN: r61136
2003-01-09* All Files: Remove PARAMS macro.Kaveh R. Ghazi1-1/+1
From-SVN: r61133
2003-01-01Make-lang.in, [...]: Replace "GNU CC" with "GCC" in the copyright header.Steven Bosscher1-5/+6
* Make-lang.in, boehm.c, buffer.c, buffer.h, builtins.c, class.c, config-lang.in, constants.c, convert.h, decl.c, except.c, expr.c, java-except.h, java-tree.h, javaop.def, jcf-parse.c, jcf-write.c, jv-scan.c, jvgenmain.c, jvspec.c, keyword.gperf, keyword.h, lang-options.h, lang-specs.h, lang.c, lex.c, lex.h, mangle.c, mangle_name.c, parse-scan.y, parse.h, parse.y, typeck.c, verify.c, xref.c, xref.h: Replace "GNU CC" with "GCC" in the copyright header. * check-init.c, gjavah.c, javaop.h, jcf-depend.c, jcf-dump.c, jcf-io.c, jcf-path.c, jcf-reader.c, jcf.h, zextract.c, zipfile.h: These files are "part of GCC". Also say "GCC" not "GNU CC". From-SVN: r60747
2002-11-06re PR java/6388 (Integer.MIN_VALUE == 0x80000000 optimized to false on powerpc)Tom Tromey1-4/+4
Fix for PR java/6388. * lex.h (JAVA_INTEGRAL_RANGE_ERROR): Wrap in do...while. * java-tree.h (enum java_tree_index): New values JTI_DECIMAL_INT_MAX_NODE, JTI_DECIMAL_LONG_MAX_NODE. (decimal_int_max, decimal_long_max): New defines. * lex.c (yylex): Rewrote range checking. Sign extend literals. (error_if_numeric_overflow): Rewrote range checking. * decl.c (java_init_decl_processing): Initialize decimal_int_max, decimal_long_max. From-SVN: r58843
2002-11-02Reverted erroneous checkinTom Tromey1-4/+4
From-SVN: r58756
2002-11-02re PR java/6388 (Integer.MIN_VALUE == 0x80000000 optimized to false on powerpc)Tom Tromey1-4/+4
Fix for PR java/6388. * lex.h (JAVA_INTEGRAL_RANGE_ERROR): Wrap in do...while. * java-tree.h (enum java_tree_index): New values JTI_DECIMAL_INT_MAX_NODE, JTI_DECIMAL_LONG_MAX_NODE. (decimal_int_max, decimal_long_max): New defines. * lex.c (yylex): Rewrote range checking. Sign extend literals. (error_if_numeric_overflow): Rewrote range checking. * decl.c (java_init_decl_processing): Initialize decimal_int_max, decimal_long_max. From-SVN: r58755
2001-10-21c-format.c (maybe_read_dollar_number): Use safe-ctype macros and/or fold ↵Kaveh R. Ghazi1-13/+5
extra calls into fewer ones. * c-format.c (maybe_read_dollar_number): Use safe-ctype macros and/or fold extra calls into fewer ones. * collect2.c (dump_file): Likewise. * cppexp.c (parse_number): Likewise. * cpplex.c (_cpp_lex_direct): Likewise. * final.c (output_asm_insn, asm_fprintf): Likewise. * fix-header.c (inf_scan_ident, main): Likewise. * fixinc/fixfixes.c (char_macro_use_fix, char_macro_def_fix): Likewise. * fold-const.c (real_hex_to_f): Likewise. * gen-protos.c (parse_fn_proto): Likewise. * genattrtab.c (check_attr_test, check_attr_value): Likewise. * genrecog.c (change_state, write_action): Likewise. * gensupport.c (shift_output_template): Likewise. * local-alloc.c (requires_inout): Likewise. * mips-tfile.c (IS_ASM_IDENT): Likewise. * protoize.c (is_id_char, main): Likewise. * real.c (asctoeg): Likewise. * recog.c (asm_operand_ok): Likewise. * reload.c (find_reloads): Likewise. * scan.c (scan_identget_token): Likewise. * sched-vis.c (print_value): Likewise. * stringpool.c (ggc_alloc_string): Likewise. * toplev.c (read_integral_parameter, decode_g_option): Likewise. * tradcif.y (parse_number, yylex, parse_escape): Likewise. * tradcpp.c (rescan): Likewise. * tree.c (clean_symbol_name): Likewise. * varasm.c (decode_reg_name): Likewise. * alpha.h (ASM_OUTPUT_ASCII): Likewise. * darwin.c (name_needs_quotes, func_name_maybe_scoped): Likewise. * dsp16xx.h (ASM_OUTPUT_ASCII): Likewise. * m88k.c (output_ascii): Likewise. * m88k.h (OVERRIDE_OPTIONS): Likewise. * mcore.h (REG_CLASS_FROM_LETTER): Likewise. * ns32k/encore.h (ASM_OUTPUT_ASCII): Likewise. * sh.h (REG_CLASS_FROM_LETTER): Likewise. cp: * xref.c (GNU_xref_member): Use safe-ctype macros and/or fold extra calls into fewer ones. f: * bad.c (ffebad_finish): Use safe-ctype macros and/or fold extra calls into fewer ones. * implic.c (ffeimplic_lookup_): Likewise. * intdoc.c (dumpimp): Likewise. * intrin.c (ffeintrin_init_0): Likewise. * lex.c (ffelex_backslash_, ffelex_cfebackslash_, ffelex_hash_): Likewise. * lex.h (ffelex_is_firstnamechar): Likewise. * target.c (ffetarget_integerhex): Likewise. java: * gjavah.c (jni_print_char, decode_signature_piece): Use safe-ctype macros and/or fold extra calls into fewer ones. * lex.c (java_read_unicode, java_lex): Likewise. * lex.h (JAVA_START_CHAR_P, JAVA_PART_CHAR_P, JAVA_ASCII_DIGIT, JAVA_ASCII_HEXDIGIT, JAVA_ASCII_LETTER): Likewise. * mangle_name.c (append_unicode_mangled_name, unicode_mangling_length): Likewise. From-SVN: r46397
2001-08-12toplev.c (set_float_handler): Make static.Zack Weinberg1-5/+0
* toplev.c (set_float_handler): Make static. * toplev.h: Don't prototype set_float_handler. * simplify-rtx.c: Don't include setjmp.h. (simplify_unary_real, simplify_binary_real, simplify_binary_is2orm1): New functions. (simplify_unary_operation, simplify_binary_operation): Use them, via do_float_handler. * fold-const.c: Don't include setjmp.h. (exact_real_inverse_1): New function. (exact_real_inverse): Use it, via do_float_handler. * varasm.c: Don't include setjmp.h. (assemble_real_1): New function. (assemble_real): Use it, via do_float_handler. Call internal_error if we get a trap here. * c-parse.in, cse.c, cselib.c, ch/lex.c, config/i386/i386.c, config/pj/pj.c, config/s390/s390.c: Don't include setjmp.h. * java/lex.h: Don't include setjmp.h. Don't define SET_FLOAT_HANDLER or prototype set_float_handler. From-SVN: r44815
2001-07-18For PR java/2812:Tom Tromey1-2/+2
* lex.h: Use HAVE_ICONV, not HAVE_ICONV_H. * lex.c (java_new_lexer): Use ICONV_CONST. (java_read_char): Likewise. * Make-lang.in (jc1$(exeext)): Link against LIBICONV. (jv-scan$(exeext)): Likewise. From-SVN: r44120
2001-05-25Standardize header guards.Richard Henderson1-3/+3
From-SVN: r42615
2000-12-13Make-lang.in (JAVA_LEX_C): Added chartables.h.Tom Tromey1-315/+31
* Make-lang.in (JAVA_LEX_C): Added chartables.h. * lex.c (java_ignorable_control_p): Removed. (java_letter_or_digit_p): Removed. (java_start_char_p): New function. (java_read_char): Return `int', not `unicode_t'. Changed callers. (java_read_unicode): Likewise. (java_read_unicode_collapsing_terminators): Likewise. (java_get_unicode): Likewise. (java_new_lexer): Initialize hit_eof. (java_parse_end_comment): Take `int' argument. (java_parse_doc_section): Likewise. (java_parse_escape_sequence): Don't allow backlash-newline. Return `int'. * lex.h (JAVA_DIGIT_P): Removed. (_JAVA_LETTER_OR_DIGIT_P): Removed. (_JAVA_IDENTIFIER_IGNORABLE): Removed. (JAVA_START_CHAR_P): Renamed from JAVA_ID_CHAR_P. (JAVA_PART_CHAR_P): New macro. (UEOF): Now -1. (JAVA_CHAR_ERROR): Now -2. (java_lexer): New field `hit_eof'. * chartables.h: New file. * gen-table.pl: new file. From-SVN: r38237
2000-11-06lex.h (JAVA_FLOAT_RANGE_ERROR): Typo fix.Tom Tromey1-1/+1
* lex.h (JAVA_FLOAT_RANGE_ERROR): Typo fix. * lex.c (IS_ZERO): New define. (java_perform_atof): Error on floating point underflow. From-SVN: r37269
2000-11-03lex.h (_JAVA_IDENTIFIER_IGNORABLE): New macro.Tom Tromey1-0/+15
* lex.h (_JAVA_IDENTIFIER_IGNORABLE): New macro. (JAVA_ID_CHAR_P): Also try java_ignorable_control_p. * lex.c (java_read_unicode): Removed `term_context' argument. Recognize any number of `u' in `\u'. (java_read_unicode_collapsing_terminators): New function. (java_get_unicode): Use it. (java_lineterminator): Removed. (yylex): Produce error if character literal is newline or single quote. Return if eof found in middle of `//' comment. EOF in `//' comment is only an error if pedantic. (java_ignorable_control_p): New function. (java_parse_end_comment): Return if eof found in middle of comment. Include flags.h. * jv-scan.c (pedantic): New global. From-SVN: r37232
2000-10-26lex.c (java_new_lexer): Initialize new fields.Tom Tromey1-1/+11
* lex.c (java_new_lexer): Initialize new fields. Work around broken iconv() implementations. (java_read_char): Swap bytes if required. Use fallback decoder if required. (byteswap_init, need_byteswap): New globals. (java_destroy_lexer): Only close iconv handle if it is in use. * lex.h (java_lexer): New fields read_anything, byte_swap, use_fallback. Made out_buffer unsigned. From-SVN: r37063
2000-10-10lex.c (java_new_lexer): Initialize out_first and out_last fields.Tom Tromey1-0/+14
* lex.c (java_new_lexer): Initialize out_first and out_last fields. * lex.h (java_lexer): Added out_buffer, out_first, out_last. From-SVN: r36830
2000-09-15* lex.h: Use HAVE_ICONV_H, not HAVE_ICONV.Tom Tromey1-1/+1
From-SVN: r36449
2000-09-12re GNATS gcj/33 (gcj mangles composed characters)Tom Tromey1-4/+37
Fix for PR gcj/33: * jv-scan.c (help): Document --encoding. (options): Added `encoding' entry. (OPT_ENCODING): New define. (main): Handle --encoding. Include <langinfo.h> if nl_langinfo exists. * lang-options.h: Document --classpath, --CLASSPATH, --main, and --encoding. * jcf-parse.c Include <langinfo.h> if we have nl_langinfo. (parse_source_file): Correctly call java_init_lex. Added `finput' argument. Use nl_langinfo to determine default encoding. * java-tree.h (current_encoding): Declare. * parse.y (java_parser_context_restore_global): Don't restore `finput'. (java_parser_context_save_global): Don't set `finput' field. (java_pop_parser_context): Don't restore `finput'. Free old lexer if required. * lang.c (current_encoding): New global. (lang_decode_option): Recognize `-fencoding='. (finish_parse): Don't close finput. * parse.h (struct parser_ctxt): Removed `finput' and `unget_utf8_value' fields. Added `lexer' field. (java_init_lex): Fixed declaration. * lex.c (java_new_lexer): New function. (java_destroy_lexer): Likewise. (java_read_char): Added `lex' argument. Handle iconv case. (java_read_unicode): Added `lex' argument. Count backslashes in lexer structure. (java_init_lex): Added `finput' and `encoding' arguments. Set `lexer' field in ctxp. (BAD_UTF8_VALUE): Removed. (java_lex): Handle seeing UEOF in the middle of a string literal. * lex.h: Include <iconv.h> if HAVE_ICONV defined. (java_lexer): New structure. (UNGETC): Removed. (GETC): Removed. (DEFAULT_ENCODING): New define. (java_destroy_lexer): Declare. From-SVN: r36377
2000-02-17Makefile.in (PARSE_C, [...]): Move dependencies on lex.c, lex.h, and PARSE_H ↵Zack Weinberg1-1/+0
to... * Makefile.in (PARSE_C, PARSE_SCAN_C): Move dependencies on lex.c, lex.h, and PARSE_H to... (parse.o, parse-scan.o): ...here, respectively. * lex.c: Split out code that may trigger SIGFPE from yylex() to its own function. * lex.h (JAVA_FLOAT_RANGE_ERROR): Don't set value. From-SVN: r32025
2000-01-21buffer.h: PROTO -> PARAMS.Kaveh R. Ghazi1-2/+2
* buffer.h: PROTO -> PARAMS. * check-init.c: Likewise. * class.c: Likewise. * constants.c: Likewise. * convert.h: Likewise. * decl.c: Likewise. * except.c: Likewise. * expr.c: Likewise. * gjavah.c: Likewise. * java-except.h: Likewise. * java-tree.h: Likewise. * jcf-depend.c: Likewise. * jcf-dump.c: Likewise. * jcf-parse.c: Likewise. * jcf-path.c: Likewise. * jcf-reader.c: Likewise. * jcf-write.c: Likewise. * jcf.h: Likewise. * jv-scan.c: Likewise. * jvgenmain.c: Likewise. * jvspec.c: Likewise. * lang.c: Likewise. * lex.c: Likewise. * lex.h: Likewise. * parse-scan.y: Likewise. * parse.h: Likewise. * parse.y: Likewise. * typeck.c: Likewise. * verify.c: Likewise. * xref.c: Likewise. * xref.h: Likewise. * zextract.c: Likewise. * zipfile.h: Likewise. From-SVN: r31550
1999-10-04re GNATS gcj/59 (Problem with jv-scan --print-main)Tom Tromey1-1/+1
* lex.h (BUILD_OPERATOR2): Return ASSIGN_ANY_TK in `lite' case as well. Fixes Java PR gcj/59. * parse-scan.y (yyerror): Report errors. From-SVN: r29811
1999-05-12lex.h: Never define HOST_WIDE_INT, HOST_BITS_PER_WIDE_INT or HOST_BITS_PER_CHAR.Kaveh R. Ghazi1-3/+0
* lex.h: Never define HOST_WIDE_INT, HOST_BITS_PER_WIDE_INT or HOST_BITS_PER_CHAR. From-SVN: r26906
1999-03-23Warning fixes:Kaveh R. Ghazi1-1/+0
* gjavah.c (print_c_decl): Remove unused argument `flags'. * jcf-dump.c (print_access_flags): Add braces around if-else. * jvspec.c (lang_specific_driver): Wrap variable `len' in macro COMBINE_INPUTS. * lex.c (build_wfl_node): Add static prototype. * lex.h (build_wfl_node): Remove static prototype. * parse.y: Include lex.c early enough to declare everything needed. Ensure calls to `build_wfl_node' pass the proper arguments. (create_class): Remove unused variable `super_decl'. (get_printable_method_name): Initialize variable `name'. From-SVN: r25921
1999-03-13lex.c (java_read_char): UNGET invalid non-initial utf8 character.Per Bothner1-2/+2
h * lex.c (java_read_char): UNGET invalid non-initial utf8 character. * lex.h (UNGETC): Change misleading macro. From-SVN: r25753
1999-01-06Fix copyrights.Jeff Law1-1/+1
From-SVN: r24538
1999-01-06lex.h: Moved static function declarations to lex.c, to shut up some -Wall ↵Per Bothner1-19/+0
warnings. � * lex.h: Moved static function declarations to lex.c, to shut up some -Wall warnings. * lex.c: Static function declarations moved here. * jcf-dump.c: Small fixes to shut up -Wall warnings. From-SVN: r24518
1998-12-09java-tree.def (NEW_ARRAY_INIT): New Java tree code.Alexandre Petit-Bianco1-0/+1
Wed Dec 9 15:37:05 1998 Alexandre Petit-Bianco <apbianco@cygnus.com> * java-tree.def (NEW_ARRAY_INIT): New Java tree code. * lex.c (java_lex): Remember column position before advancing one token. Retain location information on OCB_TK. * lex.h (typedef struct java_lc): Added new field. * parse.h (GET_SKIP_TYPE): New macro. (QUAL_DECL_TYPE): Redefined using GET_SKIP_TYPE. * parse.y (build_new_array_init, patch_new_array_init, patch_array_constructor, maybe_build_array_element_wfl, array_constructor_check_entry): New function prototypes. (switch_block:): Tagged <node>. (OCB_TK): Tagged <operator>. (array_initializer:): Installed actions. (variable_initializer): Build location information on element if necessary. (switch_statement:): Fixed indentation typo. (switch_block:): Redefined default action. (java_complete_tree): Handle NEW_ARRAY_INIT in MODIFY_EXPR:. (patch_assignment): Removed duplicate code. (maybe_build_array_element_wfl, build_new_array_init, patch_new_array_init, patch_array_constructor, array_constructor_check_entry): New functions. Parse and walk array initializer nodes. From-SVN: r24224
1998-11-10class.c (is_compiled_class): Call safe_layout_class for class compiled from ↵Alexandre Petit-Bianco1-7/+19
source. Tue Nov 10 12:34:03 1998 Alexandre Petit-Bianco <apbianco@cygnus.com> * class.c (is_compiled_class): Call safe_layout_class for class compiled from source. * conver.h (convert_to_integer, convert_to_real, convert_to_pointer): Added prototypes. * decl.c (init_decl_processing): Non longer push the decls of `methodtable', `constants', `Class', `Field', `dispatchTable' `jexception' and `Method'. * expr.c (build_invokeinterface): New function. (expand_invoke): static variable CLASS_IDENT now in build_invokeinterface. Use build_invokeinterface. (expand_java_field_op): Moved code to inline java.lang.PRIMTYPE.TYPE into a function. (build_primtype_type_ref): New function. * java-tree.def (INSTANCEOF_EXPR): New tree code. * java-tree.h (CLASS_METHOD_CHECKED_P, METHOD_DEPRECATED, FIELD_DEPRECATED, CLASS_DEPRECATED): New flag macros. (DECL_CONSTRUCTOR_P): Fixed typo in comment. (DECL_LOCAL_STATIC_VALUE): New macro. (build_invokeinterface, build_primtype_type_ref): New function prototypes. (java_parse_abort_on_error): Macro rewritten. * jcf-parse.c (current_method): Add comment to declaration. (parse_zip_file_entries, process_zip_dir, void parse_source_file): Function prototypes fixed. (jcf_parse_source): push/pop parser context. save/restore global. (parse_source_file): Fixed leading comment. Now take a IDENTIFIER_NODE as an argument. Doesn't check methods, layout classes and pop the parser context anymore. (yyparse): Push parser context, save globals, parse the source file, restore globals and pop the parser context when processing a source file. * jcf.h (VERBOSE_SKELETON): Replaces SOURCE_FRONTEND_DEBUG define. * lex.c (java_parse_doc_section): New function. (java_lex): Call java_parse_doc_section when appropriate. Build an operator around INSTANCEOF_TK. * lex.h (java_lineterminator, java_sprint_unicode, java_unicode_2_utf8, java_lex_error, java_store_unicode): Prototypes rewritten. (java_parse_escape_sequence, java_letter_or_digit_p, java_parse_doc_section, java_parse_end_comment, java_get_unicode, java_read_unicode, java_store_unicode, java_read_char, java_allocate_new_line, java_unget_unicode, java_sneak_unicode): Added function prototypes. * parse.h (VERBOSE_SKELETON): Replaces SOURCE_FRONTEND_DEBUG define. (JNULLP_TYPE_P, CHECK_METHODS, CHECK_DEPRECATED, REGISTER_IMPORT): New macros (struct parser_ctxt): New fields: deprecated, current_parsed_class_un, gclass_list. (fix_method_argument_names, issue_warning_error_from_context, resolve_package, lookup_package_type): New function prototypes. (resolve_expression_name): Fixed function prototype. (find_applicable_accessible_methods_list): Fixed indentation, added extra argument in prototype. (check_final_assignment, build_null_of_type, check_deprecation, check_method_redefinition, reset_method_name, java_check_regular_methods, java_check_abstract_methods, maybe_build_primttype_type_ref): New function prototype. * parse.y (conver.h): Include. (INSTANCEOF_TK): Tagged <operator>. (single_type_import_declaration): Use REGISTER_IMPORT macro. (relational_expression:): Build binop for instanceof. (java_push_parser_context): Remember ctxp->gclass_list across contexts. (java_pop_parser_context): Simply return if no context exists. Remember gclass_list across contexts. (issue_warning_error_from_context): New function. (parse_error_context): Don't setup ctxp->elc here. Call issue_warning_error_from_context instead. (parse_warning_context): Likewise. (maybe_create_class_interface_decl): Removed DECL_ARTIFICIAL setup. Link new class/interface to ctxp->gclass_list. (add_superinterfaces): Register interface as incomplete if not loaded. (create_class): Remember class unqualified name in ctxp->current_parsed_class_un. Check class deprecation. (register_fields): Check field deprecation. Remember static final field value in DECL_LOCAL_STATIC_VALUE. Changed comment in part processing INIT. (method_header): New local variable ORIG_ARG. Use unqualified current class name for check on constructor errors. Promote return type if of record type. Argument list fix moved in fix_method_argument_names, called here. Check method deprecation. (fix_method_argument_names): New function. (method_declarator): Promote record typed arguments. (safe_layout_class): Check class methods before layout. (java_complete_class): Compute field layout when patched. (do_resolve_class): Try to load class after having it renamed after the package name. (get_printable_method_name): Use DECL_CONTEXT. (reset_method_name): New function. (check_method_redefinition): Use reset_method_name. (java_check_regular_methods): New local variable SAVED_FOUND_WFL. Temporarily reinstall overriding/hiding method names for error report. Check for compile-time error when method found has default (package) access. (java_check_abstract_methods): Now takes an interface DECL node as an argument. Also reinstall real name on unchecked overriding/hiding methods for error report. (java_check_methods): Fixed leading comment. Get classes to verify from ctxp->gclass_list. Use CHECK_METHODS macro and set CLASS_METHOD_CHECKED_P on class verification. (lookup_java_method2): Get real method name if necessary. (find_in_imports): Don't check package class access here. (resolve_package, lookup_package_type): New functions. (java_layout_classes): Fixed leading comment. Take classes to be laid out from ctxp->gclass_list. (java_complete_expand_methods): Don't expand native and abstract methods. (java_expand_classes): New function. (resolve_expression_name): Use additional argument ORIG. Retrieve values of static final field of primitive types. (resolve_field_access): Handles static final field of promotive type. (resolve_qualified_expression_name): Handle STRING_CST as primaries and package name resolution. Check deprecation on found decls. Set where_found and type_found on non static field resolved during qualification. Layout non primitive field decl types. (check_deprecation): New function. (maybe_access_field): Simplified. (patch_method_invocation_stmt): Local variable CLASS_TYPE removed. Reverse method's argument when primary is a type. Don't use CLASS_TYPE to report problems, use IDENTIFIER_WFL instead. Include abstract class in the list of class searchable for constructors. Use DECL_CONTEXT of found method for access checks. Check method deprecation. (patch_invoke): Pay extra care to NEW_CLASS_EXPR type call when converting arguments. Handle INVOKE_INTERFACE. (lookup_method_invoke): Search constructor using existing infrastructure (don't rely on lookup_java_constructor anymore). (find_applicable_accessible_methods_list): Extra argument flag LC. Now include constructor in the search. (qualify_ambiguous_name): Conditional expression are primaries. (not_initialized_as_it_should_p): static final are always initialized. (java_complete_tree): Pass extra NULL argument to resolve_expression_name. Stricter test to carry on patching assignments. New case for INSTANCEOF_EXPR. (complete_function_arguments): Inline PRIMTYPE.TYPE read access. (check_final_assignment, maybe_build_primttype_type_ref): New functions. (patch_assignment): Detect resolved static finals and carry normal assignment error check on them. Inline PRIMTYPE.TYPE read access. (try_builtin_assignconv): Access constant 0 on all primitive types. (valid_builtin_assignconv_identity_widening_p): Accept identical types. Accept all promoted type on int type. (valid_ref_assignconv_cast_p): Accept a null pointer to be assigned to a reference. (valid_method_invocation_conversion_p): Accept to check null pointers. (build_binop): Merge declaration and initialization of local variable BINOP. (patch_binop): New case for INSTANCEOF_EXPR. NE_EXPR to accept all numeric types. Improved validity test for qualify operators on references. (patch_unaryop): Broadened rejection test for PREDECREMENT_EXPR and PREINCREMENT_EXPR. Also detect resolved static finals of a primitive type and issue the appropriate error message. (resolve_type_during_patch): Mark class loaded when resolved. (patch_cast): Allow null to be cased to reference types. (build_null_of_type): New function. (patch_array_ref): Handle array on references correctly. (patch_return): Removed unused local variable MODIFY. Force boolean to be returned as integers. Allows null to be returned by a function returning a reference. * typeck.c (convert_to_integer, convert_to_real, convert_to_pointer): Prototypes moved to convert.h (lookup_argument_method): Use method real name, if necessary. This improves method checking, gets rid of a cross file type dependency bug and does a more robust job at laying out classes when necessary. It unifies the regular methods and constructors lookup. It implements the `instanceof' operator and interface method invocations. It also fixes random bugs. From-SVN: r23599
1998-10-22jcf-io.c (find_class): Use saw_java_source to determine when to look for ↵Tom Tromey1-1/+0
`.java' file. * jcf-io.c (find_class): Use saw_java_source to determine when to look for `.java' file. * jcf-parse.c (saw_java_source): New global. (yyparse): Set it if `.java' file seen. * Make-lang.in (JAVA_SRCS): Added jcf-path.c. (GCJH_SOURCES): Likewise. * Makefile.in (datadir): New macro. (libjava_zip): Likewise. (JAVA_OBJS): Added jcf-path.o. (../jcf-dump$(exeext)): Depend on and link with jcf-depend.o. (../gcjh$(exeext)): Likewise. (jcf-path.o): New target. * java-tree.h (fix_classpath): Removed decl. * jcf-parse.c (fix_classpath): Removed. (load_class): Don't call fix_classpath. * parse.y (read_import_dir): Don't call fix_classpath. * lex.h: Don't mention classpath. * lex.c (java_init_lex): Don't initialize classpath. * jcf-io.c (classpath): Removed global. (find_class): Use jcf_path iteration functions. Correctly search class path for .java file. (open_in_zip): New argument `is_system'. * jcf-dump.c (main): Call jcf_path_init. Recognize all new classpath-related options. * lang.c (lang_decode_option): Handle -fclasspath, -fCLASSPATH, and -I. (lang_init): Call jcf_path_init. * lang-options.h: Mention -I, -fclasspath, and -fCLASSPATH. * lang-specs.h: Handle -I. Minor cleanup to -M options. Correctly put braces around second string in each entry. * gjavah.c (main): Call jcf_path_init. Recognize all the new classpath-related options. (help): Updated for new options. * jcf.h: Declare functions from jcf-path.c. Don't mention `classpath' global. * jcf-path.c: New file. * jcf-depend.c: Include jcf.h. * jcf-write.c (localvar_alloc): Returns `void'. (localvar_free): Removed unused variable. * lang.c (OBJECT_SUFFIX): Define if not already defined. (init_parse): Use OBJECT_SUFFIX, not ".o". From-SVN: r23219
1998-10-16lex.c (setjmp.h): No longer included.Alexandre Petit-Bianco1-0/+2
Fri Oct 16 10:59:01 1998 Alexandre Petit-Bianco <apbianco@cygnus.com> * lex.c (setjmp.h): No longer included. * lex.h (setjmp.h): Included. * parse.h (SET_TYPE_FOR_RESOLUTION): New macro. (duplicate_declaration_error_p): Renamed from duplicate_declaration_error. (build_array_from_name): New function prototype. * parse.y (setjmp.h): No longer included. (variable_declarator_id): Define action. (build_array_from_name): New function. (duplicate_declaration_error_p): Renamed from duplicate_declaration_error. Fixed leading comment. (register_fields): Main `for' loop reorganized. Uses SET_TYPE_FOR_RESOLUTION and build_array_from_name. (method_declarator): Uses SET_TYPE_FOR_RESOLUTION and call build_array_from_name. (resolve_class): Set CLASS_LOADED_P on newly build array dimension types. (read_import_dir): Don't try to skip `.' and `..'. (declare_local_variables): Uses SET_TYPE_FOR_RESOLUTION and build_array_from_name. Main `for' loop reorganized. (resolve_qualified_expression_name): When building access to a field, use the type where the field was found, not its own type. (maybe_access_field): Use field DECL_CONTEXT if the type where the field was found is null. (qualify_ambiguous_name): Sweep through all successive array dimensions. Implements the alternate form `T a[]' of array declarations. Fixes a bug when building access to certain fields. Fixed a compilation warning when lex.h is included from somewhere else than parse.y From-SVN: r23142
1998-10-14java-tree.h (pop_labeled_block, [...]): New function prototypes.Alexandre Petit-Bianco1-0/+1
Wed Oct 14 18:21:29 1998 Alexandre Petit-Bianco <apbianco@cygnus.com> * java-tree.h (pop_labeled_block, lang_printable_name, maybe_add_interface, set_super_info, get_access_flags_from_decl, interface_of_p, inherits_from_p, fix_classpath, complete_start_java_method, emit_handlers, init_outgoing_cpool, make_class_data, register_class, alloc_name_constant): New function prototypes. * lang.c (lang_decode_option): Set argc argument unused. Fixed indentation. Added cast to remove warning. (lang_printable_name): Set v argument unused. (lang_print_error): Added argument to lang_printable_name call. (java_dummy_print, print_lang_decl, print_lang_type, print_lang_identifier, lang_print_xnode): All argument marked unused. * lex.c (java_unget_unicode): Removed unnecessary argument. (java_allocate_new_line): Unused local variable is gone. (java_read_char): Added parenthesis in expressions to remove warnings. Added final return statement. (java_read_unicode): Added parenthesis in expression to remove warning. (java_parse_end_comment): Fixed java_unget_unicode invocation. (java_parse_escape_sequence): Likewise. (java_lex): Unused local variables are gone. Fixed java_unget_unicode invocation. * lex.h (set_float_handler): Prototype added when JC1_LITE not defined. * parse.h (ERROR_CANT_CONVERT_TO_BOOLEAN): Fixed lang_printable_name invocation in macro. (ERROR_CANT_CONVERT_TO_NUMERIC, ERROR_CAST_NEEDED_TO_INTEGRAL): Likewise. (duplicate_declaration_error): Suppressed unused argument in prototype. (identical_subpath_p): Function declaration is gone. (patch_invoke): Suppressed unused argument in prototype. (patch_cast, build_labeled_block, check_thrown_exceptions): Likewise. * parse.y (setjmp.h): Included (toplev.h): Likewise. (field_declaration:): Suppressed unused local (label_decl:): Fixed build_labeled_block invocation. (java_pop_parser_context): Put extra parenthesis around assignment in if. (yyerror): Suppressed unused local variables. (variable_redefinition_error): Fixed lang_printable_name invocation. (create_interface): Suppressed unused local variables. (create_class): Likewise. (duplicate_declaration_error): Suppressed unused argument. Fixed lang_printable_name invocation. (register_fields): Suppressed unused local variable. Fixed duplicate_declaration_error invocation. (method_header): Suppressed unused local variable. (method_declarator, parser_check_super): Likewise. (java_complete_class): Suppressed unused local variable. Fixed fatal error message. (complete_class_report_errors): Added default: in switch. (java_check_regular_methods): Fixed lang_printable_name invocations. (check_throws_clauses): Likewise. (java_check_abstract_methods): Suppressed unused local variable. Fixed lang_printable_name invocation. (read_import_entry): Added supplemental return statement. (read_import_dir): Suppressed unused local variables. (check_pkg_class_access, declare_local_variables): Likewise. (source_start_java_method): Suppressed unused extern variable declarations (expand_start_java_method): Suppressed unused extern and local variable declarations. (java_complete_expand_methods): Likewise. (java_complete_expand_method): Suppressed unused local variables. (make_qualified_name): Likewise. (resolve_qualified_expression_name): Added default: in switch. Fixed lang_printable_name invocation. (class_instance_creation_expression): Added parenthesis around expressions. (patch_method_invocation_stmt): Fixed lang_printable_name and patch_invoke invocations. (check_for_static_method_reference): Fixed lang_printable_name invocation. (patch_invoke): Suppressed unused arguments and local variables. (lookup_method_invoke): Suppressed unused local variables. (qualify_ambiguous_name): Added default: in switch. (identical_subpath_p): Function removed. (patch_assignment): Suppressed unused local variables. Suppressed unnecessary if statement. Fixed lang_printable_name invocations. (try_builtin_assignconv): Fixed lang_printable_name invocations. (valid_ref_assignconv_cast_p): Parenthesis around expression. Suppressed unused local variables. (build_binop): Suppressed unused local variables. fixed lang_printable_name invocations. (string_constant_concatenation): Suppressed unused local variables. (patch_unaryop): Fixed lang_printable_name invocation. (patch_cast): Suppressed unnecessary argument. Fixed lang_printable_name invocation. (patch_array_ref): Fixed lang_printable_name invocation. (patch_newarray, patch_return, patch_if_else_statement): Likewise. (build_labeled_block): Suppressed unused argument. (generate_labeled_block): Fixed build_labeled_block invocation. (build_loop_body): Suppressed unused local variables. (patch_loop_statement): Likewise. (patch_exit): Fixed lang_printable_name invocation. (patch_switch_statement): Likewise. (case_identity): First argument marked unused. (patch_try_statement): Fixed lang_printable_name invocations. (patch_synchronized_statement, patch_throw_statement): Likewise. (check_thrown_exceptions): Fixed check_thrown_exceptions and lang_printable_name invocations. (check_thrown_exceptions_do): Suppressed unused argument. Suppresses warnings during the compilation of parse.y (including lex.c) and lang.c From-SVN: r23090
1998-09-06Initial revisionAnthony Green1-0/+512
From-SVN: r22299