summaryrefslogtreecommitdiff
path: root/libcpp
diff options
context:
space:
mode:
authorcgd <cgd@138bc75d-0d04-0410-961f-82ee72b054a4>2009-09-19 06:15:21 +0000
committercgd <cgd@138bc75d-0d04-0410-961f-82ee72b054a4>2009-09-19 06:15:21 +0000
commitc25f268925f51315b4dea284813362bd44a7ffcd (patch)
treef813fae3ff4b5335403a4b5b6455bf737c81f085 /libcpp
parent13dde709ce3bd835338736299be9d8ded9e4b2b2 (diff)
downloadgcc-c25f268925f51315b4dea284813362bd44a7ffcd.tar.gz
[libcpp/ChangeLog]
2009-09-18 Chris Demetriou <cgd@google.com> PR preprocessor/28435: * include/cpplib.h (struct cpp_options): Add new member deps.need_preprocessor_output. * files.c (open_file_failed): If preprocessor output is needed always report an error. [gcc/ChangeLog] 2009-09-19 Chris Demetriou <cgd@google.com> PR preprocessor/28435: * c-opts.c (c_common_handle_option): For -MD and -MMD, indicate to cpplib that the preprocessor output is needed. [gcc/testsuite/ChangeLog] 2009-09-19 Chris Demetriou <cgd@google.com> PR preprocessor/28435: * gcc.dg/cpp/missing-header-MD.c: New test. * gcc.dg/cpp/missing-header-MMD.c: New test. * gcc.dg/cpp/missing-sysheader-MD.c: New test. * gcc.dg/cpp/missing-sysheader-MMD.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151879 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libcpp')
-rw-r--r--libcpp/ChangeLog8
-rw-r--r--libcpp/files.c25
-rw-r--r--libcpp/include/cpplib.h4
3 files changed, 31 insertions, 6 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog
index 5d278223113..6b257d211cb 100644
--- a/libcpp/ChangeLog
+++ b/libcpp/ChangeLog
@@ -1,3 +1,11 @@
+2009-09-18 Chris Demetriou <cgd@google.com>
+
+ PR preprocessor/28435:
+ * include/cpplib.h (struct cpp_options): Add new member
+ deps.need_preprocessor_output.
+ * files.c (open_file_failed): If preprocessor output is needed
+ always report an error.
+
2009-09-13 Kai Tietz <kai.tietz@onevision.com>
* configure.ac: Set for i?86-w64-mingw*
diff --git a/libcpp/files.c b/libcpp/files.c
index 69aa7895361..96ba7e80afc 100644
--- a/libcpp/files.c
+++ b/libcpp/files.c
@@ -935,15 +935,28 @@ open_file_failed (cpp_reader *pfile, _cpp_file *file, int angle_brackets)
errno = file->err_no;
if (print_dep && CPP_OPTION (pfile, deps.missing_files) && errno == ENOENT)
- deps_add_dep (pfile->deps, file->name);
+ {
+ deps_add_dep (pfile->deps, file->name);
+ /* If the preprocessor output (other than dependency information) is
+ being used, we must also flag an error. */
+ if (CPP_OPTION (pfile, deps.need_preprocessor_output))
+ cpp_errno (pfile, CPP_DL_FATAL, file->path);
+ }
else
{
- /* If we are outputting dependencies but not for this file then
- don't error because we can still produce correct output. */
- if (CPP_OPTION (pfile, deps.style) && ! print_dep)
- cpp_errno (pfile, CPP_DL_WARNING, file->path);
- else
+ /* If we are not outputting dependencies, or if we are and dependencies
+ were requested for this file, or if preprocessor output is needed
+ in addition to dependency information, this is an error.
+
+ Otherwise (outputting dependencies but not for this file, and not
+ using the preprocessor output), we can still produce correct output
+ so it's only a warning. */
+ if (CPP_OPTION (pfile, deps.style) == DEPS_NONE
+ || print_dep
+ || CPP_OPTION (pfile, deps.need_preprocessor_output))
cpp_errno (pfile, CPP_DL_FATAL, file->path);
+ else
+ cpp_errno (pfile, CPP_DL_WARNING, file->path);
}
}
diff --git a/libcpp/include/cpplib.h b/libcpp/include/cpplib.h
index e873ccfeea5..df04668dda0 100644
--- a/libcpp/include/cpplib.h
+++ b/libcpp/include/cpplib.h
@@ -433,6 +433,10 @@ struct cpp_options
/* If true, no dependency is generated on the main file. */
bool ignore_main_file;
+
+ /* If true, intend to use the preprocessor output (e.g., for compilation)
+ in addition to the dependency info. */
+ bool need_preprocessor_output;
} deps;
/* Target-specific features set by the front end or client. */