Add conflict check filter

Set ENABLE_CHECK_FILTER to 1 for get list of display filter with conflict...

Ping-Bug:2402
Change-Id: I8d56b1573120d1a29d437aae1088be242e15e9a3
Reviewed-on: https://code.wireshark.org/review/13644
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
This commit is contained in:
Alexis La Goutte 2016-02-01 21:33:33 +01:00
parent 6ea3f3790a
commit 4f3a88989e
5 changed files with 71 additions and 1 deletions

View File

@ -989,6 +989,10 @@ elseif(QT_FOUND)
endif()
endif()
if(ENABLE_CHECKHF_CONFLICT)
set(ENABLE_CHECK_FILTER 1)
endif()
message(STATUS "C-Flags: ${CMAKE_C_FLAGS}")
message(STATUS "CXX-Flags: ${CMAKE_CXX_FLAGS}")
message(STATUS "Warnings as errors: ${WERROR_COMMON_FLAGS}")

View File

@ -25,6 +25,7 @@ option(EXTCAP_ANDROIDDUMP_LIBPCAP "Build androiddump using libpcap" OFF)
option(ENABLE_EXTRA_COMPILER_WARNINGS "Do additional compiler warnings (disables -Werror)" OFF)
option(ENABLE_CODE_ANALYSIS "Enable the compiler's static analyzer if possible" OFF)
option(ENABLE_ASAN "Enable AddressSanitizer (ASAN) for debugging (May be slow down)" OFF)
option(ENABLE_CHECKHF_CONFLICT "Enable Check hf conflict for debugging (May be slow start)" OFF)
#
# Leave GTK2 the default on Windows, looks better than GTK3

View File

@ -31,6 +31,9 @@
/* Define to 1 if we want to enable plugins */
#cmakedefine HAVE_PLUGINS 1
/* Define to 1 if we check hf conflict */
#cmakedefine ENABLE_CHECK_FILTER 1
/* Link plugins statically into Wireshark */
#cmakedefine ENABLE_STATIC 1

View File

@ -963,6 +963,14 @@ AC_ARG_ENABLE(asan,
],)
# Add check hf conflict..
#
AC_ARG_ENABLE(checkhf-conflict,
AC_HELP_STRING( [--enable-checkhf-conflict],
[Enable Check hf conflict for debugging (May be slow start)@<:@default=no@:>@]),
[
AC_DEFINE(ENABLE_CHECK_FILTER, 1, [Enable check hf conflict])
],)
#
# The following are for C and C++

View File

@ -62,7 +62,6 @@
/* XXX - This should probably be a preference */
#define MAX_TREE_ITEMS (1 * 1000 * 1000)
typedef struct __subtree_lvl {
gint cursor_offset;
proto_item *it;
@ -6675,6 +6674,54 @@ tmp_fld_check_assert(header_field_info *hfinfo)
}
}
#ifdef ENABLE_CHECK_FILTER
static enum ftenum
_ftype_common(enum ftenum type)
{
switch (type) {
case FT_INT8:
case FT_INT16:
case FT_INT24:
case FT_INT32:
return FT_INT32;
case FT_UINT8:
case FT_UINT16:
case FT_UINT24:
case FT_UINT32:
case FT_IPXNET:
case FT_FRAMENUM:
return FT_UINT32;
case FT_UINT64:
case FT_EUI64:
return FT_UINT64;
case FT_STRING:
case FT_STRINGZ:
case FT_UINT_STRING:
return FT_STRING;
case FT_FLOAT:
case FT_DOUBLE:
return FT_DOUBLE;
case FT_BYTES:
case FT_UINT_BYTES:
case FT_ETHER:
case FT_OID:
return FT_BYTES;
case FT_ABSOLUTE_TIME:
case FT_RELATIVE_TIME:
return FT_ABSOLUTE_TIME;
default:
return type;
}
}
#endif
static void
register_type_length_mismatch(void)
{
@ -6803,6 +6850,13 @@ proto_register_field_init(header_field_info *hfinfo, const int parent)
same_name_hfinfo->same_name_next = hfinfo;
hfinfo->same_name_prev_id = same_name_hfinfo->id;
#ifdef ENABLE_CHECK_FILTER
while (same_name_hfinfo) {
if (_ftype_common(hfinfo->type) != _ftype_common(same_name_hfinfo->type))
fprintf(stderr, "'%s' exists multiple times with NOT compatible types: %s and %s\n", hfinfo->abbrev, ftype_name(hfinfo->type), ftype_name(same_name_hfinfo->type));
same_name_hfinfo = same_name_hfinfo->same_name_next;
}
#endif
}
}