Skip to content

Commit 7b31427

Browse files
Apply test improvements
1 parent 6cba4d4 commit 7b31427

File tree

2 files changed

+23
-16
lines changed

2 files changed

+23
-16
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// RUN: %clang_analyze_cc1 -verify %s -Wno-incompatible-library-redeclaration \
2+
// RUN: -analyzer-checker=alpha.unix.cstring.BufferOverlap
3+
// expected-no-diagnostics
4+
5+
typedef typeof(sizeof(int)) size_t;
6+
7+
void memcpy(int dst, int src, size_t size);
8+
9+
void test_memcpy_proxy() {
10+
memcpy(42, 42, 42); // no-crash
11+
}
12+
13+
void strcpy(int dst, char *src);
14+
15+
void test_strcpy_proxy() {
16+
strcpy(42, (char *)42); // no-crash
17+
}
18+
19+
void strxfrm(int dst, char *src, size_t size);
20+
21+
void test_strxfrm_proxy() {
22+
strxfrm(42, (char *)42, 42); // no-crash
23+
}

clang/test/Analysis/buffer-overlap.c

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -96,19 +96,3 @@ void test_snprintf6() {
9696
char b[4] = {0};
9797
snprintf(a, sizeof(a), "%s", b); // no-warning
9898
}
99-
100-
101-
void memcpy(int dst, int src, size_t size); // expected-warning{{incompatible redeclaration of library function 'memcpy'}} expected-note{{'memcpy' is a builtin with type 'void *(void *, const void *, __size_t)' (aka 'void *(void *, const void *, unsigned long)')}}
102-
void test_memcpy_proxy() {
103-
memcpy(42, 42, 42);
104-
}
105-
106-
void strcpy(int dst, char *src); // expected-warning{{incompatible redeclaration of library function 'strcpy'}} expected-note{{'strcpy' is a builtin with type 'char *(char *, const char *)'}}
107-
void test_strcpy_proxy() {
108-
strcpy(42, (char *)42);
109-
}
110-
111-
void strxfrm(int dst, char *src, size_t size); // expected-warning{{incompatible redeclaration of library function 'strxfrm'}} expected-note{{'strxfrm' is a builtin with type '__size_t (char *, const char *, __size_t)' (aka 'unsigned long (char *, const char *, unsigned long)')}}
112-
void test_strxfrm_proxy() {
113-
strxfrm(42, (char *)42, 42);
114-
}

0 commit comments

Comments
 (0)