You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[-Wunsafe-buffer-usage] Do not warn about class methods with libc function names (#151270)
This commit fixes the false positive that C++ class methods with libc
function names would be false warned about. For example,
```
struct T {void strcpy() const;};
void test(const T& t) { str.strcpy(); // no warn }
```
rdar://156264388
memcpy(); // expected-warning{{function 'memcpy' is unsafe}}
80
-
std::memcpy(); // expected-warning{{function 'memcpy' is unsafe}}
81
89
__builtin_memcpy(p, q, 64); // expected-warning{{function '__builtin_memcpy' is unsafe}}
82
90
__builtin___memcpy_chk(p, q, 8, 64); // expected-warning{{function '__builtin___memcpy_chk' is unsafe}}
83
91
__asan_memcpy(); // expected-warning{{function '__asan_memcpy' is unsafe}}
84
92
strcpy(); // expected-warning{{function 'strcpy' is unsafe}}
85
-
std::strcpy(); // expected-warning{{function 'strcpy' is unsafe}}
86
93
strcpy_s(); // expected-warning{{function 'strcpy_s' is unsafe}}
87
94
wcscpy_s(); // expected-warning{{function 'wcscpy_s' is unsafe}}
95
+
#ifdef TEST_STD_NS
96
+
std::strcpy(); // expected-warning{{function 'strcpy' is unsafe}}
97
+
std::memcpy(); // expected-warning{{function 'memcpy' is unsafe}}
98
+
#endif
88
99
89
100
/* Test printfs */
90
101
fprintf((FILE*)p, "%s%d", p, *p); // expected-warning{{function 'fprintf' is unsafe}} expected-note{{string argument is not guaranteed to be null-terminated}}
0 commit comments