DiagnosticParseKinds.td revision 263508
1//==--- DiagnosticParseKinds.td - libparse diagnostics --------------------===//
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
10//===----------------------------------------------------------------------===//
11// Parser Diagnostics
12//===----------------------------------------------------------------------===//
13
14let Component = "Parse" in {
15
16def w_asm_qualifier_ignored : Warning<"ignored %0 qualifier on asm">,
17                              CatInlineAsm;
18def warn_file_asm_volatile : Warning<
19  "meaningless 'volatile' on asm outside function">, CatInlineAsm;
20
21let CategoryName = "Inline Assembly Issue" in {
22def err_asm_empty : Error<"__asm used with no assembly instructions">;
23def err_inline_ms_asm_parsing : Error<"%0">;
24def err_msasm_unsupported_arch : Error<
25  "Unsupported architecture '%0' for MS-style inline assembly">;
26def err_msasm_unable_to_create_target : Error<
27  "MS-style inline assembly is not available: %0">;
28}
29
30let CategoryName = "Parse Issue" in {
31
32def ext_empty_translation_unit : Extension<
33  "ISO C requires a translation unit to contain at least one declaration">,
34  InGroup<DiagGroup<"empty-translation-unit">>;
35def warn_cxx98_compat_top_level_semi : Warning<
36  "extra ';' outside of a function is incompatible with C++98">,
37  InGroup<CXX98CompatPedantic>, DefaultIgnore;
38def ext_extra_semi : Extension<
39  "extra ';' %select{"
40  "outside of a function|"
41  "inside a %1|"
42  "inside instance variable list|"
43  "after member function definition}0">,
44  InGroup<ExtraSemi>;
45def ext_extra_semi_cxx11 : Extension<
46  "extra ';' outside of a function is a C++11 extension">,
47  InGroup<CXX11ExtraSemi>;
48def warn_extra_semi_after_mem_fn_def : Warning<
49  "extra ';' after member function definition">,
50  InGroup<ExtraSemi>, DefaultIgnore;
51
52def ext_duplicate_declspec : ExtWarn<"duplicate '%0' declaration specifier">,
53  InGroup<DuplicateDeclSpecifier>;
54def warn_duplicate_declspec : Warning<"duplicate '%0' declaration specifier">,
55  InGroup<DuplicateDeclSpecifier>;
56def ext_plain_complex : ExtWarn<
57  "plain '_Complex' requires a type specifier; assuming '_Complex double'">;
58def ext_integer_complex : Extension<
59  "complex integer types are a GNU extension">, InGroup<GNUComplexInteger>;
60def ext_thread_before : Extension<"'__thread' before '%0'">;
61def ext_keyword_as_ident : ExtWarn<
62  "keyword '%0' will be treated as an identifier %select{here|for the remainder of the translation unit}1">,
63  InGroup<KeywordCompat>;
64
65def error_empty_enum : Error<"use of empty enum">;
66def err_invalid_sign_spec : Error<"'%0' cannot be signed or unsigned">;
67def err_invalid_short_spec : Error<"'short %0' is invalid">;
68def err_invalid_long_spec : Error<"'long %0' is invalid">;
69def err_invalid_longlong_spec : Error<"'long long %0' is invalid">;
70def err_invalid_complex_spec : Error<"'_Complex %0' is invalid">;
71def err_friend_storage_spec : Error<"'%0' is invalid in friend declarations">;
72
73def ext_ident_list_in_param : Extension<
74  "type-less parameter names in function declaration">;
75def ext_c99_variable_decl_in_for_loop : Extension<
76  "variable declaration in for loop is a C99-specific feature">, InGroup<C99>;
77def ext_c99_compound_literal : Extension<
78  "compound literals are a C99-specific feature">, InGroup<C99>;
79def ext_enumerator_list_comma_c : Extension<
80  "commas at the end of enumerator lists are a C99-specific "
81  "feature">, InGroup<C99>;
82def ext_enumerator_list_comma_cxx : Extension<
83  "commas at the end of enumerator lists are a C++11 extension">,
84  InGroup<CXX11>;
85def warn_cxx98_compat_enumerator_list_comma : Warning<
86  "commas at the end of enumerator lists are incompatible with C++98">,
87  InGroup<CXX98CompatPedantic>, DefaultIgnore;
88def err_enumerator_list_missing_comma : Error<
89  "missing ',' between enumerators">;
90def err_enumerator_unnamed_no_def : Error<
91  "unnamed enumeration must be a definition">;
92def ext_cxx11_enum_fixed_underlying_type : Extension<
93  "enumeration types with a fixed underlying type are a C++11 extension">, 
94  InGroup<CXX11>;
95def ext_c_enum_fixed_underlying_type : Extension<
96  "enumeration types with a fixed underlying type are a Microsoft extension">,
97  InGroup<Microsoft>;
98def warn_cxx98_compat_enum_fixed_underlying_type : Warning<
99  "enumeration types with a fixed underlying type are incompatible with C++98">,
100  InGroup<CXX98Compat>, DefaultIgnore;
101def warn_cxx98_compat_alignof : Warning<
102  "alignof expressions are incompatible with C++98">,
103  InGroup<CXX98Compat>, DefaultIgnore;
104def ext_alignof_expr : ExtWarn<
105  "%0 applied to an expression is a GNU extension">, InGroup<GNUAlignofExpression>;
106
107def warn_microsoft_dependent_exists : Warning<
108  "dependent %select{__if_not_exists|__if_exists}0 declarations are ignored">, 
109  InGroup<DiagGroup<"microsoft-exists">>;
110
111def ext_c11_generic_selection : Extension<
112  "generic selections are a C11-specific feature">, InGroup<C11>;
113def err_duplicate_default_assoc : Error<
114  "duplicate default generic association">;
115def note_previous_default_assoc : Note<
116  "previous default generic association is here">;
117
118def ext_c11_alignment : Extension<
119  "%0 is a C11-specific feature">, InGroup<C11>;
120
121def ext_c11_noreturn : Extension<
122  "_Noreturn functions are a C11-specific feature">, InGroup<C11>;
123
124def ext_gnu_indirect_goto : Extension<
125  "use of GNU indirect-goto extension">, InGroup<GNULabelsAsValue>;
126def ext_gnu_address_of_label : Extension<
127  "use of GNU address-of-label extension">, InGroup<GNULabelsAsValue>;
128def ext_gnu_statement_expr : Extension<
129  "use of GNU statement expression extension">, InGroup<GNUStatementExpression>;
130def ext_gnu_conditional_expr : Extension<
131  "use of GNU ?: conditional expression extension, omitting middle operand">, InGroup<GNUConditionalOmittedOperand>;
132def ext_gnu_empty_initializer : Extension<
133  "use of GNU empty initializer extension">, InGroup<GNUEmptyInitializer>;
134def ext_gnu_array_range : Extension<"use of GNU array range extension">, 
135  InGroup<GNUDesignator>;
136def ext_gnu_missing_equal_designator : ExtWarn<
137  "use of GNU 'missing =' extension in designator">, 
138  InGroup<GNUDesignator>;
139def err_expected_equal_designator : Error<"expected '=' or another designator">;
140def ext_gnu_old_style_field_designator : ExtWarn<
141  "use of GNU old-style field designator extension">, 
142  InGroup<GNUDesignator>;
143def ext_gnu_case_range : Extension<"use of GNU case range extension">,
144  InGroup<GNUCaseRange>;
145
146// Generic errors.
147def err_expected_expression : Error<"expected expression">;
148def err_expected_type : Error<"expected a type">;
149def err_expected_external_declaration : Error<"expected external declaration">;
150def err_extraneous_closing_brace : Error<"extraneous closing brace ('}')">;
151def err_expected_ident : Error<"expected identifier">;
152def err_expected_ident_lparen : Error<"expected identifier or '('">;
153def err_expected_ident_lbrace : Error<"expected identifier or '{'">;
154def err_expected_lbrace : Error<"expected '{'">;
155def err_expected_lparen : Error<"expected '('">;
156def err_expected_lparen_or_lbrace : Error<"expected '(' or '{'">;
157def err_expected_rparen : Error<"expected ')'">;
158def err_expected_lsquare : Error<"expected '['">;
159def err_expected_rsquare : Error<"expected ']'">;
160def err_expected_rbrace : Error<"expected '}'">;
161def err_expected_greater : Error<"expected '>'">;
162def err_expected_ggg : Error<"expected '>>>'">;
163def err_expected_semi_declaration : Error<
164  "expected ';' at end of declaration">;
165def err_expected_semi_decl_list : Error<
166  "expected ';' at end of declaration list">;
167def ext_expected_semi_decl_list : ExtWarn<
168  "expected ';' at end of declaration list">;
169def err_expected_member_name_or_semi : Error<
170  "expected member name or ';' after declaration specifiers">;
171def err_function_declared_typedef : Error<
172  "function definition declared 'typedef'">;
173def err_at_defs_cxx : Error<"@defs is not supported in Objective-C++">;
174def err_at_in_class : Error<"unexpected '@' in member specification">;
175
176def err_expected_fn_body : Error<
177  "expected function body after function declarator">;
178def warn_attribute_on_function_definition : Warning<
179  "GCC does not allow %0 attribute in this position on a function definition">, 
180  InGroup<GccCompat>;
181def warn_attribute_no_decl : Warning<
182  "attribute %0 ignored, because it is not attached to a declaration">, 
183  InGroup<IgnoredAttributes>;
184def err_expected_method_body : Error<"expected method body">;
185def err_invalid_token_after_toplevel_declarator : Error<
186  "expected ';' after top level declarator">;
187def err_invalid_token_after_declarator_suggest_equal : Error<
188  "invalid '%0' at end of declaration; did you mean '='?">;
189def err_expected_statement : Error<"expected statement">;
190def err_expected_lparen_after : Error<"expected '(' after '%0'">;
191def err_expected_lparen_after_id : Error<"expected '(' after %0">;
192def err_expected_less_after : Error<"expected '<' after '%0'">;
193def err_expected_equal_after : Error<"expected '=' after %0">;
194def err_expected_comma : Error<"expected ','">;
195def err_expected_lbrace_in_compound_literal : Error<
196  "expected '{' in compound literal">;
197def err_expected_while : Error<"expected 'while' in do/while loop">;
198
199def err_expected_semi_after : Error<"expected ';' after %0">;
200def err_expected_semi_after_stmt : Error<"expected ';' after %0 statement">;
201def err_expected_semi_after_expr : Error<"expected ';' after expression">;
202def err_extraneous_token_before_semi : Error<"extraneous '%0' before ';'">;
203
204def err_expected_semi_after_method_proto : Error<
205  "expected ';' after method prototype">;
206def err_expected_semi_after_namespace_name : Error<
207  "expected ';' after namespace name">;
208def err_unexpected_namespace_attributes_alias : Error<
209  "attributes can not be specified on namespace alias">;
210def err_inline_namespace_alias : Error<"namespace alias cannot be inline">;
211def err_namespace_nonnamespace_scope : Error<
212  "namespaces can only be defined in global or namespace scope">;
213def err_nested_namespaces_with_double_colon : Error<
214  "nested namespace definition must define each namespace separately">;
215def err_expected_semi_after_attribute_list : Error<
216  "expected ';' after attribute list">;
217def err_expected_semi_after_static_assert : Error<
218  "expected ';' after static_assert">;
219def err_expected_semi_for : Error<"expected ';' in 'for' statement specifier">;
220def err_expected_colon_after : Error<"expected ':' after %0">;
221def warn_missing_selector_name : Warning<
222  "%0 used as the name of the previous parameter rather than as part "
223  "of the selector">,
224  InGroup<DiagGroup<"missing-selector-name">>;
225def note_missing_selector_name : Note<
226  "introduce a parameter name to make %0 part of the selector">;
227def note_force_empty_selector_name : Note<
228  "or insert whitespace before ':' to use %0 as parameter name "
229  "and have an empty entry in the selector">;
230def err_label_end_of_compound_statement : Error<
231  "label at end of compound statement: expected statement">;
232def err_address_of_label_outside_fn : Error<
233  "use of address-of-label extension outside of a function body">;
234def err_asm_operand_wide_string_literal : Error<
235  "cannot use %select{unicode|wide}0 string literal in 'asm'">;
236def err_expected_selector_for_method : Error<
237  "expected selector for Objective-C method">;
238def err_expected_property_name : Error<"expected property name">;
239
240def err_unexpected_at : Error<"unexpected '@' in program">;
241
242def err_invalid_reference_qualifier_application : Error<
243  "'%0' qualifier may not be applied to a reference">;
244def err_illegal_decl_reference_to_reference : Error<
245  "%0 declared as a reference to a reference">;
246def ext_rvalue_reference : ExtWarn<
247  "rvalue references are a C++11 extension">, InGroup<CXX11>;
248def warn_cxx98_compat_rvalue_reference : Warning<
249  "rvalue references are incompatible with C++98">,
250  InGroup<CXX98Compat>, DefaultIgnore;
251def ext_ref_qualifier : ExtWarn<
252  "reference qualifiers on functions are a C++11 extension">, InGroup<CXX11>;
253def warn_cxx98_compat_ref_qualifier : Warning<
254  "reference qualifiers on functions are incompatible with C++98">,
255  InGroup<CXX98Compat>, DefaultIgnore;
256def ext_inline_namespace : ExtWarn<
257  "inline namespaces are a C++11 feature">, InGroup<CXX11>;
258def warn_cxx98_compat_inline_namespace : Warning<
259  "inline namespaces are incompatible with C++98">,
260  InGroup<CXX98Compat>, DefaultIgnore;
261def ext_generalized_initializer_lists : ExtWarn<
262  "generalized initializer lists are a C++11 extension">,
263  InGroup<CXX11>;
264def warn_cxx98_compat_generalized_initializer_lists : Warning<
265  "generalized initializer lists are incompatible with C++98">,
266  InGroup<CXX98Compat>, DefaultIgnore;
267def err_init_list_bin_op : Error<"initializer list cannot be used on the "
268  "%select{left|right}0 hand side of operator '%1'">;
269def warn_cxx98_compat_trailing_return_type : Warning<
270  "trailing return types are incompatible with C++98">,
271  InGroup<CXX98Compat>, DefaultIgnore;
272def ext_auto_type_specifier : ExtWarn<
273  "'auto' type specifier is a C++11 extension">, InGroup<CXX11>;
274def warn_auto_storage_class : Warning<
275  "'auto' storage class specifier is redundant and incompatible with C++11">,
276  InGroup<CXX11Compat>, DefaultIgnore;
277def ext_auto_storage_class : ExtWarn<
278  "'auto' storage class specifier is not permitted in C++11, and will not "
279  "be supported in future releases">, InGroup<DiagGroup<"auto-storage-class">>;
280def ext_decltype_auto_type_specifier : ExtWarn<
281  "'decltype(auto)' type specifier is a C++1y extension">, InGroup<CXX1y>;
282def warn_cxx11_compat_decltype_auto_type_specifier : Warning<
283  "'decltype(auto)' type specifier is incompatible with C++ standards before "
284  "C++1y">, InGroup<CXXPre1yCompat>, DefaultIgnore;
285def ext_for_range : ExtWarn<
286  "range-based for loop is a C++11 extension">, InGroup<CXX11>;
287def warn_cxx98_compat_for_range : Warning<
288  "range-based for loop is incompatible with C++98">,
289  InGroup<CXX98Compat>, DefaultIgnore;
290def err_for_range_expected_decl : Error<
291  "for range declaration must declare a variable">;
292def err_argument_required_after_attribute : Error<
293  "argument required after attribute">;
294def err_missing_param : Error<"expected parameter declarator">;
295def err_missing_comma_before_ellipsis : Error<
296  "C requires a comma prior to the ellipsis in a variadic function type">;
297def err_unexpected_typedef_ident : Error<
298  "unexpected type name %0: expected identifier">;
299def warn_cxx98_compat_decltype : Warning<
300  "'decltype' type specifier is incompatible with C++98">,
301  InGroup<CXX98Compat>, DefaultIgnore;
302def err_unexpected_scope_on_base_decltype : Error<
303  "unexpected namespace scope prior to decltype">;
304def err_expected_class_name : Error<"expected class name">;
305def err_expected_class_name_not_template : 
306  Error<"'typename' is redundant; base classes are implicitly types">;
307def err_unspecified_vla_size_with_static : Error<
308  "'static' may not be used with an unspecified variable length array size">;
309def warn_deprecated_register : Warning<
310  "'register' storage class specifier is deprecated">,
311  InGroup<DeprecatedRegister>;
312def err_expected_parentheses_around_typename : Error<
313  "expected parentheses around type name in %0 expression">;
314
315def err_expected_case_before_expression: Error<
316  "expected 'case' keyword before expression">;
317
318// Declarations.
319def err_typename_requires_specqual : Error<
320  "type name requires a specifier or qualifier">;
321def err_typename_invalid_storageclass : Error<
322  "type name does not allow storage class to be specified">;
323def err_typename_invalid_functionspec : Error<
324  "type name does not allow function specifier to be specified">;
325def err_typename_invalid_constexpr : Error<
326  "type name does not allow constexpr specifier to be specified">;
327def err_typename_identifiers_only : Error<
328  "typename is allowed for identifiers only">;
329
330def err_invalid_decl_spec_combination : Error<
331  "cannot combine with previous '%0' declaration specifier">;
332def err_invalid_vector_decl_spec_combination : Error<
333  "cannot combine with previous '%0' declaration specifier. "
334  "'__vector' must be first">;
335def err_invalid_pixel_decl_spec_combination : Error<
336  "'__pixel' must be preceded by '__vector'.  "
337  "'%0' declaration specifier not allowed here">;
338def err_invalid_vector_decl_spec : Error<
339  "cannot use '%0' with '__vector'">;
340def err_invalid_vector_bool_decl_spec : Error<
341  "cannot use '%0' with '__vector bool'">;
342def warn_vector_long_decl_spec_combination : Warning<
343  "Use of 'long' with '__vector' is deprecated">, InGroup<Deprecated>;
344def err_friend_invalid_in_context : Error<
345  "'friend' used outside of class">;
346def err_unknown_typename : Error<
347  "unknown type name %0">;
348def err_use_of_tag_name_without_tag : Error<
349  "must use '%1' tag to refer to type %0%select{| in this scope}2">;
350def err_templated_using_directive : Error<
351  "cannot template a using directive">;
352def err_templated_using_declaration : Error<
353  "cannot template a using declaration">;
354def err_unexected_colon_in_nested_name_spec : Error<
355  "unexpected ':' in nested name specifier; did you mean '::'?">;
356def err_bool_redeclaration : Error<
357  "redeclaration of C++ built-in type 'bool'">;
358def ext_c11_static_assert : Extension<
359  "_Static_assert is a C11-specific feature">, InGroup<C11>;
360def warn_cxx98_compat_static_assert : Warning<
361  "static_assert declarations are incompatible with C++98">,
362  InGroup<CXX98Compat>, DefaultIgnore;
363def err_paren_after_colon_colon : Error<
364  "unexpected parenthesis after '::'">;
365def err_function_definition_not_allowed : Error<
366  "function definition is not allowed here">;
367
368/// Objective-C parser diagnostics
369def err_expected_minus_or_plus : Error<
370  "method type specifier must start with '-' or '+'">;
371def err_objc_no_attributes_on_category : Error<
372  "attributes may not be specified on a category">;
373def err_objc_missing_end : Error<"missing '@end'">;
374def note_objc_container_start : Note<
375  "%select{class|protocol|category|class extension|implementation"
376  "|category implementation}0 started here">;
377def warn_objc_protocol_qualifier_missing_id : Warning<
378  "protocol has no object type specified; defaults to qualified 'id'">;
379def err_objc_unknown_at : Error<"expected an Objective-C directive after '@'">;
380def err_illegal_super_cast : Error<
381  "cannot cast 'super' (it isn't an expression)">;
382def err_nsnumber_nonliteral_unary : Error<
383  "@%0 must be followed by a number to form an NSNumber object">;
384def warn_cstyle_param : Warning<
385  "use of C-style parameters in Objective-C method declarations"
386  " is deprecated">, InGroup<DeprecatedDeclarations>;
387
388let CategoryName = "ARC Parse Issue" in {
389def err_arc_bridge_retain : Error<
390  "unknown cast annotation __bridge_retain; did you mean __bridge_retained?">;
391// To be default mapped to an error later.
392def warn_arc_bridge_cast_nonarc : Warning<
393  "'%0' casts have no effect when not using ARC">,
394  InGroup<DiagGroup<"arc-bridge-casts-disallowed-in-nonarc">>;
395}
396  
397def err_objc_illegal_visibility_spec : Error<
398  "illegal visibility specification">;
399def err_objc_illegal_interface_qual : Error<"illegal interface qualifier">;
400def err_objc_expected_equal_for_getter : Error<
401  "expected '=' for Objective-C getter">;
402def err_objc_expected_equal_for_setter : Error<
403  "expected '=' for Objective-C setter">;
404def err_objc_expected_selector_for_getter_setter : Error<
405  "expected selector for Objective-C %select{setter|getter}0">;
406def err_objc_property_requires_field_name : Error<
407  "property requires fields to be named">;
408def err_objc_property_bitfield : Error<"property name cannot be a bitfield">;
409def err_objc_expected_property_attr : Error<"unknown property attribute %0">;
410def err_objc_properties_require_objc2 : Error<
411  "properties are an Objective-C 2 feature">;
412def err_objc_unexpected_attr : Error<
413  "prefix attribute must be followed by an interface or protocol">;
414def err_objc_postfix_attribute : Error <
415  "postfix attributes are not allowed on Objective-C directives">;
416def err_objc_postfix_attribute_hint : Error <
417  "postfix attributes are not allowed on Objective-C directives, place"
418  " them in front of '%select{@interface|@protocol}0'">;
419def err_objc_directive_only_in_protocol : Error<
420  "directive may only be specified in protocols only">;
421def err_missing_catch_finally : Error<
422  "@try statement without a @catch and @finally clause">;
423def err_objc_concat_string : Error<"unexpected token after Objective-C string">;
424def err_expected_objc_container : Error<
425  "'@end' must appear in an Objective-C context">;
426def err_unexpected_protocol_qualifier : Error<
427  "@implementation declaration can not be protocol qualified">;
428def err_objc_unexpected_atend : Error<
429  "'@end' appears where closing brace '}' is expected">;
430def error_property_ivar_decl : Error<
431  "property synthesize requires specification of an ivar">;
432def err_synthesized_property_name : Error<
433  "expected a property name in @synthesize">;
434def warn_semicolon_before_method_body : Warning<
435  "semicolon before method body is ignored">,
436  InGroup<DiagGroup<"semicolon-before-method-body">>, DefaultIgnore;
437def note_extra_comma_message_arg : Note<
438  "comma separating Objective-C messaging arguments">;
439
440def err_expected_field_designator : Error<
441  "expected a field designator, such as '.field = 4'">;
442
443def err_declaration_does_not_declare_param : Error<
444  "declaration does not declare a parameter">;
445def err_no_matching_param : Error<"parameter named %0 is missing">;
446
447/// C++ parser diagnostics
448def err_invalid_operator_on_type : Error<
449  "cannot use %select{dot|arrow}0 operator on a type">;
450def err_expected_unqualified_id : Error<
451  "expected %select{identifier|unqualified-id}0">;
452def err_unexpected_unqualified_id : Error<"type-id cannot have a name">;
453def err_func_def_no_params : Error<
454  "function definition does not declare parameters">;
455def err_expected_lparen_after_type : Error<
456  "expected '(' for function-style cast or type construction">;
457def err_expected_init_in_condition : Error<
458  "variable declaration in condition must have an initializer">;
459def err_expected_init_in_condition_lparen : Error<
460  "variable declaration in condition cannot have a parenthesized initializer">;
461def err_extraneous_rparen_in_condition : Error<
462  "extraneous ')' after condition, expected a statement">;
463def warn_dangling_else : Warning<
464  "add explicit braces to avoid dangling else">,
465  InGroup<DanglingElse>;
466def err_expected_member_or_base_name : Error<
467  "expected class member or base class name">;
468def err_expected_lbrace_after_base_specifiers : Error<
469  "expected '{' after base class list">;
470def err_missing_end_of_definition : Error<
471  "missing '}' at end of definition of %q0">;
472def note_missing_end_of_definition_before : Note<
473  "still within definition of %q0 here">;
474def ext_ellipsis_exception_spec : Extension<
475  "exception specification of '...' is a Microsoft extension">,
476  InGroup<Microsoft>;
477def err_dynamic_and_noexcept_specification : Error<
478  "cannot have both throw() and noexcept() clause on the same function">;
479def warn_cxx98_compat_noexcept_decl : Warning<
480  "noexcept specifications are incompatible with C++98">,
481  InGroup<CXX98Compat>, DefaultIgnore;
482def err_expected_catch : Error<"expected catch">;
483def err_expected_lbrace_or_comma : Error<"expected '{' or ','">;
484def err_expected_rbrace_or_comma : Error<"expected '}' or ','">;
485def err_expected_rsquare_or_comma : Error<"expected ']' or ','">;
486def err_using_namespace_in_class : Error<
487  "'using namespace' is not allowed in classes">;
488def err_constructor_bad_name : Error<
489  "missing return type for function %0; did you mean the constructor name %1?">;
490def err_destructor_tilde_identifier : Error<
491  "expected a class name after '~' to name a destructor">;
492def err_destructor_template_id : Error<
493  "destructor name %0 does not refer to a template">;
494def err_default_arg_unparsed : Error<
495  "unexpected end of default argument expression">;
496def err_bracket_depth_exceeded : Error<
497  "bracket nesting level exceeded maximum of %0">, DefaultFatal;
498def note_bracket_depth : Note<
499  "use -fbracket-depth=N to increase maximum nesting level">;
500def err_misplaced_ellipsis_in_declaration : Error<
501  "'...' must %select{immediately precede declared identifier|"
502  "be innermost component of anonymous pack declaration}0">;
503def ext_abstract_pack_declarator_parens : ExtWarn<
504  "ISO C++11 requires a parenthesized pack declaration to have a name">,
505  InGroup<DiagGroup<"anonymous-pack-parens">>;
506def err_function_is_not_record : Error<
507  "unexpected '%select{.|->}0' in function call; perhaps remove the "
508  "'%select{.|->}0'?">;
509
510// C++ derived classes
511def err_dup_virtual : Error<"duplicate 'virtual' in base specifier">;
512
513// C++ operator overloading
514def err_literal_operator_string_prefix : Error<
515  "string literal after 'operator' cannot have an encoding prefix">;
516def err_literal_operator_string_not_empty : Error<
517  "string literal after 'operator' must be '\"\"'">;
518def warn_cxx98_compat_literal_operator : Warning<
519  "literal operators are incompatible with C++98">,
520  InGroup<CXX98Compat>, DefaultIgnore;
521
522// Classes.
523def err_anon_type_definition : Error<
524  "declaration of anonymous %0 must be a definition">;
525def err_default_delete_in_multiple_declaration : Error<
526  "'= %select{default|delete}0' is a function definition and must occur in a "
527  "standalone declaration">;
528
529def warn_cxx98_compat_noexcept_expr : Warning<
530  "noexcept expressions are incompatible with C++98">,
531  InGroup<CXX98Compat>, DefaultIgnore;
532def warn_cxx98_compat_nullptr : Warning<
533  "'nullptr' is incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
534
535def warn_cxx98_compat_alignas : Warning<"'alignas' is incompatible with C++98">,
536  InGroup<CXX98Compat>, DefaultIgnore;
537def warn_cxx98_compat_attribute : Warning<
538  "attributes are incompatible with C++98">,
539  InGroup<CXX98Compat>, DefaultIgnore;
540def err_cxx11_attribute_forbids_arguments : Error<
541  "attribute '%0' cannot have an argument list">;
542def err_cxx11_attribute_forbids_ellipsis : Error<
543  "attribute '%0' cannot be used as an attribute pack">;
544def err_cxx11_attribute_repeated : Error<
545  "attribute %0 cannot appear multiple times in an attribute specifier">;
546def err_attributes_not_allowed : Error<"an attribute list cannot appear here">;
547def err_l_square_l_square_not_attribute : Error<
548  "C++11 only allows consecutive left square brackets when "
549  "introducing an attribute">;
550def err_ms_declspec_type : Error<
551  "__declspec attributes must be an identifier or string literal">;
552def warn_ms_declspec_unknown : Warning<
553  "unknown __declspec attribute %0 ignored">, InGroup<UnknownAttributes>;
554def err_ms_property_no_getter_or_putter : Error<
555  "property does not specify a getter or a putter">;
556def err_ms_property_unknown_accessor : Error<
557  "expected 'get' or 'put' in property declaration">;
558def err_ms_property_has_set_accessor : Error<
559  "putter for property must be specified as 'put', not 'set'">;
560def err_ms_property_missing_accessor_kind : Error<
561  "missing 'get=' or 'put='">;
562def err_ms_property_expected_equal : Error<
563  "expected '=' after '%0'">;
564def err_ms_property_duplicate_accessor : Error<
565  "property declaration specifies '%0' accessor twice">;
566def err_ms_property_expected_accessor_name : Error<
567  "expected name of accessor method">;
568def err_ms_property_expected_comma_or_rparen : Error<
569  "expected ',' or ')' at end of property accessor list">;
570
571/// C++ Templates
572def err_expected_template : Error<"expected template">;
573def err_unknown_template_name : Error<
574  "unknown template name %0">;
575def err_expected_comma_greater : Error<
576  "expected ',' or '>' in template-parameter-list">;
577def err_class_on_template_template_param : Error<
578  "template template parameter requires 'class' after the parameter list">;
579def err_template_spec_syntax_non_template : Error<
580  "identifier followed by '<' indicates a class template specialization but "
581  "%0 %select{does not refer to a template|refers to a function "
582  "template|<unused>|refers to a template template parameter}1">;
583def err_id_after_template_in_nested_name_spec : Error<
584  "expected template name after 'template' keyword in nested name specifier">;
585def err_two_right_angle_brackets_need_space : Error<
586  "a space is required between consecutive right angle brackets (use '> >')">;
587def err_right_angle_bracket_equal_needs_space : Error<
588  "a space is required between a right angle bracket and an equals sign "
589  "(use '> =')">;
590def warn_cxx11_right_shift_in_template_arg : Warning<
591  "use of right-shift operator ('>>') in template argument will require "
592  "parentheses in C++11">, InGroup<CXX11Compat>;
593def warn_cxx98_compat_two_right_angle_brackets : Warning<
594  "consecutive right angle brackets are incompatible with C++98 (use '> >')">,
595  InGroup<CXX98Compat>, DefaultIgnore;
596def err_multiple_template_declarators : Error<
597    "%select{|a template declaration|an explicit template specialization|"
598    "an explicit template instantiation}0 can "
599    "only %select{|declare|declare|instantiate}0 a single entity">;
600def err_explicit_instantiation_with_definition : Error<
601    "explicit template instantiation cannot have a definition; if this "
602    "definition is meant to be an explicit specialization, add '<>' after the "
603    "'template' keyword">;
604def err_template_defn_explicit_instantiation : Error<
605  "%select{function|class|variable}0 cannot be defined in an explicit instantiation; if this "
606  "declaration is meant to be a %select{function|class|variable}0 definition, remove the 'template' keyword">;
607def err_friend_explicit_instantiation : Error<
608  "friend cannot be declared in an explicit instantiation; if this "
609  "declaration is meant to be a friend declaration, remove the 'template' keyword">;
610def err_explicit_instantiation_enum : Error<
611    "enumerations cannot be explicitly instantiated">;
612def err_expected_template_parameter : Error<"expected template parameter">;
613
614def err_missing_dependent_template_keyword : Error<
615  "use 'template' keyword to treat '%0' as a dependent template name">;
616def warn_missing_dependent_template_keyword : ExtWarn<
617  "use 'template' keyword to treat '%0' as a dependent template name">;
618
619def ext_extern_template : Extension<
620  "extern templates are a C++11 extension">, InGroup<CXX11>;
621def warn_cxx98_compat_extern_template : Warning<
622  "extern templates are incompatible with C++98">,
623  InGroup<CXX98CompatPedantic>, DefaultIgnore;
624def warn_static_inline_explicit_inst_ignored : Warning<
625  "ignoring '%select{static|inline}0' keyword on explicit template "
626  "instantiation">, InGroup<DiagGroup<"static-inline-explicit-instantiation">>;
627  
628// Constructor template diagnostics.
629def err_out_of_line_constructor_template_id : Error<
630  "out-of-line constructor for %0 cannot have template arguments">;
631def err_out_of_line_template_id_names_constructor : Error<
632  "qualified reference to %0 is a constructor name rather than a "
633  "template name wherever a constructor can be declared">;
634def err_out_of_line_type_names_constructor : Error<
635  "qualified reference to %0 is a constructor name rather than a "
636  "type wherever a constructor can be declared">;
637
638def err_expected_qualified_after_typename : Error<
639  "expected a qualified name after 'typename'">;
640def warn_expected_qualified_after_typename : ExtWarn<
641  "expected a qualified name after 'typename'">;
642def err_expected_semi_after_tagdecl : Error<
643  "expected ';' after %0">;
644
645def err_typename_refers_to_non_type_template : Error<
646  "typename specifier refers to a non-template">;
647def err_expected_type_name_after_typename : Error<
648  "expected an identifier or template-id after '::'">;
649def err_explicit_spec_non_template : Error<
650  "explicit %select{specialization|instantiation}0 of non-template "
651  "%select{class|struct|union|interface}1 %2">;
652  
653def err_default_template_template_parameter_not_template : Error<
654  "default template argument for a template template parameter must be a class "
655  "template">;
656  
657def err_ctor_init_missing_comma : Error<
658  "missing ',' between base or member initializers">;
659
660// C++ declarations
661def err_friend_decl_defines_type : Error<
662  "cannot define a type in a friend declaration">;
663def err_missing_whitespace_digraph : Error<
664  "found '<::' after a "
665  "%select{template name|const_cast|dynamic_cast|reinterpret_cast|static_cast}0"
666  " which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?">;
667
668def ext_deleted_function : ExtWarn<
669  "deleted function definitions are a C++11 extension">, InGroup<CXX11>;
670def warn_cxx98_compat_deleted_function : Warning<
671  "deleted function definitions are incompatible with C++98">,
672  InGroup<CXX98Compat>, DefaultIgnore;
673def ext_defaulted_function : ExtWarn<
674  "defaulted function definitions are a C++11 extension">, InGroup<CXX11>;
675def warn_cxx98_compat_defaulted_function : Warning<
676  "defaulted function definitions are incompatible with C++98">,
677  InGroup<CXX98Compat>, DefaultIgnore;
678
679// C++11 in-class member initialization
680def ext_nonstatic_member_init : ExtWarn<
681  "in-class initialization of non-static data member is a C++11 extension">,
682  InGroup<CXX11>;
683def warn_cxx98_compat_nonstatic_member_init : Warning<
684  "in-class initialization of non-static data members is incompatible with C++98">,
685  InGroup<CXX98Compat>, DefaultIgnore;
686def err_bitfield_member_init: Error<
687  "bitfield member cannot have an in-class initializer">;
688def err_incomplete_array_member_init: Error<
689  "array bound cannot be deduced from an in-class initializer">;
690
691// C++11 alias-declaration
692def ext_alias_declaration : ExtWarn<
693  "alias declarations are a C++11 extension">, InGroup<CXX11>;
694def warn_cxx98_compat_alias_declaration : Warning<
695  "alias declarations are incompatible with C++98">,
696  InGroup<CXX98Compat>, DefaultIgnore;
697def err_alias_declaration_not_identifier : Error<
698  "name defined in alias declaration must be an identifier">;
699def err_alias_declaration_specialization : Error<
700  "%select{partial specialization|explicit specialization|explicit instantiation}0 of alias templates is not permitted">;
701    
702// C++11 override control
703def ext_override_control_keyword : ExtWarn<
704  "'%0' keyword is a C++11 extension">, InGroup<CXX11>;
705def warn_cxx98_compat_override_control_keyword : Warning<
706  "'%0' keyword is incompatible with C++98">,
707  InGroup<CXX98Compat>, DefaultIgnore;
708def err_override_control_interface : Error<
709  "'%0' keyword not permitted with interface types">;
710def ext_ms_sealed_keyword : ExtWarn<
711  "'sealed' keyword is a Microsoft extension">,
712  InGroup<Microsoft>;
713
714def err_access_specifier_interface : Error<
715  "interface types cannot specify '%select{private|protected}0' access">;
716
717def err_duplicate_virt_specifier : Error<
718  "class member already marked '%0'">;
719
720def err_scoped_enum_missing_identifier : Error<
721  "scoped enumeration requires a name">;
722def ext_scoped_enum : ExtWarn<
723  "scoped enumerations are a C++11 extension">, InGroup<CXX11>;
724def warn_cxx98_compat_scoped_enum : Warning<
725  "scoped enumerations are incompatible with C++98">,
726  InGroup<CXX98Compat>, DefaultIgnore;
727
728def err_expected_parameter_pack : Error<
729  "expected the name of a parameter pack">;
730def err_paren_sizeof_parameter_pack : Error<
731  "missing parentheses around the size of parameter pack %0">;
732def err_sizeof_parameter_pack : Error<
733  "expected parenthesized parameter pack name in 'sizeof...' expression">;
734
735// C++11 lambda expressions
736def err_expected_comma_or_rsquare : Error<
737  "expected ',' or ']' in lambda capture list">;
738def err_this_captured_by_reference : Error<
739  "'this' cannot be captured by reference">;
740def err_expected_capture : Error<
741  "expected variable name or 'this' in lambda capture list">;
742def err_expected_lambda_body : Error<"expected body of lambda expression">;
743def warn_cxx98_compat_lambda : Warning<
744  "lambda expressions are incompatible with C++98">,
745  InGroup<CXX98Compat>, DefaultIgnore;
746def err_lambda_missing_parens : Error<
747  "lambda requires '()' before %select{'mutable'|return type}0">;
748
749// Availability attribute
750def err_expected_version : Error<
751  "expected a version of the form 'major[.minor[.subminor]]'">;
752def err_zero_version : Error<
753  "version number must have non-zero major, minor, or sub-minor version">;
754def err_availability_expected_platform : Error<
755  "expected a platform name, e.g., 'macosx'">;
756def err_availability_expected_change : Error<
757  "expected 'introduced', 'deprecated', or 'obsoleted'">;
758def err_availability_unknown_change : Error<
759  "%0 is not an availability stage; use 'introduced', 'deprecated', or "
760  "'obsoleted'">;
761def err_availability_redundant : Error<
762  "redundant %0 availability change; only the last specified change will "
763  "be used">;
764def warn_availability_and_unavailable : Warning<
765  "'unavailable' availability overrides all other availability information">,
766  InGroup<Availability>;
767
768// Type safety attributes
769def err_type_safety_unknown_flag : Error<
770  "invalid comparison flag %0; use 'layout_compatible' or 'must_be_null'">;
771
772// Language specific pragmas
773// - Generic warnings
774def warn_pragma_expected_lparen : Warning<
775  "missing '(' after '#pragma %0' - ignoring">;
776def warn_pragma_expected_rparen : Warning<
777  "missing ')' after '#pragma %0' - ignoring">;
778def warn_pragma_expected_identifier : Warning<
779  "expected identifier in '#pragma %0' - ignored">;  
780def warn_pragma_ms_struct : Warning<
781  "incorrect use of '#pragma ms_struct on|off' - ignored">;  
782def warn_pragma_extra_tokens_at_eol : Warning<
783  "extra tokens at end of '#pragma %0' - ignored">; 
784// - #pragma options
785def warn_pragma_options_expected_align : Warning<
786  "expected 'align' following '#pragma options' - ignored">;
787def warn_pragma_align_expected_equal : Warning<
788  "expected '=' following '#pragma %select{align|options align}0' - ignored">;
789def warn_pragma_align_invalid_option : Warning<
790  "invalid alignment option in '#pragma %select{align|options align}0' - ignored">;
791// - #pragma pack
792def warn_pragma_pack_invalid_action : Warning<
793  "unknown action for '#pragma pack' - ignored">;
794def warn_pragma_pack_malformed : Warning<
795  "expected integer or identifier in '#pragma pack' - ignored">;
796// - #pragma unused
797def warn_pragma_unused_expected_var : Warning<
798  "expected '#pragma unused' argument to be a variable name">;
799def warn_pragma_unused_expected_punc : Warning<
800  "expected ')' or ',' in '#pragma unused'">;
801// - #pragma fp_contract
802def err_pragma_fp_contract_scope : Error<
803  "'#pragma fp_contract' can only appear at file scope or at the start of a "
804  "compound statement">; 
805// - #pragma comment
806def err_pragma_comment_malformed : Error<
807  "pragma comment requires parenthesized identifier and optional string">;
808def err_pragma_comment_unknown_kind : Error<"unknown kind of pragma comment">;
809// - #pragma detect_mismatch
810def err_pragma_detect_mismatch_malformed : Error<
811  "pragma detect_mismatch is malformed; it requires two comma-separated "
812  "string literals">;
813
814// OpenCL Section 6.8.g
815def err_not_opencl_storage_class_specifier : Error<
816  "OpenCL does not support the '%0' storage class specifier">;
817
818// OpenCL EXTENSION pragma (OpenCL 1.1 [9.1])
819def warn_pragma_expected_colon : Warning<
820  "missing ':' after %0 - ignoring">;
821def warn_pragma_expected_enable_disable : Warning<
822  "expected 'enable' or 'disable' - ignoring">;
823def warn_pragma_unknown_extension : Warning<
824  "unknown OpenCL extension %0 - ignoring">;
825
826def err_seh_expected_handler : Error<
827  "expected '__except' or '__finally' block">;
828
829def err_seh___except_block : Error<
830  "%0 only allowed in __except block">;
831
832def err_seh___except_filter : Error<
833  "%0 only allowed in __except filter expression">;
834
835def err_seh___finally_block : Error<
836  "%0 only allowed in __finally block">;
837
838// OpenMP support.
839def warn_pragma_omp_ignored : Warning <
840  "unexpected '#pragma omp ...' in program">, InGroup<SourceUsesOpenMP>, DefaultIgnore;
841def warn_omp_extra_tokens_at_eol : Warning <
842  "extra tokens at the end of '#pragma omp %0' are ignored">,
843  InGroup<ExtraTokens>;
844def err_omp_unknown_directive : Error <
845  "expected an OpenMP directive">;
846def err_omp_unexpected_directive : Error <
847  "unexpected OpenMP directive '#pragma omp %0'">;
848def err_omp_expected_punc : Error <
849  "expected ',' or ')' in %select{'#pragma omp %1'|'%1' clause}0">;
850def err_omp_unexpected_clause : Error <
851  "unexpected OpenMP clause '%0' in directive '#pragma omp %1'">;
852def err_omp_more_one_clause : Error <
853  "directive '#pragma omp %0' cannot contain more than one '%1' clause">;
854} // end of Parse Issue category.
855
856let CategoryName = "Modules Issue" in {
857def err_module_expected_ident : Error<
858  "expected a module name after module import">;
859def err_module_expected_semi : Error<
860  "expected ';' after module name">;
861}
862
863} // end of Parser diagnostics
864