1//==--- DiagnosticParseKinds.td - libparse diagnostics --------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9//===----------------------------------------------------------------------===//
10// Parser Diagnostics
11//===----------------------------------------------------------------------===//
12
13let Component = "Parse" in {
14
15def warn_asm_qualifier_ignored : Warning<
16  "ignored %0 qualifier on asm">, CatInlineAsm, InGroup<ASMIgnoredQualifier>;
17def warn_file_asm_volatile : Warning<
18  "meaningless 'volatile' on asm outside function">, CatInlineAsm,
19  InGroup<ASMIgnoredQualifier>;
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">;
28def err_gnu_inline_asm_disabled : Error<
29  "GNU-style inline assembly is disabled">;
30def err_asm_goto_cannot_have_output : Error<
31  "'asm goto' cannot have output constraints">;
32}
33
34let CategoryName = "Parse Issue" in {
35
36def warn_cxx2a_compat_explicit_bool : Warning<
37  "this expression will be parsed as explicit(bool) in C++2a">,
38  InGroup<CXX2aCompat>, DefaultIgnore;
39
40def ext_empty_translation_unit : Extension<
41  "ISO C requires a translation unit to contain at least one declaration">,
42  InGroup<DiagGroup<"empty-translation-unit">>;
43def warn_cxx98_compat_top_level_semi : Warning<
44  "extra ';' outside of a function is incompatible with C++98">,
45  InGroup<CXX98CompatExtraSemi>, DefaultIgnore;
46def ext_extra_semi : Extension<
47  "extra ';' %select{"
48  "outside of a function|"
49  "inside a %1|"
50  "inside instance variable list|"
51  "after member function definition}0">,
52  InGroup<ExtraSemi>;
53def ext_extra_semi_cxx11 : Extension<
54  "extra ';' outside of a function is a C++11 extension">,
55  InGroup<CXX11ExtraSemi>;
56def warn_extra_semi_after_mem_fn_def : Warning<
57  "extra ';' after member function definition">,
58  InGroup<ExtraSemi>, DefaultIgnore;
59def warn_null_statement : Warning<
60  "empty expression statement has no effect; "
61  "remove unnecessary ';' to silence this warning">,
62  InGroup<ExtraSemiStmt>, DefaultIgnore;
63
64def ext_thread_before : Extension<"'__thread' before '%0'">;
65def ext_keyword_as_ident : ExtWarn<
66  "keyword '%0' will be made available as an identifier "
67  "%select{here|for the remainder of the translation unit}1">,
68  InGroup<KeywordCompat>;
69
70def ext_nullability : Extension<
71  "type nullability specifier %0 is a Clang extension">,
72  InGroup<DiagGroup<"nullability-extension">>;
73
74def err_empty_enum : Error<"use of empty enum">;
75
76def ext_ident_list_in_param : Extension<
77  "type-less parameter names in function declaration">;
78def ext_c99_variable_decl_in_for_loop : Extension<
79  "variable declaration in for loop is a C99-specific feature">, InGroup<C99>;
80def ext_c99_compound_literal : Extension<
81  "compound literals are a C99-specific feature">, InGroup<C99>;
82def ext_enumerator_list_comma_c : Extension<
83  "commas at the end of enumerator lists are a C99-specific "
84  "feature">, InGroup<C99>;
85def ext_enumerator_list_comma_cxx : Extension<
86  "commas at the end of enumerator lists are a C++11 extension">,
87  InGroup<CXX11>;
88def warn_cxx98_compat_enumerator_list_comma : Warning<
89  "commas at the end of enumerator lists are incompatible with C++98">,
90  InGroup<CXX98CompatPedantic>, DefaultIgnore;
91def err_enumerator_list_missing_comma : Error<
92  "missing ',' between enumerators">;
93def err_enumerator_unnamed_no_def : Error<
94  "unnamed enumeration must be a definition">;
95def ext_cxx11_enum_fixed_underlying_type : Extension<
96  "enumeration types with a fixed underlying type are a C++11 extension">,
97  InGroup<CXX11>;
98def ext_ms_c_enum_fixed_underlying_type : Extension<
99  "enumeration types with a fixed underlying type are a Microsoft extension">,
100  InGroup<MicrosoftFixedEnum>;
101def ext_clang_c_enum_fixed_underlying_type : Extension<
102  "enumeration types with a fixed underlying type are a Clang extension">,
103  InGroup<DiagGroup<"fixed-enum-extension">>;
104def warn_cxx98_compat_enum_fixed_underlying_type : Warning<
105  "enumeration types with a fixed underlying type are incompatible with C++98">,
106  InGroup<CXX98Compat>, DefaultIgnore;
107def warn_cxx98_compat_alignof : Warning<
108  "alignof expressions are incompatible with C++98">,
109  InGroup<CXX98Compat>, DefaultIgnore;
110def ext_alignof_expr : ExtWarn<
111  "%0 applied to an expression is a GNU extension">, InGroup<GNUAlignofExpression>;
112def err_lambda_after_delete : Error<
113  "'[]' after delete interpreted as 'delete[]'; add parentheses to treat this as a lambda-expression">;
114
115def warn_microsoft_dependent_exists : Warning<
116  "dependent %select{__if_not_exists|__if_exists}0 declarations are ignored">,
117  InGroup<DiagGroup<"microsoft-exists">>;
118def warn_microsoft_qualifiers_ignored : Warning<
119  "qualifiers after comma in declarator list are ignored">,
120  InGroup<IgnoredAttributes>;
121
122def ext_c11_generic_selection : Extension<
123  "generic selections are a C11-specific feature">, InGroup<C11>;
124def err_duplicate_default_assoc : Error<
125  "duplicate default generic association">;
126def note_previous_default_assoc : Note<
127  "previous default generic association is here">;
128
129def ext_c11_alignment : Extension<
130  "%0 is a C11-specific feature">, InGroup<C11>;
131
132def ext_c11_noreturn : Extension<
133  "_Noreturn functions are a C11-specific feature">, InGroup<C11>;
134def err_c11_noreturn_misplaced : Error<
135  "'_Noreturn' keyword must precede function declarator">;
136
137def ext_gnu_indirect_goto : Extension<
138  "use of GNU indirect-goto extension">, InGroup<GNULabelsAsValue>;
139def ext_gnu_address_of_label : Extension<
140  "use of GNU address-of-label extension">, InGroup<GNULabelsAsValue>;
141def err_stmtexpr_file_scope : Error<
142  "statement expression not allowed at file scope">;
143def ext_gnu_statement_expr : Extension<
144  "use of GNU statement expression extension">, InGroup<GNUStatementExpression>;
145def ext_gnu_conditional_expr : Extension<
146  "use of GNU ?: conditional expression extension, omitting middle operand">, InGroup<GNUConditionalOmittedOperand>;
147def ext_gnu_empty_initializer : Extension<
148  "use of GNU empty initializer extension">, InGroup<GNUEmptyInitializer>;
149def ext_gnu_array_range : Extension<"use of GNU array range extension">,
150  InGroup<GNUDesignator>;
151def ext_gnu_missing_equal_designator : ExtWarn<
152  "use of GNU 'missing =' extension in designator">,
153  InGroup<GNUDesignator>;
154def err_expected_equal_designator : Error<"expected '=' or another designator">;
155def ext_gnu_old_style_field_designator : ExtWarn<
156  "use of GNU old-style field designator extension">,
157  InGroup<GNUDesignator>;
158def ext_gnu_case_range : Extension<"use of GNU case range extension">,
159  InGroup<GNUCaseRange>;
160
161// Generic errors.
162def err_expected_expression : Error<"expected expression">;
163def err_expected_type : Error<"expected a type">;
164def err_expected_external_declaration : Error<"expected external declaration">;
165def err_extraneous_closing_brace : Error<"extraneous closing brace ('}')">;
166def err_expected_semi_declaration : Error<
167  "expected ';' at end of declaration">;
168def err_expected_semi_decl_list : Error<
169  "expected ';' at end of declaration list">;
170def ext_expected_semi_decl_list : ExtWarn<
171  "expected ';' at end of declaration list">;
172def err_expected_member_name_or_semi : Error<
173  "expected member name or ';' after declaration specifiers">;
174def err_function_declared_typedef : Error<
175  "function definition declared 'typedef'">;
176def err_at_defs_cxx : Error<"@defs is not supported in Objective-C++">;
177def err_at_in_class : Error<"unexpected '@' in member specification">;
178def err_unexpected_semi : Error<"unexpected ';' before %0">;
179
180def err_expected_fn_body : Error<
181  "expected function body after function declarator">;
182def warn_attribute_on_function_definition : Warning<
183  "GCC does not allow %0 attribute in this position on a function definition">,
184  InGroup<GccCompat>;
185def warn_gcc_attribute_location : Warning<
186  "GCC does not allow an attribute in this position on a function declaration">,
187  InGroup<GccCompat>;
188def warn_gcc_variable_decl_in_for_loop : Warning<
189  "GCC does not allow variable declarations in for loop initializers before "
190  "C99">, InGroup<GccCompat>;
191def warn_attribute_no_decl : Warning<
192  "attribute %0 ignored, because it is not attached to a declaration">,
193  InGroup<IgnoredAttributes>;
194def err_ms_attributes_not_enabled : Error<
195  "'__declspec' attributes are not enabled; use '-fdeclspec' or "
196  "'-fms-extensions' to enable support for __declspec attributes">;
197def err_expected_method_body : Error<"expected method body">;
198def err_declspec_after_virtspec : Error<
199  "'%0' qualifier may not appear after the virtual specifier '%1'">;
200def err_invalid_token_after_toplevel_declarator : Error<
201  "expected ';' after top level declarator">;
202def err_invalid_token_after_declarator_suggest_equal : Error<
203  "invalid %0 at end of declaration; did you mean '='?">;
204def err_expected_statement : Error<"expected statement">;
205def err_expected_lparen_after : Error<"expected '(' after '%0'">;
206def err_expected_rparen_after : Error<"expected ')' after '%0'">;
207def err_expected_punc : Error<"expected ')' or ',' after '%0'">;
208def err_expected_less_after : Error<"expected '<' after '%0'">;
209def err_expected_lbrace_in_compound_literal : Error<
210  "expected '{' in compound literal">;
211def err_expected_while : Error<"expected 'while' in do/while loop">;
212
213def err_expected_semi_after_stmt : Error<"expected ';' after %0 statement">;
214def err_expected_semi_after_expr : Error<"expected ';' after expression">;
215def err_extraneous_token_before_semi : Error<"extraneous '%0' before ';'">;
216
217def err_expected_semi_after_method_proto : Error<
218  "expected ';' after method prototype">;
219def err_expected_semi_after_namespace_name : Error<
220  "expected ';' after namespace name">;
221def err_unexpected_namespace_attributes_alias : Error<
222  "attributes cannot be specified on namespace alias">;
223def err_unexpected_nested_namespace_attribute : Error<
224  "attributes cannot be specified on a nested namespace definition">;
225def err_inline_namespace_alias : Error<"namespace alias cannot be inline">;
226def err_namespace_nonnamespace_scope : Error<
227  "namespaces can only be defined in global or namespace scope">;
228def ext_nested_namespace_definition : ExtWarn<
229  "nested namespace definition is a C++17 extension; "
230  "define each namespace separately">, InGroup<CXX17>;
231def warn_cxx14_compat_nested_namespace_definition : Warning<
232  "nested namespace definition is incompatible with C++ standards before C++17">,
233  InGroup<CXXPre17Compat>, DefaultIgnore;
234def ext_inline_nested_namespace_definition : ExtWarn<
235  "inline nested namespace definition is a C++2a extension">, InGroup<CXX2a>;
236def warn_cxx17_compat_inline_nested_namespace_definition : Warning<
237  "inline nested namespace definition is incompatible with C++ standards before"
238  " C++2a">, InGroup<CXXPre2aCompat>, DefaultIgnore;
239def err_inline_nested_namespace_definition : Error<
240  "nested namespace definition cannot be 'inline'">;
241def err_expected_semi_after_attribute_list : Error<
242  "expected ';' after attribute list">;
243def err_expected_semi_after_static_assert : Error<
244  "expected ';' after static_assert">;
245def err_expected_semi_for : Error<"expected ';' in 'for' statement specifier">;
246def err_single_decl_assign_in_for_range : Error<
247  "range-based 'for' statement uses ':', not '='">;
248def warn_missing_selector_name : Warning<
249  "%0 used as the name of the previous parameter rather than as part "
250  "of the selector">,
251  InGroup<DiagGroup<"missing-selector-name">>;
252def note_missing_selector_name : Note<
253  "introduce a parameter name to make %0 part of the selector">;
254def note_force_empty_selector_name : Note<
255  "or insert whitespace before ':' to use %0 as parameter name "
256  "and have an empty entry in the selector">;
257def err_label_end_of_compound_statement : Error<
258  "label at end of compound statement: expected statement">;
259def err_address_of_label_outside_fn : Error<
260  "use of address-of-label extension outside of a function body">;
261def err_asm_operand_wide_string_literal : Error<
262  "cannot use %select{unicode|wide}0 string literal in 'asm'">;
263def err_expected_selector_for_method : Error<
264  "expected selector for Objective-C method">;
265def err_expected_property_name : Error<"expected property name">;
266
267def err_unexpected_at : Error<"unexpected '@' in program">;
268def err_atimport : Error<
269"use of '@import' when modules are disabled">;
270
271def warn_atimport_in_framework_header : Warning<
272  "use of '@import' in framework header is discouraged, "
273  "including this header requires -fmodules">,
274  InGroup<FrameworkHdrAtImport>;
275
276def err_invalid_reference_qualifier_application : Error<
277  "'%0' qualifier may not be applied to a reference">;
278def err_illegal_decl_reference_to_reference : Error<
279  "%0 declared as a reference to a reference">;
280def ext_rvalue_reference : ExtWarn<
281  "rvalue references are a C++11 extension">, InGroup<CXX11>;
282def warn_cxx98_compat_rvalue_reference : Warning<
283  "rvalue references are incompatible with C++98">,
284  InGroup<CXX98Compat>, DefaultIgnore;
285def ext_ref_qualifier : ExtWarn<
286  "reference qualifiers on functions are a C++11 extension">, InGroup<CXX11>;
287def warn_cxx98_compat_ref_qualifier : Warning<
288  "reference qualifiers on functions are incompatible with C++98">,
289  InGroup<CXX98Compat>, DefaultIgnore;
290def ext_inline_namespace : ExtWarn<
291  "inline namespaces are a C++11 feature">, InGroup<CXX11InlineNamespace>;
292def warn_cxx98_compat_inline_namespace : Warning<
293  "inline namespaces are incompatible with C++98">,
294  InGroup<CXX98Compat>, DefaultIgnore;
295def ext_generalized_initializer_lists : ExtWarn<
296  "generalized initializer lists are a C++11 extension">,
297  InGroup<CXX11>;
298def warn_cxx98_compat_generalized_initializer_lists : Warning<
299  "generalized initializer lists are incompatible with C++98">,
300  InGroup<CXX98Compat>, DefaultIgnore;
301def err_init_list_bin_op : Error<"initializer list cannot be used on the "
302  "%select{left|right}0 hand side of operator '%1'">;
303def warn_cxx98_compat_trailing_return_type : Warning<
304  "trailing return types are incompatible with C++98">,
305  InGroup<CXX98Compat>, DefaultIgnore;
306def ext_auto_storage_class : ExtWarn<
307  "'auto' storage class specifier is not permitted in C++11, and will not "
308  "be supported in future releases">, InGroup<DiagGroup<"auto-storage-class">>;
309def ext_decltype_auto_type_specifier : ExtWarn<
310  "'decltype(auto)' type specifier is a C++14 extension">, InGroup<CXX14>;
311def warn_cxx11_compat_decltype_auto_type_specifier : Warning<
312  "'decltype(auto)' type specifier is incompatible with C++ standards before "
313  "C++14">, InGroup<CXXPre14Compat>, DefaultIgnore;
314def ext_auto_type : Extension<
315  "'__auto_type' is a GNU extension">,
316  InGroup<GNUAutoType>;
317def ext_for_range : ExtWarn<
318  "range-based for loop is a C++11 extension">, InGroup<CXX11>;
319def warn_cxx98_compat_for_range : Warning<
320  "range-based for loop is incompatible with C++98">,
321  InGroup<CXX98Compat>, DefaultIgnore;
322def err_for_range_identifier : Error<
323  "range-based for loop requires type for loop variable">;
324def err_for_range_expected_decl : Error<
325  "for range declaration must declare a variable">;
326def err_argument_required_after_attribute : Error<
327  "argument required after attribute">;
328def err_missing_param : Error<"expected parameter declarator">;
329def err_missing_comma_before_ellipsis : Error<
330  "C requires a comma prior to the ellipsis in a variadic function type">;
331def err_unexpected_typedef_ident : Error<
332  "unexpected type name %0: expected identifier">;
333def warn_cxx98_compat_decltype : Warning<
334  "'decltype' type specifier is incompatible with C++98">,
335  InGroup<CXX98Compat>, DefaultIgnore;
336def err_unexpected_scope_on_base_decltype : Error<
337  "unexpected namespace scope prior to decltype">;
338def err_expected_class_name : Error<"expected class name">;
339def err_expected_class_name_not_template :
340  Error<"'typename' is redundant; base classes are implicitly types">;
341def err_unspecified_vla_size_with_static : Error<
342  "'static' may not be used with an unspecified variable length array size">;
343def err_unspecified_size_with_static : Error<
344  "'static' may not be used without an array size">;
345def err_expected_parentheses_around_typename : Error<
346  "expected parentheses around type name in %0 expression">;
347
348def err_expected_case_before_expression: Error<
349  "expected 'case' keyword before expression">;
350
351def ext_warn_gnu_final : ExtWarn<
352  "__final is a GNU extension, consider using C++11 final">,
353  InGroup<GccCompat>;
354
355// Declarations.
356def err_typename_requires_specqual : Error<
357  "type name requires a specifier or qualifier">;
358def err_typename_invalid_storageclass : Error<
359  "type name does not allow storage class to be specified">;
360def err_typename_invalid_functionspec : Error<
361  "type name does not allow function specifier to be specified">;
362def err_typename_invalid_constexpr : Error<
363  "type name does not allow %select{constexpr|consteval}0 specifier to be specified">;
364def err_typename_identifiers_only : Error<
365  "typename is allowed for identifiers only">;
366
367def err_friend_invalid_in_context : Error<
368  "'friend' used outside of class">;
369def err_templated_using_directive_declaration : Error<
370  "cannot template a using %select{directive|declaration}0">;
371def err_unexpected_colon_in_nested_name_spec : Error<
372  "unexpected ':' in nested name specifier; did you mean '::'?">;
373def err_unexpected_token_in_nested_name_spec : Error<
374  "'%0' cannot be a part of nested name specifier; did you mean ':'?">;
375def err_bool_redeclaration : Error<
376  "redeclaration of C++ built-in type 'bool'">;
377def ext_c11_static_assert : Extension<
378  "_Static_assert is a C11-specific feature">, InGroup<C11>;
379def warn_cxx98_compat_static_assert : Warning<
380  "static_assert declarations are incompatible with C++98">,
381  InGroup<CXX98Compat>, DefaultIgnore;
382def ext_static_assert_no_message : ExtWarn<
383  "static_assert with no message is a C++17 extension">, InGroup<CXX17>;
384def warn_cxx14_compat_static_assert_no_message : Warning<
385  "static_assert with no message is incompatible with C++ standards before "
386  "C++17">,
387  DefaultIgnore, InGroup<CXXPre17Compat>;
388def err_function_definition_not_allowed : Error<
389  "function definition is not allowed here">;
390def err_expected_end_of_enumerator : Error<
391  "expected '= constant-expression' or end of enumerator definition">;
392def err_expected_coloncolon_after_super : Error<
393  "expected '::' after '__super'">;
394
395def ext_decomp_decl_empty : ExtWarn<
396  "ISO C++17 does not allow a decomposition group to be empty">,
397  InGroup<DiagGroup<"empty-decomposition">>;
398
399/// Objective-C parser diagnostics
400def err_expected_minus_or_plus : Error<
401  "method type specifier must start with '-' or '+'">;
402def err_objc_missing_end : Error<"missing '@end'">;
403def note_objc_container_start : Note<
404  "%select{class|protocol|category|class extension|implementation"
405  "|category implementation}0 started here">;
406def warn_objc_protocol_qualifier_missing_id : Warning<
407  "protocol has no object type specified; defaults to qualified 'id'">;
408def err_objc_unknown_at : Error<"expected an Objective-C directive after '@'">;
409def err_illegal_super_cast : Error<
410  "cannot cast 'super' (it isn't an expression)">;
411def err_nsnumber_nonliteral_unary : Error<
412  "@%0 must be followed by a number to form an NSNumber object">;
413def warn_cstyle_param : Warning<
414  "use of C-style parameters in Objective-C method declarations"
415  " is deprecated">, InGroup<DeprecatedDeclarations>;
416
417let CategoryName = "ARC Parse Issue" in {
418def err_arc_bridge_retain : Error<
419  "unknown cast annotation __bridge_retain; did you mean __bridge_retained?">;
420// To be default mapped to an error later.
421def warn_arc_bridge_cast_nonarc : Warning<
422  "'%0' casts have no effect when not using ARC">,
423  InGroup<DiagGroup<"arc-bridge-casts-disallowed-in-nonarc">>;
424}
425
426def err_objc_illegal_visibility_spec : Error<
427  "illegal visibility specification">;
428def err_objc_illegal_interface_qual : Error<"illegal interface qualifier">;
429def err_objc_expected_equal_for_getter : Error<
430  "expected '=' for Objective-C getter">;
431def err_objc_expected_equal_for_setter : Error<
432  "expected '=' for Objective-C setter">;
433def err_objc_expected_selector_for_getter_setter : Error<
434  "expected selector for Objective-C %select{setter|getter}0">;
435def err_objc_property_requires_field_name : Error<
436  "property requires fields to be named">;
437def err_objc_property_bitfield : Error<"property name cannot be a bit-field">;
438def err_objc_expected_property_attr : Error<"unknown property attribute %0">;
439def err_objc_properties_require_objc2 : Error<
440  "properties are an Objective-C 2 feature">;
441def err_objc_unexpected_attr : Error<
442  "prefix attribute must be followed by an interface, protocol, or implementation">;
443def err_objc_postfix_attribute : Error <
444  "postfix attributes are not allowed on Objective-C directives">;
445def err_objc_postfix_attribute_hint : Error <
446  "postfix attributes are not allowed on Objective-C directives, place"
447  " them in front of '%select{@interface|@protocol}0'">;
448def err_objc_directive_only_in_protocol : Error<
449  "directive may only be specified in protocols only">;
450def err_missing_catch_finally : Error<
451  "@try statement without a @catch and @finally clause">;
452def err_objc_concat_string : Error<"unexpected token after Objective-C string">;
453def err_expected_objc_container : Error<
454  "'@end' must appear in an Objective-C context">;
455def err_unexpected_protocol_qualifier : Error<
456  "@implementation declaration cannot be protocol qualified">;
457def err_objc_unexpected_atend : Error<
458  "'@end' appears where closing brace '}' is expected">;
459def err_synthesized_property_name : Error<
460  "expected a property name in @synthesize">;
461def warn_semicolon_before_method_body : Warning<
462  "semicolon before method body is ignored">,
463  InGroup<SemiBeforeMethodBody>, DefaultIgnore;
464def note_extra_comma_message_arg : Note<
465  "comma separating Objective-C messaging arguments">;
466
467def err_expected_field_designator : Error<
468  "expected a field designator, such as '.field = 4'">;
469
470def err_declaration_does_not_declare_param : Error<
471  "declaration does not declare a parameter">;
472def err_no_matching_param : Error<"parameter named %0 is missing">;
473
474/// Objective-C++ parser diagnostics
475def err_expected_token_instead_of_objcxx_keyword : Error<
476  "expected %0; %1 is a keyword in Objective-C++">;
477def err_expected_member_name_or_semi_objcxx_keyword : Error<
478  "expected member name or ';' after declaration specifiers; "
479  "%0 is a keyword in Objective-C++">;
480
481/// C++ parser diagnostics
482def err_invalid_operator_on_type : Error<
483  "cannot use %select{dot|arrow}0 operator on a type">;
484def err_expected_unqualified_id : Error<
485  "expected %select{identifier|unqualified-id}0">;
486def err_brackets_go_after_unqualified_id : Error<
487  "brackets are not allowed here; to declare an array, "
488  "place the brackets after the %select{identifier|name}0">;
489def err_unexpected_unqualified_id : Error<"type-id cannot have a name">;
490def err_func_def_no_params : Error<
491  "function definition does not declare parameters">;
492def err_expected_lparen_after_type : Error<
493  "expected '(' for function-style cast or type construction">;
494def err_expected_init_in_condition : Error<
495  "variable declaration in condition must have an initializer">;
496def err_expected_init_in_condition_lparen : Error<
497  "variable declaration in condition cannot have a parenthesized initializer">;
498def err_extraneous_rparen_in_condition : Error<
499  "extraneous ')' after condition, expected a statement">;
500def warn_dangling_else : Warning<
501  "add explicit braces to avoid dangling else">,
502  InGroup<DanglingElse>;
503def err_expected_member_or_base_name : Error<
504  "expected class member or base class name">;
505def err_expected_lbrace_after_base_specifiers : Error<
506  "expected '{' after base class list">;
507def err_missing_end_of_definition : Error<
508  "missing '}' at end of definition of %q0">;
509def note_missing_end_of_definition_before : Note<
510  "still within definition of %q0 here">;
511def ext_ellipsis_exception_spec : Extension<
512  "exception specification of '...' is a Microsoft extension">,
513  InGroup<MicrosoftExceptionSpec>;
514def err_dynamic_and_noexcept_specification : Error<
515  "cannot have both throw() and noexcept() clause on the same function">;
516def err_except_spec_unparsed : Error<
517  "unexpected end of exception specification">;
518def ext_dynamic_exception_spec : ExtWarn<
519  "ISO C++17 does not allow dynamic exception specifications">,
520  InGroup<DynamicExceptionSpec>, DefaultError;
521def warn_exception_spec_deprecated : Warning<
522  "dynamic exception specifications are deprecated">,
523  InGroup<DeprecatedDynamicExceptionSpec>, DefaultIgnore;
524def note_exception_spec_deprecated : Note<"use '%0' instead">;
525def warn_cxx98_compat_noexcept_decl : Warning<
526  "noexcept specifications are incompatible with C++98">,
527  InGroup<CXX98Compat>, DefaultIgnore;
528def err_expected_catch : Error<"expected catch">;
529def err_using_namespace_in_class : Error<
530  "'using namespace' is not allowed in classes">;
531def err_constructor_bad_name : Error<
532  "missing return type for function %0; did you mean the constructor name %1?">;
533def err_destructor_tilde_identifier : Error<
534  "expected a class name after '~' to name a destructor">;
535def err_destructor_tilde_scope : Error<
536  "'~' in destructor name should be after nested name specifier">;
537def err_destructor_template_id : Error<
538  "destructor name %0 does not refer to a template">;
539def err_default_arg_unparsed : Error<
540  "unexpected end of default argument expression">;
541def err_bracket_depth_exceeded : Error<
542  "bracket nesting level exceeded maximum of %0">, DefaultFatal;
543def note_bracket_depth : Note<
544  "use -fbracket-depth=N to increase maximum nesting level">;
545def err_misplaced_ellipsis_in_declaration : Error<
546  "'...' must %select{immediately precede declared identifier|"
547  "be innermost component of anonymous pack declaration}0">;
548def warn_misplaced_ellipsis_vararg : Warning<
549  "'...' in this location creates a C-style varargs function"
550  "%select{, not a function parameter pack|}0">,
551  InGroup<DiagGroup<"ambiguous-ellipsis">>;
552def note_misplaced_ellipsis_vararg_existing_ellipsis : Note<
553  "preceding '...' declares a function parameter pack">;
554def note_misplaced_ellipsis_vararg_add_ellipsis : Note<
555  "place '...' %select{immediately before declared identifier|here}0 "
556  "to declare a function parameter pack">;
557def note_misplaced_ellipsis_vararg_add_comma : Note<
558  "insert ',' before '...' to silence this warning">;
559def ext_abstract_pack_declarator_parens : ExtWarn<
560  "ISO C++11 requires a parenthesized pack declaration to have a name">,
561  InGroup<DiagGroup<"anonymous-pack-parens">>;
562def err_function_is_not_record : Error<
563  "unexpected %0 in function call; perhaps remove the %0?">;
564def err_super_in_using_declaration : Error<
565  "'__super' cannot be used with a using declaration">;
566def ext_constexpr_if : ExtWarn<
567  "constexpr if is a C++17 extension">, InGroup<CXX17>;
568def warn_cxx14_compat_constexpr_if : Warning<
569  "constexpr if is incompatible with C++ standards before C++17">,
570  DefaultIgnore, InGroup<CXXPre17Compat>;
571def ext_init_statement : ExtWarn<
572  "'%select{if|switch}0' initialization statements are a C++17 extension">,
573  InGroup<CXX17>;
574def warn_cxx14_compat_init_statement : Warning<
575  "%select{if|switch}0 initialization statements are incompatible with "
576  "C++ standards before C++17">, DefaultIgnore, InGroup<CXXPre17Compat>;
577def ext_for_range_init_stmt : ExtWarn<
578  "range-based for loop initialization statements are a C++2a extension">,
579  InGroup<CXX2a>;
580def warn_cxx17_compat_for_range_init_stmt : Warning<
581  "range-based for loop initialization statements are incompatible with "
582  "C++ standards before C++2a">, DefaultIgnore, InGroup<CXXPre2aCompat>;
583def warn_empty_init_statement : Warning<
584  "empty initialization statement of '%select{if|switch|range-based for}0' "
585  "has no effect">, InGroup<EmptyInitStatement>, DefaultIgnore;
586
587// C++ derived classes
588def err_dup_virtual : Error<"duplicate 'virtual' in base specifier">;
589
590// C++ operator overloading
591def err_literal_operator_string_prefix : Error<
592  "string literal after 'operator' cannot have an encoding prefix">;
593def err_literal_operator_string_not_empty : Error<
594  "string literal after 'operator' must be '\"\"'">;
595def warn_cxx98_compat_literal_operator : Warning<
596  "literal operators are incompatible with C++98">,
597  InGroup<CXX98Compat>, DefaultIgnore;
598
599// Classes.
600def err_anon_type_definition : Error<
601  "declaration of anonymous %0 must be a definition">;
602def err_default_delete_in_multiple_declaration : Error<
603  "'= %select{default|delete}0' is a function definition and must occur in a "
604  "standalone declaration">;
605
606def warn_cxx98_compat_noexcept_expr : Warning<
607  "noexcept expressions are incompatible with C++98">,
608  InGroup<CXX98Compat>, DefaultIgnore;
609def warn_cxx98_compat_nullptr : Warning<
610  "'nullptr' is incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
611
612def warn_wrong_clang_attr_namespace : Warning<
613  "'__clang__' is a predefined macro name, not an attribute scope specifier; "
614  "did you mean '_Clang' instead?">, InGroup<IgnoredAttributes>;
615def ext_ns_enum_attribute : Extension<
616  "attributes on %select{a namespace|an enumerator}0 declaration are "
617  "a C++17 extension">, InGroup<CXX17>;
618def warn_cxx14_compat_ns_enum_attribute : Warning<
619  "attributes on %select{a namespace|an enumerator}0 declaration are "
620  "incompatible with C++ standards before C++17">,
621  InGroup<CXXPre17CompatPedantic>, DefaultIgnore;
622def warn_cxx98_compat_alignas : Warning<"'alignas' is incompatible with C++98">,
623  InGroup<CXX98Compat>, DefaultIgnore;
624def warn_cxx98_compat_attribute : Warning<
625  "C++11 attribute syntax is incompatible with C++98">,
626  InGroup<CXX98Compat>, DefaultIgnore;
627def err_cxx11_attribute_forbids_arguments : Error<
628  "attribute %0 cannot have an argument list">;
629def err_attribute_requires_arguments : Error<
630  "parentheses must be omitted if %0 attribute's argument list is empty">;
631def err_cxx11_attribute_forbids_ellipsis : Error<
632  "attribute %0 cannot be used as an attribute pack">;
633def err_cxx11_attribute_repeated : Error<
634  "attribute %0 cannot appear multiple times in an attribute specifier">;
635def warn_cxx14_compat_using_attribute_ns : Warning<
636  "default scope specifier for attributes is incompatible with C++ standards "
637  "before C++17">, InGroup<CXXPre17Compat>, DefaultIgnore;
638def ext_using_attribute_ns : ExtWarn<
639  "default scope specifier for attributes is a C++17 extension">,
640  InGroup<CXX17>;
641def err_using_attribute_ns_conflict : Error<
642  "attribute with scope specifier cannot follow default scope specifier">;
643def err_attributes_not_allowed : Error<"an attribute list cannot appear here">;
644def err_attributes_misplaced : Error<"misplaced attributes; expected attributes here">;
645def err_l_square_l_square_not_attribute : Error<
646  "C++11 only allows consecutive left square brackets when "
647  "introducing an attribute">;
648def err_ms_declspec_type : Error<
649  "__declspec attributes must be an identifier or string literal">;
650def err_ms_property_no_getter_or_putter : Error<
651  "property does not specify a getter or a putter">;
652def err_ms_property_unknown_accessor : Error<
653  "expected 'get' or 'put' in property declaration">;
654def err_ms_property_has_set_accessor : Error<
655  "putter for property must be specified as 'put', not 'set'">;
656def err_ms_property_missing_accessor_kind : Error<
657  "missing 'get=' or 'put='">;
658def err_ms_property_expected_equal : Error<
659  "expected '=' after '%0'">;
660def err_ms_property_duplicate_accessor : Error<
661  "property declaration specifies '%0' accessor twice">;
662def err_ms_property_expected_accessor_name : Error<
663  "expected name of accessor method">;
664def err_ms_property_expected_comma_or_rparen : Error<
665  "expected ',' or ')' at end of property accessor list">;
666def err_ms_property_initializer : Error<
667  "property declaration cannot have an in-class initializer">;
668
669/// C++ Templates
670def err_expected_template : Error<"expected template">;
671def err_unknown_template_name : Error<
672  "unknown template name %0">;
673def err_expected_comma_greater : Error<
674  "expected ',' or '>' in template-parameter-list">;
675def err_class_on_template_template_param : Error<
676  "template template parameter requires 'class' after the parameter list">;
677def ext_template_template_param_typename : ExtWarn<
678  "template template parameter using 'typename' is a C++17 extension">,
679  InGroup<CXX17>;
680def warn_cxx14_compat_template_template_param_typename : Warning<
681  "template template parameter using 'typename' is "
682  "incompatible with C++ standards before C++17">,
683  InGroup<CXXPre17Compat>, DefaultIgnore;
684def err_template_spec_syntax_non_template : Error<
685  "identifier followed by '<' indicates a class template specialization but "
686  "%0 %select{does not refer to a template|refers to a function template|"
687  "<unused>|refers to a variable template|<unused>|refers to a concept}1">;
688def err_id_after_template_in_nested_name_spec : Error<
689  "expected template name after 'template' keyword in nested name specifier">;
690def err_unexpected_template_in_unqualified_id : Error<
691  "'template' keyword not permitted here">;
692def err_unexpected_template_after_using : Error<
693  "'template' keyword not permitted after 'using' keyword">;
694def err_two_right_angle_brackets_need_space : Error<
695  "a space is required between consecutive right angle brackets (use '> >')">;
696def err_right_angle_bracket_equal_needs_space : Error<
697  "a space is required between a right angle bracket and an equals sign "
698  "(use '> =')">;
699def warn_cxx11_right_shift_in_template_arg : Warning<
700  "use of right-shift operator ('>>') in template argument will require "
701  "parentheses in C++11">, InGroup<CXX11Compat>;
702def warn_cxx98_compat_two_right_angle_brackets : Warning<
703  "consecutive right angle brackets are incompatible with C++98 (use '> >')">,
704  InGroup<CXX98Compat>, DefaultIgnore;
705def err_templated_invalid_declaration : Error<
706  "a static_assert declaration cannot be a template">;
707def err_multiple_template_declarators : Error<
708  "%select{|a template declaration|an explicit template specialization|"
709  "an explicit template instantiation}0 can "
710  "only %select{|declare|declare|instantiate}0 a single entity">;
711def err_explicit_instantiation_with_definition : Error<
712  "explicit template instantiation cannot have a definition; if this "
713  "definition is meant to be an explicit specialization, add '<>' after the "
714  "'template' keyword">;
715def err_template_defn_explicit_instantiation : Error<
716  "%select{function|class|variable}0 cannot be defined in an explicit instantiation; if this "
717  "declaration is meant to be a %select{function|class|variable}0 definition, remove the 'template' keyword">;
718def err_friend_explicit_instantiation : Error<
719  "friend cannot be declared in an explicit instantiation; if this "
720  "declaration is meant to be a friend declaration, remove the 'template' keyword">;
721def err_explicit_instantiation_enum : Error<
722  "enumerations cannot be explicitly instantiated">;
723def err_expected_template_parameter : Error<"expected template parameter">;
724
725def err_missing_dependent_template_keyword : Error<
726  "use 'template' keyword to treat '%0' as a dependent template name">;
727def warn_missing_dependent_template_keyword : ExtWarn<
728  "use 'template' keyword to treat '%0' as a dependent template name">;
729
730def ext_extern_template : Extension<
731  "extern templates are a C++11 extension">, InGroup<CXX11>;
732def warn_cxx98_compat_extern_template : Warning<
733  "extern templates are incompatible with C++98">,
734  InGroup<CXX98CompatPedantic>, DefaultIgnore;
735def warn_static_inline_explicit_inst_ignored : Warning<
736  "ignoring '%select{static|inline}0' keyword on explicit template "
737  "instantiation">, InGroup<DiagGroup<"static-inline-explicit-instantiation">>;
738
739// Constructor template diagnostics.
740def err_out_of_line_constructor_template_id : Error<
741  "out-of-line constructor for %0 cannot have template arguments">;
742
743def err_expected_qualified_after_typename : Error<
744  "expected a qualified name after 'typename'">;
745def warn_expected_qualified_after_typename : ExtWarn<
746  "expected a qualified name after 'typename'">;
747
748def err_typename_refers_to_non_type_template : Error<
749  "typename specifier refers to a non-type template">;
750def err_expected_type_name_after_typename : Error<
751  "expected an identifier or template-id after '::'">;
752def err_explicit_spec_non_template : Error<
753  "explicit %select{specialization|instantiation}0 of "
754  "%select{non-|undeclared }3template %1 %2">;
755
756def err_default_template_template_parameter_not_template : Error<
757  "default template argument for a template template parameter must be a class "
758  "template">;
759
760def ext_fold_expression : ExtWarn<
761  "pack fold expression is a C++17 extension">,
762  InGroup<CXX17>;
763def warn_cxx14_compat_fold_expression : Warning<
764  "pack fold expression is incompatible with C++ standards before C++17">,
765  InGroup<CXXPre17Compat>, DefaultIgnore;
766def err_expected_fold_operator : Error<
767  "expected a foldable binary operator in fold expression">;
768def err_fold_operator_mismatch : Error<
769  "operators in fold expression must be the same">;
770
771def err_ctor_init_missing_comma : Error<
772  "missing ',' between base or member initializers">;
773
774// C++ declarations
775def err_friend_decl_defines_type : Error<
776  "cannot define a type in a friend declaration">;
777def err_missing_whitespace_digraph : Error<
778  "found '<::' after a "
779  "%select{template name|const_cast|dynamic_cast|reinterpret_cast|static_cast}0"
780  " which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?">;
781
782def ext_defaulted_deleted_function : ExtWarn<
783  "%select{defaulted|deleted}0 function definitions are a C++11 extension">,
784  InGroup<CXX11>;
785def warn_cxx98_compat_defaulted_deleted_function : Warning<
786  "%select{defaulted|deleted}0 function definitions are incompatible with C++98">,
787  InGroup<CXX98Compat>, DefaultIgnore;
788
789// C++11 in-class member initialization
790def ext_nonstatic_member_init : ExtWarn<
791  "in-class initialization of non-static data member is a C++11 extension">,
792  InGroup<CXX11>;
793def warn_cxx98_compat_nonstatic_member_init : Warning<
794  "in-class initialization of non-static data members is incompatible with C++98">,
795  InGroup<CXX98Compat>, DefaultIgnore;
796def ext_bitfield_member_init: ExtWarn<
797  "default member initializer for bit-field is a C++2a extension">,
798  InGroup<CXX2a>;
799def warn_cxx17_compat_bitfield_member_init: Warning<
800  "default member initializer for bit-field is incompatible with "
801  "C++ standards before C++2a">, InGroup<CXXPre2aCompat>, DefaultIgnore;
802def err_incomplete_array_member_init: Error<
803  "array bound cannot be deduced from an in-class initializer">;
804
805// C++11 alias-declaration
806def ext_alias_declaration : ExtWarn<
807  "alias declarations are a C++11 extension">, InGroup<CXX11>;
808def warn_cxx98_compat_alias_declaration : Warning<
809  "alias declarations are incompatible with C++98">,
810  InGroup<CXX98Compat>, DefaultIgnore;
811def err_alias_declaration_not_identifier : Error<
812  "name defined in alias declaration must be an identifier">;
813def err_alias_declaration_specialization : Error<
814  "%select{partial specialization|explicit specialization|explicit instantiation}0 of alias templates is not permitted">;
815def err_alias_declaration_pack_expansion : Error<
816  "alias declaration cannot be a pack expansion">;
817
818// C++17 using-declaration pack expansions
819def ext_multi_using_declaration : ExtWarn<
820  "use of multiple declarators in a single using declaration is "
821  "a C++17 extension">, InGroup<CXX17>;
822def warn_cxx17_compat_multi_using_declaration : Warning<
823  "use of multiple declarators in a single using declaration is "
824  "incompatible with C++ standards before C++17">,
825  InGroup<CXXPre17Compat>, DefaultIgnore;
826def ext_using_declaration_pack : ExtWarn<
827  "pack expansion of using declaration is a C++17 extension">, InGroup<CXX17>;
828def warn_cxx17_compat_using_declaration_pack : Warning<
829  "pack expansion using declaration is incompatible with C++ standards "
830  "before C++17">, InGroup<CXXPre17Compat>, DefaultIgnore;
831
832// C++11 override control
833def ext_override_control_keyword : ExtWarn<
834  "'%0' keyword is a C++11 extension">, InGroup<CXX11>;
835def warn_cxx98_compat_override_control_keyword : Warning<
836  "'%0' keyword is incompatible with C++98">,
837  InGroup<CXX98Compat>, DefaultIgnore;
838def err_override_control_interface : Error<
839  "'%0' keyword not permitted with interface types">;
840def ext_ms_sealed_keyword : ExtWarn<
841  "'sealed' keyword is a Microsoft extension">,
842  InGroup<MicrosoftSealed>;
843
844def err_access_specifier_interface : Error<
845  "interface types cannot specify '%select{private|protected}0' access">;
846
847def err_duplicate_virt_specifier : Error<
848  "class member already marked '%0'">;
849
850def err_scoped_enum_missing_identifier : Error<
851  "scoped enumeration requires a name">;
852def ext_scoped_enum : ExtWarn<
853  "scoped enumerations are a C++11 extension">, InGroup<CXX11>;
854def warn_cxx98_compat_scoped_enum : Warning<
855  "scoped enumerations are incompatible with C++98">,
856  InGroup<CXX98Compat>, DefaultIgnore;
857
858def err_expected_parameter_pack : Error<
859  "expected the name of a parameter pack">;
860def err_paren_sizeof_parameter_pack : Error<
861  "missing parentheses around the size of parameter pack %0">;
862def err_sizeof_parameter_pack : Error<
863  "expected parenthesized parameter pack name in 'sizeof...' expression">;
864
865// C++11 lambda expressions
866def err_expected_comma_or_rsquare : Error<
867  "expected ',' or ']' in lambda capture list">;
868def err_this_captured_by_reference : Error<
869  "'this' cannot be captured by reference">;
870def err_expected_capture : Error<
871  "expected variable name or 'this' in lambda capture list">;
872def err_expected_lambda_body : Error<"expected body of lambda expression">;
873def warn_cxx98_compat_lambda : Warning<
874  "lambda expressions are incompatible with C++98">,
875  InGroup<CXX98Compat>, DefaultIgnore;
876def err_lambda_missing_parens : Error<
877  "lambda requires '()' before %select{'mutable'|return type|"
878  "attribute specifier|'constexpr'|'consteval'}0">;
879def err_lambda_decl_specifier_repeated : Error<
880  "%select{'mutable'|'constexpr'|'consteval'}0 cannot appear multiple times in a lambda declarator">;
881def err_lambda_capture_misplaced_ellipsis : Error<
882  "ellipsis in pack %select{|init-}0capture must appear %select{after|before}0 "
883  "the name of the capture">;
884def err_lambda_capture_multiple_ellipses : Error<
885  "multiple ellipses in pack capture">;
886// C++17 lambda expressions
887def err_expected_star_this_capture : Error<
888  "expected 'this' following '*' in lambda capture list">;
889
890// C++17 constexpr lambda expressions
891def warn_cxx14_compat_constexpr_on_lambda : Warning<
892  "constexpr on lambda expressions is incompatible with C++ standards before C++17">,
893  InGroup<CXXPre17Compat>, DefaultIgnore;
894def ext_constexpr_on_lambda_cxx17 : ExtWarn<
895  "'constexpr' on lambda expressions is a C++17 extension">, InGroup<CXX17>;
896
897// C++2a template lambdas
898def ext_lambda_template_parameter_list: ExtWarn<
899  "explicit template parameter list for lambdas is a C++2a extension">,
900  InGroup<CXX2a>;
901def warn_cxx17_compat_lambda_template_parameter_list: Warning<
902  "explicit template parameter list for lambdas is incompatible with "
903  "C++ standards before C++2a">, InGroup<CXXPre2aCompat>, DefaultIgnore;
904def err_lambda_template_parameter_list_empty : Error<
905  "lambda template parameter list cannot be empty">;
906
907// Availability attribute
908def err_expected_version : Error<
909  "expected a version of the form 'major[.minor[.subminor]]'">;
910def warn_expected_consistent_version_separator : Warning<
911  "use same version number separators '_' or '.'; as in "
912  "'major[.minor[.subminor]]'">, InGroup<Availability>;
913def err_zero_version : Error<
914  "version number must have non-zero major, minor, or sub-minor version">;
915def err_availability_expected_platform : Error<
916  "expected a platform name, e.g., 'macos'">;
917
918// objc_bridge_related attribute
919def err_objcbridge_related_expected_related_class : Error<
920  "expected a related ObjectiveC class name, e.g., 'NSColor'">;
921def err_objcbridge_related_selector_name : Error<
922  "expected a class method selector with single argument, e.g., 'colorWithCGColor:'">;
923
924def err_availability_expected_change : Error<
925  "expected 'introduced', 'deprecated', or 'obsoleted'">;
926def err_availability_unknown_change : Error<
927  "%0 is not an availability stage; use 'introduced', 'deprecated', or "
928  "'obsoleted'">;
929def err_availability_redundant : Error<
930  "redundant %0 availability change; only the last specified change will "
931  "be used">;
932def warn_availability_and_unavailable : Warning<
933  "'unavailable' availability overrides all other availability information">,
934  InGroup<Availability>;
935
936// @available(...)
937def err_avail_query_expected_platform_name : Error<
938  "expected a platform name here">;
939
940def err_avail_query_unrecognized_platform_name : Error<
941  "unrecognized platform name %0">;
942def err_availability_query_wildcard_required: Error<
943  "must handle potential future platforms with '*'">;
944def err_availability_query_repeated_platform: Error<
945  "version for '%0' already specified">;
946def err_availability_query_repeated_star : Error<
947  "'*' query has already been specified">;
948
949// External source symbol attribute
950def err_external_source_symbol_expected_keyword : Error<
951  "expected 'language', 'defined_in', or 'generated_declaration'">;
952def err_external_source_symbol_duplicate_clause : Error<
953  "duplicate %0 clause in an 'external_source_symbol' attribute">;
954
955// Type safety attributes
956def err_type_safety_unknown_flag : Error<
957  "invalid comparison flag %0; use 'layout_compatible' or 'must_be_null'">;
958
959// Type traits
960def err_type_trait_arity : Error<
961  "type trait requires %0%select{| or more}1 argument%select{|s}2; have "
962  "%3 argument%s3">;
963
964// Language specific pragmas
965// - Generic warnings
966def warn_pragma_expected_lparen : Warning<
967  "missing '(' after '#pragma %0' - ignoring">, InGroup<IgnoredPragmas>;
968def warn_pragma_expected_rparen : Warning<
969  "missing ')' after '#pragma %0' - ignoring">, InGroup<IgnoredPragmas>;
970def warn_pragma_expected_identifier : Warning<
971  "expected identifier in '#pragma %0' - ignored">, InGroup<IgnoredPragmas>;
972def warn_pragma_expected_string : Warning<
973  "expected string literal in '#pragma %0' - ignoring">, InGroup<IgnoredPragmas>;
974def warn_pragma_missing_argument : Warning<
975  "missing argument to '#pragma %0'%select{|; expected %2}1">, InGroup<IgnoredPragmas>;
976def warn_pragma_invalid_argument : Warning<
977  "unexpected argument '%0' to '#pragma %1'%select{|; expected %3}2">, InGroup<IgnoredPragmas>;
978
979// '#pragma clang section' related errors
980def err_pragma_expected_clang_section_name : Error<
981  "expected one of [bss|data|rodata|text] section kind in '#pragma %0'">;
982def err_pragma_clang_section_expected_equal : Error<
983  "expected '=' following '#pragma clang section %select{invalid|bss|data|rodata|text}0'">;
984def warn_pragma_expected_section_name : Warning<
985  "expected a string literal for the section name in '#pragma %0' - ignored">,
986  InGroup<IgnoredPragmas>;
987
988def warn_pragma_expected_section_push_pop_or_name : Warning<
989  "expected push, pop or a string literal for the section name in '#pragma %0' - ignored">,
990  InGroup<IgnoredPragmas>;
991def warn_pragma_expected_section_label_or_name : Warning<
992  "expected a stack label or a string literal for the section name in '#pragma %0' - ignored">,
993  InGroup<IgnoredPragmas>;
994def warn_pragma_expected_init_seg : Warning<
995  "expected 'compiler', 'lib', 'user', or a string literal for the section name in '#pragma %0' - ignored">,
996  InGroup<IgnoredPragmas>;
997def warn_pragma_expected_integer : Warning<
998  "expected integer between %0 and %1 inclusive in '#pragma %2' - ignored">,
999  InGroup<IgnoredPragmas>;
1000def warn_pragma_ms_struct : Warning<
1001  "incorrect use of '#pragma ms_struct on|off' - ignored">,
1002  InGroup<IgnoredPragmas>;
1003def warn_pragma_extra_tokens_at_eol : Warning<
1004  "extra tokens at end of '#pragma %0' - ignored">,
1005  InGroup<IgnoredPragmas>;
1006def warn_pragma_expected_comma : Warning<
1007  "expected ',' in '#pragma %0'">, InGroup<IgnoredPragmas>;
1008def warn_pragma_expected_punc : Warning<
1009  "expected ')' or ',' in '#pragma %0'">, InGroup<IgnoredPragmas>;
1010def warn_pragma_expected_non_wide_string : Warning<
1011  "expected non-wide string literal in '#pragma %0'">, InGroup<IgnoredPragmas>;
1012// - Generic errors
1013def err_pragma_missing_argument : Error<
1014  "missing argument to '#pragma %0'%select{|; expected %2}1">;
1015// - #pragma options
1016def warn_pragma_options_expected_align : Warning<
1017  "expected 'align' following '#pragma options' - ignored">,
1018  InGroup<IgnoredPragmas>;
1019def warn_pragma_align_expected_equal : Warning<
1020  "expected '=' following '#pragma %select{align|options align}0' - ignored">,
1021  InGroup<IgnoredPragmas>;
1022def warn_pragma_align_invalid_option : Warning<
1023  "invalid alignment option in '#pragma %select{align|options align}0' - ignored">,
1024  InGroup<IgnoredPragmas>;
1025// - #pragma pack
1026def warn_pragma_unsupported_action : Warning<
1027  "known but unsupported action '%1' for '#pragma %0' - ignored">,
1028  InGroup<IgnoredPragmas>;
1029def warn_pragma_invalid_specific_action : Warning<
1030  "unknown action '%1' for '#pragma %0' - ignored">,
1031  InGroup<IgnoredPragmas>;
1032def warn_pragma_expected_action_or_r_paren : Warning<
1033  "expected action or ')' in '#pragma %0' - ignored">,
1034  InGroup<IgnoredPragmas>;
1035def warn_pragma_invalid_action : Warning<
1036  "unknown action for '#pragma %0' - ignored">,
1037  InGroup<IgnoredPragmas>;
1038def warn_pragma_pack_malformed : Warning<
1039  "expected integer or identifier in '#pragma pack' - ignored">,
1040  InGroup<IgnoredPragmas>;
1041// - #pragma intrinsic
1042def warn_pragma_intrinsic_builtin : Warning<
1043  "%0 is not a recognized builtin%select{|; consider including <intrin.h> to access non-builtin intrinsics}1">,
1044  InGroup<IgnoredPragmaIntrinsic>;
1045// - #pragma optimize
1046def warn_pragma_optimize : Warning<
1047  "'#pragma optimize' is not supported">,
1048  InGroup<IgnoredPragmaOptimize>;
1049// - #pragma unused
1050def warn_pragma_unused_expected_var : Warning<
1051  "expected '#pragma unused' argument to be a variable name">,
1052  InGroup<IgnoredPragmas>;
1053// - #pragma init_seg
1054def warn_pragma_init_seg_unsupported_target : Warning<
1055  "'#pragma init_seg' is only supported when targeting a "
1056  "Microsoft environment">,
1057  InGroup<IgnoredPragmas>;
1058// - #pragma fp_contract
1059def err_pragma_fp_contract_scope : Error<
1060  "'#pragma fp_contract' can only appear at file scope or at the start of a "
1061  "compound statement">;
1062// - #pragma stdc unknown
1063def ext_stdc_pragma_ignored : ExtWarn<"unknown pragma in STDC namespace">,
1064   InGroup<UnknownPragmas>;
1065def warn_stdc_fenv_access_not_supported :
1066   Warning<"pragma STDC FENV_ACCESS ON is not supported, ignoring pragma">,
1067   InGroup<UnknownPragmas>;
1068// - #pragma comment
1069def err_pragma_comment_malformed : Error<
1070  "pragma comment requires parenthesized identifier and optional string">;
1071def err_pragma_comment_unknown_kind : Error<"unknown kind of pragma comment">;
1072// PS4 recognizes only #pragma comment(lib)
1073def warn_pragma_comment_ignored : Warning<"'#pragma comment %0' ignored">,
1074  InGroup<IgnoredPragmas>;
1075// - #pragma detect_mismatch
1076def err_pragma_detect_mismatch_malformed : Error<
1077  "pragma detect_mismatch is malformed; it requires two comma-separated "
1078  "string literals">;
1079// - #pragma pointers_to_members
1080def err_pragma_pointers_to_members_unknown_kind : Error<
1081  "unexpected %0, expected to see one of %select{|'best_case', 'full_generality', }1"
1082  "'single_inheritance', 'multiple_inheritance', or 'virtual_inheritance'">;
1083// - #pragma clang optimize on/off
1084def err_pragma_optimize_invalid_argument : Error<
1085  "unexpected argument '%0' to '#pragma clang optimize'; "
1086  "expected 'on' or 'off'">;
1087def err_pragma_optimize_extra_argument : Error<
1088  "unexpected extra argument '%0' to '#pragma clang optimize'">;
1089// - #pragma clang attribute
1090def err_pragma_attribute_expected_push_pop_paren : Error<
1091  "expected 'push', 'pop', or '(' after '#pragma clang attribute'">;
1092def err_pragma_attribute_invalid_argument : Error<
1093  "unexpected argument '%0' to '#pragma clang attribute'; "
1094  "expected 'push' or 'pop'">;
1095def err_pragma_attribute_expected_attribute : Error<
1096  "expected an attribute after '('">;
1097def err_pragma_attribute_expected_attribute_name : Error<
1098  "expected identifier that represents an attribute name">;
1099def err_pragma_attribute_extra_tokens_after_attribute : Error<
1100  "extra tokens after attribute in a '#pragma clang attribute push'">;
1101def err_pragma_attribute_unsupported_attribute : Error<
1102  "attribute %0 is not supported by '#pragma clang attribute'">;
1103def err_pragma_attribute_multiple_attributes : Error<
1104  "more than one attribute specified in '#pragma clang attribute push'">;
1105def err_pragma_attribute_expected_attribute_syntax : Error<
1106  "expected an attribute that is specified using the GNU, C++11 or '__declspec'"
1107  " syntax">;
1108def note_pragma_attribute_use_attribute_kw : Note<"use the GNU '__attribute__' "
1109  "syntax">;
1110def err_pragma_attribute_invalid_subject_set_specifier : Error<
1111  "expected attribute subject set specifier 'apply_to'">;
1112def err_pragma_attribute_expected_subject_identifier : Error<
1113  "expected an identifier that corresponds to an attribute subject rule">;
1114def err_pragma_attribute_unknown_subject_rule : Error<
1115  "unknown attribute subject rule '%0'">;
1116def err_pragma_attribute_expected_subject_sub_identifier : Error<
1117  "expected an identifier that corresponds to an attribute subject matcher "
1118  "sub-rule; '%0' matcher %select{does not support sub-rules|supports the "
1119  "following sub-rules: %2|}1">;
1120def err_pragma_attribute_unknown_subject_sub_rule : Error<
1121  "%select{invalid use of|unknown}2 attribute subject matcher sub-rule '%0'; "
1122  "'%1' matcher %select{does not support sub-rules|supports the following "
1123  "sub-rules: %3}2">;
1124def err_pragma_attribute_duplicate_subject : Error<
1125  "duplicate attribute subject matcher '%0'">;
1126def err_pragma_attribute_expected_period : Error<
1127  "expected '.' after pragma attribute namespace %0">;
1128def err_pragma_attribute_namespace_on_attribute : Error<
1129  "namespace can only apply to 'push' or 'pop' directives">;
1130def note_pragma_attribute_namespace_on_attribute : Note<
1131  "omit the namespace to add attributes to the most-recently"
1132  " pushed attribute group">;
1133
1134def err_opencl_unroll_hint_on_non_loop : Error<
1135  "OpenCL only supports 'opencl_unroll_hint' attribute on for, while, and do statements">;
1136
1137// OpenCL EXTENSION pragma (OpenCL 1.1 [9.1])
1138def warn_pragma_expected_colon : Warning<
1139  "missing ':' after %0 - ignoring">, InGroup<IgnoredPragmas>;
1140def warn_pragma_expected_predicate : Warning<
1141  "expected %select{'enable', 'disable', 'begin' or 'end'|'disable'}0 - ignoring">, InGroup<IgnoredPragmas>;
1142def warn_pragma_begin_end_mismatch : Warning<
1143  "OpenCL extension end directive mismatches begin directive - ignoring">, InGroup<IgnoredPragmas>;
1144def warn_pragma_unknown_extension : Warning<
1145  "unknown OpenCL extension %0 - ignoring">, InGroup<IgnoredPragmas>;
1146def warn_pragma_unsupported_extension : Warning<
1147  "unsupported OpenCL extension %0 - ignoring">, InGroup<IgnoredPragmas>;
1148def warn_pragma_extension_is_core : Warning<
1149  "OpenCL extension %0 is core feature or supported optional core feature - ignoring">, InGroup<DiagGroup<"pedantic-core-features">>, DefaultIgnore;
1150
1151// OpenCL errors.
1152def err_opencl_taking_function_address_parser : Error<
1153  "taking address of function is not allowed">;
1154def err_opencl_logical_exclusive_or : Error<
1155  "^^ is a reserved operator in OpenCL">;
1156
1157// C++ for OpenCL.
1158def err_openclcxx_virtual_function : Error<
1159  "virtual functions are not supported in C++ for OpenCL">;
1160
1161// OpenMP support.
1162def warn_pragma_omp_ignored : Warning<
1163  "unexpected '#pragma omp ...' in program">, InGroup<SourceUsesOpenMP>, DefaultIgnore;
1164def warn_omp_extra_tokens_at_eol : Warning<
1165  "extra tokens at the end of '#pragma omp %0' are ignored">,
1166  InGroup<ExtraTokens>;
1167def warn_pragma_expected_colon_r_paren : Warning<
1168  "missing ':' or ')' after %0 - ignoring">, InGroup<IgnoredPragmas>;
1169def err_omp_unknown_directive : Error<
1170  "expected an OpenMP directive">;
1171def err_omp_unexpected_directive : Error<
1172  "unexpected OpenMP directive %select{|'#pragma omp %1'}0">;
1173def err_omp_expected_punc : Error<
1174  "expected ',' or ')' in '%0' %select{clause|directive}1">;
1175def err_omp_unexpected_clause : Error<
1176  "unexpected OpenMP clause '%0' in directive '#pragma omp %1'">;
1177def err_omp_immediate_directive : Error<
1178  "'#pragma omp %0' %select{|with '%2' clause }1cannot be an immediate substatement">;
1179def err_omp_expected_identifier_for_critical : Error<
1180  "expected identifier specifying the name of the 'omp critical' directive">;
1181def err_omp_expected_reduction_identifier : Error<
1182  "expected identifier or one of the following operators: '+', '-', '*', '&', '|', '^', '&&', or '||'">;
1183def err_omp_decl_in_declare_simd : Error<
1184  "function declaration is expected after 'declare simd' directive">;
1185def err_omp_unknown_map_type : Error<
1186  "incorrect map type, expected one of 'to', 'from', 'tofrom', 'alloc', 'release', or 'delete'">;
1187def err_omp_unknown_map_type_modifier : Error<
1188  "incorrect map type modifier, expected 'always', 'close', or 'mapper'">;
1189def err_omp_map_type_missing : Error<
1190  "missing map type">;
1191def err_omp_map_type_modifier_missing : Error<
1192  "missing map type modifier">;
1193def err_omp_declare_simd_inbranch_notinbranch : Error<
1194  "unexpected '%0' clause, '%1' is specified already">;
1195def err_expected_end_declare_target : Error<
1196  "expected '#pragma omp end declare target'">;
1197def err_omp_declare_target_unexpected_clause: Error<
1198  "unexpected '%0' clause, only 'to' or 'link' clauses expected">;
1199def err_omp_expected_clause: Error<
1200  "expected at least one clause on '#pragma omp %0' directive">;
1201def err_omp_mapper_illegal_identifier : Error<
1202  "illegal OpenMP user-defined mapper identifier">;
1203def err_omp_mapper_expected_declarator : Error<
1204  "expected declarator on 'omp declare mapper' directive">;
1205
1206// Pragma loop support.
1207def err_pragma_loop_missing_argument : Error<
1208  "missing argument; expected %select{an integer value|"
1209  "'enable'%select{|, 'full'}1%select{|, 'assume_safety'}2 or 'disable'}0">;
1210def err_pragma_loop_invalid_option : Error<
1211  "%select{invalid|missing}0 option%select{ %1|}0; expected vectorize, "
1212  "vectorize_width, interleave, interleave_count, unroll, unroll_count, "
1213  "pipeline, pipeline_initiation_interval, or distribute">;
1214
1215def err_pragma_fp_invalid_option : Error<
1216  "%select{invalid|missing}0 option%select{ %1|}0; expected contract">;
1217def err_pragma_fp_invalid_argument : Error<
1218  "unexpected argument '%0' to '#pragma clang fp %1'; "
1219  "expected 'on', 'fast' or 'off'">;
1220def err_pragma_fp_scope : Error<
1221  "'#pragma clang fp' can only appear at file scope or at the start of a "
1222  "compound statement">;
1223
1224def err_pragma_invalid_keyword : Error<
1225  "invalid argument; expected 'enable'%select{|, 'full'}0%select{|, 'assume_safety'}1 or 'disable'">;
1226def err_pragma_pipeline_invalid_keyword : Error<
1227    "invalid argument; expected 'disable'">;
1228
1229// Pragma unroll support.
1230def warn_pragma_unroll_cuda_value_in_parens : Warning<
1231  "argument to '#pragma unroll' should not be in parentheses in CUDA C/C++">,
1232  InGroup<CudaCompat>;
1233
1234def warn_cuda_attr_lambda_position : Warning<
1235  "nvcc does not allow '__%0__' to appear after '()' in lambdas">,
1236  InGroup<CudaCompat>;
1237def warn_pragma_force_cuda_host_device_bad_arg : Warning<
1238  "incorrect use of #pragma clang force_cuda_host_device begin|end">,
1239  InGroup<IgnoredPragmas>;
1240def err_pragma_cannot_end_force_cuda_host_device : Error<
1241  "force_cuda_host_device end pragma without matching "
1242  "force_cuda_host_device begin">;
1243} // end of Parse Issue category.
1244
1245let CategoryName = "Modules Issue" in {
1246def err_unexpected_module_decl : Error<
1247  "module declaration can only appear at the top level">;
1248def err_module_expected_ident : Error<
1249  "expected a module name after '%select{module|import}0'">;
1250def err_attribute_not_module_attr : Error<
1251  "%0 attribute cannot be applied to a module">;
1252def err_attribute_not_import_attr : Error<
1253  "%0 attribute cannot be applied to a module import">;
1254def err_module_expected_semi : Error<
1255  "expected ';' after module name">;
1256def err_global_module_introducer_not_at_start : Error<
1257  "'module;' introducing a global module fragment can appear only "
1258  "at the start of the translation unit">;
1259def err_module_fragment_exported : Error<
1260  "%select{global|private}0 module fragment cannot be exported">;
1261def err_private_module_fragment_expected_semi : Error<
1262  "expected ';' after private module fragment declaration">;
1263def err_missing_before_module_end : Error<"expected %0 at end of module">;
1264def err_unsupported_module_partition : Error<
1265  "sorry, module partitions are not yet supported">;
1266
1267def err_export_empty : Error<"export declaration cannot be empty">;
1268}
1269
1270let CategoryName = "Generics Issue" in {
1271
1272def err_objc_expected_type_parameter : Error<
1273  "expected type parameter name">;
1274
1275def err_objc_parameterized_implementation : Error<
1276  "@implementation cannot have type parameters">;
1277
1278def err_objc_type_args_after_protocols : Error<
1279  "protocol qualifiers must precede type arguments">;
1280
1281def note_meant_to_use_typename : Note<
1282  "did you mean to use 'typename'?">;
1283}
1284
1285let CategoryName = "Coroutines Issue" in {
1286def err_for_co_await_not_range_for : Error<
1287  "'co_await' modifier can only be applied to range-based for loop">;
1288}
1289
1290let CategoryName = "Concepts Issue" in {
1291def err_concept_definition_not_identifier : Error<
1292  "name defined in concept definition must be an identifier">;
1293def ext_concept_legacy_bool_keyword : ExtWarn<
1294  "ISO C++2a does not permit the 'bool' keyword after 'concept'">,
1295  InGroup<DiagGroup<"concepts-ts-compat">>;
1296}
1297
1298} // end of Parser diagnostics
1299