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