- 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
Rename flex macros using parenthesis (mostly a style issue):
DIAG_OFF_FLEX -> DIAG_OFF_FLEX()
DIAG_ON_FLEX -> DIAG_ON_FLEX()
Use the same kind of construct with lemon generated code using
DIAG_OFF_LEMON() and DIAG_ON_LEMON(). Use %include and %code
directives to enforce the desired order with generated code
in the middle in between pragmas.
Fix a clang-specific pragma to use DIAG_OFF_CLANG().
DIAG_OFF(unreachable-code) -> DIAG_OFF_CLANG(unreachable-code).
Apparently GCC is ignoring the -Wunreachable flag, that's why
it did not trigger an unknown pragma warning. From [1}:
The -Wunreachable-code has been removed, because it was unstable: it
relied on the optimizer, and so different versions of gcc would warn
about different code. The compiler still accepts and ignores the
command line option so that existing Makefiles are not broken. In some
future release the option will be removed entirely. - Ian
[1] https://gcc.gnu.org/legacy-ml/gcc-help/2011-05/msg00360.html
Add UNICODE_REPLACEMENT_CHARACTER as a #define for the Unicode
REPLACEMENT CHARACTER code point (0x00FFFD), and use that instead of
0xfffd/0xFFFD/0x00FFFD in cases where that value refers to REPLACEMENT
CHARACTER.
This removes the last dependency of the logging subsystem on the
preferences module. The latter is started much later than the former
and this is an issue.
The Windows-only preference "gui.console_open" is stored in the
registry as HKEY_LOCAL_USER\Software\Wireshark\ConsoleOpen. The semantics
are exactly the same. The preference is read by the logging subsystem
for initialization and then again by the preferences (read/write) so
the user can configure it as before.
The code to store the preference also in the preferences file was
kept, for backward compatibility and because it is not incompatible
with using the Registry concurrently.
The elimination of the prefs dependency also allows moving the Windows
console logic to wsutil and add the functionality to wslog directly,
thereby eliminating the superfluous Wireshark/Logray custom log handler.
To be able to read the ws_log_console_open global variable from
libwireshark it becomes necessary to add a new export macro
symbol called WSUTIL_EXPORT.
This adds a new attribute that allows declaring Wireshark
functions as deprecated.
Also disabe -Werror with deprecated declarations Deprecated
declarations can be introduced suddenly with a new version
of an external dependency or a new internal deprecation and
that has its own timeline to fix. We should still be able to
build with -Werror in that case.
This enable the warning at "warning" level (neither ignored nor
an error). This is used to selectively disable -Werror for a section
of code but keep the warning enabled as useful and relevant.
For example it can be used to defer replacing deprecated declarations
and still build with -Werror enabled globally.
Using a warning is probably too exalted for the current state
of the code, where UTF-8 errors are somewhat expected from
dissectors that are lax about input validation.
Use a debug level with its own "UTF-8" domain instead.
Using a dedicated domain allows to filter on encoding errors and
with some enhancements to the logging subsystem make them fatal
for tracking and debugging purposes.
Using a dedicated domain might have other drawbacks but for now
it seems like the best approach.
This prevents the weird failures I saw on macOS in #17856; instead, it
should fail on *all* platforms with
Unhandled exception ("epan/proto.c:8800: failed assertion "DISSECTOR_ASSERT_NOT_REACHED"", group=1, code=6)
(which it does on macOS 11.6/Xcode 12.5.1 and Windows 10/VS 2019
16.11.8; according to
https://en.wikipedia.org/w/index.php?title=Thread-local_storage&oldid=1064900318#C_and_C++
the major UN*X C compilers support __thread and the major Windows C
compilers support __declspec(thread).).
@jvalverde: on branches that require C11/C++11 support, we could perhaps
just use _Thread_local for C and thread_local for C++. Note that
<thread.h> is optional in C11, and macOS 11.6/Xcode 12.5.1 does not
appear to include it.)
This does not *fix* the aforementioned issue; to do *that* we need to do
TRY in the register-dissectors thread code. I'm committing this
separately because it fixes a bug in our exception package that could
cause all sorts of randomness now and in the future - what we're doing
now is Just Wrong.
(Yes, there's code to support per-thread exception handler stacks *on
platforms with pthreads*, but this is simpler *and* also works on
Windows.)
Add a LOG_LEVEL_ECHO that is always active and always non-fatal.
Use that to implement a WS_DEBUG_HERE() macro for quick print outs
during debugging sessions.
Currently used to define ssize_t on platforms that lack it.
Fix some Windows build errors caused by moving the definition into a
separate header.
Fix some narrowing warnings on Windows x64 from changing the definition
of ssize_t from long int to int64_t.
The casts in dumpcap are ugly but necessary. The whole code needs
to be rewritten for portability, or the warnings disabled.
Wmem is an alternative to GLib data structures so it should
have the same scope and be equally as convenient to use.
Wmem does not and cannot depend on anything else other than
GLib.
Blind attempt to fix Debian package brokenness managing
headers separately from install rules.
Global public headers that don't fit any of the Wireshark
libraries should be placed in include/.
Eventually the C files in the root dir should be placed somewhere
else as well (like src/) but this is not a priority.
Fixes#17726.