aboutsummaryrefslogtreecommitdiff
path: root/test/SemaCXX/warn-memsize-comparison.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-01-02 19:18:08 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-01-02 19:18:08 +0000
commitbab175ec4b075c8076ba14c762900392533f6ee4 (patch)
tree01f4f29419a2cb10abe13c1e63cd2a66068b0137 /test/SemaCXX/warn-memsize-comparison.cpp
parent8b7a8012d223fac5d17d16a66bb39168a9a1dfc0 (diff)
downloadsrc-bab175ec4b075c8076ba14c762900392533f6ee4.tar.gz
src-bab175ec4b075c8076ba14c762900392533f6ee4.zip
Vendor import of clang trunk r290819:vendor/clang/clang-trunk-r290819
Notes
Notes: svn path=/vendor/clang/dist/; revision=311118 svn path=/vendor/clang/clang-trunk-r290819/; revision=311119; tag=vendor/clang/clang-trunk-r290819
Diffstat (limited to 'test/SemaCXX/warn-memsize-comparison.cpp')
-rw-r--r--test/SemaCXX/warn-memsize-comparison.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/test/SemaCXX/warn-memsize-comparison.cpp b/test/SemaCXX/warn-memsize-comparison.cpp
index 54c410e3dc0b..b5c7a9d6969c 100644
--- a/test/SemaCXX/warn-memsize-comparison.cpp
+++ b/test/SemaCXX/warn-memsize-comparison.cpp
@@ -5,7 +5,7 @@ typedef __SIZE_TYPE__ size_t;
extern "C" void *memset(void *, int, size_t);
extern "C" void *memmove(void *s1, const void *s2, size_t n);
extern "C" void *memcpy(void *s1, const void *s2, size_t n);
-extern "C" void *memcmp(void *s1, const void *s2, size_t n);
+extern "C" int memcmp(void *s1, const void *s2, size_t n);
extern "C" int strncmp(const char *s1, const char *s2, size_t n);
extern "C" int strncasecmp(const char *s1, const char *s2, size_t n);
extern "C" char *strncpy(char *dst, const char *src, size_t n);
@@ -28,11 +28,12 @@ void f() {
expected-note {{explicitly cast the argument}}
if (memmove(b1, b2, sizeof(b1)) == 0) {}
+ // FIXME: This fixit is bogus.
if (memcpy(b1, b2, sizeof(b1) < 0)) {} // \
expected-warning{{size argument in 'memcpy' call is a comparison}} \
expected-note {{did you mean to compare}} \
expected-note {{explicitly cast the argument}}
- if (memcpy(b1, b2, sizeof(b1)) < 0) {}
+ if (memcpy(b1, b2, sizeof(b1)) < 0) {} // expected-error {{ordered comparison between pointer and zero}}
if (memcmp(b1, b2, sizeof(b1) <= 0)) {} // \
expected-warning{{size argument in 'memcmp' call is a comparison}} \
@@ -58,11 +59,12 @@ void f() {
expected-note {{explicitly cast the argument}}
if (strncpy(b1, b2, sizeof(b1)) == 0 || true) {}
+ // FIXME: This fixit is bogus.
if (strncat(b1, b2, sizeof(b1) - 1 >= 0 && true)) {} // \
expected-warning{{size argument in 'strncat' call is a comparison}} \
expected-note {{did you mean to compare}} \
expected-note {{explicitly cast the argument}}
- if (strncat(b1, b2, sizeof(b1) - 1) >= 0 && true) {}
+ if (strncat(b1, b2, sizeof(b1) - 1) >= 0 && true) {} // expected-error {{ordered comparison between pointer and zero}}
if (strndup(b1, sizeof(b1) != 0)) {} // \
expected-warning{{size argument in 'strndup' call is a comparison}} \