diff options
-rw-r--r-- | lib9p/core.c | 6 | ||||
-rw-r--r-- | lib9p/core_include/lib9p/core.h | 5 | ||||
-rw-r--r-- | lib9p/idl/1992-9P0.9p.wip | 2 | ||||
-rw-r--r-- | lib9p/idl/2010-9P2000.L.9p | 2 | ||||
-rw-r--r-- | lib9p/srv.c | 6 | ||||
-rw-r--r-- | libmisc/include/libmisc/assert.h | 3 | ||||
-rw-r--r-- | libmisc/tests/test_obj_autobox.c | 10 | ||||
-rw-r--r-- | libmisc/tests/test_obj_nest.c | 10 |
8 files changed, 18 insertions, 26 deletions
diff --git a/lib9p/core.c b/lib9p/core.c index 58fe538..3843429 100644 --- a/lib9p/core.c +++ b/lib9p/core.c @@ -48,17 +48,11 @@ bool lib9p_str_eq(struct lib9p_s a, struct lib9p_s b) { /* bounds checks **************************************************************/ static inline void assert_ver(enum lib9p_version ver) { -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wtype-limits" assert(0 <= ver && ver < LIB9P_VER_NUM); -#pragma GCC diagnostic pop } static inline void assert_typ(enum lib9p_msg_type typ) { -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wtype-limits" assert(0 <= typ && typ < 0xFF); -#pragma GCC diagnostic pop } /* simple lookups *************************************************************/ diff --git a/lib9p/core_include/lib9p/core.h b/lib9p/core_include/lib9p/core.h index 9d92312..fc4eedf 100644 --- a/lib9p/core_include/lib9p/core.h +++ b/lib9p/core_include/lib9p/core.h @@ -7,9 +7,8 @@ #ifndef _LIB9P_CORE_H_ #define _LIB9P_CORE_H_ -#include <stdint.h> /* for uint{n}_t */ -#include <string.h> /* for memset() */ -#include <sys/types.h> /* for ssize_t */ +#include <stdint.h> /* for uint{n}_t */ +#include <string.h> /* for memset() */ #include <libhw/generic/io.h> /* for struct iovec */ #include <libmisc/assert.h> diff --git a/lib9p/idl/1992-9P0.9p.wip b/lib9p/idl/1992-9P0.9p.wip index c9432c9..de902dd 100644 --- a/lib9p/idl/1992-9P0.9p.wip +++ b/lib9p/idl/1992-9P0.9p.wip @@ -137,5 +137,5 @@ msg Twstat = "typ[1,val=78] tag[tag] fid[fid] stat[stat]" msg Rwstat = "typ[1,val=79] tag[tag] fid[fid]" msg Tclwalk = "typ[1,val=80] tag[tag] fid[fid] newfid[fid] name[name]" msg Rclwalk = "typ[1,val=81] tag[tag] fid[fid] qid[qid]" -msg Tauth = "typ[1,val=82] tag[tag] fid[fid] uid[name] chal[encrypted_auth_challenge]" # chal is an encrypted +msg Tauth = "typ[1,val=82] tag[tag] fid[fid] uid[name] chal[encrypted_auth_challenge]" msg Rauth = "typ[1,val=83] tag[tag] fid[fid] chal[encrypted_auth_response]" diff --git a/lib9p/idl/2010-9P2000.L.9p b/lib9p/idl/2010-9P2000.L.9p index 5eb7d5c..d442252 100644 --- a/lib9p/idl/2010-9P2000.L.9p +++ b/lib9p/idl/2010-9P2000.L.9p @@ -198,7 +198,7 @@ bitfield lo = 4 "bit 16=DIRECTORY" "bit 17=NOFOLLOW" "bit 18=NOATIME" - "bit 19=CLOEXEC" + "bit 19=CLOEXEC" # What does this even mean in a remote protocol? "bit 20=SYNC" "num(MODE) RDONLY = 0" diff --git a/lib9p/srv.c b/lib9p/srv.c index 085cc8b..d1f5814 100644 --- a/lib9p/srv.c +++ b/lib9p/srv.c @@ -4,13 +4,9 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -#include <limits.h> /* for SSIZE_MAX, not set by newlib */ #include <stddef.h> /* for size_t */ #include <stdlib.h> /* for malloc() */ #include <string.h> /* for memcpy() */ -#ifndef SSIZE_MAX -#define SSIZE_MAX (SIZE_MAX >> 1) -#endif #include <libcr/coroutine.h> #include <libcr_ipc/chan.h> @@ -40,7 +36,7 @@ #error config.h must define CONFIG_9P_SRV_MAX_HOSTMSG_SIZE #endif static_assert(CONFIG_9P_SRV_MAX_MSG_SIZE <= CONFIG_9P_SRV_MAX_HOSTMSG_SIZE); -static_assert(CONFIG_9P_SRV_MAX_HOSTMSG_SIZE <= SSIZE_MAX); +static_assert(CONFIG_9P_SRV_MAX_HOSTMSG_SIZE <= SIZE_MAX); /* context ********************************************************************/ diff --git a/libmisc/include/libmisc/assert.h b/libmisc/include/libmisc/assert.h index ccdb288..18ca2e5 100644 --- a/libmisc/include/libmisc/assert.h +++ b/libmisc/include/libmisc/assert.h @@ -12,7 +12,10 @@ #else # define __assert_msg(expr, expr_str, msg) \ do { \ + _Pragma("GCC diagnostic push") \ + _Pragma("GCC diagnostic ignored \"-Wtype-limits\"") \ if (!(expr)) \ + _Pragma("GCC diagnostic pop") \ __assert_msg_fail(expr_str, __FILE__, __LINE__, __func__, msg); \ } while (0) [[noreturn]] void __assert_msg_fail(const char *expr, diff --git a/libmisc/tests/test_obj_autobox.c b/libmisc/tests/test_obj_autobox.c index 1bf442d..1110639 100644 --- a/libmisc/tests/test_obj_autobox.c +++ b/libmisc/tests/test_obj_autobox.c @@ -14,11 +14,11 @@ /* interfaces *****************************************************************/ #define reader_LO_IFACE \ - LO_FUNC(ssize_t, read, void *, size_t) + LO_FUNC(size_t, read, void *, size_t) LO_INTERFACE(reader); #define writer_LO_IFACE \ - LO_FUNC(ssize_t, write, void *, size_t) + LO_FUNC(size_t, write, void *, size_t) LO_INTERFACE(writer); #define read_writer_LO_IFACE \ @@ -42,7 +42,7 @@ LO_IMPLEMENTATION_C(reader, struct myclass, myclass, static); LO_IMPLEMENTATION_C(writer, struct myclass, myclass, static); LO_IMPLEMENTATION_C(read_writer, struct myclass, myclass, static); -static ssize_t myclass_read(struct myclass *self, void *buf, size_t count) { +static size_t myclass_read(struct myclass *self, void *buf, size_t count) { test_assert(self); if (count > self->len) count = self->len; @@ -50,10 +50,10 @@ static ssize_t myclass_read(struct myclass *self, void *buf, size_t count) { return count; } -static ssize_t myclass_write(struct myclass *self, void *buf, size_t count) { +static size_t myclass_write(struct myclass *self, void *buf, size_t count) { test_assert(self); if (self->len) - return -1; + return 0; if (count > sizeof(self->buf)) count = sizeof(self->buf); memcpy(self->buf, buf, count); diff --git a/libmisc/tests/test_obj_nest.c b/libmisc/tests/test_obj_nest.c index 66c1efd..20ffe4a 100644 --- a/libmisc/tests/test_obj_nest.c +++ b/libmisc/tests/test_obj_nest.c @@ -13,11 +13,11 @@ /* interfaces *****************************************************************/ #define reader_LO_IFACE \ - LO_FUNC(ssize_t, read, void *, size_t) + LO_FUNC(size_t, read, void *, size_t) LO_INTERFACE(reader); #define writer_LO_IFACE \ - LO_FUNC(ssize_t, write, void *, size_t) + LO_FUNC(size_t, write, void *, size_t) LO_INTERFACE(writer); #define read_writer_LO_IFACE \ @@ -41,7 +41,7 @@ LO_IMPLEMENTATION_C(reader, struct myclass, myclass, static); LO_IMPLEMENTATION_C(writer, struct myclass, myclass, static); LO_IMPLEMENTATION_C(read_writer, struct myclass, myclass, static); -static ssize_t myclass_read(struct myclass *self, void *buf, size_t count) { +static size_t myclass_read(struct myclass *self, void *buf, size_t count) { test_assert(self); if (count > self->len) count = self->len; @@ -49,10 +49,10 @@ static ssize_t myclass_read(struct myclass *self, void *buf, size_t count) { return count; } -static ssize_t myclass_write(struct myclass *self, void *buf, size_t count) { +static size_t myclass_write(struct myclass *self, void *buf, size_t count) { test_assert(self); if (self->len) - return -1; + return 0; if (count > sizeof(self->buf)) count = sizeof(self->buf); memcpy(self->buf, buf, count); |