1 //==--- DiagnosticGroups.td - Diagnostic Group Definitions ----------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 def ImplicitFunctionDeclare : DiagGroup<"implicit-function-declaration">;
11 def ImplicitInt : DiagGroup<"implicit-int">;
13 // Aggregation warning settings.
14 def Implicit : DiagGroup<"implicit", [
15 ImplicitFunctionDeclare,
19 // Empty DiagGroups are recognized by clang but ignored.
20 def : DiagGroup<"abi">;
21 def : DiagGroup<"address">;
22 def AddressOfTemporary : DiagGroup<"address-of-temporary">;
23 def : DiagGroup<"aggregate-return">;
24 def AmbigMemberTemplate : DiagGroup<"ambiguous-member-template">;
25 def Availability : DiagGroup<"availability">;
26 def Section : DiagGroup<"section">;
27 def AutoImport : DiagGroup<"auto-import">;
28 def ConstantConversion : DiagGroup<"constant-conversion">;
29 def LiteralConversion : DiagGroup<"literal-conversion">;
30 def StringConversion : DiagGroup<"string-conversion">;
31 def SignConversion : DiagGroup<"sign-conversion">;
32 def BoolConversion : DiagGroup<"bool-conversion">;
33 def IntConversion : DiagGroup<"int-conversion">;
34 def EnumConversion : DiagGroup<"enum-conversion">;
35 def NonLiteralNullConversion : DiagGroup<"non-literal-null-conversion">;
36 def NullConversion : DiagGroup<"null-conversion">;
37 def ImplicitConversionFloatingPointToBool :
38 DiagGroup<"implicit-conversion-floating-point-to-bool">;
39 def BuiltinRequiresHeader : DiagGroup<"builtin-requires-header">;
40 def CXXCompat: DiagGroup<"c++-compat">;
41 def CastAlign : DiagGroup<"cast-align">;
42 def : DiagGroup<"cast-qual">;
43 def : DiagGroup<"char-align">;
44 def Comment : DiagGroup<"comment">;
45 def : DiagGroup<"ctor-dtor-privacy">;
46 def DefaultArgSpecialMember : DiagGroup<"default-arg-special-member">;
47 def GNUDesignator : DiagGroup<"gnu-designator">;
49 def DeleteNonVirtualDtor : DiagGroup<"delete-non-virtual-dtor">;
50 def AbstractFinalClass : DiagGroup<"abstract-final-class">;
52 def DeprecatedDeclarations : DiagGroup<"deprecated-declarations">;
53 def DeprecatedWritableStr : DiagGroup<"deprecated-writable-strings">;
54 def Deprecated : DiagGroup<"deprecated", [ DeprecatedDeclarations] >,
55 DiagCategory<"Deprecations">;
57 def DeprecatedImplementations :DiagGroup<"deprecated-implementations">;
59 def : DiagGroup<"disabled-optimization">;
60 def : DiagGroup<"discard-qual">;
61 def : DiagGroup<"div-by-zero">;
63 def DocumentationHTML : DiagGroup<"documentation-html">;
64 def DocumentationPedantic : DiagGroup<"documentation-pedantic">;
65 def DocumentationDeprecatedSync : DiagGroup<"documentation-deprecated-sync">;
66 def Documentation : DiagGroup<"documentation",
68 DocumentationDeprecatedSync]>;
70 def EmptyBody : DiagGroup<"empty-body">;
71 def ExtraTokens : DiagGroup<"extra-tokens">;
72 def CXX11ExtraSemi : DiagGroup<"c++11-extra-semi">;
73 def ExtraSemi : DiagGroup<"extra-semi", [CXX11ExtraSemi]>;
75 def FormatExtraArgs : DiagGroup<"format-extra-args">;
76 def FormatZeroLength : DiagGroup<"format-zero-length">;
78 def CXX98CompatBindToTemporaryCopy :
79 DiagGroup<"c++98-compat-bind-to-temporary-copy">;
80 def CXX98CompatLocalTypeTemplateArgs :
81 DiagGroup<"c++98-compat-local-type-template-args">;
82 def CXX98CompatUnnamedTypeTemplateArgs :
83 DiagGroup<"c++98-compat-unnamed-type-template-args">;
85 def CXX98Compat : DiagGroup<"c++98-compat",
86 [CXX98CompatBindToTemporaryCopy,
87 CXX98CompatLocalTypeTemplateArgs,
88 CXX98CompatUnnamedTypeTemplateArgs]>;
89 // Warnings for C++11 features which are Extensions in C++98 mode.
90 def CXX98CompatPedantic : DiagGroup<"c++98-compat-pedantic", [CXX98Compat]>;
92 def CXX11Narrowing : DiagGroup<"c++11-narrowing">;
94 // Original name of this warning in Clang
95 def : DiagGroup<"c++0x-narrowing", [CXX11Narrowing]>;
97 // Name of this warning in GCC
98 def : DiagGroup<"narrowing", [CXX11Narrowing]>;
100 def CXX11CompatReservedUserDefinedLiteral :
101 DiagGroup<"c++11-compat-reserved-user-defined-literal">;
102 def ReservedUserDefinedLiteral :
103 DiagGroup<"reserved-user-defined-literal",
104 [CXX11CompatReservedUserDefinedLiteral]>;
106 def CXX11Compat : DiagGroup<"c++11-compat",
108 CXX11CompatReservedUserDefinedLiteral]>;
109 def : DiagGroup<"c++0x-compat", [CXX11Compat]>;
111 def : DiagGroup<"effc++">;
112 def DivZero : DiagGroup<"division-by-zero">;
113 def ExitTimeDestructors : DiagGroup<"exit-time-destructors">;
114 def FlexibleArrayExtensions : DiagGroup<"flexible-array-extensions">;
115 def FourByteMultiChar : DiagGroup<"four-char-constants">;
116 def GlobalConstructors : DiagGroup<"global-constructors">;
117 def BitwiseOpParentheses: DiagGroup<"bitwise-op-parentheses">;
118 def LogicalOpParentheses: DiagGroup<"logical-op-parentheses">;
119 def ShiftOpParentheses: DiagGroup<"shift-op-parentheses">;
120 def DanglingElse: DiagGroup<"dangling-else">;
121 def IgnoredQualifiers : DiagGroup<"ignored-qualifiers">;
122 def : DiagGroup<"import">;
123 def IncompatiblePointerTypes : DiagGroup<"incompatible-pointer-types">;
124 def IncompleteUmbrella : DiagGroup<"incomplete-umbrella">;
125 def KNRPromotedParameter : DiagGroup<"knr-promoted-parameter">;
126 def : DiagGroup<"init-self">;
127 def : DiagGroup<"inline">;
128 def : DiagGroup<"invalid-pch">;
129 def LiteralRange : DiagGroup<"literal-range">;
130 def LocalTypeTemplateArgs : DiagGroup<"local-type-template-args",
131 [CXX98CompatLocalTypeTemplateArgs]>;
132 def MalformedWarningCheck : DiagGroup<"malformed-warning-check">;
133 def Main : DiagGroup<"main">;
134 def MainReturnType : DiagGroup<"main-return-type">;
135 def MissingBraces : DiagGroup<"missing-braces">;
136 def MissingDeclarations: DiagGroup<"missing-declarations">;
137 def : DiagGroup<"missing-format-attribute">;
138 def : DiagGroup<"missing-include-dirs">;
139 def MultiChar : DiagGroup<"multichar">;
140 def : DiagGroup<"nested-externs">;
141 def CXX11LongLong : DiagGroup<"c++11-long-long">;
142 def LongLong : DiagGroup<"long-long", [CXX11LongLong]>;
143 def MismatchedParameterTypes : DiagGroup<"mismatched-parameter-types">;
144 def MismatchedReturnTypes : DiagGroup<"mismatched-return-types">;
145 def MismatchedTags : DiagGroup<"mismatched-tags">;
146 def MissingFieldInitializers : DiagGroup<"missing-field-initializers">;
147 def ModuleBuild : DiagGroup<"module-build">;
148 def NullCharacter : DiagGroup<"null-character">;
149 def NullDereference : DiagGroup<"null-dereference">;
150 def InitializerOverrides : DiagGroup<"initializer-overrides">;
151 def NonNull : DiagGroup<"nonnull">;
152 def : DiagGroup<"nonportable-cfstrings">;
153 def NonVirtualDtor : DiagGroup<"non-virtual-dtor">;
154 def OveralignedType : DiagGroup<"over-aligned">;
155 def : DiagGroup<"old-style-cast">;
156 def : DiagGroup<"old-style-definition">;
157 def OutOfLineDeclaration : DiagGroup<"out-of-line-declaration">;
158 def : DiagGroup<"overflow">;
159 def ForwardClassReceiver : DiagGroup<"receiver-forward-class">;
160 def MethodAccess : DiagGroup<"objc-method-access">;
161 def ObjCReceiver : DiagGroup<"receiver-expr">;
162 def OverlengthStrings : DiagGroup<"overlength-strings">;
163 def OverloadedVirtual : DiagGroup<"overloaded-virtual">;
164 def PrivateExtern : DiagGroup<"private-extern">;
165 def SelTypeCast : DiagGroup<"cast-of-sel-type">;
166 def BadFunctionCast : DiagGroup<"bad-function-cast">;
167 def ObjCPropertyImpl : DiagGroup<"objc-property-implementation">;
168 def ObjCPropertyNoAttribute : DiagGroup<"objc-property-no-attribute">;
169 def ObjCMissingSuperCalls : DiagGroup<"objc-missing-super-calls">;
170 def ObjCRetainBlockProperty : DiagGroup<"objc-noncopy-retain-block-property">;
171 def ObjCReadonlyPropertyHasSetter : DiagGroup<"objc-readonly-with-setter-property">;
172 def ObjCRootClass : DiagGroup<"objc-root-class">;
173 def Packed : DiagGroup<"packed">;
174 def Padded : DiagGroup<"padded">;
175 def PointerArith : DiagGroup<"pointer-arith">;
176 def PoundWarning : DiagGroup<"#warnings">,
177 DiagCategory<"#warning Directive">;
178 def PoundPragmaMessage : DiagGroup<"#pragma-messages">,
179 DiagCategory<"#pragma message Directive">;
180 def : DiagGroup<"pointer-to-int-cast">;
181 def : DiagGroup<"redundant-decls">;
182 def ReturnTypeCLinkage : DiagGroup<"return-type-c-linkage">;
183 def ReturnType : DiagGroup<"return-type", [ReturnTypeCLinkage]>;
184 def BindToTemporaryCopy : DiagGroup<"bind-to-temporary-copy",
185 [CXX98CompatBindToTemporaryCopy]>;
186 def SelfAssignmentField : DiagGroup<"self-assign-field">;
187 def SelfAssignment : DiagGroup<"self-assign", [SelfAssignmentField]>;
188 def SemiBeforeMethodBody : DiagGroup<"semicolon-before-method-body">;
189 def Sentinel : DiagGroup<"sentinel">;
190 def MissingMethodReturnType : DiagGroup<"missing-method-return-type">;
191 def : DiagGroup<"sequence-point">;
192 def Shadow : DiagGroup<"shadow">;
193 def Shorten64To32 : DiagGroup<"shorten-64-to-32">;
194 def : DiagGroup<"sign-promo">;
195 def SignCompare : DiagGroup<"sign-compare">;
196 def : DiagGroup<"stack-protector">;
197 def : DiagGroup<"switch-default">;
198 def : DiagGroup<"synth">;
199 def SizeofArrayArgument : DiagGroup<"sizeof-array-argument">;
200 def StringPlusInt : DiagGroup<"string-plus-int">;
201 def StrncatSize : DiagGroup<"strncat-size">;
202 def TautologicalOutOfRangeCompare : DiagGroup<"tautological-constant-out-of-range-compare">;
203 def TautologicalCompare : DiagGroup<"tautological-compare",
204 [TautologicalOutOfRangeCompare]>;
205 def HeaderHygiene : DiagGroup<"header-hygiene">;
206 def DuplicateDeclSpecifier : DiagGroup<"duplicate-decl-specifier">;
207 def CompareDistinctPointerType : DiagGroup<"compare-distinct-pointer-types">;
209 // Preprocessor warnings.
210 def AmbiguousMacro : DiagGroup<"ambiguous-macro">;
212 // Just silence warnings about -Wstrict-aliasing for now.
213 def : DiagGroup<"strict-aliasing=0">;
214 def : DiagGroup<"strict-aliasing=1">;
215 def : DiagGroup<"strict-aliasing=2">;
216 def : DiagGroup<"strict-aliasing">;
218 // Just silence warnings about -Wstrict-overflow for now.
219 def : DiagGroup<"strict-overflow=0">;
220 def : DiagGroup<"strict-overflow=1">;
221 def : DiagGroup<"strict-overflow=2">;
222 def : DiagGroup<"strict-overflow=3">;
223 def : DiagGroup<"strict-overflow=4">;
224 def : DiagGroup<"strict-overflow=5">;
225 def : DiagGroup<"strict-overflow">;
227 def InvalidOffsetof : DiagGroup<"invalid-offsetof">;
228 def LambdaExtensions : DiagGroup<"lambda-extensions">;
229 def : DiagGroup<"strict-prototypes">;
230 def StrictSelector : DiagGroup<"strict-selector-match">;
231 def MethodDuplicate : DiagGroup<"duplicate-method-match">;
232 def CoveredSwitchDefault : DiagGroup<"covered-switch-default">;
233 def SwitchEnum : DiagGroup<"switch-enum">;
234 def Switch : DiagGroup<"switch">;
235 def ImplicitFallthroughPerFunction :
236 DiagGroup<"implicit-fallthrough-per-function">;
237 def ImplicitFallthrough : DiagGroup<"implicit-fallthrough",
238 [ImplicitFallthroughPerFunction]>;
239 def InvalidPPToken : DiagGroup<"invalid-pp-token">;
240 def Trigraphs : DiagGroup<"trigraphs">;
242 def : DiagGroup<"type-limits">;
243 def Unicode : DiagGroup<"unicode">;
244 def UninitializedMaybe : DiagGroup<"conditional-uninitialized">;
245 def UninitializedSometimes : DiagGroup<"sometimes-uninitialized">;
246 def Uninitialized : DiagGroup<"uninitialized", [UninitializedSometimes]>;
247 def UnknownPragmas : DiagGroup<"unknown-pragmas">;
248 def NSobjectAttribute : DiagGroup<"NSObject-attribute">;
249 def UnknownAttributes : DiagGroup<"attributes">;
250 def IgnoredAttributes : DiagGroup<"ignored-attributes">;
251 def UnnamedTypeTemplateArgs : DiagGroup<"unnamed-type-template-args",
252 [CXX98CompatUnnamedTypeTemplateArgs]>;
253 def UnusedArgument : DiagGroup<"unused-argument">;
254 def UnusedComparison : DiagGroup<"unused-comparison">;
255 def UnusedExceptionParameter : DiagGroup<"unused-exception-parameter">;
256 def UnneededInternalDecl : DiagGroup<"unneeded-internal-declaration">;
257 def UnneededMemberFunction : DiagGroup<"unneeded-member-function">;
258 def UnusedPrivateField : DiagGroup<"unused-private-field">;
259 def UnusedFunction : DiagGroup<"unused-function", [UnneededInternalDecl]>;
260 def UnusedMemberFunction : DiagGroup<"unused-member-function",
261 [UnneededMemberFunction]>;
262 def UnusedLabel : DiagGroup<"unused-label">;
263 def UnusedParameter : DiagGroup<"unused-parameter">;
264 def UnusedResult : DiagGroup<"unused-result">;
265 def UnusedValue : DiagGroup<"unused-value", [UnusedComparison, UnusedResult]>;
266 def UnusedVariable : DiagGroup<"unused-variable">;
267 def UsedButMarkedUnused : DiagGroup<"used-but-marked-unused">;
268 def UserDefinedLiterals : DiagGroup<"user-defined-literals">;
269 def ReadOnlySetterAttrs : DiagGroup<"readonly-setter-attrs">;
270 def Reorder : DiagGroup<"reorder">;
271 def UndeclaredSelector : DiagGroup<"undeclared-selector">;
272 def ImplicitAtomic : DiagGroup<"implicit-atomic-properties">;
273 def CustomAtomic : DiagGroup<"custom-atomic-properties">;
274 def AtomicProperties : DiagGroup<"atomic-properties",
275 [ImplicitAtomic, CustomAtomic]>;
276 // FIXME: Remove arc-abi once an Xcode is released that doesn't pass this flag.
277 def : DiagGroup<"arc-abi">;
278 def ARCUnsafeRetainedAssign : DiagGroup<"arc-unsafe-retained-assign">;
279 def ARCRetainCycles : DiagGroup<"arc-retain-cycles">;
280 def ARCNonPodMemAccess : DiagGroup<"arc-non-pod-memaccess">;
281 def AutomaticReferenceCounting : DiagGroup<"arc",
282 [ARCUnsafeRetainedAssign,
284 ARCNonPodMemAccess]>;
285 def ARCRepeatedUseOfWeakMaybe : DiagGroup<"arc-maybe-repeated-use-of-weak">;
286 def ARCRepeatedUseOfWeak : DiagGroup<"arc-repeated-use-of-weak",
287 [ARCRepeatedUseOfWeakMaybe]>;
288 def Selector : DiagGroup<"selector">;
289 def Protocol : DiagGroup<"protocol">;
290 def SuperSubClassMismatch : DiagGroup<"super-class-method-mismatch">;
291 def OverridingMethodMismatch : DiagGroup<"overriding-method-mismatch">;
292 def VariadicMacros : DiagGroup<"variadic-macros">;
293 def VectorConversion : DiagGroup<"vector-conversion">; // clang specific
294 def VexingParse : DiagGroup<"vexing-parse">;
295 def VLA : DiagGroup<"vla">;
296 def VolatileRegisterVar : DiagGroup<"volatile-register-var">;
297 def Visibility : DiagGroup<"visibility">;
298 def ZeroLengthArray : DiagGroup<"zero-length-array">;
300 // GCC calls -Wdeprecated-writable-strings -Wwrite-strings.
301 def GCCWriteStrings : DiagGroup<"write-strings" , [DeprecatedWritableStr]>;
303 def CharSubscript : DiagGroup<"char-subscripts">;
304 def LargeByValueCopy : DiagGroup<"large-by-value-copy">;
305 def DuplicateArgDecl : DiagGroup<"duplicate-method-arg">;
307 // Aggregation warning settings.
309 // -Widiomatic-parentheses contains warnings about 'idiomatic'
310 // missing parentheses; it is off by default. We do not include it
311 // in -Wparentheses because most users who use -Wparentheses explicitly
312 // do not want these warnings.
313 def ParenthesesOnEquality : DiagGroup<"parentheses-equality">;
314 def Parentheses : DiagGroup<"parentheses",
315 [LogicalOpParentheses,
316 BitwiseOpParentheses,
318 ParenthesesOnEquality,
321 // -Wconversion has its own warnings, but we split a few out for
323 // - some people want just 64-to-32 warnings
324 // - conversion warnings with constant sources are on by default
325 // - conversion warnings for literals are on by default
326 // - bool-to-pointer conversion warnings are on by default
327 // - __null-to-integer conversion warnings are on by default
328 def Conversion : DiagGroup<"conversion",
335 NonLiteralNullConversion, // (1-1)->pointer (etc)
336 NullConversion, // NULL->non-pointer
339 DiagCategory<"Value Conversion Issue">;
341 def Unused : DiagGroup<"unused",
342 [UnusedArgument, UnusedFunction, UnusedLabel,
343 // UnusedParameter, (matches GCC's behavior)
344 // UnusedMemberFunction, (clean-up llvm before enabling)
346 UnusedValue, UnusedVariable]>,
347 DiagCategory<"Unused Entity Issue">;
350 def FormatInvalidSpecifier : DiagGroup<"format-invalid-specifier">;
351 def FormatSecurity : DiagGroup<"format-security">;
352 def FormatNonStandard : DiagGroup<"format-non-iso">;
353 def FormatY2K : DiagGroup<"format-y2k">;
354 def Format : DiagGroup<"format",
355 [FormatExtraArgs, FormatZeroLength, NonNull,
356 FormatSecurity, FormatY2K, FormatInvalidSpecifier]>,
357 DiagCategory<"Format String Issue">;
358 def FormatNonLiteral : DiagGroup<"format-nonliteral", [FormatSecurity]>;
359 def Format2 : DiagGroup<"format=2",
360 [FormatNonLiteral, FormatSecurity, FormatY2K]>;
362 def TypeSafety : DiagGroup<"type-safety">;
364 def IntToPointerCast : DiagGroup<"int-to-pointer-cast">;
366 def Extra : DiagGroup<"extra", [
367 MissingFieldInitializers,
369 InitializerOverrides,
370 SemiBeforeMethodBody,
371 MissingMethodReturnType,
376 def Most : DiagGroup<"most", [
379 DeleteNonVirtualDtor,
396 ObjCMissingSuperCalls,
402 // Thread Safety warnings
403 def ThreadSafetyAttributes : DiagGroup<"thread-safety-attributes">;
404 def ThreadSafetyAnalysis : DiagGroup<"thread-safety-analysis">;
405 def ThreadSafetyPrecise : DiagGroup<"thread-safety-precise">;
406 def ThreadSafety : DiagGroup<"thread-safety",
407 [ThreadSafetyAttributes,
408 ThreadSafetyAnalysis,
409 ThreadSafetyPrecise]>;
411 // Note that putting warnings in -Wall will not disable them by default. If a
412 // warning should be active _only_ when -Wall is passed in, mark it as
413 // DefaultIgnore in addition to putting it here.
414 def : DiagGroup<"all", [Most, Parentheses, Switch]>;
416 // Warnings enabled by -pedantic. This is magically filled in by TableGen.
417 def Pedantic : DiagGroup<"pedantic">;
420 def : DiagGroup<"", [Extra]>; // -W = -Wextra
421 def : DiagGroup<"endif-labels", [ExtraTokens]>; // -Wendif-labels=-Wendif-tokens
422 def : DiagGroup<"comments", [Comment]>; // -Wcomments = -Wcomment
423 def : DiagGroup<"conversion-null",
424 [NullConversion]>; // -Wconversion-null = -Wnull-conversion
425 def : DiagGroup<"bool-conversions",
426 [BoolConversion]>; // -Wbool-conversions = -Wbool-conversion
427 def : DiagGroup<"int-conversions",
428 [IntConversion]>; // -Wint-conversions = -Wint-conversion
429 def : DiagGroup<"vector-conversions",
430 [VectorConversion]>; // -Wvector-conversions = -Wvector-conversion
432 // A warning group for warnings that we want to have on by default in clang,
433 // but which aren't on by default in GCC.
434 def NonGCC : DiagGroup<"non-gcc",
435 [SignCompare, Conversion, LiteralRange]>;
437 // A warning group for warnings about using C++11 features as extensions in
438 // earlier C++ versions.
439 def CXX11 : DiagGroup<"c++11-extensions", [CXX11ExtraSemi, CXX11LongLong]>;
441 def : DiagGroup<"c++0x-extensions", [CXX11]>;
442 def DelegatingCtorCycles :
443 DiagGroup<"delegating-ctor-cycles">;
445 // A warning group for warnings about using C11 features as extensions.
446 def C11 : DiagGroup<"c11-extensions">;
448 // A warning group for warnings about using C99 features as extensions.
449 def C99 : DiagGroup<"c99-extensions">;
451 // A warning group for warnings about GCC extensions.
452 def GNU : DiagGroup<"gnu", [GNUDesignator, VLA, ZeroLengthArray]>;
453 // A warning group for warnings about code that clang accepts but gcc doesn't.
454 def GccCompat : DiagGroup<"gcc-compat">;
456 // A warning group for warnings about Microsoft extensions.
457 def Microsoft : DiagGroup<"microsoft">;
459 def ObjCNonUnifiedException : DiagGroup<"objc-nonunified-exceptions">;
461 def ObjCProtocolMethodImpl : DiagGroup<"objc-protocol-method-implementation">;
463 // ObjC API warning groups.
464 def ObjCRedundantLiteralUse : DiagGroup<"objc-redundant-literal-use">;
465 def ObjCRedundantAPIUse : DiagGroup<"objc-redundant-api-use", [
466 ObjCRedundantLiteralUse
469 def ObjCCocoaAPI : DiagGroup<"objc-cocoa-api", [
473 def ObjCStringComparison : DiagGroup<"objc-string-compare">;
474 def ObjCLiteralComparison : DiagGroup<"objc-literal-compare", [
478 // Inline ASM warnings.
479 def ASMOperandWidths : DiagGroup<"asm-operand-widths">;
480 def ASM : DiagGroup<"asm", [