[cfe-commits] r70332 - in /cfe/trunk: include/clang/Basic/DiagnosticFrontendKinds.td lib/Frontend/PCHReader.cpp tools/clang-cc/clang-cc.cpp
Douglas Gregor
dgregor at apple.com
Tue Apr 28 15:01:17 PDT 2009
Author: dgregor
Date: Tue Apr 28 17:01:16 2009
New Revision: 70332
URL: http://llvm.org/viewvc/llvm-project?rev=70332&view=rev
Log:
Make all PCH-incompatibility warnings into errors, and abort
compilation if the user requested a PCH file but no such PCH file
exists.
Modified:
cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td
cfe/trunk/lib/Frontend/PCHReader.cpp
cfe/trunk/tools/clang-cc/clang-cc.cpp
Modified: cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td?rev=70332&r1=70331&r2=70332&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td Tue Apr 28 17:01:16 2009
@@ -24,97 +24,95 @@
"FIX-IT detected errors it could not fix; no output will be generated">;
// PCH reader
-def warn_pch_target_triple : Warning<
+def warn_pch_target_triple : Error<
"PCH file was compiled for the target '%0' but the current translation "
"unit is being compiled for target '%1'">;
-def note_ignoring_pch : Note<
- "ignoring precompiled header '%0'">;
-def warn_pch_c99 : Warning<
+def warn_pch_c99 : Error<
"C99 support was %select{disabled|enabled}0 in PCH file but is "
"currently %select{disabled|enabled}1">;
-def warn_pch_cplusplus : Warning<
+def warn_pch_cplusplus : Error<
"C++ support was %select{disabled|enabled}0 in PCH file but is "
"currently %select{disabled|enabled}1">;
-def warn_pch_cplusplus0x : Warning<
+def warn_pch_cplusplus0x : Error<
"C++0x support was %select{disabled|enabled}0 in PCH file but is "
"currently %select{disabled|enabled}1">;
-def warn_pch_objective_c : Warning<
+def warn_pch_objective_c : Error<
"Objective-C support was %select{disabled|enabled}0 in PCH file but is "
"currently %select{disabled|enabled}1">;
-def warn_pch_objective_c2 : Warning<
+def warn_pch_objective_c2 : Error<
"Objective-C 2.0 support was %select{disabled|enabled}0 in PCH file but "
"is currently %select{disabled|enabled}1">;
-def warn_pch_nonfragile_abi : Warning<
+def warn_pch_nonfragile_abi : Error<
"PCH file was compiled with the %select{32-bit|non-fragile}0 Objective-C "
"ABI but the %select{32-bit|non-fragile}1 Objective-C ABI is selected">;
-def warn_pch_extensions : Warning<
+def warn_pch_extensions : Error<
"extensions were %select{enabled|disabled}0 in PCH file but are "
"currently %select{enabled|disabled}1">;
-def warn_pch_gnu_extensions : Warning<
+def warn_pch_gnu_extensions : Error<
"GNU extensions were %select{disabled|enabled}0 in PCH file but are "
"currently %select{disabled|enabled}1">;
-def warn_pch_microsoft_extensions : Warning<
+def warn_pch_microsoft_extensions : Error<
"Microsoft extensions were %select{disabled|enabled}0 in PCH file but are "
"currently %select{disabled|enabled}1">;
-def warn_pch_heinous_extensions : Warning<
+def warn_pch_heinous_extensions : Error<
"heinous extensions were %select{disabled|enabled}0 in PCH file but are "
"currently %select{disabled|enabled}1">;
-def warn_pch_lax_vector_conversions : Warning<
+def warn_pch_lax_vector_conversions : Error<
"lax vector conversions were %select{disabled|enabled}0 in PCH file but "
"are currently %select{disabled|enabled}1">;
-def warn_pch_exceptions : Warning<
+def warn_pch_exceptions : Error<
"exceptions were %select{disabled|enabled}0 in PCH file but "
"are currently %select{disabled|enabled}1">;
-def warn_pch_objc_runtime : Warning<
+def warn_pch_objc_runtime : Error<
"PCH file was compiled with the %select{NeXT|GNU}0 runtime but the "
"%select{NeXT|GNU}1 runtime is selected">;
-def warn_pch_freestanding : Warning<
+def warn_pch_freestanding : Error<
"PCH file was compiled with a %select{hosted|freestanding}0 "
"implementation but a %select{hosted|freestanding}1 implementation "
"is selected">;
-def warn_pch_builtins : Warning<
+def warn_pch_builtins : Error<
"PCH file was compiled with builtins %select{enabled|disabled}0 but "
"builtins are currently %select{enabled|disabled}1">;
-def warn_pch_thread_safe_statics : Warning<
+def warn_pch_thread_safe_statics : Error<
"PCH file was compiled %select{without|with}0 thread-safe statics but"
"thread-safe statics are currently %select{disabled|enabled}1">;
-def warn_pch_blocks : Warning<
+def warn_pch_blocks : Error<
"blocks were %select{disabled|enabled}0 in PCH file but "
"are currently %select{disabled|enabled}1">;
-def warn_pch_math_errno : Warning<
+def warn_pch_math_errno : Error<
"math functions %select{do not respect|respect}0 'errno' in PCH "
"file but they are currently set to %select{not respect|respect}1 "
"'errno'">;
-def warn_pch_overflow_checking : Warning<
+def warn_pch_overflow_checking : Error<
"signed integer overflow checking was %select{disabled|enabled}0 in PCH "
"file but is currently %select{disabled|enabled}1">;
-def warn_pch_optimize : Warning<
+def warn_pch_optimize : Error<
"the macro '__OPTIMIZE__' was %select{not defined|defined}0 in "
"the PCH file but is currently %select{undefined|defined}1">;
-def warn_pch_optimize_size : Warning<
+def warn_pch_optimize_size : Error<
"the macro '__OPTIMIZE_SIZE__' was %select{not defined|defined}0 in "
"the PCH file but is currently %select{undefined|defined}1">;
-def warn_pch_static : Warning<
+def warn_pch_static : Error<
"the PCH file was compiled %select{dynamic|static}0 but the "
"current translation unit is being compiled as %select{dynamic|static}1">;
-def warn_pch_pic_level : Warning<
+def warn_pch_pic_level : Error<
"PCH file was compiled with PIC level %0, but the current translation "
"unit will be compiled with PIC level %1">;
-def warn_pch_gnu_inline : Warning<
+def warn_pch_gnu_inline : Error<
"PCH file was compiled with %select{C99|GNU|}0 inline semantics but "
"%select{C99|GNU}1 inline semantics are currently selected">;
-def warn_pch_no_inline : Warning<
+def warn_pch_no_inline : Error<
"the macro '__NO_INLINE__' was %select{not defined|defined}0 in "
"the PCH file but is currently %select{undefined|defined}1">;
-def warn_pch_gc_mode : Warning<
+def warn_pch_gc_mode : Error<
"the PCH file was built with %select{no||hybrid}0 garbage collection but "
"the current translation unit will compiled with %select{no||hybrid}1 "
"garbage collection">;
-def warn_pch_version_too_old : Warning<
+def warn_pch_version_too_old : Error<
"PCH file uses an older PCH format that is no longer supported">;
-def warn_pch_version_too_new : Warning<
+def warn_pch_version_too_new : Error<
"PCH file uses a newer PCH format that cannot be read">;
-def warn_cmdline_conflicting_macro_def : Warning<
+def warn_cmdline_conflicting_macro_def : Error<
"definition of the macro '%0' conflicts with the definition used to "
"build the precompiled header">;
def note_pch_macro_defined_as : Note<
@@ -123,10 +121,10 @@
"macro definitions used to build the precompiled header are missing">;
def note_using_macro_def_from_pch : Note<
"using this macro definition from precompiled header">;
-def warn_macro_name_used_in_pch : Warning<
+def warn_macro_name_used_in_pch : Error<
"definition of macro %0 conflicts with an identifier used in the "
"precompiled header">;
-def warn_pch_compiler_options_mismatch : Warning<
+def warn_pch_compiler_options_mismatch : Error<
"compiler options used when building the precompiled header differ from "
"the options used when using the precompiled header">;
def err_not_a_pch_file : Error<
Modified: cfe/trunk/lib/Frontend/PCHReader.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PCHReader.cpp?rev=70332&r1=70331&r2=70332&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/PCHReader.cpp (original)
+++ cfe/trunk/lib/Frontend/PCHReader.cpp Tue Apr 28 17:01:16 2009
@@ -414,7 +414,6 @@
const std::string &Missing = MissingPredefines[I];
if (!startsWith(Missing, "#define ") != 0) {
Diag(diag::warn_pch_compiler_options_mismatch);
- Diag(diag::note_ignoring_pch) << FileName;
return true;
}
@@ -489,10 +488,8 @@
Diag(PCHMissingLoc, diag::note_using_macro_def_from_pch);
}
- if (ConflictingDefines) {
- Diag(diag::note_ignoring_pch) << FileName;
+ if (ConflictingDefines)
return true;
- }
// Determine what predefines were introduced based on command-line
// parameters that were not present when building the PCH
@@ -506,7 +503,6 @@
const std::string &Extra = ExtraPredefines[I];
if (!startsWith(Extra, "#define ") != 0) {
Diag(diag::warn_pch_compiler_options_mismatch);
- Diag(diag::note_ignoring_pch) << FileName;
return true;
}
@@ -527,8 +523,6 @@
MacroName.c_str() + MacroName.size())) {
Diag(diag::warn_macro_name_used_in_pch)
<< II;
- Diag(diag::note_ignoring_pch)
- << FileName;
return true;
}
@@ -1102,7 +1096,6 @@
if (TargetTriple != PP.getTargetInfo().getTargetTriple()) {
Diag(diag::warn_pch_target_triple)
<< TargetTriple << PP.getTargetInfo().getTargetTriple();
- Diag(diag::note_ignoring_pch) << FileName;
return IgnorePCH;
}
break;
@@ -1392,7 +1385,6 @@
#define PARSE_LANGOPT_IMPORTANT(Option, DiagID) \
if (Record[Idx] != LangOpts.Option) { \
Diag(DiagID) << (unsigned)Record[Idx] << LangOpts.Option; \
- Diag(diag::note_ignoring_pch) << FileName; \
return true; \
} \
++Idx
@@ -1446,7 +1438,6 @@
if ((LangOpts.getGCMode() != 0) != (Record[Idx] != 0)) {
Diag(diag::warn_pch_gc_mode)
<< (unsigned)Record[Idx] << LangOpts.getGCMode();
- Diag(diag::note_ignoring_pch) << FileName;
return true;
}
++Idx;
Modified: cfe/trunk/tools/clang-cc/clang-cc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-cc/clang-cc.cpp?rev=70332&r1=70331&r2=70332&view=diff
==============================================================================
--- cfe/trunk/tools/clang-cc/clang-cc.cpp (original)
+++ cfe/trunk/tools/clang-cc/clang-cc.cpp Tue Apr 28 17:01:16 2009
@@ -1775,15 +1775,19 @@
return;
case PCHReader::IgnorePCH:
- // No suitable PCH file could be found. Just ignore the
- // -include-pch option entirely.
-
+ // No suitable PCH file could be found. Return an error.
+ return;
+
+#if 0
+ // FIXME: We can recover from failed attempts to load PCH
+ // files. This code will do so, if we ever want to enable it.
+
// We delayed the initialization of builtins in the hope of
// loading the PCH file. Since the PCH file could not be
// loaded, initialize builtins now.
if (ContextOwner)
ContextOwner->InitializeBuiltins(PP.getIdentifierTable());
- break;
+#endif
}
// Finish preprocessor initialization. We do this now (rather
More information about the cfe-commits
mailing list