[PATCH] D58379: [compiler-rt] Intercept the bcmp() function.
Clement Courbet via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 20 02:21:22 PST 2019
courbet marked 3 inline comments as done.
courbet 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
----------------
krytarowski wrote:
> 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.
> I would include <string.h> unconditionally and only <strings.h> there where needed.
Right, and that's consistent with `weak_hook_test`.
> 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.
The freebsd man page has:
```
A bcmp() function first appeared in 4.2BSD. Its prototype existed previ-
ously in <string.h> before it was moved to <strings.h> for IEEE Std
1003.1-2001 (``POSIX.1'') compliance.
```
In any case, on all systems `strings.h` seems to be doing the right thing to accommodate this so I kept strings.h only for _GNU_SOURCE for simplicity.
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