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