aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-pch.c
AgeCommit message (Collapse)AuthorFilesLines
2006-01-04directives.c (struct pragma_entry): Add is_deferred.Richard Henderson1-11/+1
libcpp/ * directives.c (struct pragma_entry): Add is_deferred. Add ident entry to value union. (end_directive): Don't eat the line if in_deferred_pragma. (run_directive): Remove pragma hacks. (insert_pragma_entry): Remove. (new_pragma_entry): New. (register_pragma_1): Split out of register_pragma. Only handle the lookup tree and return the new entry. (cpp_register_pragma): Fill in the pragma entry here. (cpp_register_deferred_pragma): New. (register_pragma_internal): New. (_cpp_init_internal_pragmas): Use register_pragma_internal. (do_pragma): Allow pragma expansion after namespace. For deferred pragmas, don't slurp the line into a string. (destringize_and_run): Save tokens for deferred pragmas. (cpp_handle_deferred_pragma): Remove. * macro.c (builtin_macro): Remove pragma token hack. (_cpp_push_token_context): Rename from push_token_context and export. * internal.h (struct lexer_state): Add pragma_allow_expansion. (_cpp_push_token_context): Declare. * lex.c (_cpp_lex_token): Allow _cpp_handle_directive to return a token. Update the line number correctly if so. (_cpp_lex_direct): Emit CPP_PRAGMA_EOL tokens. (cpp_token_val_index): Return CPP_TOKEN_FLD_PRAGMA for pragmas. * include/cpplib.h (PRAGMA_EOL): New. (CPP_TOKEN_FLD_PRAGMA): New. (struct cpp_token): Add val.pragma. (struct cpp_options): Remove defer_pragmas. (cpp_handle_deferred_pragma): Remove. (cpp_register_deferred_pragma): Declare. gcc/ * c-lex.c (c_lex_with_flags) <CPP_PRAGMA>: Smuggle pragma id via integer constant. (pragma_lex): Remove. * c-pch.c (c_common_pch_pragma): Accept the name as an argument, rather than parsing it. * c-pragma.c (handle_pragma_weak, handle_pragma_redefine_extname, handle_pragma_extern_prefix): Add %< %> quotes. (registered_pragmas): New. (c_register_pragma_1): New. (c_register_pragma): Use it. (c_register_pragma_with_expansion): Likewise. (c_invoke_pragma_handler): New. (init_pragma): Use cpp_register_deferred_pragma directly for pch_preprocess. * c-pragma.h (enum pragma_kind): New. (pragma_handler): New. (c_invoke_pragma_handler): Declare. * c-common.c (c_parse_error): Pretty print CPP_PRAGMA and CPP_PRAGMA_EOL. * c-common.h (c_common_pch_pragma): Update decl. * Makefile.in (c-parser.o): Update dependencies. (GTFILES): Add c-pragma.h. * c-parser.c (struct c_token): Add pragma_kind. (struct c_parser): Add in_pragma. (c_lex_one_token): Always initialize keyword and pragma_kind. Extract data for CPP_PRAGMA. (c_parser_peek_2nd_token): Deny CPP_PRAGMA_EOL. (c_parser_consume_token): Don't allow CPP_PRAGMA unless errors. Don't allow CPP_PRAGMA_EOL if in_pragma. (c_parser_consume_pragma): New. (c_parser_skip_until_found): Stop on CPP_PRAGMA_EOL. (c_parser_skip_to_end_of_parameter): Likewise. (c_parser_skip_to_end_of_block_or_statement): Likewise. (c_parser_skip_to_pragma_eol): New. (c_parser_external_declaration): Handle CPP_PRAGMA. (c_parser_compound_statement_nostart): Likewise. (c_parser_statement_after_labels): Likewise. (c_parser_pragma): New. (pragma_lex): Likewise. (c_parser_pragma_pch_preprocess): New. (c_parser_new): Merge into ... (c_parse_file): ... here. Call c_parser_pragma_pch_preprocess. gcc/cp/ * lex.c (handle_pragma_java_exceptions): Fix whitespace. * parser.c (struct cp_token): Add pragma_kind. (eof_token): Update to match. (struct cp_lexer): Add in_pragma; rearrange next for better packing. (cp_parser_initial_pragma): New. (cp_lexer_new_main): Use it. Don't bother clearing c_lex_return_raw_strings. (cp_lexer_get_preprocessor_token): Always initialize keyword and pragma_kind fields. Handle CPP_PRAGMA. (cp_lexer_consume_token): Don't allow CPP_PRAGMA_EOL when in_pragma is set. (cp_lexer_handle_pragma): Remove. Update callers to cp_parser_pragma. (cp_lexer_print_token) <CPP_PRAGMA>: Don't print as a string. (cp_parser_skip_to_pragma_eol): New. (cp_parser_error): Use it. (cp_parser_skip_to_closing_parenthesis): Stop at CPP_PRAGMA_EOL; rearrange with switch statement. (cp_parser_skip_to_end_of_statement): Likewise. (cp_parser_skip_to_end_of_block_or_statement): Likewise. (cp_parser_skip_to_closing_brace): Likewise. (cp_parser_skip_until_found): Likewise. (cp_parser_statement): Add in_compound argument; update callers. Use it to decide how to handle pragma parsing. (cp_parser_labeled_statement): Add in_compound argument; pass it on to cp_parser_statement. (cp_parser_statement_seq_opt): Stop at CPP_PRAGMA_EOL. (cp_parser_declaration_seq_opt): Likewise. (cp_parser_parameter_declaration): Likewise. (cp_parser_member_specification_opt): Likewise. (cp_parser_function_definition_after_decl): Likewise. (cp_parser_cache_group): Handle CPP_PRAGMA/CPP_PRAGMA_EOL pairs. (cp_parser_pragma): New. (pragma_lex): New. gcc/testsuite/ * g++.dg/parse/pragma2.C: Update expected error lines. From-SVN: r109336
2005-12-17tree-inline.c (copy_body_r): Use explicit cast when converting from void *.Gabriel Dos Reis1-2/+2
* tree-inline.c (copy_body_r): Use explicit cast when converting from void *. (copy_bb): Likewise. (copy_edges_for_bb): Likewise. (remap_decl_1): Likewise. (estimate_num_insns_1): Likewise. * cgraph.c (hash_node): Use explicit cast when converting from void *. (eq_node): Likewise. (cgraph_create_node): Use GGC_CNEW. (cgraph_create_edge): Use GGC_NEW. (cgraph_remove_node): Use explicit cast when converting from void *. (hash_varpool_node): Likewise. (eq_varpool_node): Likewise. (cgraph_varpool_node): Use GGC_CNEW. * lambda.h (lambda_vector_new): Use GGC_CNEWVEC. * tree-scalar-evolution.c (new_scev_info_str): Use XNEW. (eq_scev_info): Use explicit cast when converting from void *. (find_var_scev_info): Likewise. (set_instantiated_value): Likewise. (gather_stats_on_scev_database_1): Likewise. * cfgloop.h (simple_loop_desc): Use explicit cast when converting from void *. * c-pch.c (c_common_write_pch): Use XNEWVEC. (c_common_read_pch): Likewise. * prefix.c (save_string): Use XNEWVEC. (translate_name): Use explicit cast when converting from void *. * c-ppoutput.c (print_line): Use explicit cast when converting from void *. (pp_dir_change): Likewise. * c-cppbuiltin.c (builtin_define_std): Likewise. (builtin_define_with_value): Likewise. (builtin_define_with_value_n): Likewise. (builtin_define_with_int_value): Likewise. (builtin_define_type_max): Likewise. * c-incpath.c (add_env_var_paths): Use XNEWVEC. (add_path): Use XNEW. * c-format.c (check_format_info_main): Use GGC_NEW. (format_type_warning): Use explicit cast when converting from void *. * c-typeck.c (alloc_tagged_tu_seen_cache): Use XNEW instead of xmalloc. (start_init): Likewise. * tree-flow-inline.h (first_referenced_var): Use explicit cast when converting from void *. (next_referenced_var): Likewise. * c-pragma.c (push_alignment): Use GGC_NEW instead of ggc_alloc. * gensupport.c (lookup_predicate): Use explicit cast to convert from void *. (init_predicate_table): Use XCNEW instead of xcalloc. * genpreds.c (process_define_predicate): Likewise. From-SVN: r108723
2005-11-26c-lex.c (pragma_lex): Rename from c_lex.Richard Henderson1-1/+1
* c-lex.c (pragma_lex): Rename from c_lex. * c-pch.c: Update for pragma_lex rename. * c-pragma.c, c-pragma.h, config/ia64/ia64-c.c: Likewise. * config/m32c/m32c-pragma.c, config/darwin-c.c: Likewise. * config/rs6000/rs6000-c.c, config/c4x/c4x-c.c: Likewise. * config/sol2-c.c, config/v850/v850-c.c: Likewise. * doc/tm.texi: Likewise. cp/ * lex.c: Update for pragma_lex rename. * parser.c: Likewise. From-SVN: r107544
2005-07-03bb-reorder.c, [...]: Avoid "." or "\n" at end of diagnostics and capital ↵Joseph Myers1-1/+1
letters at start of diagnostics. * bb-reorder.c, c-pch.c, c-pragma.c, c.opt, cfghooks.c, cfgloop.c, cfgrtl.c, cgraphunit.c, config/c4x/c4x.c, config/cris/cris.c, config/frv/frv.c, config/host-darwin.c, config/iq2000/iq2000.c, config/lynx.h, config/m68k/m68k.c, config/pa/pa.c, config/sh/sh.h, config/stormy16/stormy16.c, config/v850/v850.c, config/vax/netbsd-elf.h, coverage.c, dwarf2out.c, emit-rtl.c, except.c, gcc.c, tree-cfg.c, tree-eh.c, tree-ssa.c, xcoffout.c: Avoid "." or "\n" at end of diagnostics and capital letters at start of diagnostics. * combine.c, cse.c: Don't translate dump file output. * toplev.c (print_version): Only translate output if going to stderr. From-SVN: r101561
2005-06-25Update FSF address.Kelley Cook1-2/+2
From-SVN: r101317
2005-05-27c-pch.c, [...]: Update copyright.Kazu Hirata1-1/+1
* c-pch.c, timevar.c, timevar.h, unwind-compat.c, unwind-dw2-fde-compat.c, unwind-dw2-fde.c, config/mmix/mmix.h, config/rs6000/eabispe.h, config/rs6000/lynx.h, config/sh/elf.h, config/sh/symbian-pre.h, config/sparc/sparc-protos.h: Update copyright. From-SVN: r100234
2005-05-18dummy-checksum.c: New.Geoffrey Keating1-74/+55
2005-05-18 Geoffrey Keating <geoffk@apple.com> * dummy-checksum.c: New. * genchecksum.c: New. * c.opt (print_pch_checksum): New flag. * c-pch.c (struct c_pch_validity): Make much shorter. (no_checksum): New. (host_machine): Remove. (target_machine): Remove. (get_ident): Change PCH version number. (pch_init): When -fverbose-asm, print out the compiler fingerprint. Don't put triplets or version string in PCH validity data. Do put the compiler checksum in the validity data. (c_common_valid_pch): Don't check triplets or version string. Do check checksum. (c_common_print_pch_checksum): New. * c-opts.c (c_common_handle_option): Add OPT_print_pch_checksum. Print fingerprint with -v. * c-common.h (c_common_print_pch_checksum): New. (executable_checksum): New. * Makefile.in (STAGEMOVESTUFF): Add cc1*-dummy, *-checksum.c. (cc1-dummy): New rule. (cc1-checksum.c): New rule. (cc1-checksum.o): New rule. (cc1): Add checksum support. (build/genchecksum): New. (build/genchecksum.o): New. (dummy-checksum.o): New. (genobjnames): Add genchecksum.o. (mostlyclean): Remove *-checksum.c. (gnucompare): Add libgcc to list of directories checked. Make comparison problems in libgcc/ and with checksum files only be warnings. * doc/invoke.texi (Precompiled Headers): Remove caution. Document that it must be the exact same binary. Add a few known-safe flags to the list. In cp/: 2005-05-18 Geoffrey Keating <geoffk@apple.com> * Make-lang.in (cc1plus-dummy): New. (cc1plus-checksum.c): New. (cc1plus-checksum.o): New. (cc1plus): Add cc1plus-checksum.o. In objc/: 2005-05-18 Geoffrey Keating <geoffk@apple.com> * Make-lang.in (cc1obj-dummy): New. (cc1obj-checksum.c): New. (cc1obj-checksum.o): New. (cc1obj): Add cc1obj-checksum.o. In objcp/: 2005-05-18 Geoffrey Keating <geoffk@apple.com> * Make-lang.in (cc1objplus-dummy): New. (cc1objplus-checksum.c): New. (cc1objplus-checksum.o): New. (cc1objplus): Add cc1objplus-checksum.o. From-SVN: r99928
2004-11-09builtins.c, [...]: Avoid "`" as left quote, using "'" or %q, %< and %> as ↵Joseph Myers1-13/+13
appropriate. * builtins.c, c-common.c, c-decl.c, c-format.c, c-format.h, c-parse.in, c-pch.c, c-pragma.c, collect2.c, final.c, gcc.c, gcov.c, opts.c, pretty-print.h, protoize.c, reg-stack.c, rtl.c, tlink.c, config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/c4x/c4x.c, config/darwin.c, config/frv/frv.c, config/h8300/h8300.c, config/i386/i386.c, config/i386/winnt.c, config/ia64/ia64.c, config/ip2k/ip2k.c, config/iq2000/iq2000.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/m68k/m68k.h, config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c, config/ns32k/ns32k.c, config/rs6000/host-darwin.c, config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c, config/sh/symbian.c, config/stormy16/stormy16.c, config/v850/v850.c: Avoid "`" as left quote, using "'" or %q, %< and %> as appropriate. Use %' as apostrophe in diagnostics where applicable. Use %< and %> in place of '' quotes where applicable. Use %qs in place of %<%s%>. Consistently quote __builtin function names. ada: * misc.c (gnat_handle_option): Use %< and %> for quoting in warning message. cp: * call.c, class.c, decl.c, decl2.c, error.c, mangle.c, parser.c, pt.c, search.c, semantics.c, typeck.c: Use %q, %< and %> for quoting in diagnostics. * parser.c (cp_parser_sizeof_operand): Use '' instead of `' for quoting in printf format. * decl.c (duplicate_decls, start_decl): Use %qD instead of unquoted %D. objc: * objc-act.c: Use %q, %< and %> for quoting in diagnostics. testsuite: * gcc.dg/builtin-prefetch-1.c: Adjust expected messages. From-SVN: r90337
2004-10-03c-aux-info.c, [...]: Follow code formatting conventions.Joseph Myers1-3/+3
* c-aux-info.c, c-common.c, c-common.h, c-cppbuiltin.c, c-decl.c, c-format.c, c-incpath.c, c-lex.c, c-objc-common.c, c-opts.c, c-parse.in, c-pch.c, c-ppoutput.c, c-pragma.c, c-typeck.c: Follow code formatting conventions. From-SVN: r88462
2004-09-15attribs.c, [...]: Use %<, %> and %q for quoting in diagnostics going through ↵Joseph Myers1-4/+4
pretty-print.c. gcc: * attribs.c, builtins.c, c-format.c, c-pch.c, coverage.c, except.c, fold-const.c, function.c, langhooks.c, params.c, reload.c, reload1.c, stmt.c, stor-layout.c, toplev.c, tree-cfg.c, tree-dump.c, tree-mudflap.c, tree.c, varasm.c: Use %<, %> and %q for quoting in diagnostics going through pretty-print.c. Use '' for quoting in other diagnostic text. * langhooks.c: Include intl.h. Mark text locating diagnostics for translation. * Makefile.in (langhooks.o): Update dependencies. * pretty-print.h (pp_printf): Mark as accepting GCC diagnostic formats. gcc/testsuite: * g++.dg/ext/member-attr.C, g++.dg/warn/deprecated.C, gcc.dg/deprecated.c, gcc.dg/noreturn-1.c, gcc.dg/noreturn-4.c: Update expected messages. libmudflap: * testsuite/libmudflap.c/pass35-frag.c: Update expected message. From-SVN: r87563
2004-09-10c-common.c, [...]: Fix comment typos.Kazu Hirata1-1/+1
* c-common.c, c-pch.c, defaults.h, lambda-code.c, passes.c, tree-data-ref.c, tree-flow.h, tree-ssa-operands.c, tree-ssa-threadupdate.c, tree-vectorizer.c, tree-vectorizer.h, value-prof.c: Fix comment typos. Follow spelling conventions. From-SVN: r87288
2004-09-07c-aux-info.c (gen_type): Use gcc_assert or gcc_unreachable.Nathan Sidwell1-6/+5
* c-aux-info.c (gen_type): Use gcc_assert or gcc_unreachable. * c-common.c (c_type_hash, c_common_nodes_and_builtins, c_expand_expr, boolean_increment, nonnull_check_p, check_function_arguments_recurse, fold_offsetof_1): Likewise. * c-cppbuiltin.c (define__GNUC__, builtin_define_stdint_macros, builtin_define_type_max): Likewise. * c-decl.c (bind, pop_scope, merge_decls, pushdecl_top_level, implicit_decl_warning, builtin_function, build_compound_literal, complete_array_type, grokdeclarator, get_parm_info, start_function, store_parm_decls_oldstyle, c_write_global_declarations): Likewise. * c-format.c (get_constant, decode_format_attr, maybe_read_dollar_number, get_flag_spec, check_format_arg, check_format_types, format_type_warning, find_char_info_specifier_index, init_dynamic_asm_fprintf_info, init_dynamic_diag_info, handle_format_attribute): Likewise. * c-gimplify.c (push_context, pop_context, finish_bc_block): * c-lex.c (c_lex_with_flags, lex_string): Likewise. * c-objc-common.c (c_tree_printer): Likewise. * c-pch.c (pch_init): Likewise. * c-pragma.c (maybe_apply_pragma_weak): Likewise. * c-pretty-print.c (pp_c_tree_decl_identifier): Likewise. * c-typeck.c (c_incomplete_type_error, composite_type, common_pointer_type, common_type, same_translation_unit_p, tagged_types_tu_compatible_p, finish_init, pop_init_level, set_designator, set_nonincremental_init_from_string, process_init_element, c_finish_if_stmt): Likewise. * caller-save.c (init_caller_save, save_call_clobbered_regs, insert_restore, insert_save, insert_one_insn): Likewise. * calls.c (emit_call_1, compute_argument_block_size, precompute_arguments, expand_call, emit_library_call_value_1, store_one_arg): Likewise. From-SVN: r87140
2004-07-29c-common.h (lang_post_pch_load): New variable.Mark Mitchell1-0/+9
* c-common.h (lang_post_pch_load): New variable. * c-pch.c (lang_post_pch_load): Define it. (c_common_read_pch): Use it. * cgraphunit.c (record_call_1): Give the front end a chance to record additional needed entities when a variable is marked as needed. * tlink.c (recompile_files): Robustify. (scan_linker_output): If a symbol is assigned to a file, but after recompilation is not present there, issue an error message. * cp-tree.h (IDENTIFIER_REPO_CHOSEN): Define. (lang_decl_flags): Narrow the width of "languages". Add repo_available_p. (DECL_NEEDED_P): Remove. (FOR_EACH_CLONE): New macro. (DECL_REPO_AVAILABLE_P): Likewise. (DECL_TINFO_P): Likewise. (set_linkage_according_to_type): Declare. (import_export_vtable): Remove. (import_export_tinfo): Likewise. (mark_needed): New function. (decl_needed_p): Likewise. (note_vauge_linkage_fn): Likewise. (init_repo): Change prototype. (repo_template_used): Remove. (repo_template_instantiated): Likewise. (repo_emit_p): New function. (repo_export_class_p): Likewise. (no_linkage_check): Change prototype. * class.c (set_linkage_according_to_type): New function. (build_vtable): Use it. Do not call import_export_vtable. Set DECL_IGNORED_P if appropriate. * decl.c (duplicate_decls): Preserve DECL_REPO_AVAILABLE_P. (make_rtL_for_nonlocal_decls): Check for template instantiations explicitly. (grokfndecl): Adjust call to no_linkage_check. (set_linkage_for_static_data_member): New function. (grokvardecl): Use it. Adjust call to no_linkage_check. (grokdeclarator): Use set_linkage_for_static_data_member. * decl2.c (note_vague_linkage_fn): New function. (note_vague_linkage_var): Likewise. (finish_static_data_member_decl): Use it. (import_export_vtable): Remove. (import_export_class): Use repo_export_class_p. (var_finalized_p): Simplify. (maybe_emit_vtables): Simplify. (mark_needed): New function. (decl_needed_p): Likewise. (import_export_decl): Add documentation and consistency checks. Use repo_emit_p. Handle virtual tables and RTTI information here. (import_export_tinfo): Remove. (write_out_vars): Call import_export_decl. (cxx_callgraph_analyze_expr): Ensure that all vtables are emitted whenever one is. (finish_file): Use decl_needed_p. Do not call import_export_decl for undefined static data members. Do not warn about undefined inlines when using a repository. (mark_used): Use note_vague_linkage_fn. Always defer template instantiations. * lex.c (cxx_init): Adjust call to init_repo. Always set flag_unit_at_a-time. * method.c (synthesize_method): Remove unncessary import_export_decl call. (implicitly_declare_fn): Use set_linkage_according_to_type. * optimize.c (maybe_clone_body): Use FOR_EACH_CLONE. * pt.c (instantiate_class_template): Don't redundantly add classes to keyed_classes. Don't call repo_template_used. (tsubst_decl): Set DECL_INTERFACE_KNOWN for instantiations of templates with internal linkage. (check_instantiated_args): Adjust call to no_linkage_check. (instantiate_template): Use FOR_EACH_CLONE. (mark_definable): New function. (mark_decl_instantiated): Use it. (do_decl_instantiation): Adjust tests for explicit instantiation after "extern template". (instantiate_class_member): Do not use repo_template_instantiated. (do_type_instantiation): Simplify. (instantiate_decl): Use mark_definable. Check repo_emit_p. Simplify. * repo.c (repo_get_id): Remove. (original_repo): Remove. (IDENTIFIER_REPO_USED): Remove. (IDENTIFIER_REPO_CHOSEN): Remove. Remove all #if 0'd code. (repo_template_used): Remove. (repo_template_instantiated): Remove. (temporary_obstack_initialized_p): New variable. (init_repo): Register with lang_post_pch_load. Avoid creating identifiers unnecessarily. Don't use original_repo. Close the file here. (reopen_repo_file_for_write): Not here. (finish_repo): Always write out a new repository file. (repo_emit_p): New function. (repo_export_class_p): Likewise. * rtti.c (get_tinfo_decl): Use set_linkage_according_to_type. (involves_incomplete_p): New function. (tinfo_base_init): Use it. (ptr_initializer): Remove non_public_ptr parameter. (ptm_initializer): Likewise. (get_pseudo_ti_init): Likewise. (unemitted_tinfo_decl_p): Remove. (emit_tinfo_decl): Use import_export_decl. * semantics.c (expand_body): Move updates of static_ctors and static_dtors to ... (expand_or_defer_fn): ... here. * tree.c (no_linkage_check): Add relaxed_p parameter. * g++.dg/abi/inline1.C: New test. * g++.dg/abi/local1-a.cc: Likewise. * g++.dg/abi/local1.C: Likewise. * g++.dg/abi/mangle11.C: Tweak location of warnings. * g++.dg/abi/mangle12.C: Likewise. * g++.dg/abi/mangle17.C: Likewise. * g++.dg/abi/mangle20-2.C: Likewise. * g++.dg/opt/interface1.C: Likewise. * g++.dg/opt/interface1.h: Likewise. * g++.dg/opt/interface1-a.cc: New test. * g++.dg/parse/repo1.C: New test. * g++.dg/template/repo1.C: Likewise. * g++.dg/warn/Winline-1.C: Likewise. * lib/gcc-dg.exp (gcc-dg-test-1): Fix -frepo handling. From-SVN: r85309
2004-06-22c-opts.c (c_common_handle_option): Handle -fpch-preprocess.Geoffrey Keating1-12/+66
2004-06-21 Geoffrey Keating <geoffk@apple.com> * c-opts.c (c_common_handle_option): Handle -fpch-preprocess. * c-common.h (flag_pch_preprocess): Declare. (c_common_pch_pragma): Likewise. * c-common.c (flag_pch_preprocess): New. * c-pch.c (c_common_read_pch): Support -fpreprocess-only. (c_common_pch_pragma): New. * c-ppoutput.c (cb_read_pch): New. (init_pp_output): Support -fpch-preprocess. * c-pragma.c (init_pragma): Support #pragma GNUC pch_preprocess. * c.opt (fpch-preprocess): New. * gcc.c (cpp_options): When save-temps, pass -fpch-preprocess. * doc/cppopts.texi: Document -fpch-preprocess. * doc/invoke.texi (Precompiled Headers): Mention that -fpreprocessed is safe for PCH. Mention that if an option is listed as safe that doesn't mean it does what you expect. Index: gcc/testsuite/ChangeLog 2004-06-21 Geoffrey Keating <geoffk@apple.com> * gcc.dg/pch/save-temps-1.c: New file. * gcc.dg/pch/save-temps-1.hs: New file. Index: libcpp/ChangeLog 2004-06-21 Geoffrey Keating <geoffk@apple.com> * files.c (should_stack_file): Correct swapped parameters to call to cb.read_pch. * pch.c (cpp_valid_state): Handle -fpreprocessed. From-SVN: r83478
2004-06-05toplev.c (init_asm_output): Add explicit 'b' to mode when opening asm_out_file.Danny Smith1-3/+4
* toplev.c (init_asm_output): Add explicit 'b' to mode when opening asm_out_file. * c-pch.c (c_common_write_pch): Remove unnecessary fflush before reading asm_out_file. Replace fflush after reading asm_out_file with fseek. * hosthooks-def.h (HOST_HOOKS_GT_PCH_ALLOC_GRANULARITY): Define default and add to HOST_HOOKS_INITIALIZER. * hosthooks.h (gt_pch_alloc_granularity): Declare hook function. * ggc-common.c (default_gt_pch_alloc_granularity): New function. (gt_pch_save): Use host_hooks.gt_pch_alloc_granularity to set mmi.offset padding. * config.gcc (i[34567]86-*-mingw32*): Set target_gtfiles to $(srcdir)/config/i386/winnt.c. (i[34567]86-*-pe | i[34567]86-*-cygwin*): Likewise. (i[34567]86-*-uwin*): Likewise. *i[34567]86-*-interix3*): Likewise. * config.host (i[34567]86-*-mingw32*): Set out_host_hook_obj. * config/i386/host-mingw32.c: New file. * config/i386/x-mingw32: Add rule for host-mingw32.o. * config/i386/winnt.c: (struct extern_list) Tag as GTY. (extern_head): Likewise. (struct export_list) Likewise. (export_head): Likewise. (i386_pe_record_external_function): Use ggc_alloc. (i386_pe_record_exported_symbol): Likewise. Include "gt-winnt.h" at end. * doc/hostconfig.texi: Document HOST_HOOKS_GT_PCH_ALLOC_GRANULARITY. From-SVN: r82643
2004-04-08re PR pch/13419 (Clarification of invoke.texi requested)Geoffrey Keating1-0/+41
2004-04-08 Geoffrey Keating <geoffk@apple.com> PR pch/13419 PR pch/14137 Radar #: 3315288 * doc/invoke.texi (Precompiled Headers): Suggest -o to put an output file in a particular place. Be more detailed about which options affect PCH validity and which options might not work. * c-pch.c (pch_matching): New. (MATCH_SIZE): New. (struct c_pch_validity): New field 'match'. (pch_init): Handle pch_matching. (c_common_valid_pch): Check pch_matching. Index: testsuite/ChangeLog 2004-04-08 Geoffrey Keating <geoffk@apple.com> * gcc.dg/pch/valid-1.c, gcc.dg/pch/valid-2.c, gcc.dg/pch/valid-3.c, gcc.dg/pch/valid-4.c, gcc.dg/pch/valid-5.c, gcc.dg/pch/valid-6.c, gcc.dg/pch/valid-1.hs, gcc.dg/pch/valid-2.hs, gcc.dg/pch/valid-3.hs, gcc.dg/pch/valid-4.hs, gcc.dg/pch/valid-5.hs, gcc.dg/pch/valid-6.hs: New tests. From-SVN: r80531
2004-03-15c-incpath.c, [...]: Update copyright.Kazu Hirata1-1/+1
gcc/ * c-incpath.c, c-incpath.h, c-pch.c, c.opt, cppexp.c, et-forest.h, genattr.c, ggc-none.c, hosthooks-def.h, hosthooks.h, params.h, ra-colorize.c, web.c, config/darwin-c.c, config/alpha/freebsd.h, config/arm/pe.c, config/avr/avr-protos.h, config/avr/avr.md, config/fr30/fr30-protos.h, config/fr30/fr30.md, config/h8300/fixunssfsi.c, config/i386/darwin.h, config/i386/freebsd.h, config/i386/freebsd64.h, config/ia64/hpux.h, config/ia64/unwind-ia64.c, config/ip2k/libgcc.S, config/m32r/xm-m32r.h, config/mmix/mmix-modes.def, config/ns32k/netbsd.h, config/ns32k/ns32k.md, config/pa/pa64-hpux.h, config/pa/pa64-regs.h, config/rs6000/aix41.h, config/rs6000/aix43.h, config/rs6000/host-darwin.c, config/sparc/aout.h, config/sparc/freebsd.h, config/sparc/litecoff.h, config/vax/vax-protos.h, doc/hostconfig.texi, doc/include/gcc-common.texi: Update copyright. gcc/cp/ * cp-lang.c, ptree.c: Update copyright. From-SVN: r79506
2004-03-10c-pch.c (c_common_no_more_pch): Update for gt_pch_use_address extra arguments.Richard Henderson1-1/+1
* c-pch.c (c_common_no_more_pch): Update for gt_pch_use_address extra arguments. * config.host (*-*-solaris2*, *-*-linux*): Add out_host_hook_obj and host_xmake_file fragments. * ggc-common.c (gt_pch_save): Update for gt_pch_get_address change. (gt_pch_restore): Similarly for gt_pch_use_address. (default_gt_pch_get_address): New. (mmap_gt_pch_get_address): Split out of gt_pch_save. (default_gt_pch_use_address): Split out of gt_pch_restore. (mmap_gt_pch_use_address): Likewise. * hooks.c (hook_voidp_size_t_null): Remove. (hook_bool_voidp_size_t_false): Remove. * hooks.h: Likewise. * hosthooks-def.h (HOST_HOOKS_GT_PCH_GET_ADDRESS): Use one of the default_ or mmap_ definitions. (HOST_HOOKS_GT_PCH_USE_ADDRESS): Likewise. * hosthooks.h (struct host_hooks): Update gt_pch_get_address and gt_pch_use_address. * config/host-linux.c, config/host-solaris.c: New files. * config/x-linux, config/x-solaris: New files. * config/rs6000/host-darwin.c darwin_rs6000_gt_pch_get_address): Update for changed definition. (darwin_rs6000_gt_pch_use_address): Likewise. * doc/hostconfig.texi: Update docs. From-SVN: r79295
2003-12-17re PR pch/12480 (pch error messages do not say they for PCH.)Geoffrey Keating1-2/+7
PR 12480 * c-pch.c (pch_init): Improve error message when precompiled header can't be written. PR 12606 * c-pch.c (pch_init): Make a PCH file appear invalid while it's being written. (c_common_write_pch): Make it valid once it's done. From-SVN: r74754
2003-11-01re PR preprocessor/12847 (xxx.c:1:20: xxxx.h: No such file or directory)John David Anglin1-12/+12
PR preprocessor/12847 * cppfiles.c, cppexp.c, cpperror.c, cpplib.h, cpplib.c, cpplex.c, cppinit.c, cpptrad.c, cppmacro.c, fix-header.c, cpppch.c, c-pch.c, c-incpath.c, cppcharset.c (DL_WARNING, DL_WARNING_SYSHDR, DL_PEDWARN, DL_ERROR, DL_ICE, DL_EXTRACT, DL_WARNING_P): Prefix macro names with "CPP_". From-SVN: r73183
2003-10-24re PR pch/10757 (Adding -fpic/-fPIC causes crash with PCH created without ↵Geoffrey Keating1-5/+33
-fpic/-fPIC) PR 10757 * c-pch.c: Include target.h. Improve comments. (struct c_pch_validity): Add target_data_length. (pch_init): Add target's validity data. (c_common_valid_pch): Check target's validity data. * target-def.h (TARGET_GET_PCH_VALIDITY): New. (TARGET_PCH_VALID_P): New. (TARGET_INITIALIZER): Add new fields. * target.h: Include tm.h. (struct gcc_target): Add get_pch_validity, pch_valid_p. * toplev.h (default_get_pch_validity): New prototype. (default_pch_valid_p): New prototype. * toplev.c (default_get_pch_validity): New routine. (default_pch_valid_p): New routine. * Makefile.in (TARGET_H): Add TM_H. Replace all users of target.h with $(TARGET_H). (c-pch.o): Add TARGET_H. * doc/tm.texi (PCH Target): New node. (TARGET_GET_PCH_VALIDITY): Document. (TARGET_PCH_VALID_P): Document. From-SVN: r72909
2003-10-22c-pch.c (struct c_pch_validity): Add pch_init field.Mark Mitchell1-0/+14
* c-pch.c (struct c_pch_validity): Add pch_init field. (pch_init): Set it. (c_common_valid_pch): Check it. (get_ident): Bump the PCH version number. From-SVN: r72804
2003-10-21c-pch.c: Add comments in various places.Geoffrey Keating1-2/+75
* c-pch.c: Add comments in various places. (struct c_pch_validity): Add the lengths of various strings. (host_machine): New static. (target_machine): New static. (get_ident): Bump version number. (pch_init): Write out version, host, target validity data. (c_common_valid_pch): Check version, host, target. * Makefile.in (c-pch.o): Add version.h; define HOST_MACHINE and TARGET_MACHINE. From-SVN: r72774
2003-07-29c-common.c (allow_pch): Remove.Geoffrey Keating1-4/+14
2003-07-29 Geoffrey Keating <geoffk@apple.com> * c-common.c (allow_pch): Remove. * c-common.h (allow_pch): Remove. (c_common_no_more_pch): Declare. * c-lex.c (c_lex): Call c_common_no_more_pch when appropriate. * c-pch.c: Include hosthooks.h. (c_common_valid_pch): Don't check allow_pch. (c_common_read_pch): Clear valid_pch to prevent reading PCH files. (c_common_no_more_pch): New. * ggc-common.c: Include hosthooks.h. (gt_pch_save): Call gt_pch_get_address. (gt_pch_restore): Call gt_pch_use_address. * hooks.c (hook_voidp_size_t_null): New. (hook_bool_voidp_size_t_false): New. * hooks.h (hook_voidp_size_t_null): New. (hook_bool_voidp_size_t_false): New. * hosthooks-def.h (HOST_HOOKS_GT_PCH_GET_ADDRESS): New. (HOST_HOOKS_GT_PCH_USE_ADDRESS): New. (HOST_HOOKS_INITIALIZER): Add HOST_HOOKS_GT_PCH_GET_ADDRESS, HOST_HOOKS_GT_PCH_USE_ADDRESS. * hosthooks.h (struct host_hooks): Add gt_pch_get_address, gt_pch_use_address. * doc/hostconfig.texi (Host Common): Document HOST_HOOKS_GT_PCH_GET_ADDRESS, HOST_HOOKS_GT_PCH_USE_ADDRESS. * Makefile.in (c-pch.o): Depend on hosthooks.h. (ggc-common.o): Likewise. * config/rs6000/host-darwin.c (HOST_HOOKS_GT_PCH_GET_ADDRESS): Define. (HOST_HOOKS_GT_PCH_USE_ADDRESS): Define. (pch_address_space): New. (darwin_rs6000_gt_pch_get_address): New. (darwin_rs6000_gt_pch_use_address): New. Index: cp/ChangeLog 2003-07-29 Geoffrey Keating <geoffk@apple.com> * parser.c (cp_lexer_new_main): Use c_common_no_more_pch instead of setting valid_pch by hand. From-SVN: r69944
2003-06-30c-common.c (enum c_language_kind, flag_objc): Remove.Neil Booth1-6/+3
* c-common.c (enum c_language_kind, flag_objc): Remove. (fix_string_type, check_case_value, c_common_nodes_and_builtins, c_add_case_label, finish_label_addr_expr, boolean_increment): Use c_dialect_ macros. * c-common.h (enum c_language_kind): Extend. (c_dialect_cxx, c_dialect_objc): New. (flag_objc): Remove. (c_common_init_options): Update prototype. * c-cppbuiltin.c (define__GNUC__, c_cpp_builtins): Use c_dialect_ macros. * c-decl.c (finsih_decl, grokfield, finish_struct): Use c_dialect_ macros. * c-format.c (C_STD_VER, C_STD_NAME): Similarly. * c-lang.c (c_init_options): Remove. (c_language): Define. (LANG_HOOKS_INIT_OPTIONS): Use common hook. * c-lex.c (lex_charconst): Use c_dialect_cxx(). * c-opts.c (lang_flags): Make function-local. (c_common_init_options): Use c_dialect_ macros. Handle C++ diagnostic requirements. (c_common_handle_option, c_common_post_options): Use flag_cxx. * c-parse.in (init_reswords): Use c_dialect_objc (). * c-pch.c (get_ident): Use c_language. * c-pretty-print.c (pp_c_bool_literal): Use c_dialect_ macros. * c-typeck.c (comptypes, build_c_cast): Similarly. * objc/objc-lang.c (c_language): Define. (LANG_HOOKS_INIT_OPTIONS): Use common hook. (objc_init_options): Remove. cp: * Make-lang.in: Update. * cp-lang.c (c_language): Define. (LANG_HOOKS_INIT_OPTIONS): Use common hook. * cp-tree.h (cxx_init_options): Remove. * lex.c: Don't include diagnostic.h. (cxx_init_options): Remove. From-SVN: r68734
2003-06-30c-pch.c (c_common_write_pch): Flush asm_out_file to allow for subsequent writes.Rainer Orth1-0/+2
* c-pch.c (c_common_write_pch): Flush asm_out_file to allow for subsequent writes. From-SVN: r68696
2003-06-22c-lex.c: Convert to ISO C90.Andreas Jaeger1-14/+8
* c-lex.c: Convert to ISO C90. * c-objc-common.c: Likewise. * c-opts.c: Likewise. * c-pch.c: Likewise. * c-ppoutput.c: Likewise. * c-pragma.h: Likewise. * c-pretty-print.c: Likewise. * c-pretty-print.h: Likewise. * c-semantics.c: Likewise. * c-tree.h: Likewise. * c-typeck.c: Likewise. From-SVN: r68327
2003-06-15c-pch.c (asm_file_name): Remove.Neil Booth1-1/+0
* c-pch.c (asm_file_name): Remove. * common.opt: Add more switches. * flags.h (g_switch_set): Boolify. * opts.c (g_switch_value, g_switch_set, exit_after_options, version_flag): Move from toplev.c. (common_handle_option): Handle more switches from toplev.c. * toplev.c (display_help, display_target_options, decode_d_option, print_version): Make non-static, remove prototypes. (aux_base_name, asm_file_name, aux_info_file_name): Constify. (version_flag, g_switch_value, g_switch_set, exit_after_options): Remove. (independent_decode_option): Move some handlers to opts.c. * toplev.h (aux_info_file_name, aux_base_name, asm_file_name, exit_after_options, version_flag, display_help, display_target_options, print_version, decode_d_option): New. java: * lang.c (version_flag): Rename to v_flag to avoid clash w/ toplev.h. From-SVN: r67971
2003-05-13diagnostic.c (output_format): Add support for %m.Zack Weinberg1-14/+8
* diagnostic.c (output_format): Add support for %m. (output_printf, output_verbatim, diagnostic_set_info, verbatim): Set err_no field of the text_info structure being initialized. (fatal_io_error): Delete function. * diagnostic.h (text_info): Add err_no field. * toplev.h (fatal_io_error): Delete prototype. * c-opts.c, c-pch.c, dwarfout.c, ggc-common.c, ggc-page.c, graph.c * toplev.c, config/mips/mips.c, config/rs6000/host-darwin.c * f/com.c, java/jcf-parse.c, java/jcf-write.c, java/lex.c * objc/objc-act.c: Replace all calls to fatal_io_error with calls to fatal_error; add ": %m" to the end of all the affected error messages. From-SVN: r66769
2003-04-12c-pch.c: Include flags.h.Geoffrey Keating1-25/+72
* c-pch.c: Include flags.h. Add comments to routines. (struct c_pch_validity): New. (get_ident): Update PCH file version number. (pch_init): Output current debugging type. (c_common_valid_pch): Check debugging type. * Makefile.in (c-pch.o): Update dependencies. * flags.h (debug_type_names): Declare. * toplev.c (debug_type_names): Move out of decode_g_option. From-SVN: r65499
2003-04-05dbxout.c (scope_labelno): Add GTY.Geoffrey Keating1-11/+6
2003-04-04 Geoffrey Keating <geoffk@apple.com> * dbxout.c (scope_labelno): Add GTY. (have_used_extensions): Add GTY. (source_label_number): Add GTY. (lastfile): Add GTY. (lastfile_is_base): New. (base_input_file): New. (dbxout_handle_pch): New. (dbx_debug_hooks): Add handle_pch. (xcoff_debug_hooks): Likewise. (dbxout_function_end): Remove scope_labelno. (dbxout_init): Set base_input_file. (dbxout_handle_pch): New. (dbxout_source_file): Honour lastfile_is_base. * dwarfout.c (dwarf_debug_hooks): Add dummy handle_pch. * sdbout.c (sdb_debug_hooks): Add dummy handle_pch. * vmsdbgout.c (vmsdbg_debug_hooks): Add dummy handle_pch. * dwarf2out.c (dwarf2_debug_hooks): Add dummy handle_pch. * debug.c (do_nothing_debug_hooks): Add dummy handle_pch. * debug.h (struct gcc_debug_hooks): Add handle_pch. * c-pch.c (pch_init): Don't call start_source_file, but do call handle_pch. (c_common_write_pch): Call handle_pch. (c_common_read_pch): Don't call start_source_file, or end_source_file. Index: gcc/testsuite/ChangeLog 2003-04-04 Geoffrey Keating <geoffk@apple.com> * gcc.dg/pch/static-3.c: New. * gcc.dg/pch/static-3.hs: New. * gcc.dg/pch/pch.exp: Test with -O0 -g too. From-SVN: r65266
2003-03-13c-pch.c, [...]: Replace "GNU CC" with "GCC".Nathanael Nerode1-4/+4
* c-pch.c, dummy-conditions.c, genautomata.c, genconditions.c, langhooks.c, tree-inline.c, unwind-dw2-fde-darwin.c, unwind-dw2-fde-glibc.c, unwind-libunwind.c, vmsdbgout.c: Replace "GNU CC" with "GCC". From-SVN: r64297
2003-03-07lang-specs.h (objective-c-header): Use .gch not .pch; support ↵Geoffrey Keating1-8/+4
-no-integrated-cpp. * objc/lang-specs.h (objective-c-header): Use .gch not .pch; support -no-integrated-cpp. * c-pch.c (get_ident): Use c_language_kind and flag_objc rather than langhooks.name. From-SVN: r63955
2003-03-07c-pch.c: Include langhooks.h.Geoffrey Keating1-7/+33
* c-pch.c: Include langhooks.h. (IDENT_LENGTH): New. (get_ident): New. (pch_ident): Delete. (pch_init): Use get_ident, IDENT_LENGTH. (c_common_valid_pch): Likewise. Also, use actual language in warning message. * Makefile.in (c-pch.o): Add langhooks.h to dependencies. * objc/config-lang.in (gtfiles): Add objc-act.c. Remove duplicate c-parse.in. * objc/Make-lang.in (objc/objc-act.o): Add dependency on gt-objc-objc-act.h. (gt-objc-objc-act.h): New rule. * objc/lang-specs.h: Support PCH. * objc/objc-act.c: Include gt-objc-objc-act.h. (objc_add_static_instance): Move num_static_inst out, mark for PCH. (build_selector_reference_decl): Move idx out, mark for PCH. (build_class_reference_decl): Likewise. (build_objc_string_decl): Move *_idx out, mark for PCH. (build_tmp_function_decl): Move xxx out, mark for PCH. From-SVN: r63924
2003-01-12c-pch.c (asm_file_startpos): Change to `long'.Kaveh R. Ghazi1-8/+8
* c-pch.c (asm_file_startpos): Change to `long'. (pch_init): Use ftell, not ftello. (c_common_write_pch): Use ftell/fseek, not ftello/fseeko. Use `long' instead of `off_t'. (c_common_read_pch): Likewise. * ggc-common.c (gt_pch_save): Use long/ftell instead of off_t/ftello. From-SVN: r61233
2003-01-10Merge from pch-branch.Geoffrey Keating1-0/+226
From-SVN: r61136