re PR preprocessor/15638 (gcc should have option to treat missing headers as fatal)
PR preprocessor/15638
gcc:
* c-common.c (c_cpp_error): Handle CPP_DL_FATAL.
gcc/fortran:
* cpp.c (cb_cpp_error): Handle CPP_DL_FATAL.
gcc/testsuite:
* gcc.dg/cpp/missing-header-1.c: New test.
* gcc.dg/cpp/include2.c: Only test #include <>. Expect
"compilation terminated" message.
* gcc.dg/cpp/include2a.c: New test. Copy of include2.c but only
test #include "".
* gcc.dg/pch/counter-2.c, gcc.dg/pch/valid-1.c,
gcc.dg/pch/valid-2.c, gcc.dg/pch/warn-1.c: Expect "compilation
terminated" message.
libcpp:
* files.c (_cpp_find_file): Call open_file_failed after diagnosing
invalid PCH.
(open_file_failed): Make error for missing file fatal.
* include/cpplib.h (CPP_DL_FATAL): Define.
From-SVN: r145341
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog
index b2f4232..e16a9e4 100644
--- a/libcpp/ChangeLog
+++ b/libcpp/ChangeLog
@@ -1,3 +1,11 @@
+2009-03-31 Joseph Myers <joseph@codesourcery.com>
+
+ PR preprocessor/15638
+ * files.c (_cpp_find_file): Call open_file_failed after diagnosing
+ invalid PCH.
+ (open_file_failed): Make error for missing file fatal.
+ * include/cpplib.h (CPP_DL_FATAL): Define.
+
2009-03-30 Sergiy Vyshnevetskiy <serg@vostok.net>
PR preprocessor/31932:
diff --git a/libcpp/files.c b/libcpp/files.c
index 007fce77..f9e6898 100644
--- a/libcpp/files.c
+++ b/libcpp/files.c
@@ -1,6 +1,6 @@
/* Part of CPP library. File handling.
Copyright (C) 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1998,
- 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+ 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
Free Software Foundation, Inc.
Written by Per Bothner, 1994.
Based on CCCP program by Paul Rubin, June 1986
@@ -488,7 +488,6 @@
return file;
}
- open_file_failed (pfile, file, angle_brackets);
if (invalid_pch)
{
cpp_error (pfile, CPP_DL_ERROR,
@@ -497,6 +496,7 @@
cpp_error (pfile, CPP_DL_ERROR,
"use -Winvalid-pch for more information");
}
+ open_file_failed (pfile, file, angle_brackets);
break;
}
@@ -942,7 +942,7 @@
if (CPP_OPTION (pfile, deps.style) && ! print_dep)
cpp_errno (pfile, CPP_DL_WARNING, file->path);
else
- cpp_errno (pfile, CPP_DL_ERROR, file->path);
+ cpp_errno (pfile, CPP_DL_FATAL, file->path);
}
}
diff --git a/libcpp/include/cpplib.h b/libcpp/include/cpplib.h
index ffde40e..adc6cf1 100644
--- a/libcpp/include/cpplib.h
+++ b/libcpp/include/cpplib.h
@@ -813,6 +813,8 @@
#define CPP_DL_ICE 0x04
/* An informative note following a warning. */
#define CPP_DL_NOTE 0x05
+/* A fatal error. */
+#define CPP_DL_FATAL 0x06
/* Output a diagnostic of some kind. */
extern bool cpp_error (cpp_reader *, int, const char *msgid, ...)