From f8ac26fc7b9e94cb19d45dd2da623046dff22cca Mon Sep 17 00:00:00 2001 From: Mateusz Daniluk <121170681+VeithMetro@users.noreply.github.com> Date: Wed, 20 Nov 2024 13:16:28 +0100 Subject: [PATCH 01/16] Use the warning suppression instead of the variable is not used macro in SystemInfo --- Source/core/SystemInfo.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Source/core/SystemInfo.h b/Source/core/SystemInfo.h index 39301480d..d649bc808 100644 --- a/Source/core/SystemInfo.h +++ b/Source/core/SystemInfo.h @@ -239,8 +239,9 @@ namespace Core { mutable uint64_t m_freeswap; mutable uint64_t m_cpuload; mutable uint64_t m_cpuloadavg[3]; - VARIABLE_IS_NOT_USED mutable time_t m_lastUpdateCpuStats; - +PUSH_WARNING(DISABLE_WARNING_UNUSED_VARIABLES) + mutable time_t m_lastUpdateCpuStats; +POP_WARNING() void UpdateCpuStats() const; void UpdateRealtimeInfo(); From c12d46d1c4065340a53a9f90d42abfdd44251372 Mon Sep 17 00:00:00 2001 From: Mateusz Daniluk <121170681+VeithMetro@users.noreply.github.com> Date: Wed, 20 Nov 2024 13:17:28 +0100 Subject: [PATCH 02/16] Use the warning suppression instead of the variable is not used macro in NetworkInfo --- Source/core/NetworkInfo.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Source/core/NetworkInfo.h b/Source/core/NetworkInfo.h index cd063ca21..ddf5fb053 100644 --- a/Source/core/NetworkInfo.h +++ b/Source/core/NetworkInfo.h @@ -206,7 +206,9 @@ namespace Core { uint32_t Close(); private: - VARIABLE_IS_NOT_USED INotification* _callback; +PUSH_WARNING(DISABLE_WARNING_UNUSED_VARIABLES) + INotification* _callback; +POP_WARNING() }; #if defined(__WINDOWS__) || defined(__APPLE__) From 85fcd2eadccd4c6e057f7d0e36218c3a5a4e5a32 Mon Sep 17 00:00:00 2001 From: Mateusz Daniluk <121170681+VeithMetro@users.noreply.github.com> Date: Wed, 20 Nov 2024 13:29:54 +0100 Subject: [PATCH 03/16] Introduce a new DISABLE_WARNING_UNUSED_PRIVATE_FIELD macro Which is specific to clang --- Source/core/Portability.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Source/core/Portability.h b/Source/core/Portability.h index 65a3fd146..70c693972 100644 --- a/Source/core/Portability.h +++ b/Source/core/Portability.h @@ -195,6 +195,7 @@ #define DISABLE_WARNING_MAYBE_UNINITIALIZED #define DISABLE_WARNING_FREE_NONHEAP_OBJECT #define DISABLE_WARNING_ARRAY_BOUNDS +#define DISABLE_WARNING_UNUSED_PRIVATE_FIELD #else #define DISABLE_WARNING_CONDITIONAL_EXPRESSION_IS_CONSTANT @@ -231,8 +232,10 @@ #if !(defined(__clang__)) && (__GNUC__ >= 4) #define DISABLE_WARNING_STRING_OPERATION_OVERREAD PUSH_WARNING_ARG_("-Wstringop-overread") +#define DISABLE_WARNING_UNUSED_PRIVATE_FIELD #else #define DISABLE_WARNING_STRING_OPERATION_OVERREAD +#define DISABLE_WARNING_UNUSED_PRIVATE_FIELD PUSH_WARNING_ARG_("-Wunused-private-field") #endif #endif From 9d37a8d02f0bd3be4061e31ab080a0a34a6f6403 Mon Sep 17 00:00:00 2001 From: Mateusz Daniluk <121170681+VeithMetro@users.noreply.github.com> Date: Wed, 20 Nov 2024 13:31:30 +0100 Subject: [PATCH 04/16] Change the macro to in NetworkInfo --- Source/core/NetworkInfo.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/core/NetworkInfo.h b/Source/core/NetworkInfo.h index ddf5fb053..b513cc0ec 100644 --- a/Source/core/NetworkInfo.h +++ b/Source/core/NetworkInfo.h @@ -206,7 +206,7 @@ namespace Core { uint32_t Close(); private: -PUSH_WARNING(DISABLE_WARNING_UNUSED_VARIABLES) +PUSH_WARNING(DISABLE_WARNING_UNUSED_PRIVATE_FIELD) INotification* _callback; POP_WARNING() }; From 622c3eb20bb2a0f0df2dc131c5a75ebf8bdc1643 Mon Sep 17 00:00:00 2001 From: Mateusz Daniluk <121170681+VeithMetro@users.noreply.github.com> Date: Wed, 20 Nov 2024 13:31:51 +0100 Subject: [PATCH 05/16] Change the macro in SystemInfo --- Source/core/SystemInfo.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/core/SystemInfo.h b/Source/core/SystemInfo.h index d649bc808..3f0e52f55 100644 --- a/Source/core/SystemInfo.h +++ b/Source/core/SystemInfo.h @@ -239,7 +239,7 @@ namespace Core { mutable uint64_t m_freeswap; mutable uint64_t m_cpuload; mutable uint64_t m_cpuloadavg[3]; -PUSH_WARNING(DISABLE_WARNING_UNUSED_VARIABLES) +PUSH_WARNING(DISABLE_WARNING_UNUSED_PRIVATE_FIELD) mutable time_t m_lastUpdateCpuStats; POP_WARNING() void UpdateCpuStats() const; From bf9c7c2f130dcc395b84f9a8601e88e871a3da79 Mon Sep 17 00:00:00 2001 From: Mateusz Daniluk <121170681+VeithMetro@users.noreply.github.com> Date: Wed, 20 Nov 2024 13:35:17 +0100 Subject: [PATCH 06/16] Change macros in PluginServer --- Source/Thunder/PluginServer.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Source/Thunder/PluginServer.h b/Source/Thunder/PluginServer.h index 9ddc623bb..47b2beba7 100644 --- a/Source/Thunder/PluginServer.h +++ b/Source/Thunder/PluginServer.h @@ -753,7 +753,9 @@ namespace PluginHost { private: bool _isExtended; uint32_t _maxRequests; - VARIABLE_IS_NOT_USED uint8_t _state; +PUSH_WARNING(DISABLE_WARNING_UNUSED_PRIVATE_FIELD) + uint8_t _state; +POP_WARNING() uint8_t _major; uint8_t _minor; uint8_t _patch; @@ -1626,7 +1628,9 @@ namespace PluginHost { } private: - VARIABLE_IS_NOT_USED const mode _mode; +PUSH_WARNING(DISABLE_WARNING_UNUSED_PRIVATE_FIELD) + const mode _mode; +POP_WARNING() mutable Core::CriticalSection _pluginHandling; // The handlers that implement the actual logic behind the service @@ -1646,7 +1650,9 @@ namespace PluginHost { uint32_t _lastId; ControlData _metadata; Core::Library _library; - VARIABLE_IS_NOT_USED void* _hibernateStorage; +PUSH_WARNING(DISABLE_WARNING_UNUSED_PRIVATE_FIELD) + void* _hibernateStorage; +POP_WARNING() ExternalAccess _external; ServiceMap& _administrator; Core::SinkType _composit; From 5f3a871323bc5b0a5c16e5a15e681f3562da79d0 Mon Sep 17 00:00:00 2001 From: Mateusz Daniluk <121170681+VeithMetro@users.noreply.github.com> Date: Wed, 20 Nov 2024 13:41:43 +0100 Subject: [PATCH 07/16] Make sure to define the DISABLE_WARNING_UNUSED_PRIVATE_FIELD macro only for clang --- Source/core/Portability.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Source/core/Portability.h b/Source/core/Portability.h index 70c693972..9872af7d8 100644 --- a/Source/core/Portability.h +++ b/Source/core/Portability.h @@ -230,12 +230,16 @@ #define DISABLE_WARNING_ARRAY_BOUNDS PUSH_WARNING_ARG_("-Warray-bounds") #endif +#if defined(__clang__) +#define DISABLE_WARNING_UNUSED_PRIVATE_FIELD PUSH_WARNING_ARG_("-Wunused-private-field") +#else +#define DISABLE_WARNING_UNUSED_PRIVATE_FIELD +#endif + #if !(defined(__clang__)) && (__GNUC__ >= 4) #define DISABLE_WARNING_STRING_OPERATION_OVERREAD PUSH_WARNING_ARG_("-Wstringop-overread") -#define DISABLE_WARNING_UNUSED_PRIVATE_FIELD #else #define DISABLE_WARNING_STRING_OPERATION_OVERREAD -#define DISABLE_WARNING_UNUSED_PRIVATE_FIELD PUSH_WARNING_ARG_("-Wunused-private-field") #endif #endif From 795bf9921ce1bc6f45067d08e250709620d3d50a Mon Sep 17 00:00:00 2001 From: Mateusz Daniluk <121170681+VeithMetro@users.noreply.github.com> Date: Thu, 21 Nov 2024 11:20:02 +0100 Subject: [PATCH 08/16] Remove unused member variables, declare _hibernateStorage only if hibernate support is enabled --- Source/Thunder/PluginServer.h | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/Source/Thunder/PluginServer.h b/Source/Thunder/PluginServer.h index 47b2beba7..06a371b45 100644 --- a/Source/Thunder/PluginServer.h +++ b/Source/Thunder/PluginServer.h @@ -753,9 +753,6 @@ namespace PluginHost { private: bool _isExtended; uint32_t _maxRequests; -PUSH_WARNING(DISABLE_WARNING_UNUSED_PRIVATE_FIELD) - uint8_t _state; -POP_WARNING() uint8_t _major; uint8_t _minor; uint8_t _patch; @@ -805,9 +802,8 @@ POP_WARNING() Service& operator=(Service&&) = delete; Service& operator=(const Service&) = delete; - Service(const PluginHost::Config& server, const Plugin::Config& plugin, ServiceMap& administrator, const mode type, const Core::ProxyType& handler) + Service(const PluginHost::Config& server, const Plugin::Config& plugin, ServiceMap& administrator, const mode /* type */, const Core::ProxyType& handler) : PluginHost::Service(plugin, server.WebPrefix(), server.PersistentPath(), server.DataPath(), server.VolatilePath()) - , _mode(type) , _pluginHandling() , _handler(nullptr) , _extended(nullptr) @@ -1628,9 +1624,6 @@ POP_WARNING() } private: -PUSH_WARNING(DISABLE_WARNING_UNUSED_PRIVATE_FIELD) - const mode _mode; -POP_WARNING() mutable Core::CriticalSection _pluginHandling; // The handlers that implement the actual logic behind the service @@ -1650,9 +1643,9 @@ POP_WARNING() uint32_t _lastId; ControlData _metadata; Core::Library _library; -PUSH_WARNING(DISABLE_WARNING_UNUSED_PRIVATE_FIELD) +#ifdef HIBERNATE_SUPPORT_ENABLED void* _hibernateStorage; -POP_WARNING() +#endif ExternalAccess _external; ServiceMap& _administrator; Core::SinkType _composit; From 327b70e691587e63bec8ec68d4f72f921d949416 Mon Sep 17 00:00:00 2001 From: Mateusz Daniluk <121170681+VeithMetro@users.noreply.github.com> Date: Thu, 21 Nov 2024 11:21:49 +0100 Subject: [PATCH 09/16] AdapterObserver callback member variable shouldn't be present on Windows and Apple --- Source/core/NetworkInfo.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/core/NetworkInfo.h b/Source/core/NetworkInfo.h index b513cc0ec..683ce67a5 100644 --- a/Source/core/NetworkInfo.h +++ b/Source/core/NetworkInfo.h @@ -206,9 +206,9 @@ namespace Core { uint32_t Close(); private: -PUSH_WARNING(DISABLE_WARNING_UNUSED_PRIVATE_FIELD) +#if !defined(__WINDOWS__) && !defined(__APPLE__) INotification* _callback; -POP_WARNING() +#endif }; #if defined(__WINDOWS__) || defined(__APPLE__) From 9d240607f13aadf2d0a963ab2b09b98b7590572b Mon Sep 17 00:00:00 2001 From: Mateusz Daniluk <121170681+VeithMetro@users.noreply.github.com> Date: Thu, 21 Nov 2024 11:24:24 +0100 Subject: [PATCH 10/16] m_lastUpdateCpuStats is only used on Linux --- Source/core/SystemInfo.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/core/SystemInfo.h b/Source/core/SystemInfo.h index 3f0e52f55..687278512 100644 --- a/Source/core/SystemInfo.h +++ b/Source/core/SystemInfo.h @@ -239,9 +239,9 @@ namespace Core { mutable uint64_t m_freeswap; mutable uint64_t m_cpuload; mutable uint64_t m_cpuloadavg[3]; -PUSH_WARNING(DISABLE_WARNING_UNUSED_PRIVATE_FIELD) +#ifdef __LINUX__ mutable time_t m_lastUpdateCpuStats; -POP_WARNING() +#endif void UpdateCpuStats() const; void UpdateRealtimeInfo(); From 6b53e897add818b908bc3ff02f679abec7b49b85 Mon Sep 17 00:00:00 2001 From: Mateusz Daniluk <121170681+VeithMetro@users.noreply.github.com> Date: Thu, 21 Nov 2024 11:26:41 +0100 Subject: [PATCH 11/16] m_lastUpdateCpuStats should be in the constructor only in case of Linux --- Source/core/SystemInfo.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Source/core/SystemInfo.cpp b/Source/core/SystemInfo.cpp index f4878c46e..ef705eed1 100644 --- a/Source/core/SystemInfo.cpp +++ b/Source/core/SystemInfo.cpp @@ -141,7 +141,9 @@ namespace Core { SystemInfo::SystemInfo() : m_HostName(ConstructHostname()) +#ifdef __LINUX__ , m_lastUpdateCpuStats(0) +#endif { #ifdef __LINUX__ #ifdef __APPLE__ From b0811d3954ac8556c4d959e3d7044540998bbf2d Mon Sep 17 00:00:00 2001 From: Mateusz Daniluk <121170681+VeithMetro@users.noreply.github.com> Date: Thu, 21 Nov 2024 11:27:48 +0100 Subject: [PATCH 12/16] Remove the -Wunused-private-field macro as it is no longer needed --- Source/core/Portability.h | 7 ------- 1 file changed, 7 deletions(-) diff --git a/Source/core/Portability.h b/Source/core/Portability.h index 9872af7d8..65a3fd146 100644 --- a/Source/core/Portability.h +++ b/Source/core/Portability.h @@ -195,7 +195,6 @@ #define DISABLE_WARNING_MAYBE_UNINITIALIZED #define DISABLE_WARNING_FREE_NONHEAP_OBJECT #define DISABLE_WARNING_ARRAY_BOUNDS -#define DISABLE_WARNING_UNUSED_PRIVATE_FIELD #else #define DISABLE_WARNING_CONDITIONAL_EXPRESSION_IS_CONSTANT @@ -230,12 +229,6 @@ #define DISABLE_WARNING_ARRAY_BOUNDS PUSH_WARNING_ARG_("-Warray-bounds") #endif -#if defined(__clang__) -#define DISABLE_WARNING_UNUSED_PRIVATE_FIELD PUSH_WARNING_ARG_("-Wunused-private-field") -#else -#define DISABLE_WARNING_UNUSED_PRIVATE_FIELD -#endif - #if !(defined(__clang__)) && (__GNUC__ >= 4) #define DISABLE_WARNING_STRING_OPERATION_OVERREAD PUSH_WARNING_ARG_("-Wstringop-overread") #else From 287a9a14f048f1f590ed7ed6c8dfd096861a8a74 Mon Sep 17 00:00:00 2001 From: Mateusz Daniluk <121170681+VeithMetro@users.noreply.github.com> Date: Thu, 21 Nov 2024 11:36:27 +0100 Subject: [PATCH 13/16] Make sure not to initliaze callback for Windows and Apple --- Source/core/NetworkInfo.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Source/core/NetworkInfo.cpp b/Source/core/NetworkInfo.cpp index 8127300cd..0f877b626 100644 --- a/Source/core/NetworkInfo.cpp +++ b/Source/core/NetworkInfo.cpp @@ -1863,8 +1863,10 @@ namespace Core { #endif - AdapterObserver::AdapterObserver(INotification* callback) + AdapterObserver::AdapterObserver(INotification* callback VARIABLE_IS_NOT_USED) +#if !defined(__WINDOWS__) && !defined(__APPLE__) : _callback(callback) +#endif { #ifdef __WINDOWS__ //IoWMIOpenBlock(&GUID_NDIS_STATUS_LINK_STATE, WMIGUID_NOTIFICATION, . . .); From 4df8736ce89c18b76bd9fdb319ef79b4bd881a46 Mon Sep 17 00:00:00 2001 From: Mateusz Daniluk <121170681+VeithMetro@users.noreply.github.com> Date: Thu, 21 Nov 2024 11:46:54 +0100 Subject: [PATCH 14/16] Make sure so that m_lastUpdateCpuStats is not defined on Apple but just Linux --- Source/core/SystemInfo.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Source/core/SystemInfo.h b/Source/core/SystemInfo.h index 687278512..4202eff51 100644 --- a/Source/core/SystemInfo.h +++ b/Source/core/SystemInfo.h @@ -239,9 +239,6 @@ namespace Core { mutable uint64_t m_freeswap; mutable uint64_t m_cpuload; mutable uint64_t m_cpuloadavg[3]; -#ifdef __LINUX__ - mutable time_t m_lastUpdateCpuStats; -#endif void UpdateCpuStats() const; void UpdateRealtimeInfo(); @@ -251,6 +248,8 @@ namespace Core { mutable uint64_t m_prevCpuSystemTicks; mutable uint64_t m_prevCpuUserTicks; mutable uint64_t m_prevCpuIdleTicks; +#elif defined(__LINUX__) + mutable time_t m_lastUpdateCpuStats; #endif }; // class SystemInfo } // namespace Core From a77ad742cacf6a7f30d92427c73f9a6d5af3e22f Mon Sep 17 00:00:00 2001 From: Mateusz Daniluk <121170681+VeithMetro@users.noreply.github.com> Date: Thu, 21 Nov 2024 11:48:47 +0100 Subject: [PATCH 15/16] Simplify the conditions for m_lastUpdateCpuStats initialization --- Source/core/SystemInfo.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Source/core/SystemInfo.cpp b/Source/core/SystemInfo.cpp index ef705eed1..e519b8c55 100644 --- a/Source/core/SystemInfo.cpp +++ b/Source/core/SystemInfo.cpp @@ -141,9 +141,6 @@ namespace Core { SystemInfo::SystemInfo() : m_HostName(ConstructHostname()) -#ifdef __LINUX__ - , m_lastUpdateCpuStats(0) -#endif { #ifdef __LINUX__ #ifdef __APPLE__ @@ -173,6 +170,7 @@ namespace Core { m_cpuloadavg[0]=info.loads[0]; m_cpuloadavg[1]=info.loads[1]; m_cpuloadavg[2]=info.loads[2]; + m_lastUpdateCpuStats = 0; #endif #endif From 9d49bdc058662a6d7bac405e63e622e2aba49158 Mon Sep 17 00:00:00 2001 From: Mateusz Daniluk <121170681+VeithMetro@users.noreply.github.com> Date: Thu, 21 Nov 2024 11:51:29 +0100 Subject: [PATCH 16/16] Remove initialization of _state member variable from ControlData --- Source/Thunder/PluginServer.h | 1 - 1 file changed, 1 deletion(-) diff --git a/Source/Thunder/PluginServer.h b/Source/Thunder/PluginServer.h index 06a371b45..9da464f97 100644 --- a/Source/Thunder/PluginServer.h +++ b/Source/Thunder/PluginServer.h @@ -676,7 +676,6 @@ namespace PluginHost { ControlData(const uint32_t maxRequests) : _isExtended(false) , _maxRequests(maxRequests) - , _state(0) , _major(~0) , _minor(~0) , _patch(~0)