diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e7e13e0..aef7fa6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -403,3 +403,18 @@ jobs: run: | gmake gmake stats + + netbsd: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: build + test + uses: vmactions/netbsd-vm@v1 + with: + usesh: true + prepare: | + /usr/sbin/pkg_add cmake gmake + run: | + gmake + gmake stats + gmake test diff --git a/cutils.h b/cutils.h index 0a46ac1..5cf1b8a 100644 --- a/cutils.h +++ b/cutils.h @@ -225,17 +225,22 @@ static inline void put_u8(uint8_t *tab, uint8_t val) *tab = val; } +#ifndef bswap16 static inline uint16_t bswap16(uint16_t x) { return (x >> 8) | (x << 8); } +#endif +#ifndef bswap32 static inline uint32_t bswap32(uint32_t v) { return ((v & 0xff000000) >> 24) | ((v & 0x00ff0000) >> 8) | ((v & 0x0000ff00) << 8) | ((v & 0x000000ff) << 24); } +#endif +#ifndef bswap64 static inline uint64_t bswap64(uint64_t v) { return ((v & ((uint64_t)0xff << (7 * 8))) >> (7 * 8)) | @@ -247,6 +252,7 @@ static inline uint64_t bswap64(uint64_t v) ((v & ((uint64_t)0xff << (1 * 8))) << (5 * 8)) | ((v & ((uint64_t)0xff << (0 * 8))) << (7 * 8)); } +#endif static inline void inplace_bswap16(uint8_t *tab) { put_u16(tab, bswap16(get_u16(tab))); diff --git a/libunicode.c b/libunicode.c index 825a12b..f0b5146 100644 --- a/libunicode.c +++ b/libunicode.c @@ -947,8 +947,8 @@ int unicode_script(CharRange *cr, int script_idx; const uint8_t *p, *p_end; uint32_t c, c1, b, n, v, v_len, i, type; - CharRange cr1_s, *cr1; - CharRange cr2_s, *cr2 = &cr2_s; + CharRange cr1_s = { 0 }, *cr1 = NULL; + CharRange cr2_s = { 0 }, *cr2 = &cr2_s; BOOL is_common; script_idx = unicode_find_name(unicode_script_name_table, script_name); diff --git a/quickjs-libc.c b/quickjs-libc.c index 6b3627a..325f49d 100644 --- a/quickjs-libc.c +++ b/quickjs-libc.c @@ -71,7 +71,7 @@ typedef sig_t sighandler_t; #define environ (*_NSGetEnviron()) #endif -#if defined(__OpenBSD__) || defined(__FreeBSD__) +#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__) typedef sig_t sighandler_t; extern char **environ; #endif @@ -3589,6 +3589,8 @@ void js_std_set_worker_new_context_func(JSContext *(*func)(JSRuntime *rt)) #define OS_PLATFORM "linux" #elif defined(__OpenBSD__) #define OS_PLATFORM "openbsd" +#elif defined(__NetBSD__) +#define OS_PLATFORM "netbsd" #elif defined(__FreeBSD__) #define OS_PLATFORM "freebsd" #else