[cfe-commits] r45664 - in /cfe/trunk: Sema/SemaExpr.cpp include/clang/Basic/DiagnosticKinds.def
Chris Lattner
sabre at nondot.org
Sun Jan 6 14:21:46 PST 2008
Author: lattner
Date: Sun Jan 6 16:21:46 2008
New Revision: 45664
URL: http://llvm.org/viewvc/llvm-project?rev=45664&view=rev
Log:
Emit warnings like "dereferencing void pointer" instead of trying to
pretty print the type name for void.
Modified:
cfe/trunk/Sema/SemaExpr.cpp
cfe/trunk/include/clang/Basic/DiagnosticKinds.def
Modified: cfe/trunk/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/SemaExpr.cpp?rev=45664&r1=45663&r2=45664&view=diff
==============================================================================
--- cfe/trunk/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/Sema/SemaExpr.cpp Sun Jan 6 16:21:46 2008
@@ -1634,10 +1634,9 @@
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());
Modified: cfe/trunk/include/clang/Basic/DiagnosticKinds.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticKinds.def?rev=45664&r1=45663&r2=45664&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticKinds.def (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticKinds.def Sun Jan 6 16:21:46 2008
@@ -750,7 +750,7 @@
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,
More information about the cfe-commits
mailing list