Wireshark-dev: Re: [Wireshark-dev] Problems building Wireshark under Windows

From: Guy Harris <gharris@xxxxxxxxx>
Date: Tue, 5 Jul 2022 22:52:28 -0700
On Jul 5, 2022, at 8:35 PM, Richard Sharpe <realrichardsharpe@xxxxxxxxx> wrote:

> To get master to build on Windows I needed this change, which might
> not be the most elegant:
> 
> $ git diff
> diff --git a/include/ws_attributes.h b/include/ws_attributes.h
> index f3ecf598f1..0b88a0fc6f 100644
> --- a/include/ws_attributes.h
> +++ b/include/ws_attributes.h
> @@ -40,7 +40,11 @@ extern "C" {
>  * declaration, as the MSVC version has to go before the declaration.)
>  */
> #ifndef __cplusplus
> -  #define WS_NORETURN _Noreturn
> +  #if defined(_MSC_VER)
> +    #define WS_NORETURN __declspec(noreturn)
> +  #elif
> +    #define WS_NORETURN _Noreturn
> +  #endif

This blog post:

	https://devblogs.microsoft.com/cppblog/c11-and-c17-standard-support-arriving-in-msvc/

says:

	"C11 and C17 Standard Support Arriving in MSVC

		...

		Our team is happy to announce that C11 and C17 are becoming supported language versions in the MSVC compiler toolset starting with Visual Studio 2019 version 16.8 Preview 3!

		...

	What’s in:
	All the required features of C11 and C17 are supported. This meant adding the following functionalities:

		• _Pragma
		• restrict
		• _Noreturn and <stdnoreturn.h>

		...

I don't see anything in C11 to indicate that stdnoreturn.h is required for _Noreturn, it just says:

	7.23 _Noreturn<stdnoreturn.h>

	The header <stdnoreturn.h> defines the macro

		noreturn

	which expands to _Noreturn.

but it doesn't seem to including that _Noreturn is *itself* a macro defined by some header file that must be included in order to use it.

And I have VS 16.11.16 installed on my virtual Windows 10 machine and the only stdnoreturn.h that Windows Explorer could find were inside the Qt and Strawberry Perl installations.

So I don't entirely trust the claim from the blog.

When I run CMake on Wireshark on that VM, I get

CMake Warning at CMakeLists.txt:592 (message):
  Windows SDK 10.0.18362.0 doesn't support C11.  Please make sure you're
  using 10.0.20348.0 or later.

The VS 2019 installer doesn't offer 10.0.20348.0; it shows the Windows 10 SDK 10.0.18362.0 as being installed, and is offering 10.0.19041.0, some *older* versions, and the Windows *11* SDK 10.0.22000.0, for installation.  I have *no* idea why it doesn't offer 10.0.20348.0, and don't know what will break if I install a W11 SDK (hopefully it allows a version of Wireshark that runs on W10 to build on W10).

Nevertheless, it builds without an error.

Which major version of VS (2017, 2019, 2022, other) are you using, and which version of the SDK is it using?