From ef88fd8e9d2b26317d71d2ed9de7a191840205b1 Mon Sep 17 00:00:00 2001 From: Alex Helfet Date: Thu, 23 Mar 2017 04:33:03 +0000 Subject: [PATCH] Fixed some issues raised by eqvinox in pull request. PR URL: https://github.com/opensourcerouting/c-capnproto/pull/15/files/1b25eae747ccf73472ed3984d283ab5a62389dff --- lib/capn-malloc.c | 8 ++++---- lib/capn.c | 2 ++ lib/capnp_c.h | 6 +----- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/lib/capn-malloc.c b/lib/capn-malloc.c index 708294e..65fcb9f 100644 --- a/lib/capn-malloc.c +++ b/lib/capn-malloc.c @@ -8,6 +8,10 @@ * of the MIT license. See the LICENSE file for details. */ +#ifdef __GNUC__ +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + #include "capnp_c.h" #include "capnp_priv.h" #include @@ -25,10 +29,6 @@ struct check_segment_alignment { }; static struct capn_segment *create(void *u, uint32_t id, int sz) { - // Silence warnings about unused parameters. - UNUSED(u); - UNUSED(id); - struct capn_segment *s; sz += sizeof(*s); if (sz < 4096) { diff --git a/lib/capn.c b/lib/capn.c index 0677452..f9d22d8 100644 --- a/lib/capn.c +++ b/lib/capn.c @@ -7,7 +7,9 @@ * of the MIT license. See the LICENSE file for details. */ +#ifdef __GNUC__ #pragma GCC diagnostic ignored "-Wmissing-field-initializers" +#endif #include "capnp_c.h" diff --git a/lib/capnp_c.h b/lib/capnp_c.h index 58867a3..edbc43e 100644 --- a/lib/capnp_c.h +++ b/lib/capnp_c.h @@ -13,11 +13,7 @@ #include #include - -// ssize_t is defined in unistd.h in GCC. -#ifdef __GNUC__ #include -#endif #if defined(unix) && !defined(__APPLE__) #include @@ -33,7 +29,7 @@ typedef intmax_t ssize_t; #define UNUSED(x) (void)(x) #endif -// Cross-platform macro ALIGNED_(x) aligns a struct by `x` bits. +// Cross-platform macro ALIGNED_(x) aligns a struct by `x` bytes. #ifdef _MSC_VER #define ALIGNED_(x) __declspec(align(x)) #endif