aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/parser.c
AgeCommit message (Collapse)AuthorFilesLines
2003-07-22fold-const.c (force_fit_type): Handle OFFSET_TYPE.Mark Mitchell1-11/+0
* fold-const.c (force_fit_type): Handle OFFSET_TYPE. * varasam.c (output_constant): Likewise. 2003-07-22 Mark Mitchell <mark@codesourcery.com> Eliminate use of POINTER_TYPE for pointers-to-members. * call.c (standard_conversion): Rework pointer-to-member handling. Add comments. (add_builtin_candidate): Likewise. (resolve_scoped_fn_name): Remove. (build_conditional_expr): Rework pointer-to-member handling. (compare_ics): Likewise. * class.c (check_field_decls): Use TYPE_PTR_P. * cp-lang.c (cp_var_mod_type_p): Rework pointer-to-member handling. * cp-tree.h (SCALAR_TYPE_P): Use TYPE_PTR_TO_MEMBER_P. (TYPE_PTRMEM_P): Add comment. (TYPE_PTR_P): Simplify. (TYPE_PTROB_P): Correct definition. (TYPE_PTR_TO_MEMBER_P): New macro. (TYPE_PTRMEM_CLASS_TYPE): Adjust. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (resolved_scoped_fn_name): Remove declaration. (build_offset_ref): Change prototype. (resolve_offset_ref): Remove. (comp_target_types): Remove. * cvt.c (cp_convert_to_pointer): Rework pointer-to-member handling. (convert_to_reference): Use can_convert. (ocp_convert): Improve error handling. Rework pointer-to-member handling. (perform_qualification_conversions): Rework pointer-to-member handling. * decl.c (build_ptrmem_type): Handle functions too. (create_array_type_for_decl): Remove OFFSET_TYPE error message. (grokdeclarator): Use OFFSET_TYPE for pointers to data members. (grokparms): Remove OFFSET_TYPE error message. * dump.c (cp_dump_tree): Rework pointer-to-member handling. * error.c (dump_type_prefix): Likewise. * expr.c (cplus_expand_constant): Use build_nop. * init.c (build_offset_ref): Add address_p parameter. Fold in necessary bits from resolve_offset_ref. (resolve_offset_ref): Remove. * parser.c (cp_parser_postfix_expression): Remove special case code for OFFSET_TYPE. * pt.c (convert_nontype_argument): Rework pointer-to-member handling. (convert_template_argument): Likewise. (unify): Likewise. (invalid_nontype_parm_type_p): Likewise. (dependent_type_p_r): Likewise. * rtti.c (get_tinfo_decl): Remove OFFSET_TYPE special case. (target_incomplete_p_): Rework pointer-to-member handling. (get_pseudo_ti_init): Likewise. (get_pseudo_ti_desc): Likewise. * semantics.c (finish_qualified_id_expr): Adjust call to build_offset_ref. Remove use of resolve_offset_ref. * tree.c (pod_type_p): Use TYPE_PTR_TO_MEMBER_P. * typeck.c (target_type): Use TYPE_PTRMEM_P. (type_unknown_p): Remove obsolete code about the time before non-dependent expressions were handled correctly. (qualify_type_recursive): Remove. (composite_pointer_type_r): New function. (composite_pointer_type): Use it. (merge_types): Remove dead comments. (comp_cv_target_types): Remove. (comp_target_types): Likewise. (comp_target_parms): Likewise. (cxx_sizeof_or_alignof_type): Remove OFFSET_TYPE error. (build_indirect_ref): Use TYPE_PTR_TO_MEMBER_P. (build_binary_op): Do not use of comp_target_types. (pointer_diff): Remove OFFSET_TYPE case. (build_unary_op): Adjust pointer-to-member handling. (unary_complex_lvalue): Likewise. (check_for_casting_away_constness): Add description parameter. (build_static_cast): Pass it. (build_reinterpret_cast): Use check_for_casting_away_constness. (build_const_cast): Adjust pointer-to-member handling. (build_c_cast): Likewise. (convert_for_assignment): Remove OFFSET_TYPE error message. (comp_ptr_ttypes_real): Adjust pointer-to-member handling. (comp_ptr_ttypes_reinterpret): Remove. (casts_away_constness_r): Adjust pointer-to-member handling. (casts_away_constness): Liekwise. (strip_all_pointer_quals): Remove. * typeck2.c (digest_init): Adjust pointer-to-member handling. (build_m_component_ref): Likewise. From-SVN: r69691
2003-07-19fixfixes.c [...]: Remove unnecessary casts.Kaveh R. Ghazi1-18/+14
gcc: * fixinc/fixfixes.c fixinc/fixincl.c fixinc/fixlib.c fixinc/server.c objc/objc-act.c: Remove unnecessary casts. f: * com.c data.c expr.c fini.c g77spec.c global.c lab.c lex.c name.c sta.c stc.c std.c storag.c stt.c stw.c symbol.c target.c type.c: Remove unnecessary casts. cp: * call.c class.c decl.c decl2.c g++spec.c lex.c parser.c pt.c rtti.c semantics.c typeck.c: Remove unnecessary casts. java: * class.c java-tree.h jcf-write.c jvspec.c: Remove unnecessary casts. treelang: * treetree.c: Remove unnecessary casts. From-SVN: r69593
2003-07-17re PR c++/11547 (ICE with const temporaries)Mark Mitchell1-82/+122
PR c++/11547 * cp-tree.h (DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P): New macro. (DECL_PRETTY_FUNCTION_P): Use VAR_DECL_CHECK. * decl.c (duplicate_decls): Merge DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P. * parser.c (cp_parser_postfix_expression): Adjust call to cp_parser_initializer_list and cp_parser_parenthesized_expression_list. (cp_parser_parenthesized_expression_list): Add non_constant_p. (cp_parser_new_placement): Adjust call to cp_parser_parenthesized_expression_list. (cp_parser_direct_new_declarator): Likewise. (cp_parser_conditional_expression): Remove. (cp_parser_constant_expression): Parse an assignment-expression, not a conditional-expression. (cp_parser_simple_declaration): Resolve expression/declaration ambiguity more quickly. (cp_parser_mem_initializer): Adjust call to cp_parser_parenthesized_expression_list. (cp_parser_init_declarator): Keep track of whether or not the initializer is a constant-expression. (cp_parser_initializer): Add non_constant_p parameter. (cp_parser_initializer_clause): Likewise. (cp_parser_initializer_list): Likewise. (cp_parser_attribute_list): Adjust call to cp_parser_parenthesized_expression_list. (cp_parser_functional_cast): Likewise. * pt.c (tsubst_decl): Copy DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P. (tsubst_expr): Tweak use of DECL_PRETTY_FUNCTION_P. * semantics.c (finish_id_expression): Use DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P. PR c++/11547 * g++.dg/parse/constant3.C: New test. * g++.dg/parse/crash7.C: Likewise. From-SVN: r69493
2003-07-16cp-tree.def (LOOKUP_EXPR): Remove.Mark Mitchell1-1/+2
* cp-tree.def (LOOKUP_EXPR): Remove. * cp-tree.h (cp_id_kind): Add CP_ID_KIND_UNQUALIFIED_DEPENDENT. (LOOKUP_EXPR_GLOBAL): Remove. (get_bindings): Remove. (is_aggr_type_2): Remove. * call.c (resolved_scoped_fn_name): Remove support for LOOKUP_EXPR. * decl.c (grokfndecl): Likewise. (grokdeclarator): Likewise. * error.c (dump_decl): Likewise. (dump_expr): Likewise. * friend.c (do_friend): Likewise. * init.c (build_offset_ref): Likewise. * lex.c (unqualified_fn_lookup_error): Use pedwarn. Do not create LOOKUP_EXPRs * mangle.c (write_expression): Remove support for LOOKUP_EXPR. * parser.c (cp_parser_postfix_expression): Modify Koenig lookup test. * pt.c (get_bindings): Give it internal linkage. (check_explicit_specialization): Remove support for LOOKUP_EXPR. (lookup_template_function): Likewise. (for_each_tempalte_parm_r): Likewise. (tsubst_decl): Likewise. (tsubst_qualified_id): Handle template template parameters. (tsubst_copy): Remove support for LOOKUP_EXPR. (tsubst_copy_and_build): Likewise. (most_general_template): Likewise. (value_dependent_expression_p): Likewise. (type_dependent_expression_p): Note that IDENTIFIER_NODEs are always dependent. * semantics.c (perform_koenig_lookup): Do not create IDENTIFIER_NODEs. (finish_fname): Likewise. (finish_id_expression): Likewise. * tree.c (is_aggr_type_2): Remove. From-SVN: r69427
2003-07-14re PR c++/7019 ([3.3 only] SFINAE does not work with explicitally specified ↵Mark Mitchell1-1/+2
template arguments) PR c++/7019 * cp-tree.h (lookup_qualified_name): Adjust prototype. * decl.c (lookup_qualified_name): Add complain parameter. Adjust call to is_aggr_type. * parser.c (cp_parser_lookup_name): Adjust call to lookup_qualified_name. * pt.c (tsubst_qualified_id): Likewise. (tsubst_copy_and_build): Likewise. * semantics.c (finish_qualified_id_expr): Deal with erroneous expressions. PR c++/7019 * g++.dg/template/overload2.C: New test. From-SVN: r69342
2003-07-14re PR c++/11493 (tree check ICE in error.c)Mark Mitchell1-366/+34
* cp-tree.h (cp_id_kind): New type. (unqualified_name_lookup_error): Change prototype. (unqualified_fn_lookup_error): New function. (do_identifier): Remove. (do_scoped_id): Likewise. (tsubst_copy_and_build): Change prototype. (reregister_specialization): New function. (perform_koenig_lookup): Likewise. (finish_id_expression): Likewise. * call.c (build_method_call): Adjust call to unqualified_name_lookup_error. * decl.c (duplicate_decls): Use reregister_specialization. * lex.c (is_global): Remove. (unqualified_name_lookup_error): Return a value. (do_identifier): Remove. (do_scoped_id): Likewise. (identifier_typedecl_value): Remove. (unqualified_fn_lookup_error): New function. * parser.c (cp_parser_id_kind): Remove. (cp_parser_non_constant_id_expression): Remove. (cp_parser_primary_expression): Use finish_id_expression. (cp_parser_class_or_namespace_name): Use cp_id_kind, not cp_parser_id_kind. (cp_parser_postfix_expression): Use perform_koenig_lookup. (cp_parser_template_argument): Use cp_id_kind. (cp_parser_fold_non_dependent_expr): Adjust call to tsubst_copy_and_build. * pt.c (unregister_specialization): Rename to ... (reregister_specialization): This. (tsubst_friend_function): Use it. (maybe_fold_nontype_arg): Adjust call to tsubst_copy_and_build. (tsubst_qualified_id): Likewise. (tsubst_expr): Likewise. (tsubst_copy_and_build): Add function_p parameter. Use finish_id_expression. Introduce RECUR macro. (tsubst_non_call_postfix_expression): New function. (regenerate_decl_from_template): Use reregister_specialization. * semantics.c (perform_koenig_lookup): New function. (finish_id_expression): Likewise. PR c++/11493 PR c++/11495 * g++.dg/parse/template9.C: Likewise. * g++.dg/template/crash4.C: New test. * g++.dg/template/koenig1.C: Likewise. * g++.old-deja/g++.benjamin/tem03.C: Adjust error markers. * g++.old-deja/g++.benjamin/tem06.C: Declare "x". * g++.old-deja/g++.jason/overload33.C: Use this-> when calling functions. * g++.old-deja/g++.jason/template36.C: Likewise. * g++.old-deja/g++.mike/p1989.C: Likewise. * g++.old-deja/g++.pt/lookup2.C: Use -fpermissive when compiling. * g++.old-deja/g++.pt/ttp20.C: Use this->. * g++.old-deja/g++.pt/ttp21.C: Use this->. * g++.old-deja/g++.pt/typename13.C: Use -fpermissive when compiling. * g++.old-deja/g++.pt/union2.C: Use this->. From-SVN: r69316
2003-07-11re PR c++/11050 ("some string" __FUNCTION__ is accepted)Nathan Sidwell1-185/+163
cp: PR c++/11050 * parser.c (cp_parser_expression_list): Rename to ... (cp_parser_parenthesized_expression_list): ... here. Add attribute parameter, parse the surounding parentheses. (cp_parser_skip_to_closing_parenthesis): Add recover and or_comma parameters. Return int. (cp_parser_skip_to_closing_parenthesis or comma): Remove. (cp_parser_postfix_expression): Adjust function call parsing. (cp_parser_new_placement): Adjust. (cp_parser_new_initializer): Likewise. (cp_parser_cast_expression): Likewise. (cp_parser_selection_statement): Likewise. (cp_parser_mem_initializer): Likewise. (cp_parser_asm_definition): Likewise. (cp_parser_init_declarator): Likewise. (cp_parser_declarator): Make cdtor_or_conv_p an int ptr. (cp_parser_direct_declarator): Likewise. Check for a parameter list on cdtors & conv functions. (cp_parser_initializer): Adjust. (cp_parser_member_declaration): Adjust. (cp_parser_attribute_list): Move code into cp_parser_parens_expression_list. (cp_parser_functional_cast): Adjust. * pt.c (type_dependent_expression_p): Erroneous expressions are non-dependent. testsuite: PR c++/11050 * g++.dg/parse/args1.C: New test. * g++.pt/defarg8.C: Change expected errors. From-SVN: r69230
2003-07-11Index: ChangeLogGeoffrey Keating1-7/+3
2003-07-10 Geoffrey Keating <geoffk@apple.com> * c-decl.c (finish_decl): Handle 'used' here... * cgraphunit.c (cgraph_finalize_function): ... and here ... * c-common.c: (handle_used_attribute): ... not here. * configure.in (onstep): Support --enable-intermodule. * Makefile.in (OBJS-common): New. (OBJS-md): New. (OBJS-archive): New. (OBJS): Build from OBJS-common, OBJS-md, OBJS-archive. (OBJS-onestep): New. (libbackend.a): Support @onestep@. (libbackend.o): New. * configure: Regenerate. * c-common.h (c_reset_state): New prototype. (c_parse_file): New prototype. (finish_file): Move prototype from c-tree.h. * c-decl.c: Include <hashtab.h>. (builtin_decls): New. (current_file_decl): New. (duplicate_decls): Add extra parameter. Change all callers. Don't output duplicate common symbols. (link_hash_hash): New. (link_hash_eq): New. (poplevel): Handle popping of the top level. (warn_if_shadowing): Handle TRANSLATION_UNIT_DECL. (pushdecl): Set DECL_CONTEXT to TRANSLATION_UNIT_DECL if appropriate. (pushdecl_top_level): Likewise. (redeclaration_error_message): Handle TRANSLATION_UNIT_DECL. (c_init_decl_processing): Create TRANSLATION_UNIT_DECL. (finish_decl): Handle TRANSLATION_UNIT_DECL. (merge_translation_unit_decls): New. (c_write_global_declarations): New. (c_reset_state): New. (implicitly_declare): Handle TRANSLATION_UNIT_DECL. * c-lang.c (LANG_HOOKS_WRITE_GLOBALS): New. * c-objc-common.c (c_cannot_inline_tree_fn): Handle TRANSLATION_UNIT_DECL. (c_objc_common_finish_file): Call merge_translation_unit_decls. * c-opts.c (in_fnames): Rename from in_fname. (c_common_decode_option): Handle multiple input filenames. (c_common_post_options): Likewise. (c_common_parse_file): Likewise; also, call c_parse_file rather than yyparse. * c-parse.in: Move cleanup code to c_parse_file. (free_parser_stacks): Move contents to c_parse_file. (c_parse_file): New. * c-tree.h (union lang_tree_node): Chain along TYPE_NEXT_VARIANT for integer types. (C_DECL_FILE_SCOPE): New. (finish_file): Move prototype to c-common.h. (merge_translation_unit_decls): New prototype. (comptypes): Add extra parameter to prototype. (c_write_global_declarations): New prototype. * c-typeck.c (tagged_types_tu_compatible_p): New. (function_types_compatible_p): Add extra parameter, change all callers. (type_lists_compatible_p): Likewise. (comptypes): Likewise. (struct tagged_tu_seen): New. (tagged_tu_seen_base): New. (build_unary_op): Handle TRANSLATION_UNIT_DECL. (c_mark_addressable): Remove #if 0 code. * calls.c (special_function_p): Handle TRANSLATION_UNIT_DECL, add comment explaining why it shouldn't have to. * cgraph.h (struct cgraph_node): Add chain_next and chain_prev GTY options. * cppinit.c (cpp_read_next_file): New. (cpp_read_main_file): Use it. * cpplib.c (undefine_macros): New. (cpp_undef_all): New. * cpplib.h (cpp_read_next_file): Prototype. (cpp_undef_all): Prototype. * langhooks-def.h (write_global_declarations): Remove prototype. * toplev.h (write_global_declarations): Add prototype. * tree.c (decl_type_context): Use switch statement, handle TRANSLATION_UNIT_DECL. * tree.def: Update documentation for TRANSLATION_UNIT_DECL. (TRANSLATION_UNIT_DECL): New kind of tree. * tree.h: Update documentation for TRANSLATION_UNIT_DECL. * Makefile.in (c-decl.o): Add $(HASHTAB_H) to dependencies. * doc/invoke.texi: Make attempt to document new functionality. 2003-05-19 Per Bothner <bothner@apple.com> * gcc.c (combine_inputs): New. (process_command): Set combine_inputs. (do_spec_1): Handle combine_inputs. (main): Likewise. Index: cp/ChangeLog 2003-07-10 Geoffrey Keating <geoffk@apple.com> * decl.c (cp_finish_decl): Handle 'used' attribute. * cp-lang.c (c_reset_state): New dummy routine. * cp-tree.h (finish_file): Move prototype to c-common.h. * parser.c (c_parse_file): Rename from yyparse; don't call finish_file. From-SVN: r69224
2003-07-10re PR c++/9411 ([New parser] Template function lookup problem)Mark Mitchell1-0/+1
PR c++/9411 * parser.c (cp_parser_postfix_expression): Check dependency of functions. PR c++/9411 * g++.dg/template/explicit2.C: New test. From-SVN: r69196
2003-07-09parser.c (cp_parser_primary_expression): Preserve the form of qualified ↵Mark Mitchell1-0/+11
expressions in templates... * parser.c (cp_parser_primary_expression): Preserve the form of qualified expressions in templates, even if they are not dependent. * pt.c (convert_nontype_argument): Handle non-dependent SCOPE_REFs. (tsubst_qualified_id): Likewise. * search.c (accessible_p): Treat everything in the body of a From-SVN: r69160
2003-07-09fold-const.c (make_range): Do not access operand 1 for a zero-operand operator.Mark Mitchell1-138/+221
* fold-const.c (make_range): Do not access operand 1 for a zero-operand operator. 2003-07-08 Mark Mitchell <mark@codesourcery.com> * cp-tree.def (NON_DEPENDENT_EXPR): New node. * cp-tree.h (build_call_from_tree): Remove. (build_member_call): Likewise. (dependent_template_arg_p): Remove. (any_dependent_template_arguments_p): New function. (dependent_template_id_p): Likewise. (any_type_dependent_arguments_p): Likewise. (build_non_dependent_expr): Likewise. (build_non_dependent_args): Likewise. (build_x_compound_expr): Adjust prototype. * call.c (build_new_method_call): Handle non-dependent expressions correctly. * decl2.c (grok_array_decl): Likewise. (build_offset_ref_call_from_tree): Likewise. (build_call_from_tree): Remove. * error.c (dump_decl): Handle NON_DEPENDENT_EXPR. (dump_expr): Likewise. * init.c (build_member_call): Remove. * mangle.c (write_expression): Update handling for template-ids. * parser.c (cp_parser_primary_expression): Use any_dependent_template_arguments_p. Update constant-expression handling. (cp_parser_postfix_expression): Use any_type_dependent_arguments_p. Simplify call processing. (cp_parser_unary_expression): Simplify. (cp_parser_expression): Adjust for changes to build_x_compound_expr. (cp_parser_template_argument): Implement standard-conforming parsing of non-type template arguments. (cp_parser_direct_declarator): Use cp_parser_fold_non_dependent_expr. (cp_parser_fold_non_dependent_expr): New function. (cp_parser_next_token_ends_template_argument_p): Likewise. * pt.c (convert_template_argument): Do not call maybe_fold_nontype_arg. (tsubst_baselink): Likewise. (tsubst_copy_and_build): Share common code. Make sizeof/alignof processing work correctly for non-dependent expressions. Adjust handling of COMPOUND_EXPR. Simplify call processing. (value_dependent_expression_p): Deal with functional casts and sizeof/alignof correctly. (type_dependent_expression_p): Handle overloaded functions. (any_type_dependent_arguments_p): New function. (any_dependent_template_arguments_p): Likewise. (dependent_template_p): Treat SCOPE_REFs as dependent. (dependent_template_id_p): Simplify. (build_non_dependent_expr): New function. (build_non_dependent_args): Likewise. * semantics.c (finish_stmt_expr): Don't make dependent statement-expresions have void type. (finish_call_expr): Handle non-dependent expressions correctly. * tree.c (lvalue_p_1): Treat NON_DEPENDENT_EXPRs as lvalues. * typeck.c (cxx_sizeof_or_alignof_type): Give the expression type size_t, even in templates. (expr_sizeof): Likewise. (finish_class_member_access_expr): Handle non-dependent expressions correctly. (build_x_indirect_ref): Likewise. (build_x_binary_op): Likewise. (build_x_unary_op): Likewise. (build_x_conditional_expr): Likewise. (build_x_compound_expr): Likewise. * typeck2.c (build_x_arrow): Likewise. 2003-07-08 Mark Mitchell <mark@codesourcery.com> * g++.dg/abi/mangle17.C: Make sure template expressions are dependent. * g++.dg/abi/mangle4.C: Mark erroneous casts. * g++.dg/debug/debug7.C: Mark erronous new-declarator. * g++.dg/opt/stack1.C: Remove erroneous code. * g++.dg/parse/template7.C: New test. * g++.dg/template/dependent-expr1.C: Mark erroneous code. * g++.old-deja/g++.pt/crash4.C: Likewise. 2003-07-09 Mark Mitchell <mark@codesourcery.com> * gcj/array.h (JvPrimClass): Don't parenthesize the output. From-SVN: r69130
2003-07-08cp-tree.h (build_scoped_method_call): Remove.Mark Mitchell1-141/+37
* cp-tree.h (build_scoped_method_call): Remove. (lookup_qualified_name): Remove parameter. (tsubst_copy_and_build): Declare. (finish_qualified_object_call_expr): Remove. (check_accessibility_of_qualified_id): New function. (finish_qualified_id_expr): Likewise. (non_reference): Likewise. (build_expr_from-tree): Remove. * call.c (non_reference): Remove. (build_scoped_method_call): Likewise. (build_method_call): Use error_operand_p. Assert that we are not processing a template. (standard_conversion): Use non_reference. * class.c (build_vtbl_entry_ref): Likewise. (build_vtbl_ref_1): Likewise. * cvt.c (build_expr_type_conversion): Use non_reference. * decl.c (lookup_qualified_name): Remove flags parameter. (grok_op_properties): Use non_reference. * decl2.c (grok_array_decl): Likewise. (build_expr_from_tree): Remove. (build_offset_ref_call_from_tree): Update comment. * error.c (parm_to_string): Call reinit_global_formatting_buffer. * except.c (prepare_eh_types): Use non_reference. (can_convert_eh): Likewise. * init.c (build_dtor_call): Avoid using build_method_call. * mangle.c (write_template_param): Remove misleading comment. * method.c (locate_copy): Use non_reference. * parser.c (cp_parser_scope_through_which_access_occurs): Remove. (cp_parser_primary_expression): Do not create SCOPE_REFs is non-dependent contexts. (cp_parser_postfix_expression): Use finish_qualified_id_expr. (cp_parser_direct_declarator): Use tsubst_copy_and_build, not build_expr_from_tree. (cp_parser_lookup_name): Adjust call to lookup_qualified_name. Use check_accessibility_of_qualified_id. * pt.c (maybe_fold_nontype_arg): Use tsubst_copy_and_build, not build_expr_from_tree. (tsubst_baselink): New function. (tsubst_qualified_id): Likewise. (tsubst_copy): Use them. Remove support for METHOD_CALL_EXPR. (tsubst_expr): Adjust call to lookup_qualified_name. (tsubst_copy_and_build): Handle SCOPE_REFs specially. Adjust handling of CALL_EXPRs. (value_dependent_expression_p): Use INTEGRAL_OR_ENUMERATION_TYPE_P. * rtti.c (get_tinfo_decl_dynamic): Use non_reference. * search.c (check_final_overrider): Likewise. * semantics.c (check_accessibility_of_qualified_id): New function. (finish_qualified_object_call_expr): Remove. * typeck.c (target_type): Use non_reference. (cxx_sizeof_or_alignof_type): Likewise. (dubious_conversion_warnings): Likewise. (convert_for_initialization): Likewise. (non_reference): New function. From-SVN: r69063
2003-07-06call.c: Fix comment formatting.Kazu Hirata1-13/+13
* call.c: Fix comment formatting. * class.c: Likewise. * cp-tree.h: Likewise. * decl.c: Likewise. * decl2.c: Likewise. * error.c: Likewise. * method.c: Likewise. * name-lookup.c: Likewise. * parser.c: Likewise. * pt.c: Likewise. * rtti.c: Likewise. * search.c: Likewise. * typeck.c: Likewise. From-SVN: r69022
2003-07-05call.c: Fix comment typos.Kazu Hirata1-34/+34
* call.c: Fix comment typos. * class.c: Likewise. * cp-tree.h: Likewise. * cvt.c: Likewise. * decl2.c: Likewise. * decl.c: Likewise. * init.c: Likewise. * mangle.c: Likewise. * parser.c: Likewise. * pt.c: Likewise. * search.c: Likewise. * semantics.c: Likewise. * tree.c: Likewise. * typeck.c: Likewise From-SVN: r68956
2003-07-05cpplib.h (CPP_AT_NAME, [...]): New token types.Zack Weinberg1-59/+15
* cpplib.h (CPP_AT_NAME, CPP_OBJC_STRING): New token types. (struct cpp_options): Add narrow_charset, wide_charset, bytes_big_endian fields. Remove EBCDIC field. (cpp_init_iconv, cpp_interpret_string): New external interfaces. * cpphash.h: Include <iconv.h> if we have it, otherwise provide a dummy definition of iconv_t. (struct cpp_reader): Add narrow_cset_desc and wide_cset_desc fields. (_cpp_valid_ucn): Update prototype. (_cpp_destroy_iconv): New prototype. * doc/cpp.texi: Document character set handling. * doc/cppopts.texi: Document -fexec-charset= and -fexec-wide-charset=. * doc/extend.texi: Delete entire section on multiline strings. Rewrite section on __FUNCTION__ etc now that these are variables in C. * cppucnid.tab, cppucnid.pl: New files. * cppucnid.h: New generated file. * cppcharset.c: Include cppucnid.h. Lots of commentary added. (iconv_open, iconv, iconv_close): Provide dummy definitions if !HAVE_ICONV. (SOURCE_CHARSET, struct strbuf, init_iconv_desc, cpp_init_iconv, _cpp_destroy_iconv, convert_cset, width_to_mask, convert_ucn, emit_numeric_escape, convert_hex, convert_oct, convert_escape, cpp_interpret_string, narrow_str_to_charconst, wide_str_to_charconst): New. (ucn_valid_in_identifier): Use a binary search through the ucnranges table defined in cppucnid.h, not a long chain of if statements. (_cpp_valid_ucn): Add a limit pointer. Downgrade "universal character names are only valid in C++ and C99" to a warning. Issue the "meaning of \[uU] is different in traditional C" warning here. Take care not to let iconv see an invalid UCS value if we get a malformed UCN. Issue an error if we don't have iconv. (cpp_interpret_charconst): Moved here from cpplex.c. Use cpp_interpret_string to do the heavy lifting. * cppinit.c (cpp_create_reader): Initialize bytes_big_endian, narrow_charset, wide_charset fields of options structure. (cpp_destroy): Call _cpp_destroy_iconv. * cpplex.c (forms_identifier_p): Adjust call to _cpp_valid_ucn. (maybe_read_ucn, hex_digit_value, cpp_parse_escape): Delete. (cpp_interpret_charconst): Moved to cppcharset.c. * cpplib.c (dequote_string): Delete. (interpret_string_notranslate): New. (do_line, do_linemarker): Use interpret_string_notranslate. * Makefile.in (cppcharset.o): Depend on cppucnid.h. * c-common.c (fname_string, combine_strings): Delete. * c-common.h (fname_string, combine_strings): Delete prototypes. * c-lex.c (ignore_escape_flag): Delete. (cb_ident): Use cpp_interpret_string, not lex_string. (get_nonpadding_token): New function. (c_lex): Handle Objective-C @-prefixed identifiers and strings here. Adjust calls to lex_string. Don't write *value twice. (lex_string): Now handles string constant concatenation. Most of the work handed off to cpp_interpret_string. Call fix_string_type here. * c-parse.in (STRING_FUNC_NAME, VAR_FUNC_NAME): Replace with FUNC_NAME, throughout. (OBJC_STRING): New token type. (primary:STRING): No need to call fix_string_type here. (primary:objc_string): Make that OBJC_STRING. (objc_string nonterminal): Delete. (yylexname): Delete code to handle fake string constants. (yylexstring): Delete entirely. (_yylex): Handle CPP_AT_NAME and CPP_OBJC_STRING. No need to handle CPP_ATSIGN. * c.opt (-fexec-charset=, -fwide-exec-charset=): New options. * c-opts.c (missing_arg, c_common_handle_option): Handle OPT_fexec_charset_ and OPT_fwide_exec_charset_. (c_common_init): Set cpp_opts->bytes_big_endian, not cpp_opts->EBCDIC. Call cpp_init_iconv. (print_help): Document -fexec-charset= and -fexec-wide-charset=. (TARGET_EBCDIC): Delete default definition. * objc/objc-act.c (build_objc_string_object): No need to handle string constant concatenation. cp: * parser.c (cp_lexer_read_token): No need to handle string constant concatenation. testsuite: * gcc.c-torture/execute/wchar_t-1.x: New file; XFAIL wchar_t-1.c everywhere. * gcc.dg/concat.c: Concatenation of string constants with __FUNCTION__ / __PRETTY_FUNCTION__ is now a hard error. * gcc.dg/wtr-strcat-1.c: Loosen dg-warning regexp. * gcc.dg/cpp/escape-2.c: Use wide character constants where necessary to avoid multi-character character constant warning. * gcc.dg/cpp/escape.c: Likewise. * gcc.dg/cpp/ucs.c: Likewise. Remove backslashes from dg-bogus comments, as they confuse Tcl. Fix a typo. libstdc++-v3: * testsuite/22_locale/collate/compare/wchar_t/2.cc * testsuite/22_locale/collate/compare/wchar_t/wrapped_env.cc * testsuite/22_locale/collate/compare/wchar_t/wrapped_locale.cc * testsuite/22_locale/collate/hash/wchar_t/2.cc * testsuite/22_locale/collate/hash/wchar_t/wrapped_env.cc * testsuite/22_locale/collate/hash/wchar_t/wrapped_locale.cc * testsuite/22_locale/collate/transform/wchar_t/2.cc * testsuite/22_locale/collate/transform/wchar_t/wrapped_env.cc * testsuite/22_locale/collate/transform/wchar_t/wrapped_locale.cc: XFAIL on all targets. From-SVN: r68952
2003-07-04call.c (build_addr_func): Handle bound pointers-to-members.Mark Mitchell1-42/+30
* call.c (build_addr_func): Handle bound pointers-to-members. (build_method_call): Do not call resolve_offset_ref. (implicit_conversion): Likewise. (resolve_scoped_fn_name): Use finish_non_static_data_member, not resolve_offset_ref. (resolve_args): Do not call resolve_offset_ref. (build_conditional_expr): Likewise. (build_new_method_call): Likewise. * cp-tree.def (OFFSET_REF): Update documentation. (cp_convert_to_pointer): Update handling of conversions from pointers to members to pointers. (ocp_convert): Do not call resolve_offset_ref. (convert_to_void): Likewise. (build_expr_type_conversion): Likewise. (delete_sanity): Likewise. (resolve_offset_ref): Simplify greatly. (build_vec_delete): Do not call resolve_offset_ref. * parser.c (cp_parser_postfix_expression): Call resolve_offset_ref if appropriate. (cp_parser_unary_expression): Use cp_parser_simple_cast_expression. (cp_parser_delete_expression): Likewise. (cp_parser_cast_expression): Likewise. (cp_parser_pm_expression): Use cp_parser_binary_op. (cp_parser_simple_cast_expression): New function. * rtti.c (build_dynamic_cast_1): Do not call resolve_offset_ref. * semantics.c (finish_increment_expr): Likewise. (finish_typeof): Likewise. * tree.c (lvalue_p_1): Do not handle OFFSET_REF. * typeck.c (require_complete_type): Do not handle OFFSET_REFs. (decay_conversion): Do not call resolve_offset_ref. (finish_class_member_access_expr): Likewise. (convert_arguments): Likewise. (build_x_binary_op): Handle DOTSTAR_EXPR. (condition_conversion): Do not call resolve_offset_ref. (unary_complex_lvalue): Likewise. (build_static_cast): Likewise. (build_reinterpret_cast): Likewise. (build_const_cast): Likewise. (build_c_cast): Likewise. (build_modify_expr): Likewise. (convert_for_assignment): Likewise. (convert_for_initialization): Likewise. * typeck2.c (build_x_arrow): Likewise. (build_m_component_ref): Simplify. * g++.old-deja/g++.jason/typeid1.C: Add dg-error marker. * g++.old-deja/g++.mike/net36.C: Tweak error messages. From-SVN: r68911
2003-07-03re PR c++/9162 ([New parser] Problem with default argument in a friend function)Nathan Sidwell1-39/+58
cp: PR c++/9162 * decl.c (grokdeclarator): Return friend decls, not void_type_node. * decl2.c (grokfield): Alter friend decl check. * parser.c (struct cp_parser): Document default_arg chain on unparsed_functions_queue. (cp_parser_save_default_args): New. (cp_parser_init_declarator, cp_parser_function_definition, cp_parser_member_declaration): Call it. (cp_parser_class_specifier): Remove unused variable. Alter processing of unparsed_functions_queue. testsuite: PR c++/9162 * g++.dg/parse/defarg4.C: New. From-SVN: r68886
2003-07-02decl2.c (defer_fn): Set DECL_DEFER_OUTPUT.Jan Hubicka1-1/+1
* decl2.c (defer_fn): Set DECL_DEFER_OUTPUT. (finish-file): Do not process function with DECL_DEFER_OUTPUT clear; clear DECL_DEFER_OUTPUT once function is processed; avoid flags massaging. * cp-tree.h (DECL_NEEDED_P): Support unit-at-a-time (expand_or_defer_fn): Declare. (lower_function): Declare. * decl.c (start_cleanup_fn): Use expand_or_defer_fn. * decl2.c: Include cgraph.h and varpool.h (maybe_emit_vtables): Make explicit instantations as needed. (mark_member_pointers, lower_function): New functions. (finish_file): Do unit-at-a-time. * method.c (synthesize_method): Use expand_or_defer_fn. * optimize.c (maybe_clone_body): Use expand_or_defer_fn. * parser.c (cp_parser_function_definition_after_decl): Use expand_or_defer_fn. * pt.c (instantiate_decl): Likewise. * semantics.c: Include cgraph.h (expand_or_defer_fn): Break out from ... (expand_body): ... here; deal with unit-at-a-time. * cp-lang.c (LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION, LANG_HOOKS_CALLGRAPH_LOWER_FUNCTION): Define. From-SVN: r68801
2003-06-30Fix bad indentation due to changes in whitespace between patch creation and ↵Wolfgang Bangerth1-7/+7
patch application. From-SVN: r68722
2003-06-30re PR c++/10750 (error with using template template expression in static ↵Giovanni Bajo1-2/+7
const initializer) 2003-06-30 Giovanni Bajo <giovannibajo@libero.it> PR c++/10750 * parser.c (cp_parser_primary_expression): A VAR_DECL with a (value- or type-) dependent expression as DECL_INITIAL is a valid constant-expression (at parser time). From-SVN: r68720
2003-06-28* c-format.c (check_format_string, get_constant)Zack Weinberg1-1/+1
* cfgrtl.c (rtl_split_edge): Mark the definition static, matching the forward declaration. cp: * decl.c (build_typename_type) * mangle.c (write_template_template_arg) * parser.c (cp_parser_scope_through_which_access_occurs) * pt.c (push_access_scope_real, push_access_scope, pop_access_scope) * repo.c (get_base_filename) * semantics.c (maybe_convert_cond): Mark the definition static, matching the forward declaration. java: * class.c (build_method_symbols_entry) * expr.c (get_offset_table_index) * jcf-parse.c (jcf_parse): Mark the definition static, matching the forward declaration. From-SVN: r68622
2003-06-24call.c (enforce_access): Assert we get a binfo.Nathan Sidwell1-1/+1
* call.c (enforce_access): Assert we get a binfo. (build_op_delete_call): Pass a binfo to perform_or_defer_access_check. * class.c (alter_access): Likewise. * decl.c (make_typename_type): Likewise. (make_unbound_class_template): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parser.c (cp_parser_lookup_name): Likewise. * search.c (lookup_member): Likewise. Move IDENTIFIER_CLASS_VALUE test. * semantics.c (finish_non_static_data_member): Likewise. (perform_or_defer_access_check): Expect a binfo. * typeck.c (comptypes): Expect types. * mangle.c (find_substitution): Don't pass a non-type to same_type_p * friend.c (make_friend_class): Likewise. * pt.c (check_default_tmpl_args): Likewise. (lookup_template_class): Likewise. From-SVN: r68424
2003-06-20re PR c++/10749 (triple nested template classes in namespace need to qualify ns)Mark Mitchell1-1/+1
PR c++/10749 * parser.c (cp_parser_class_head): See through dependent names when parsing a class-head. PR c++/10749 * g++.dg/template/memclass2.C: New test. From-SVN: r68276
2003-06-16cp-tree.h: Follow spelling conventions.Kazu Hirata1-7/+7
* cp-tree.h: Follow spelling conventions. * mangle.c: Likewise. * method.c: Likewise. * parser.c: Likewise. From-SVN: r68015
2003-05-25parser.c (cp_parser_explicit_instantiation): Restore old access before ↵Kriang Lerdsuwanakij1-2/+6
template instantiation. * parser.c (cp_parser_explicit_instantiation): Restore old access before template instantiation. * g++.dg/template/access11.C: New test. From-SVN: r67166
2003-05-15re PR c++/5388 (Incorrect message "operands to ?: have different types")Jason Merrill1-0/+2
PR c++/5388 * call.c (conditional_conversion): Don't consider implicit conversions if T2 is a base of T1. * cp-tree.h (DERIVED_FROM_P, UNIQUELY_DERIVED_FROM_P): Make boolean. (ACCESSIBLY_UNIQUELY_DERIVED_P, PUBLICLY_UNIQUELY_DERIVED_P): Likewise. * parser.c (cp_parser_primary_expression): Convert a static data member from reference. From-SVN: r66844
2003-05-10re PR c++/9252 ([New parser] Errors due to legally used "typename")Kriang Lerdsuwanakij1-10/+7
PR c++/9252 * cp-tree.h (saved_scope): Remove check_access field. (tsubst_flags_t): Remove tf_parsing. * decl.c (maybe_push_to_top_level): Don't initialize scope_chain->check_access. (make_typename_type, make_unbound_class_template): Don't use tf_parsing. (register_dtor_fn): Use push/pop_deferring_access_checks instead of scope_chain->check_access. * method.c (use_thunk): Likewise. * parser.c (cp_parser_explicit_instantiation (cp_parser_constructor_declarator_p): Don't call push/pop_deferring_access_checks here. (cp_parser_template_argument, cp_parser_class_name): Don't use tf_parsing. (yyparse): Check flag_access_control. * pt.c (instantiate_class_template): Call push/pop_deferring_access_checks. * semantics.c (push_deferring_access_checks): Propagate dk_no_check. (perform_or_defer_access_check): Make sure basetype_path is a type before comparison. * call.c (build_op_delete_call, build_over_call): Use perform_or_defer_access_check. * class.c (alter_access): Likewise. * init.c (build_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * search.c (lookup_member): Likewise. * semantics.c (finish_non_static_data_member): Likewise. (simplify_aggr_init_exprs_r): Use push/pop_deferring_access_checks instead of flag_access_control. * g++.dg/parse/access8.C: New test. * g++.dg/parse/access9.C: New test. From-SVN: r66660
2003-05-10re PR c++/9554 (Out of class declaration of member class template ↵Kriang Lerdsuwanakij1-42/+28
specialisation rejected) PR c++/9554 * parser.c (cp_parser_class_name): Remove check_access parameter. All caller adjusted. Update declaration. (cp_parser_lookup_name): Likewise. * semantics.c (push_deferring_access_checks): Change parameter type to enum deferring_kind. All caller adjusted. (resume_deferring_access_checks): Adjust to use new enum. (stop_deferring_access_checks): Likewise. (perform_or_defer_access_check): Likewise. * cp-tree.h (deferring_kind): New enum. (deferred_access): Adjust field type. (push_deferring_access_checks): Update declaration. * g++.dg/parse/access1.C: New test. From-SVN: r66659
2003-05-03class.c (finish_struct): Use location_t and input_location directly.Nathan Sidwell1-13/+7
* class.c (finish_struct): Use location_t and input_location directly. * decl.c (make_label_decl): Likewise. (use_label): Likewise. * decl2.c (warn_if_unknown_interface): Likewise. (start_static_initialization_or_destruction): Likewise. (generate_ctor_or_dtor_function): Likewise. (finish_file): Likewise. * error.c (print_instantiation_full_context): Likewise. * init.c (create_temporary_var): Likewise. * method.c (synthesize_method): Likewise. * parser.c (cp_token): Likewise. (cp_lexer_set_source_position_from_token): Likewise. (cp_lexer_get_preprocessor_token): Likewise. (cp_parser_statement): Likewise. * pt.c (tsubst_friend_function): Likewise. (instantiate_class_template): Likewise. (tsubst_decl): Likewise. (tsubst): Likewise. (instantiate_decl): Likewise. * semantics.c (begin_class_definition): Likewise. (expand_body): Likewise. From-SVN: r66423
2003-05-01input.h (lineno): Rename to ...Nathan Sidwell1-2/+2
* 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-04-23Makefile.in (c-lex.o, [...]): Update.Neil Booth1-4/+0
* Makefile.in (c-lex.o, LIBCPP_OBJS, cpplex.o): Update. * c-lex.c (MULTIBYTE_CHARS): Remove conditionals. (lex_string): Take cpp_string with full spelling. (cb_ident): Update. (c_lex): Update diagnostics. * cpplex.c (SPELL_NUMBER, SPELL_STRING): Combine into SPELL_LITERAL. (create_literal): New. (lex_string): Unterminated literals have type CPP_OTHER. (_cpp_lex_direct): Update calls to lex_string. Use create_literal for CPP_OTHER. (cpp_token_len, cpp_spell_token, cpp_output_token): Simplify. (_cpp_equiv_tokens, cpp_interpret_charconst): Update. * cpplib.c (parse_include, do_line, do_linemarker, destringize_and_run): Update for token storing full spelling. * cpplib.h: Update token spelling types. * cppmacro.c (stringify_arg, check_trad_stringification): Update for token storing full spelling. cp: * Make-lang.in (lex.o): Remove mbchar.h. * lex.c (MULTIBYTE_CHARS): Lose. * parser.c (cp_lexer_get_preprocessor_token): CPP_OTHER handled in c-lex.c. testsuite: * gcc.dg/cpp/include2.c: Update. * gcc.dg/cpp/multiline-2.c: New. * gcc.dg/cpp/multiline.c: Update. * gcc.dg/cpp/strify2.c: Update. * gcc.dg/cpp/trad/literals-2.c: Update. From-SVN: r66019
2003-04-15re PR c++/10381 (Accepts call to inexistent function)Mark Mitchell1-29/+38
PR c++/10381 * parser.c (cp_parser_primary_expression): Reorganize logic for dealing with name lookup failures. PR c++/10381 * g++.dg/parse/lookup3.C: New test. From-SVN: r65656
2003-04-10c-common.h (lang_statement_code_p): Remove declaration.Steven Bosscher1-1/+1
2003-04-09 Steven Bosscher <steven@gcc.gnu.org> * c-common.h (lang_statement_code_p): Remove declaration. (statement_code_p): Ditto. (c_common_stmt_codes): Define; list of c-common statement codes. (statement_code_p): New extern declaration. (STATEMENT_CODE_P): Define. (INIT_STATEMENT_CODES): Define. * c-common.c (statement_code_p): Kill the function, declare as an array of bools instead. (lang_statement_code_p): Remove. (walk_stmt_tree): Use STATEMENT_CODE_P not statement_code_p. (c_safe_from_p): Ditto. * c-objc-common.c (c_objc_common_init): Use INIT_STATEMENT_CODES to initialize the statement_code_p array. * tree-inline.c (walk_tree): Use STATEMENT_CODE_P instead of statement_code_p. (copy_tree_r): Ditto. * cp/cp-tree.h (cp_stmt_codes): Define; list of C++ specific statement tree codes. * cp/lex.c (cxx_init): Add missing print line break. Use INIT_STATEMENT_CODES to initialize the statement_code_p array. * cp/parser.c (cp_parser_statement): Use STATEMENT_CODE_P instead of statement_code_p. * cp/pt.c (tsubst_expr): Ditto. * cp/tree.c (verify_stmt_tree_r): Ditto. (cp_statement_code_p): Remove. (init_tree): Don't set lang_statement_code_p, it's gone. From-SVN: r65422
2003-03-27re PR c++/10158 (ICE with templates and friends)Nathan Sidwell1-0/+4
cp: PR c++/10158 * parser.c (cp_parser_function_definition): Set DECL_INITIALIZED_IN_CLASS for members. * pt.c (instantiate_decl): Only reduce the template args for friends that are not defined in class. testsuite: PR c++/10158 * g++.dg/template/friend18.C: New test. From-SVN: r64920
2003-03-17re PR c++/9639 ([New parser] Namespace std in constructor argument lists on ↵Mark Mitchell1-1/+4
illegal code causes an ICE) PR c++/9639 * parser.c (cp_parser_declarator_id): Clear parser->scope. PR c++/9639 * g++.dg/parse/crash1.C: New test. From-SVN: r64495
2003-03-16re PR c++/9629 (virtual inheritance segfault)Nathan Sidwell1-3/+9
cp: PR c++/9629 * cp-tree.h (struct language_function): Add in_base_initializer. (in_base_initializer): define it. (expand_member_init): Remove INIT param. * init.c (expand_member_init): Remove INIT param, return the member. (emit_mem_initializers): Set in_base_initializer. * class.c (build_base_path): Check in_base_initializer. * parser.c (cp_parser_mem_initializer): Set in_base_initializer. * pt.c (tsubst_initializer_list): Likewise. testsuite: PR c++/9629 * g++.dg/init/ctor2.C: New test. From-SVN: r64438
2003-03-08re PR c++/9823 (ICE in sort_mem_initializers)Mark Mitchell1-3/+5
PR c++/9823 * cp-tree.h (begin_mem_initializers): Remove. * parser.c (cp_parser_mem_initializer_list): Inline it here. Do not call finish_mem_initializers if not in a constructor. (cp_parser_class_head): Fix typo in error message. * semantics.c (begin_mem_initializers): Remove. * testsuite/g++.dg/parser/constructor1.C: New test. PR c++/9823 * g++.dg/parser/constructor1.C: New test. From-SVN: r63999
2003-03-08re PR c++/9809 (when are builtins brought into view)Mark Mitchell1-6/+18
PR c++/9809 * g++.dg/parse/builtin1.C: New test. PR c++/9982 * g++.dg/abi/cookie1.C: New test. * g++.dg/abi/cookie2.C: Likewise. PR c++/9524 * g++.dg/parse/field1.C: New test. PR c++/9912 * g++.dg/parse/class1.C: New test. * g++.dg/parse/namespace7.C: Likewise. * g++.old-deja/g++.other/decl5.C: Remove XFAILs. From-SVN: r63977
2003-03-06re PR c++/9188 ([New parser] Strange wording of error message)Kriang Lerdsuwanakij1-2/+2
PR c++/9188 * parser.c (cp_parser_type_parameter): Remove redundant `expect' in error message. (cp_parser_single_declaration): Likewise. From-SVN: r63891
2003-03-01parser.c (cp_parser_init_declarator): Revert opaque vector_opaque_p change.Aldy Hernandez1-8/+1
2003-02-28 Aldy Hernandez <aldyh@redhat.com> * parser.c (cp_parser_init_declarator): Revert opaque vector_opaque_p change. Do not include target.h. From-SVN: r63599
2003-02-25003-02-20 Aldy Hernandez <aldyh@redhat.com>Aldy Hernandez1-3/+9
* doc/tm.texi: Document Rename TARGET_VECTOR_TYPES_COMPATIBLE to TARGET_VECTOR_OPAQUE_P. Document accordingly. * testsuite/gcc.dg/20030218-1.c: Check that initialization of opaque types fail. * c-typeck.c (comptypes): Change call to vector_types_compatible to vector_opaque_p. (convert_for_assignment): Call vector_opaque_p instead of vector_types_compatible. (really_start_incremental_init): Disallow initialization of opaque types. * target-def.h: Remove TARGET_VECTOR_TYPES_COMPATIBLE. Define TARGET_VECTOR_OPAQUE_P. (TARGET_INITIALIZER): Same. * target.h (struct gcc_target): Remove vector_types_compatible. Add vector_opaque_p. * config/rs6000/rs6000.c (rs6000_spe_vector_types_compatible): Remove. (is_ev64_opaque_type): Check for TARGET_SPE and make sure type is a vector type. Change return type to bool. (TARGET_VECTOR_TYPES_COMPATIBLE): Remove. (TARGET_VECTOR_OPAQUE_P): Define. * cp/parser.c (cp_parser_init_declarator): Call vector_opaque_p target hook. Include target.h. (cp_parser_init_declarator): Fix typo in function comments. From-SVN: r63411
2003-02-24re PR c++/9836 (Error with typdefs in partial specializations of classes)Mark Mitchell1-2/+1
PR c++/9836 * cp-tree.h (CLASSTYPE_PRIMARY_TEMPLATE): Do not skip from specializations back to the main template. * parser.c (cp_parser_diagnose_invalid_type_name):Adjust use. * pt.c (resolve_typename_type): Likewise. PR c++/9836 * g++.dg/template/spec6.C: New test. From-SVN: r63383
2003-02-24re PR c++/5333 (ICE on nested template classes using other nested template ↵Mark Mitchell1-4/+2
classes) PR c++/5333 * cp-tree.h (CLASSTYPE_PRIMARY_TEMPLATE): New macro. * parser.c (cp_parser_diagnose_invalid_type_name): Use it. * pt.c (instantiate_class_template): Don't try to instantiate dependent types. (resolve_typename_type): Use CLASSTYPE_PRIMARY_TEMPLATE. PR c++/5333 * g++.dg/parse/fused-params1.C: Adjust error messages. * g++.dg/template/nested3.C: New test. From-SVN: r63354
2003-02-20Change base class access representation.Nathan Sidwell1-18/+5
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED, TREE_VIA_PRIVATE): Remove. (BINFO_BASEACCESSES): New binfo elt. (BINFO_BASEACCESS): New accessor. (BINFO_ELTS): Increase. (TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New. (access_public_node, access_protected_node, access_private_node): New global nodes. * tree.c (build_common_tree_nodes_2): Initialize access nodes. * dbxout.c (dbxout_type): Adjust. * dwarf2out.c (gen_inheritance_die): Add access parameter. (gen_member_die): Adjust. * dwarfout.c (output_inheritance_die): ARG is array of two trees. (output_type): Adjust. * tree-dump.c (dequeue_and_dump): Adjust binfo dumping. Change base class access representation. Share virtual base binfos. * cp/call.c (build_special_member_call): Remove binfo_for_vbase call. * cp/class.c (build_base_path): Likewise. (build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use. (build_secondary_vtable): Remove FOR_TYPE arg. Adjust. (make_new_vtable): Adjust. (force_canonical_binfo_r): Delete. (force_canonical_binfo): Delete. (mark_primary_virtual_base): Delete. (dfs_unshared_virtual_bases): Delete. (mark_primary_bases): Adjust. (maybe_warn_about_overly_private_class): Adjust. (dfs_base_derived_from): Delete. (base_derived_from): Follow the inheritance chain. (struct find_final_overrider_data): Add vpath member. (dfs_find_final_overrider): Adjust. (dfs_find_final_overrider_q, dfs_find_final_overrider_post): New. (find_final_overrider): Adjust. (update_vtable_entry_for_fn): Adjust. (modify_all_vtables): Adjust. (walk_subobject_offsets): Adjust. (layout_nonempty_base_or_field): Adjust. (layout_empty_base): Remove last parameter. Adjust. (build_base_field): Adjust. (build_base_fields): Adjust. (propagate_binfo_offsets): Remove last parameter. Adjust. (dfs_set_offset_for_unshared_vbases): Delete. (layout_virtual_bases): Adjust. (finish_struct_1): Adjust. (init_class_processing): Don't init access nodes. (dfs_get_primary_binfo): Delete. (get_primary_binfo): Adjust. (dump_class_hierarchy_r): Remove most derived arg, add IGO parameter. Adjust. (dump_class_hierarchy): Adjust. (finish_vtbls): Adjust. (get_original_base): Delete. (build_vtt_inits): Adjust. (dfs_build_secondary_vptr_vtt_inits): Adjust. (dfs_ctor_vtable_bases_queue_p): Adjust. (build_ctor_vtbl_group): Adjust. (dfs_accumulate_vtbl_inits): Adjust. (build_vtbl_initializer): Adjust. (build_vbase_offset_vtbl_entries): Adjust. (add_vcall_offset_vtbl_entries_1): Adjust. * cp/cp-tree.h (CPTI_ACCESS_*): Remove. (access_*_node): Remove. (CANONICAL_BINFO): Delete. (BINFO_UNSHARED_MARKED): Remove. (BINFO_MARKED): Set LANG_FLAG_0 directly. (SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete. (BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly. (SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED): Delete. (BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly. (SET_BINFO_NEW_VTABLE_MARKED): Adjust. (SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED): Delete. (BINFO_DEPENDENT_BASE_P): New. (dfs_walk, dfs_walk_real): Queue function takes derived binfo and index. (markedp, unmarkedp): Adjust. (dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p, dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp, find_vbase_instance, binfo_for_vbase): Delete. (copied_binfo, original_binfo): Declare. (finish_base_specifier): Add virtual_p arg. (unshare_base_binfos): Delete. (copy_base_binfos): Declare. (reverse_path): Delete. * cp/decl.c (xref_basetypes): Access and virtuality passed differently. Don't copy direct base binfos here. Call copy_base_binfos. * cp/init.c (dfs_initialize_vtbl_ptrs): Adjust. (initialize_vtbl_ptrs): Adjust. (expand_member_init): Adjust. * cp/parser.c (cp_parser_base_specifier): Adjust. * cp/pt.c (instantiate_class_template): Adjust. (get_template_base_recursive): Adjust. * cp/rtti.c (get_pseudo_ti_init): Adjust. (get_pseudo_ti_desc): Adjust. * cp/tree.c (unshare_base_binfos): Rename to ... (copy_base_binfos): ... here, reimplement. (make_binfo): Set BINFO_DEPENDENT_BASE_P. (reverse_path): Remove. * cp/typeck.c (get_delta_difference): Adjust error messages. * cp/semantics.c (finish_base_specifier): Add virtual arg, adjust. * cp/search.c (lookup_base_r): Adjust. (dynamic_cast_base_recurse): Adjust. (canonical_binfo): Remove. (dfs_canonical_queue): Remove. (dfs_assert_unmarked_p): Remove. (assert_canonical_unmarked): Remove. (shared_marked_p, shared_unmarked_p): Remove. (BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE. (dfs_access_in_type): Adjust. (access_in_type): Adjust. (dfs_accessible_queue_p): Adjust. (dfs_accessible_p): Adjust. (is_subobject_of_p_1, is_subobject_of_p): Remove. (struct lookup_field_info): Remove from_dep_base_p field. (lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P. (lookup_field_r): Remove dependent base code. (lookup_member): Likewise. (dfs_walk, dfs_walk_real): Add access arg to queue fn. (dfs_unmarked_real_bases_queue_p): Remove. (dfs_marked_real_bases_queue_p): Remove. (dfs_skip_vbases): Remove. (dfs_get_pure_virtuals): Adjust. (markedp, unmarkedp): Adjust. (marked_vtable_pathp, unmarked_vtable_pathp): Remove. (marked_pushdecls_p, unmarked_pushdecls_p): Adjust. (dfs_unmark): Adjust. (dfs_get_vbase_types):Remove. (dfs_build_inheritance_graph_order): Remove. (get_vbase_types): Remove (dfs_find_vbase_instance): Remove. (find_vbase_instance): Remove. (dfs_debug_unmarkedp): Adjust. (dependent_base_p): Remove. (dfs_push_type_decls): Adjust. (dfs_push_decls): Adjust. (dfs_no_overlap_yet): Adjust. (copied_binfo): New function. (original_binfo): New function. (binfo_for_vbase): Remove. Change base class access representation. * java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC. (add_interface_do): Likewise. From-SVN: r63172
2003-02-18re PR c++/9623 (named initializer regression)Jason Merrill1-1/+7
PR c++/9623 * decl.c (reshape_init): Don't mess with initializer labels. [[Split portion of a mixed commit.]] From-SVN: r63044.2
2003-01-30c-common.c (builtin_define_float_constants): Define __<TYPE>_HAS_INFINITY__ ↵Mark Mitchell1-101/+279
and __<TYPE>_HAS_QUIET_NAN__. * c-common.c (builtin_define_float_constants): Define __<TYPE>_HAS_INFINITY__ and __<TYPE>_HAS_QUIET_NAN__. * call.c (build_field_call): Use build_new_op, not build_opfncall. (prep_operand): New function. (build_new_op): Use it. Remove dead code. * class.c (pushclass): Change "modify" parameter type from int to bool. (currently_open_class): Use same_type_p, not pointer equality. (push_nested_class): Adjust calls to pushclass, remove modify parameter. * cp-tree.h (INTEGRAL_OR_ENUMERATION_TYPE_P): New macro. (pushclass): Change prototype. (push_nested_class): Likewise. (grokoptypename): Remove. (build_opfncall): Remove. (value_dependent_expression_p): Declare. (resolve_typename_type): Likewise. (resolve_typename_type_in_current_instantiation): Likewise. (enter_scope_of): Remove. (tsubst): Remove. (tsubst_expr): Likewise. (tsubst_copy): Likewise. (tsubst_copy_and_build): Likewise. * decl.c (warn_about_implicit_typename_lookup): Remove. (finish_case_label): Return error_mark_node for erroneous labels. (start_decl): Adjust calls to push_nested_class. (grokfndecl): Call push_scope/pop_scope around call to duplicate_decls. (grokdeclarator): Do not call tsubst. (start_function): Adjust calls to push_nested_class. * decl2.c (grok_array_decl): Use build_new_op, not build_opfncall. (check_classfn): Use push_scope/pop_scope around type comparisions. (grokoptypename): Remove. (push_sscope): Adjust call to push_nested_class. * error.c (dump_type): Show cv-qualification of typename types. * init.c (build_member_call): Use build_new_op, not build_opfncall. * method.c (build_opfncall): Remove. * parser.c (cp_parser): Add allow_non_constant_expression_p and non_constant_expression_p. (cp_parser_constant_expression): Adjust prototype. (cp_parser_resolve_typename_type): Remove. (cp_parser_non_constant_expression): New function. (cp_parser_non_constant_id_expression): Likewise. (cp_parser_new): Set allow_non_constant_expression_p and non_constant_expression_p. (cp_parser_primary_expression): Reject `this' and `va_arg' in constant-expressions. Note that dependent names aren't really constant. (cp_parser_postfix_expression): Reject conversions to non-integral types in constant-expressions. Neither are increments or decrements. (cp_parser_unary_expression): Reject increments and decrements in constant-expressions. (cp_parser_direct_new_declarator): Adjust call to cp_parser_constant_expression. (cp_parser_cast_expression): Reject conversions to non-integral types in constant-expressions. (cp_parser_assignment_expression): Rejects assignments in constant-expressions. (cp_parser_expression): Reject commas in constant-expressions. (cp_parser_labeled_statement): Adjust call to cp_parser_constant_expression. (cp_parser_direct_declarator): Simplify array bounds, even in templates, when they are non-dependent. Use resolve_typename_type, not cp_parser_resolve_typename_type. (cp_parser_class_head): Use resolve_typename_type, not cp_parser_resolve_typename_type. (cp_parser_member_declaration): Adjust call to cp_parser_constant_expression. (cp_parser_constant_initializer): Likewise. (cp_parser_constructor_declarator): Use resolve_typename_type, not cp_parser_resolve_typename_type. (cp_parser_late_parsing_default_args): Adjust call to push_nested_class. * pt.c (tsubst): Give it internal linkage. (tsubst_expr): Likewise. (tsubst_copy): Likewise. (tsubst_copy_and_build): Likewise. (push_access_scope_real): Likewise. (tsubst_friend_class): Likewise. (instantiate_class_template): Adjust call to pushclass. (value_dependent_expression_p): Give it external linkage. Robustify. (resolve_typename_type): New function. * semantics.c (finish_call_expr): Use build_new_op, not build_opfncall. (begin_constructor_declarator): Remove. (begin_class_definition): Adjust call to pushclass. (enter_scope_of): Remove. * typeck.c (comptypes): Resolve typename types as appropriate. (build_x_indirect_ref): Use build_new_op, not build_opfncall. (build_x_compound_expr): Likewise. (build_modify_expr): Likewise. (build_x_modify_expr): Likewise. * typeck2.c (build_x_arrow): Likewise. * g++.dg/parser/constant1.C: New test. * include/std/std_limits.h (numeric_limits<float>::has_infinity): Use __FLT_HAS_INIFINITY__ to initialize. (numeric_limits<float>::has_quiet_NaN): Likewise. (numeric_limits<double>::has_infinity): Use __DBL_HAS_INIFINITY__ to initialize. (numeric_limits<double>::has_quiet_NaN): Likewise. (numeric_limits<long double>::has_infinity): Use __LDBL_HAS_INIFINITY__ to initialize. (numeric_limits<long_double>::has_quiet_NaN): Likewise. From-SVN: r62130
2003-01-29re PR c++/8591 (g++ crashes while instantiating templates)Kriang Lerdsuwanakij1-19/+38
PR c++/8591 * parser.c (cp_parser_elaborated_type_specifier): Convert TEMPLATE_DECL to TYPE_DECL only when processing template friends. (cp_parser_maybe_treat_template_as_class): Remove redundant tests. * g++.dg/parse/friend2.C: New test. From-SVN: r62076
2003-01-28re PR c++/3902 ([parser] ambiguous 8.2/7)Nathan Sidwell1-2/+2
cp: PR c++/3902 * parser.c (cp_parser_decl_specifier_seq): Cannot have constructor inside a declarator. testsuite: PR c++/3902 * g++.dg/parse/template5.C: New test. From-SVN: r61987
2003-01-25re PR c++/9403 (parse error on template keyword used for disambiguation)Nathan Sidwell1-59/+26
cp: PR c++/9403 * parser.c (cp_parser_class_or_namespace_name): Reject duplicate template keyword. (cp_parser_base_specifier): Look for and consume a TEMPLATE keyword. Replace switch with array index. PR c++/795 * semantics.c (finish_non_static_data_member): Remember the field's type even in a template. PR c++/9415 * pt.c (tsubst_copy_and_build, CALL_EXPR): BASELINK exprs are already scoped. PR c++/8545 * parser.c (cp_parser_cast_expression): Be more tentative. testsuite: PR c++/9403 * g++.dg/parse/template3.C: New test. * g++.old-deja/g++.pt/memclass5.C: Add needed template keyword. PR c++/795 * g++.dg/parse/template4.C: New test. PR c++/9415 * g++.dg/template/qual2.C: New test. PR c++/8545 * g++.old-deja/g++.brendan/parse3.C: Remove XFAIL. * g++.old-deja/g++.ns/bogus1.C: Change expected error. From-SVN: r61791
2003-01-23re PR c++/9354 ([New parser?] segfault in template definition)Mark Mitchell1-4/+11
PR c++/9354 * init.c (build_new): Set the type of the new-expression, even when processing_templte_decl. PR c++/9216 * parser.c (cp_parser_primary_expression): Improve error message for templates used in an expression context. PR c++/8696 * parser.c (cp_parser_decl_specifier_seq): Commit to tentative parse when encountering "typedef". PR c++/9354 * g++.dg/parse/new1.C: New test. PR c++/9216 * g++.dg/parse/template2.C: New test. PR c++/9354 * g++.dg/parse/typedef2.C: New test. From-SVN: r61643