In certain situations using __MINGW64__ is not correct.
We want to have the condition apply using MinGW-w64 but also
using MSYS2, which the __MINGW64__ condition alone does not
capture.
Add a HAVE_MSYSTEM C define and use it where appropriate.
Dumpcap depends on wsutil.so. The path to the shared library
is encoded in the RPATH (or RUNPATH) property of ELF binaries.
This is currently an absolute path on most Unixy systems.
Dumpcap could not be made to work with a relative RPATH because it
uses elevated privileges and some loaders will ignore relative
RPATHs and non-standard paths under those circumstances, because of
(justified) security concerns.
To enable relocation of the program we link dumpcap statically
with wsutil instead.
This provides a fully working relocatable installation on Linux
and other platforms that support relative RPATHs.
Instead of having AUTHORS.src and copying that to a new AUTHORS
file with git log information appended to that have a single
AUHTORS file and update it in place with git log info.
Install documentation to DOCDIR instead of DATADIR.
The code must be fixed to open the Help URLs from
this new path.
This only affects Unix-like FHS platforms. Windows
installation does its own thing.
Needs testing with macOS packaging.
DFTest is a private test utility and isn't installed anywhere.
I don't think it makes sense to maintain a man page. Certainly
doesn't make sense to ship it.
The doc file is understandably minimal so just nuke it.
Set our ld library path and our data, extcap, and plugin directories.
Document WIRESHARK_EXTCAP_DIR and WIRESHARK_PLUGIN_DIR. Note that we
might want to set our various directories relative to the program path.
Develpment headers are a sizeable part of the binary installation
and most users won't ever require them. It's recommended to package
them separately in a devel package or SDK.
Create a CMake installation component for development headers
and add the EXCLUDE_FROM_ALL property.
Headers can be installed using the invocation:
cmake --install <dir> --component Development
It looks like AppleClang 10 and 11 generate bogus missing braces
warnings as well. The macOS Intel builder, which has AppleClang
11.0.0.11000033 installed, is failing with
wireshark/epan/dissectors/packet-rtps.c:11403:63: error: suggest braces around initialization of subobject [-Werror,-Wmissing-braces]
coherent_set_entity_info coherent_set_entity_info_object = {0};
^
{}
Make the "ninja install" target in the MINGW64 shell work and
allow Wireshark to run from the msys2 installation, besides
the build directory.
To clarify the names used here MSYSTEM is the distribution with a
Linux-like environment for Windows. MINGW is the toolchain.
It is possible to use MinGW without MSYS2 and we generally select
the CMake variables WIN32/MSVC/MINGW/USE_MSYSTEM taking that into
consideration but that WIN32+MINGW platform is not supported at the
moment and it's unlikely to be supported in the near future.
Originally WS_DISABLE_DEBUG was chosen to be
similar to G_DISABLE_ASSERT and NDEBUG.
However generator expressions are essential for modern CMake
but the syntax is weird and having to use negations makes it
ten-fold worse.
Remove the negation. Instead of changing the CMake variable
reverse the macro definition for WS_DISABLE_DEBUG.
The $<CONFIG:cgs> generator expression with multiple config arguments
requires CMake >= 3.19 so we can't use that yet for a further
syntactical simplification.
The stringop-overflow warning is active with both GCC and Clang
in the master branch and was not triggered by our build bots so
update the comment to reflect that.
```
epan/dissectors/packet-lwm.c:464:31: error: writing 16 bytes into a region of size 0 [-Werror=stringop-overflow=]
464 | vector[i] ^= text_dec[i];
| ~~~~~~~~~~^~~~~~~~~~~~~~
epan/dissectors/packet-lwm.c:419:21: note: at offset 192 into destination object ‘nwkSecurityVector’ of size 16
419 | guint32 nwkSecurityVector[4];
| ^~~~~~~~~~~~~~~~~
```
Disable UTF-8 debug checks for release builds for optimization
purposes.
Also remove unused macro that currently lacks a proper use case.
Change version info to be more complete about the build type without
being too verbose.
If the jump misses init it's probably because the variable is
not used. Don't force contortions to avoid this common and
harmless case of "missing init" for an unused variable after
jumping.
Windows already requires CMake 3.13. Bump the non-Windows
required version to 3.13 as well, since all our currently
supported Linux distributions have at least 3.13.
RHEL 8 and SUSE Enterprise 15 were initially released with
3.10 and 3.11, but have had updates with much more recent
versions since mid 2021 and mid 2020, respectively.
Add another category for warnings that are worth looking
into.
Split ENABLE_EXTRA_WARNINGS into ENABLE_TODO_WARNINGS and
ENABLE_PEDANTIC_WARNINGS.
Disable pedantic warnings in the CI builds.
Add Clang specific warnings to standard category.
Fix or workaround -Wunreachable warnings.
Enable -Qunused-arguments because it may be a useful warning.
Remove -fwrapv because it is implied by -fno-strict-overflow.
Move GCC-specific flag out of if(GCC) condition. Let CMake enable
it automatically.
It's is valid for C and C++ so move -Wlogical-op to common
flags.
Remove comment because GCC 4.4.5 is over 12 years old at this time,
assume it is outdated.
Remove warnings included in -Wall and -Wextra to make the command
line less noisy and speed up CMake invocation.
Remove a -Werror=implicit flag. Let errors be controlled exclusively
by -Werror.
Move some -Wno-foo flags that are only relevant with -Wpedantic.
Allow fuzz jobs to pass with warnings because catching warnings is
not their purpose.
Remove -Werror=unused-but-set-variable that was added in
85357ae721 as a work-around to the fact that -Werror is not
enabled as a side-effect of ENABLE_EXTRA_COMPILER_WARNINGS.
Allow users to control -Werror. For example the MSYS2 build
has many warnings, this policy of adding -Werror= breaks that
build.
Add -Werror=unused-but-set-variable to our default compiler flags and fix
```
epan/dissectors/packet-dcerpc-frsrpc.c:709:10: error: variable 'nb_chunk' set but not used [-Werror,-Wunused-but-set-variable]
guint32 nb_chunk = 0;
^
```
```
epan/dissectors/packet-dcom-oxid.c:175:13: error: variable 'u32ItemIdx' set but not used [-Werror,-Wunused-but-set-variable]
guint32 u32ItemIdx;
^
```
```
epan/dissectors/packet-l2tp.c:1775:104: error: parameter 'ccid' set but not used [-Werror,-Wunused-but-set-parameter]
static int dissect_l2tp_ericsson_avps(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint32 ccid)
^
```
```
epan/dissectors/packet-ldp.c:1922:19: error: variable 'ix' set but not used [-Werror,-Wunused-but-set-variable]
guint8 ix;
^
```
```
epan/dissectors/packet-nas_5gs.c:4757:14: error: variable 'curr_len' set but not used [-Werror,-Wunused-but-set-variable]
guint i, curr_len;
^
```
```
epan/dissectors/packet-per.c:1769:6: error: variable 'extension_addition_entries' set but not used [-Werror,-Wunused-but-set-variable]
int extension_addition_entries;
^
```
```
epan/dissectors/packet-rtitcp.c:618:11: error: variable 'messages_count' set but not used [-Werror,-Wunused-but-set-variable]
guint messages_count, offset;
^
```
```
epan/dissectors/packet-tcp.c:2130:9: error: variable 'ackcount' set but not used [-Werror,-Wunused-but-set-variable]
int ackcount;
^
epan/dissectors/packet-tcp.c:3317:12: error: variable 'nbOptionsChanged' set but not used [-Werror,-Wunused-but-set-variable]
guint8 nbOptionsChanged = 0;
^
```
```
epan/dissectors/packet-zbee-zcl-se.c:11802:15: error: variable 'i' set but not used [-Werror,-Wunused-but-set-variable]
for (gint i = 0; tvb_reported_length_remaining(tvb, *offset) >= 5; i++) {
^
```
```
ui/iface_lists.c:142:23: error: variable 'linktype_count' set but not used [-Werror,-Wunused-but-set-variable]
gint linktype_count;
^
```
```
ui/voip_calls.c:456:15: error: variable 'item_num' set but not used [-Werror,-Wunused-but-set-variable]
guint item_num;
^
```
```
file.c:572:17: error: variable 'count' set but not used [-Werror,-Wunused-but-set-variable]
guint32 count = 0;
^
```
```
file.c:3667:24: warning: cast from 'const unsigned char *' to 'unsigned char *' drops const qualifier [-Wcast-qual]
pd = (guint8 *)ws_mempbrk_exec(pd, buf_end - pd, pattern, &c_char);
^
```
```
ui/qt/io_graph_dialog.cpp:1932:60: error: variable 'mavg_right' set but not used [-Werror,-Wunused-but-set-variable]
unsigned int mavg_in_average_count = 0, mavg_left = 0, mavg_right = 0;
^
```
```
ui/qt/stats_tree_dialog.cpp:166:9: error: variable 'node_count' set but not used [-Werror,-Wunused-but-set-variable]
int node_count = 0;
^
```
```
ui/qt/models/profile_model.cpp:1142:13: error: variable 'entryCount' set but not used [-Werror,-Wunused-but-set-variable]
int entryCount = 0;
^
```
Properly generate filter expressions for custom columns by
using proto_construct_match_selected_string on each value and
then joining them together later instead of trying to split
the column expression value.
This ensures that escaping is done properly for display filter
strings, that commas internal to field values are not confused
with commas between occurrences, that for multifield columns
we can distinguish which field each value matches, etc.
It's not entirely clear whether AND or OR logic is appropriate
for multiple occurrences; currently OR is used.
Bump glib requirement to 2.54 for g_ptr_array_find_with_equal_func
(this doesn't drop support for any major distribution that already
meets our other library requirements, like Qt.)
Fix#18001.
The RPM packages use a versioned build directory, which creates problems
for ccache. The APT packages simply take a long time to build. Switch
both to a twice-daily schedule so that we don't set fire to CI minutes
in parallel with every merge.
Back out a recent CMake change since it's no longer needed.