diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-02-14 00:32:47 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-02-14 00:32:47 +0000 |
commit | ac5d4c5f8ec84453fe22a3c3b1bdb8ffd765423e (patch) | |
tree | 146387c45453bb4edb7bdff4ba294e2d7baa521f /clang/test | |
parent | 6e1b2e36a5a8e27b07c9c3061621fe48d11fc031 (diff) | |
download | bcm5719-llvm-ac5d4c5f8ec84453fe22a3c3b1bdb8ffd765423e.tar.gz bcm5719-llvm-ac5d4c5f8ec84453fe22a3c3b1bdb8ffd765423e.zip |
Extend builtin "attribute" syntax to include a notation for
printf-like functions, both builtin functions and those in the
C library. The function-call checker now queries this attribute do
determine if we have a printf-like function, rather than scanning
through the list of "known functions IDs". However, there are 5
functions they are not yet "builtins", so the function-call checker
handles them specifically still:
- fprintf and vfprintf: the builtins mechanism cannot (yet)
express FILE* arguments, so these can't be encoded.
- NSLog: the builtins mechanism cannot (yet) express NSString*
arguments, so this (and NSLogv) can't be encoded.
- asprintf and vasprintf: these aren't part of the C99 standard
library, so we really shouldn't be defining them as builtins in
the general case (and we don't seem to have the machinery to make
them builtins only on certain targets and depending on whether
extensions are enabled).
llvm-svn: 64512
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/Analysis/dead-stores.c | 3 | ||||
-rw-r--r-- | clang/test/Analysis/uninit-vals.c | 4 | ||||
-rw-r--r-- | clang/test/Rewriter/finally.m | 3 | ||||
-rw-r--r-- | clang/test/Sema/block-return.c | 3 |
4 files changed, 9 insertions, 4 deletions
diff --git a/clang/test/Analysis/dead-stores.c b/clang/test/Analysis/dead-stores.c index 7d7b3696379..2d07a8057b0 100644 --- a/clang/test/Analysis/dead-stores.c +++ b/clang/test/Analysis/dead-stores.c @@ -12,7 +12,8 @@ void f1() { void f2(void *b) { char *c = (char*)b; // no-warning char *d = b+1; // expected-warning {{never read}} - printf("%s", c); + printf("%s", c); // expected-warning{{implicitly declaring C library function 'printf' with type 'int (char const *, ...)'}} \ + // expected-note{{please include the header <stdio.h> or explicitly provide a declaration for 'printf'}} } void f3() { diff --git a/clang/test/Analysis/uninit-vals.c b/clang/test/Analysis/uninit-vals.c index a7f5733dc41..2f2c33d67d7 100644 --- a/clang/test/Analysis/uninit-vals.c +++ b/clang/test/Analysis/uninit-vals.c @@ -31,7 +31,9 @@ int f5() { void f6(int i) { int x; for (i = 0 ; i < 10; i++) - printf("%d",x++); // expected-warning {{use of uninitialized variable}} + printf("%d",x++); // expected-warning {{use of uninitialized variable}} \ + // expected-warning{{implicitly declaring C library function 'printf' with type 'int (char const *, ...)'}} \ + // expected-note{{please include the header <stdio.h> or explicitly provide a declaration for 'printf'}} } void f7(int i) { diff --git a/clang/test/Rewriter/finally.m b/clang/test/Rewriter/finally.m index 903cdec1f7a..0d623dcc1ce 100644 --- a/clang/test/Rewriter/finally.m +++ b/clang/test/Rewriter/finally.m @@ -2,7 +2,8 @@ int main() { @try { - printf("executing try"); + printf("executing try"); // expected-warning{{implicitly declaring C library function 'printf' with type 'int (char const *, ...)'}} \ + // expected-note{{please include the header <stdio.h> or explicitly provide a declaration for 'printf'}} return(0); // expected-warning{{rewriter doesn't support user-specified control flow semantics for @try/@finally (code may not execute properly)}} } @finally { printf("executing finally"); diff --git a/clang/test/Sema/block-return.c b/clang/test/Sema/block-return.c index 64c29935f5f..a3705348355 100644 --- a/clang/test/Sema/block-return.c +++ b/clang/test/Sema/block-return.c @@ -80,5 +80,6 @@ void foo4() { int (^xx)(const char *s) = ^(char *s) { return 1; }; // expected-warning {{incompatible block pointer types initializing 'int (^)(char *)', expected 'int (^)(char const *)'}} int (*yy)(const char *s) = funk; // expected-warning {{incompatible pointer types initializing 'int (char *)', expected 'int (*)(char const *)'}} - int (^nested)(char *s) = ^(char *str) { void (^nest)(void) = ^(void) { printf("%s\n", str); }; next(); return 1; }; + int (^nested)(char *s) = ^(char *str) { void (^nest)(void) = ^(void) { printf("%s\n", str); }; next(); return 1; }; // expected-warning{{implicitly declaring C library function 'printf' with type 'int (char const *, ...)'}} \ + // expected-note{{please include the header <stdio.h> or explicitly provide a declaration for 'printf'}} } |