//===-- DiagnosticKinds.def - C Family Diagnostic Kind Database -*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
//  This file defines the DiagnosticKind database.
//
//===----------------------------------------------------------------------===//

// Flags for diagnostic:
//
//   DIAG_TYPE - Allows one of:
//     NOTE      - Informational message.
//     WARNING   - Warning.
//     EXTENSION - Notification that an extension to the language is being used.
//     ERROR     - Error, compilation will stop after parsing completes.

//===----------------------------------------------------------------------===//
// Lexer Diagnostics
//===----------------------------------------------------------------------===//

DIAG(null_in_string, WARNING,
     "null character(s) preserved in string literal")
DIAG(null_in_char  , WARNING,
     "null character(s) preserved in character literal")
DIAG(null_in_file  , WARNING,
     "null character ignored")
DIAG(nested_block_comment, WARNING,
     "\"/*\" within block comment")
DIAG(escaped_newline_block_comment_end, WARNING,
     "escaped newline between */ characters at block comment end")
DIAG(backslash_newline_space, WARNING,
     "backslash and newline separated by space")

// Trigraphs.
DIAG(trigraph_ignored, WARNING, "trigraph ignored")
DIAG(trigraph_ignored_block_comment, WARNING,
     "ignored trigraph would end block comment")
DIAG(trigraph_ends_block_comment, WARNING,
     "trigraph ends block comment")
DIAG(trigraph_converted, WARNING,
     "trigraph converted to '%0' character")

DIAG(ext_multi_line_bcpl_comment, EXTENSION,
     "multi-line // comment")
DIAG(ext_bcpl_comment, EXTENSION,
     "// comments are not allowed in this language")
DIAG(ext_no_newline_eof, EXTENSION,
     "no newline at end of file")
DIAG(ext_backslash_newline_eof, EXTENSION,
     "backslash-newline at end of file")
DIAG(ext_dollar_in_identifier, EXTENSION,
     "'$' in identifier")
DIAG(charize_microsoft_ext, EXTENSION,
     "@# is a microsoft extension")

DIAG(ext_token_used, EXTENSION,
     "extension used")

DIAG(err_unterminated_string, ERROR,
     "missing terminating \" character")
DIAG(err_unterminated_char, ERROR,
     "missing terminating ' character")
DIAG(err_empty_character, ERROR,
     "empty character constant")
DIAG(err_unterminated_block_comment, ERROR,
     "unterminated /* comment")
DIAG(err_invalid_character_to_charify, ERROR,
     "invalid argument to convert to character")

//===----------------------------------------------------------------------===//
// Preprocessor Diagnostics
//===----------------------------------------------------------------------===//

DIAG(pp_hash_warning, WARNING,
     "#warning%0")
DIAG(pp_include_next_in_primary, WARNING,
     "#include_next in primary source file")
DIAG(pp_include_next_absolute_path, WARNING,
     "#include_next with absolute path")
DIAG(ext_c99_whitespace_required_after_macro_name, WARNING,
     "ISO C99 requires whitespace after the macro name")
DIAG(pp_pragma_once_in_main_file, WARNING,
     "#pragma once in main file")
DIAG(pp_pragma_sysheader_in_main_file, WARNING,
     "#pragma system_header ignored in main file")
DIAG(pp_poisoning_existing_macro, WARNING,
     "poisoning existing macro")
DIAG(pp_out_of_date_dependency, WARNING,
     "current file is older than dependency %0")
DIAG(pp_undef_builtin_macro, WARNING,
     "undefining builtin macro")
DIAG(pp_redef_builtin_macro, WARNING,
     "redefining builtin macro")
DIAG(pp_macro_not_used, WARNING,    // -Wunused-macros
     "macro is not used")
DIAG(pp_invalid_string_literal, WARNING,
     "invalid string literal, ignoring final '\\'")
DIAG(warn_pp_expr_overflow, WARNING,
     "integer overflow in preprocessor expression")
DIAG(warn_pp_convert_lhs_to_positive, WARNING,
     "left side of operator converted from negative value to unsigned: %0")
DIAG(warn_pp_convert_rhs_to_positive, WARNING,
     "right side of operator converted from negative value to unsigned: %0")

DIAG(ext_pp_import_directive, EXTENSION,
     "#import is a language extension")
DIAG(ext_pp_ident_directive, EXTENSION,
     "#ident is a language extension")
DIAG(ext_pp_include_next_directive, EXTENSION,
     "#include_next is a language extension")
DIAG(ext_pp_warning_directive, EXTENSION,
     "#warning is a language extension")
DIAG(ext_pp_extra_tokens_at_eol, EXTENSION,
     "extra tokens at end of %0 directive")
DIAG(ext_pp_comma_expr, EXTENSION,
     "comma operator in operand of #if")
DIAG(ext_pp_bad_vaargs_use, EXTENSION,
     "__VA_ARGS__ can only appear in the expansion of a C99 variadic macro")
DIAG(ext_pp_macro_redef, EXTENSION,
     "\"%0\" macro redefined")
DIAG(ext_pp_macro_redef2, EXTENSION,
     "this is previous definition")
DIAG(ext_variadic_macro, EXTENSION,
     "variadic macros were introduced in C99")
DIAG(ext_named_variadic_macro, EXTENSION,
     "named variadic macros are a GNU extension")
DIAG(ext_embedded_directive, EXTENSION,
     "embedding a directive within macro arguments is not portable")
DIAG(ext_missing_varargs_arg, EXTENSION,
     "varargs argument missing, but tolerated as an extension")
DIAG(ext_empty_fnmacro_arg, EXTENSION,
     "empty macro arguments were standardized in C99")

DIAG(ext_pp_base_file, EXTENSION,
     "__BASE_FILE__ is a language extension")
DIAG(ext_pp_include_level, EXTENSION,
     "__INCLUDE_LEVEL__ is a language extension")
DIAG(ext_pp_timestamp, EXTENSION,
     "__TIMESTAMP__ is a language extension")

DIAG(err_pp_invalid_directive, ERROR,
     "invalid preprocessing directive")
DIAG(err_pp_hash_error, ERROR,
     "#error%0")
DIAG(err_pp_file_not_found, ERROR,
     "'%0' file not found")
DIAG(err_pp_empty_filename, ERROR,
     "empty filename")
DIAG(err_pp_include_too_deep, ERROR,
     "#include nested too deeply")
DIAG(err_pp_expects_filename, ERROR,
     "expected \"FILENAME\" or <FILENAME>")
DIAG(err_pp_macro_not_identifier, ERROR,
     "macro names must be identifiers")
DIAG(err_pp_missing_macro_name, ERROR,
     "macro name missing")
DIAG(err_pp_missing_rparen_in_macro_def, ERROR,
     "missing ')' in macro parameter list")
DIAG(err_pp_invalid_tok_in_arg_list, ERROR,
     "invalid token in macro parameter list")
DIAG(err_pp_expected_ident_in_arg_list, ERROR,
     "expected identifier in macro parameter list")
DIAG(err_pp_expected_comma_in_arg_list, ERROR,
     "expected comma in macro parameter list")
DIAG(err_pp_duplicate_name_in_arg_list, ERROR,
     "duplicate macro parameter name \"%0\"")
DIAG(err_pp_stringize_not_parameter, ERROR,
     "'#' is not followed by a macro parameter")
DIAG(err_pp_malformed_ident, ERROR,
     "invalid #ident directive")
DIAG(err_pp_unterminated_conditional, ERROR,
     "unterminated conditional directive")
DIAG(pp_err_else_after_else, ERROR,
     "#else after #else")
DIAG(pp_err_elif_after_else, ERROR,
     "#elif after #else")
DIAG(pp_err_else_without_if, ERROR,
     "#else without #if")
DIAG(pp_err_elif_without_if, ERROR,
     "#elif without #if")
DIAG(err_pp_endif_without_if, ERROR,
     "#endif without #if")
DIAG(err_pp_expected_value_in_expr, ERROR,
     "expected value in expression")
DIAG(err_pp_missing_val_before_operator, ERROR,
     "missing value before operator")
DIAG(err_pp_expected_rparen, ERROR,
     "expected ')' in preprocessor expression")
DIAG(err_pp_expected_eol, ERROR,
     "expected end of line in preprocessor expression")
DIAG(warn_pp_undef_identifier, WARNING,
     "\"%0\" is not defined, evaluates to 0")
DIAG(err_pp_defined_requires_identifier, ERROR,
     "operator \"defined\" requires an identifier")
DIAG(err_pp_missing_rparen, ERROR,
     "missing ')' after \"defined\"")
DIAG(err_pp_colon_without_question, ERROR,
     "':' without preceding '?'")
DIAG(err_pp_division_by_zero, ERROR,
     "division by zero in preprocessor expression")
DIAG(err_pp_remainder_by_zero, ERROR,
     "remainder by zero in preprocessor expression")
DIAG(err_pp_expr_bad_token_binop, ERROR,
     "token is not a valid binary operator in a preprocessor subexpression")
DIAG(err_pp_expr_bad_token_start_expr, ERROR,
     "invalid token at start of a preprocessor expression")
DIAG(err_pp_invalid_poison, ERROR,
     "can only poison identifier tokens")
DIAG(err_pp_used_poisoned_id, ERROR,
     "attempt to use a poisoned identifier")
DIAG(err__Pragma_malformed, ERROR,
     "_Pragma takes a parenthesized string literal")
DIAG(err_defined_macro_name, ERROR,
     "\"defined\" cannot be used as a macro name")
DIAG(err_paste_at_start, ERROR,
     "\"##\" cannot appear at start of macro expansion")
DIAG(err_paste_at_end, ERROR,
     "\"##\" cannot appear at end of macro expansion")
DIAG(ext_paste_comma, EXTENSION,
     "Use of comma pasting extension is non-portable")
DIAG(err_unterm_macro_invoc, ERROR,
     "unterminated function-like macro invocation")
DIAG(err_too_many_args_in_macro_invoc, ERROR,
     "too many arguments provided to function-like macro invocation")
DIAG(err_too_few_args_in_macro_invoc, ERROR,
     "too few arguments provided to function-like macro invocation")
DIAG(err_pp_bad_paste, ERROR,
     "pasting formed \"%0\", an invalid preprocessing token")
DIAG(err_pp_operator_used_as_macro_name, ERROR,
     "C++ operator \"%0\" cannot be used as a macro name")
DIAG(err_pp_illegal_floating_literal, ERROR,
     "floating point literal in preprocessor expression")

// Should be a sorry?
DIAG(err_pp_I_dash_not_supported, ERROR,
     "-I- not supported, please use -iquote instead")
     
//===----------------------------------------------------------------------===//
// Parser Diagnostics
//===----------------------------------------------------------------------===//
DIAG(w_type_defaults_to_int, WARNING,
     "type defaults to 'int'")
DIAG(w_no_declarators, WARNING,
     "declaration does not declare anything")
DIAG(w_asm_qualifier_ignored, WARNING,
     "ignored %0 qualifier on asm")

DIAG(ext_empty_source_file, EXTENSION,
     "ISO C forbids an empty source file")
DIAG(ext_top_level_semi, EXTENSION,
     "ISO C does not allow an extra ';' outside of a function")
DIAG(ext_extra_struct_semi, EXTENSION,
     "ISO C does not allow an extra ';' inside a struct or union")
DIAG(ext_missing_declspec, EXTENSION,
     "declaration specifier missing, defaulting to 'int'")
DIAG(ext_missing_type_specifier, EXTENSION,
     "type specifier missing, defaults to 'int'")

DIAG(ext_duplicate_declspec, EXTENSION,
     "duplicate '%0' declaration specifier")
DIAG(ext_plain_complex, EXTENSION,
     "ISO C does not support plain '_Complex' meaning '_Complex double'")
DIAG(ext_integer_complex, EXTENSION,
     "ISO C does not support complex integer types")
DIAG(ext_thread_before, EXTENSION,
     "'__thread' before 'static'")
DIAG(ext_integer_increment_complex, EXTENSION,
     "ISO C does not support '++'/'--' on complex integer types")
DIAG(ext_integer_complement_complex, EXTENSION,
     "ISO C does not support '~' for complex conjugation")
     
DIAG(ext_mixed_decls_code, EXTENSION,
     "ISO C90 forbids mixing declarations and code")

DIAG(ext_empty_struct_union_enum, EXTENSION,
     "use of empty %0 extension")
DIAG(warn_enum_value_overflow, WARNING,
     "overflow in enumeration value")

DIAG(ext_ident_list_in_param, EXTENSION,
     "type-less parameter names in function declaration")
DIAG(ext_c99_array_usage, EXTENSION,
     "use of C99-specific array features")
DIAG(ext_c99_variable_decl_in_for_loop, EXTENSION,
     "variable declaration in for loop is a C99-specific feature")
DIAG(ext_c99_compound_literal, EXTENSION,
     "compound literals are a C99-specific feature")
DIAG(ext_c99_enumerator_list_comma, EXTENSION,
     "commas at the end of enumerator lists are a C99-specific feature")

DIAG(ext_gnu_void_ptr, EXTENSION,
     "use of GNU void* extension")
DIAG(ext_gnu_indirect_goto, EXTENSION,
     "use of GNU indirect-goto extension")
DIAG(ext_gnu_address_of_label, EXTENSION,
     "use of GNU address-of-label extension")
DIAG(ext_gnu_statement_expr, EXTENSION,
     "use of GNU statement expression extension")
DIAG(ext_gnu_conditional_expr, EXTENSION,
     "use of GNU ?: expression extension, eliding middle term")
DIAG(ext_gnu_empty_initializer, EXTENSION,
     "use of GNU empty initializer extension")
DIAG(ext_gnu_array_range, EXTENSION,
     "use of GNU array range extension")
DIAG(ext_gnu_missing_equal_designator, EXTENSION,
     "use of GNU 'missing =' extension in designator")
DIAG(ext_gnu_old_style_field_designator, EXTENSION,
     "use of GNU old-style field designator extension")
DIAG(ext_gnu_case_range, EXTENSION,
     "use of GNU case range extension")
   
// Generic errors.
DIAG(err_parse_error, ERROR,
     "parse error")
DIAG(err_expected_expression, ERROR,
     "expected expression")
DIAG(err_invalid_receiver_to_message, ERROR,
     "invalid receiver to message expression")
DIAG(err_expected_external_declaration, ERROR,
     "expected external declaration")
DIAG(err_expected_ident, ERROR,
     "expected identifier")
DIAG(err_expected_ident_lparen, ERROR,
     "expected identifier or '('")
DIAG(err_expected_ident_lbrace, ERROR,
     "expected identifier or '{'")
DIAG(err_expected_lbrace, ERROR,
     "expected '{'")
DIAG(err_expected_rparen, ERROR,
     "expected ')'")
DIAG(err_expected_rsquare, ERROR,
     "expected ']'")
DIAG(err_expected_rbrace, ERROR,
     "expected '}'")
DIAG(err_expected_greater, ERROR,
     "expected '>'")
DIAG(err_expected_semi_decl_list, ERROR,
     "expected ';' at end of declaration list")
DIAG(ext_expected_semi_decl_list, EXTENSION,
     "expected ';' at end of declaration list")
DIAG(err_function_declared_typedef, ERROR,
     "function definition declared 'typedef'")
DIAG(err_expected_fn_body, ERROR,
     "expected function body after function declarator")
DIAG(err_expected_method_body, ERROR,
     "expected method body")
DIAG(err_expected_after_declarator, ERROR,
     "expected '=', ',', ';', 'asm', or '__attribute__' after declarator")
DIAG(err_expected_statement, ERROR,
     "expected statement")
DIAG(err_expected_lparen_after, ERROR,
     "expected '(' after '%0'")
DIAG(err_expected_less_after, ERROR,
     "expected '<' after '%0'")
DIAG(err_expected_comma, ERROR,
     "expected ','")
DIAG(err_expected_lbrace_in_compound_literal, ERROR,
     "expected '{' in compound literal")
DIAG(err_expected_while, ERROR,
     "expected 'while' in do/while loop")
DIAG(err_expected_semi_after, ERROR,
     "expected ';' after %0")
DIAG(err_expected_semi_after_expr, ERROR,
     "expected ';' after expression")
DIAG(err_expected_semi_for, ERROR,
     "expected ';' in 'for' statement specifier")
DIAG(err_non_variable_decl_in_for, ERROR,
     "declaration of non-local variable in 'for' loop")
DIAG(err_expected_colon_after, ERROR,
     "expected ':' after %0")
DIAG(err_label_end_of_compound_statement, ERROR,
     "label at end of compound statement: expected statement")
DIAG(err_expected_colon, ERROR,
     "expected ':'")
DIAG(err_expected_string_literal, ERROR,
     "expected string literal")
DIAG(err_expected_asm_operand, ERROR,
     "expected string literal or '[' for asm operand")

DIAG(err_unexpected_at, ERROR,
     "unexpected '@' in program")

/// err_matching - this is used as a continuation of a previous error, e.g. to 
/// specify the '(' when we expected a ')'.  This should probably be some
/// special sort of diagnostic kind to indicate that it is the second half of
/// the previous diagnostic.
DIAG(err_matching, ERROR,
     "to match this '%0'")

/// Objective-C parser diagnostics
DIAG(err_unexpected_interface, ERROR,
     "unexpected interface name '%0': expected expression")
DIAG(err_objc_no_attributes_on_category, ERROR,
     "attributes may not be specified on a category")
DIAG(err_objc_missing_end, ERROR,
     "missing @end")
DIAG(err_objc_illegal_visibility_spec, ERROR,
     "illegal visibility specification")
DIAG(err_objc_illegal_interface_qual, ERROR,
     "illegal interface qualifier")
DIAG(err_objc_expected_equal, ERROR,
     "setter/getter expects '=' followed by name")
DIAG(err_objc_expected_property_attr, ERROR,
     "unknown property attribute detected")
DIAG(err_objc_protocol_required, ERROR,
     "@required may be specified in protocols only")
DIAG(err_objc_protocol_optional, ERROR,
     "@optional may be specified in protocols only")
DIAG(err_missing_catch_finally, ERROR,
     "@try statment without a @catch and @finally clause")
DIAG(err_objc_concat_string, ERROR,
     "unexpected token after Objective-C string")
DIAG(err_undef_superclass, ERROR,
     "cannot find interface declaration for '%0', superclass of '%1'")
DIAG(err_duplicate_class_def, ERROR,
     "duplicate interface declaration for class '%0'")
DIAG(warn_undef_protocolref, WARNING,
     "cannot find protocol definition for '%0', referenced by '%1'")
DIAG(err_duplicate_protocol_def, ERROR,
     "duplicate protocol declaration of '%0'")
DIAG(err_undef_interface, ERROR,
     "cannot find interface declaration for '%0'")
DIAG(err_dup_category_def, ERROR,
     "duplicate interface declaration for category '%0(%1)'")
DIAG(warn_undef_interface, WARNING,
     "cannot find interface declaration for '%0'")
DIAG(err_dup_implementation_class, ERROR,
     "reimplementation of class '%0'")
DIAG(err_conflicting_super_class, ERROR,
     "conflicting super class name '%0'")
DIAG(err_conflicting_ivar_name, ERROR,
     "conflicting instance variable name '%0'")
DIAG(err_inconsistant_ivar_count, ERROR,
     "inconsistent number of instance variables specified")
DIAG(err_conflicting_ivar_type, ERROR,
     "conflicting instance variable type")
DIAG(warn_undef_method_impl, WARNING,
     "method definition for '%0' not found")
DIAG(warn_incomplete_impl, WARNING,
     "incomplete implementation")
DIAG(error_duplicate_method_decl, ERROR,
     "duplicate declaration of method '%0'")
DIAG(err_previous_declaration, ERROR,
     "previous declaration is here")
DIAG(err_previous_implicit_declaration, ERROR,
     "previous implicit declaration is here")
DIAG(err_undeclared_protocol, ERROR,
     "cannot find protocol declaration for '%0'")
DIAG(err_missing_sel_definition, ERROR,
     "cannot find definition of 'SEL'")
DIAG(err_missing_id_definition, ERROR,
     "cannot find definition of 'id'")
DIAG(err_missing_proto_definition, ERROR,
     "cannot find definition of 'Protocol'")
DIAG(err_missing_class_definition, ERROR,
     "cannot find definition of 'Class'")
DIAG(warn_previous_alias_decl, WARNING,
     "previously declared alias is ignored")
DIAG(warn_previous_declaration, WARNING,
     "previous declaration is here")
DIAG(err_conflicting_aliasing_type, ERROR,
     "conflicting types for alias '%0'")
DIAG(err_statically_allocated_object, ERROR,
     "statically allocated Objective-C object '%0'")
DIAG(warn_method_not_found, WARNING,
     "method '%0%1' not found (return type defaults to 'id')")
DIAG(warn_method_not_found_in_protocol, WARNING,
     "method '%0%1' not found in protocol (return type defaults to 'id')")
DIAG(err_collection_expr_type, ERROR,
     "collection expression type ('%0') is not a valid object")
DIAG(err_selector_element_type, ERROR,
     "selector element type ('%0') is not a valid object")
DIAG(err_toomany_element_decls, ERROR,
     "Only one element declaration is allowed")
DIAG(warn_expected_implementation, WARNING,
     "@end must appear in an @implementation context")
DIAG(error_missing_method_context, ERROR,
     "missing context for method declaration")
DIAG(error_bad_receiver_type, ERROR,
     "bad receiver type '%0'")
DIAG(error_no_super_class, ERROR,
     "no super class declared in @interface for '%0'")
DIAG(error_missing_property_context, ERROR,
     "missing context for property implementation declaration")
DIAG(error_bad_property_context, ERROR,
     "property implementation must be in a class or category implementation")
DIAG(error_bad_property_decl, ERROR,
     "property implementation must have its declaration in interface '%0'")
DIAG(error_bad_category_property_decl, ERROR,
     "property implementation must have its declaration in the category '%0'")
DIAG(error_property_ivar_decl, ERROR,
     "property synthesize requires specification of an ivar")
DIAG(error_dynamic_property_ivar_decl, ERROR,
     "dynamic property can not have ivar specification")
DIAG(error_missing_property_interface, ERROR,
     "property implementation in a category with no category declaration")
DIAG(error_missing_property_ivar_decl, ERROR,
     "synthesized property '%0' must either be named the same as a compatible"
     " ivar or must explicitly name an ivar")
DIAG(error_synthesize_category_decl, ERROR,
     "@synthesize not allowed in a category's implementation")
DIAG(error_property_ivar_type, ERROR,
     "type of property '%0'  does not match type of ivar '%1'") 
DIAG(warn_readonly_property, WARNING,
     "attribute 'readonly' of property '%0' restricts attribute "
     "'readwrite' of property inherited from '%1'")
DIAG(warn_property_attribute, WARNING,
     "property '%0' '%1' attribute does not match the property inherited from'%2' ")
DIAG(warn_property_type, WARNING,
     "property type '%0' does not match property type inherited from '%1'")

//===----------------------------------------------------------------------===//
// Semantic Analysis
//===----------------------------------------------------------------------===//

// Semantic analysis of string and character constant literals.
DIAG(ext_nonstandard_escape, EXTENSION,
     "use of non-standard escape character '\\%0'")
DIAG(ext_unknown_escape, EXTENSION,
     "unknown escape sequence '\\%0'")
DIAG(warn_extraneous_wide_char_constant, WARNING,
     "extraneous characters in wide character constant ignored")
DIAG(warn_char_constant_too_large, WARNING,
     "character constant too long for its type")
DIAG(warn_hex_escape_too_large, WARNING,
     "hex escape sequence out of range")
DIAG(warn_octal_escape_too_large, WARNING,
     "octal escape sequence out of range")

DIAG(err_hex_escape_no_digits, ERROR,
     "\\x used with no following hex digits")
     
DIAG(err_predef_outside_function, ERROR,
     "predefined identifier is only valid inside function")

// Declarations.
DIAG(err_typename_requires_specqual, ERROR,
     "type name requires a specifier or qualifier")
DIAG(err_typename_invalid_storageclass, ERROR,
     "type name does not allow storage class to be specified")
DIAG(err_typename_invalid_functionspec, ERROR,
     "type name does not allow function specifier to be specified")
DIAG(err_invalid_decl_spec_combination, ERROR,
     "cannot combine with previous '%0' declaration specifier")
DIAG(err_invalid_sign_spec, ERROR,
     "'%0' cannot be signed or unsigned")
DIAG(err_invalid_short_spec, ERROR,
     "'short %0' is invalid")
DIAG(err_invalid_long_spec, ERROR,
     "'long %0' is invalid")
DIAG(err_invalid_longlong_spec, ERROR,
     "'long long %0' is invalid")
DIAG(ext_longlong, EXTENSION,
     "'long long' is an extension when C99 mode is not enabled")
DIAG(err_invalid_complex_spec, ERROR,
     "'_Complex %0' is invalid")
DIAG(err_invalid_thread_spec, ERROR,
     "'__thread %0' is invalid")
DIAG(err_ellipsis_first_arg, ERROR,
     "ISO C requires a named argument before '...'")
DIAG(err_unspecified_vla_size_with_static, ERROR,
     "'static' may not be used with an unspecified variable length array size")
DIAG(ext_vla, EXTENSION,
     "variable length arrays are a C99 feature, accepted as an extension")
DIAG(err_invalid_storage_class_in_func_decl, ERROR,
     "invalid storage class specifier in function declarator")
DIAG(ext_anon_param_requires_type_specifier, EXTENSION,
     "type specifier required for unnamed parameter, defaults to int")
DIAG(err_missing_param, ERROR,
     "expected parameter declarator")

DIAG(err_invalid_reference_qualifier_application, ERROR,
     "'%0' qualifier may not be applied to a reference")
DIAG(err_declarator_need_ident, ERROR,
     "declarator requires an identifier")
DIAG(err_bad_language, ERROR,
     "unknown linkage language")

// Attributes
DIAG(err_attribute_wrong_number_arguments, ERROR,
     "attribute requires %0 argument(s)")
DIAG(err_attribute_invalid_vector_type, ERROR,
     "invalid vector type '%0'")
DIAG(err_attribute_argument_not_int, ERROR,
     "'%0' attribute requires integer constant")
DIAG(err_attribute_argument_n_not_int, ERROR,
     "'%0' attribute requires parameter %1 to be an integer constant")
DIAG(err_attribute_argument_n_not_string, ERROR,
     "'%0' attribute requires parameter %1 to be a string")
DIAG(err_attribute_argument_out_of_bounds, ERROR,
     "'%0' attribute parameter %1 is out of bounds")
DIAG(err_format_strftime_third_parameter, ERROR,
     "strftime format attribute requires 3rd parameter to be 0")
DIAG(err_format_attribute_requires_variadic, ERROR,
     "format attribute requires variadic function")
DIAG(err_format_attribute_not_string, ERROR,
     "format argument not a string type")
DIAG(err_format_attribute_not_NSString, ERROR,
    "format argument is not an NSString")
DIAG(err_attribute_invalid_size, ERROR,
     "vector size not an integral multiple of component size")
DIAG(err_attribute_zero_size, ERROR,
     "zero vector size")
DIAG(err_typecheck_vector_not_convertable, ERROR,
     "can't convert between vector values of different size ('%0' and '%1')")
DIAG(err_typecheck_ext_vector_not_typedef, ERROR,
     "ext_vector_type only applies to types, not variables")
DIAG(err_ext_vector_component_exceeds_length, ERROR,
     "vector component access exceeds type '%0'")
DIAG(err_ext_vector_component_name_illegal, ERROR,
     "illegal vector component name '%0'")
DIAG(err_ext_vector_component_access, ERROR,
     "vector component access limited to variables")
DIAG(err_attribute_address_space_not_int, ERROR,
     "address space attribute requires an integer constant")
DIAG(err_attribute_address_multiple_qualifiers, ERROR,
     "multiple address spaces specified for type")
DIAG(err_as_qualified_auto_decl, ERROR,
     "automatic variable qualified with an address space")
DIAG(err_attribute_annotate_no_string, ERROR,
     "argument to annotate attribute was not a string literal")
DIAG(warn_attribute_ignored, WARNING,
  "'%0' attribute ignored")
DIAG(warn_attribute_wrong_decl_type, WARNING,
  "'%0' attribute only applies to %1 types")
DIAG(warn_attribute_ignored_for_field_of_type, WARNING,
  "'%0' attribute ignored for field of type '%1'")
DIAG(warn_attribute_type_not_supported, WARNING,
  "'%0' attribute argument not supported: '%1'")

// Function Parameter Semantic Analysis.
DIAG(err_param_with_void_type, ERROR,
     "argument may not have 'void' type")
DIAG(err_void_only_param, ERROR,
     "'void' must be the first and only parameter if specified")
DIAG(err_void_param_qualified, ERROR,
     "'void' as parameter must not have type qualifiers")
DIAG(err_param_redefinition, ERROR,
     "redefinition of parameter '%0'")
DIAG(err_ident_list_in_fn_declaration, ERROR,
     "a parameter list without types is only allowed in a function definition")
DIAG(err_declaration_does_not_declare_param, ERROR,
     "declaration does not declare a parameter")
DIAG(err_no_matching_param, ERROR,
     "parameter named '%0' is missing")
DIAG(ext_param_not_declared, EXTENSION,
     "parameter '%0' was not declared, defaulting to type 'int'")
DIAG(ext_param_typedef_of_void, EXTENSION,
     "empty parameter list defined with a typedef of 'void' not allowed in C++")
DIAG(err_param_default_argument, ERROR,
     "C does not support default arguments")
DIAG(err_param_default_argument_redefinition, ERROR,
     "redefinition of default argument")
DIAG(err_param_default_argument_missing, ERROR,
     "missing default argument on parameter")
DIAG(err_param_default_argument_missing_name, ERROR,
     "missing default argument on parameter '%0'")
DIAG(err_param_default_argument_references_param, ERROR,
     "default argument references parameter '%0'")
DIAG(err_param_default_argument_references_local, ERROR,
     "default argument references local variable '%0' of enclosing function")
DIAG(err_param_default_argument_nonfunc, ERROR,
     "default arguments can only be specified for parameters in a function declaration")
DIAG(err_previous_definition, ERROR,
     "previous definition is here")
DIAG(err_previous_use, ERROR,
     "previous use is here")
DIAG(err_first_label, ERROR,
    "first label is here")

DIAG(err_unexpected_typedef, ERROR,
     "unexpected type name '%0': expected expression")
DIAG(err_unexpected_namespace, ERROR,
     "unexpected namespace name '%0': expected expression")
DIAG(err_unexpected_typedef_ident, ERROR,
     "unexpected type name '%0': expected identifier")
DIAG(err_undeclared_var_use, ERROR,
     "use of undeclared identifier '%0'")
DIAG(warn_deprecated, WARNING,
     "'%0' is deprecated")
DIAG(err_redefinition, ERROR,
     "redefinition of '%0'")
DIAG(err_static_non_static, ERROR,
     "static declaration of '%0' follows non-static declaration")
DIAG(err_non_static_static, ERROR,
     "non-static declaration of '%0' follows static declaration")
DIAG(err_redefinition_different_kind, ERROR,
     "redefinition of '%0' as different kind of symbol")
DIAG(err_conflicting_types, ERROR,
     "conflicting types for '%0'")
DIAG(err_nested_redefinition, ERROR,
     "nested redefinition of '%0'")
DIAG(err_use_with_wrong_tag, ERROR,
     "use of '%0' with tag type that does not match previous declaration")
DIAG(ext_forward_ref_enum, EXTENSION,
     "ISO C forbids forward references to 'enum' types")
DIAG(err_redefinition_of_enumerator, ERROR,
     "redefinition of enumerator '%0'")
DIAG(err_duplicate_member, ERROR,
     "duplicate member '%0'")
DIAG(err_enum_value_not_integer_constant_expr, ERROR,
     "enumerator value for '%0' is not an integer constant")
DIAG(ext_enum_value_not_int, EXTENSION,
     "ISO C restricts enumerator values to range of 'int' (%0 is too large)")
DIAG(warn_enum_too_large, WARNING,
     "enumeration values exceed range of largest integer")
DIAG(err_case_label_not_integer_constant_expr, ERROR,
     "case label does not reduce to an integer constant")
DIAG(err_typecheck_illegal_vla, ERROR,
     "variable length array declared outside of any function")
DIAG(err_typecheck_negative_array_size, ERROR,
     "array size is negative")
DIAG(warn_typecheck_function_qualifiers, WARNING,
     "qualifier on function type '%0' has unspecified behavior")
DIAG(err_typecheck_invalid_restrict_not_pointer, ERROR,
     "restrict requires a pointer or reference ('%0' is invalid)")
DIAG(err_typecheck_invalid_restrict_invalid_pointee, ERROR,
     "pointer to function type ('%0') may not be 'restrict' qualified")
DIAG(ext_typecheck_zero_array_size, EXTENSION,
     "zero size arrays are an extension")
DIAG(err_at_least_one_initializer_needed_to_size_array, ERROR,
    "at least one initializer value required to size array")
DIAG(err_array_size_non_int, ERROR,
     "size of array has non-integer type '%0'")
DIAG(err_init_element_not_constant, ERROR,
     "initializer element is not constant")
DIAG(err_block_extern_cant_init, ERROR,
     "'extern' variable cannot have an initializer")
DIAG(warn_extern_init, WARNING,
     "'extern' variable has an initializer")
DIAG(err_variable_object_no_init, ERROR,
     "variable-sized object may not be initialized")
DIAG(err_array_init_list_required, ERROR,
     "initialization with \"{...}\" expected for array")
DIAG(warn_excess_initializers, WARNING,
     "excess elements in array initializer")
DIAG(err_excess_initializers_in_char_array_initializer, ERROR,
    "excess elements in char array initializer")
DIAG(warn_initializer_string_for_char_array_too_long, WARNING,
    "initializer-string for char array is too long")
DIAG(warn_braces_around_scalar_init, WARNING,
     "braces around scalar initializer")
DIAG(err_illegal_initializer, ERROR,
     "illegal initializer (only variables can be initialized)")

DIAG(err_redefinition_of_label, ERROR,
     "redefinition of label '%0'")
DIAG(err_undeclared_label_use, ERROR,
     "use of undeclared label '%0'")

DIAG(warn_implicit_function_decl, WARNING,
     "implicit declaration of function '%0'")
DIAG(ext_implicit_function_decl, EXTENSION,
     "implicit declaration of function '%0' is invalid in C99")

DIAG(err_func_returning_array_function, ERROR,
     "function cannot return array or function type '%0'")
DIAG(err_field_declared_as_function, ERROR,
     "field '%0' declared as a function")
DIAG(err_field_incomplete, ERROR,
     "field '%0' has incomplete type")
DIAG(err_variable_sized_type_in_struct, EXTENSION,
     "variable sized type '%0' must be at end of struct or class")
DIAG(err_flexible_array_empty_struct, ERROR,
     "flexible array '%0' not allowed in otherwise empty struct")
DIAG(ext_flexible_array_in_struct, EXTENSION,
     "'%0' may not be nested in a struct due to flexible array member")
DIAG(err_flexible_array_in_array, ERROR,
     "'%0' may not be used as an array element due to flexible array member")
DIAG(err_illegal_decl_array_of_functions, ERROR,
     "'%0' declared as array of functions")
DIAG(err_illegal_decl_array_incomplete_type, ERROR,
     "array has incomplete element type '%0'")
DIAG(err_illegal_decl_array_of_references, ERROR,
     "'%0' declared as array of references")
DIAG(err_illegal_decl_pointer_to_reference, ERROR,
     "'%0' declared as a pointer to a reference")
DIAG(err_illegal_decl_reference_to_reference, ERROR,
     "'%0' declared as a reference to a reference")

// Expressions.
DIAG(ext_sizeof_function_type, EXTENSION,
     "invalid application of 'sizeof' to a function type")
DIAG(ext_sizeof_void_type, EXTENSION,
     "invalid application of '%0' to a void type")
DIAG(err_sizeof_incomplete_type, ERROR,
     "invalid application of 'sizeof' to an incomplete type '%0'")
DIAG(err_alignof_incomplete_type, ERROR,
     "invalid application of '__alignof' to an incomplete type '%0'")
DIAG(err_offsetof_record_type, ERROR,
     "offsetof requires struct, union, or class type, '%0' invalid")
DIAG(err_offsetof_array_type, ERROR,
     "offsetof requires array type, '%0' invalid")
DIAG(ext_offsetof_extended_field_designator, EXTENSION,
     "using extended field designator is an extension")
     
DIAG(err_invalid_suffix_integer_constant, ERROR,
     "invalid suffix '%0' on integer constant")
DIAG(err_invalid_suffix_float_constant, ERROR,
     "invalid suffix '%0' on floating constant")
DIAG(ext_imaginary_constant, EXTENSION,
     "imaginary constants are an extension")
DIAG(warn_integer_too_large, WARNING,
     "integer constant is too large for its type")
DIAG(warn_integer_too_large_for_signed, WARNING,
     "integer constant is so large that it is unsigned")
DIAG(err_exponent_has_no_digits, ERROR,
     "exponent has no digits")
DIAG(ext_binary_literal, EXTENSION,
     "binary integer literals are an extension")
DIAG(err_invalid_binary_digit, ERROR,
     "invalid digit '%0' in binary constant")
DIAG(err_invalid_octal_digit, ERROR,
     "invalid digit '%0' in octal constant")
DIAG(err_invalid_decimal_digit, ERROR,
     "invalid digit '%0' in decimal constant")
DIAG(err_hexconstant_requires_exponent, ERROR,
     "hexadecimal floating constants require an exponent")
DIAG(err_typecheck_subscript_value, ERROR,
     "subscripted value is neither array nor pointer")
DIAG(err_typecheck_subscript, ERROR,
     "array subscript is not an integer")
DIAG(err_typecheck_subscript_not_object, ERROR,
     "illegal subscript of non-object type '%0'")
DIAG(err_typecheck_member_reference_structUnion, ERROR,
     "member reference is not to a structure or union")
DIAG(err_typecheck_member_reference_arrow, ERROR,
     "member reference is not a pointer")
DIAG(err_typecheck_incomplete_tag, ERROR,
     "incomplete definition of type '%0'")
DIAG(err_typecheck_no_member, ERROR,
     "no member named '%0'")
DIAG(err_typecheck_illegal_increment_decrement, ERROR,
     "cannot modify value of type '%0'")
DIAG(err_typecheck_invalid_lvalue_incr_decr, ERROR,
     "invalid lvalue in increment/decrement expression")
DIAG(err_typecheck_arithmetic_incomplete_type, ERROR,
     "arithmetic on pointer to incomplete type '%0'")
DIAG(err_typecheck_decl_incomplete_type, ERROR,
     "variable has incomplete type '%0'")
DIAG(err_realimag_invalid_type, ERROR,
     "invalid type '%0' to __real or __imag operator")
DIAG(err_typecheck_sclass_fscope, ERROR,
     "illegal storage class on file-scoped variable")
DIAG(err_typecheck_sclass_func, ERROR,
     "illegal storage class on function")
DIAG(err_typecheck_address_of, ERROR,
     "address of %0 requested")
DIAG(err_typecheck_invalid_lvalue_addrof, ERROR,
     "address expression must be an lvalue or a function designator")
DIAG(err_typecheck_unary_expr, ERROR,
     "invalid argument type to unary expression '%0'")
DIAG(err_typecheck_indirection_requires_pointer, ERROR,
     "indirection requires pointer operand ('%0' invalid)")
DIAG(err_typecheck_invalid_operands, ERROR,
     "invalid operands to binary expression ('%0' and '%1')")
DIAG(err_typecheck_sub_ptr_object, ERROR,
     "'%0' is not a complete object type")
DIAG(err_typecheck_sub_ptr_compatible, ERROR,
     "'%0' and '%1' are not pointers to compatible types")
DIAG(ext_typecheck_comparison_of_pointer_integer, WARNING,
     "comparison between pointer and integer ('%0' and '%1')")
DIAG(ext_typecheck_comparison_of_distinct_pointers, WARNING,
     "comparison of distinct pointer types ('%0' and '%1')")
DIAG(err_typecheck_assign_const, ERROR,
     "read-only variable is not assignable")

// assignment related diagnostics (also for argument passing, returning, etc).
DIAG(err_typecheck_convert_incompatible, ERROR,
     "incompatible type %2 '%1', expected '%0'")
DIAG(ext_typecheck_convert_pointer_int, EXTENSION,
     "incompatible pointer to integer conversion %2 '%1', expected '%0'")
DIAG(ext_typecheck_convert_int_pointer, EXTENSION,
     "incompatible integer to pointer conversion %2 '%1', expected '%0'")
DIAG(ext_typecheck_convert_pointer_void_func, EXTENSION,
     "%2 '%1' converts between void* and function pointer, expected '%0'")
DIAG(ext_typecheck_convert_incompatible_pointer, EXTENSION,
     "incompatible pointer types %2 '%1', expected '%0'")
DIAG(ext_typecheck_convert_discards_qualifiers, EXTENSION,
     "%2 '%1' discards qualifiers, expected '%0'")
     
DIAG(err_typecheck_array_not_modifiable_lvalue, ERROR,
     "array type '%0' is not assignable")
DIAG(err_typecheck_non_object_not_modifiable_lvalue, ERROR,
     "non-object type '%0' is not assignable")
DIAG(err_typecheck_expression_not_modifiable_lvalue, ERROR,
     "expression is not assignable")
DIAG(err_typecheck_incomplete_type_not_modifiable_lvalue, ERROR,
     "incomplete type '%0' is not assignable")
DIAG(err_typecheck_duplicate_vector_components_not_mlvalue, ERROR,
     "vector is not assignable (contains duplicate components)")
DIAG(err_typecheck_call_not_function, ERROR,
     "called object is not a function or function pointer")
DIAG(err_typecheck_call_too_few_args, ERROR,
     "too few arguments to function")
DIAG(err_typecheck_call_too_many_args, ERROR,
     "too many arguments to function")
DIAG(err_typecheck_call_invalid_ordered_compare, ERROR,
     "ordered compare requires two args of floating point type ('%0' and '%1')")
DIAG(err_typecheck_cond_expect_scalar, ERROR,
     "used type '%0' where arithmetic or pointer type is required")
DIAG(err_typecheck_expect_scalar_operand, ERROR,
     "operand of type '%0' where arithmetic or pointer type is required")
DIAG(err_typecheck_cond_incompatible_operands, ERROR,
     "incompatible operand types ('%0' and '%1')")
DIAG(warn_typecheck_cond_incompatible_pointers, WARNING,
     "pointer type mismatch ('%0' and '%1')")
DIAG(err_typecheck_choose_expr_requires_constant, ERROR,
     "'__builtin_choose_expr' requires a constant expression")
DIAG(warn_unused_expr, WARNING,
     "expression result unused")
DIAG(err_pascal_string_too_long, ERROR,
    "Pascal string is too long")
DIAG(err_invalid_lvalue_in_asm_output, ERROR,
    "invalid lvalue in asm output")
DIAG(err_invalid_output_constraint_in_asm, ERROR,
    "invalid output constraint in asm")
DIAG(err_invalid_input_constraint_in_asm, ERROR,
    "invalid input constraint in asm")
DIAG(err_invalid_type_in_asm_input, ERROR,
    "invalid type '%0' in asm input")
DIAG(err_unknown_register_name_in_asm, ERROR,
    "unknown register name '%0' in asm")
DIAG(err_invalid_conversion_between_vectors, ERROR,
    "invalid conversion between vector type '%0' and '%1' of different size")
DIAG(err_invalid_conversion_between_vector_and_integer, ERROR,
    "invalid conversion between vector type '%0' and integer type '%1' "
    "of different size")
DIAG(err_invalid_conversion_between_vector_and_scalar, ERROR,
    "invalid conversion between vector type '%0' and scalar type '%1'")
DIAG(err_overload_expr_requires_non_zero_constant, ERROR,
     "overload requires a non-zero constant expression as first argument")
DIAG(err_overload_incorrect_fntype, ERROR,
     "argument is not a function, or has wrong number of parameters")
DIAG(err_overload_no_match, ERROR,
     "no matching overload found for arguments of type '%0'")
DIAG(err_overload_multiple_match, ERROR,
     "more than one matching function found in __builtin_overload")

// Classes.
DIAG(err_dup_virtual, ERROR,
     "duplicate 'virtual' in base specifier")
DIAG(err_expected_class_name, ERROR,
     "expected class name")
DIAG(err_anon_type_definition, ERROR,
     "declaration of anonymous %0 must be a definition")
DIAG(err_base_clause_on_union, ERROR,
     "unions cannot have base classes")
DIAG(err_base_must_be_class, ERROR,
     "base specifier must name a class")
DIAG(err_union_as_base_class, ERROR,
     "unions cannot be base classes")
DIAG(err_incomplete_base_class, ERROR,
     "base class has incomplete type")

// CHECK: printf format string errors
DIAG(warn_printf_not_string_constant, WARNING,
     "format string is not a string literal (potentially insecure)")
DIAG(warn_printf_write_back, WARNING,
     "use of '%n' in format string discouraged (potentially insecure)")
DIAG(warn_printf_insufficient_data_args, WARNING,
    "more '%' conversions than data arguments")
DIAG(warn_printf_too_many_data_args, WARNING,
    "more data arguments than '%' conversions")
DIAG(warn_printf_invalid_conversion, WARNING,
    "invalid conversion '%0'")
DIAG(warn_printf_missing_format_string, WARNING,
    "format string missing")
DIAG(warn_printf_empty_format_string, WARNING,
   "format string is empty")
DIAG(warn_printf_format_string_is_wide_literal, WARNING,
  "format string should not be a wide string")
DIAG(warn_printf_format_string_contains_null_char, WARNING,
  "format string contains '\\0' within the string body")
DIAG(warn_printf_asterisk_width_missing_arg, WARNING,
     "'*' specified field width is missing a matching 'int' argument")
DIAG(warn_printf_asterisk_precision_missing_arg, WARNING,
     "'.*' specified field precision is missing a matching 'int' argument")
DIAG(warn_printf_asterisk_width_wrong_type, WARNING,
     "field width should have type 'int', but argument has type '%0'")
DIAG(warn_printf_asterisk_precision_wrong_type, WARNING,
     "field precision should have type 'int', but argument has type '%0'")

// CHECK: returning address/reference of stack memory
DIAG(warn_ret_stack_addr, WARNING,
  "address of stack memory associated with local variable '%0' returned")
DIAG(warn_ret_stack_ref, WARNING,
  "reference to stack memory associated with local variable '%0' returned")

// CHECK: floating point values should not use "==" or "!="
DIAG(warn_floatingpoint_eq, WARNING,
  "comparing floating point with == or != is unsafe")

// CHECK: for non-floating point, expressions of the form x == x or x != x
// should result in a warning, since these always evaluate to a constant.
DIAG(warn_selfcomparison,WARNING,
     "self-comparison always results in a constant value.")

// CHECK: stores to variables that are no longer live (dead stores)
DIAG(warn_dead_store, WARNING, "value stored to variable is never used")

// CHECK: use of uninitialized values
DIAG(warn_uninit_val, WARNING, "use of uninitialized variable")

// CFString checking
DIAG(err_cfstring_literal_not_string_constant, ERROR,
  "CFString literal is not a string constant")
DIAG(warn_cfstring_literal_contains_non_ascii_character, WARNING,
  "CFString literal contains non-ASCII character")
DIAG(warn_cfstring_literal_contains_nul_character, WARNING,
  "CFString literal contains NUL character")

// Statements.
DIAG(err_continue_not_in_loop, ERROR,
     "'continue' statement not in loop statement")
DIAG(err_break_not_in_loop_or_switch, ERROR,
     "'break' statement not in loop or switch statement")
DIAG(err_default_not_in_switch, ERROR,
     "'default' statement not in switch statement")
DIAG(err_case_not_in_switch, ERROR,
     "'case' statement not in switch statement")
DIAG(warn_case_value_overflow, WARNING,
     "overflow converting case value to switch condition type (%0 to %1)")
DIAG(err_duplicate_case, ERROR,
     "duplicate case value '%0'")
DIAG(err_duplicate_case_prev, ERROR,
     "previous case value occurrence defined here")
DIAG(warn_case_empty_range, WARNING,
     "empty case range specified")
DIAG(err_typecheck_statement_requires_scalar, ERROR,
     "statement requires expression of scalar type ('%0' invalid)")
DIAG(err_typecheck_statement_requires_integer, ERROR,
    "statement requires expression of integer type ('%0' invalid)")
DIAG(err_multiple_default_labels_defined, ERROR,
    "multiple default labels in one switch")
DIAG(warn_empty_if_body, WARNING,
    "if statement has empty body")
DIAG(err_va_start_used_in_non_variadic_function, ERROR,
    "'va_start' used in function with fixed args")
DIAG(warn_second_parameter_of_va_start_not_last_named_argument, WARNING,
    "second parameter of 'va_start' not last named argument")
DIAG(err_first_argument_to_va_arg_not_of_type_va_list, ERROR,
    "first argument to 'va_arg' is of type '%0' and not 'va_list'")
  
DIAG(warn_return_missing_expr, WARNING,
     "non-void function '%0' should return a value")
DIAG(ext_return_missing_expr, EXTENSION,
     "non-void function '%0' should return a value")
DIAG(ext_return_has_expr, EXTENSION,
     "void function '%0' should not return a value")

#undef DIAG
