From 30f3b450c63a99ff5eef24b45cd999f8c2cf9b91 Mon Sep 17 00:00:00 2001 From: Jordan Rose Date: Thu, 10 Jan 2013 18:50:51 +0000 Subject: [PATCH] Diagnostics: name all implicit groups used more than once. This will be a new style requirement going forwards: a diagnostic can only use the implicit InGroup> syntax if "foo" is not used by any other diagnostics; as soon as it is, it needs an explicit group. This also brings some stray "conversion" diagnostics into the "Value Conversion Issue" category, instead of the more generic "Semantic Issue" category. I consider this an improvement! - warn_impcast_complex_scalar - warn_impcast_float_integer - warn_impcast_float_precision - warn_impcast_integer_precision - warn_impcast_vector_scalar git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172088 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Basic/DiagnosticDriverKinds.td | 10 +-- .../clang/Basic/DiagnosticFrontendKinds.td | 10 +-- include/clang/Basic/DiagnosticGroups.td | 17 ++++ include/clang/Basic/DiagnosticLexKinds.td | 4 +- include/clang/Basic/DiagnosticSemaKinds.td | 84 +++++++++---------- 5 files changed, 71 insertions(+), 54 deletions(-) diff --git a/include/clang/Basic/DiagnosticDriverKinds.td b/include/clang/Basic/DiagnosticDriverKinds.td index 5fec06dc88..1f05accb98 100644 --- a/include/clang/Basic/DiagnosticDriverKinds.td +++ b/include/clang/Basic/DiagnosticDriverKinds.td @@ -110,19 +110,19 @@ def warn_c_kext : Warning< "ignoring -fapple-kext which is valid for C++ and Objective-C++ only">; def warn_drv_input_file_unused : Warning< "%0: '%1' input unused%select{ when '%3' is present|}2">, - InGroup>; + InGroup; def warn_drv_input_file_unused_by_cpp : Warning< "%0: '%1' input unused in cpp mode">, - InGroup>; + InGroup; def warn_drv_preprocessed_input_file_unused : Warning< "%0: previously preprocessed input%select{ unused when '%2' is present|}1">, - InGroup>; + InGroup; def warn_drv_unused_argument : Warning< "argument unused during compilation: '%0'">, - InGroup>; + InGroup; def warn_drv_empty_joined_argument : Warning< "joined argument expects additional value: '%0'">, - InGroup>; + InGroup; def warn_drv_clang_unsupported : Warning< "the clang compiler does not support '%0'">; def warn_drv_deprecated_arg : Warning< diff --git a/include/clang/Basic/DiagnosticFrontendKinds.td b/include/clang/Basic/DiagnosticFrontendKinds.td index 13641c1841..168cc74443 100644 --- a/include/clang/Basic/DiagnosticFrontendKinds.td +++ b/include/clang/Basic/DiagnosticFrontendKinds.td @@ -102,19 +102,19 @@ def err_relocatable_without_isysroot : Error< def warn_unknown_warning_option : Warning< "unknown warning option '%0'">, - InGroup >; + InGroup; def warn_unknown_negative_warning_option : Warning< "unknown warning option '%0'">, - InGroup >; + InGroup; def warn_unknown_warning_option_suggest : Warning< "unknown warning option '%0'; did you mean '%1'?">, - InGroup >; + InGroup; def warn_unknown_negative_warning_option_suggest : Warning< "unknown warning option '%0'; did you mean '%1'?">, - InGroup >; + InGroup; def warn_unknown_warning_specifier : Warning< "unknown %0 warning specifier: '%1'">, - InGroup >; + InGroup; def err_unknown_analyzer_checker : Error< "no analyzer checkers are associated with '%0'">; diff --git a/include/clang/Basic/DiagnosticGroups.td b/include/clang/Basic/DiagnosticGroups.td index 68f388df3a..845b493514 100644 --- a/include/clang/Basic/DiagnosticGroups.td +++ b/include/clang/Basic/DiagnosticGroups.td @@ -22,6 +22,8 @@ def : DiagGroup<"address">; def AddressOfTemporary : DiagGroup<"address-of-temporary">; def : DiagGroup<"aggregate-return">; def AmbigMemberTemplate : DiagGroup<"ambiguous-member-template">; +def ArrayBounds : DiagGroup<"array-bounds">; +def ArrayBoundsPointerArithmetic : DiagGroup<"array-bounds-pointer-arithmetic">; def Availability : DiagGroup<"availability">; def Section : DiagGroup<"section">; def AutoImport : DiagGroup<"auto-import">; @@ -36,6 +38,7 @@ def NonLiteralNullConversion : DiagGroup<"non-literal-null-conversion">; def NullConversion : DiagGroup<"null-conversion">; def ImplicitConversionFloatingPointToBool : DiagGroup<"implicit-conversion-floating-point-to-bool">; +def BadArrayNewLength : DiagGroup<"bad-array-new-length">; def BuiltinRequiresHeader : DiagGroup<"builtin-requires-header">; def CXXCompat: DiagGroup<"c++-compat">; def CastAlign : DiagGroup<"cast-align">; @@ -117,10 +120,14 @@ def BitwiseOpParentheses: DiagGroup<"bitwise-op-parentheses">; def LogicalOpParentheses: DiagGroup<"logical-op-parentheses">; def ShiftOpParentheses: DiagGroup<"shift-op-parentheses">; def DanglingElse: DiagGroup<"dangling-else">; +def DanglingField : DiagGroup<"dangling-field">; +def DistributedObjectModifiers : DiagGroup<"distributed-object-modifiers">; def IgnoredQualifiers : DiagGroup<"ignored-qualifiers">; def : DiagGroup<"import">; def IncompatiblePointerTypes : DiagGroup<"incompatible-pointer-types">; def IncompleteUmbrella : DiagGroup<"incomplete-umbrella">; +def InvalidNoreturn : DiagGroup<"invalid-noreturn">; +def InvalidSourceEncoding : DiagGroup<"invalid-source-encoding">; def KNRPromotedParameter : DiagGroup<"knr-promoted-parameter">; def : DiagGroup<"init-self">; def : DiagGroup<"inline">; @@ -135,18 +142,22 @@ def MissingBraces : DiagGroup<"missing-braces">; def MissingDeclarations: DiagGroup<"missing-declarations">; def : DiagGroup<"missing-format-attribute">; def : DiagGroup<"missing-include-dirs">; +def MissingNoreturn : DiagGroup<"missing-noreturn">; def MultiChar : DiagGroup<"multichar">; def : DiagGroup<"nested-externs">; def CXX11LongLong : DiagGroup<"c++11-long-long">; def LongLong : DiagGroup<"long-long", [CXX11LongLong]>; +def MethodSignatures : DiagGroup<"method-signatures">; def MismatchedParameterTypes : DiagGroup<"mismatched-parameter-types">; def MismatchedReturnTypes : DiagGroup<"mismatched-return-types">; def MismatchedTags : DiagGroup<"mismatched-tags">; def MissingFieldInitializers : DiagGroup<"missing-field-initializers">; +def NullArithmetic : DiagGroup<"null-arithmetic">; def NullCharacter : DiagGroup<"null-character">; def NullDereference : DiagGroup<"null-dereference">; def InitializerOverrides : DiagGroup<"initializer-overrides">; def NonNull : DiagGroup<"nonnull">; +def NonPODVarargs : DiagGroup<"non-pod-varargs">; def : DiagGroup<"nonportable-cfstrings">; def NonVirtualDtor : DiagGroup<"non-virtual-dtor">; def OveralignedType : DiagGroup<"over-aligned">; @@ -177,6 +188,7 @@ def PoundPragmaMessage : DiagGroup<"#pragma-messages">, DiagCategory<"#pragma message Directive">; def : DiagGroup<"pointer-to-int-cast">; def : DiagGroup<"redundant-decls">; +def ReturnStackAddress : DiagGroup<"return-stack-address">; def ReturnTypeCLinkage : DiagGroup<"return-type-c-linkage">; def ReturnType : DiagGroup<"return-type", [ReturnTypeCLinkage]>; def BindToTemporaryCopy : DiagGroup<"bind-to-temporary-copy", @@ -195,6 +207,8 @@ def : DiagGroup<"stack-protector">; def : DiagGroup<"switch-default">; def : DiagGroup<"synth">; def SizeofArrayArgument : DiagGroup<"sizeof-array-argument">; +def SizeofPointerMemaccess : DiagGroup<"sizeof-pointer-memaccess">; +def StaticInInline : DiagGroup<"static-in-inline">; def StringPlusInt : DiagGroup<"string-plus-int">; def StrncatSize : DiagGroup<"strncat-size">; def TautologicalOutOfRangeCompare : DiagGroup<"tautological-constant-out-of-range-compare">; @@ -238,17 +252,20 @@ def InvalidPPToken : DiagGroup<"invalid-pp-token">; def Trigraphs : DiagGroup<"trigraphs">; def : DiagGroup<"type-limits">; +def UndefinedReinterpretCast : DiagGroup<"undefined-reinterpret-cast">; def Unicode : DiagGroup<"unicode">; def UninitializedMaybe : DiagGroup<"conditional-uninitialized">; def UninitializedSometimes : DiagGroup<"sometimes-uninitialized">; def Uninitialized : DiagGroup<"uninitialized", [UninitializedSometimes]>; def UnknownPragmas : DiagGroup<"unknown-pragmas">; +def UnknownWarningOption : DiagGroup<"unknown-warning-option">; def NSobjectAttribute : DiagGroup<"NSObject-attribute">; def UnknownAttributes : DiagGroup<"attributes">; def IgnoredAttributes : DiagGroup<"ignored-attributes">; def UnnamedTypeTemplateArgs : DiagGroup<"unnamed-type-template-args", [CXX98CompatUnnamedTypeTemplateArgs]>; def UnusedArgument : DiagGroup<"unused-argument">; +def UnusedCommandLineArgument : DiagGroup<"unused-command-line-argument">; def UnusedComparison : DiagGroup<"unused-comparison">; def UnusedExceptionParameter : DiagGroup<"unused-exception-parameter">; def UnneededInternalDecl : DiagGroup<"unneeded-internal-declaration">; diff --git a/include/clang/Basic/DiagnosticLexKinds.td b/include/clang/Basic/DiagnosticLexKinds.td index dbb5b4e58f..3c036a3e65 100644 --- a/include/clang/Basic/DiagnosticLexKinds.td +++ b/include/clang/Basic/DiagnosticLexKinds.td @@ -175,12 +175,12 @@ def err_bad_string_encoding : Error< "illegal character encoding in string literal">; def warn_bad_string_encoding : ExtWarn< "illegal character encoding in string literal">, - InGroup>; + InGroup; def err_bad_character_encoding : Error< "illegal character encoding in character literal">; def warn_bad_character_encoding : ExtWarn< "illegal character encoding in character literal">, - InGroup>; + InGroup; def err_lexing_string : Error<"failure when lexing a string">; diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index 4d8f267098..4563519d57 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -309,10 +309,10 @@ def err_falloff_nonvoid_block : Error< "control reaches end of non-void block">; def warn_suggest_noreturn_function : Warning< "%select{function|method}0 %1 could be declared with attribute 'noreturn'">, - InGroup>, DefaultIgnore; + InGroup, DefaultIgnore; def warn_suggest_noreturn_block : Warning< "block could be declared with attribute 'noreturn'">, - InGroup>, DefaultIgnore; + InGroup, DefaultIgnore; def warn_unreachable : Warning<"will never be executed">, InGroup>, DefaultIgnore; @@ -352,7 +352,7 @@ def note_bad_memaccess_silence : Note< def warn_sizeof_pointer_expr_memaccess : Warning< "'%0' call operates on objects of type %1 while the size is based on a " "different type %2">, - InGroup>; + InGroup; def warn_sizeof_pointer_expr_memaccess_note : Note< "did you mean to %select{dereference the argument to 'sizeof' (and multiply " "it by the number of elements)|remove the addressof in the argument to " @@ -361,7 +361,7 @@ def warn_sizeof_pointer_expr_memaccess_note : Note< def warn_sizeof_pointer_type_memaccess : Warning< "argument to 'sizeof' in %0 call is the same pointer type %1 as the " "%select{destination|source}2; expected %3 or an explicit length">, - InGroup>; + InGroup; def warn_strlcpycat_wrong_size : Warning< "size argument in %0 call appears to be size of the source; expected the size of " "the destination">, @@ -528,7 +528,7 @@ def warn_conflicting_overriding_ret_type_modifiers : Warning< def warn_conflicting_ret_type_modifiers : Warning< "conflicting distributed object modifiers on return type " "in implementation of %0">, - InGroup>; + InGroup; def warn_non_covariant_overriding_ret_types : Warning< "conflicting return type in " @@ -538,7 +538,7 @@ def warn_non_covariant_overriding_ret_types : Warning< def warn_non_covariant_ret_types : Warning< "conflicting return type in " "implementation of %0: %1 vs %2">, - InGroup>, DefaultIgnore; + InGroup, DefaultIgnore; def warn_conflicting_overriding_param_types : Warning< "conflicting parameter types in " @@ -553,7 +553,7 @@ def warn_conflicting_param_types : Warning< def warn_conflicting_param_modifiers : Warning< "conflicting distributed object modifiers on parameter type " "in implementation of %0">, - InGroup>; + InGroup; def warn_conflicting_overriding_param_modifiers : Warning< "conflicting distributed object modifiers on parameter type " @@ -568,7 +568,7 @@ def warn_non_contravariant_overriding_param_types : Warning< def warn_non_contravariant_param_types : Warning< "conflicting parameter types in " "implementation of %0: %1 vs %2">, - InGroup>, DefaultIgnore; + InGroup, DefaultIgnore; def warn_conflicting_overriding_variadic :Warning< "conflicting variadic declaration of method and its " @@ -1983,16 +1983,16 @@ def warn_thread_safety_beta : Warning< def warn_impcast_vector_scalar : Warning< "implicit conversion turns vector to scalar: %0 to %1">, - InGroup>, DefaultIgnore; + InGroup, DefaultIgnore; def warn_impcast_complex_scalar : Warning< "implicit conversion discards imaginary component: %0 to %1">, - InGroup>, DefaultIgnore; + InGroup, DefaultIgnore; def warn_impcast_float_precision : Warning< "implicit conversion loses floating-point precision: %0 to %1">, - InGroup>, DefaultIgnore; + InGroup, DefaultIgnore; def warn_impcast_float_integer : Warning< "implicit conversion turns floating-point number into integer: %0 to %1">, - InGroup>, DefaultIgnore; + InGroup, DefaultIgnore; def warn_impcast_integer_sign : Warning< "implicit conversion changes signedness: %0 to %1">, InGroup, DefaultIgnore; @@ -2001,7 +2001,7 @@ def warn_impcast_integer_sign_conditional : Warning< InGroup, DefaultIgnore; def warn_impcast_integer_precision : Warning< "implicit conversion loses integer precision: %0 to %1">, - InGroup>, DefaultIgnore; + InGroup, DefaultIgnore; def warn_impcast_integer_64_32 : Warning< "implicit conversion loses integer precision: %0 to %1">, InGroup, DefaultIgnore; @@ -3239,10 +3239,10 @@ def note_used_here : Note<"used here">; def warn_internal_in_extern_inline : ExtWarn< "static %select{function|variable}0 %1 is used in an inline function with " - "external linkage">, InGroup >; + "external linkage">, InGroup; def ext_internal_in_extern_inline : Extension< "static %select{function|variable}0 %1 is used in an inline function with " - "external linkage">, InGroup >; + "external linkage">, InGroup; def note_convert_inline_to_static : Note< "use 'static' to give inline function %0 internal linkage">; def note_internal_decl_declared_here : Note< @@ -3348,7 +3348,7 @@ def err_array_too_large : Error< "array is too large (%0 elements)">; def warn_array_new_too_large : Warning<"array is too large (%0 elements)">, // FIXME PR11644: ", will throw std::bad_array_new_length at runtime" - InGroup>; + InGroup; // -Wpadded, -Wpacked def warn_padded_struct_field : Warning< @@ -3368,7 +3368,7 @@ def warn_unnecessary_packed : Warning< def err_typecheck_negative_array_size : Error<"array size is negative">; def warn_typecheck_negative_array_new_size : Warning<"array size is negative">, // FIXME PR11644: ", will throw std::bad_array_new_length at runtime" - InGroup>; + InGroup; def warn_typecheck_function_qualifiers : Warning< "qualifier on function type %0 has unspecified behavior">; def err_typecheck_invalid_restrict_not_pointer : Error< @@ -3383,7 +3383,7 @@ def err_typecheck_zero_array_size : Error< "zero-length arrays are not permitted in C++">; def warn_typecheck_zero_static_array_size : Warning< "'static' has no effect on zero-length arrays">, - InGroup>; + InGroup; def err_array_size_non_int : Error<"size of array has non-integer type %0">; def err_init_element_not_constant : Error< "initializer element is not a compile-time constant">; @@ -4116,7 +4116,7 @@ def note_indirection_through_null : Note< def warn_pointer_indirection_from_incompatible_type : Warning< "dereference of type %1 that was reinterpret_cast from type %0 has undefined " "behavior">, - InGroup>, DefaultIgnore; + InGroup, DefaultIgnore; def err_objc_object_assignment : Error< "cannot assign to class object (%0 invalid)">; @@ -4173,11 +4173,11 @@ def warn_comparison_of_mixed_enum_types : Warning< InGroup>; def warn_null_in_arithmetic_operation : Warning< "use of NULL in arithmetic operation">, - InGroup>; + InGroup; def warn_null_in_comparison_operation : Warning< "comparison between NULL and non-pointer " "%select{(%1 and NULL)|(NULL and %1)}0">, - InGroup>; + InGroup; def err_invalid_this_use : Error< "invalid use of 'this' outside of a non-static member function">; @@ -4435,7 +4435,7 @@ def err_bad_reinterpret_cast_reference : Error< "reinterpret_cast of a %0 to %1 needs its address which is not allowed">; def warn_undefined_reinterpret_cast : Warning< "reinterpret_cast from %0 to %1 has undefined behavior">, - InGroup>, DefaultIgnore; + InGroup, DefaultIgnore; // These messages don't adhere to the pattern. // FIXME: Display the path somehow better. @@ -5067,7 +5067,7 @@ def err_ref_bad_target : Error< def warn_non_pod_vararg_with_format_string : Warning< "cannot pass %select{non-POD|non-trivial}0 object of type %1 to variadic " "%select{function|block|method|constructor}2; expected type from format " - "string was %3">, InGroup>, DefaultError; + "string was %3">, InGroup, DefaultError; // The arguments to this diagnostic should match the warning above. def err_cannot_pass_objc_interface_to_vararg_format : Error< "cannot pass object with interface type %1 by value to variadic " @@ -5080,7 +5080,7 @@ def err_cannot_pass_objc_interface_to_vararg : Error< def warn_cannot_pass_non_pod_arg_to_vararg : Warning< "cannot pass object of %select{non-POD|non-trivial}0 type %1 through variadic" " %select{function|block|method|constructor}2; call will abort at runtime">, - InGroup>, DefaultError; + InGroup, DefaultError; def warn_cxx98_compat_pass_non_pod_arg_to_vararg : Warning< "passing object of trivial but non-POD type %0 through variadic" " %select{function|block|method|constructor}1 is incompatible with C++98">, @@ -5500,17 +5500,17 @@ def ext_implicit_exception_spec_mismatch : ExtWarn< def warn_ptr_arith_precedes_bounds : Warning< "the pointer decremented by %0 refers before the beginning of the array">, - InGroup>, DefaultIgnore; + InGroup, DefaultIgnore; def warn_ptr_arith_exceeds_bounds : Warning< "the pointer incremented by %0 refers past the end of the array (that " "contains %1 element%s2)">, - InGroup>, DefaultIgnore; + InGroup, DefaultIgnore; def warn_array_index_precedes_bounds : Warning< "array index %0 is before the beginning of the array">, - InGroup>; + InGroup; def warn_array_index_exceeds_bounds : Warning< "array index %0 is past the end of the array (which contains %1 " - "element%s2)">, InGroup>; + "element%s2)">, InGroup; def note_array_index_out_of_bounds : Note< "array %0 declared here">; @@ -5548,7 +5548,7 @@ def warn_format_mix_positional_nonpositional_args : Warning< InGroup; def warn_static_array_too_small : Warning< "array argument is too small; contains %0 elements, callee requires at least %1">, - InGroup>; + InGroup; def note_callee_static_array : Note< "callee declares array parameter as static here">; def warn_empty_format_string : Warning< @@ -5597,19 +5597,19 @@ def warn_null_arg : Warning< // CHECK: returning address/reference of stack memory def warn_ret_stack_addr : Warning< "address of stack memory associated with local variable %0 returned">, - InGroup>; + InGroup; def warn_ret_stack_ref : Warning< "reference to stack memory associated with local variable %0 returned">, - InGroup>; + InGroup; def warn_ret_local_temp_addr : Warning< "returning address of local temporary object">, - InGroup>; + InGroup; def warn_ret_local_temp_ref : Warning< "returning reference to local temporary object">, - InGroup>; + InGroup; def warn_ret_addr_label : Warning< "returning address of label, which is local">, - InGroup>; + InGroup; def err_ret_local_block : Error< "returning block that lives on the local stack">; def note_ref_var_local_bind : Note< @@ -5619,13 +5619,13 @@ def note_ref_var_local_bind : Note< // a constructor parameter. def warn_bind_ref_member_to_parameter : Warning< "binding reference member %0 to stack allocated parameter %1">, - InGroup>; + InGroup; def warn_init_ptr_member_to_parameter_addr : Warning< "initializing pointer member %0 with the stack address of parameter %1">, - InGroup>; + InGroup; def warn_bind_ref_member_to_temporary : Warning< "binding reference member %0 to a temporary value">, - InGroup>; + InGroup; def note_ref_or_ptr_member_declared_here : Note< "%select{reference|pointer}0 member declared here">; @@ -5711,7 +5711,7 @@ def warn_bool_switch_condition : Warning< "switch condition has boolean value">; def warn_case_value_overflow : Warning< "overflow converting case value to switch condition type (%0 to %1)">, - InGroup>; + InGroup; def err_duplicate_case : Error<"duplicate case value '%0'">; def err_duplicate_case_differing_expr : Error< "duplicate case value: '%0' and '%1' both equal '%2'">; @@ -5814,10 +5814,10 @@ def err_second_parameter_to_va_arg_abstract: Error< "second argument to 'va_arg' is of abstract type %0">; def warn_second_parameter_to_va_arg_not_pod : Warning< "second argument to 'va_arg' is of non-POD type %0">, - InGroup>, DefaultError; + InGroup, DefaultError; def warn_second_parameter_to_va_arg_ownership_qualified : Warning< "second argument to 'va_arg' is of ARC ownership-qualified type %0">, - InGroup>, DefaultError; + InGroup, DefaultError; def warn_second_parameter_to_va_arg_never_compatible : Warning< "second argument to 'va_arg' is of promotable type %0; this va_arg has " "undefined behavior because arguments will be promoted to %1">; @@ -5839,10 +5839,10 @@ def err_return_init_list : Error< "must not return a value">; def warn_noreturn_function_has_return_expr : Warning< "function %0 declared 'noreturn' should not return">, - InGroup>; + InGroup; def warn_falloff_noreturn_function : Warning< "function declared 'noreturn' should not return">, - InGroup>; + InGroup; def err_noreturn_block_has_return_expr : Error< "block declared 'noreturn' should not return">; def err_block_on_nonlocal : Error< -- 2.40.0