From 8d82adb28a1842619dc80f273ffae960b8b38f42 Mon Sep 17 00:00:00 2001 From: akallabeth Date: Thu, 17 Jun 2021 09:21:20 +0200 Subject: [PATCH] Fixed warnings --- channels/client/tables.h | 9 +++++++++ client/X11/xf_cliprdr.c | 2 +- client/X11/xf_gfx.c | 2 +- client/X11/xf_input.c | 2 +- libfreerdp/core/activation.c | 2 +- libfreerdp/core/connection.c | 1 - libfreerdp/locale/keyboard.c | 2 +- uwac/include/uwac/uwac.h | 2 +- uwac/libuwac/uwac-clipboard.c | 2 +- winpr/libwinpr/comm/comm.c | 2 +- winpr/libwinpr/comm/comm_sercx2_sys.c | 4 +++- winpr/libwinpr/comm/comm_sercx2_sys.h | 2 +- winpr/libwinpr/comm/comm_sercx_sys.c | 5 ++++- winpr/libwinpr/comm/comm_sercx_sys.h | 2 +- winpr/libwinpr/comm/comm_serial_sys.c | 2 +- winpr/libwinpr/comm/comm_serial_sys.h | 2 +- winpr/libwinpr/handle/nonehandle.h | 2 +- winpr/libwinpr/interlocked/interlocked.c | 20 ++++++++++++++++++++ winpr/libwinpr/sspi/sspi.c | 9 +++++++++ winpr/libwinpr/sspi/sspi_export.c | 9 +++++++++ winpr/libwinpr/thread/thread.c | 4 ++-- winpr/libwinpr/utils/collections/ArrayList.c | 4 ++-- winpr/libwinpr/utils/trio/trio.c | 4 ++-- 23 files changed, 73 insertions(+), 22 deletions(-) diff --git a/channels/client/tables.h b/channels/client/tables.h index b6b3f9ca2..7b74709e5 100644 --- a/channels/client/tables.h +++ b/channels/client/tables.h @@ -19,6 +19,11 @@ #include +/* The 'entry' function pointers have variable arguments. */ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wstrict-prototypes" +#endif struct _STATIC_ENTRY { const char* name; @@ -49,3 +54,7 @@ struct _STATIC_ADDIN_TABLE const STATIC_SUBSYSTEM_ENTRY* table; }; typedef struct _STATIC_ADDIN_TABLE STATIC_ADDIN_TABLE; + +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif diff --git a/client/X11/xf_cliprdr.c b/client/X11/xf_cliprdr.c index 38b005b91..fdf7d3276 100644 --- a/client/X11/xf_cliprdr.c +++ b/client/X11/xf_cliprdr.c @@ -98,7 +98,7 @@ struct xf_cliprdr_fuse_inode }; typedef struct xf_cliprdr_fuse_inode xfCliprdrFuseInode; -void xf_cliprdr_fuse_inode_free(void* obj) +static void xf_cliprdr_fuse_inode_free(void* obj) { xfCliprdrFuseInode* inode = (xfCliprdrFuseInode*)obj; if (!inode) diff --git a/client/X11/xf_gfx.c b/client/X11/xf_gfx.c index d948e6eca..a01c0c0ce 100644 --- a/client/X11/xf_gfx.c +++ b/client/X11/xf_gfx.c @@ -216,7 +216,7 @@ fail: return status; } -UINT32 x11_pad_scanline(UINT32 scanline, UINT32 inPad) +static UINT32 x11_pad_scanline(UINT32 scanline, UINT32 inPad) { /* Ensure X11 alignment is met */ if (inPad > 0) diff --git a/client/X11/xf_input.c b/client/X11/xf_input.c index 8ad777286..b20bd38b1 100644 --- a/client/X11/xf_input.c +++ b/client/X11/xf_input.c @@ -72,7 +72,7 @@ static double z_vector; static double px_vector; static double py_vector; -const char* xf_input_get_class_string(int class) +static const char* xf_input_get_class_string(int class) { if (class == XIKeyClass) return "XIKeyClass"; diff --git a/libfreerdp/core/activation.c b/libfreerdp/core/activation.c index 3c9606ea6..3ccc54533 100644 --- a/libfreerdp/core/activation.c +++ b/libfreerdp/core/activation.c @@ -169,7 +169,7 @@ BOOL rdp_send_server_control_cooperate_pdu(rdpRdp* rdp) return rdp_send_data_pdu(rdp, s, DATA_PDU_TYPE_CONTROL, rdp->mcs->userId); } -BOOL rdp_send_server_control_granted_pdu(rdpRdp* rdp) +static BOOL rdp_send_server_control_granted_pdu(rdpRdp* rdp) { wStream* s = rdp_data_pdu_init(rdp); if (!s) diff --git a/libfreerdp/core/connection.c b/libfreerdp/core/connection.c index 12279705e..712156f77 100644 --- a/libfreerdp/core/connection.c +++ b/libfreerdp/core/connection.c @@ -185,7 +185,6 @@ */ static int rdp_client_connect_finalize(rdpRdp* rdp); -static BOOL rdp_send_server_control_granted_pdu(rdpRdp* rdp); static BOOL rdp_client_reset_codecs(rdpContext* context) { diff --git a/libfreerdp/locale/keyboard.c b/libfreerdp/locale/keyboard.c index 4c5ae03e4..93908d769 100644 --- a/libfreerdp/locale/keyboard.c +++ b/libfreerdp/locale/keyboard.c @@ -50,7 +50,7 @@ static DWORD VIRTUAL_SCANCODE_TO_X11_KEYCODE[256][2] = { 0 }; static DWORD X11_KEYCODE_TO_VIRTUAL_SCANCODE[256] = { 0 }; static DWORD REMAPPING_TABLE[0x10000] = { 0 }; -int freerdp_detect_keyboard(DWORD* keyboardLayoutId) +static int freerdp_detect_keyboard(DWORD* keyboardLayoutId) { #if defined(_WIN32) CHAR name[KL_NAMELENGTH + 1] = { 0 }; diff --git a/uwac/include/uwac/uwac.h b/uwac/include/uwac/uwac.h index a3b129a84..cdcc4cc7e 100644 --- a/uwac/include/uwac/uwac.h +++ b/uwac/include/uwac/uwac.h @@ -337,7 +337,7 @@ extern "C" * handler is supposed to answer if the execution can continue. I can also be used * to log things. * - * @param handler + * @param handler the error handling function to install */ UWAC_API void UwacInstallErrorHandler(UwacErrorHandler handler); diff --git a/uwac/libuwac/uwac-clipboard.c b/uwac/libuwac/uwac-clipboard.c index 1d5c8fbf0..8296ddfa7 100644 --- a/uwac/libuwac/uwac-clipboard.c +++ b/uwac/libuwac/uwac-clipboard.c @@ -194,7 +194,7 @@ static void callback_done(void* data, struct wl_callback* callback, uint32_t ser static const struct wl_callback_listener callback_listener = { .done = callback_done }; -uint32_t get_serial(UwacSeat* s) +static uint32_t get_serial(UwacSeat* s) { struct wl_callback* callback; uint32_t serial = 0; diff --git a/winpr/libwinpr/comm/comm.c b/winpr/libwinpr/comm/comm.c index 1919d2d99..651766d6b 100644 --- a/winpr/libwinpr/comm/comm.c +++ b/winpr/libwinpr/comm/comm.c @@ -1184,7 +1184,7 @@ static HANDLE_OPS ops = { CommIsHandled, CommCloseHandle, /** * http://msdn.microsoft.com/en-us/library/windows/desktop/aa363198%28v=vs.85%29.aspx * - * @param lpDeviceName e.g. COM1, \\.\COM1, ... + * @param lpDeviceName e.g. COM1, "\\.\COM1", ... * * @param dwDesiredAccess expects GENERIC_READ | GENERIC_WRITE, a * warning message is printed otherwise. TODO: better support. diff --git a/winpr/libwinpr/comm/comm_sercx2_sys.c b/winpr/libwinpr/comm/comm_sercx2_sys.c index fd0e0c191..34ff7a57a 100644 --- a/winpr/libwinpr/comm/comm_sercx2_sys.c +++ b/winpr/libwinpr/comm/comm_sercx2_sys.c @@ -147,11 +147,13 @@ static SERIAL_DRIVER _SerCx2Sys = { .reset_device = NULL, /* not supported by SerCx2.sys */ }; -SERIAL_DRIVER* SerCx2Sys_s() +SERIAL_DRIVER* SerCx2Sys_s(void) { /* _SerCx2Sys completed with inherited functions from SerialSys or SerCxSys */ SERIAL_DRIVER* pSerialSys = SerialSys_s(); SERIAL_DRIVER* pSerCxSys = SerCxSys_s(); + if (!pSerialSys || !pSerCxSys) + return NULL; _SerCx2Sys.set_baud_rate = pSerialSys->set_baud_rate; _SerCx2Sys.get_baud_rate = pSerialSys->get_baud_rate; diff --git a/winpr/libwinpr/comm/comm_sercx2_sys.h b/winpr/libwinpr/comm/comm_sercx2_sys.h index 162898eba..a2906538a 100644 --- a/winpr/libwinpr/comm/comm_sercx2_sys.h +++ b/winpr/libwinpr/comm/comm_sercx2_sys.h @@ -29,7 +29,7 @@ extern "C" { #endif - SERIAL_DRIVER* SerCx2Sys_s(); + SERIAL_DRIVER* SerCx2Sys_s(void); #ifdef __cplusplus } diff --git a/winpr/libwinpr/comm/comm_sercx_sys.c b/winpr/libwinpr/comm/comm_sercx_sys.c index 054d3eb76..46bc20bf2 100644 --- a/winpr/libwinpr/comm/comm_sercx_sys.c +++ b/winpr/libwinpr/comm/comm_sercx_sys.c @@ -28,6 +28,7 @@ #include #include "comm_serial_sys.h" +#include "comm_sercx_sys.h" static BOOL _set_handflow(WINPR_COMM* pComm, const SERIAL_HANDFLOW* pHandflow) { @@ -211,10 +212,12 @@ static SERIAL_DRIVER _SerCxSys = { .reset_device = NULL, /* not supported by SerCx.sys */ }; -SERIAL_DRIVER* SerCxSys_s() +SERIAL_DRIVER* SerCxSys_s(void) { /* _SerCxSys completed with inherited functions from SerialSys */ SERIAL_DRIVER* pSerialSys = SerialSys_s(); + if (!pSerialSys) + return NULL; _SerCxSys.set_baud_rate = pSerialSys->set_baud_rate; _SerCxSys.get_baud_rate = pSerialSys->get_baud_rate; diff --git a/winpr/libwinpr/comm/comm_sercx_sys.h b/winpr/libwinpr/comm/comm_sercx_sys.h index ce008e7c9..2268c0cc0 100644 --- a/winpr/libwinpr/comm/comm_sercx_sys.h +++ b/winpr/libwinpr/comm/comm_sercx_sys.h @@ -29,7 +29,7 @@ extern "C" { #endif - SERIAL_DRIVER* SerCxSys_s(); + SERIAL_DRIVER* SerCxSys_s(void); #ifdef __cplusplus } diff --git a/winpr/libwinpr/comm/comm_serial_sys.c b/winpr/libwinpr/comm/comm_serial_sys.c index 8917b9efa..4834bcd6d 100644 --- a/winpr/libwinpr/comm/comm_serial_sys.c +++ b/winpr/libwinpr/comm/comm_serial_sys.c @@ -1609,7 +1609,7 @@ static SERIAL_DRIVER _SerialSys = { .reset_device = _reset_device, }; -SERIAL_DRIVER* SerialSys_s() +SERIAL_DRIVER* SerialSys_s(void) { return &_SerialSys; } diff --git a/winpr/libwinpr/comm/comm_serial_sys.h b/winpr/libwinpr/comm/comm_serial_sys.h index 2ce0d71c1..abb3f01db 100644 --- a/winpr/libwinpr/comm/comm_serial_sys.h +++ b/winpr/libwinpr/comm/comm_serial_sys.h @@ -29,7 +29,7 @@ extern "C" { #endif - SERIAL_DRIVER* SerialSys_s(); + SERIAL_DRIVER* SerialSys_s(void); #ifdef __cplusplus } diff --git a/winpr/libwinpr/handle/nonehandle.h b/winpr/libwinpr/handle/nonehandle.h index 1aa509888..463c446dc 100644 --- a/winpr/libwinpr/handle/nonehandle.h +++ b/winpr/libwinpr/handle/nonehandle.h @@ -33,7 +33,7 @@ struct winpr_none_handle typedef struct winpr_none_handle WINPR_NONE_HANDLE; -HANDLE CreateNoneHandle(); +HANDLE CreateNoneHandle(void); #endif /*_WIN32*/ diff --git a/winpr/libwinpr/interlocked/interlocked.c b/winpr/libwinpr/interlocked/interlocked.c index b6bd102fd..ed6db32aa 100644 --- a/winpr/libwinpr/interlocked/interlocked.c +++ b/winpr/libwinpr/interlocked/interlocked.c @@ -223,7 +223,10 @@ USHORT QueryDepthSList(WINPR_PSLIST_HEADER ListHead) LONG InterlockedIncrement(LONG volatile* Addend) { #ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Watomic-implicit-seq-cst" return __sync_add_and_fetch(Addend, 1); +#pragma GCC diagnostic pop #else return 0; #endif @@ -232,7 +235,10 @@ LONG InterlockedIncrement(LONG volatile* Addend) LONG InterlockedDecrement(LONG volatile* Addend) { #ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Watomic-implicit-seq-cst" return __sync_sub_and_fetch(Addend, 1); +#pragma GCC diagnostic pop #else return 0; #endif @@ -241,6 +247,8 @@ LONG InterlockedDecrement(LONG volatile* Addend) LONG InterlockedExchange(LONG volatile* Target, LONG Value) { #ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Watomic-implicit-seq-cst" return __sync_val_compare_and_swap(Target, *Target, Value); #else return 0; @@ -250,7 +258,10 @@ LONG InterlockedExchange(LONG volatile* Target, LONG Value) LONG InterlockedExchangeAdd(LONG volatile* Addend, LONG Value) { #ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Watomic-implicit-seq-cst" return __sync_fetch_and_add(Addend, Value); +#pragma GCC diagnostic pop #else return 0; #endif @@ -259,7 +270,10 @@ LONG InterlockedExchangeAdd(LONG volatile* Addend, LONG Value) LONG InterlockedCompareExchange(LONG volatile* Destination, LONG Exchange, LONG Comperand) { #ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Watomic-implicit-seq-cst" return __sync_val_compare_and_swap(Destination, Comperand, Exchange); +#pragma GCC diagnostic pop #else return 0; #endif @@ -269,7 +283,10 @@ PVOID InterlockedCompareExchangePointer(PVOID volatile* Destination, PVOID Excha PVOID Comperand) { #ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Watomic-implicit-seq-cst" return __sync_val_compare_and_swap(Destination, Comperand, Exchange); +#pragma GCC diagnostic pop #else return 0; #endif @@ -350,7 +367,10 @@ LONGLONG InterlockedCompareExchange64(LONGLONG volatile* Destination, LONGLONG E LONGLONG Comperand) { #ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Watomic-implicit-seq-cst" return __sync_val_compare_and_swap(Destination, Comperand, Exchange); +#pragma GCC diagnostic pop #else return 0; #endif diff --git a/winpr/libwinpr/sspi/sspi.c b/winpr/libwinpr/sspi/sspi.c index ad47175a3..a2b38ccfe 100644 --- a/winpr/libwinpr/sspi/sspi.c +++ b/winpr/libwinpr/sspi/sspi.c @@ -33,6 +33,11 @@ #include "sspi.h" +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + static wLog* g_Log = NULL; static INIT_ONCE g_Initialized = INIT_ONCE_STATIC_INIT; @@ -1123,3 +1128,7 @@ SecurityFunctionTableW sspi_SecurityFunctionTableW = { sspi_DecryptMessage, /* DecryptMessage */ sspi_SetContextAttributesW, /* SetContextAttributes */ }; + +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif diff --git a/winpr/libwinpr/sspi/sspi_export.c b/winpr/libwinpr/sspi/sspi_export.c index 9cc81f7b0..6d76b6fa1 100644 --- a/winpr/libwinpr/sspi/sspi_export.c +++ b/winpr/libwinpr/sspi/sspi_export.c @@ -36,6 +36,11 @@ typedef unsigned long ULONG; #endif typedef LONG SECURITY_STATUS; +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wmissing-prototypes" +#endif + /** * Standard SSPI API */ @@ -318,3 +323,7 @@ SSPI_EXPORT SECURITY_STATUS SEC_ENTRY VerifySignature(void* phContext, void* pMe { return sspi_VerifySignature(phContext, pMessage, MessageSeqNo, pfQOP); } + +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif diff --git a/winpr/libwinpr/thread/thread.c b/winpr/libwinpr/thread/thread.c index 5e7b4fd7f..14d03e533 100644 --- a/winpr/libwinpr/thread/thread.c +++ b/winpr/libwinpr/thread/thread.c @@ -248,7 +248,7 @@ static INIT_ONCE threads_InitOnce = INIT_ONCE_STATIC_INIT; static pthread_t mainThreadId; static DWORD currentThreadTlsIndex = TLS_OUT_OF_INDEXES; -BOOL initializeThreads(PINIT_ONCE InitOnce, PVOID Parameter, PVOID* Context) +static BOOL initializeThreads(PINIT_ONCE InitOnce, PVOID Parameter, PVOID* Context) { if (!apc_init(&mainThread.apc)) { @@ -657,7 +657,7 @@ typedef struct ULONG_PTR completionArg; } UserApcItem; -void userAPC(LPVOID arg) +static void userAPC(LPVOID arg) { UserApcItem* userApc = (UserApcItem*)arg; diff --git a/winpr/libwinpr/utils/collections/ArrayList.c b/winpr/libwinpr/utils/collections/ArrayList.c index dd0a8670e..9b38a120b 100644 --- a/winpr/libwinpr/utils/collections/ArrayList.c +++ b/winpr/libwinpr/utils/collections/ArrayList.c @@ -112,7 +112,7 @@ BOOL ArrayList_IsSynchronized(wArrayList* arrayList) * Lock access to the ArrayList */ -void ArrayList_Lock_Conditional(wArrayList* arrayList) +static void ArrayList_Lock_Conditional(wArrayList* arrayList) { WINPR_ASSERT(arrayList); if (arrayList->synchronized) @@ -129,7 +129,7 @@ void ArrayList_Lock(wArrayList* arrayList) * Unlock access to the ArrayList */ -void ArrayList_Unlock_Conditional(wArrayList* arrayList) +static void ArrayList_Unlock_Conditional(wArrayList* arrayList) { WINPR_ASSERT(arrayList); if (arrayList->synchronized) diff --git a/winpr/libwinpr/utils/trio/trio.c b/winpr/libwinpr/utils/trio/trio.c index e4ceb6337..00d1a2c76 100644 --- a/winpr/libwinpr/utils/trio/trio.c +++ b/winpr/libwinpr/utils/trio/trio.c @@ -4732,8 +4732,8 @@ TRIO_PUBLIC int trio_asprintfv TRIO_ARGS3((result, format, args), char** result, /** Register new user-defined specifier. - @param callback - @param name + @param callback a function to call + @param name a name for the specifier @return Handle. */ TRIO_PUBLIC trio_pointer_t trio_register TRIO_ARGS2((callback, name), trio_callback_t callback,