Adapt the test suite to the new warnings produced.

Disable the indirect calls. We don't support them yet on AST level.
This commit is contained in:
Baozeng Ding 2013-09-09 15:32:53 +02:00 committed by sftnight
parent 2fe19f6639
commit a46498e831
2 changed files with 11 additions and 14 deletions

View File

@ -4,9 +4,9 @@
//XFAIL: darwin
char *p = 0;
strcmp("a", p); // expected-warning {{you are about to dereference null ptr, which probably will lead to seg violation. Do you want to proceed?[y/n]}}
strcmp("a", p); // expected-warning {{warning: null passed to a callee which requires a non-null argument}}
strcmp(p, "a"); // expected-warning {{you are about to dereference null ptr, which probably will lead to seg violation. Do you want to proceed?[y/n]}}
strcmp(p, "a"); // expected-warning {{warning: null passed to a callee which requires a non-null argument}}
extern "C" int printf(const char* fmt, ...);
.rawInput 1
@ -21,9 +21,8 @@ extern "C" int cannotCallWithNull(int* p) {
printf("Must not be called with p=0.\n");
return 1;
}
cannotCallWithNull() // expected-warning {{null passed to a callee which requires a non-null argument}}
// expected-warning {{you are about to dereference null ptr, which probably will lead to seg violation. Do you want to proceed?[y/n]}}
int *q = 0;
cannotCallWithNull(q); // expected-warning {{warning: null passed to a callee which requires a non-null argument}}
//CHECK-NOT: Must not be called with p=0.
cannotCallWithNull(new int(4))
//CHECK: (int) 1

View File

@ -1,5 +1,4 @@
// RUN: cat %s | %cling -Xclang -verify | FileCheck %s
// RUN: cat %s | %cling -Xclang -verify
// We must be able to handle cases where, there is a custom function that has
// attributes non-null arguments and we should be able to add a non-null arg
@ -28,10 +27,10 @@ int* p = new int(1);
float* f = new float(0.0);
const char* charNull = 0;
custom_namespace::standaloneFunc(pNull, 1, fNull); // expected-warning {{you are about to dereference null ptr, which probably will lead to seg violation. Do you want to proceed?[y/n]}}
custom_namespace::standaloneFunc(pNull, 1, f); // expected-warning {{you are about to dereference null ptr, which probably will lead to seg violation. Do you want to proceed?[y/n]}}
custom_namespace::standaloneFunc(p, 1, fNull); // expected-warning {{you are about to dereference null ptr, which probably will lead to seg violation. Do you want to proceed?[y/n]}}
printf(charNull, ""); // expected-warning {{you are about to dereference null ptr, which probably will lead to seg violation. Do you want to proceed?[y/n]}}
custom_namespace::standaloneFunc(pNull, 1, fNull); // expected-warning {{null passed to a callee which requires a non-null argument}}
custom_namespace::standaloneFunc(pNull, 1, f); // expected-warning {{null passed to a callee which requires a non-null argument}}
custom_namespace::standaloneFunc(p, 1, fNull); // expected-warning {{null passed to a callee which requires a non-null argument}}
printf(charNull, ""); // expected-warning {{null passed to a callee which requires a non-null argument}}
.rawInput 1
int trampoline() {
@ -41,8 +40,7 @@ int trampoline() {
return 1;
}
.rawInput 0
//CHECK-NOT: Must not be called with 0 args.
trampoline() // expected-warning {{you are about to dereference null ptr, which probably will lead to seg violation. Do you want to proceed?[y/n]}}
//CHECK: (int) 1
//trampoline()
.q