]> granicus.if.org Git - clang/blob - include/clang/Basic/DiagnosticKinds.def
make some diagnostics more terse, update testcases.
[clang] / include / clang / Basic / DiagnosticKinds.def
1 //===-- DiagnosticKinds.def - C Family Diagnostic Kind Database -*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 //  This file defines the DiagnosticKind database.
11 //
12 //===----------------------------------------------------------------------===//
13
14 // Flags for diagnostic:
15 //
16 //   DIAG_TYPE - Allows one of:
17 //     NOTE      - Informational message.
18 //     WARNING   - Warning.
19 //     EXTENSION - Notification that an extension to the language is being used.
20 //     ERROR     - Error, compilation will stop after parsing completes.
21
22 //===----------------------------------------------------------------------===//
23 // Portability
24 //===----------------------------------------------------------------------===//
25
26 DIAG(port_target_macro_use, NOTE,
27      "use of a target-specific macro, source is not 'portable'")
28
29 DIAG(port_target_builtin_use, NOTE,
30      "use of a target-specific builtin function, source is not 'portable'")
31
32 DIAG(port_wchar_t, NOTE,
33      "sizeof(wchar_t) varies between targets, source is not 'portable'")
34
35 //===----------------------------------------------------------------------===//
36 // Lexer Diagnostics
37 //===----------------------------------------------------------------------===//
38
39 DIAG(null_in_string, WARNING,
40      "null character(s) preserved in string literal")
41 DIAG(null_in_char  , WARNING,
42      "null character(s) preserved in character literal")
43 DIAG(null_in_file  , WARNING,
44      "null character ignored")
45 DIAG(nested_block_comment, WARNING,
46      "\"/*\" within block comment")
47 DIAG(escaped_newline_block_comment_end, WARNING,
48      "escaped newline between */ characters at block comment end")
49 DIAG(backslash_newline_space, WARNING,
50      "backslash and newline separated by space")
51
52 // Trigraphs.
53 DIAG(trigraph_ignored, WARNING, "trigraph ignored")
54 DIAG(trigraph_ignored_block_comment, WARNING,
55      "ignored trigraph would end block comment")
56 DIAG(trigraph_ends_block_comment, WARNING,
57      "trigraph ends block comment")
58 DIAG(trigraph_converted, WARNING,
59      "trigraph converted to '%0' character")
60
61 DIAG(ext_multi_line_bcpl_comment, EXTENSION,
62      "multi-line // comment")
63 DIAG(ext_bcpl_comment, EXTENSION,
64      "// comments are not allowed in this language")
65 DIAG(ext_no_newline_eof, EXTENSION,
66      "no newline at end of file")
67 DIAG(ext_backslash_newline_eof, EXTENSION,
68      "backslash-newline at end of file")
69 DIAG(ext_dollar_in_identifier, EXTENSION,
70      "'$' in identifier")
71 DIAG(charize_microsoft_ext, EXTENSION,
72      "@# is a microsoft extension")
73
74 DIAG(ext_token_used, EXTENSION,
75      "extension used")
76
77 DIAG(err_unterminated_string, ERROR,
78      "missing terminating \" character")
79 DIAG(err_unterminated_char, ERROR,
80      "missing terminating ' character")
81 DIAG(err_empty_character, ERROR,
82      "empty character constant")
83 DIAG(err_unterminated_block_comment, ERROR,
84      "unterminated /* comment")
85 DIAG(err_invalid_character_to_charify, ERROR,
86      "invalid argument to convert to character")
87
88 //===----------------------------------------------------------------------===//
89 // Preprocessor Diagnostics
90 //===----------------------------------------------------------------------===//
91
92 DIAG(pp_hash_warning, WARNING,
93      "#warning%0")
94 DIAG(pp_include_next_in_primary, WARNING,
95      "#include_next in primary source file")
96 DIAG(pp_include_next_absolute_path, WARNING,
97      "#include_next with absolute path")
98 DIAG(ext_c99_whitespace_required_after_macro_name, WARNING,
99      "ISO C99 requires whitespace after the macro name")
100 DIAG(pp_pragma_once_in_main_file, WARNING,
101      "#pragma once in main file")
102 DIAG(pp_pragma_sysheader_in_main_file, WARNING,
103      "#pragma system_header ignored in main file")
104 DIAG(pp_poisoning_existing_macro, WARNING,
105      "poisoning existing macro")
106 DIAG(pp_out_of_date_dependency, WARNING,
107      "current file is older than dependency %0")
108 DIAG(pp_undef_builtin_macro, WARNING,
109      "undefining builtin macro")
110 DIAG(pp_redef_builtin_macro, WARNING,
111      "redefining builtin macro")
112 DIAG(pp_macro_not_used, WARNING,    // -Wunused-macros
113      "macro is not used")
114 DIAG(pp_invalid_string_literal, WARNING,
115      "invalid string literal, ignoring final '\\'")
116 DIAG(warn_pp_expr_overflow, WARNING,
117      "integer overflow in preprocessor expression")
118 DIAG(warn_pp_convert_lhs_to_positive, WARNING,
119      "left side of operator converted from negative value to unsigned: %0")
120 DIAG(warn_pp_convert_rhs_to_positive, WARNING,
121      "right side of operator converted from negative value to unsigned: %0")
122
123 DIAG(ext_pp_import_directive, EXTENSION,
124      "#import is a language extension")
125 DIAG(ext_pp_ident_directive, EXTENSION,
126      "#ident is a language extension")
127 DIAG(ext_pp_include_next_directive, EXTENSION,
128      "#include_next is a language extension")
129 DIAG(ext_pp_warning_directive, EXTENSION,
130      "#warning is a language extension")
131 DIAG(ext_pp_extra_tokens_at_eol, EXTENSION,
132      "extra tokens at end of %0 directive")
133 DIAG(ext_pp_comma_expr, EXTENSION,
134      "comma operator in operand of #if")
135 DIAG(ext_pp_bad_vaargs_use, EXTENSION,
136      "__VA_ARGS__ can only appear in the expansion of a C99 variadic macro")
137 DIAG(ext_pp_macro_redef, EXTENSION,
138      "\"%0\" macro redefined")
139 DIAG(ext_pp_macro_redef2, EXTENSION,
140      "this is previous definition")
141 DIAG(ext_variadic_macro, EXTENSION,
142      "variadic macros were introduced in C99")
143 DIAG(ext_named_variadic_macro, EXTENSION,
144      "named variadic macros are a GNU extension")
145 DIAG(ext_embedded_directive, EXTENSION,
146      "embedding a directive within macro arguments is not portable")
147 DIAG(ext_missing_varargs_arg, EXTENSION,
148      "varargs argument missing, but tolerated as an extension")
149 DIAG(ext_empty_fnmacro_arg, EXTENSION,
150      "empty macro arguments were standardized in C99")
151
152 DIAG(ext_pp_base_file, EXTENSION,
153      "__BASE_FILE__ is a language extension")
154 DIAG(ext_pp_include_level, EXTENSION,
155      "__INCLUDE_LEVEL__ is a language extension")
156 DIAG(ext_pp_timestamp, EXTENSION,
157      "__TIMESTAMP__ is a language extension")
158
159 DIAG(err_pp_invalid_directive, ERROR,
160      "invalid preprocessing directive")
161 DIAG(err_pp_hash_error, ERROR,
162      "#error%0")
163 DIAG(err_pp_file_not_found, ERROR,
164      "'%0' file not found")
165 DIAG(err_pp_empty_filename, ERROR,
166      "empty filename")
167 DIAG(err_pp_include_too_deep, ERROR,
168      "#include nested too deeply")
169 DIAG(err_pp_expects_filename, ERROR,
170      "expected \"FILENAME\" or <FILENAME>")
171 DIAG(err_pp_macro_not_identifier, ERROR,
172      "macro names must be identifiers")
173 DIAG(err_pp_missing_macro_name, ERROR,
174      "macro name missing")
175 DIAG(err_pp_missing_rparen_in_macro_def, ERROR,
176      "missing ')' in macro parameter list")
177 DIAG(err_pp_invalid_tok_in_arg_list, ERROR,
178      "invalid token in macro parameter list")
179 DIAG(err_pp_expected_ident_in_arg_list, ERROR,
180      "expected identifier in macro parameter list")
181 DIAG(err_pp_expected_comma_in_arg_list, ERROR,
182      "expected comma in macro parameter list")
183 DIAG(err_pp_duplicate_name_in_arg_list, ERROR,
184      "duplicate macro parameter name \"%0\"")
185 DIAG(err_pp_stringize_not_parameter, ERROR,
186      "'#' is not followed by a macro parameter")
187 DIAG(err_pp_malformed_ident, ERROR,
188      "invalid #ident directive")
189 DIAG(err_pp_unterminated_conditional, ERROR,
190      "unterminated conditional directive")
191 DIAG(pp_err_else_after_else, ERROR,
192      "#else after #else")
193 DIAG(pp_err_elif_after_else, ERROR,
194      "#elif after #else")
195 DIAG(pp_err_else_without_if, ERROR,
196      "#else without #if")
197 DIAG(pp_err_elif_without_if, ERROR,
198      "#elif without #if")
199 DIAG(err_pp_endif_without_if, ERROR,
200      "#endif without #if")
201 DIAG(err_pp_expected_value_in_expr, ERROR,
202      "expected value in expression")
203 DIAG(err_pp_missing_val_before_operator, ERROR,
204      "missing value before operator")
205 DIAG(err_pp_expected_rparen, ERROR,
206      "expected ')' in preprocessor expression")
207 DIAG(err_pp_expected_eol, ERROR,
208      "expected end of line in preprocessor expression")
209 DIAG(warn_pp_undef_identifier, WARNING,
210      "\"%0\" is not defined, evaluates to 0")
211 DIAG(err_pp_defined_requires_identifier, ERROR,
212      "operator \"defined\" requires an identifier")
213 DIAG(err_pp_missing_rparen, ERROR,
214      "missing ')' after \"defined\"")
215 DIAG(err_pp_colon_without_question, ERROR,
216      "':' without preceding '?'")
217 DIAG(err_pp_question_without_colon, ERROR,
218      "'?' without following ':'")
219 DIAG(err_pp_division_by_zero, ERROR,
220      "division by zero in preprocessor expression")
221 DIAG(err_pp_remainder_by_zero, ERROR,
222      "remainder by zero in preprocessor expression")
223 DIAG(err_pp_expr_bad_token, ERROR,
224      "token is not valid in preprocessor expressions")
225 DIAG(err_pp_invalid_poison, ERROR,
226      "can only poison identifier tokens")
227 DIAG(err_pp_used_poisoned_id, ERROR,
228      "attempt to use a poisoned identifier")
229 DIAG(err__Pragma_malformed, ERROR,
230      "_Pragma takes a parenthesized string literal")
231 DIAG(err_defined_macro_name, ERROR,
232      "\"defined\" cannot be used as a macro name")
233 DIAG(err_paste_at_start, ERROR,
234      "\"##\" cannot appear at start of macro expansion")
235 DIAG(err_paste_at_end, ERROR,
236      "\"##\" cannot appear at end of macro expansion")
237 DIAG(ext_paste_comma, EXTENSION,
238      "Use of comma pasting extension is non-portable")
239 DIAG(err_unterm_macro_invoc, ERROR,
240      "unterminated function-like macro invocation")
241 DIAG(err_too_many_args_in_macro_invoc, ERROR,
242      "too many arguments provided to function-like macro invocation")
243 DIAG(err_too_few_args_in_macro_invoc, ERROR,
244      "too few arguments provided to function-like macro invocation")
245 DIAG(err_pp_bad_paste, ERROR,
246      "pasting formed \"%0\", an invalid preprocessing token")
247 DIAG(err_pp_operator_used_as_macro_name, ERROR,
248      "C++ operator \"%0\" cannot be used as a macro name")
249 DIAG(err_pp_illegal_floating_literal, ERROR,
250      "floating point literal in preprocessor expression")
251
252 // Should be a sorry?
253 DIAG(err_pp_I_dash_not_supported, ERROR,
254      "-I- not supported, please use -iquote instead")
255      
256 //===----------------------------------------------------------------------===//
257 // Parser Diagnostics
258 //===----------------------------------------------------------------------===//
259
260 DIAG(w_type_defaults_to_int, WARNING,
261      "type defaults to 'int'")
262 DIAG(w_no_declarators, WARNING,
263      "declaration does not declare anything")
264 DIAG(w_asm_qualifier_ignored, WARNING,
265      "ignored %0 qualifier on asm")
266
267 DIAG(ext_empty_source_file, EXTENSION,
268      "ISO C forbids an empty source file")
269 DIAG(ext_top_level_semi, EXTENSION,
270      "ISO C does not allow an extra ';' outside of a function")
271 DIAG(ext_extra_struct_semi, EXTENSION,
272      "ISO C does not allow an extra ';' inside a struct or union")
273 DIAG(ext_duplicate_declspec, EXTENSION,
274      "duplicate '%0' declaration specifier")
275 DIAG(ext_plain_complex, EXTENSION,
276      "ISO C does not support plain '_Complex' meaning '_Complex double'")
277 DIAG(ext_integer_complex, EXTENSION,
278      "ISO C does not support complex integer types")
279 DIAG(ext_thread_before, EXTENSION,
280      "'__thread' before 'static'")
281 DIAG(ext_integer_increment_complex, EXTENSION,
282      "ISO C does not support '++'/'--' on complex integer types")
283 DIAG(ext_integer_complement_complex, EXTENSION,
284      "ISO C does not support '~' for complex conjugation")
285      
286 DIAG(ext_mixed_decls_code, EXTENSION,
287      "ISO C90 forbids mixing declarations and code")
288
289 DIAG(ext_empty_struct_union_enum, EXTENSION,
290      "use of empty %0 extension")
291 DIAG(warn_enum_value_overflow, WARNING,
292      "overflow in enumeration value")
293
294 DIAG(ext_ident_list_in_param, EXTENSION,
295      "type-less parameter names in function declaration")
296 DIAG(ext_c99_array_usage, EXTENSION,
297      "use of C99-specific array features")
298 DIAG(ext_c99_variable_decl_in_for_loop, EXTENSION,
299      "variable declaration in for loop is a C99-specific feature")
300 DIAG(ext_c99_compound_literal, EXTENSION,
301      "compound literals are a C99-specific feature")
302 DIAG(ext_c99_enumerator_list_comma, EXTENSION,
303      "commas at the end of enumerator lists are a C99-specific feature")
304
305 DIAG(ext_gnu_void_ptr, EXTENSION,
306      "use of GNU void* extension")
307 DIAG(ext_gnu_indirect_goto, EXTENSION,
308      "use of GNU indirect-goto extension")
309 DIAG(ext_gnu_address_of_label, EXTENSION,
310      "use of GNU address-of-label extension")
311 DIAG(ext_gnu_statement_expr, EXTENSION,
312      "use of GNU statement expression extension")
313 DIAG(ext_gnu_conditional_expr, EXTENSION,
314      "use of GNU ?: expression extension, eliding middle term")
315 DIAG(ext_gnu_empty_initializer, EXTENSION,
316      "use of GNU empty initializer extension")
317 DIAG(ext_gnu_array_range, EXTENSION,
318      "use of GNU array range extension")
319 DIAG(ext_gnu_missing_equal_designator, EXTENSION,
320      "use of GNU 'missing =' extension in designator")
321 DIAG(ext_gnu_old_style_field_designator, EXTENSION,
322      "use of GNU old-style field designator extension")
323 DIAG(ext_gnu_case_range, EXTENSION,
324      "use of GNU case range extension")
325      
326 // Generic errors.
327 DIAG(err_parse_error, ERROR,
328      "parse error")
329 DIAG(err_expected_expression, ERROR,
330      "expected expression")
331 DIAG(err_invalid_receiver_to_message, ERROR,
332      "invalid receiver to message expression")
333 DIAG(err_expected_external_declaration, ERROR,
334      "expected external declaration")
335 DIAG(err_expected_ident, ERROR,
336      "expected identifier")
337 DIAG(err_expected_ident_lparen, ERROR,
338      "expected identifier or '('")
339 DIAG(err_expected_ident_lbrace, ERROR,
340      "expected identifier or '{'")
341 DIAG(err_expected_lbrace, ERROR,
342      "expected '{'")
343 DIAG(err_expected_rparen, ERROR,
344      "expected ')'")
345 DIAG(err_expected_rsquare, ERROR,
346      "expected ']'")
347 DIAG(err_expected_rbrace, ERROR,
348      "expected '}'")
349 DIAG(err_expected_greater, ERROR,
350      "expected '>'")
351 DIAG(err_expected_semi_decl_list, ERROR,
352      "expected ';' at end of declaration list")
353 DIAG(ext_expected_semi_decl_list, EXTENSION,
354      "expected ';' at end of declaration list")
355 DIAG(err_expected_fn_body, ERROR,
356      "expected function body after function declarator")
357 DIAG(err_expected_after_declarator, ERROR,
358      "expected '=', ',', ';', 'asm', or '__attribute__' after declarator")
359 DIAG(err_expected_statement, ERROR,
360      "expected statement")
361 DIAG(err_expected_lparen_after, ERROR,
362      "expected '(' after '%0'")
363 DIAG(err_expected_less_after, ERROR,
364      "expected '<' after '%0'")
365 DIAG(err_expected_comma, ERROR,
366      "expected ','")
367 DIAG(err_expected_lbrace_in_compound_literal, ERROR,
368      "expected '{' in compound literal")
369 DIAG(err_expected_while, ERROR,
370      "expected 'while' in do/while loop")
371 DIAG(err_expected_semi_after, ERROR,
372      "expected ';' after %0")
373 DIAG(err_expected_semi_after_expr, ERROR,
374      "expected ';' after expression")
375 DIAG(err_expected_semi_for, ERROR,
376      "expected ';' in 'for' statement specifier")
377 DIAG(err_non_variable_decl_in_for, ERROR,
378      "declaration of non-local variable in 'for' loop")
379 DIAG(err_expected_colon_after, ERROR,
380      "expected ':' after %0")
381 DIAG(err_label_end_of_compound_statement, ERROR,
382      "label at end of compound statement: expected statement")
383 DIAG(err_expected_colon, ERROR,
384      "expected ':'")
385 DIAG(err_expected_string_literal, ERROR,
386      "expected string literal")
387 DIAG(err_expected_asm_operand, ERROR,
388      "expected string literal or '[' for asm operand")
389
390 DIAG(err_unexpected_at, ERROR,
391      "unexpected '@' in program")
392
393 /// err_matching - this is used as a continuation of a previous error, e.g. to 
394 /// specify the '(' when we expected a ')'.  This should probably be some
395 /// special sort of diagnostic kind to indicate that it is the second half of
396 /// the previous diagnostic.
397 DIAG(err_matching, ERROR,
398      "to match this '%0'")
399
400 /// Objective-C parser diagnostics
401 DIAG(err_unexpected_interface, ERROR,
402      "unexpected interface name '%0': expected expression")
403 DIAG(err_objc_no_attributes_on_category, ERROR,
404      "attributes may not be specified on a category")
405 DIAG(err_objc_missing_end, ERROR,
406      "missing @end")
407 DIAG(err_objc_illegal_visibility_spec, ERROR,
408      "illegal visibility specification")
409 DIAG(err_objc_illegal_interface_qual, ERROR,
410      "illegal interface qualifier")
411 DIAG(err_objc_expected_equal, ERROR,
412      "setter/getter expects '=' followed by name")
413 DIAG(err_objc_expected_property_attr, ERROR,
414      "unknown property attribute detected")
415 DIAG(err_objc_protocol_required, ERROR,
416      "@required may be specified in protocols only")
417 DIAG(err_objc_protocol_optional, ERROR,
418      "@optional may be specified in protocols only")
419 DIAG(err_missing_catch_finally, ERROR,
420      "@try statment without a @catch and @finally clause")
421 DIAG(err_objc_concat_string, ERROR,
422      "unexpected token after Objective-C string")
423 DIAG(err_undef_superclass, ERROR,
424      "cannot find interface declaration for '%0', superclass of '%1'")
425 DIAG(err_duplicate_class_def, ERROR,
426      "duplicate interface declaration for class '%0'")
427 DIAG(warn_undef_protocolref, WARNING,
428      "cannot find protocol definition for '%0', referenced by '%1'")
429 DIAG(err_duplicate_protocol_def, ERROR,
430      "duplicate protocol declaration of '%0'")
431 DIAG(err_undef_interface, ERROR,
432      "cannot find interface declaration for '%0'")
433 DIAG(err_dup_category_def, ERROR,
434      "duplicate interface declaration for category '%0(%1)'")
435 DIAG(warn_undef_interface, WARNING,
436      "cannot find interface declaration for '%0'")
437 DIAG(err_dup_implementation_class, ERROR,
438      "reimplementation of class '%0'")
439 DIAG(err_conflicting_super_class, ERROR,
440      "conflicting super class name '%0'")
441 DIAG(err_conflicting_ivar_name, ERROR,
442      "conflicting instance variable name '%0'")
443 DIAG(err_inconsistant_ivar_count, ERROR,
444      "inconsistent number of instance variables specified")
445 DIAG(err_conflicting_ivar_type, ERROR,
446      "conflicting instance variable type")
447 DIAG(warn_undef_method_impl, WARNING,
448      "method definition for '%0' not found")
449 DIAG(warn_incomplete_impl_class, WARNING,
450      "incomplete implementation of class '%0'")
451 DIAG(warn_incomplete_impl_category, WARNING,
452      "incomplete implementation of category '%0'")
453 DIAG(error_duplicate_method_decl, ERROR,
454      "duplicate declaration of method '%0'")
455 DIAG(err_previous_declaration, ERROR,
456      "previous declaration is here")
457 DIAG(err_undeclared_protocol, ERROR,
458      "cannot find protocol declaration for '%0'")
459 DIAG(err_missing_sel_definition, ERROR,
460      "cannot find definition of 'SEL'")
461 DIAG(err_missing_id_definition, ERROR,
462      "cannot find definition of 'id'")
463 DIAG(err_missing_proto_definition, ERROR,
464      "cannot find definition of 'Protocol'")
465 DIAG(err_missing_class_definition, ERROR,
466      "cannot find definition of 'Class'")
467 DIAG(warn_previous_alias_decl, WARNING,
468      "previously declared alias is ignored")
469 DIAG(warn_previous_declaration, WARNING,
470      "previous declaration is here")
471 DIAG(err_conflicting_aliasing_type, ERROR,
472      "conflicting types for alias %0'")
473 DIAG(err_statically_allocated_object, ERROR,
474      "statically allocated Objective-C object '%0'")
475 DIAG(warn_method_not_found, WARNING,
476      "method '%0%1' not found (return type defaults to 'id')")
477 DIAG(warn_method_not_found_in_protocol, WARNING,
478      "method '%0%1' not found in protocol (return type defaults to 'id')")
479 DIAG(err_collection_expr_type, ERROR,
480      "collection expression type ('%0') is not a valid object")
481 DIAG(err_selector_element_type, ERROR,
482      "selector element type ('%0') is not a valid object")
483 DIAG(err_toomany_element_decls, ERROR,
484      "Only one element declaration is allowed")
485 DIAG(warn_expected_implementation, WARNING,
486      "@end must appear in an @implementation context")
487 DIAG(error_bad_receiver_type, ERROR,
488      "bad receiver type '%0'")
489
490 //===----------------------------------------------------------------------===//
491 // Semantic Analysis
492 //===----------------------------------------------------------------------===//
493
494 // Semantic analysis of string and character constant literals.
495 DIAG(ext_nonstandard_escape, EXTENSION,
496      "use of non-standard escape character '\\%0'")
497 DIAG(ext_unknown_escape, EXTENSION,
498      "unknown escape sequence '\\%0'")
499 DIAG(warn_extraneous_wide_char_constant, WARNING,
500      "extraneous characters in wide character constant ignored")
501 DIAG(warn_char_constant_too_large, WARNING,
502      "character constant too long for its type")
503 DIAG(warn_hex_escape_too_large, WARNING,
504      "hex escape sequence out of range")
505 DIAG(warn_octal_escape_too_large, WARNING,
506      "octal escape sequence out of range")
507
508 DIAG(err_hex_escape_no_digits, ERROR,
509      "\\x used with no following hex digits")
510      
511 DIAG(err_predef_outside_function, ERROR,
512      "predefined identifier is only valid inside function")
513
514 // Declarations.
515 DIAG(err_typename_requires_specqual, ERROR,
516      "type name requires a specifier or qualifier")
517 DIAG(err_typename_invalid_storageclass, ERROR,
518      "type name does not allow storage class to be specified")
519 DIAG(err_typename_invalid_functionspec, ERROR,
520      "type name does not allow function specifier to be specified")
521 DIAG(err_invalid_decl_spec_combination, ERROR,
522      "cannot combine with previous '%0' declaration specifier")
523 DIAG(err_invalid_sign_spec, ERROR,
524      "'%0' cannot be signed or unsigned")
525 DIAG(err_invalid_short_spec, ERROR,
526      "'short %0' is invalid")
527 DIAG(err_invalid_long_spec, ERROR,
528      "'long %0' is invalid")
529 DIAG(err_invalid_longlong_spec, ERROR,
530      "'long long %0' is invalid")
531 DIAG(ext_longlong, EXTENSION,
532      "'long long' is an extension when C99 mode is not enabled")
533 DIAG(err_invalid_complex_spec, ERROR,
534      "'_Complex %0' is invalid")
535 DIAG(err_invalid_thread_spec, ERROR,
536      "'__thread %0' is invalid")
537 DIAG(err_ellipsis_first_arg, ERROR,
538      "ISO C requires a named argument before '...'")
539 DIAG(err_unspecified_vla_size_with_static, ERROR,
540      "'static' may not be used with an unspecified variable length array size")
541 DIAG(ext_vla, EXTENSION,
542      "variable length arrays are a C99 feature, accepted as an extension")
543 DIAG(err_invalid_storage_class_in_func_decl, ERROR,
544      "invalid storage class specifier in function declarator")
545 DIAG(err_anon_param_requires_type_specifier, ERROR,
546      "type specifier required for unnamed parameter")
547 DIAG(err_param_requires_type_specifier, ERROR,
548      "type specifier required for parameter '%0'")
549
550 DIAG(err_invalid_reference_qualifier_application, ERROR,
551      "'%0' qualifier may not be applied to a reference")
552 DIAG(err_declarator_need_ident, ERROR,
553      "declarator requires an identifier")
554 DIAG(err_bad_language, ERROR,
555      "unknown linkage language")
556
557 // Attributes
558 DIAG(err_attribute_wrong_number_arguments, ERROR,
559      "attribute requires %0 argument(s)")
560 DIAG(err_attribute_invalid_vector_type, ERROR,
561      "invalid vector type '%0'")
562 DIAG(err_attribute_vector_size_not_int, ERROR,
563      "vector_size requires integer constant")
564 DIAG(err_attribute_invalid_size, ERROR,
565      "vector size not an integral multiple of component size")
566 DIAG(err_attribute_zero_size, ERROR,
567      "zero vector size")
568 DIAG(err_typecheck_vector_not_convertable, ERROR,
569      "can't convert between vector values of different size ('%0' and '%1')")
570 DIAG(err_typecheck_ocu_vector_not_typedef, ERROR,
571      "ocu_vector_type only applies to types, not variables")
572 DIAG(err_ocuvector_component_exceeds_length, ERROR,
573      "vector component access exceeds type '%0'")
574 DIAG(err_ocuvector_component_name_illegal, ERROR,
575      "illegal vector component name '%0'")
576 DIAG(err_ocuvector_component_access, ERROR,
577      "vector component access limited to variables")
578
579 // Function Parameter Semantic Analysis.
580 DIAG(err_param_with_void_type, ERROR,
581      "argument may not have 'void' type")
582 DIAG(err_void_only_param, ERROR,
583      "'void' must be the first and only parameter if specified")
584 DIAG(err_void_param_qualified, ERROR,
585      "'void' as parameter must not have type qualifiers")
586 DIAG(err_param_redefinition, ERROR,
587      "redefinition of parameter '%0'")
588 DIAG(err_ident_list_in_fn_declaration, ERROR,
589      "a parameter list without types is only allowed in a function definition")
590 DIAG(err_declaration_does_not_declare_param, ERROR,
591      "declaration does not declare a parameter")
592 DIAG(err_no_matching_param, ERROR,
593      "parameter named '%0' is missing")
594 DIAG(ext_param_not_declared, EXTENSION,
595      "parameter '%0' was not declared, defaulting to type 'int'")
596
597 DIAG(err_previous_definition, ERROR,
598      "previous definition is here")
599 DIAG(err_previous_use, ERROR,
600      "previous use is here")
601 DIAG(err_first_label, ERROR,
602     "first label is here")
603
604 DIAG(err_unexpected_typedef, ERROR,
605      "unexpected type name '%0': expected expression")
606 DIAG(err_undeclared_var_use, ERROR,
607      "use of undeclared identifier '%0'")
608 DIAG(err_redefinition, ERROR,
609      "redefinition of '%0'")
610 DIAG(err_static_non_static, ERROR,
611      "static declaration of '%0' follows non-static declaration")
612 DIAG(err_non_static_static, ERROR,
613      "non-static declaration of '%0' follows static declaration")
614 DIAG(err_redefinition_different_kind, ERROR,
615      "redefinition of '%0' as different kind of symbol")
616 DIAG(err_conflicting_types, ERROR,
617      "conflicting types for '%0'")
618 DIAG(err_nested_redefinition, ERROR,
619      "nested redefinition of '%0'")
620 DIAG(err_use_with_wrong_tag, ERROR,
621      "use of '%0' with tag type that does not match previous declaration")
622 DIAG(ext_forward_ref_enum, EXTENSION,
623      "ISO C forbids forward references to 'enum' types")
624 DIAG(err_redefinition_of_enumerator, ERROR,
625      "redefinition of enumerator '%0'")
626 DIAG(err_duplicate_member, ERROR,
627      "duplicate member '%0'")
628 DIAG(err_enum_value_not_integer_constant_expr, ERROR,
629      "enumerator value for '%0' is not an integer constant")
630 DIAG(ext_enum_value_not_int, EXTENSION,
631      "ISO C restricts enumerator values to range of 'int' (%0 is too large)")
632 DIAG(warn_enum_too_large, WARNING,
633      "enumeration values exceed range of largest integer")
634 DIAG(err_case_label_not_integer_constant_expr, ERROR,
635      "case label does not reduce to an integer constant")
636 DIAG(err_typecheck_illegal_vla, ERROR,
637      "variable length array declared outside of any function")
638 DIAG(err_typecheck_negative_array_size, ERROR,
639      "array size is negative")
640 DIAG(ext_typecheck_zero_array_size, EXTENSION,
641      "zero size arrays are an extension")
642 DIAG(err_at_least_one_initializer_needed_to_size_array, ERROR,
643     "at least one initializer value required to size array")
644 DIAG(err_array_size_non_int, ERROR,
645      "size of array has non-integer type '%0'")
646 DIAG(err_init_element_not_constant, ERROR,
647      "initializer element is not constant")
648 DIAG(err_block_extern_cant_init, ERROR,
649      "'extern' variable cannot have an initializer")
650 DIAG(warn_extern_init, WARNING,
651      "'extern' variable has an initializer")
652 DIAG(err_variable_object_no_init, ERROR,
653      "variable-sized object may not be initialized")
654 DIAG(warn_excess_initializers, WARNING,
655      "excess elements in array initializer")
656 DIAG(err_excess_initializers_in_char_array_initializer, ERROR,
657     "excess elements in char array initializer")
658 DIAG(warn_initializer_string_for_char_array_too_long, WARNING,
659     "initializer-string for char array is too long")
660 DIAG(warn_braces_around_scalar_init, WARNING,
661      "braces around scalar initializer")
662 DIAG(err_illegal_initializer, ERROR,
663      "illegal initializer (only variables can be initialized)")
664
665 DIAG(err_redefinition_of_label, ERROR,
666      "redefinition of label '%0'")
667 DIAG(err_undeclared_label_use, ERROR,
668      "use of undeclared label '%0'")
669
670 DIAG(warn_implicit_function_decl, WARNING,
671      "implicit declaration of function '%0'")
672 DIAG(ext_implicit_function_decl, EXTENSION,
673      "implicit declaration of function '%0' is invalid in C99")
674
675 DIAG(err_func_returning_array_function, ERROR,
676      "function cannot return array or function type '%0'")
677 DIAG(err_field_declared_as_function, ERROR,
678      "field '%0' declared as a function")
679 DIAG(err_field_incomplete, ERROR,
680      "field '%0' has incomplete type")
681 DIAG(err_variable_sized_type_in_struct, EXTENSION,
682      "variable sized type '%0' must be at end of struct or class")
683 DIAG(err_flexible_array_empty_struct, ERROR,
684      "flexible array '%0' not allowed in otherwise empty struct")
685 DIAG(ext_flexible_array_in_struct, EXTENSION,
686      "'%0' may not be nested in a struct due to flexible array member")
687 DIAG(err_flexible_array_in_array, ERROR,
688      "'%0' may not be used as an array element due to flexible array member")
689 DIAG(err_illegal_decl_array_of_functions, ERROR,
690      "'%0' declared as array of functions")
691 DIAG(err_illegal_decl_array_incomplete_type, ERROR,
692      "array has incomplete element type '%0'")
693 DIAG(err_illegal_decl_array_of_references, ERROR,
694      "'%0' declared as array of references")
695 DIAG(err_illegal_decl_pointer_to_reference, ERROR,
696      "'%0' declared as a pointer to a reference")
697 DIAG(err_illegal_decl_reference_to_reference, ERROR,
698      "'%0' declared as a reference to a reference")
699
700 // Expressions.
701 DIAG(ext_sizeof_function_type, EXTENSION,
702      "invalid application of 'sizeof' to a function type")
703 DIAG(ext_sizeof_void_type, EXTENSION,
704      "invalid application of '%0' to a void type")
705 DIAG(err_sizeof_incomplete_type, ERROR,
706      "invalid application of 'sizeof' to an incomplete type '%0'")
707 DIAG(err_alignof_incomplete_type, ERROR,
708      "invalid application of '__alignof' to an incomplete type '%0'")
709 DIAG(err_offsetof_record_type, ERROR,
710      "offsetof requires struct, union, or class type, '%0' invalid")
711 DIAG(err_offsetof_array_type, ERROR,
712      "offsetof requires array type, '%0' invalid")
713 DIAG(ext_offsetof_extended_field_designator, EXTENSION,
714      "using extended field designator is an extension")
715      
716 DIAG(err_invalid_suffix_integer_constant, ERROR,
717      "invalid suffix '%0' on integer constant")
718 DIAG(err_invalid_suffix_float_constant, ERROR,
719      "invalid suffix '%0' on floating constant")
720 DIAG(ext_imaginary_constant, EXTENSION,
721      "imaginary constants are an extension")
722 DIAG(warn_integer_too_large, WARNING,
723      "integer constant is too large for its type")
724 DIAG(warn_integer_too_large_for_signed, WARNING,
725      "integer constant is so large that it is unsigned")
726 DIAG(err_exponent_has_no_digits, ERROR,
727      "exponent has no digits")
728 DIAG(ext_binary_literal, EXTENSION,
729      "binary integer literals are an extension")
730 DIAG(err_invalid_binary_digit, ERROR,
731      "invalid digit '%0' in binary constant")
732 DIAG(err_invalid_octal_digit, ERROR,
733      "invalid digit '%0' in octal constant")
734 DIAG(err_invalid_decimal_digit, ERROR,
735      "invalid digit '%0' in decimal constant")
736 DIAG(err_hexconstant_requires_exponent, ERROR,
737      "hexadecimal floating constants require an exponent")
738 DIAG(err_typecheck_subscript_value, ERROR,
739      "subscripted value is neither array nor pointer")
740 DIAG(err_typecheck_subscript, ERROR,
741      "array subscript is not an integer")
742 DIAG(err_typecheck_subscript_not_object, ERROR,
743      "illegal subscript of non-object type '%0'")
744 DIAG(err_typecheck_member_reference_structUnion, ERROR,
745      "member reference is not to a structure or union")
746 DIAG(err_typecheck_member_reference_arrow, ERROR,
747      "member reference is not a pointer")
748 DIAG(err_typecheck_incomplete_tag, ERROR,
749      "incomplete definition of type '%0'")
750 DIAG(err_typecheck_no_member, ERROR,
751      "no member named '%0'")
752 DIAG(err_typecheck_illegal_increment_decrement, ERROR,
753      "cannot modify value of type '%0'")
754 DIAG(err_typecheck_invalid_lvalue_incr_decr, ERROR,
755      "invalid lvalue in increment/decrement expression")
756 DIAG(err_typecheck_arithmetic_incomplete_type, ERROR,
757      "arithmetic on pointer to incomplete type '%0'")
758 DIAG(err_typecheck_decl_incomplete_type, ERROR,
759      "variable has incomplete type '%0'")
760 DIAG(err_realimag_invalid_type, ERROR,
761      "invalid type '%0' to __real or __imag operator")
762 DIAG(err_typecheck_sclass_fscope, ERROR,
763      "illegal storage class on file-scoped variable")
764 DIAG(err_typecheck_sclass_func, ERROR,
765      "illegal storage class on function")
766 DIAG(err_typecheck_address_of_register, ERROR,
767      "address of register variable requested")
768 DIAG(err_typecheck_invalid_lvalue_addrof, ERROR,
769      "address expression must be an lvalue or a function designator")
770 DIAG(err_typecheck_unary_expr, ERROR,
771      "invalid argument type to unary expression '%0'")
772 DIAG(err_typecheck_indirection_requires_pointer, ERROR,
773      "indirection requires pointer operand ('%0' invalid)")
774 DIAG(err_typecheck_invalid_operands, ERROR,
775      "invalid operands to binary expression ('%0' and '%1')")
776 DIAG(err_typecheck_sub_ptr_object, ERROR,
777      "'%0' is not a complete object type")
778 DIAG(err_typecheck_sub_ptr_compatible, ERROR,
779      "'%0' and '%1' are not pointers to compatible types")
780 DIAG(ext_typecheck_comparison_of_pointer_integer, WARNING,
781      "comparison between pointer and integer ('%0' and '%1')")
782 DIAG(ext_typecheck_comparison_of_distinct_pointers, WARNING,
783      "comparison of distinct pointer types ('%0' and '%1')")
784 DIAG(err_typecheck_assign_const, ERROR,
785      "read-only variable is not assignable")
786
787 // assignment related diagnostics (also for argument passing, returning, etc).
788 DIAG(err_typecheck_convert_incompatible, ERROR,
789      "incompatible type %2 '%1', expected '%0'")
790 DIAG(ext_typecheck_convert_pointer_int, EXTENSION,
791      "incompatible pointer to integer conversion %2 '%1', expected '%0'")
792 DIAG(ext_typecheck_convert_int_pointer, EXTENSION,
793      "incompatible integer to pointer conversion %2 '%1', expected '%0'")
794 DIAG(ext_typecheck_convert_pointer_void_func, EXTENSION,
795      "%2 '%1' converts between void* and function pointer, expected '%0'")
796 DIAG(ext_typecheck_convert_incompatible_pointer, EXTENSION,
797      "incompatible pointer types %2 '%1', expected '%0'")
798 DIAG(ext_typecheck_convert_discards_qualifiers, EXTENSION,
799      "%2 '%1' discards qualifiers, expected '%0'")
800      
801 DIAG(err_typecheck_array_not_modifiable_lvalue, ERROR,
802      "array type '%0' is not assignable")
803 DIAG(err_typecheck_non_object_not_modifiable_lvalue, ERROR,
804      "non-object type '%0' is not assignable")
805 DIAG(err_typecheck_expression_not_modifiable_lvalue, ERROR,
806      "expression is not assignable")
807 DIAG(err_typecheck_incomplete_type_not_modifiable_lvalue, ERROR,
808      "incomplete type '%0' is not assignable")
809 DIAG(err_typecheck_duplicate_vector_components_not_mlvalue, ERROR,
810      "vector is not assignable (contains duplicate components)")
811 DIAG(err_typecheck_call_not_function, ERROR,
812      "called object is not a function or function pointer")
813 DIAG(err_typecheck_call_too_few_args, ERROR,
814      "too few arguments to function")
815 DIAG(err_typecheck_call_too_many_args, ERROR,
816      "too many arguments to function")
817 DIAG(err_typecheck_call_invalid_ordered_compare, ERROR,
818      "ordered compare requires two args of floating point type ('%0' and '%1')")
819 DIAG(err_typecheck_cond_expect_scalar, ERROR,
820      "used type '%0' where arithmetic or pointer type is required")
821 DIAG(err_typecheck_expect_scalar_operand, ERROR,
822      "operand of type '%0' where arithmetic or pointer type is required")
823 DIAG(err_typecheck_cond_incompatible_operands, ERROR,
824      "incompatible operand types ('%0' and '%1')")
825 DIAG(ext_typecheck_cond_incompatible_pointers, WARNING,
826      "pointer type mismatch ('%0' and '%1')")
827 DIAG(err_typecheck_choose_expr_requires_constant, ERROR,
828      "'__builtin_choose_expr' requires a constant expression")
829 DIAG(warn_unused_expr, WARNING,
830      "expression result unused")
831 DIAG(err_pascal_string_too_long, ERROR,
832     "Pascal string is too long")
833 DIAG(err_invalid_lvalue_in_asm_output, ERROR,
834     "invalid lvalue in asm output")
835 DIAG(err_invalid_output_constraint_in_asm, ERROR,
836     "invalid output constraint in asm")
837 DIAG(err_invalid_input_constraint_in_asm, ERROR,
838     "invalid input constraint in asm")
839 DIAG(err_invalid_type_in_asm_input, ERROR,
840     "invalid type '%0' in asm input")
841 DIAG(err_unknown_register_name_in_asm, ERROR,
842     "unknown register name '%0' in asm")
843 DIAG(err_invalid_conversion_between_vectors, ERROR,
844     "invalid conversion between vector type '%0' and '%1' of different size")
845 DIAG(err_invalid_conversion_between_vector_and_integer, ERROR,
846     "invalid conversion between vector type '%0' and integer type '%1' "
847     "of different size")
848 DIAG(err_invalid_conversion_between_vector_and_scalar, ERROR,
849     "invalid conversion between vector type '%0' and scalar type '%1'")
850 DIAG(err_overload_expr_requires_non_zero_constant, ERROR,
851      "overload requires a non-zero constant expression as first argument")
852 DIAG(err_overload_incorrect_fntype, ERROR,
853      "argument is not a function, or has wrong number of parameters")
854 DIAG(err_overload_no_match, ERROR,
855      "no matching overload found for arguments of type '%0'")
856 DIAG(err_overload_multiple_match, ERROR,
857      "more than one matching function found in __builtin_overload")
858
859 // CHECK: printf format string errors
860 DIAG(warn_printf_not_string_constant, WARNING,
861      "format string is not a string literal (potentially insecure)")
862 DIAG(warn_printf_write_back, WARNING,
863      "use of '%n' in format string discouraged (potentially insecure)")
864 DIAG(warn_printf_insufficient_data_args, WARNING,
865     "more '%' conversions than data arguments")
866 DIAG(warn_printf_too_many_data_args, WARNING,
867     "more data arguments than '%' conversions")
868 DIAG(warn_printf_invalid_conversion, WARNING,
869     "invalid conversion '%0'")
870 DIAG(warn_printf_missing_format_string, WARNING,
871     "format string missing")
872 DIAG(warn_printf_empty_format_string, WARNING,
873    "format string is empty")
874 DIAG(warn_printf_format_string_is_wide_literal, WARNING,
875   "format string should not be a wide string")
876 DIAG(warn_printf_format_string_contains_null_char, WARNING,
877   "format string contains '\\0' within the string body")
878 DIAG(warn_printf_asterisk_width_missing_arg, WARNING,
879      "'*' specified field width is missing a matching 'int' argument")
880 DIAG(warn_printf_asterisk_precision_missing_arg, WARNING,
881      "'.*' specified field precision is missing a matching 'int' argument")
882 DIAG(warn_printf_asterisk_width_wrong_type, WARNING,
883      "field width should have type 'int', but argument has type '%0'")
884 DIAG(warn_printf_asterisk_precision_wrong_type, WARNING,
885      "field precision should have type 'int', but argument has type '%0'")
886
887 // CHECK: returning address/reference of stack memory
888 DIAG(warn_ret_stack_addr, WARNING,
889   "address of stack memory associated with local variable '%0' returned")
890 DIAG(warn_ret_stack_ref, WARNING,
891   "reference to stack memory associated with local variable '%0' returned")
892
893 // CHECK: floating point values should not use "==" or "!="
894 DIAG(warn_floatingpoint_eq, WARNING,
895   "comparing floating point with == or != is unsafe")
896
897 // CHECK: for non-floating point, expressions of the form x == x or x != x
898 // should result in a warning, since these always evaluate to a constant.
899 DIAG(warn_selfcomparison,WARNING,
900      "self-comparison always results in a constant value.")
901
902 // CHECK: stores to variables that are no longer live (dead stores)
903 DIAG(warn_dead_store, WARNING, "value stored to variable is never used")
904
905 // CHECK: use of uninitialized values
906 DIAG(warn_uninit_val, WARNING, "use of uninitialized variable")
907
908 // CFString checking
909 DIAG(err_cfstring_literal_not_string_constant, ERROR,
910   "CFString literal is not a string constant")
911 DIAG(warn_cfstring_literal_contains_non_ascii_character, WARNING,
912   "CFString literal contains non-ASCII character")
913 DIAG(warn_cfstring_literal_contains_nul_character, WARNING,
914   "CFString literal contains NUL character")
915
916 // Statements.
917 DIAG(err_continue_not_in_loop, ERROR,
918      "'continue' statement not in loop statement")
919 DIAG(err_break_not_in_loop_or_switch, ERROR,
920      "'break' statement not in loop or switch statement")
921 DIAG(err_default_not_in_switch, ERROR,
922      "'default' statement not in switch statement")
923 DIAG(err_case_not_in_switch, ERROR,
924      "'case' statement not in switch statement")
925 DIAG(warn_case_value_overflow, WARNING,
926      "overflow converting case value to switch condition type (%0 to %1)")
927 DIAG(err_duplicate_case, ERROR,
928      "duplicate case value '%0'")
929 DIAG(err_duplicate_case_prev, ERROR,
930      "previous case value occurrence defined here")
931 DIAG(warn_case_empty_range, WARNING,
932      "empty case range specified")
933 DIAG(err_typecheck_statement_requires_scalar, ERROR,
934      "statement requires expression of scalar type ('%0' invalid)")
935 DIAG(err_typecheck_statement_requires_integer, ERROR,
936     "statement requires expression of integer type ('%0' invalid)")
937 DIAG(err_multiple_default_labels_defined, ERROR,
938     "multiple default labels in one switch")
939 DIAG(warn_empty_if_body, WARNING,
940     "if statement has empty body")
941 DIAG(err_va_start_used_in_non_variadic_function, ERROR,
942     "'va_start' used in function with fixed args")
943 DIAG(warn_second_parameter_of_va_start_not_last_named_argument, WARNING,
944     "second parameter of 'va_start' not last named argument")
945 DIAG(err_first_argument_to_va_arg_not_of_type_va_list, ERROR,
946     "first argument to 'va_arg' is of type '%0' and not 'va_list'")
947   
948 DIAG(warn_return_missing_expr, WARNING,
949      "non-void function '%0' should return a value")
950 DIAG(ext_return_missing_expr, EXTENSION,
951      "non-void function '%0' should return a value")
952 DIAG(ext_return_has_expr, EXTENSION,
953      "void function '%0' should not return a value")
954
955
956
957 #undef DIAG