--- nono/lib/header.h 2026/04/29 17:04:30 1.1.1.3 +++ nono/lib/header.h 2026/04/29 17:04:34 1.1.1.4 @@ -1,14 +1,15 @@ // // nono -// Copyright (C) 2017 isaki@NetBSD.org +// Copyright (C) 2020 nono project +// Licensed under nono-license.txt // #pragma once #define NONO_MAJOR_VER (0) -#define NONO_MINOR_VER (0) -#define NONO_PATCH_VER (3) -#define NONO_DATE "2020/05/16" +#define NONO_MINOR_VER (1) +#define NONO_PATCH_VER (0) +#define NONO_DATE "2020/07/19" #include "config-nono.h" #include @@ -29,14 +30,14 @@ #include #include -typedef uint8_t uint8; -typedef uint16_t uint16; -typedef uint32_t uint32; -typedef uint64_t uint64; -typedef int8_t int8; -typedef int16_t int16; -typedef int32_t int32; -typedef int64_t int64; +using uint8 = uint8_t; +using uint16 = uint16_t; +using uint32 = uint32_t; +using uint64 = uint64_t; +using int8 = int8_t; +using int16 = int16_t; +using int32 = int32_t; +using int64 = int64_t; #if defined(HAVE_ENDIAN_H) #include @@ -99,7 +100,9 @@ typedef int64_t int64; #endif #endif -#if defined(HAVE___ATTRIBUTE_FALLTHROUGH) +#if defined(__clang__) +# define FALLTHROUGH [[clang::fallthrough]] +#elif defined(HAVE___ATTRIBUTE_FALLTHROUGH) # define FALLTHROUGH __attribute__((__fallthrough__)) #else # define FALLTHROUGH ((void)0) @@ -141,17 +144,6 @@ DEF_UNION64(union64, q, h, l); } \ } while (0) -// NetBSD は pthread_setname_np(threadID, name, arg) だが -// Linux は pthread_setname_np(threadID, name) で -// MacOSX は pthread_setname_np(name) だったりする。 -// 今の所 NetBSD でも arg はいらないので(というか NetBSD の name, arg の -// デザインはおかしい)、引数1つバージョンに揃えることにする。 -#if HAVE_PTHREAD_SETNAME_NP == 3 -#define pthread_setname_np(name) pthread_setname_np(pthread_self(), name, NULL) -#elif HAVE_PTHREAD_SETNAME_NP == 2 -#define pthread_setname_np(name) pthread_setname_np(pthread_self(), name) -#endif - // 便利マクロ #define kevent_set(k, e, n) kevent((k), (e), (n), NULL, 0, NULL) #define kevent_poll(k, e, n, t) kevent((k), NULL, 0, (e), (n), (t))