]> granicus.if.org Git - clang/commitdiff
annotate diagnostics with which groups they belong to. Each
authorChris Lattner <sabre@nondot.org>
Wed, 15 Apr 2009 18:08:55 +0000 (18:08 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 15 Apr 2009 18:08:55 +0000 (18:08 +0000)
diagnostic can belong to at most one group.  Each group can
contain multiple diags, but we have nice syntax for the common
case of "1 diag to one group".

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69192 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/Diagnostic.td
include/clang/Basic/DiagnosticCommonKinds.td
include/clang/Basic/DiagnosticLexKinds.td
include/clang/Basic/DiagnosticSemaKinds.td

index 12096347c8553ad34c14e19b883348f9b6ee45f8..2da2986c54ea35c25c24dbcb8d11ff82262e8f96 100644 (file)
@@ -26,25 +26,25 @@ def CLASS_WARNING   : DiagClass;
 def CLASS_EXTENSION : DiagClass;
 def CLASS_ERROR     : DiagClass;
 
+// Diagnostic Groups.
+class DiagGroup<string name>;
+class InGroup<DiagGroup Group> { DiagGroup Group = Group; }
+class IsGroup<string Name> { DiagGroup Group = DiagGroup<Name>; }
+
+def ImplicitFunctionDeclare : DiagGroup<"implicit-function-declaration">;
+def Trigraphs : DiagGroup<"trigraphs">;
 
-/*
-class Option<string name, list<OptionControlled> members> : OptionControlled {
-  string Name = name;
-  list<OptionControlled> Members = members;
-}
 
-// Definitions for options ("warning groups").
-include "DiagnosticOptions.td"
 
-*/
 
 // All diagnostics emitted by the compiler are an indirect subclass of this.
 class Diagnostic<string text, DiagClass DC, DiagMapping defaultmapping> {
   /// Component is specified by the file with a big let directive.
-  string Component = ?;
-  string Text = text;
-  DiagClass Class = DC;
+  string      Component = ?;
+  string      Text = text;
+  DiagClass   Class = DC;
   DiagMapping DefaultMapping = defaultmapping;
+  DiagGroup   Group;
 }
 
 class Error<string str>     : Diagnostic<str, CLASS_ERROR, MAP_ERROR>;
index 08c5b449987a437982bdf38d171bd50d44bd56e1..1347293398bfaae4d691082bd99312642b7970c7 100644 (file)
@@ -52,12 +52,14 @@ 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">, DefaultIgnore;
+def pp_macro_not_used : Warning<"macro is not used">, DefaultIgnore,
+    IsGroup<"unused-macros">;
 
 
 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">, DefaultIgnore;
+  "%0 is not defined, evaluates to 0">,
+  IsGroup<"undef">, DefaultIgnore;
 
 }
index b13f8435196183896060618c05ed59aafad8d4b6..586423bc2651afa26c611b783f56c006aee36988 100644 (file)
@@ -23,11 +23,13 @@ def backslash_newline_space : Warning<
   "backslash and newline separated by space">;
 
 // Trigraphs.
-def trigraph_ignored : Warning<"trigraph ignored">;
+def trigraph_ignored : Warning<"trigraph ignored">, InGroup<Trigraphs>;
 def trigraph_ignored_block_comment : Warning<
-  "ignored trigraph would end block comment">;
-def trigraph_ends_block_comment : Warning<"trigraph ends block comment">;
-def trigraph_converted : Warning<"trigraph converted to '%0' character">;
+  "ignored trigraph would end block comment">, InGroup<Trigraphs>;
+def trigraph_ends_block_comment : Warning<"trigraph ends block comment">,
+    InGroup<Trigraphs>;
+def trigraph_converted : Warning<"trigraph converted to '%0' character">,
+    InGroup<Trigraphs>;
 
 def ext_multi_line_bcpl_comment : Extension<"multi-line // comment">;
 def ext_bcpl_comment : Extension<
@@ -112,8 +114,10 @@ def ext_pp_ident_directive : Extension<"#ident is a language extension">;
 def ext_pp_include_next_directive : Extension<
   "#include_next is a language extension">;
 def ext_pp_warning_directive : Extension<"#warning is a language extension">;
+
 def ext_pp_extra_tokens_at_eol : ExtWarn<
-  "extra tokens at end of #%0 directive">;
+  "extra tokens at end of #%0 directive">, IsGroup<"extra-tokens">;
+  
 def ext_pp_comma_expr : Extension<"comma operator in operand of #if">;
 def ext_pp_bad_vaargs_use : Extension<
   "__VA_ARGS__ can only appear in the expansion of a C99 variadic macro">;
index dd2ea2171bfa76b631b3456d9c92d33d31592753..dbb5e375283c4b140ed572cfb789ffbace1161a9 100644 (file)
@@ -76,8 +76,14 @@ def err_bad_variable_name : Error<
 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">, DefaultIgnore;
+  "implicit declaration of function %0">,
+  InGroup<ImplicitFunctionDeclare>, DefaultIgnore;
+def ext_implicit_function_decl : Extension<
+  "implicit declaration of function %0 is invalid in C99">,
+  InGroup<ImplicitFunctionDeclare>;
+
 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 +227,8 @@ 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">, DefaultIgnore;
+  "property attributes '%0' and '%1' are mutually exclusive">,
+  IsGroup<"readonly-setter-attrs">, DefaultIgnore;
 
 // C++ declarations
 def err_static_assert_expression_is_not_constant : Error<
@@ -718,12 +725,14 @@ def err_unexpected_namespace : Error<
   "unexpected namespace name %0: expected expression">;
 def err_undeclared_var_use : Error<"use of undeclared identifier %0">;
 def err_undeclared_use : Error<"use of undeclared '%0'">;
-def warn_deprecated : Warning<"%0 is deprecated">;
+def warn_deprecated : Warning<"%0 is deprecated">,
+    IsGroup<"deprecated-declarations">;
 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">, DefaultIgnore;
+  "no previous prototype for function %0">,
+  IsGroup<"missing-prototypes">, DefaultIgnore;
 def err_redefinition : Error<"redefinition of %0">;
 def err_static_non_static : Error<
   "static declaration of %0 follows non-static declaration">;
@@ -819,8 +828,6 @@ def err_undeclared_label_use : Error<"use of undeclared label '%0'">;
 
 def err_goto_into_scope : Error<"illegal jump (scoping violation)">;
 
-def ext_implicit_function_decl : Extension<
-  "implicit declaration of function %0 is invalid in C99">;
 
 def err_func_returning_array_function : Error<
   "function cannot return array or function type %0">;
@@ -883,7 +890,8 @@ 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">, DefaultIgnore;
+  "comparing floating point with == or != is unsafe">,
+  IsGroup<"float-equal">, DefaultIgnore;
 
 def err_typecheck_subscript_value : Error<
   "subscripted value is neither array nor pointer">;
@@ -987,7 +995,8 @@ def err_builtin_direct_init_more_than_one_arg : Error<
 def err_value_init_for_array_type : Error<
   "array types cannot be value-initialized">;
 def warn_printf_not_string_constant : Warning<
-  "format string is not a string literal (potentially insecure)">;
+  "format string is not a string literal (potentially insecure)">,
+  IsGroup<"format-nonliteral">;
 
 def err_unexpected_interface : Error<
   "unexpected interface name %0: expected expression">;
@@ -1158,7 +1167,8 @@ def ext_typecheck_convert_int_pointer : ExtWarn<
 def ext_typecheck_convert_pointer_void_func : Extension<
   "%2 %1 converts between void* and function pointer, expected %0">;
 def ext_typecheck_convert_incompatible_pointer_sign : ExtWarn<
-  "pointer types point to integer types with different sign %2 %1, expected %0">;
+ "pointer types point to integer types with different sign %2 %1, expected %0">,
+  IsGroup<"pointer-sign">;
 def ext_typecheck_convert_incompatible_pointer : ExtWarn<
   "incompatible pointer types %2 %1, expected %0">;
 def ext_typecheck_convert_discards_qualifiers : ExtWarn<