c-common.h (c_common_print_pch_checksum): Remove.
c-family/ * c-common.h (c_common_print_pch_checksum): Remove. * c-pch.c: Do not include output.h. (CHECK_NO_ASM_OUT_DURING_PCH): Define and add FIXME. (asm_out_file): Define iff CHECK_NO_ASM_OUT_DURING_PCH isdefined. (asm_file_startpos): Define iff CHECK_NO_ASM_OUT_DURING_PCH is defined. (struct c_pch_header): Remove. (get_ident): Update gpch version. (pch_init): Do not print executable_checksum to asm_out_file. Do not fail if there is no asm_out_file to read back from. Set asm_file_startpos only if CHECK_NO_ASM_OUT_DURING_PCH is defined. (c_common_write_pch): Verify that nothing was written to asm_out_file since pch_init was called. Do not write a c_pch_header, and do not copy from asm_out_file to the PCH. (c_common_read_pch): Do not read a c_pch_header, and do not restore the content of asm_out_file from the PCH. (c_common_print_pch_checksum): Remove. * c-opts.c (c_common_init): Print out executable_checksum directly. testsuite/ * testsuite/gcc.dg/pch/ident-1.c: New test. * testsuite/gcc.dg/pch/ident-1.hs: Header file for new test. From-SVN: r188856
This commit is contained in:
parent
7033abe11e
commit
8ca92d04e1
8 changed files with 62 additions and 103 deletions
|
@ -7906,7 +7906,7 @@
|
|||
* tree.h (warn_if_unused_value): Move declaration from here.
|
||||
* stmt.c (warn_if_unused_value): Move definition from here.
|
||||
|
||||
2010-04-10 Michael Matz <matz@suse.de>
|
||||
2012-04-10 Michael Matz <matz@suse.de>
|
||||
|
||||
* tree-vectorizer.h (_loop_vec_info.strided_stores): Rename to
|
||||
grouped_stores.
|
||||
|
@ -12633,7 +12633,7 @@
|
|||
* config/alpha/alpha.c (alpha_option_override): Default to
|
||||
full IEEE compliance mode for Go language.
|
||||
|
||||
2011-01-29 Tijl Coosemans <tijl@coosemans.org>
|
||||
2012-01-29 Tijl Coosemans <tijl@coosemans.org>
|
||||
|
||||
* config/freebsd-spec.h [TARGET_LIBC_PROVIDES_SSP]
|
||||
(LINK_SSP_SPEC): Define.
|
||||
|
@ -13216,7 +13216,7 @@
|
|||
|
||||
* cfgrtl.c (rtl_dump_bb): Do not dump insns for {ENTRY|EXIT}_BLOCK.
|
||||
|
||||
2011-01-20 Tijl Coosemans <tijl@coosemans.org>
|
||||
2012-01-20 Tijl Coosemans <tijl@coosemans.org>
|
||||
|
||||
* config/i386/i386.c: Fix checks for !TARGET_MACHO.
|
||||
* config/rs6000/rs6000.c: Likewise.
|
||||
|
|
|
@ -1,3 +1,23 @@
|
|||
2012-06-21 Steven Bosscher <steven@gcc.gnu.org>
|
||||
|
||||
* c-common.h (c_common_print_pch_checksum): Remove.
|
||||
* c-pch.c: Do not include output.h.
|
||||
(CHECK_NO_ASM_OUT_DURING_PCH): Define and add FIXME.
|
||||
(asm_out_file): Define iff CHECK_NO_ASM_OUT_DURING_PCH isdefined.
|
||||
(asm_file_startpos): Define iff CHECK_NO_ASM_OUT_DURING_PCH is defined.
|
||||
(struct c_pch_header): Remove.
|
||||
(get_ident): Update gpch version.
|
||||
(pch_init): Do not print executable_checksum to asm_out_file.
|
||||
Do not fail if there is no asm_out_file to read back from. Set
|
||||
asm_file_startpos only if CHECK_NO_ASM_OUT_DURING_PCH is defined.
|
||||
(c_common_write_pch): Verify that nothing was written to asm_out_file
|
||||
since pch_init was called. Do not write a c_pch_header, and do not
|
||||
copy from asm_out_file to the PCH.
|
||||
(c_common_read_pch): Do not read a c_pch_header, and do not restore
|
||||
the content of asm_out_file from the PCH.
|
||||
(c_common_print_pch_checksum): Remove.
|
||||
* c-opts.c (c_common_init): Print out executable_checksum directly.
|
||||
|
||||
2012-06-19 Steven Bosscher <steven@gcc.gnu.org>
|
||||
|
||||
* c-target.def (objc_declare_unresolved_class_reference,
|
||||
|
|
|
@ -1020,7 +1020,6 @@ extern void c_common_read_pch (cpp_reader *pfile, const char *name, int fd,
|
|||
extern void c_common_write_pch (void);
|
||||
extern void c_common_no_more_pch (void);
|
||||
extern void c_common_pch_pragma (cpp_reader *pfile, const char *);
|
||||
extern void c_common_print_pch_checksum (FILE *f);
|
||||
|
||||
/* In *-checksum.c */
|
||||
extern const unsigned char executable_checksum[16];
|
||||
|
|
|
@ -1100,7 +1100,13 @@ c_common_init (void)
|
|||
cpp_init_iconv (parse_in);
|
||||
|
||||
if (version_flag)
|
||||
c_common_print_pch_checksum (stderr);
|
||||
{
|
||||
int i;
|
||||
fputs ("Compiler executable checksum: ", stderr);
|
||||
for (i = 0; i < 16; i++)
|
||||
fprintf (stderr, "%02x", executable_checksum[i]);
|
||||
putc ('\n', stderr);
|
||||
}
|
||||
|
||||
/* Has to wait until now so that cpplib has its hash table. */
|
||||
init_pragma ();
|
||||
|
|
|
@ -26,7 +26,6 @@ along with GCC; see the file COPYING3. If not see
|
|||
#include "tree.h"
|
||||
#include "flags.h"
|
||||
#include "c-common.h"
|
||||
#include "output.h" /* for asm_out_file */
|
||||
#include "debug.h"
|
||||
#include "c-pragma.h"
|
||||
#include "ggc.h"
|
||||
|
@ -36,6 +35,24 @@ along with GCC; see the file COPYING3. If not see
|
|||
#include "opts.h"
|
||||
#include "timevar.h"
|
||||
|
||||
/* PCH was introduced before unit-at-a-time became the only supported
|
||||
compilation mode. To exactly replay the content parsed at PCH generate
|
||||
time, anything written to asm_out_file was read back in and stored in
|
||||
the PCH, and written back out to asm_out_file while reading a PCH.
|
||||
|
||||
Nowadays, ideally no action by a front end should never result in output
|
||||
to asm_out_file, and front-end files should not include output.h. For
|
||||
now assert that nothing is written to asm_out_file while a PCH is being
|
||||
generated. Before GCC 4.8 is released, this code should be removed.
|
||||
FIXME. */
|
||||
#define CHECK_NO_ASM_OUT_DURING_PCH
|
||||
#ifdef CHECK_NO_ASM_OUT_DURING_PCH
|
||||
extern FILE *asm_out_file;
|
||||
|
||||
/* The position in the assembler output file when pch_init was called. */
|
||||
static long asm_file_startpos;
|
||||
#endif
|
||||
|
||||
/* 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'. */
|
||||
|
@ -69,19 +86,11 @@ struct c_pch_validity
|
|||
size_t target_data_length;
|
||||
};
|
||||
|
||||
struct c_pch_header
|
||||
{
|
||||
unsigned long asm_size;
|
||||
};
|
||||
|
||||
#define IDENT_LENGTH 8
|
||||
|
||||
/* The file we'll be writing the PCH to. */
|
||||
static FILE *pch_outfile;
|
||||
|
||||
/* The position in the assembler output file when pch_init was called. */
|
||||
static long asm_file_startpos;
|
||||
|
||||
static const char *get_ident (void);
|
||||
|
||||
/* Compute an appropriate 8-byte magic number for the PCH file, so that
|
||||
|
@ -93,7 +102,7 @@ static const char *
|
|||
get_ident (void)
|
||||
{
|
||||
static char result[IDENT_LENGTH];
|
||||
static const char templ[] = "gpch.013";
|
||||
static const char templ[] = "gpch.014";
|
||||
static const char c_language_chars[] = "Co+O";
|
||||
|
||||
memcpy (result, templ, IDENT_LENGTH);
|
||||
|
@ -115,15 +124,6 @@ pch_init (void)
|
|||
void *target_validity;
|
||||
static const char partial_pch[] = "gpcWrite";
|
||||
|
||||
#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
|
||||
|
||||
if (!pch_file)
|
||||
return;
|
||||
|
||||
|
@ -153,13 +153,9 @@ pch_init (void)
|
|||
|| fwrite (target_validity, v.target_data_length, 1, f) != 1)
|
||||
fatal_error ("can%'t write to %s: %m", pch_file);
|
||||
|
||||
/* 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)
|
||||
fatal_error ("%qs is not a valid output file", asm_file_name);
|
||||
|
||||
#ifdef CHECK_NO_ASM_OUT_DURING_PCH
|
||||
asm_file_startpos = ftell (asm_out_file);
|
||||
#endif
|
||||
|
||||
/* Let the debugging format deal with the PCHness. */
|
||||
(*debug_hooks->handle_pch) (0);
|
||||
|
@ -174,9 +170,7 @@ void
|
|||
c_common_write_pch (void)
|
||||
{
|
||||
char *buf;
|
||||
long asm_file_end;
|
||||
long written;
|
||||
struct c_pch_header h;
|
||||
|
||||
timevar_push (TV_PCH_SAVE);
|
||||
|
||||
|
@ -186,33 +180,9 @@ c_common_write_pch (void)
|
|||
|
||||
cpp_write_pch_deps (parse_in, pch_outfile);
|
||||
|
||||
asm_file_end = ftell (asm_out_file);
|
||||
h.asm_size = asm_file_end - asm_file_startpos;
|
||||
|
||||
if (fwrite (&h, sizeof (h), 1, pch_outfile) != 1)
|
||||
fatal_error ("can%'t write %s: %m", pch_file);
|
||||
|
||||
buf = XNEWVEC (char, 16384);
|
||||
|
||||
if (fseek (asm_out_file, asm_file_startpos, SEEK_SET) != 0)
|
||||
fatal_error ("can%'t seek in %s: %m", asm_file_name);
|
||||
|
||||
for (written = asm_file_startpos; written < asm_file_end; )
|
||||
{
|
||||
long size = asm_file_end - written;
|
||||
if (size > 16384)
|
||||
size = 16384;
|
||||
if (fread (buf, size, 1, asm_out_file) != 1)
|
||||
fatal_error ("can%'t read %s: %m", asm_file_name);
|
||||
if (fwrite (buf, size, 1, pch_outfile) != 1)
|
||||
fatal_error ("can%'t write %s: %m", pch_file);
|
||||
written += size;
|
||||
}
|
||||
free (buf);
|
||||
/* asm_out_file can be written afterwards, so fseek to clear
|
||||
_IOREAD flag. */
|
||||
if (fseek (asm_out_file, 0, SEEK_END) != 0)
|
||||
fatal_error ("can%'t seek in %s: %m", asm_file_name);
|
||||
#ifdef CHECK_NO_ASM_OUT_DURING_PCH
|
||||
gcc_assert (ftell (asm_out_file) - asm_file_startpos == 0);
|
||||
#endif
|
||||
|
||||
gt_pch_save (pch_outfile);
|
||||
|
||||
|
@ -375,7 +345,6 @@ c_common_read_pch (cpp_reader *pfile, const char *name,
|
|||
int fd, const char *orig_name ATTRIBUTE_UNUSED)
|
||||
{
|
||||
FILE *f;
|
||||
struct c_pch_header h;
|
||||
struct save_macro_data *smd;
|
||||
expanded_location saved_loc;
|
||||
bool saved_trace_includes;
|
||||
|
@ -392,38 +361,6 @@ c_common_read_pch (cpp_reader *pfile, const char *name,
|
|||
|
||||
cpp_get_callbacks (parse_in)->valid_pch = NULL;
|
||||
|
||||
if (fread (&h, sizeof (h), 1, f) != 1)
|
||||
{
|
||||
cpp_errno (pfile, CPP_DL_ERROR, "reading");
|
||||
fclose (f);
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (!flag_preprocess_only)
|
||||
{
|
||||
unsigned long written;
|
||||
char * buf = XNEWVEC (char, 16384);
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
/* Save the location and then restore it after reading the PCH. */
|
||||
saved_loc = expand_location (line_table->highest_line);
|
||||
saved_trace_includes = line_table->trace_includes;
|
||||
|
@ -501,14 +438,3 @@ c_common_pch_pragma (cpp_reader *pfile, const char *name)
|
|||
close (fd);
|
||||
}
|
||||
|
||||
/* 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);
|
||||
}
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2012-06-21 Steven Bosscher <steven@gcc.gnu.org>
|
||||
|
||||
* testsuite/gcc.dg/pch/ident-1.c: New test.
|
||||
* testsuite/gcc.dg/pch/ident-1.hs: Header file for new test.
|
||||
|
||||
2012-06-21 Michael Matz <matz@suse.de>
|
||||
|
||||
PR middle-end/53688
|
||||
|
|
2
gcc/testsuite/gcc.dg/pch/ident-1.c
Normal file
2
gcc/testsuite/gcc.dg/pch/ident-1.c
Normal file
|
@ -0,0 +1,2 @@
|
|||
#include "ident-1.h"
|
||||
|
1
gcc/testsuite/gcc.dg/pch/ident-1.hs
Normal file
1
gcc/testsuite/gcc.dg/pch/ident-1.hs
Normal file
|
@ -0,0 +1 @@
|
|||
#ident "My true identity will never be revealed!"
|
Loading…
Add table
Reference in a new issue