aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/spew.c
AgeCommit message (Collapse)AuthorFilesLines
2002-12-30parse.y: Remove.Mark Mitchell1-1551/+0
* parse.y: Remove. * spew.c: Likewise. * Make-lang.in (gt-cp-spew.h): Remove. * cp-tree.h (do_pending_lang_change): Remove. (do_identifier): Change prototype. (finish_id_expr): Remove. * decl.c (lookup_name_real): Remove yylex variable. * decl2.c (build_expr_from_tree): Adjust call to do_identifier. * lex.c (init_cpp_parse): Remove. (reduce_cmp): Likewise. (token_cmp): Likewise. (yychar): Likewise. (lastiddecl): Likewise. (token_count): Likewise. (reduce_count): Likewise. (yyhook): Likewise. (print_parse_statistics): Likewise. (do_pending_lang_change): Likewise. (do_identifier): Remove parsing parameter. * lex.h (lastiddecl): Remove. (looking_for_typename): Remove. (looking_for_template): Likewise. (pending_lang_change): Likewise. (yylex): Likewise. * semantics.c (finish_id_expr): Remove. From-SVN: r60642
2002-12-28Make-lang.in (po-generated): Remove parse.c.Mark Mitchell1-1/+0
* Make-lang.in (po-generated): Remove parse.c. (CXX_OBJS): Remove parse.o and spew.o. Add parser.o. ($(srcdir)/cp/parse.h): Remove target. ($(srcdir)/cp/parse.c): Likewise. (gt-cp-parse.h): Likewise. (gt-cp-parser.h): New target. (c++.distclean): Do not remove parse.output. (c++.maintainer-clean): Do not remove parse.c or parse.h. (cp/spew.o): Remove target. (cp/lex.o): Adjust dependencies. (cp/pt.o): Likewise. (cp/parse.o): Likewise. (cp/TAGS): Do not mention parse.c. (cp/parser.o): New target. * NEWS: Mention the new parser. * call.c (build_scoped_method_call): Simplify. (build_method_call): Likewise. (build_new_function_call): Adjust calls to add_function_candidate and add_template_candidate. (build_new_op): Improve handling of erroroneous operands. (convert_default_arg): Remove circular argument processing. (name_as_c_string): New function. (build_new_method_call): Use it. (perform_implicit_conversion): Use error_operand_p. * class.c (finish_struct_anon): Use constructor_name_p. (check_field_decls): Likewise. (pop_nested_class): Use OVL_NEXT, not OVL_CHAIN. (resolve_address_of_overloaded_function): Likewise. (instantiate_type): Tweak pointer-to-member handling. (get_primary_binfo): Remove incorrect assertion. * config-lang.in (gtfiles): Add parser.c, remove parse.c. * cp-tree.h (DEFARG_TOKENS): New macro. (default_arg): New structure. (cp_tree_node_structure_enum): Add TS_CP_DEFAULT_ARG. (lang_tree_node): Add default_arg. (cp_tree_index): Add CPTI_TYPE_INFO_REF_TYPE. (type_info_ref_type): New macro. (saved_scope): Make processing_explicit_instantiation a boolean. (check_access): New field. (unparsed_text): Remove. (language_function): Remove unparsed_inlines. (error_operand_p): New macro. (lang_decl): Adjust pending_inline_info. (DEFARG_POINTER): Remove. (tag_types): Add typenames. (lookup_ualified_name): Declare. (lookup_name_real): Likewise. (shadow_tag): Adjust prototype. (get_scope_of_declarator): Declare it. (process_next_inline): Remove it. (check_for_missing_semicolon): Likewise. (maybe_get_template_decl_from_type_decl): Declare it. (finish_label_stmt): Adjust prototype. (finish_non_static_data_meber): Declare it. (finish_pseudo_destructor_call_expr): Rename to ... (finish_pseudo_destructor_expr): ... this. (finish_compound_literal): Declare it. (begin_inline_definitions): Remove it. (init_spew): Remove. (peekyylex): Likewise. (arbitrate_lookup): Likewise. (frob_opname): Likewise. (maybe_snarf_defarg): Likewise. (add_defarg_fn): Likewise. (do_pending_defargs): Likewise. (done_pending_defargs): Likewise. (unprocessed_defarg_fn): Likewise. (replace_defarg): Likewise. (end_input): Likewise. (get_overloaded_fn): Likewise. * cvt.c (convert_to_reference): Improve error handling. * decl.c (lookup_name_real): Do not declare it static. (maybe_push_to_top_level): Set check_access. (identifier_type_value): Adjust call to lookup_name_real. (lookup_qualified_name): New method. (lookup_name_real): Remove special-case parsing code. (lookup_name-nonclass): Adjust call to lookup_name_real. (lookup_name_namespace_only): Likewise. (lookup_name): Likewise. (check_tag_decl): Return the type declared. (shadow_tag): Likewise. (register_dtor_fn): Tweak check_access. (grokfndecl): Use constructor_name_p. (get_scope_of_declarator): New function. (grokdeclarator): Obscure tweaks for slightly different declarator representations. (start_method): Return error_mark_node to indicate failure. (cp_tree_node_structure_enum): Use TS_CP_DEFAULT_ARG for DEFAULT_ARGs. * decl2.c (constructor_name_full): Simplify. (constructor_name): Use it. (build_expr_from_tree): Adjust for changes to do new parser. (push_scope): Improve robustness. (validate_nonmember_using_decl): Process declarations, not names. (do_class_using_decl): Likewise. (handle_class_head): Do not mess with CLASSTYPE_DECLARED_CLASS here. * error.c (dump_expr): Handle IDENTIFIER_NODEs and BASELINKs. * expr.c (cxx_expand_expr): Handle BASELINKs. * init.c (member_init_ok_or_else): Issue more errors. (build_offset_ref): Tweak handling of FUNCTION_DECLs. * lex.c: Do not include parse.h. (yypring): Do not declare. (yylval): Likewise. (make_reference_declarator): Remove error-generating code. (rid_to_yy): Remove. (cxx_init): Do not call init_spew. (yypring): Remove. (check_for_missing_semicolon): Remove. * lex.h (got_scope): Remove. (got_object): Remove. * method.c (hack_identifier): Use finish_non_static_data_member. (implicitly_declare_fn): Adjust use of constructor_name. * parser.c: New file. * pt.c (parse.h): Do not include it. (maybe_get_template_decl_from_template): Do not declare it. (finish_member_template_decl): Tweak. (begin_explicit_instantiation): Adjust for processing_explicit_instantiation being boolean. (end_explicit_instantiation): Likewise. (maybe_process_partial_specialization): Tighten specialization test. (retrieve_local_specialization): Adjust ue of hash table. (eq_local_specializations): New function. (register_local_specialization): Likewise. (push_template_decl_real): Remove unnecessary test. (maybe_get_template_decl_from_type_decl): Don't make it static. (for_each_template_parm_r): Handle TYPEOF_TYPE. (tsubst_copy): Use retrieive_local_specialization to handle PARM_DECL. Adjust handling of CONST_DECLs. Handle BASELINKs. Handle COMPONENT_REFs with pseudo-destructor-expressions. Simplify handling of CALL_EXPR and METHOD_CALL_EXPR. (tsubst_expr): Pass decls, not names, to do_local_using_decl. (unify): Tweak handling of CONST_DECLs. (regenerate_decl_from_template): Use push_nested_class. (template_for_substitution): New funciton. (instantiate_decl): Use it. Register parameters as local specializations. * rtti.c (init_rtti_processing): Set type_info_ref_type. (build_typeid): Use it. (get_typeid): Likeise. * search.c (accessible_p): Use check_access, not flag_access_control. (adjust_result_of_qualified_name_lookup): Pay attention to the context_class. * semantics.c (finish_asm_stmt): Adjust error handling. (finish_label_stmt): Return the statement. (finish_non_static_data_member): New function. (finish_class_expr): Handle BASELINKs. (finish_call_expr): Handle PSEUDO_DTOR_EXPR. (finish_object_call_expr): Simplify handling during templates. (finish_pseudo_destructor_call_expr): Rename to ... (finish_pseudo_dtor_expr): ... this. (finish_compound_literal): New function. (begin_inline_definitions): Remove. (finish_sizeof): Remove special template handling. * spew.c: Do not include parse.h. * tree.c (get_overloaded_fn): Remove. * typeck.c (build_class_member_access_expr): Handle PSEUDO_DTOR_EXPR. Adjust handling of static member functions. (lookup_destructor): New function. (finish_class_member_access_expr): Use it. (convert_arguments): Simplify. (build_unary_op): Handle BASELINKs. From-SVN: r60560
2002-12-16Merge basic-improvements-branch to trunkZack Weinberg1-3/+6
From-SVN: r60174
2002-12-03re PR c++/8720 (ICE with bitwise or (3 operands))Mark Mitchell1-5/+7
PR c++/8720 * spew.c (remove_last_token): Make sure that last_chunk is set correctly. PR c++/8615 * error.c (dump_expr): Handle character constants with TREE_OVERFLOW set. PR c++/8720 * g++.dg/parse/defarg1.C: New test. PR c++/8615 * g++.dg/template/char1.C: New test. From-SVN: r59757
2002-10-23re PR c++/7679 (The compiler crashes wen a right parentesis is missing)Mark Mitchell1-2/+17
PR c++/7679 * spew.c (next_token): Do not return an endless stream of END_OF_SAVED_INPUT tokens. (snarf_method): Add three END_OF_SAVED_INPUT tokens to the end of the cached token stream. (snarf_defarg): Likewise. PR c++/7679 * g++.dg/parse/inline1.C: New test. From-SVN: r58465
2002-10-22re PR c++/6579 (Infinite loop with statement expressions in member ↵Mark Mitchell1-0/+27
initialization) PR c++/6579 * spew.c (snarf_parenthesized_expression): New function. (snarf_block): Use it. PR c++/6579 * g++.dg/parse/stmtexpr3.C: New test. From-SVN: r58427
2002-09-21ChangeLog: Follow spelling conventions.Kazu Hirata1-1/+1
* ChangeLog: Follow spelling conventions. * ChangeLog.2: Likewise. * call.c: Likewise. * class.c: Likewise. * cp-tree.h: Likewise. * cvt.c: Likewise. * decl.c: Likewise. * decl2.c: Likewise. * except.c: Likewise. * friend.c: Likewise. * g++spec.c: Likewise. * init.c: Likewise. * lex.c: Likewise. * mangle.c: Likewise. * method.c: Likewise. * operators.def: Likewise. * optimize.c: Likewise. * pt.c: Likewise. * rtti.c: Likewise. * search.c: Likewise. * semantics.c: Likewise. * spew.c: Likewise. * tree.c: Likewise. * typeck.c: Likewise. From-SVN: r57387
2002-09-14error.c: Fix comment formatting.Kazu Hirata1-7/+7
* error.c: Fix comment formatting. * except.c: Likewise. * expr.c: Likewise. * friend.c: Likewise. * g++spec.c: Likewise. * init.c: Likewise. * lex.c: Likewise. * mangle.c: Likewise. * method.c: Likewise. * optimize.c: Likewise. * pt.c: Likewise. * rtti.c: Likewise. * search.c: Likewise. * semantics.c: Likewise. * spew.c: Likewise. * tree.c: Likewise. * typeck.c: Likewise. * typeck2.c: Likewise. From-SVN: r57138
2002-08-08Rework build_component_ref.Mark Mitchell1-2/+2
* call.c (build_vfield_ref): Do not go through build_component_ref. (build_field_call): Use build_class_member_access_expr. (build_user_type_conversion_1): Use BASELINK_FUNCTIONS. (build_object_call): Likewise. * class.c (convert_to_base): New function. (type_requires_array_cookie): Use BASELINK_FUNCTIONS. (instantiate_type): Handle BASELINKs. * cp-tree.def (BASELINK): New tree code. * cp-tree.h (BASELINK_P): Reimplement. (SET_BASELINK_P): Remove. (BASELINK_BINFO): Reimplement. (BASELINK_FUNCTIONS): Likewise. (BASELINK_ACCESS_BINFO): Likewise. (BASELINK_OPTYPE): Likewise. (convert_to_base): New function. (name_p): Likewise. (build_object_ref): Remove. (build_component_ref_1): Likewise. (build_component_ref): Likewise. (build_x_component_ref): Likewise. (build_class_member_access_expr): New function. (finish_class_member_access_expr): Likewise. (build_ptrmemfunc_access_expr): Likewise. * decl.c (grokdeclarator): Handle BASELINKs. * decl2. (build_expr_from_tree): Handle COMPONENT_REFs by using finish_class_member_access_expr. (arg_assoc): Handle BASELINKs. (do_class_using_decl): Likewise. * error.c (dump_decl): Likewise. (dump_expr): Use build_ptrmemfunc_access_expr. * except.c (dtor_nothrow): Use CLASSTYPE_DESTRUCTORS to find destructors. (build_throw): Use BASELINK_FUNCTIONS. * init.c (perform_member_init): Use build_class_member_access_expr. (build_offset_ref): Handle BASELINKs. Use build_class_member_access_expr. * method.c (hack_identifier): Likewise. * parse.y (do_id): Use BASELINK, not TREE_LIST. (primary): Remove uses of build_object_ref. * pt.c (lookup_template_function): Handle BASELINKs. (resolve_overloaded_unification): Likewise. * search.c (build_baselink): Build a BASELINK, not a TREE_LIST. (lookup_field): Use BASELINK, not TREE_LIST. (lookup_fnfiels): Likewise. (setup_class_bindings): Likewise. * semantics.c (finish_object_call_expr): Do not use build_method_call when we already know what function is being called. * spew.c (identifier_type): Use BASELINK, not TREE_LIST. * tree.c (really_overloaded_fn): Use OVL_CHAIN for OVERLOADs, not TREE_CHAIN. (name_p): New function. * typeck.c (build_object_ref): Remove. (build_component_ref_1): Likewise. (build_x_component_ref): Likewise. (build_class_member_access_expr): New function. (finish_class_member_access_expr): Likewise. (build_ptrmemfunc_access_expr): Likewise. (get_member_function_from_ptrfunc): Use build_ptrmemfunc_access_expr. (build_binary_op): Likewise. (build_unary_op): Likewise. (build_ptrmemfunc): Likewise. (pfn_from_ptrmemfunc): Likewise. * typeck2.c (build_m_component_ref): Adjust comment. * g++.dg/abi/offsetof.C: Tweak error messages. * g++.old-deja/g++.mike/p10769a.C: Likewise. From-SVN: r56117
2002-07-29spew.c (space_for_token): Allocate zeroed memory for a new token chunk.Richard Earnshaw1-1/+1
* spew.c (space_for_token): Allocate zeroed memory for a new token chunk. From-SVN: r55834
2002-07-26c-common.h (RID_AND, [...]): Remove.Neil Booth1-17/+2
* c-common.h (RID_AND, RID_AND_EQ, RID_NOT, RID_NOT_EQ, RID_OR, RID_OR_EQ, RID_XOR, RID_XOR_EQ, RID_BITAND, RID_BITOR, RID_COMPL): Remove. * c-parse.in (rid_to_yy): Similarly. cp: * cp-tree.h (flag_operator_names): Remove. * decl2.c (flag_operator_names): Remove. (lang_f_options): Remove operator-names. * lex.c (D_OPNAME): Remove. (reswords): Remove operator names. (rid_to_yy): Remove operator names. (init_reswords): No need to handle D_OPNAME. * spew.c (read_process_identifier): There are no operator names. From-SVN: r55777
2002-07-20spew.c (struct uinparsed_test): Replace 'filename' and 'lineno' members with ↵Gabriel Dos Reis1-33/+26
'locus'. * spew.c (struct uinparsed_test): Replace 'filename' and 'lineno' members with 'locus'. Adjust use throughout. (struct feed): Likewise. (alloc_unparsed_test): Change prototype, take a 'const location_t *'. Adjust use. (snarf_defarg): Use error(), not error_with_file_and_line(). From-SVN: r55610
2002-06-20utils.c (init_gigi_decls): Use ARRAY_SIZE in lieu of explicit array size ↵Kaveh R. Ghazi1-1/+1
calculation. ada: * utils.c (init_gigi_decls): Use ARRAY_SIZE in lieu of explicit array size calculation. gcc: * c-decl.c (c_decode_option): Use ARRAY_SIZE in lieu of explicit array size calculation. * gengtype.c (NUM_BASE_FILES, create_file, write_gc_root): Likewise. cp: * spew.c (remove_last_token): Use ARRAY_SIZE in lieu of explicit array size calculation. From-SVN: r54842
2002-06-20c-parse.in (initelt: identifier ':' initval): Add an empty action to fix a ↵Akim Demaille1-40/+41
type clash. 2002-06-19 Akim Demaille <akim@epita.fr> * c-parse.in (initelt: identifier ':' initval): Add an empty action to fix a type clash. (aliasdecl, classdef): Add the missing closing `;'. Whitespace changes. * gengtype-yacc.y (typedef_struct): Add an empty action to preevnt $$ = $1 type clashes. cp: * parse.y (TYPENAME): Rename as tTYPENAME to avoid the clash with decl.h's TYPENAME. * spew.c, lex.c: Adjust. * parse.y (explicit_instantiation): Add empty action to override the default $$ = $1 where it introduces a type clash. From-SVN: r54811
2002-06-04Merge from pch-branch up to tag pch-commit-20020603.Geoffrey Keating1-155/+148
From-SVN: r54232
2002-05-25Makefile.in (C_COMMON_H): Fix.Neil Booth1-1/+1
* Makefile.in (C_COMMON_H): Fix. Update other targets. * c-common.c: Don't include c-lex.h. (builtin_define_with_value): Make static and prototype. (builtin_define_std): Move from c-lex.h. * c-common.h (init_c_lex): Move from c-lex.h. * c-decl.c: Don't include c-lex.h. (make_pointer_declarator): Move from c-parse.in. * c-lex.c: Don't include c-lex.h. * c-lex.h: Remove. * c-parse.in: Don't include c-lex.h; include c-pragma.h. (make_pointer_declarator): Move to c-decl.c. * c-pragma.c: Don't include c-lex.h. * c-pragma.h (yydebug, YYDEBUG, parse_in, c_lex): Move from c-lex.h. * c-tree.h (make_pointer_declarator): New. cp: * lex.c: Don't include c-lex.h. * parse.y, spew.c: Don't include c-lex.h; include c-pragma.h. doc: * passes.texi, tm.texi: Update. objc: * Make-lang.in: Update and correct. * objc-act.c: Don't include c-lex.h or cpplib.h. treelang: * treetree.c: Don't include c-lex.h. config: * darwin-c.c: Don't include c-lex.h. * c4x/c4x-c.c: Don't include c-lex.h. * c4x/t-c4x: Update. * i370/i370-c.c: Don't include c-lex.h. * i370/t-i370: Update. * i960/i960-c.c: Don't include c-lex.h. * i960/i960.c: Don't include cpplib.h, c-lex.h or c-pragma.h. * i960/t-960bare: Update. * i960/t-vxworks: Update. * rs6000/rs6000-c.c: Don't include c-lex.h; include c-pragma.h. * rs6000/t-darwin: Update. * rs6000/t-rs6000-c-rule: Update. * v850/v850-c.c: Don't include c-lex.h. * v850/v850.c: Don't include c-lex.h or cpplib.h. From-SVN: r53876
2002-05-23c-lex.c (indent_level): Remove.Neil Booth1-9/+1
* c-lex.c (indent_level): Remove. (cb_file_change, c_lex): Remove indent level handling. * c-lex.h (indent_level): Remove. * input.h (struct file_stack): Remove indent_level. * toplev.c (push_srcloc): Remove indent_level handling. cp: * spew.c (yyungetc, snarf_block): Remove indent_level handling. From-SVN: r53786
2002-04-26c-common.c (fix_string_type): Split out of ...Richard Henderson1-1/+39
* c-common.c (fix_string_type): Split out of ... (combine_strings): ... here. Take a varray, not a tree list. (c_expand_builtin_printf): Use fix_string_type. * c-common.h: Update decls. * c-parse.in (string): Remove. Update all uses to use STRING instead, and not call combine_strings. (yylexstring): New. (_yylex): Use it. * c-typeck.c (simple_asm_stmt): Don't call combine_strings. (build_asm_stmt): Likewise. * objc/objc-act.c (my_build_string): Use fix_string_type. (build_objc_string_object): Build varray for combine_strings. * parse.y (string): Remove. Update all uses to use STRING instead, and not call combine_strings. * rtti.c (tinfo_name): Use fix_string_type. * semantics.c (finish_asm_stmt): Don't call combine_strings. * spew.c (yylexstring): New. (read_token): Use it. * g++.dg/parse/concat1.C: New. * gcc.dg/concat2.c: New. From-SVN: r52790
2002-02-04xref.c: Remove.Jason Merrill1-5/+0
* xref.c: Remove. * Make-lang.in (CXX_OBJS): Remove cp/xref.o (cp/xref.o): Remove dependencies. * class.c (finish_struct_1, check_methods): Don't call xref fns. (finish_struct_1): Likewise. * friend.c (make_friend_class): Likewise. * lex.c (cxx_init, cxx_finish, extract_interface_info): Likewise. * spew.c (read_process_identifier): Likewise. From-SVN: r49472
2002-01-23spew.c (pending_inlines, [...]): Make static.Jakub Jelinek1-8/+13
* spew.c (pending_inlines, pending_inlines_tail, processing_these_inlines): Make static. (mark_pending_inlines): Remove static. (begin_parsing_inclass_inline): If in function, save pi for GC to cp_function_chain->unparsed_inlines instead. (process_next_inline): Likewise. * cp-tree.h (struct cp_language_function): Add unparsed_inlines. (mark_pending_inlines): Add prototype. * decl.c (spew_debug): Remove unused extern. (mark_lang_function): Call mark_pending_inlines. * g++.dg/other/gc1.C: New test. From-SVN: r49147
2002-01-23call.c, [...]: Change my_fancy_abort() to abort().Craig Rodrigues1-2/+2
2002-01-23 Craig Rodrigues <rodrigc@gcc.gnu.org> * call.c, class.c, decl.c, decl2.c, error.c, expr.c, friend.c, init.c, lex.c, mangle.c, method.c, pt.c, repo.c, rtti.c, search.c, semantics.c, spew.c, tree.c, typeck.c, typeck2.c, xref.c: Change my_fancy_abort() to abort(). From-SVN: r49139
2002-01-10spew.c (YYCHAR): Uppercase macro parameter and add parenthesis.Graham Stott1-4/+4
* spew.c (YYCHAR): Uppercase macro parameter and add parenthesis. (YYCODE): Likewise. (NAME): Uppercase macro parameter. From-SVN: r48717
2001-12-18cp-tree.h: Delete #defines for cp_error, cp_warning, cp_pedwarn, and ↵Zack Weinberg1-1/+1
cp_compiler_error. * cp-tree.h: Delete #defines for cp_error, cp_warning, cp_pedwarn, and cp_compiler_error. * call.c, class.c, cp-tree.h, cvt.c, decl.c, decl2.c, error.c, except.c, friend.c, init.c, lex.c, method.c, parse.y, pt.c, rtti.c, search.c, semantics.c, spew.c, tree.c, typeck.c, typeck2.c: Change calls to the above macros to use their language-independent equivalents: error, warning, pedwarn, and internal_error respectively. From-SVN: r48140
2001-12-12cp-tree.h (DESTRUCTOR_DECL_PREFIX, [...]): Delete.Jakub Jelinek1-5/+2
* cp-tree.h (DESTRUCTOR_DECL_PREFIX, DESTRUCTOR_NAME_P, ANON_PARMNAME_FORMAT, ANON_PARMNAME_P, DESTRUCTOR_NAME_FORMAT, THIS_NAME_P): Delete. * spew.c (read_process_identifier): Remove DESTRUCTOR_NAME_P, THIS_NAME_P and ANON_PARMNAME_P tests from warning about clash with internal naming scheme. * error.c (dump_decl): Remove DESTRUCTOR_NAME_P use. From-SVN: r47936
2001-11-15c-common.c: Include c-lex.h.Neil Booth1-1/+1
* c-common.c: Include c-lex.h. (c_common_lang_init): Change prototype. Call init_c_lex and init_pragma from here. * c-common.h (c_common_lang_init): Change prototype. * c-decl.c (init_decl_processing): Rename. Call c_parse_init. * c-lang.c (c_init): Change prototype. Update. (c_init_options): Update. * c-lex.c (cpp_filename): Remove. (init_c_lex): Update. Read the main file, and get the original file name. (yyparse): Finish the command line options. * c-parse.in (c_parse_init): Call init_reswords here. (init_parse): Remove. * c-tree.h (c_init_decl_processing): New. * cpphash.c (_cpp_init_hashtable): After initializing the hash table, populate it. * cppinit.c (read_original_filename, cpp_finish_options): New. (cpp_create_reader): New prototype. Defer hash table initialization. (cpp_start_read): Rename cpp_read_main_file. Initialize the hash table. Get the original filename. * cpplib.h (cpp_create_reader): Update. (cpp_start_read): Remove. (cpp_read_main_file, cpp_finish_options): New. * cppmain.c (main, do_preprocessing): Update. * langhooks.h (struct langhooks): Update init prototype. * toplev.c (general_init, parse_options_and_default_flags, process_options, lang_indpendent_init, lang_dependent_init, init_asm_output): New; perform the bulk of initialization. (compile_file): Move most of initialization to above functions. (debug_hooks): Initialize statically. (set_Wunused): Relocate. (toplev_main): Move most of initialization to other init functions. Have a clear logic flow. * tree.h (init_parse, init_decl_processing): Remove. ada: * misc.c (gnat_init): Change prototype. Include the functionality of the old init_parse and init_decl_processing. (gnat_init_decl_processing): New prototype. (init_parse): Remove. * utils.c (init_decl_processing): Rename gnat_init_decl_processing. cp: * cp-tree.h (init_reswords, cxx_init_decl_processing): New. (cxx_init): Update prototype. * decl.c (init_decl_processing): Rename. Move null node init to its creation time. * lex.c (cxx_init_options): Update. (cxx_init): Combine with old init_parse; also call cxx_init_decl_processing. f: * com.c (ffecom_init_decl_processing): Renamed from init_decl_processing. (init_parse): Move contents to ffe_init. (ffe_init): Update prototype. java: * decl.c (init_decl_processing): Rename java_init_decl_processing. * java-tree.h: New prototype. * lang.c (java_init): Update prototype. Combine with old init_parse. objc: * objc-act.c (objc_init): Update prototype, combine with old init_parse. (objc_init_options): Update. From-SVN: r47046
2001-10-28ChangeLog.1, [...]: Fix spelling errors.Joseph Myers1-1/+1
* ChangeLog.1, ChangeLog.2, ChangeLog, class.c, decl2.c, search.c, semantics.c, spew.c: Fix spelling errors. From-SVN: r46593
2001-10-02spew.c (end_input): No longer static.Jason Merrill1-3/+2
* spew.c (end_input): No longer static. * cp-tree.h: Declare it. * parse.y (datadef): Add "error END_OF_SAVED_INPUT" expansion. From-SVN: r45962
2001-09-12decl2.c (lang_f_options): Const-ification.Kaveh R. Ghazi1-1/+1
* decl2.c (lang_f_options): Const-ification. * lex.c (cplus_tree_code_name): Likewise. * spew.c (yyerror): Likewise. From-SVN: r45565
2001-08-04Makefile.in (CPPLIB_H): New, so that dependencies on cpplib.h are also on ↵Neil Booth1-2/+0
line-map.h. * Makefile.in (CPPLIB_H): New, so that dependencies on cpplib.h are also on line-map.h. * cppfiles.c (stack_include_file): Update. * cpphash.h (struct cpp_buffer): New member return_at_eof. (_cpp_pop_buffer): New. * cppinit.c (cpp_destroy, cpp_finish): Update. (do_includes): Mark each buffer to return at EOF. * cpplex.c (_cpp_lex_token): Pop buffers at EOF. Continue or return as requested. * cpplib.c (run_directive, do_line, cpp_push_buffer): Update. (cpp_pop_buffer): Rename _cpp_pop_buffer. Stop skipping. * cpplib.h (cpp_pop_buffer): Remove. (cpp_scan_buffer_nooutput): Rename cpp_scan_nooutput. * cppmacro.c (cpp_scan_buffer_nooutput): Similarly. No need to pop buffers. * cppmain.c (scan_buffer): Rename scan_translation_unit. No need to pop buffers. (do_preprocessing): Update. * fix-header.c (read_scan_file): Update. No need to pop buffers. * c-parse.in (_yylex): Similarly. * scan-decls.c (scan_decls): Similarly. * line-map.h: Update comments. * cp/spew.c (read_token): No need to pop buffers. * objc/Make-lang.in (objc-act.o): Update dependencies. From-SVN: r44634
2001-07-26spew.c (yylex): Only copy the token's lineno, if it is non-zero.Nathan Sidwell1-2/+7
cp: * spew.c (yylex): Only copy the token's lineno, if it is non-zero. testsuite: * g++.old-deja/g++.other/lineno5.C: New test. From-SVN: r44391
2001-07-19c-lex.c (c_lex): Remove CPP_INT, CPP_FLOAT cases.Neil Booth1-5/+1
* c-lex.c (c_lex): Remove CPP_INT, CPP_FLOAT cases. * c-parse.in (yyerror, _yylex): Similarly. * cppexp.c (parse_number, parse_defined, lex, _cpp_parse_expr): Don't use CPP_INT, CPP_FLOAT; CPP_NUMBER is enough. Update comments. * cpplib.h (CPP_INT, CPP_FLOAT): Remove. * cp/spew.c (read_token, yyerror): Remove CPP_INT, CPP_FLOAT cases. From-SVN: r44144
2001-05-16spew.c (read_token): Call yyerror on all unexpected tokens.Nathan Sidwell1-8/+3
cp: * spew.c (read_token): Call yyerror on all unexpected tokens. testsuite: * g++.old-deja/g++.other/crash41.C: New test. From-SVN: r42143
2001-05-01spew.c (last_token_id): New static variable.Nathan Sidwell1-4/+8
cp: * spew.c (last_token_id): New static variable. (read_token): Set it here. (yyerror): Use it here. From-SVN: r41719
2001-04-26invoke.texi: Document more C++ command-line options.Mark Mitchell1-6/+1
* invoke.texi: Document more C++ command-line options. Remove support for -Wextern-inline, -flabels-ok, -fvtable-gc, -fxref * cp-tree.h (warn_extern_inline): Remove. (flag_labels_ok): Likewise. * decl2.c (warn_extern_inline): Remove. (flag_labels_ok): Likewise. (lang_f_options): Remove labels-ok, vtable-gc, xref. (unsupported_options): Add them. (cxx_decode_option): Don't accept -Wextern-inline. * method.c (hack_identifier): Remove -flabels-ok support. * spew.c (see_typename): Likewise. * g++.dg/vtgc1.C: XFAIL. * g++.old-deja/g++.other/crash18.C: Likewise. From-SVN: r41609
2001-03-07c-parse.in (yylexname): New function, split out of _yylex.Zack Weinberg1-5/+1
* c-parse.in (yylexname): New function, split out of _yylex. (objc_rid_sans_at): New table. (init_reswords): Initialize it. (_yylex): Give labels clearer names. Handle CPP_ATSIGN by retrieving the next token and checking it for significance as an ObjC keyword or string constant. * cpplex.c (_cpp_lex_token): Just return CPP_ATSIGN for '@'. * cpplib.h (TTYPE_TABLE): Add CPP_ATSIGN, drop CPP_OSTRING. * c-lex.c, c-parse.in, cppmacro.c, cpplex.c, cp/spew.c: Remove references to CPP_OSTRING. From-SVN: r40279
2001-02-23* spew.c (yylex): Correct handling of friends.Mark Mitchell1-3/+7
From-SVN: r39990
2001-01-13c-lex.c (init_c_lex): Use cpp_get_callbacks to set callbacks.Neil Booth1-2/+1
* c-lex.c (init_c_lex): Use cpp_get_callbacks to set callbacks. * c-parse.in (finish_parse): Use cpp_errors. (__yylex): Use return value of cpp_pop_buffer. * cp/lex.c (finish_parse): Use cpp_errors. * cp/spew.c (read_token): Use return value of cpp_pop_buffer. From-SVN: r38982
2001-01-11call.c (convert_default_arg): Check for unprocessed DEFAULT_ARG.Nathan Sidwell1-8/+113
cp: * call.c (convert_default_arg): Check for unprocessed DEFAULT_ARG. * cp-tree.h (replace_defarg): Move to spew.c. (maybe_snarf_defarg, add_defarg_fn, do_pending_defargs): Move to spew.c, which is where they really are. (done_pending_defargs): Declare. (unprocessed_defarg_fn): Declare. * decl.c (replace_defarg): Move to spew.c * parse.y (structsp): Call done_pending_defargs. * spew.c (defarg_fns): Rearrange list structure. (defarg_fnsdone): New static variable. (defarg_depfns): New static variable. (init_spew): Adjust. (add_defarg_fn): Store the type in TREE_TYPE. (do_pending_defargs): Detect and deal with ordering constraints and circularity. (done_pending_defargs): New function. (unprocessed_defarg_fn): New function. (replace_defarg): Moved from decl.c. Robustify. Don't save if circularity detected. testsuite: * g++.old-deja/g++.other/defarg7.C: New test. * g++.old-deja/g++.other/defarg8.C: New test. From-SVN: r38903
2000-11-28c-lex.h (parse_in): Change parse_in to a cpp_reader *.Neil Booth1-2/+2
* c-lex.h (parse_in): Change parse_in to a cpp_reader *. * c-decl.c (c_decode_option): Update to match. * c-lex.c (init_c_lex, yyparse): Update to match. * c-lang.c (lang_init_options): Use cpp_create_reader. * cppinit.c (cpp_init): Rename initialize. (cpp_reader_init): Rename cpp_create_reader. Create the reader. Initialize cpplib if appropriate. * cpplib.h (cpp_create_reader) New prototype. (cpp_init, cpp_reader_init): Delete prototypes. * cppmain.c (general_init, setup_callbacks): New functions. (main): Use them. * fix-header.c (scan_in): Change type to cpp_reader *. (read_scan_file): Update for new cpplib interface and scan_in type. * cp/decl.c (parse_in): Change to cpp_reader *. (lang_decode_option): Update. * cp/lex.c (lang_init_options): Use new cpplib interface. (init_cp_pragma, finish_parse, handle_pragma_implementation): Update. * cp/spew.c (read_token): Update. * objc/objc-act.c (lang_init_options): Update new cpplib interface. From-SVN: r37826
2000-11-28spew.c (yyerror): Cope if yylval.ttype is NULL.Nathan Sidwell1-4/+8
cp: * spew.c (yyerror): Cope if yylval.ttype is NULL. testsuite: * g++.old-deja/g++.other/parse2.C: New test. From-SVN: r37816
2000-11-26Makefile.in: Remove MAYBE_CPPLIB and maybe_cpplib.Neil Booth1-2/+0
* Makefile.in: Remove MAYBE_CPPLIB and maybe_cpplib. * c-decl.c: Remove parse_in declaration. * c-lang.c: Similarly. * c-lex.c: Similarly. * c-parse.in: Similarly. * c-pragma.c: Similarly. * configure.in: Similarly. * cp/Make-lang.in: Similarly. * cp/spew.c: Similarly. * cp/decl2.c: Remove check for lang-c++ option. * cp/lang-specs.h: Remove -lang-c++ from cc1plus command line. * cp/lex.c (lang_init_options): With cpp_reader_init, default to C++. * c-lex.h: Add declaration of parse_in. * cppinit.c: Call set_lang after allocating pfile->pending. * configure: Regenerate. From-SVN: r37754
2000-11-25c-common.c: Remove USE_CPPLIB conditional inclusions.Neil Booth1-14/+0
* c-common.c: Remove USE_CPPLIB conditional inclusions. * c-common.h: Similarly. * c-decl.c: Similarly. * c-lang.c: Similarly. * c-lex.c: Similarly. * c-parse.in: Similarly. * c-pragma.c: Similarly. * c-pragma.h: Similarly. * gcc.c: Similarly. * toplev.c: Similarly. * cp/cp-tree.h: Similarly. * cp/decl2.c: Similarly. * cp/lang-specs.h: Similarly. * cp/lex.c: Similarly. * cp/lex.h: Similarly. * cp/spew.c: Similarly. * java/lang-options.h: Similarly. * objc/lang-specs.h: Similarly. * objc/objc-act.c: Similarly. * configure.in: Remove configure option. * config.in: Regenerate. * configure: Regenerate. From-SVN: r37742
2000-11-20lex.c (rid_to_yy, RID_EXPORT): Make unique keyword.Nathan Sidwell1-11/+0
cp: * lex.c (rid_to_yy, RID_EXPORT): Make unique keyword. * parse.y (extdef): Add EXPORT reduction. * spew.c (yylex): Don't skip export here. testsuite: * g++.old-deja/g++.pt/export1.C: New test. From-SVN: r37585
2000-11-09lex.c (do_identifier): Don't lookup_name for operators.Nathan Sidwell1-1/+2
gcp/ChangeLog: * lex.c (do_identifier): Don't lookup_name for operators. * parse.y (operator): Save looking_for_typename. (unoperator): Restore it. * spew.c (frob_opname): Use nth_token for lookahead. testsuite/ChangeLog: * g++.old-deja/g++.pt/operator1.C: New test. From-SVN: r37340
2000-11-01c-parse.in (_yylex): Remove CPP_BACKSLASH case.Neil Booth1-4/+0
* c-parse.in (_yylex): Remove CPP_BACKSLASH case. * cp/spew.c: Similarly. * cpplex.c (_cpp_lex_token): Backslashes are now CPP_OTHER. * cppmacro.c (stringify_arg): Similarly. * cpplib.h (CPP_BACKSLASH): Delete. From-SVN: r37182
2000-10-17* spew.c (snarf_defarg): Cast 2nd arg to obstack_blank to (int).Brad Lucier1-1/+1
From-SVN: r36921
2000-10-06pt.c (lookup_template_class): Set current access for enum.Nathan Sidwell1-1/+0
* pt.c (lookup_template_class): Set current access for enum. (tsubst_enum): Set file & line for enum decl. * spew.c (yylex): Remove unused variable. From-SVN: r36755
2000-10-05spew.c (frob_id): New static function.Nathan Sidwell1-50/+41
* spew.c (frob_id): New static function. (frob_opname): Use it. (yylex): Use it. From-SVN: r36719
2000-09-11cp-tree.h (frob_opname): Declare.Nathan Sidwell1-0/+36
* cp-tree.h (frob_opname): Declare. * parse.y (saved_scopes): New static variable. (cp_parse_init): Adjust. (do_id): If lastiddecl is NULL, do do_identifier. (operator): Save scope information. (unoperator): new reduction. Restore scope information. (operator_name): Append unoperator. Call frob_opname. * spew.c (frob_opname): Define. From-SVN: r36315
2000-09-07Integrated preprocessor.Zack Weinberg1-188/+1123
top level: * Makefile.in: Remove all references to c-parse.gperf, c-gperf.h, and c-parse.h. Remove -d from yacc command line generating c-parse.c. Update dependencies. * c-parse.gperf, c-gperf.h: Delete. * c-common.c: Don't define parse_options, cpp_token, yy_cur, yy_lim, or yy_get_token. Don't define get_directive_line if USE_CPPLIB. * c-common.h: Add multiple include guard. Define RID values for every keyword in C, C++, and Objective C. Put all the modifiers first. (struct c_fileinfo, get_fileinfo, dump_time_statistics): New. * c-decl.c (c_decode_option): Handle -lang-objc here. (print_lang_identifier): Handle C_IS_RESERVED_WORD case. (grokdeclarator): Adjust for new RID scheme. (extract_interface_info): New stub. * c-lang.c: Don't declare yy_cur or parse_options. (lang_init_options): Call cpp_init. Don't call cpp_options_init. (lang_init): Don't call check_newline if USE_CPPLIB. * c-lex.c: Don't include c-parse.h. Do include timevar.h. Elide lots of unnecessary code if USE_CPPLIB. Delete code rendered unnecessary by new architecture. Move routines not shared with C++ to c-parse.in. Maintain a local idea of the line number. Handle C++ as well as C. [USE_CPPLIB]: Declare and register callbacks for #ident and for entering/leaving files. (init_c_lex, c_lex): Are now the entry points to this file. (check_newline): Break out directive handling to process_directive. (read_ucs, is_extended_char, utf8_extend_token): Moved here from C++ front end. (readescape, parse_float): Overhaul. (lex_number, lex_string, lex_charconst): Break out of c_lex (n'ee yylex). (get_fileinfo, update_header_times, dump_one_header, dump_time_statistics): New and/or moved here from C++. Support per-file data needed by C++ and per-header timing statistics (C++ only, at the moment). * c-lex.h: Update prototypes. Add multiple include guard. * c-tree.h (struct lang_identifier): Add rid_code field. (C_IS_RESERVED_WORD, C_RID_CODE): New. * c-parse.in: Include c-pragma.h. Remove unnecesary calls to reinit_parse_for_function and/or position_after_white_space. (save_filename, save_lineno): Look ahead before saving. (label -> identifier ':'): Save file and line before shifting ':'. (reservedwords): No need to call get_identifier. (init_parse, finish_parse, yyerror, yylex, yyprint, make_pointer_declarator): Are now here for C/ObjC. (rid_to_yy): Conversion table from RID constants to Yacc codes. * c-pragma.c: Rewrite parsing logic to fit with cpplib's #pragma registry. Provide dummy implementation of that interface if !USE_CPPLIB. * c-pragma.h: Update to match. * flags.h: Add multiple include guard. (flag_detailed_statistics): Moved here from C++. * toplev.c: Define flag_detailed_statistics. * gcc.c (C specs): Use %(trad_capable_cpp) for -E|-M|-MM case #if USE_CPPLIB. * timevar.def (TV_CPP, TV_LEX): New. * timevar.h: Add multiple include guard. * objc/lang-specs.h: Use %(trad_capable_cpp) for -E|-M|-MM case #if USE_CPPLIB. * objc/objc-act.c: Don't mention yy_cur or parse_options. Initialize cpplib properly. Force lineno to 0 after first call to check_newline. Don't handle -lang-objc here. Move forget_protocol_qualifiers and remember_protocol_qualifiers here. cp: * Make-lang.in, Makefile.in: Remove all references to input.c, gxx.gperf, and hash.h. Add ../c-lex.o to C_OBJS. * gxx.gperf, hash.h, input.c: Delete. * lang-specs.h: Pass -lang-c++ to cc1plus so cpplib is initialized properly. * class.c (fixup_pending_inline): Take a tree, not a struct pending_inline *. All callers changed. (init_class_processing): Set RID_PUBLIC, RID_PRIVATE, RID_PROTECTED entries in ridpointers[] array here. * decl.c (duplicate_decls): Do not refer to struct pending_inline. (record_builtin_type, init_decl_processing): Use RID_MAX not CP_RID_MAX. (grokdeclarator): Use C_IS_RESERVED_WORD. * decl2.c (lang_decode_option): Ignore -lang-c++ for sake of cpplib. (grok_x_components): Do not inspect pending_inlines chain. * cp-tree.h (struct lang_identifier): Add rid_code entry. (C_IS_RESERVED_WORD, C_RID_CODE, C_RID_YYCODE): New. (flag_no_gnu_keywords, flag_operator_names, rid_to_yy): Declare. (DEFARG_LENGTH, struct pending_inline, TIME_IDENTIFIER_TIME, TIME_IDENTIFIER_FILEINFO): Kill. Update prototypes. * lex.h: Expunge cp_rid. Rewrite RIDBIT macros to use just a single 32-bit word. * parse.y: Call do_pending_inlines unconditionally. reinit_parse_for_method is now snarf_method. fn.defpen is no longer necessary. Remove unnecessary <itype> annotation on SCOPE. Do not refer to end_of_file or struct pending_inline. * semantics.c (begin_inline_definitions): Call do_pending_inlines unconditionally. * lex.c: Remove all code now shared with C front end. Initialize cpplib properly if USE_CPPLIB. Put reserved words into the get_identifier table. Rewrite pragma handling to work with the registry. Move code to save tokens for later processing to spew.c. * spew.c: Rewrite everything in terms of token streams instead of text. Move routines here from lex.c / input.c as appropriate. GC-mark trees hanging off the pending inlines chain. testsuite: * g++.old-deja/g++.benjamin/13478.C: Put meaningful tags on ERROR markers. * g++.old-deja/g++.brendan/crash8.C: Move ERROR marker up one line. * gcc.dg/c99-array-nonobj-1.c: Don't expect func[] cases to fail. * gcc.dg/wtr-label-1.c: Don't use unconstrained .* in error regexps. * gcc.dg/wtr-suffix-1.c: Correct error regexps. * gcc.dg/cpp/unc1.c, gcc.dg/cpp/unc2.c, gcc.dg/cpp/unc3.c: Preprocess only. * gcc.dg/cpp/unc4.c: Adjust line number in dg-error line. * gcc.dg/noncompile/const-ll-1.c: Generalize error regexp. From-SVN: r36216