Skip to content

Commit e345bc6

Browse files
committed
[compiler-rt] [msan] Support POSIX iconv(3) on NetBSD 9.99.17+
Fixes build of test.
1 parent 52efd67 commit e345bc6

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

compiler-rt/test/msan/iconv.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,23 @@
88
#include <stdio.h>
99
#include <errno.h>
1010

11+
#if defined(__NetBSD__)
12+
#include <sys/param.h>
13+
#if __NetBSD_Prereq__(9,99,17)
14+
#define NETBSD_POSIX_ICONV 1
15+
#else
16+
#define NETBSD_POSIX_ICONV 0
17+
#endif
18+
#endif
19+
1120
int main(void) {
1221
iconv_t cd = iconv_open("ASCII", "ASCII");
1322
assert(cd != (iconv_t)-1);
1423

1524
char inbuf_[100];
1625
strcpy(inbuf_, "sample text");
1726
char outbuf_[100];
18-
#if defined(__NetBSD__)
27+
#if defined(__NetBSD__) && !NETBSD_POSIX_ICONV
1928
// Some OSes expect the 2nd argument of iconv(3) to be of type const char **
2029
const char *inbuf = inbuf_;
2130
#else

0 commit comments

Comments
 (0)