diff options
author | Lenny Maiorani <lenny@colorado.edu> | 2011-05-03 16:34:26 +0000 |
---|---|---|
committer | Lenny Maiorani <lenny@colorado.edu> | 2011-05-03 16:34:26 +0000 |
commit | 5066858bcd0b3f264fee42faba2f4ce6f85cb911 (patch) | |
tree | 9024b10521fb1cd86b8582a4dcce40519970cc83 /clang/test/Analysis/string.c | |
parent | 85ac42339c2932a41d0c16cda5989d2e27931095 (diff) | |
download | bcm5719-llvm-5066858bcd0b3f264fee42faba2f4ce6f85cb911.tar.gz bcm5719-llvm-5066858bcd0b3f264fee42faba2f4ce6f85cb911.zip |
Removing strncpy() checking in CString checker for now. Some significant changes need to be made to properly support modeling of it since it potentially leaves strings non-null terminated.
llvm-svn: 130758
Diffstat (limited to 'clang/test/Analysis/string.c')
-rw-r--r-- | clang/test/Analysis/string.c | 68 |
1 files changed, 0 insertions, 68 deletions
diff --git a/clang/test/Analysis/string.c b/clang/test/Analysis/string.c index 40afacc4388..e6baf51c474 100644 --- a/clang/test/Analysis/string.c +++ b/clang/test/Analysis/string.c @@ -328,74 +328,6 @@ void strcpy_no_overflow(char *y) { } //===----------------------------------------------------------------------=== -// strncpy() -//===----------------------------------------------------------------------=== - -#ifdef VARIANT - -#define __strncpy_chk BUILTIN(__strncpy_chk) -char *__strncpy_chk(char *restrict s1, const char *restrict s2, size_t n, size_t destlen); - -#define strncpy(a,b,c) __strncpy_chk(a,b,c, (size_t)-1) - -#else /* VARIANT */ - -#define strncpy BUILTIN(strncpy) -char *strncpy(char *restrict s1, const char *restrict s2, size_t n); - -#endif /* VARIANT */ - - -void strncpy_null_dst(char *x) { - strncpy(NULL, x, 1); // expected-warning{{Null pointer argument in call to byte string function}} -} - -void strncpy_null_src(char *x) { - strncpy(x, NULL, 1); // expected-warning{{Null pointer argument in call to byte string function}} -} - -void strncpy_fn(char *x) { - strncpy(x, (char*)&strncpy_fn, 1); // expected-warning{{Argument to byte string function is the address of the function 'strncpy_fn', which is not a null-terminated string}} -} - -void strncpy_effects(char *x, char *y) { - char a = x[0]; - - if (strncpy(x, y, strlen(y)) != x) - (void)*(char*)0; // no-warning - - if (strlen(x) != strlen(y)) - (void)*(char*)0; // no-warning - - if (a != x[0]) - (void)*(char*)0; // expected-warning{{null}} -} - -void strncpy_overflow(char *y) { - char x[4]; - if (strlen(y) == 4) - strncpy(x, y, strlen(y)); // expected-warning{{Byte string function overflows destination buffer}} -} - -void strncpy_len_overflow(char *y) { - char x[4]; - if (strlen(y) == 3) - strncpy(x, y, sizeof(x)); // no-warning -} - -void strncpy_no_overflow(char *y) { - char x[4]; - if (strlen(y) == 3) - strncpy(x, y, strlen(y)); // no-warning -} - -void strncpy_no_len_overflow(char *y) { - char x[4]; - if (strlen(y) == 4) - strncpy(x, y, sizeof(x)-1); // no-warning -} - -//===----------------------------------------------------------------------=== // stpcpy() //===----------------------------------------------------------------------=== |