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