From c0d578e68f92d8add050826588146be0a6fd1ee0 Mon Sep 17 00:00:00 2001 From: Geoffrey Keating Date: Tue, 22 Jun 2004 06:51:56 +0000 Subject: c-opts.c (c_common_handle_option): Handle -fpch-preprocess. 2004-06-21 Geoffrey Keating * 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 * 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 * files.c (should_stack_file): Correct swapped parameters to call to cb.read_pch. * pch.c (cpp_valid_state): Handle -fpreprocessed. From-SVN: r83478 --- libcpp/ChangeLog | 6 ++++++ libcpp/files.c | 2 +- libcpp/pch.c | 11 ++++++++++- 3 files changed, 17 insertions(+), 2 deletions(-) (limited to 'libcpp') diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index 236c068..897d4ac 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,9 @@ +2004-06-21 Geoffrey Keating + + * files.c (should_stack_file): Correct swapped parameters to call + to cb.read_pch. + * pch.c (cpp_valid_state): Handle -fpreprocessed. + 2004-06-15 Paolo Bonzini * Makefile.in: Regenerate with automake 1.8.5. diff --git a/libcpp/files.c b/libcpp/files.c index 6a18d71..0680652 100644 --- a/libcpp/files.c +++ b/libcpp/files.c @@ -625,7 +625,7 @@ should_stack_file (cpp_reader *pfile, _cpp_file *file, bool import) /* Handle PCH files immediately; don't stack them. */ if (file->pch) { - pfile->cb.read_pch (pfile, file->path, file->fd, file->pchname); + pfile->cb.read_pch (pfile, file->pchname, file->fd, file->path); close (file->fd); file->fd = -1; return false; diff --git a/libcpp/pch.c b/libcpp/pch.c index a9d139a..a343cd8 100644 --- a/libcpp/pch.c +++ b/libcpp/pch.c @@ -438,13 +438,22 @@ cpp_valid_state (cpp_reader *r, const char *name, int fd) if (m.name_length == 0) break; + /* If this file is already preprocessed, there won't be any + macros defined, and that's OK. */ + if (CPP_OPTION (r, preprocessed)) + { + if (lseek (fd, m.definition_length, SEEK_CUR) == -1) + goto error; + continue; + } + if (m.definition_length > namebufsz) { free (namebuf); namebufsz = m.definition_length + 256; namebuf = xmalloc (namebufsz); } - + if ((size_t)read (fd, namebuf, m.definition_length) != m.definition_length) goto error; -- cgit v1.1