[PATCH] D58379: [compiler-rt] Intercept the bcmp() function.

Kamil Rytarowski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 19 18:46:40 PST 2019


krytarowski added inline comments.


================
Comment at: lib/asan/tests/asan_mem_test.cc:15
+#include <strings.h>  // for bcmp
+#elif defined(__NetBSD__)
+#include <string.h>  // for bcmp
----------------
jyknight wrote:
> MaskRay wrote:
> > Maybe.. You can also enable it for OpenBSD `string.h` and FreeBSD `strings.h`
> Both openbsd and netbsd appear to expose it from <strings.h> (plural) as the primary location too.
> 
> On both systems, <string.h> (singular) does a conditional #include of <strings.h>, so this probably works too, but seems better to consolidate around strings.h.
I would include <string.h> unconditionally and only `<strings.h>` there where needed.

```
#include <string.h>
#if defined (_GNU_SOURCE)
#include <strings.h>
#endif
```

FreeBSD doesn't need `<strings.h>` either.


================
Comment at: test/sanitizer_common/TestCases/Posix/weak_hook_test.cc:11
+#include <string.h>
+#if defined(_GNU_SOURCE) || defined(__FreeBSD__)
+#include <strings.h>  // for bcmp
----------------
No need for `__FreeBSD__`.


Repository:
  rCRT Compiler Runtime

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58379/new/

https://reviews.llvm.org/D58379





More information about the llvm-commits mailing list