From: Chris Lattner Date: Wed, 15 Apr 2009 18:08:55 +0000 (+0000) Subject: annotate diagnostics with which groups they belong to. Each X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=494571789e4154a0eba645e4d611913ab395adb2;p=clang annotate diagnostics with which groups they belong to. Each 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 --- diff --git a/include/clang/Basic/Diagnostic.td b/include/clang/Basic/Diagnostic.td index 12096347c8..2da2986c54 100644 --- a/include/clang/Basic/Diagnostic.td +++ b/include/clang/Basic/Diagnostic.td @@ -26,25 +26,25 @@ def CLASS_WARNING : DiagClass; def CLASS_EXTENSION : DiagClass; def CLASS_ERROR : DiagClass; +// Diagnostic Groups. +class DiagGroup; +class InGroup { DiagGroup Group = Group; } +class IsGroup { DiagGroup Group = DiagGroup; } + +def ImplicitFunctionDeclare : DiagGroup<"implicit-function-declaration">; +def Trigraphs : DiagGroup<"trigraphs">; -/* -class Option members> : OptionControlled { - string Name = name; - list Members = members; -} -// Definitions for options ("warning groups"). -include "DiagnosticOptions.td" -*/ // All diagnostics emitted by the compiler are an indirect subclass of this. class Diagnostic { /// 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 : Diagnostic; diff --git a/include/clang/Basic/DiagnosticCommonKinds.td b/include/clang/Basic/DiagnosticCommonKinds.td index 08c5b44998..1347293398 100644 --- a/include/clang/Basic/DiagnosticCommonKinds.td +++ b/include/clang/Basic/DiagnosticCommonKinds.td @@ -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; } diff --git a/include/clang/Basic/DiagnosticLexKinds.td b/include/clang/Basic/DiagnosticLexKinds.td index b13f843519..586423bc26 100644 --- a/include/clang/Basic/DiagnosticLexKinds.td +++ b/include/clang/Basic/DiagnosticLexKinds.td @@ -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; 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; +def trigraph_ends_block_comment : Warning<"trigraph ends block comment">, + InGroup; +def trigraph_converted : Warning<"trigraph converted to '%0' character">, + InGroup; 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">; diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index dd2ea2171b..dbb5e37528 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -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, DefaultIgnore; +def ext_implicit_function_decl : Extension< + "implicit declaration of function %0 is invalid in C99">, + InGroup; + 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<