зеркало из https://github.com/microsoft/clang.git
Heh, funny thing, 'void' isn't a POD type. Nice of us to suggest it to
silence this warning. ;] Fixed that obvious bug and added a bit more testing as well. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130318 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
67d097e123
Коммит
134cb4442d
|
@ -1810,7 +1810,7 @@ void Sema::CheckMemsetArguments(const CallExpr *Call) {
|
|||
QualType DestTy = Dest->getType();
|
||||
if (const PointerType *DestPtrTy = DestTy->getAs<PointerType>()) {
|
||||
QualType PointeeTy = DestPtrTy->getPointeeType();
|
||||
if (!PointeeTy->isPODType()) {
|
||||
if (!PointeeTy->isPODType() && !PointeeTy->isVoidType()) {
|
||||
DiagRuntimeBehavior(
|
||||
Dest->getExprLoc(), Dest,
|
||||
PDiag(diag::warn_non_pod_memset)
|
||||
|
|
|
@ -32,7 +32,16 @@ void test_warn() {
|
|||
// expected-note {{explicitly cast the pointer to silence this warning}}
|
||||
}
|
||||
|
||||
void test_nowarn() {
|
||||
void test_nowarn(void *void_ptr) {
|
||||
int i, *iptr;
|
||||
float y;
|
||||
char c;
|
||||
|
||||
memset(&i, 0, sizeof i);
|
||||
memset(&iptr, 0, sizeof iptr);
|
||||
memset(&y, 0, sizeof y);
|
||||
memset(&c, 0, sizeof c);
|
||||
memset(void_ptr, 0, 42);
|
||||
memset(&s1, 0, sizeof s1);
|
||||
memset(&s2, 0, sizeof s2);
|
||||
memset(&s3, 0, sizeof s3);
|
||||
|
|
Загрузка…
Ссылка в новой задаче