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