On Tue, Jul 5, 2022 at 6:41 PM Richard Sharpe
<realrichardsharpe@xxxxxxxxx> wrote:
>
> Hi folks,
>
> I am seeing the following errors (a large number of them) while
> building Wireshark under Windows:
>
> ---------------------
> 83>C:\Users\Richard.Sharpe.A00187\source\wireshark-gl-ds\wsutil/wslog.h(280,6):
> error C2054: expected '(' to follow '_Noreturn'
> [C:\Development\wsbuild64\extcap\ssh-base.vcxproj]
> C:\Users\Richard.Sharpe.A00187\source\wireshark-gl-ds\wsutil/wslog.h(280,6):
> error C2054: void ws_log_fatal_full(const char *domain, enum
> ws_log_level level, [C:\Development\wsbuild64\extcap\ssh-base.vcxproj]
> C:\Users\Richard.Sharpe.A00187\source\wireshark-gl-ds\wsutil/wslog.h(280,6):
> error C2054: ^ [C:\Development\wsbuild64\extcap\ssh-base.vcxproj]
> 83>C:\Users\Richard.Sharpe.A00187\source\wireshark-gl-ds\wsutil/wslog.h(282,64):
> error C2085: 'ws_log_fatal_full': not in formal parameter list
> [C:\Development\wsbuild64\extcap\ssh-base.vcxproj]
> ...
> -------------------
>
> They seem to come from the fact that include/ws_attributes.h where
> WS_NORETURN etc are defined which does not define WS_NORETURN
> correctly for C files.
>
> #ifndef __cplusplus
> #define WS_NORETURN _Noreturn
> #else /* __cplusplus */
> #if __has_attribute(noreturn) \
> || WS_IS_AT_LEAST_GNUC_VERSION(2,5) \
> || WS_IS_AT_LEAST_SUNC_VERSION(5,9) \
> || WS_IS_AT_LEAST_XL_C_VERSION(10,1) \
> || WS_IS_AT_LEAST_HP_C_VERSION(6,10)
> /*
> * Compiler with support for __attribute__((noreturn)), or GCC 2.5 and
> * later, or Solaris Studio 12 (Sun C 5.9) and later, or IBM XL C 10.1
> * and later (do any earlier versions of XL C support this?), or
> * HP aCC A.06.10 and later.
> */
> #define WS_NORETURN __attribute__((noreturn))
> #elif defined(_MSC_VER)
> /*
> * MSVC.
> */
> #define WS_NORETURN __declspec(noreturn)
> #else
> #define WS_NORETURN
> #endif
> #endif /* __cplusplus */
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
#else /* __cplusplus */
#if __has_attribute(noreturn) \
|| WS_IS_AT_LEAST_GNUC_VERSION(2,5) \
--
Regards,
Richard Sharpe
(何以解憂?唯有杜康。--曹操)(传说杜康是酒的发明者)