aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-04-15 17:20:11 +0000
committerChris Lattner <sabre@nondot.org>2009-04-15 17:20:11 +0000
commitaf008839f3ad499b1e6f752b6a324b7bd1de6cea (patch)
tree849e1e3b7aceae6e7597dc47f9bd26a14d4ac7ec
parentd2aa7c90e7646c509f3493fa8548635ccf4a2d0a (diff)
now that we've decoupled diagnostic classes from default mappings,
move the remaining default mapping exceptions from C++ code into the .td files. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69183 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/Basic/Diagnostic.td6
-rw-r--r--include/clang/Basic/DiagnosticCommonKinds.td6
-rw-r--r--include/clang/Basic/DiagnosticLexKinds.td2
-rw-r--r--include/clang/Basic/DiagnosticSemaKinds.td11
-rw-r--r--tools/clang-cc/Warnings.cpp17
5 files changed, 17 insertions, 25 deletions
diff --git a/include/clang/Basic/Diagnostic.td b/include/clang/Basic/Diagnostic.td
index 97cce59387..12096347c8 100644
--- a/include/clang/Basic/Diagnostic.td
+++ b/include/clang/Basic/Diagnostic.td
@@ -53,6 +53,12 @@ class Extension<string str> : Diagnostic<str, CLASS_EXTENSION, MAP_IGNORE>;
class ExtWarn<string str> : Diagnostic<str, CLASS_EXTENSION, MAP_WARNING>;
class Note<string str> : Diagnostic<str, CLASS_NOTE, MAP_FATAL/*ignored*/>;
+
+class DefaultIgnore { DiagMapping DefaultMapping = MAP_IGNORE; }
+class DefaultWarn { DiagMapping DefaultMapping = MAP_WARNING; }
+class DefaultError { DiagMapping DefaultMapping = MAP_ERROR; }
+class DefaultFatal { DiagMapping DefaultMapping = MAP_FATAL; }
+
// Definitions for Diagnostics.
include "DiagnosticASTKinds.td"
include "DiagnosticAnalysisKinds.td"
diff --git a/include/clang/Basic/DiagnosticCommonKinds.td b/include/clang/Basic/DiagnosticCommonKinds.td
index 5090f7bcdb..08c5b44998 100644
--- a/include/clang/Basic/DiagnosticCommonKinds.td
+++ b/include/clang/Basic/DiagnosticCommonKinds.td
@@ -52,10 +52,12 @@ def note_invalid_subexpr_in_ice : Note<
"subexpression not valid in an integer constant expression">;
// Driver
-def pp_macro_not_used : Warning<"macro is not used">;
+def pp_macro_not_used : Warning<"macro is not used">, DefaultIgnore;
+
+
def err_pp_I_dash_not_supported : Error<
"-I- not supported, please use -iquote instead">;
def warn_pp_undef_identifier : Warning<
- "%0 is not defined, evaluates to 0">;
+ "%0 is not defined, evaluates to 0">, DefaultIgnore;
}
diff --git a/include/clang/Basic/DiagnosticLexKinds.td b/include/clang/Basic/DiagnosticLexKinds.td
index 12df867715..b13f843519 100644
--- a/include/clang/Basic/DiagnosticLexKinds.td
+++ b/include/clang/Basic/DiagnosticLexKinds.td
@@ -137,7 +137,7 @@ def ext_pp_counter : Extension<
def err_pp_invalid_directive : Error<"invalid preprocessing directive">;
def err_pp_hash_error : Error<"#error%0">;
-def err_pp_file_not_found : Error<"'%0' file not found">;
+def err_pp_file_not_found : Error<"'%0' file not found">, DefaultFatal;
def err_pp_empty_filename : Error<"empty filename">;
def err_pp_include_too_deep : Error<"#include nested too deeply">;
def err_pp_expects_filename : Error<"expected \"FILENAME\" or <FILENAME>">;
diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td
index 7bef91c57a..dd2ea2171b 100644
--- a/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/include/clang/Basic/DiagnosticSemaKinds.td
@@ -77,7 +77,7 @@ def err_parameter_name_omitted : Error<"parameter name omitted">;
def warn_decl_in_param_list : Warning<
"declaration of %0 will not be visible outside of this function">;
def warn_implicit_function_decl : Warning<
- "implicit declaration of function %0">;
+ "implicit declaration of function %0">, DefaultIgnore;
def err_ellipsis_first_arg : Error<
"ISO C requires a named argument before '...'">;
def err_declarator_need_ident : Error<"declarator requires an identifier">;
@@ -221,7 +221,7 @@ def error_duplicate_ivar_use : Error<
"synthesized properties %0 and %1 both claim ivar %2">;
def error_property_implemented : Error<"property %0 is already implemented">;
def warn_objc_property_attr_mutually_exclusive : Warning<
- "property attributes '%0' and '%1' are mutually exclusive">;
+ "property attributes '%0' and '%1' are mutually exclusive">, DefaultIgnore;
// C++ declarations
def err_static_assert_expression_is_not_constant : Error<
@@ -679,7 +679,7 @@ def err_template_spec_redecl_global_scope : Error<
// C++ Template Instantiation
def err_template_recursion_depth_exceeded : Error<
- "recursive template instantiation exceeded maximum depth of %0">;
+ "recursive template instantiation exceeded maximum depth of %0">,DefaultFatal;
def note_template_recursion_depth : Note<
"use -ftemplate-depth-N to increase recursive template instantiation depth">;
@@ -722,7 +722,8 @@ def warn_deprecated : Warning<"%0 is deprecated">;
def warn_unavailable : Warning<"%0 is unavailable">;
def note_unavailable_here : Note<
"function has been explicitly marked %select{unavailable|deleted}0 here">;
-def warn_missing_prototype : Warning<"no previous prototype for function %0">;
+def warn_missing_prototype : Warning<
+ "no previous prototype for function %0">, DefaultIgnore;
def err_redefinition : Error<"redefinition of %0">;
def err_static_non_static : Error<
"static declaration of %0 follows non-static declaration">;
@@ -882,7 +883,7 @@ def err_offsetof_array_type : Error<"offsetof requires array type, %0 invalid">;
def ext_offsetof_extended_field_designator : Extension<
"using extended field designator is an extension">;
def warn_floatingpoint_eq : Warning<
- "comparing floating point with == or != is unsafe">;
+ "comparing floating point with == or != is unsafe">, DefaultIgnore;
def err_typecheck_subscript_value : Error<
"subscripted value is neither array nor pointer">;
diff --git a/tools/clang-cc/Warnings.cpp b/tools/clang-cc/Warnings.cpp
index f272292301..ca540a3998 100644
--- a/tools/clang-cc/Warnings.cpp
+++ b/tools/clang-cc/Warnings.cpp
@@ -102,25 +102,8 @@ static bool WarningOptionCompare(const WarningOption &LHS,
bool clang::ProcessWarningOptions(Diagnostic &Diags) {
Diags.setSuppressSystemWarnings(true); // Default to -Wno-system-headers
-
- // FIXME: These should be mapped to group options.
Diags.setIgnoreAllWarnings(OptNoWarnings);
- // Set some defaults that are currently set manually. This, too, should
- // be in the tablegen stuff later.
- Diags.setDiagnosticMapping(diag::pp_macro_not_used, diag::MAP_IGNORE);
- Diags.setDiagnosticMapping(diag::warn_floatingpoint_eq, diag::MAP_IGNORE);
- Diags.setDiagnosticMapping(diag::warn_objc_property_attr_mutually_exclusive,
- diag::MAP_IGNORE);
- Diags.setDiagnosticMapping(diag::warn_pp_undef_identifier, diag::MAP_IGNORE);
- Diags.setDiagnosticMapping(diag::warn_implicit_function_decl,
- diag::MAP_IGNORE);
-
- Diags.setDiagnosticMapping(diag::err_pp_file_not_found, diag::MAP_FATAL);
- Diags.setDiagnosticMapping(diag::err_template_recursion_depth_exceeded,
- diag::MAP_FATAL);
- Diags.setDiagnosticMapping(diag::warn_missing_prototype, diag::MAP_IGNORE);
-
// FIXME: -fdiagnostics-show-option
// FIXME: -Wfatal-errors / -Wfatal-errors=foo