From: Chris Lattner Date: Thu, 3 Jan 2008 23:13:36 +0000 (+0000) Subject: regroup assignment-related diagnostics, fix a mistake in one. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2119c489cd251e104e1d472bafacd78784758536;p=clang regroup assignment-related diagnostics, fix a mistake in one. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45558 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/Sema/SemaExpr.cpp b/Sema/SemaExpr.cpp index 68c301afd8..bab7d3d7e9 100644 --- a/Sema/SemaExpr.cpp +++ b/Sema/SemaExpr.cpp @@ -2254,7 +2254,7 @@ bool Sema::CheckMessageArgumentTypes(Expr **Args, unsigned NumArgs, argExpr->getSourceRange()); break; case CompatiblePointerDiscardsQualifiers: - Diag(l, diag::ext_typecheck_passing_discards_qualifiers, + Diag(l, diag::ext_typecheck_sending_discards_qualifiers, rhsType.getAsString(), lhsType.getAsString(), argExpr->getSourceRange()); break; diff --git a/include/clang/Basic/DiagnosticKinds.def b/include/clang/Basic/DiagnosticKinds.def index 0f31c922cf..c97e52a6b5 100644 --- a/include/clang/Basic/DiagnosticKinds.def +++ b/include/clang/Basic/DiagnosticKinds.def @@ -759,6 +759,20 @@ 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") + + +DIAG(err_typecheck_return_incompatible, ERROR, + "incompatible type returning '%1', expected '%0'") +DIAG(ext_typecheck_return_pointer_int, EXTENSION, + "incompatible type returning '%1', expected '%0'") +DIAG(ext_typecheck_return_pointer_void_func, EXTENSION, + "returning '%1' to from function expecting '%0' converts between void*" + " and function pointer") +DIAG(ext_typecheck_return_incompatible_pointer, EXTENSION, + "incompatible pointer types returning '%1', expected '%0'") +DIAG(ext_typecheck_return_discards_qualifiers, EXTENSION, + "returning '%1' from function expecting '%0' discards qualifiers") + DIAG(err_typecheck_assign_incompatible, ERROR, "incompatible types assigning '%1' to '%0'") DIAG(ext_typecheck_assign_pointer_int, WARNING, @@ -769,24 +783,7 @@ DIAG(ext_typecheck_assign_discards_qualifiers, WARNING, "assigning '%1' to '%0' discards qualifiers") DIAG(ext_typecheck_assign_pointer_void_func, EXTENSION, "assigning '%1' to '%0' converts between void* and function pointer") -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_passing_incompatible, ERROR, "incompatible types passing '%0' to function expecting '%1'") DIAG(ext_typecheck_passing_incompatible_pointer, WARNING, @@ -798,6 +795,7 @@ DIAG(ext_typecheck_passing_pointer_void_func, EXTENSION, " and function pointer") DIAG(ext_typecheck_passing_discards_qualifiers, WARNING, "passing '%0' to '%1' discards qualifiers") + DIAG(err_typecheck_sending_incompatible, ERROR, "incompatible types passing '%0' to method expecting '%1'") DIAG(ext_typecheck_sending_incompatible_pointer, WARNING, @@ -807,6 +805,28 @@ DIAG(ext_typecheck_sending_pointer_int, WARNING, DIAG(ext_typecheck_sending_pointer_void_func, EXTENSION, "sending '%1' to method expecting '%0' converts between void*" " and function pointer") +DIAG(ext_typecheck_sending_discards_qualifiers, WARNING, + "sending '%0' to '%1' discards qualifiers") + + +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, @@ -913,17 +933,6 @@ 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_return_incompatible, ERROR, - "incompatible type returning '%1', expected '%0'") -DIAG(ext_typecheck_return_pointer_int, EXTENSION, - "incompatible type returning '%1', expected '%0'") -DIAG(ext_typecheck_return_pointer_void_func, EXTENSION, - "returning '%1' to from function expecting '%0' converts between void*" - " and function pointer") -DIAG(ext_typecheck_return_incompatible_pointer, EXTENSION, - "incompatible pointer type returning '%1', expected '%0'") -DIAG(ext_typecheck_return_discards_qualifiers, EXTENSION, - "returning '%1' from function expecting '%0' discards qualifiers") DIAG(err_typecheck_statement_requires_scalar, ERROR, "statement requires expression of scalar type ('%0' invalid)") DIAG(err_typecheck_statement_requires_integer, ERROR,