From: Chris Lattner Date: Sun, 6 Jan 2008 22:21:46 +0000 (+0000) Subject: Emit warnings like "dereferencing void pointer" instead of trying to X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5d5d210062b44ba40c1bb90b73c67be91428f54e;p=clang Emit warnings like "dereferencing void pointer" instead of trying to pretty print the type name for void. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45664 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/Sema/SemaExpr.cpp b/Sema/SemaExpr.cpp index c617c4667f..78180be497 100644 --- a/Sema/SemaExpr.cpp +++ b/Sema/SemaExpr.cpp @@ -1634,10 +1634,9 @@ QualType Sema::CheckIndirectionOperand(Expr *op, SourceLocation OpLoc) { QualType ptype = PT->getPointeeType(); // C99 6.5.3.2p4. "if it points to an object,...". if (ptype->isIncompleteType()) { // An incomplete type is not an object - // GCC compat: special case 'void *' (treat as warning). + // GCC compat: special case 'void *' (treat as extension, not error). if (ptype->isVoidType()) { - Diag(OpLoc, diag::ext_typecheck_deref_ptr_to_void, - qType.getAsString(), op->getSourceRange()); + Diag(OpLoc, diag::ext_typecheck_deref_ptr_to_void,op->getSourceRange()); } else { Diag(OpLoc, diag::err_typecheck_deref_incomplete_type, ptype.getAsString(), op->getSourceRange()); diff --git a/include/clang/Basic/DiagnosticKinds.def b/include/clang/Basic/DiagnosticKinds.def index 97d58382af..70acbbcc74 100644 --- a/include/clang/Basic/DiagnosticKinds.def +++ b/include/clang/Basic/DiagnosticKinds.def @@ -750,7 +750,7 @@ DIAG(err_typecheck_indirection_requires_pointer, ERROR, DIAG(err_typecheck_deref_incomplete_type, ERROR, "dereferencing pointer to incomplete type '%0'") DIAG(ext_typecheck_deref_ptr_to_void, WARNING, - "dereferencing '%0' pointer") + "dereferencing void pointer") DIAG(err_typecheck_invalid_operands, ERROR, "invalid operands to binary expression ('%0' and '%1')") DIAG(err_typecheck_sub_ptr_object, ERROR,