From 9c68879a27cdd617c9d05808b362a0066deb042a Mon Sep 17 00:00:00 2001 From: Philipp Dittmann Date: Tue, 3 Jan 2023 13:09:43 +0100 Subject: [PATCH] Windows: Fix Release (unused variables) - ws_assert does not work, because _ASSERT_ENABLED is false and gets optimized - add _U_ to unused variables because of compile flag /W3 - local variables need suppression of warning 4189 --- epan/dfilter/dfunctions.c | 8 ++++---- epan/dfilter/semcheck.c | 8 ++++---- epan/dfilter/sttype-op.c | 2 +- epan/wslua/wslua_proto.c | 3 ++- include/ws_attributes.h | 2 +- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/epan/dfilter/dfunctions.c b/epan/dfilter/dfunctions.c index 0dc23c9438..ca788aa631 100644 --- a/epan/dfilter/dfunctions.c +++ b/epan/dfilter/dfunctions.c @@ -30,7 +30,7 @@ /* Convert an FT_STRING using a callback function */ static gboolean -string_walk(GSList *args, guint32 arg_count, GSList **retval, gchar(*conv_func)(gchar)) +string_walk(GSList *args, guint32 arg_count _U_, GSList **retval, gchar(*conv_func)(gchar)) { GSList *arg1; fvalue_t *arg_fvalue; @@ -79,7 +79,7 @@ df_func_upper(GSList *args, guint32 arg_count, GSList **retval) /* dfilter function: count() */ static gboolean -df_func_count(GSList *args, guint32 arg_count, GSList **retval) +df_func_count(GSList *args, guint32 arg_count _U_, GSList **retval) { GSList *arg1; fvalue_t *ft_ret; @@ -100,7 +100,7 @@ df_func_count(GSList *args, guint32 arg_count, GSList **retval) /* dfilter function: string() */ static gboolean -df_func_string(GSList *args, guint32 arg_count, GSList **retval) +df_func_string(GSList *args, guint32 arg_count _U_, GSList **retval) { GSList *arg1; fvalue_t *arg_fvalue; @@ -207,7 +207,7 @@ df_func_min(GSList *args, guint32 arg_count, GSList **retval) } static gboolean -df_func_abs(GSList *args, guint32 arg_count, GSList **retval) +df_func_abs(GSList *args, guint32 arg_count _U_, GSList **retval) { GSList *arg1; fvalue_t *fv_arg, *new_fv; diff --git a/epan/dfilter/semcheck.c b/epan/dfilter/semcheck.c index f116050501..8683f96ff3 100644 --- a/epan/dfilter/semcheck.c +++ b/epan/dfilter/semcheck.c @@ -596,7 +596,7 @@ dfilter_fvalue_from_charconst(dfwork_t *dfw, ftenum_t ftype, stnode_t *st) /* If the LHS of a relation test is a FIELD, run some checks * and possibly some modifications of syntax tree nodes. */ static void -check_relation_LHS_FIELD(dfwork_t *dfw, stnode_op_t st_op, +check_relation_LHS_FIELD(dfwork_t *dfw, stnode_op_t st_op _U_, FtypeCanFunc can_func, gboolean allow_partial_value, stnode_t *st_node, stnode_t *st_arg1, stnode_t *st_arg2) @@ -795,7 +795,7 @@ check_relation_LHS_FVALUE(dfwork_t *dfw, stnode_op_t st_op _U_, } static void -check_relation_LHS_SLICE(dfwork_t *dfw, stnode_op_t st_op, +check_relation_LHS_SLICE(dfwork_t *dfw, stnode_op_t st_op _U_, FtypeCanFunc can_func _U_, gboolean allow_partial_value, stnode_t *st_node _U_, @@ -894,7 +894,7 @@ check_relation_LHS_SLICE(dfwork_t *dfw, stnode_op_t st_op, /* If the LHS of a relation test is a FUNCTION, run some checks * and possibly some modifications of syntax tree nodes. */ static void -check_relation_LHS_FUNCTION(dfwork_t *dfw, stnode_op_t st_op, +check_relation_LHS_FUNCTION(dfwork_t *dfw, stnode_op_t st_op _U_, FtypeCanFunc can_func, gboolean allow_partial_value, stnode_t *st_node, stnode_t *st_arg1, stnode_t *st_arg2) { @@ -1005,7 +1005,7 @@ check_relation_LHS_FUNCTION(dfwork_t *dfw, stnode_op_t st_op, } static void -check_relation_LHS_ARITHMETIC(dfwork_t *dfw, stnode_op_t st_op, +check_relation_LHS_ARITHMETIC(dfwork_t *dfw, stnode_op_t st_op _U_, FtypeCanFunc can_func, gboolean allow_partial_value, stnode_t *st_node, stnode_t *st_arg1, stnode_t *st_arg2) { diff --git a/epan/dfilter/sttype-op.c b/epan/dfilter/sttype-op.c index a6765f141c..965be2f841 100644 --- a/epan/dfilter/sttype-op.c +++ b/epan/dfilter/sttype-op.c @@ -21,7 +21,7 @@ typedef struct { #define OPER_MAGIC 0xab9009ba static gpointer -oper_new(gpointer junk) +oper_new(gpointer junk _U_) { oper_t *oper; diff --git a/epan/wslua/wslua_proto.c b/epan/wslua/wslua_proto.c index 9b4ebcd601..363975b258 100644 --- a/epan/wslua/wslua_proto.c +++ b/epan/wslua/wslua_proto.c @@ -233,7 +233,8 @@ WSLUA_METHOD Proto_register_heuristic(lua_State* L) { Proto proto = checkProto(L,1); const gchar *listname = luaL_checkstring(L, WSLUA_ARG_Proto_register_heuristic_LISTNAME); const gchar *proto_name = proto->name; - const int top = lua_gettop(L); + const int top _U_ = lua_gettop(L); + gchar *short_name; if (!proto_name || proto->hfid == -1) { diff --git a/include/ws_attributes.h b/include/ws_attributes.h index d838e2696f..de0e5da78c 100644 --- a/include/ws_attributes.h +++ b/include/ws_attributes.h @@ -28,7 +28,7 @@ extern "C" { /* This includes clang */ #define _U_ __attribute__((unused)) #elif defined(_MSC_VER) - #define _U_ __pragma(warning(suppress:4100)) + #define _U_ __pragma(warning(suppress:4100 4189)) #else #define _U_ #endif