]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm-project/clang/include/clang/Basic/DiagnosticLexKinds.td
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
[FreeBSD/FreeBSD.git] / contrib / llvm-project / clang / include / clang / Basic / DiagnosticLexKinds.td
1 //==--- DiagnosticLexKinds.td - liblex 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 // Lexer Diagnostics
11 //===----------------------------------------------------------------------===//
12
13 let Component = "Lex", CategoryName = "Lexical or Preprocessor Issue" in {
14
15 def null_in_char_or_string : Warning<
16   "null character(s) preserved in %select{char|string}0 literal">,
17   InGroup<NullCharacter>;
18 def null_in_file : Warning<"null character ignored">, InGroup<NullCharacter>;
19 def warn_nested_block_comment : Warning<"'/*' within block comment">,
20   InGroup<Comment>;
21 def escaped_newline_block_comment_end : Warning<
22   "escaped newline between */ characters at block comment end">,
23   InGroup<Comment>;
24 def backslash_newline_space : Warning<
25   "backslash and newline separated by space">,
26   InGroup<DiagGroup<"backslash-newline-escape">>;
27
28 // Digraphs.
29 def warn_cxx98_compat_less_colon_colon : Warning<
30   "'<::' is treated as digraph '<:' (aka '[') followed by ':' in C++98">,
31   InGroup<CXX98Compat>, DefaultIgnore;
32
33 def warn_cxx17_compat_spaceship : Warning<
34   "'<=>' operator is incompatible with C++ standards before C++2a">,
35   InGroup<CXXPre2aCompat>, DefaultIgnore;
36 def warn_cxx2a_compat_spaceship : Warning<
37   "'<=>' is a single token in C++2a; "
38   "add a space to avoid a change in behavior">,
39   InGroup<CXX2aCompat>;
40
41 // Trigraphs.
42 def trigraph_ignored : Warning<"trigraph ignored">, InGroup<Trigraphs>;
43 def trigraph_ignored_block_comment : Warning<
44   "ignored trigraph would end block comment">, InGroup<Trigraphs>;
45 def trigraph_ends_block_comment : Warning<"trigraph ends block comment">,
46     InGroup<Trigraphs>;
47 def trigraph_converted : Warning<"trigraph converted to '%0' character">,
48     InGroup<Trigraphs>;
49
50 def ext_multi_line_line_comment : Extension<"multi-line // comment">,
51     InGroup<Comment>;
52 def ext_line_comment : Extension<
53   "// comments are not allowed in this language">,
54   InGroup<Comment>;
55 def ext_no_newline_eof : Extension<"no newline at end of file">,
56   InGroup<NewlineEOF>;
57 def warn_no_newline_eof : Warning<"no newline at end of file">,
58   InGroup<NewlineEOF>, DefaultIgnore;
59
60 def warn_cxx98_compat_no_newline_eof : Warning<
61   "C++98 requires newline at end of file">,
62   InGroup<CXX98CompatPedantic>, DefaultIgnore;
63
64 def ext_dollar_in_identifier : Extension<"'$' in identifier">,
65   InGroup<DiagGroup<"dollar-in-identifier-extension">>;
66 def ext_charize_microsoft : Extension<
67   "charizing operator #@ is a Microsoft extension">,
68   InGroup<MicrosoftCharize>;
69 def ext_comment_paste_microsoft : Extension<
70   "pasting two '/' tokens into a '//' comment is a Microsoft extension">,
71   InGroup<MicrosoftCommentPaste>;
72 def ext_ctrl_z_eof_microsoft : Extension<
73   "treating Ctrl-Z as end-of-file is a Microsoft extension">,
74   InGroup<MicrosoftEndOfFile>;
75
76 def ext_token_used : Extension<"extension used">,
77   InGroup<DiagGroup<"language-extension-token">>;
78
79 def warn_cxx11_keyword : Warning<"'%0' is a keyword in C++11">,
80   InGroup<CXX11Compat>, DefaultIgnore;
81 def warn_cxx2a_keyword : Warning<"'%0' is a keyword in C++2a">,
82   InGroup<CXX2aCompat>, DefaultIgnore;
83
84 def ext_unterminated_char_or_string : ExtWarn<
85   "missing terminating %select{'|'\"'}0 character">, InGroup<InvalidPPToken>;
86 def ext_empty_character : ExtWarn<"empty character constant">,
87   InGroup<InvalidPPToken>;
88 def err_unterminated_block_comment : Error<"unterminated /* comment">;
89 def err_invalid_character_to_charify : Error<
90   "invalid argument to convert to character">;
91 def err_unterminated___pragma : Error<"missing terminating ')' character">;
92
93 def err_conflict_marker : Error<"version control conflict marker in file">;
94
95 def err_raw_delim_too_long : Error<
96   "raw string delimiter longer than 16 characters"
97   "; use PREFIX( )PREFIX to delimit raw string">;
98 def err_invalid_char_raw_delim : Error<
99   "invalid character '%0' character in raw string delimiter"
100   "; use PREFIX( )PREFIX to delimit raw string">;
101 def err_unterminated_raw_string : Error<
102   "raw string missing terminating delimiter )%0\"">;
103 def warn_cxx98_compat_raw_string_literal : Warning<
104   "raw string literals are incompatible with C++98">,
105   InGroup<CXX98Compat>, DefaultIgnore;
106
107 def ext_multichar_character_literal : ExtWarn<
108   "multi-character character constant">, InGroup<MultiChar>;
109 def ext_four_char_character_literal : Extension<
110   "multi-character character constant">, InGroup<FourByteMultiChar>;
111
112
113 // Unicode and UCNs
114 def err_invalid_utf8 : Error<
115   "source file is not valid UTF-8">;
116 def err_non_ascii : Error<
117   "non-ASCII characters are not allowed outside of literals and identifiers">;
118 def ext_unicode_whitespace : ExtWarn<
119   "treating Unicode character as whitespace">,
120   InGroup<DiagGroup<"unicode-whitespace">>;
121 def warn_utf8_symbol_homoglyph : Warning<
122   "treating Unicode character <U+%0> as identifier character rather than "
123   "as '%1' symbol">, InGroup<DiagGroup<"unicode-homoglyph">>;
124 def warn_utf8_symbol_zero_width : Warning<
125   "identifier contains Unicode character <U+%0> that is invisible in "
126   "some environments">, InGroup<DiagGroup<"unicode-zero-width">>;
127
128 def err_hex_escape_no_digits : Error<
129   "\\%0 used with no following hex digits">;
130 def warn_ucn_escape_no_digits : Warning<
131   "\\%0 used with no following hex digits; "
132   "treating as '\\' followed by identifier">, InGroup<Unicode>;
133 def err_ucn_escape_incomplete : Error<
134   "incomplete universal character name">;
135 def warn_ucn_escape_incomplete : Warning<
136   "incomplete universal character name; "
137   "treating as '\\' followed by identifier">, InGroup<Unicode>;
138 def note_ucn_four_not_eight : Note<"did you mean to use '\\u'?">;
139
140 def err_ucn_escape_basic_scs : Error<
141   "character '%0' cannot be specified by a universal character name">;
142 def err_ucn_control_character : Error<
143   "universal character name refers to a control character">;
144 def err_ucn_escape_invalid : Error<"invalid universal character">;
145 def warn_ucn_escape_surrogate : Warning<
146   "universal character name refers to a surrogate character">,
147   InGroup<Unicode>;
148
149 def warn_c99_compat_unicode_id : Warning<
150   "%select{using this character in an identifier|starting an identifier with "
151   "this character}0 is incompatible with C99">,
152   InGroup<C99Compat>, DefaultIgnore;
153 def warn_cxx98_compat_unicode_id : Warning<
154   "using this character in an identifier is incompatible with C++98">,
155   InGroup<CXX98Compat>, DefaultIgnore;
156
157 def warn_cxx98_compat_literal_ucn_escape_basic_scs : Warning<
158   "specifying character '%0' with a universal character name "
159   "is incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
160 def warn_cxx98_compat_literal_ucn_control_character : Warning<
161   "universal character name referring to a control character "
162   "is incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
163 def warn_ucn_not_valid_in_c89 : Warning<
164   "universal character names are only valid in C99 or C++; "
165   "treating as '\\' followed by identifier">, InGroup<Unicode>;
166 def warn_ucn_not_valid_in_c89_literal : ExtWarn<
167   "universal character names are only valid in C99 or C++">, InGroup<Unicode>;
168
169
170 // Literal
171 def ext_nonstandard_escape : Extension<
172   "use of non-standard escape character '\\%0'">;
173 def ext_unknown_escape : ExtWarn<"unknown escape sequence '\\%0'">,
174   InGroup<DiagGroup<"unknown-escape-sequence">>;
175 def err_invalid_digit : Error<
176   "invalid digit '%0' in %select{decimal|octal|binary}1 constant">;
177 def err_invalid_suffix_constant : Error<
178   "invalid suffix '%0' on %select{integer|floating}1 constant">;
179 def warn_cxx11_compat_digit_separator : Warning<
180   "digit separators are incompatible with C++ standards before C++14">,
181   InGroup<CXXPre14Compat>, DefaultIgnore;
182 def err_digit_separator_not_between_digits : Error<
183   "digit separator cannot appear at %select{start|end}0 of digit sequence">;
184 def warn_extraneous_char_constant : Warning<
185   "extraneous characters in character constant ignored">;
186 def warn_char_constant_too_large : Warning<
187   "character constant too long for its type">;
188 def err_multichar_utf_character_literal : Error<
189   "Unicode character literals may not contain multiple characters">;
190 def err_exponent_has_no_digits : Error<"exponent has no digits">;
191 def err_hex_constant_requires : Error<
192   "hexadecimal floating %select{constant|literal}0 requires "
193   "%select{an exponent|a significand}1">;
194 def ext_hex_constant_invalid : Extension<
195   "hexadecimal floating constants are a C99 feature">, InGroup<C99>;
196 def ext_hex_literal_invalid : Extension<
197   "hexadecimal floating literals are a C++17 feature">, InGroup<CXX17>;
198 def warn_cxx17_hex_literal : Warning<
199   "hexadecimal floating literals are incompatible with "
200   "C++ standards before C++17">,
201   InGroup<CXXPre17CompatPedantic>, DefaultIgnore;
202 def ext_binary_literal : Extension<
203   "binary integer literals are a GNU extension">, InGroup<GNUBinaryLiteral>;
204 def ext_binary_literal_cxx14 : Extension<
205   "binary integer literals are a C++14 extension">, InGroup<CXX14BinaryLiteral>;
206 def warn_cxx11_compat_binary_literal : Warning<
207   "binary integer literals are incompatible with C++ standards before C++14">,
208   InGroup<CXXPre14CompatBinaryLiteral>, DefaultIgnore;
209 def err_pascal_string_too_long : Error<"Pascal string is too long">;
210 def err_escape_too_large : Error<
211   "%select{hex|octal}0 escape sequence out of range">;
212 def ext_string_too_long : Extension<"string literal of length %0 exceeds "
213   "maximum length %1 that %select{C90|ISO C99|C++}2 compilers are required to "
214   "support">, InGroup<OverlengthStrings>;
215 def err_character_too_large : Error<
216   "character too large for enclosing character literal type">;
217 def warn_c99_compat_unicode_literal : Warning<
218   "unicode literals are incompatible with C99">,
219   InGroup<C99Compat>, DefaultIgnore;
220 def warn_cxx98_compat_unicode_literal : Warning<
221   "unicode literals are incompatible with C++98">,
222   InGroup<CXX98Compat>, DefaultIgnore;
223 def warn_cxx14_compat_u8_character_literal : Warning<
224   "unicode literals are incompatible with C++ standards before C++17">,
225   InGroup<CXXPre17Compat>, DefaultIgnore;
226 def warn_cxx11_compat_user_defined_literal : Warning<
227   "identifier after literal will be treated as a user-defined literal suffix "
228   "in C++11">, InGroup<CXX11Compat>, DefaultIgnore;
229 def warn_cxx11_compat_reserved_user_defined_literal : Warning<
230   "identifier after literal will be treated as a reserved user-defined literal "
231   "suffix in C++11">,
232   InGroup<CXX11CompatReservedUserDefinedLiteral>, DefaultIgnore;
233 def ext_reserved_user_defined_literal : ExtWarn<
234   "invalid suffix on literal; C++11 requires a space between literal and "
235   "identifier">, InGroup<ReservedUserDefinedLiteral>, DefaultError;
236 def ext_ms_reserved_user_defined_literal : ExtWarn<
237   "invalid suffix on literal; C++11 requires a space between literal and "
238   "identifier">, InGroup<ReservedUserDefinedLiteral>;
239 def err_unsupported_string_concat : Error<
240   "unsupported non-standard concatenation of string literals">;
241 def err_string_concat_mixed_suffix : Error<
242   "differing user-defined suffixes ('%0' and '%1') in string literal "
243   "concatenation">;
244 def err_pp_invalid_udl : Error<
245   "%select{character|integer}0 literal with user-defined suffix "
246   "cannot be used in preprocessor constant expression">;
247 def err_bad_string_encoding : Error<
248   "illegal character encoding in string literal">;
249 def warn_bad_string_encoding : ExtWarn<
250   "illegal character encoding in string literal">,
251   InGroup<InvalidSourceEncoding>;
252 def err_bad_character_encoding : Error<
253   "illegal character encoding in character literal">;
254 def warn_bad_character_encoding : ExtWarn<
255   "illegal character encoding in character literal">,
256   InGroup<InvalidSourceEncoding>;
257 def err_lexing_string : Error<"failure when lexing a string">;
258 def err_placeholder_in_source : Error<"editor placeholder in source file">;
259
260 //===----------------------------------------------------------------------===//
261 // Preprocessor Diagnostics
262 //===----------------------------------------------------------------------===//
263
264 let CategoryName = "User-Defined Issue" in {
265 def pp_hash_warning : Warning<"%0">,
266   InGroup<PoundWarning>, ShowInSystemHeader;
267 def err_pp_hash_error : Error<"%0">;
268 }
269
270 def pp_include_next_in_primary : Warning<
271   "#include_next in primary source file; "
272   "will search from start of include path">,
273   InGroup<DiagGroup<"include-next-outside-header">>;
274 def pp_include_macros_out_of_predefines : Error<
275   "the #__include_macros directive is only for internal use by -imacros">;
276 def pp_include_next_absolute_path : Warning<
277   "#include_next in file found relative to primary source file or found by "
278   "absolute path; will search from start of include path">,
279   InGroup<DiagGroup<"include-next-absolute-path">>;
280 def ext_c99_whitespace_required_after_macro_name : ExtWarn<
281   "ISO C99 requires whitespace after the macro name">, InGroup<C99>;
282 def ext_missing_whitespace_after_macro_name : ExtWarn<
283   "whitespace required after macro name">;
284 def warn_missing_whitespace_after_macro_name : Warning<
285   "whitespace recommended after macro name">;
286
287 class NonportablePath  : Warning<
288   "non-portable path to file '%0'; specified path differs in case from file"
289   " name on disk">;
290 def pp_nonportable_path : NonportablePath,
291   InGroup<DiagGroup<"nonportable-include-path">>;
292 def pp_nonportable_system_path : NonportablePath, DefaultIgnore,
293   InGroup<DiagGroup<"nonportable-system-include-path">>;
294
295 def pp_pragma_once_in_main_file : Warning<"#pragma once in main file">,
296   InGroup<DiagGroup<"pragma-once-outside-header">>;
297 def pp_pragma_sysheader_in_main_file : Warning<
298   "#pragma system_header ignored in main file">,
299   InGroup<DiagGroup<"pragma-system-header-outside-header">>;
300 def pp_poisoning_existing_macro : Warning<"poisoning existing macro">;
301 def pp_out_of_date_dependency : Warning<
302   "current file is older than dependency %0">;
303 def ext_pp_undef_builtin_macro : ExtWarn<"undefining builtin macro">,
304   InGroup<BuiltinMacroRedefined>;
305 def ext_pp_redef_builtin_macro : ExtWarn<"redefining builtin macro">,
306   InGroup<BuiltinMacroRedefined>;
307 def pp_disabled_macro_expansion : Warning<
308   "disabled expansion of recursive macro">, DefaultIgnore,
309   InGroup<DiagGroup<"disabled-macro-expansion">>;
310 def pp_macro_not_used : Warning<"macro is not used">, DefaultIgnore,
311   InGroup<DiagGroup<"unused-macros">>;
312 def warn_pp_undef_identifier : Warning<
313   "%0 is not defined, evaluates to 0">,
314   InGroup<DiagGroup<"undef">>, DefaultIgnore;
315 def warn_pp_ambiguous_macro : Warning<
316   "ambiguous expansion of macro %0">, InGroup<AmbiguousMacro>;
317 def note_pp_ambiguous_macro_chosen : Note<
318   "expanding this definition of %0">;
319 def note_pp_ambiguous_macro_other : Note<
320   "other definition of %0">;
321 def warn_pp_macro_hides_keyword : Extension<
322   "keyword is hidden by macro definition">, InGroup<KeywordAsMacro>;
323 def warn_pp_macro_is_reserved_id : Warning<
324   "macro name is a reserved identifier">, DefaultIgnore,
325   InGroup<ReservedIdAsMacro>;
326 def warn_pp_objc_macro_redef_ignored : Warning<
327   "ignoring redefinition of Objective-C qualifier macro">,
328   InGroup<DiagGroup<"objc-macro-redefinition">>;
329
330 def pp_invalid_string_literal : Warning<
331   "invalid string literal, ignoring final '\\'">;
332 def warn_pp_expr_overflow : Warning<
333   "integer overflow in preprocessor expression">;
334 def warn_pp_convert_to_positive : Warning<
335   "%select{left|right}0 side of operator converted from negative value to "
336   "unsigned: %1">;
337
338 def ext_pp_import_directive : Extension<"#import is a language extension">,
339   InGroup<DiagGroup<"import-preprocessor-directive-pedantic">>;
340 def err_pp_import_directive_ms : Error<
341   "#import of type library is an unsupported Microsoft feature">;
342 def ext_pp_include_search_ms : ExtWarn<
343   "#include resolved using non-portable Microsoft search rules as: %0">,
344   InGroup<MicrosoftInclude>;
345
346 def ext_pp_ident_directive : Extension<"#ident is a language extension">;
347 def ext_pp_include_next_directive : Extension<
348   "#include_next is a language extension">, InGroup<GNUIncludeNext>;
349 def ext_pp_warning_directive : Extension<"#warning is a language extension">;
350
351 def ext_pp_extra_tokens_at_eol : ExtWarn<
352   "extra tokens at end of #%0 directive">, InGroup<ExtraTokens>;
353
354 def ext_pp_comma_expr : Extension<"comma operator in operand of #if">;
355 def ext_pp_bad_vaargs_use : Extension<
356   "__VA_ARGS__ can only appear in the expansion of a C99 variadic macro">;
357
358 def ext_pp_bad_vaopt_use
359     : ExtWarn<
360           "__VA_OPT__ can only appear in the expansion of a variadic macro">,
361       InGroup<VariadicMacros>;
362
363 def err_pp_missing_lparen_in_vaopt_use : Error<
364   "missing '(' following __VA_OPT__">;
365 def err_pp_vaopt_nested_use : Error<
366   "__VA_OPT__ cannot be nested within its own replacement tokens">;
367
368 def err_vaopt_paste_at_start : Error<
369   "'##' cannot appear at start of __VA_OPT__ argument">;
370
371 def err_vaopt_paste_at_end
372     : Error<"'##' cannot appear at end of __VA_OPT__ argument">;
373
374 def ext_pp_macro_redef : ExtWarn<"%0 macro redefined">, InGroup<MacroRedefined>;
375 def ext_variadic_macro : Extension<"variadic macros are a C99 feature">,
376   InGroup<VariadicMacros>;
377 def warn_cxx98_compat_variadic_macro : Warning<
378   "variadic macros are incompatible with C++98">,
379   InGroup<CXX98CompatPedantic>, DefaultIgnore;
380 def ext_named_variadic_macro : Extension<
381   "named variadic macros are a GNU extension">, InGroup<VariadicMacros>;
382 def err_embedded_directive : Error<
383   "embedding a #%0 directive within macro arguments is not supported">;
384 def ext_embedded_directive : Extension<
385   "embedding a directive within macro arguments has undefined behavior">,
386   InGroup<DiagGroup<"embedded-directive">>;
387 def ext_missing_varargs_arg : Extension<
388   "must specify at least one argument for '...' parameter of variadic macro">,
389   InGroup<GNUZeroVariadicMacroArguments>;
390 def ext_empty_fnmacro_arg : Extension<
391   "empty macro arguments are a C99 feature">, InGroup<C99>;
392 def warn_cxx98_compat_empty_fnmacro_arg : Warning<
393   "empty macro arguments are incompatible with C++98">,
394   InGroup<CXX98CompatPedantic>, DefaultIgnore;
395 def note_macro_here : Note<"macro %0 defined here">;
396 def note_macro_expansion_here : Note<"expansion of macro %0 requested here">;
397
398 def ext_pp_opencl_variadic_macros : Extension<
399   "variadic macros are a Clang extension in OpenCL">;
400
401 def err_pp_invalid_directive : Error<"invalid preprocessing directive">;
402 def err_pp_directive_required : Error<
403   "%0 must be used within a preprocessing directive">;
404 def err_pp_file_not_found : Error<"'%0' file not found">, DefaultFatal;
405 def err_pp_through_header_not_found : Error<
406   "'%0' required for precompiled header not found">, DefaultFatal;
407 def err_pp_through_header_not_seen : Error<
408   "#include of '%0' not seen while attempting to "
409   "%select{create|use}1 precompiled header">, DefaultFatal;
410 def err_pp_pragma_hdrstop_not_seen : Error<
411   "#pragma hdrstop not seen while attempting to use precompiled header">,
412   DefaultFatal;
413 def warn_pp_macro_def_mismatch_with_pch : Warning<
414   "definition of macro %0 does not match definition in precompiled header">,
415   InGroup<ClangClPch>;
416 def warn_pp_hdrstop_filename_ignored : Warning<
417   "#pragma hdrstop filename not supported, "
418   "/Fp can be used to specify precompiled header filename">,
419   InGroup<ClangClPch>;
420 def err_pp_file_not_found_angled_include_not_fatal : Error<
421   "'%0' file not found with <angled> %select{include|import}1; "
422   "use \"quotes\" instead">;
423 def err_pp_file_not_found_typo_not_fatal
424     : Error<"'%0' file not found, did you mean '%1'?">;
425 def note_pp_framework_without_header : Note<
426   "did not find header '%0' in framework '%1' (loaded from '%2')">;
427 def err_pp_error_opening_file : Error<
428   "error opening file '%0': %1">, DefaultFatal;
429 def err_pp_including_mainfile_in_preamble : Error<
430   "main file cannot be included recursively when building a preamble">;
431 def err_pp_empty_filename : Error<"empty filename">;
432 def err_pp_include_too_deep : Error<"#include nested too deeply">;
433 def err_pp_expects_filename : Error<"expected \"FILENAME\" or <FILENAME>">;
434 def err_pp_macro_not_identifier : Error<"macro name must be an identifier">;
435 def err_pp_missing_macro_name : Error<"macro name missing">;
436 def err_pp_missing_rparen_in_macro_def : Error<
437   "missing ')' in macro parameter list">;
438 def err_pp_invalid_tok_in_arg_list : Error<
439   "invalid token in macro parameter list">;
440 def err_pp_expected_ident_in_arg_list : Error<
441   "expected identifier in macro parameter list">;
442 def err_pp_expected_comma_in_arg_list : Error<
443   "expected comma in macro parameter list">;
444 def err_pp_duplicate_name_in_arg_list : Error<
445   "duplicate macro parameter name %0">;
446 def err_pp_stringize_not_parameter : Error<
447   "'%select{#|#@}0' is not followed by a macro parameter">;
448 def err_pp_malformed_ident : Error<"invalid #ident directive">;
449 def err_pp_unterminated_conditional : Error<
450   "unterminated conditional directive">;
451 def pp_err_else_after_else : Error<"#else after #else">;
452 def pp_err_elif_after_else : Error<"#elif after #else">;
453 def pp_err_else_without_if : Error<"#else without #if">;
454 def pp_err_elif_without_if : Error<"#elif without #if">;
455 def err_pp_endif_without_if : Error<"#endif without #if">;
456 def err_pp_expected_value_in_expr : Error<"expected value in expression">;
457 def err_pp_expected_rparen : Error<"expected ')' in preprocessor expression">;
458 def err_pp_expected_eol : Error<
459   "expected end of line in preprocessor expression">;
460 def err_pp_expected_after : Error<"missing %1 after %0">;
461 def err_pp_nested_paren : Error<"nested parentheses not permitted in %0">;
462 def err_pp_colon_without_question : Error<"':' without preceding '?'">;
463 def err_pp_division_by_zero : Error<
464   "division by zero in preprocessor expression">;
465 def err_pp_remainder_by_zero : Error<
466   "remainder by zero in preprocessor expression">;
467 def err_pp_expr_bad_token_binop : Error<
468   "token is not a valid binary operator in a preprocessor subexpression">;
469 def err_pp_expr_bad_token_lparen : Error<
470   "function-like macro %0 is not defined">;
471 def err_pp_expr_bad_token_start_expr : Error<
472   "invalid token at start of a preprocessor expression">;
473 def err_pp_invalid_poison : Error<"can only poison identifier tokens">;
474 def err_pp_used_poisoned_id : Error<"attempt to use a poisoned identifier">;
475
476 def err_feature_check_malformed : Error<
477   "builtin feature check macro requires a parenthesized identifier">;
478
479 def warn_has_warning_invalid_option :
480    ExtWarn<"__has_warning expected option name (e.g. \"-Wundef\")">,
481    InGroup<MalformedWarningCheck>;
482
483 def err_pp_identifier_arg_not_identifier : Error<
484   "cannot convert %0 token to an identifier">;
485
486 def warn_pragma_include_alias_mismatch_angle :
487    ExtWarn<"angle-bracketed include <%0> cannot be aliased to double-quoted "
488    "include \"%1\"">, InGroup<UnknownPragmas>;
489 def warn_pragma_include_alias_mismatch_quote :
490    ExtWarn<"double-quoted include \"%0\" cannot be aliased to angle-bracketed "
491    "include <%1>">, InGroup<UnknownPragmas>;
492 def warn_pragma_include_alias_expected :
493    ExtWarn<"pragma include_alias expected '%0'">,
494    InGroup<UnknownPragmas>;
495 def warn_pragma_include_alias_expected_filename :
496    ExtWarn<"pragma include_alias expected include filename">,
497    InGroup<UnknownPragmas>;
498
499 // - #pragma warning(...)
500 def warn_pragma_warning_expected :
501   ExtWarn<"#pragma warning expected '%0'">,
502   InGroup<UnknownPragmas>;
503 def warn_pragma_warning_spec_invalid :
504   ExtWarn<"#pragma warning expected 'push', 'pop', 'default', 'disable',"
505           " 'error', 'once', 'suppress', 1, 2, 3, or 4">,
506   InGroup<UnknownPragmas>;
507 def warn_pragma_warning_push_level :
508   ExtWarn<"#pragma warning(push, level) requires a level between 0 and 4">,
509   InGroup<UnknownPragmas>;
510 def warn_pragma_warning_expected_number :
511   ExtWarn<"#pragma warning expected a warning number">,
512   InGroup<UnknownPragmas>;
513
514 // - #pragma execution_character_set(...)
515 def warn_pragma_exec_charset_expected :
516   ExtWarn<"#pragma execution_character_set expected '%0'">,
517   InGroup<UnknownPragmas>;
518 def warn_pragma_exec_charset_spec_invalid :
519   ExtWarn<"#pragma execution_character_set expected 'push' or 'pop'">,
520   InGroup<UnknownPragmas>;
521 def warn_pragma_exec_charset_push_invalid :
522    ExtWarn<"#pragma execution_character_set invalid value '%0', only 'UTF-8' is supported">,
523    InGroup<UnknownPragmas>;
524
525 def err__Pragma_malformed : Error<
526   "_Pragma takes a parenthesized string literal">;
527 def err_pragma_message_malformed : Error<
528   "pragma %select{message|warning|error}0 requires parenthesized string">;
529 def err_pragma_push_pop_macro_malformed : Error<
530    "pragma %0 requires a parenthesized string">;
531 def warn_pragma_pop_macro_no_push : Warning<
532    "pragma pop_macro could not pop '%0', no matching push_macro">,
533   InGroup<IgnoredPragmas>;
534 def warn_pragma_message : Warning<"%0">,
535    InGroup<PoundPragmaMessage>, DefaultWarnNoWerror;
536 def err_pragma_message : Error<"%0">;
537 def warn_pragma_ignored : Warning<"unknown pragma ignored">,
538    InGroup<UnknownPragmas>, DefaultIgnore;
539 def ext_on_off_switch_syntax :
540    ExtWarn<"expected 'ON' or 'OFF' or 'DEFAULT' in pragma">,
541    InGroup<UnknownPragmas>;
542 def ext_pragma_syntax_eod :
543    ExtWarn<"expected end of directive in pragma">,
544    InGroup<UnknownPragmas>;
545 def warn_pragma_diagnostic_invalid :
546    ExtWarn<"pragma diagnostic expected 'error', 'warning', 'ignored', 'fatal',"
547             " 'push', or 'pop'">,
548    InGroup<UnknownPragmas>;
549 def warn_pragma_diagnostic_cannot_pop :
550    ExtWarn<"pragma diagnostic pop could not pop, no matching push">,
551    InGroup<UnknownPragmas>;
552 def warn_pragma_diagnostic_invalid_option :
553    ExtWarn<"pragma diagnostic expected option name (e.g. \"-Wundef\")">,
554    InGroup<UnknownPragmas>;
555 def warn_pragma_diagnostic_invalid_token :
556    ExtWarn<"unexpected token in pragma diagnostic">,
557    InGroup<UnknownPragmas>;
558 def warn_pragma_diagnostic_unknown_warning :
559    ExtWarn<"unknown warning group '%0', ignored">,
560    InGroup<UnknownWarningOption>;
561 // - #pragma __debug
562 def warn_pragma_debug_unexpected_command : Warning<
563   "unexpected debug command '%0'">, InGroup<IgnoredPragmas>;
564 def warn_pragma_debug_missing_argument : Warning<
565   "missing argument to debug command '%0'">, InGroup<IgnoredPragmas>;
566 def warn_pragma_debug_unknown_module : Warning<
567   "unknown module '%0'">, InGroup<IgnoredPragmas>;
568 // #pragma module
569 def err_pp_expected_module_name : Error<
570   "expected %select{identifier after '.' in |}0module name">;
571 def err_pp_module_begin_wrong_module : Error<
572   "must specify '-fmodule-name=%0' to enter %select{|submodule of }1"
573   "this module%select{ (current module is %3)|}2">;
574 def err_pp_module_begin_no_module_map : Error<
575   "no module map available for module %0">;
576 def err_pp_module_begin_no_submodule : Error<
577   "submodule %0.%1 not declared in module map">;
578 def err_pp_module_begin_without_module_end : Error<
579   "no matching '#pragma clang module end' for this "
580   "'#pragma clang module begin'">;
581 def err_pp_module_end_without_module_begin : Error<
582   "no matching '#pragma clang module begin' for this "
583   "'#pragma clang module end'">;
584 def note_pp_module_begin_here : Note<
585   "entering module '%0' due to this pragma">;
586 def err_pp_module_build_missing_end : Error<
587   "no matching '#pragma clang module endbuild' for this '#pragma clang module build'">;
588
589 def err_defined_macro_name : Error<"'defined' cannot be used as a macro name">;
590 def err_paste_at_start : Error<
591   "'##' cannot appear at start of macro expansion">;
592 def err_paste_at_end : Error<"'##' cannot appear at end of macro expansion">;
593 def ext_paste_comma : Extension<
594   "token pasting of ',' and __VA_ARGS__ is a GNU extension">, InGroup<GNUZeroVariadicMacroArguments>;
595 def err_unterm_macro_invoc : Error<
596   "unterminated function-like macro invocation">;
597 def err_too_many_args_in_macro_invoc : Error<
598   "too many arguments provided to function-like macro invocation">;
599 def note_suggest_parens_for_macro : Note<
600   "parentheses are required around macro argument containing braced "
601   "initializer list">;
602 def note_init_list_at_beginning_of_macro_argument : Note<
603   "cannot use initializer list at the beginning of a macro argument">;
604 def err_too_few_args_in_macro_invoc : Error<
605   "too few arguments provided to function-like macro invocation">;
606 def err_pp_bad_paste : Error<
607   "pasting formed '%0', an invalid preprocessing token">;
608 def ext_pp_bad_paste_ms : ExtWarn<
609   "pasting formed '%0', an invalid preprocessing token">, DefaultError,
610   InGroup<DiagGroup<"invalid-token-paste">>;
611 def err_pp_operator_used_as_macro_name : Error<
612   "C++ operator %0 (aka %1) used as a macro name">;
613 def ext_pp_operator_used_as_macro_name : Extension<
614   err_pp_operator_used_as_macro_name.Text>, InGroup<MicrosoftCppMacro>;
615 def err_pp_illegal_floating_literal : Error<
616   "floating point literal in preprocessor expression">;
617 def err_pp_line_requires_integer : Error<
618   "#line directive requires a positive integer argument">;
619 def ext_pp_line_zero : Extension<
620   "#line directive with zero argument is a GNU extension">,
621   InGroup<GNUZeroLineDirective>;
622 def err_pp_line_invalid_filename : Error<
623   "invalid filename for #line directive">;
624 def warn_pp_line_decimal : Warning<
625   "%select{#line|GNU line marker}0 directive interprets number as decimal, not octal">;
626 def err_pp_line_digit_sequence : Error<
627   "%select{#line|GNU line marker}0 directive requires a simple digit sequence">;
628 def err_pp_linemarker_requires_integer : Error<
629   "line marker directive requires a positive integer argument">;
630 def err_pp_linemarker_invalid_filename : Error<
631   "invalid filename for line marker directive">;
632 def err_pp_linemarker_invalid_flag : Error<
633   "invalid flag line marker directive">;
634 def err_pp_linemarker_invalid_pop : Error<
635   "invalid line marker flag '2': cannot pop empty include stack">;
636 def ext_pp_line_too_big : Extension<
637   "C requires #line number to be less than %0, allowed as extension">;
638 def warn_cxx98_compat_pp_line_too_big : Warning<
639   "#line number greater than 32767 is incompatible with C++98">,
640   InGroup<CXX98CompatPedantic>, DefaultIgnore;
641
642 def err_pp_visibility_non_macro : Error<"no macro named %0">;
643
644 def err_pp_arc_cf_code_audited_syntax : Error<"expected 'begin' or 'end'">;
645 def err_pp_double_begin_of_arc_cf_code_audited : Error<
646   "already inside '#pragma clang arc_cf_code_audited'">;
647 def err_pp_unmatched_end_of_arc_cf_code_audited : Error<
648   "not currently inside '#pragma clang arc_cf_code_audited'">;
649 def err_pp_include_in_arc_cf_code_audited : Error<
650   "cannot %select{#include files|import headers}0 "
651   "inside '#pragma clang arc_cf_code_audited'">;
652 def err_pp_eof_in_arc_cf_code_audited : Error<
653   "'#pragma clang arc_cf_code_audited' was not ended within this file">;
654
655 def warn_pp_date_time : Warning<
656   "expansion of date or time macro is not reproducible">,
657   ShowInSystemHeader, DefaultIgnore, InGroup<DiagGroup<"date-time">>;
658
659 // Module map parsing
660 def err_mmap_unknown_token : Error<"skipping stray token">;
661 def err_mmap_expected_module : Error<"expected module declaration">;
662 def err_mmap_expected_module_name : Error<"expected module name">;
663 def err_mmap_expected_lbrace : Error<"expected '{' to start module '%0'">;
664 def err_mmap_expected_rbrace : Error<"expected '}'">;
665 def note_mmap_lbrace_match : Note<"to match this '{'">;
666 def err_mmap_expected_rsquare : Error<"expected ']' to close attribute">;
667 def note_mmap_lsquare_match : Note<"to match this ']'">;
668 def err_mmap_expected_member : Error<
669   "expected umbrella, header, submodule, or module export">;
670 def err_mmap_expected_header : Error<"expected a header name after '%0'">;
671 def err_mmap_expected_mmap_file : Error<"expected a module map file name">;
672 def err_mmap_module_redefinition : Error<
673   "redefinition of module '%0'">;
674 def note_mmap_prev_definition : Note<"previously defined here">;
675 def err_mmap_umbrella_clash : Error<
676   "umbrella for module '%0' already covers this directory">;
677 def err_mmap_module_id : Error<
678   "expected a module name or '*'">;
679 def err_mmap_expected_library_name : Error<
680   "expected %select{library|framework}0 name as a string">;
681 def err_mmap_config_macro_submodule : Error<
682   "configuration macros are only allowed in top-level modules">;
683 def err_mmap_use_decl_submodule : Error<
684   "use declarations are only allowed in top-level modules">;
685 def err_mmap_expected_config_macro : Error<
686   "expected configuration macro name after ','">;
687 def err_mmap_expected_conflicts_comma : Error<
688   "expected ',' after conflicting module name">;
689 def err_mmap_expected_conflicts_message : Error<
690   "expected a message describing the conflict with '%0'">;
691 def err_mmap_missing_module_unqualified : Error<
692   "no module named '%0' visible from '%1'">;
693 def err_mmap_missing_module_qualified : Error<
694   "no module named '%0' in '%1'">;
695 def err_mmap_top_level_inferred_submodule : Error<
696   "only submodules and framework modules may be inferred with wildcard syntax">;
697 def err_mmap_inferred_no_umbrella : Error<
698   "inferred submodules require a module with an umbrella">;
699 def err_mmap_inferred_framework_submodule : Error<
700   "inferred submodule cannot be a framework submodule">;
701 def err_mmap_explicit_inferred_framework : Error<
702   "inferred framework modules cannot be 'explicit'">;
703 def err_mmap_missing_exclude_name : Error<
704   "expected excluded module name">;
705 def err_mmap_inferred_redef : Error<
706   "redefinition of inferred submodule">;
707 def err_mmap_expected_lbrace_wildcard : Error<
708   "expected '{' to start inferred submodule">;
709 def err_mmap_expected_inferred_member : Error<
710   "expected %select{module exclusion with 'exclude'|'export *'}0">;
711 def err_mmap_expected_export_wildcard : Error<
712   "only '*' can be exported from an inferred submodule">;
713 def err_mmap_explicit_top_level : Error<
714   "'explicit' is not permitted on top-level modules">;
715 def err_mmap_nested_submodule_id : Error<
716   "qualified module name can only be used to define modules at the top level">;
717 def err_mmap_expected_feature : Error<"expected a feature name">;
718 def err_mmap_expected_attribute : Error<"expected an attribute name">;
719 def warn_mmap_unknown_attribute : Warning<"unknown attribute '%0'">,
720   InGroup<IgnoredAttributes>;
721 def warn_mmap_mismatched_private_submodule : Warning<
722   "private submodule '%0' in private module map, expected top-level module">,
723   InGroup<PrivateModule>;
724 def warn_mmap_mismatched_private_module_name : Warning<
725   "expected canonical name for private module '%0'">,
726   InGroup<PrivateModule>;
727 def note_mmap_rename_top_level_private_module : Note<
728   "rename '%0' to ensure it can be found by name">;
729 def warn_mmap_incomplete_framework_module_declaration : Warning<
730   "skipping '%0' because module declaration of '%1' lacks the 'framework' qualifier">,
731   InGroup<IncompleteFrameworkModuleDeclaration>;
732 def note_mmap_add_framework_keyword : Note<
733   "use 'framework module' to declare module '%0'">;
734
735 def err_mmap_duplicate_header_attribute : Error<
736   "header attribute '%0' specified multiple times">;
737 def err_mmap_invalid_header_attribute_value : Error<
738   "expected integer literal as value for header attribute '%0'">;
739 def err_mmap_expected_header_attribute : Error<
740   "expected a header attribute name ('size' or 'mtime')">;
741 def err_mmap_conflicting_export_as : Error<
742   "conflicting re-export of module '%0' as '%1' or '%2'">;
743 def warn_mmap_redundant_export_as : Warning<
744   "module '%0' already re-exported as '%1'">,
745   InGroup<PrivateModule>;
746 def err_mmap_submodule_export_as : Error<
747   "only top-level modules can be re-exported as public">;
748
749 def warn_quoted_include_in_framework_header : Warning<
750   "double-quoted include \"%0\" in framework header, "
751   "expected angle-bracketed instead"
752   >, InGroup<FrameworkHdrQuotedInclude>, DefaultIgnore;
753 def warn_framework_include_private_from_public : Warning<
754   "public framework header includes private framework header '%0'"
755   >, InGroup<FrameworkIncludePrivateFromPublic>;
756
757 def warn_auto_module_import : Warning<
758   "treating #%select{include|import|include_next|__include_macros}0 as an "
759   "import of module '%1'">, InGroup<AutoImport>, DefaultIgnore;
760 def note_implicit_top_level_module_import_here : Note<
761   "submodule of top-level module '%0' implicitly imported here">;
762 def warn_uncovered_module_header : Warning<
763   "umbrella header for module '%0' does not include header '%1'">,
764   InGroup<IncompleteUmbrella>;
765 def warn_mmap_umbrella_dir_not_found : Warning<
766   "umbrella directory '%0' not found">,
767   InGroup<IncompleteUmbrella>;
768 def err_expected_id_building_module : Error<
769   "expected a module name in '__building_module' expression">;
770 def warn_use_of_private_header_outside_module : Warning<
771   "use of private header from outside its module: '%0'">,
772   InGroup<DiagGroup<"private-header">>, DefaultError;
773 def err_undeclared_use_of_module : Error<
774   "module %0 does not depend on a module exporting '%1'">;
775 def warn_non_modular_include_in_framework_module : Warning<
776   "include of non-modular header inside framework module '%0': '%1'">,
777   InGroup<NonModularIncludeInFrameworkModule>, DefaultIgnore;
778 def warn_non_modular_include_in_module : Warning<
779   "include of non-modular header inside module '%0': '%1'">,
780   InGroup<NonModularIncludeInModule>, DefaultIgnore;
781 def warn_module_conflict : Warning<
782   "module '%0' conflicts with already-imported module '%1': %2">,
783   InGroup<ModuleConflict>;
784
785 // C++20 modules
786 def err_header_import_semi_in_macro : Error<
787   "semicolon terminating header import declaration cannot be produced "
788   "by a macro">;
789 def err_header_import_not_header_unit : Error<
790   "header file %0 (aka '%1') cannot be imported because "
791   "it is not known to be a header unit">;
792
793 def warn_header_guard : Warning<
794   "%0 is used as a header guard here, followed by #define of a different macro">,
795   InGroup<DiagGroup<"header-guard">>;
796 def note_header_guard : Note<
797   "%0 is defined here; did you mean %1?">;
798
799 def warn_defined_in_object_type_macro : Warning<
800   "macro expansion producing 'defined' has undefined behavior">,
801   InGroup<ExpansionToDefined>;
802 def warn_defined_in_function_type_macro : Extension<
803   "macro expansion producing 'defined' has undefined behavior">,
804   InGroup<ExpansionToDefined>;
805
806 let CategoryName = "Nullability Issue" in {
807
808 def err_pp_assume_nonnull_syntax : Error<"expected 'begin' or 'end'">;
809 def err_pp_double_begin_of_assume_nonnull : Error<
810   "already inside '#pragma clang assume_nonnull'">;
811 def err_pp_unmatched_end_of_assume_nonnull : Error<
812   "not currently inside '#pragma clang assume_nonnull'">;
813 def err_pp_include_in_assume_nonnull : Error<
814   "cannot %select{#include files|import headers}0 "
815   "inside '#pragma clang assume_nonnull'">;
816 def err_pp_eof_in_assume_nonnull : Error<
817   "'#pragma clang assume_nonnull' was not ended within this file">;
818
819 }
820
821 let CategoryName = "Dependency Directive Source Minimization Issue" in {
822
823 def err_dep_source_minimizer_missing_sema_after_at_import : Error<
824   "could not find ';' after @import">;
825 def err_dep_source_minimizer_unexpected_tokens_at_import : Error<
826   "unexpected extra tokens at end of @import declaration">;
827
828 }
829
830 }