summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-01-06 22:21:46 +0000
committerChris Lattner <sabre@nondot.org>2008-01-06 22:21:46 +0000
commitcfb6f430b60b79a3f4137d4959f1722fbc0d5e41 (patch)
treedabe73b26ed329d311d5bddd6f216b290dad7bf6
parentdb911e90371ddc2228e9233ecc6cbc9d5b0b1b12 (diff)
downloadbcm5719-llvm-cfb6f430b60b79a3f4137d4959f1722fbc0d5e41.tar.gz
bcm5719-llvm-cfb6f430b60b79a3f4137d4959f1722fbc0d5e41.zip
Emit warnings like "dereferencing void pointer" instead of trying to
pretty print the type name for void. llvm-svn: 45664
-rw-r--r--clang/Sema/SemaExpr.cpp5
-rw-r--r--clang/include/clang/Basic/DiagnosticKinds.def2
2 files changed, 3 insertions, 4 deletions
diff --git a/clang/Sema/SemaExpr.cpp b/clang/Sema/SemaExpr.cpp
index c617c4667fc..78180be4978 100644
--- a/clang/Sema/SemaExpr.cpp
+++ b/clang/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/clang/include/clang/Basic/DiagnosticKinds.def b/clang/include/clang/Basic/DiagnosticKinds.def
index 97d58382afa..70acbbcc74d 100644
--- a/clang/include/clang/Basic/DiagnosticKinds.def
+++ b/clang/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,
OpenPOWER on IntegriCloud