2003-01-10 03:22:34 +01:00
|
|
|
/* Precompiled header implementation for the C languages.
|
c-pch.c, [...]: Update copyright.
* 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-27 02:14:08 +02:00
|
|
|
Copyright (C) 2000, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
|
2003-01-10 03:22:34 +01:00
|
|
|
|
c-pch.c, [...]: Replace "GNU CC" with "GCC".
* 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-13 04:48:31 +01:00
|
|
|
This file is part of GCC.
|
2003-01-10 03:22:34 +01:00
|
|
|
|
c-pch.c, [...]: Replace "GNU CC" with "GCC".
* 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-13 04:48:31 +01:00
|
|
|
GCC is free software; you can redistribute it and/or modify
|
2003-01-10 03:22:34 +01:00
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
any later version.
|
|
|
|
|
c-pch.c, [...]: Replace "GNU CC" with "GCC".
* 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-13 04:48:31 +01:00
|
|
|
GCC is distributed in the hope that it will be useful,
|
2003-01-10 03:22:34 +01:00
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
c-pch.c, [...]: Replace "GNU CC" with "GCC".
* 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-13 04:48:31 +01:00
|
|
|
along with GCC; see the file COPYING. If not, write to
|
2005-06-25 04:02:01 +02:00
|
|
|
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
|
|
|
Boston, MA 02110-1301, USA. */
|
2003-01-10 03:22:34 +01:00
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
#include "system.h"
|
|
|
|
#include "coretypes.h"
|
2003-10-22 01:28:05 +02:00
|
|
|
#include "version.h"
|
2003-01-10 03:22:34 +01:00
|
|
|
#include "cpplib.h"
|
|
|
|
#include "tree.h"
|
2003-04-12 03:58:33 +02:00
|
|
|
#include "flags.h"
|
2003-01-10 03:22:34 +01:00
|
|
|
#include "c-common.h"
|
|
|
|
#include "output.h"
|
|
|
|
#include "toplev.h"
|
|
|
|
#include "debug.h"
|
|
|
|
#include "c-pragma.h"
|
|
|
|
#include "ggc.h"
|
2003-03-07 02:20:52 +01:00
|
|
|
#include "langhooks.h"
|
2003-07-30 01:36:53 +02:00
|
|
|
#include "hosthooks.h"
|
2003-10-24 23:28:13 +02:00
|
|
|
#include "target.h"
|
2003-01-10 03:22:34 +01:00
|
|
|
|
re PR pch/13419 (Clarification of invoke.texi requested)
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-04-09 01:41:09 +02:00
|
|
|
/* This is a list of flag variables that must match exactly, and their
|
|
|
|
names for the error message. The possible values for *flag_var must
|
|
|
|
fit in a 'signed char'. */
|
|
|
|
|
2006-05-19 00:16:23 +02:00
|
|
|
static const struct c_pch_matching
|
re PR pch/13419 (Clarification of invoke.texi requested)
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-04-09 01:41:09 +02:00
|
|
|
{
|
|
|
|
int *flag_var;
|
|
|
|
const char *flag_name;
|
|
|
|
} pch_matching[] = {
|
|
|
|
{ &flag_exceptions, "-fexceptions" },
|
|
|
|
{ &flag_unit_at_a_time, "-funit-at-a-time" }
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
MATCH_SIZE = ARRAY_SIZE (pch_matching)
|
|
|
|
};
|
|
|
|
|
2005-05-18 22:45:26 +02:00
|
|
|
/* The value of the checksum in the dummy compiler that is actually
|
|
|
|
checksummed. That compiler should never be run. */
|
|
|
|
static const char no_checksum[16] = { 0 };
|
2003-10-22 01:28:05 +02:00
|
|
|
|
2005-05-18 22:45:26 +02:00
|
|
|
/* Information about flags and suchlike that affect PCH validity.
|
2003-10-24 23:28:13 +02:00
|
|
|
|
2005-05-18 22:45:26 +02:00
|
|
|
Before this structure is read, both an initial 8-character identification
|
|
|
|
string, and a 16-byte checksum, have been read and validated. */
|
2003-10-22 01:28:05 +02:00
|
|
|
|
2003-04-12 03:58:33 +02:00
|
|
|
struct c_pch_validity
|
|
|
|
{
|
|
|
|
unsigned char debug_info_type;
|
re PR pch/13419 (Clarification of invoke.texi requested)
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-04-09 01:41:09 +02:00
|
|
|
signed char match[MATCH_SIZE];
|
2003-10-22 17:44:44 +02:00
|
|
|
void (*pch_init) (void);
|
2003-10-24 23:28:13 +02:00
|
|
|
size_t target_data_length;
|
2003-04-12 03:58:33 +02:00
|
|
|
};
|
|
|
|
|
2006-05-19 00:16:23 +02:00
|
|
|
struct c_pch_header
|
2003-01-10 03:22:34 +01:00
|
|
|
{
|
|
|
|
unsigned long asm_size;
|
|
|
|
};
|
|
|
|
|
2003-03-07 02:20:52 +01:00
|
|
|
#define IDENT_LENGTH 8
|
2003-01-10 03:22:34 +01:00
|
|
|
|
2003-10-22 01:28:05 +02:00
|
|
|
/* The file we'll be writing the PCH to. */
|
2003-01-10 03:22:34 +01:00
|
|
|
static FILE *pch_outfile;
|
|
|
|
|
2003-10-22 01:28:05 +02:00
|
|
|
/* The position in the assembler output file when pch_init was called. */
|
2003-01-12 17:44:09 +01:00
|
|
|
static long asm_file_startpos;
|
2003-01-10 03:22:34 +01:00
|
|
|
|
2003-06-22 15:41:26 +02:00
|
|
|
static const char *get_ident (void);
|
2003-03-07 02:20:52 +01:00
|
|
|
|
2003-04-12 03:58:33 +02:00
|
|
|
/* Compute an appropriate 8-byte magic number for the PCH file, so that
|
|
|
|
utilities like file(1) can identify it, and so that GCC can quickly
|
|
|
|
ignore non-PCH files and PCH files that are of a completely different
|
|
|
|
format. */
|
|
|
|
|
2003-03-07 02:20:52 +01:00
|
|
|
static const char *
|
c-aux-info.c, [...]: Follow code formatting conventions.
* 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-10-03 22:53:05 +02:00
|
|
|
get_ident (void)
|
2003-03-07 02:20:52 +01:00
|
|
|
{
|
|
|
|
static char result[IDENT_LENGTH];
|
2005-05-18 22:45:26 +02:00
|
|
|
static const char template[IDENT_LENGTH] = "gpch.013";
|
c-common.c (enum c_language_kind, flag_objc): Remove.
* 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-30 21:36:25 +02:00
|
|
|
static const char c_language_chars[] = "Co+O";
|
2006-05-19 00:16:23 +02:00
|
|
|
|
2003-03-07 02:20:52 +01:00
|
|
|
memcpy (result, template, IDENT_LENGTH);
|
c-common.c (enum c_language_kind, flag_objc): Remove.
* 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-30 21:36:25 +02:00
|
|
|
result[4] = c_language_chars[c_language];
|
|
|
|
|
2003-03-07 02:20:52 +01:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2005-05-18 22:45:26 +02:00
|
|
|
/* Prepare to write a PCH file, if one is being written. This is
|
2006-05-19 00:16:23 +02:00
|
|
|
called at the start of compilation.
|
2005-05-18 22:45:26 +02:00
|
|
|
|
|
|
|
Also, print out the executable checksum if -fverbose-asm is in effect. */
|
2003-04-12 03:58:33 +02:00
|
|
|
|
2003-01-10 03:22:34 +01:00
|
|
|
void
|
2003-06-22 15:41:26 +02:00
|
|
|
pch_init (void)
|
2003-01-10 03:22:34 +01:00
|
|
|
{
|
|
|
|
FILE *f;
|
2003-04-12 03:58:33 +02:00
|
|
|
struct c_pch_validity v;
|
2003-10-24 23:28:13 +02:00
|
|
|
void *target_validity;
|
2003-12-17 23:04:34 +01:00
|
|
|
static const char partial_pch[IDENT_LENGTH] = "gpcWrite";
|
2006-05-19 00:16:23 +02:00
|
|
|
|
2005-05-18 22:45:26 +02:00
|
|
|
#ifdef ASM_COMMENT_START
|
|
|
|
if (flag_verbose_asm)
|
|
|
|
{
|
|
|
|
fprintf (asm_out_file, "%s ", ASM_COMMENT_START);
|
|
|
|
c_common_print_pch_checksum (asm_out_file);
|
|
|
|
fputc ('\n', asm_out_file);
|
|
|
|
}
|
|
|
|
#endif
|
2006-05-19 00:16:23 +02:00
|
|
|
|
c-aux-info.c, [...]: Follow code formatting conventions.
* 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-10-03 22:53:05 +02:00
|
|
|
if (!pch_file)
|
2003-04-12 03:58:33 +02:00
|
|
|
return;
|
2006-05-19 00:16:23 +02:00
|
|
|
|
2003-04-12 03:58:33 +02:00
|
|
|
f = fopen (pch_file, "w+b");
|
|
|
|
if (f == NULL)
|
builtins.c, [...]: Avoid "`" as left quote, using "'" or %q, %< and %> as 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-11-09 11:13:30 +01:00
|
|
|
fatal_error ("can%'t create precompiled header %s: %m", pch_file);
|
2003-04-12 03:58:33 +02:00
|
|
|
pch_outfile = f;
|
c-aux-info.c (gen_type): Use gcc_assert or gcc_unreachable.
* 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-09-07 12:19:00 +02:00
|
|
|
|
2005-05-18 22:45:26 +02:00
|
|
|
gcc_assert (memcmp (executable_checksum, no_checksum, 16) != 0);
|
2006-05-19 00:16:23 +02:00
|
|
|
|
2003-04-12 03:58:33 +02:00
|
|
|
v.debug_info_type = write_symbols;
|
re PR pch/13419 (Clarification of invoke.texi requested)
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-04-09 01:41:09 +02:00
|
|
|
{
|
|
|
|
size_t i;
|
|
|
|
for (i = 0; i < MATCH_SIZE; i++)
|
|
|
|
{
|
|
|
|
v.match[i] = *pch_matching[i].flag_var;
|
c-aux-info.c (gen_type): Use gcc_assert or gcc_unreachable.
* 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-09-07 12:19:00 +02:00
|
|
|
gcc_assert (v.match[i] == *pch_matching[i].flag_var);
|
re PR pch/13419 (Clarification of invoke.texi requested)
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-04-09 01:41:09 +02:00
|
|
|
}
|
|
|
|
}
|
2003-10-22 17:44:44 +02:00
|
|
|
v.pch_init = &pch_init;
|
2003-10-24 23:28:13 +02:00
|
|
|
target_validity = targetm.get_pch_validity (&v.target_data_length);
|
2006-05-19 00:16:23 +02:00
|
|
|
|
2003-12-17 23:04:34 +01:00
|
|
|
if (fwrite (partial_pch, IDENT_LENGTH, 1, f) != 1
|
2005-05-18 22:45:26 +02:00
|
|
|
|| fwrite (executable_checksum, 16, 1, f) != 1
|
2003-10-22 01:28:05 +02:00
|
|
|
|| fwrite (&v, sizeof (v), 1, f) != 1
|
2003-10-24 23:28:13 +02:00
|
|
|
|| fwrite (target_validity, v.target_data_length, 1, f) != 1)
|
builtins.c, [...]: Avoid "`" as left quote, using "'" or %q, %< and %> as 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-11-09 11:13:30 +01:00
|
|
|
fatal_error ("can%'t write to %s: %m", pch_file);
|
2003-04-12 03:58:33 +02:00
|
|
|
|
|
|
|
/* We need to be able to re-read the output. */
|
|
|
|
/* The driver always provides a valid -o option. */
|
|
|
|
if (asm_file_name == NULL
|
|
|
|
|| strcmp (asm_file_name, "-") == 0)
|
attribs.c, [...]: Use %<, %> and %q for quoting in diagnostics going through 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-15 22:48:10 +02:00
|
|
|
fatal_error ("%qs is not a valid output file", asm_file_name);
|
2006-05-19 00:16:23 +02:00
|
|
|
|
2003-04-12 03:58:33 +02:00
|
|
|
asm_file_startpos = ftell (asm_out_file);
|
2006-05-19 00:16:23 +02:00
|
|
|
|
2003-04-12 03:58:33 +02:00
|
|
|
/* Let the debugging format deal with the PCHness. */
|
|
|
|
(*debug_hooks->handle_pch) (0);
|
2006-05-19 00:16:23 +02:00
|
|
|
|
2003-04-12 03:58:33 +02:00
|
|
|
cpp_save_state (parse_in, f);
|
2003-01-10 03:22:34 +01:00
|
|
|
}
|
|
|
|
|
2003-04-12 03:58:33 +02:00
|
|
|
/* Write the PCH file. This is called at the end of a compilation which
|
|
|
|
will produce a PCH file. */
|
|
|
|
|
2003-01-10 03:22:34 +01:00
|
|
|
void
|
2003-06-22 15:41:26 +02:00
|
|
|
c_common_write_pch (void)
|
2003-01-10 03:22:34 +01:00
|
|
|
{
|
|
|
|
char *buf;
|
2003-01-12 17:44:09 +01:00
|
|
|
long asm_file_end;
|
|
|
|
long written;
|
2003-01-10 03:22:34 +01:00
|
|
|
struct c_pch_header h;
|
|
|
|
|
2003-04-05 09:01:51 +02:00
|
|
|
(*debug_hooks->handle_pch) (1);
|
|
|
|
|
2003-01-10 03:22:34 +01:00
|
|
|
cpp_write_pch_deps (parse_in, pch_outfile);
|
|
|
|
|
2003-01-12 17:44:09 +01:00
|
|
|
asm_file_end = ftell (asm_out_file);
|
2003-01-10 03:22:34 +01:00
|
|
|
h.asm_size = asm_file_end - asm_file_startpos;
|
2006-05-19 00:16:23 +02:00
|
|
|
|
2003-01-10 03:22:34 +01:00
|
|
|
if (fwrite (&h, sizeof (h), 1, pch_outfile) != 1)
|
builtins.c, [...]: Avoid "`" as left quote, using "'" or %q, %< and %> as 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-11-09 11:13:30 +01:00
|
|
|
fatal_error ("can%'t write %s: %m", pch_file);
|
2006-05-19 00:16:23 +02:00
|
|
|
|
2005-12-17 21:45:46 +01:00
|
|
|
buf = XNEWVEC (char, 16384);
|
2003-01-10 03:22:34 +01:00
|
|
|
|
2003-01-12 17:44:09 +01:00
|
|
|
if (fseek (asm_out_file, asm_file_startpos, SEEK_SET) != 0)
|
builtins.c, [...]: Avoid "`" as left quote, using "'" or %q, %< and %> as 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-11-09 11:13:30 +01:00
|
|
|
fatal_error ("can%'t seek in %s: %m", asm_file_name);
|
2003-01-10 03:22:34 +01:00
|
|
|
|
|
|
|
for (written = asm_file_startpos; written < asm_file_end; )
|
|
|
|
{
|
2003-01-12 17:44:09 +01:00
|
|
|
long size = asm_file_end - written;
|
2003-01-10 03:22:34 +01:00
|
|
|
if (size > 16384)
|
|
|
|
size = 16384;
|
|
|
|
if (fread (buf, size, 1, asm_out_file) != 1)
|
builtins.c, [...]: Avoid "`" as left quote, using "'" or %q, %< and %> as 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-11-09 11:13:30 +01:00
|
|
|
fatal_error ("can%'t read %s: %m", asm_file_name);
|
2003-01-10 03:22:34 +01:00
|
|
|
if (fwrite (buf, size, 1, pch_outfile) != 1)
|
builtins.c, [...]: Avoid "`" as left quote, using "'" or %q, %< and %> as 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-11-09 11:13:30 +01:00
|
|
|
fatal_error ("can%'t write %s: %m", pch_file);
|
2003-01-10 03:22:34 +01:00
|
|
|
written += size;
|
|
|
|
}
|
|
|
|
free (buf);
|
2004-06-05 09:28:27 +02:00
|
|
|
/* asm_out_file can be written afterwards, so fseek to clear
|
|
|
|
_IOREAD flag. */
|
|
|
|
if (fseek (asm_out_file, 0, SEEK_END) != 0)
|
builtins.c, [...]: Avoid "`" as left quote, using "'" or %q, %< and %> as 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-11-09 11:13:30 +01:00
|
|
|
fatal_error ("can%'t seek in %s: %m", asm_file_name);
|
2003-01-10 03:22:34 +01:00
|
|
|
|
|
|
|
gt_pch_save (pch_outfile);
|
|
|
|
cpp_write_pch_state (parse_in, pch_outfile);
|
|
|
|
|
2003-12-17 23:04:34 +01:00
|
|
|
if (fseek (pch_outfile, 0, SEEK_SET) != 0
|
|
|
|
|| fwrite (get_ident (), IDENT_LENGTH, 1, pch_outfile) != 1)
|
builtins.c, [...]: Avoid "`" as left quote, using "'" or %q, %< and %> as 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-11-09 11:13:30 +01:00
|
|
|
fatal_error ("can%'t write %s: %m", pch_file);
|
2003-12-17 23:04:34 +01:00
|
|
|
|
2003-01-10 03:22:34 +01:00
|
|
|
fclose (pch_outfile);
|
|
|
|
}
|
|
|
|
|
2003-10-24 23:28:13 +02:00
|
|
|
/* Check the PCH file called NAME, open on FD, to see if it can be
|
|
|
|
used in this compilation. Return 1 if valid, 0 if the file can't
|
|
|
|
be used now but might be if it's seen later in the compilation, and
|
|
|
|
2 if this file could never be used in the compilation. */
|
2003-04-12 03:58:33 +02:00
|
|
|
|
2003-01-10 03:22:34 +01:00
|
|
|
int
|
2003-06-22 15:41:26 +02:00
|
|
|
c_common_valid_pch (cpp_reader *pfile, const char *name, int fd)
|
2003-01-10 03:22:34 +01:00
|
|
|
{
|
|
|
|
int sizeread;
|
|
|
|
int result;
|
2005-05-18 22:45:26 +02:00
|
|
|
char ident[IDENT_LENGTH + 16];
|
2003-03-07 02:20:52 +01:00
|
|
|
const char *pch_ident;
|
2003-04-12 03:58:33 +02:00
|
|
|
struct c_pch_validity v;
|
2003-01-10 03:22:34 +01:00
|
|
|
|
|
|
|
/* Perform a quick test of whether this is a valid
|
2003-04-12 03:58:33 +02:00
|
|
|
precompiled header for the current language. */
|
2003-01-10 03:22:34 +01:00
|
|
|
|
2005-05-18 22:45:26 +02:00
|
|
|
gcc_assert (memcmp (executable_checksum, no_checksum, 16) != 0);
|
|
|
|
|
|
|
|
sizeread = read (fd, ident, IDENT_LENGTH + 16);
|
2003-01-10 03:22:34 +01:00
|
|
|
if (sizeread == -1)
|
builtins.c, [...]: Avoid "`" as left quote, using "'" or %q, %< and %> as 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-11-09 11:13:30 +01:00
|
|
|
fatal_error ("can%'t read %s: %m", name);
|
2005-05-18 22:45:26 +02:00
|
|
|
else if (sizeread != IDENT_LENGTH + 16)
|
|
|
|
{
|
|
|
|
cpp_error (pfile, CPP_DL_WARNING, "%s: too short to be a PCH file",
|
|
|
|
name);
|
|
|
|
return 2;
|
|
|
|
}
|
2006-05-19 00:16:23 +02:00
|
|
|
|
2003-03-07 02:20:52 +01:00
|
|
|
pch_ident = get_ident();
|
|
|
|
if (memcmp (ident, pch_ident, IDENT_LENGTH) != 0)
|
2003-01-10 03:22:34 +01:00
|
|
|
{
|
|
|
|
if (cpp_get_options (pfile)->warn_invalid_pch)
|
|
|
|
{
|
|
|
|
if (memcmp (ident, pch_ident, 5) == 0)
|
|
|
|
/* It's a PCH, for the right language, but has the wrong version.
|
|
|
|
*/
|
2006-05-19 00:16:23 +02:00
|
|
|
cpp_error (pfile, CPP_DL_WARNING,
|
2003-01-10 03:22:34 +01:00
|
|
|
"%s: not compatible with this GCC version", name);
|
|
|
|
else if (memcmp (ident, pch_ident, 4) == 0)
|
|
|
|
/* It's a PCH for the wrong language. */
|
re PR preprocessor/12847 (xxx.c:1:20: xxxx.h: No such file or directory)
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-11-01 23:56:54 +01:00
|
|
|
cpp_error (pfile, CPP_DL_WARNING, "%s: not for %s", name,
|
2003-03-07 02:20:52 +01:00
|
|
|
lang_hooks.name);
|
2006-05-19 00:16:23 +02:00
|
|
|
else
|
2003-01-10 03:22:34 +01:00
|
|
|
/* Not any kind of PCH. */
|
re PR preprocessor/12847 (xxx.c:1:20: xxxx.h: No such file or directory)
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-11-01 23:56:54 +01:00
|
|
|
cpp_error (pfile, CPP_DL_WARNING, "%s: not a PCH file", name);
|
2003-01-10 03:22:34 +01:00
|
|
|
}
|
|
|
|
return 2;
|
|
|
|
}
|
2005-05-18 22:45:26 +02:00
|
|
|
if (memcmp (ident + IDENT_LENGTH, executable_checksum, 16) != 0)
|
2003-10-22 01:28:05 +02:00
|
|
|
{
|
|
|
|
if (cpp_get_options (pfile)->warn_invalid_pch)
|
re PR preprocessor/12847 (xxx.c:1:20: xxxx.h: No such file or directory)
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-11-01 23:56:54 +01:00
|
|
|
cpp_error (pfile, CPP_DL_WARNING,
|
2005-05-18 22:45:26 +02:00
|
|
|
"%s: created by a different GCC executable", name);
|
2003-10-22 01:28:05 +02:00
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
|
2005-05-18 22:45:26 +02:00
|
|
|
/* At this point, we know it's a PCH file created by this
|
|
|
|
executable, so it ought to be long enough that we can read a
|
|
|
|
c_pch_validity structure. */
|
|
|
|
if (read (fd, &v, sizeof (v)) != sizeof (v))
|
|
|
|
fatal_error ("can%'t read %s: %m", name);
|
|
|
|
|
2003-04-12 03:58:33 +02:00
|
|
|
/* The allowable debug info combinations are that either the PCH file
|
|
|
|
was built with the same as is being used now, or the PCH file was
|
|
|
|
built for some kind of debug info but now none is in use. */
|
|
|
|
if (v.debug_info_type != write_symbols
|
|
|
|
&& write_symbols != NO_DEBUG)
|
|
|
|
{
|
|
|
|
if (cpp_get_options (pfile)->warn_invalid_pch)
|
2006-05-19 00:16:23 +02:00
|
|
|
cpp_error (pfile, CPP_DL_WARNING,
|
2003-04-12 03:58:33 +02:00
|
|
|
"%s: created with -g%s, but used with -g%s", name,
|
|
|
|
debug_type_names[v.debug_info_type],
|
|
|
|
debug_type_names[write_symbols]);
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
|
re PR pch/13419 (Clarification of invoke.texi requested)
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-04-09 01:41:09 +02:00
|
|
|
/* Check flags that must match exactly. */
|
|
|
|
{
|
|
|
|
size_t i;
|
|
|
|
for (i = 0; i < MATCH_SIZE; i++)
|
|
|
|
if (*pch_matching[i].flag_var != v.match[i])
|
|
|
|
{
|
|
|
|
if (cpp_get_options (pfile)->warn_invalid_pch)
|
2006-05-19 00:16:23 +02:00
|
|
|
cpp_error (pfile, CPP_DL_WARNING,
|
re PR pch/13419 (Clarification of invoke.texi requested)
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-04-09 01:41:09 +02:00
|
|
|
"%s: settings for %s do not match", name,
|
|
|
|
pch_matching[i].flag_name);
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-10-22 17:44:44 +02:00
|
|
|
/* If the text segment was not loaded at the same address as it was
|
|
|
|
when the PCH file was created, function pointers loaded from the
|
|
|
|
PCH will not be valid. We could in theory remap all the function
|
2006-05-19 00:16:23 +02:00
|
|
|
pointers, but no support for that exists at present.
|
2005-05-18 22:45:26 +02:00
|
|
|
Since we have the same executable, it should only be necessary to
|
|
|
|
check one function. */
|
2003-10-22 17:44:44 +02:00
|
|
|
if (v.pch_init != &pch_init)
|
|
|
|
{
|
|
|
|
if (cpp_get_options (pfile)->warn_invalid_pch)
|
2006-05-19 00:16:23 +02:00
|
|
|
cpp_error (pfile, CPP_DL_WARNING,
|
2003-10-22 17:44:44 +02:00
|
|
|
"%s: had text segment at different address", name);
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
|
2003-10-24 23:28:13 +02:00
|
|
|
/* Check the target-specific validity data. */
|
|
|
|
{
|
|
|
|
void *this_file_data = xmalloc (v.target_data_length);
|
|
|
|
const char *msg;
|
2006-05-19 00:16:23 +02:00
|
|
|
|
2003-10-24 23:28:13 +02:00
|
|
|
if ((size_t) read (fd, this_file_data, v.target_data_length)
|
|
|
|
!= v.target_data_length)
|
builtins.c, [...]: Avoid "`" as left quote, using "'" or %q, %< and %> as 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-11-09 11:13:30 +01:00
|
|
|
fatal_error ("can%'t read %s: %m", name);
|
2003-10-24 23:28:13 +02:00
|
|
|
msg = targetm.pch_valid_p (this_file_data, v.target_data_length);
|
|
|
|
free (this_file_data);
|
|
|
|
if (msg != NULL)
|
|
|
|
{
|
|
|
|
if (cpp_get_options (pfile)->warn_invalid_pch)
|
re PR preprocessor/12847 (xxx.c:1:20: xxxx.h: No such file or directory)
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-11-01 23:56:54 +01:00
|
|
|
cpp_error (pfile, CPP_DL_WARNING, "%s: %s", name, msg);
|
2003-10-24 23:28:13 +02:00
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-01-10 03:22:34 +01:00
|
|
|
/* Check the preprocessor macros are the same as when the PCH was
|
|
|
|
generated. */
|
2006-05-19 00:16:23 +02:00
|
|
|
|
2003-01-10 03:22:34 +01:00
|
|
|
result = cpp_valid_state (pfile, name, fd);
|
|
|
|
if (result == -1)
|
|
|
|
return 2;
|
|
|
|
else
|
|
|
|
return result == 0;
|
|
|
|
}
|
|
|
|
|
2004-07-29 19:59:31 +02:00
|
|
|
/* If non-NULL, this function is called after a precompile header file
|
|
|
|
is loaded. */
|
|
|
|
void (*lang_post_pch_load) (void);
|
|
|
|
|
2003-04-12 03:58:33 +02:00
|
|
|
/* Load in the PCH file NAME, open on FD. It was originally searched for
|
|
|
|
by ORIG_NAME. */
|
|
|
|
|
2003-01-10 03:22:34 +01:00
|
|
|
void
|
2003-06-22 15:41:26 +02:00
|
|
|
c_common_read_pch (cpp_reader *pfile, const char *name,
|
|
|
|
int fd, const char *orig_name ATTRIBUTE_UNUSED)
|
2003-01-10 03:22:34 +01:00
|
|
|
{
|
|
|
|
FILE *f;
|
|
|
|
struct c_pch_header h;
|
|
|
|
struct save_macro_data *smd;
|
2006-05-19 00:16:23 +02:00
|
|
|
|
2003-01-10 03:22:34 +01:00
|
|
|
f = fdopen (fd, "rb");
|
|
|
|
if (f == NULL)
|
|
|
|
{
|
re PR preprocessor/12847 (xxx.c:1:20: xxxx.h: No such file or directory)
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-11-01 23:56:54 +01:00
|
|
|
cpp_errno (pfile, CPP_DL_ERROR, "calling fdopen");
|
2003-01-10 03:22:34 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2003-07-30 01:36:53 +02:00
|
|
|
cpp_get_callbacks (parse_in)->valid_pch = NULL;
|
2003-01-10 03:22:34 +01:00
|
|
|
|
|
|
|
if (fread (&h, sizeof (h), 1, f) != 1)
|
|
|
|
{
|
re PR preprocessor/12847 (xxx.c:1:20: xxxx.h: No such file or directory)
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-11-01 23:56:54 +01:00
|
|
|
cpp_errno (pfile, CPP_DL_ERROR, "reading");
|
2003-01-10 03:22:34 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2004-06-22 08:51:56 +02:00
|
|
|
if (!flag_preprocess_only)
|
2003-01-10 03:22:34 +01:00
|
|
|
{
|
2004-06-22 08:51:56 +02:00
|
|
|
unsigned long written;
|
2005-12-17 21:45:46 +01:00
|
|
|
char * buf = XNEWVEC (char, 16384);
|
2004-06-22 08:51:56 +02:00
|
|
|
|
|
|
|
for (written = 0; written < h.asm_size; )
|
|
|
|
{
|
|
|
|
long size = h.asm_size - written;
|
|
|
|
if (size > 16384)
|
|
|
|
size = 16384;
|
|
|
|
if (fread (buf, size, 1, f) != 1
|
|
|
|
|| fwrite (buf, size, 1, asm_out_file) != 1)
|
|
|
|
cpp_errno (pfile, CPP_DL_ERROR, "reading");
|
|
|
|
written += size;
|
|
|
|
}
|
|
|
|
free (buf);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* If we're preprocessing, don't write to a NULL
|
|
|
|
asm_out_file. */
|
|
|
|
if (fseek (f, h.asm_size, SEEK_CUR) != 0)
|
|
|
|
cpp_errno (pfile, CPP_DL_ERROR, "seeking");
|
2003-01-10 03:22:34 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
cpp_prepare_state (pfile, &smd);
|
|
|
|
|
|
|
|
gt_pch_restore (f);
|
|
|
|
|
|
|
|
if (cpp_read_state (pfile, name, f, smd) != 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
fclose (f);
|
2006-05-19 00:16:23 +02:00
|
|
|
|
2004-07-29 19:59:31 +02:00
|
|
|
/* Give the front end a chance to take action after a PCH file has
|
c-common.c, [...]: Fix comment typos.
* 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-10 12:44:48 +02:00
|
|
|
been loaded. */
|
2004-07-29 19:59:31 +02:00
|
|
|
if (lang_post_pch_load)
|
|
|
|
(*lang_post_pch_load) ();
|
2003-01-10 03:22:34 +01:00
|
|
|
}
|
2003-07-30 01:36:53 +02:00
|
|
|
|
|
|
|
/* Indicate that no more PCH files should be read. */
|
|
|
|
|
|
|
|
void
|
|
|
|
c_common_no_more_pch (void)
|
|
|
|
{
|
|
|
|
if (cpp_get_callbacks (parse_in)->valid_pch)
|
|
|
|
{
|
|
|
|
cpp_get_callbacks (parse_in)->valid_pch = NULL;
|
2004-03-11 04:19:04 +01:00
|
|
|
host_hooks.gt_pch_use_address (NULL, 0, -1, 0);
|
2003-07-30 01:36:53 +02:00
|
|
|
}
|
|
|
|
}
|
2004-06-22 08:51:56 +02:00
|
|
|
|
|
|
|
/* Handle #pragma GCC pch_preprocess, to load in the PCH file. */
|
|
|
|
|
|
|
|
#ifndef O_BINARY
|
|
|
|
# define O_BINARY 0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
void
|
2006-01-04 17:33:38 +01:00
|
|
|
c_common_pch_pragma (cpp_reader *pfile, const char *name)
|
2004-06-22 08:51:56 +02:00
|
|
|
{
|
|
|
|
int fd;
|
|
|
|
|
c-aux-info.c, [...]: Follow code formatting conventions.
* 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-10-03 22:53:05 +02:00
|
|
|
if (!cpp_get_options (pfile)->preprocessed)
|
2004-06-22 08:51:56 +02:00
|
|
|
{
|
|
|
|
error ("pch_preprocess pragma should only be used with -fpreprocessed");
|
|
|
|
inform ("use #include instead");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
fd = open (name, O_RDONLY | O_BINARY, 0666);
|
|
|
|
if (fd == -1)
|
bb-reorder.c, [...]: Avoid "." or "\n" at end of diagnostics and capital 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-07-03 23:08:11 +02:00
|
|
|
fatal_error ("%s: couldn%'t open PCH file: %m", name);
|
2006-05-19 00:16:23 +02:00
|
|
|
|
2004-06-22 08:51:56 +02:00
|
|
|
if (c_common_valid_pch (pfile, name, fd) != 1)
|
|
|
|
{
|
|
|
|
if (!cpp_get_options (pfile)->warn_invalid_pch)
|
|
|
|
inform ("use -Winvalid-pch for more information");
|
|
|
|
fatal_error ("%s: PCH file was invalid", name);
|
|
|
|
}
|
2006-05-19 00:16:23 +02:00
|
|
|
|
2004-06-22 08:51:56 +02:00
|
|
|
c_common_read_pch (pfile, name, fd, name);
|
2006-05-19 00:16:23 +02:00
|
|
|
|
2004-06-22 08:51:56 +02:00
|
|
|
close (fd);
|
|
|
|
}
|
2005-05-18 22:45:26 +02:00
|
|
|
|
|
|
|
/* Print out executable_checksum[]. */
|
|
|
|
|
|
|
|
void
|
|
|
|
c_common_print_pch_checksum (FILE *f)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
fputs ("Compiler executable checksum: ", f);
|
|
|
|
for (i = 0; i < 16; i++)
|
|
|
|
fprintf (f, "%02x", executable_checksum[i]);
|
|
|
|
putc ('\n', f);
|
|
|
|
}
|