Attention is currently required from: plaisthos.
Hello plaisthos,
I'd like you to do a code review.
Please visit
http://gerrit.openvpn.net/c/openvpn/+/1186?usp=email
to review the following change.
Change subject: Enable -Wsign-conversion
......................................................................
Enable -Wsign-conversion
As before with -Wconversion override all the known issues
to be able to address them one by one.
Change-Id: Iecf502ec811e99c56647b2d45298fa0fb66960fb
Signed-off-by: Frank Lichtenheld <[email protected]>
---
M CMakeLists.txt
M configure.ac
M src/openvpn/argv.c
M src/openvpn/base64.c
M src/openvpn/buffer.c
M src/openvpn/buffer.h
M src/openvpn/clinat.c
M src/openvpn/comp-lz4.c
M src/openvpn/console_builtin.c
M src/openvpn/crypto.c
M src/openvpn/crypto_epoch.c
M src/openvpn/crypto_mbedtls.c
M src/openvpn/crypto_openssl.c
M src/openvpn/dhcp.c
M src/openvpn/env_set.c
M src/openvpn/error.h
M src/openvpn/event.c
M src/openvpn/fragment.c
M src/openvpn/list.h
M src/openvpn/lzo.c
M src/openvpn/mbuf.c
M src/openvpn/networking_sitnl.c
M src/openvpn/ntlm.c
M src/openvpn/otime.h
M src/openvpn/packet_id.c
M src/openvpn/platform.h
M src/openvpn/plugin.c
M src/openvpn/pool.c
M src/openvpn/reliable.c
M src/openvpn/socket.h
M src/openvpn/ssl_util.c
M src/openvpn/status.c
M src/openvpn/wfp_block.c
M src/openvpn/xkey_provider.c
M src/openvpnmsica/dllmain.c
M src/openvpnserv/common.c
M src/openvpnserv/interactive.c
M src/tapctl/tap.c
M tests/unit_tests/openvpn/mock_get_random.c
M tests/unit_tests/openvpn/mock_msg.c
M tests/unit_tests/openvpn/test_networking.c
41 files changed, 228 insertions(+), 80 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/86/1186/1
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 51f4221..803cdb4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -113,7 +113,7 @@
check_and_add_compiler_flag(-Wno-stringop-truncation NoStringOpTruncation)
check_and_add_compiler_flag(-Wstrict-prototypes StrictPrototypes)
check_and_add_compiler_flag(-Wold-style-definition OldStyleDefinition)
- add_compile_options(-Wconversion -Wno-sign-conversion)
+ add_compile_options(-Wconversion)
if (USE_WERROR)
add_compile_options(-Werror)
endif ()
diff --git a/configure.ac b/configure.ac
index 957205e..b23939e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1396,7 +1396,7 @@
ACL_CHECK_ADD_COMPILE_FLAGS([-Wno-stringop-truncation])
ACL_CHECK_ADD_COMPILE_FLAGS([-Wstrict-prototypes])
ACL_CHECK_ADD_COMPILE_FLAGS([-Wold-style-definition])
-ACL_CHECK_ADD_COMPILE_FLAGS([-Wconversion -Wno-sign-conversion])
+ACL_CHECK_ADD_COMPILE_FLAGS([-Wconversion])
ACL_CHECK_ADD_COMPILE_FLAGS([-Wall])
if test "${enable_pedantic}" = "yes"; then
diff --git a/src/openvpn/argv.c b/src/openvpn/argv.c
index 55deef5..5d4ca57 100644
--- a/src/openvpn/argv.c
+++ b/src/openvpn/argv.c
@@ -323,6 +323,11 @@
return f;
}
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wsign-conversion"
+#endif
+
/**
* Create a struct argv based on a format string
*
@@ -418,6 +423,10 @@
return res;
}
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic pop
+#endif
+
/**
* printf() variant which populates a struct argv. It processes the
* format string with the provided arguments. For each space separator found
diff --git a/src/openvpn/base64.c b/src/openvpn/base64.c
index 2a5a46d..00fef04 100644
--- a/src/openvpn/base64.c
+++ b/src/openvpn/base64.c
@@ -44,6 +44,7 @@
#if defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
+#pragma GCC diagnostic ignored "-Wsign-conversion"
#endif
static char base64_chars[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
diff --git a/src/openvpn/buffer.c b/src/openvpn/buffer.c
index b6d6669..023f7fe 100644
--- a/src/openvpn/buffer.c
+++ b/src/openvpn/buffer.c
@@ -109,6 +109,11 @@
return buf;
}
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wsign-conversion"
+#endif
+
struct buffer
#ifdef DMALLOC
clone_buf_debug(const struct buffer *buf, const char *file, int line)
diff --git a/src/openvpn/buffer.h b/src/openvpn/buffer.h
index 1405667..15377e9 100644
--- a/src/openvpn/buffer.h
+++ b/src/openvpn/buffer.h
@@ -327,6 +327,11 @@
return true;
}
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wsign-conversion"
+#endif
+
static inline void
buf_set_write(struct buffer *buf, uint8_t *data, int size)
{
@@ -851,6 +856,10 @@
return memcmp(BPTR(src), match, size) == 0;
}
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic pop
+#endif
+
bool buf_string_match_head_str(const struct buffer *src, const char *match);
bool buf_string_compare_advance(struct buffer *src, const char *match);
diff --git a/src/openvpn/clinat.c b/src/openvpn/clinat.c
index 2d21daf..fdd1a34 100644
--- a/src/openvpn/clinat.c
+++ b/src/openvpn/clinat.c
@@ -180,6 +180,11 @@
gc_free(&gc);
}
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wsign-conversion"
+#endif
+
void
client_nat_transform(const struct client_nat_option_list *list, struct buffer
*ipbuf,
const int direction)
diff --git a/src/openvpn/comp-lz4.c b/src/openvpn/comp-lz4.c
index a78c664..87173d6 100644
--- a/src/openvpn/comp-lz4.c
+++ b/src/openvpn/comp-lz4.c
@@ -91,6 +91,7 @@
#if defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
+#pragma GCC diagnostic ignored "-Wsign-conversion"
#endif
static void
@@ -118,10 +119,6 @@
*buf = *work;
}
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
-
static void
lz4_decompress(struct buffer *buf, struct buffer work, struct compress_context
*compctx,
const struct frame *frame)
@@ -207,6 +204,10 @@
}
}
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic pop
+#endif
+
const struct compress_alg lz4_alg = { "lz4", lz4_compress_init,
lz4_compress_uninit, lz4_compress,
lz4_decompress };
diff --git a/src/openvpn/console_builtin.c b/src/openvpn/console_builtin.c
index 71c0025..61d1657 100644
--- a/src/openvpn/console_builtin.c
+++ b/src/openvpn/console_builtin.c
@@ -187,6 +187,11 @@
#endif /* HAVE_TERMIOS_H */
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wconversion"
+#pragma GCC diagnostic ignored "-Wsign-conversion"
+#endif
/**
* Core function for getting input from console
@@ -273,11 +278,6 @@
return ret;
}
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wconversion"
-#endif
-
/**
* @copydoc query_user_exec()
*
diff --git a/src/openvpn/crypto.c b/src/openvpn/crypto.c
index 8e56881..f033a97 100644
--- a/src/openvpn/crypto.c
+++ b/src/openvpn/crypto.c
@@ -62,6 +62,12 @@
* happen unless the frame parameters are wrong.
*/
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wconversion"
+#pragma GCC diagnostic ignored "-Wsign-conversion"
+#endif
+
static void
openvpn_encrypt_aead(struct buffer *buf, struct buffer work, struct
crypto_options *opt)
{
@@ -186,11 +192,6 @@
return;
}
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wconversion"
-#endif
-
static void
openvpn_encrypt_v1(struct buffer *buf, struct buffer work, struct
crypto_options *opt)
{
@@ -1537,10 +1538,6 @@
gc_free(&gc);
}
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
-
int
write_key_file(const int nkeys, const char *filename)
{
@@ -1599,6 +1596,10 @@
return nbits;
}
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic pop
+#endif
+
void
must_have_n_keys(const char *filename, const char *option, const struct key2
*key2, int n)
{
diff --git a/src/openvpn/crypto_epoch.c b/src/openvpn/crypto_epoch.c
index 7026ff8..e0654d1 100644
--- a/src/openvpn/crypto_epoch.c
+++ b/src/openvpn/crypto_epoch.c
@@ -38,6 +38,12 @@
#include "buffer.h"
#include "integer.h"
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wconversion"
+#pragma GCC diagnostic ignored "-Wsign-conversion"
+#endif
+
void
ovpn_hkdf_expand(const uint8_t *secret, const uint8_t *info, int info_len,
uint8_t *out,
int out_len)
@@ -72,11 +78,6 @@
hmac_ctx_free(hmac_ctx);
}
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wconversion"
-#endif
-
bool
ovpn_expand_label(const uint8_t *secret, size_t secret_len, const uint8_t
*label, size_t label_len,
const uint8_t *context, size_t context_len, uint8_t *out,
uint16_t out_len)
@@ -168,10 +169,6 @@
key->epoch = epoch_key->epoch;
}
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
-
static void
epoch_init_send_key_ctx(struct crypto_options *co)
{
diff --git a/src/openvpn/crypto_mbedtls.c b/src/openvpn/crypto_mbedtls.c
index 40978d9..7a44416 100644
--- a/src/openvpn/crypto_mbedtls.c
+++ b/src/openvpn/crypto_mbedtls.c
@@ -233,6 +233,7 @@
#if defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
+#pragma GCC diagnostic ignored "-Wsign-conversion"
#endif
bool
@@ -765,10 +766,6 @@
return 1;
}
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
-
/*
*
* Generic message digest information functions
diff --git a/src/openvpn/crypto_openssl.c b/src/openvpn/crypto_openssl.c
index f1bfd9f..4c13fe4 100644
--- a/src/openvpn/crypto_openssl.c
+++ b/src/openvpn/crypto_openssl.c
@@ -520,6 +520,12 @@
return ret;
}
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wconversion"
+#pragma GCC diagnostic ignored "-Wsign-conversion"
+#endif
+
bool
crypto_pem_decode(const char *name, struct buffer *dst, const struct buffer
*src)
{
@@ -895,11 +901,6 @@
return EVP_CIPHER_CTX_mode(ctx);
}
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wconversion"
-#endif
-
bool
cipher_ctx_mode_cbc(const cipher_ctx_t *ctx)
{
@@ -1003,10 +1004,6 @@
return cipher_ctx_final(ctx, dst, dst_len);
}
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
-
/*
*
* Generic message digest information functions
@@ -1221,21 +1218,12 @@
HMAC_CTX_reset(ctx);
}
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wconversion"
-#endif
-
int
hmac_ctx_size(HMAC_CTX *ctx)
{
return HMAC_size(ctx);
}
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
-
void
hmac_ctx_reset(HMAC_CTX *ctx)
{
diff --git a/src/openvpn/dhcp.c b/src/openvpn/dhcp.c
index 38e8d40..302d6ac 100644
--- a/src/openvpn/dhcp.c
+++ b/src/openvpn/dhcp.c
@@ -75,6 +75,7 @@
#if defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
+#pragma GCC diagnostic ignored "-Wsign-conversion"
#endif
static in_addr_t
diff --git a/src/openvpn/env_set.c b/src/openvpn/env_set.c
index 487a5e2..3de0374 100644
--- a/src/openvpn/env_set.c
+++ b/src/openvpn/env_set.c
@@ -434,6 +434,11 @@
return (script_security() >= SSEC_PW_ENV || !is_password_env_var(str));
}
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wsign-conversion"
+#endif
+
/* Make arrays of strings */
const char **
diff --git a/src/openvpn/error.h b/src/openvpn/error.h
index 2ad2c5d..6f13f49 100644
--- a/src/openvpn/error.h
+++ b/src/openvpn/error.h
@@ -406,6 +406,11 @@
return err & M_FATAL ? (err ^ M_FATAL) | M_NONFATAL : err;
}
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wsign-conversion"
+#endif
+
static inline int
openvpn_errno_maybe_crt(bool *crt_error)
{
diff --git a/src/openvpn/event.c b/src/openvpn/event.c
index ca84d19..2f4a6bc 100644
--- a/src/openvpn/event.c
+++ b/src/openvpn/event.c
@@ -636,6 +636,11 @@
return stat;
}
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wsign-conversion"
+#endif
+
static struct event_set *
ep_init(int *maxevents, unsigned int flags)
{
@@ -1112,6 +1117,10 @@
}
#endif /* SELECT */
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic pop
+#endif
+
static struct event_set *
event_set_init_simple(int *maxevents, unsigned int flags)
{
diff --git a/src/openvpn/fragment.c b/src/openvpn/fragment.c
index 7fc42e5..9f7dcce 100644
--- a/src/openvpn/fragment.c
+++ b/src/openvpn/fragment.c
@@ -40,6 +40,11 @@
goto error; \
}
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wsign-conversion"
+#endif
+
static void
fragment_list_buf_init(struct fragment_list *list, const struct frame *frame)
{
@@ -129,6 +134,10 @@
f->outgoing_return = alloc_buf(BUF_SIZE(frame));
}
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic pop
+#endif
+
/*
* Accept an incoming datagram (which may be a fragment) from remote.
* If the datagram is whole (i.e not a fragment), pass through.
diff --git a/src/openvpn/list.h b/src/openvpn/list.h
index fb3302d..bdb7e41 100644
--- a/src/openvpn/list.h
+++ b/src/openvpn/list.h
@@ -121,6 +121,11 @@
return hash->n_buckets;
}
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wsign-conversion"
+#endif
+
static inline struct hash_bucket *
hash_bucket(struct hash *hash, uint32_t hv)
{
diff --git a/src/openvpn/lzo.c b/src/openvpn/lzo.c
index 8daaec0..087de9d 100644
--- a/src/openvpn/lzo.c
+++ b/src/openvpn/lzo.c
@@ -40,6 +40,12 @@
#include "memdbg.h"
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wconversion"
+#pragma GCC diagnostic ignored "-Wsign-conversion"
+#endif
+
static void
lzo_compress_init(struct compress_context *compctx)
{
@@ -72,11 +78,6 @@
*header = NO_COMPRESS_BYTE;
}
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wconversion"
-#endif
-
static void
lzo_decompress(struct buffer *buf, struct buffer work, struct compress_context
*compctx,
const struct frame *frame)
diff --git a/src/openvpn/mbuf.c b/src/openvpn/mbuf.c
index 448124c..dc6b42f 100644
--- a/src/openvpn/mbuf.c
+++ b/src/openvpn/mbuf.c
@@ -37,6 +37,7 @@
#if defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
+#pragma GCC diagnostic ignored "-Wsign-conversion"
#endif
struct mbuf_set *
@@ -49,10 +50,6 @@
return ret;
}
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
-
void
mbuf_free(struct mbuf_set *ms)
{
diff --git a/src/openvpn/networking_sitnl.c b/src/openvpn/networking_sitnl.c
index 168401f..c08ea7a 100644
--- a/src/openvpn/networking_sitnl.c
+++ b/src/openvpn/networking_sitnl.c
@@ -133,6 +133,7 @@
#if defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
+#pragma GCC diagnostic ignored "-Wsign-conversion"
#endif
/**
diff --git a/src/openvpn/ntlm.c b/src/openvpn/ntlm.c
index 521677b..4ea8133 100644
--- a/src/openvpn/ntlm.c
+++ b/src/openvpn/ntlm.c
@@ -77,6 +77,7 @@
#if defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
+#pragma GCC diagnostic ignored "-Wsign-conversion"
#endif
static void
diff --git a/src/openvpn/otime.h b/src/openvpn/otime.h
index 108d0f2..f9cc64e 100644
--- a/src/openvpn/otime.h
+++ b/src/openvpn/otime.h
@@ -62,6 +62,7 @@
#if defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
+#pragma GCC diagnostic ignored "-Wsign-conversion"
#endif
static inline int
diff --git a/src/openvpn/packet_id.c b/src/openvpn/packet_id.c
index 63a4cae..e25bd40 100644
--- a/src/openvpn/packet_id.c
+++ b/src/openvpn/packet_id.c
@@ -74,6 +74,7 @@
#if defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
+#pragma GCC diagnostic ignored "-Wsign-conversion"
#endif
static void
diff --git a/src/openvpn/platform.h b/src/openvpn/platform.h
index f1a2b01..17479f1 100644
--- a/src/openvpn/platform.h
+++ b/src/openvpn/platform.h
@@ -93,6 +93,11 @@
* Extract UID or GID
*/
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wsign-conversion"
+#endif
+
static inline int
platform_state_user_uid(const struct platform_state_user *s)
{
@@ -111,6 +116,10 @@
return -1;
}
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic pop
+#endif
+
void platform_chroot(const char *path);
void platform_nice(int niceval);
diff --git a/src/openvpn/plugin.c b/src/openvpn/plugin.c
index 769fe65..66626c0 100644
--- a/src/openvpn/plugin.c
+++ b/src/openvpn/plugin.c
@@ -455,6 +455,11 @@
#define _OPENVPN_PATCH_LEVEL "git:" CONFIGURE_GIT_REVISION CONFIGURE_GIT_FLAGS
#endif
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wsign-conversion"
+#endif
+
static void
plugin_open_item(struct plugin *p, const struct plugin_option *o,
struct openvpn_plugin_string_list **retlist, const char
**envp,
@@ -537,6 +542,10 @@
}
}
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic pop
+#endif
+
static int
plugin_call_item(const struct plugin *p, void *per_client_context, const int
type,
const struct argv *av, struct openvpn_plugin_string_list
**retlist,
diff --git a/src/openvpn/pool.c b/src/openvpn/pool.c
index 0e95c5e..ee3ea5a 100644
--- a/src/openvpn/pool.c
+++ b/src/openvpn/pool.c
@@ -136,6 +136,11 @@
return ret;
}
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wsign-conversion"
+#endif
+
struct ifconfig_pool *
ifconfig_pool_init(const bool ipv4_pool, enum pool_type type, in_addr_t start,
in_addr_t end,
const bool duplicate_cn, const bool ipv6_pool, const struct
in6_addr ipv6_base,
@@ -708,6 +713,10 @@
}
}
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic pop
+#endif
+
void
ifconfig_pool_write(struct ifconfig_pool_persist *persist, const struct
ifconfig_pool *pool)
{
diff --git a/src/openvpn/reliable.c b/src/openvpn/reliable.c
index 0c8b552..26be1d9 100644
--- a/src/openvpn/reliable.c
+++ b/src/openvpn/reliable.c
@@ -344,6 +344,12 @@
* struct reliable member functions.
*/
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wconversion"
+#pragma GCC diagnostic ignored "-Wsign-conversion"
+#endif
+
void
reliable_init(struct reliable *rel, int buf_size, int offset, int array_size,
bool hold)
{
@@ -687,11 +693,6 @@
}
}
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wconversion"
-#endif
-
/* in how many seconds should we wake up to check for timeout */
/* if we return BIG_TIMEOUT, nothing to wait for */
interval_t
diff --git a/src/openvpn/socket.h b/src/openvpn/socket.h
index cce9183..466af7e 100644
--- a/src/openvpn/socket.h
+++ b/src/openvpn/socket.h
@@ -638,6 +638,11 @@
struct link_socket_actual *to);
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wsign-conversion"
+#endif
+
static inline ssize_t
link_socket_write_udp_posix(struct link_socket *sock, struct buffer *buf,
struct link_socket_actual *to)
@@ -660,6 +665,10 @@
return send(sock->sd, BPTR(buf), BLEN(buf), MSG_NOSIGNAL);
}
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic pop
+#endif
+
#endif /* ifdef _WIN32 */
static inline ssize_t
diff --git a/src/openvpn/ssl_util.c b/src/openvpn/ssl_util.c
index 50e8c03..10970e8 100644
--- a/src/openvpn/ssl_util.c
+++ b/src/openvpn/ssl_util.c
@@ -56,6 +56,12 @@
return var_value;
}
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wconversion"
+#pragma GCC diagnostic ignored "-Wsign-conversion"
+#endif
+
unsigned int
extract_iv_proto(const char *peer_info)
{
@@ -290,11 +296,6 @@
return NULL;
}
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wconversion"
-#endif
-
int
get_num_elements(const char *string, char delimiter)
{
diff --git a/src/openvpn/status.c b/src/openvpn/status.c
index a9f9498..d3f30b39 100644
--- a/src/openvpn/status.c
+++ b/src/openvpn/status.c
@@ -210,6 +210,7 @@
#if defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
+#pragma GCC diagnostic ignored "-Wsign-conversion"
#endif
#define STATUS_PRINTF_MAXLEN 512
diff --git a/src/openvpn/wfp_block.c b/src/openvpn/wfp_block.c
index 506d41b..669031a 100644
--- a/src/openvpn/wfp_block.c
+++ b/src/openvpn/wfp_block.c
@@ -131,6 +131,11 @@
return err;
}
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wsign-conversion"
+#endif
+
/*
* Block outgoing local traffic, possibly DNS only, except for
* (i) adapter with the specified index (and loopback, if all is blocked)
@@ -340,6 +345,10 @@
return err;
}
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic pop
+#endif
+
DWORD
delete_wfp_block_filters(HANDLE engine_handle)
{
diff --git a/src/openvpn/xkey_provider.c b/src/openvpn/xkey_provider.c
index 1819ab0..8dfbc1a 100644
--- a/src/openvpn/xkey_provider.c
+++ b/src/openvpn/xkey_provider.c
@@ -940,6 +940,11 @@
return ret;
}
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wsign-conversion"
+#endif
+
static int
signature_sign(void *ctx, unsigned char *sig, size_t *siglen, size_t sigsize,
const unsigned char *tbs, size_t tbslen)
@@ -1074,6 +1079,10 @@
return signature_sign(ctx, sig, siglen, sigsize, buf, sz);
}
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic pop
+#endif
+
/* Sign digest using native sign function -- will only work for native keys
*/
int
diff --git a/src/openvpnmsica/dllmain.c b/src/openvpnmsica/dllmain.c
index e7d4a4b..e57285d 100644
--- a/src/openvpnmsica/dllmain.c
+++ b/src/openvpnmsica/dllmain.c
@@ -98,6 +98,10 @@
return true;
}
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wsign-conversion"
+#endif
void
x_msg_va(const unsigned int flags, const char *format, va_list arglist)
diff --git a/src/openvpnserv/common.c b/src/openvpnserv/common.c
index a42c65d..38b6de6 100644
--- a/src/openvpnserv/common.c
+++ b/src/openvpnserv/common.c
@@ -26,6 +26,11 @@
LPCWSTR service_instance = L"";
static wchar_t win_sys_path[MAX_PATH];
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wsign-conversion"
+#endif
+
static DWORD
GetRegString(HKEY key, LPCWSTR value, LPWSTR data, DWORD size, LPCWSTR
default_value)
{
@@ -52,7 +57,6 @@
return ERROR_SUCCESS;
}
-
DWORD
GetOpenvpnSettings(settings_t *s)
{
@@ -274,6 +278,10 @@
return utf16;
}
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic pop
+#endif
+
const wchar_t *
get_win_sys_path(void)
{
diff --git a/src/openvpnserv/interactive.c b/src/openvpnserv/interactive.c
index ce0d4dd..1bddd24 100644
--- a/src/openvpnserv/interactive.c
+++ b/src/openvpnserv/interactive.c
@@ -512,6 +512,11 @@
free(sud->directory);
}
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wconversion"
+#pragma GCC diagnostic ignored "-Wsign-conversion"
+#endif
static SOCKADDR_INET
sockaddr_inet(short family, inet_address_t *addr)
@@ -1383,11 +1388,6 @@
return TRUE;
}
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wconversion"
-#endif
-
/**
* Prepare DNS domain "SearchList" registry value, so additional
* VPN domains can be added and its original state can be restored
@@ -2619,10 +2619,6 @@
return err;
}
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
-
/**
* Return the registry key where NRPT rules are stored
*
@@ -3561,6 +3557,9 @@
return 0;
}
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic pop
+#endif
static DWORD WINAPI
ServiceCtrlInteractive(DWORD ctrl_code, DWORD event, LPVOID data, LPVOID ctx)
diff --git a/src/tapctl/tap.c b/src/tapctl/tap.c
index b633e77..fb19118 100644
--- a/src/tapctl/tap.c
+++ b/src/tapctl/tap.c
@@ -100,6 +100,11 @@
return fptr;
}
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wsign-conversion"
+#endif
+
/**
* Returns length of string of strings
*
diff --git a/tests/unit_tests/openvpn/mock_get_random.c
b/tests/unit_tests/openvpn/mock_get_random.c
index 77db18e..58ca5f0 100644
--- a/tests/unit_tests/openvpn/mock_get_random.c
+++ b/tests/unit_tests/openvpn/mock_get_random.c
@@ -28,6 +28,11 @@
#include <stdint.h>
#include <cmocka.h>
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wsign-conversion"
+#endif
+
unsigned long
get_random(void)
{
@@ -35,6 +40,10 @@
return rand();
}
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic pop
+#endif
+
void
prng_bytes(uint8_t *output, int len)
{
diff --git a/tests/unit_tests/openvpn/mock_msg.c
b/tests/unit_tests/openvpn/mock_msg.c
index 603520b..38e036e 100644
--- a/tests/unit_tests/openvpn/mock_msg.c
+++ b/tests/unit_tests/openvpn/mock_msg.c
@@ -45,6 +45,10 @@
char mock_msg_buf[MOCK_MSG_BUF];
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wsign-conversion"
+#endif
void
mock_set_debug_level(int level)
@@ -70,6 +74,10 @@
return x_debug_level;
}
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic pop
+#endif
+
void
x_msg_va(const unsigned int flags, const char *format, va_list arglist)
{
diff --git a/tests/unit_tests/openvpn/test_networking.c
b/tests/unit_tests/openvpn/test_networking.c
index f2da83e..4bda473 100644
--- a/tests/unit_tests/openvpn/test_networking.c
+++ b/tests/unit_tests/openvpn/test_networking.c
@@ -39,6 +39,11 @@
return net_iface_del(NULL, name);
}
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wsign-conversion"
+#endif
+
static int
net__iface_mtu_set(int mtu)
{
@@ -47,6 +52,10 @@
return net_iface_mtu_set(NULL, iface, mtu);
}
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic pop
+#endif
+
static int
net__addr_v4_add(const char *addr_str, int prefixlen)
{
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1186?usp=email
To unsubscribe, or for help writing mail filters, visit
http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Iecf502ec811e99c56647b2d45298fa0fb66960fb
Gerrit-Change-Number: 1186
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]>
Gerrit-Reviewer: plaisthos <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel