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