Wireshark-dev: [Wireshark-dev] Re: warning C4702: unreachable code

From: Tamás Regős <regost@xxxxxxxxx>
Date: Wed, 4 Feb 2026 09:46:45 +0700
Hi Guy,

I have tried several different combinations which even included GCC/Clang and MSVC flags too... I left the GCC flags there, no impact...

I ended up with "/w14018 /w14702" and it is "Visual Studio 17 2022".

cmake -DCMAKE_C_FLAGS="/w14018 /w14702" -DCMAKE_CXX_FLAGS="/w14018 /w14702" -Wall -Wextra -Wformat -Wredundant-decls -Wunreachable-code -Wsign-compare -Wint-conversion -Wno-unused-variable -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_C_CLANG_TIDY=clang-tidy -DCMAKE_CXX_CLANG_TIDY=clang-tidy -G "Visual Studio 17 2022" -A arm64 ..\\wireshark \r

GCC/Clang Flag       MSVC Equivalent    What it does
-Wall               /W4                 Enables high-level warnings (Level 4).
-Werror             /WX                 Treats all warnings as errors.
-Wsign-compare      /w14018             Enables "signed/unsigned mismatch" as a Level 1 warning.
-Wunreachable-code  /w14702             It triggers when the compiler detects code that cannot be reached (deadcode)



I use Microsoft Visual Studio Community 2022 - Current Version 17.12.3


Regards,
Tamas

On Wed, 4 Feb 2026 at 09:42, Guy Harris <gharris@xxxxxxxxx> wrote:
On Feb 3, 2026, at 3:14 AM, Tamás Regős <regost@xxxxxxxxx> wrote:

While I was trying to run some of the pipeline logic locally on my Windows machine related to my earlier emails and new MRs (!23460, !23461), I recompiled WS with some additional Visual Studio flags for clang checks and I can see a lots of "warning C4702: unreachable code".

Should these be addressed and fixed via MRs?

wireshark\epan\dissectors\packet-blip.c(323,1): warning C4702: unreachable code

As per Michael Mann, it's calling REPORT_DISSECTOR_BUG(), which calls proto_report_dissector_bug(), which is marked with WS_NORETURN, which should mark that routine as never returning.

And it does so for:

GCC 2.5 and later, or any compiler that claims to be (equivalent to) that (Clang, possible Intel C, possibly more);

SunOracle Studio C 5.9 or later;

IBM XL C 10.1 or later;

HP aCC 6.10 or later;

all versions of Visual Studio that we support.

but for all but Visual Studio, that's done with __attribute__((noreturn)), but with Visual Studio it's done with __declspec(noreturn).

When you say "with some additional Visual Studio flags for clang checks", does that involve a version of Visual Studio C/C++ with a combination of Clang code and VS code, e.g. a Clang front end? If so, it might be using a "does not return" indication that the compiler doesn't recognize.

Also, what are the additional flags you used?
_______________________________________________
Wireshark-dev mailing list -- wireshark-dev@xxxxxxxxxxxxx
To unsubscribe send an email to wireshark-dev-leave@xxxxxxxxxxxxx