Skip to content

Commit 33587e9

Browse files
committed
TraceLoggingProvider: Disable for MinGW builds
There are no `TraceLoggerProvider.h` or `winmeta.h` headers in MinGW w32api package, so just disable the support for TraceLoggerProvider interfaces. Signed-off-by: Pavel Solodovnikov <pavel.al.solodovnikov@gmail.com>
1 parent 725e273 commit 33587e9

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

src/public/tier0/valve_tracelogging.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,13 @@
8282
#include <windows.h>
8383
//#include <ShlObj.h>
8484
//#include <winsock2.h>
85-
#include <winmeta.h>
85+
86+
// TraceLoggingProvider-related header files are not available in MinGW builds, so disable it.
87+
#if defined(_WIN32) && (defined(__MINGW32__) || defined(__MINGW64__))
88+
#define VALVE_DISABLE_TRACELOGGING
89+
#else
90+
#include <winmeta.h>
91+
#endif
8692

8793
#ifdef VALVE_DISABLE_TRACELOGGING
8894
#define IsTraceLoggingEnabled() false

src/steamnetworkingsockets/clientlib/steamnetworkingsockets_lowlevel.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ namespace SteamNetworkingSocketsLib {
7878

7979
inline void ETW_LongOp( const char *opName, SteamNetworkingMicroseconds usec, const char *pszInfo )
8080
{
81+
#if IsTraceLoggingEnabled()
8182
if ( !pszInfo )
8283
pszInfo = "";
8384
TraceLoggingWrite(
@@ -87,6 +88,11 @@ inline void ETW_LongOp( const char *opName, SteamNetworkingMicroseconds usec, co
8788
TraceLoggingUInt64( usec, "Microseconds" ),
8889
TraceLoggingString( pszInfo, "ExtraInfo" )
8990
);
91+
#else
92+
(void)opName;
93+
(void)usec;
94+
(void)pszInfo;
95+
#endif
9096
}
9197

9298
constexpr int k_msMaxPollWait = 1000;
@@ -4513,6 +4519,7 @@ STEAMNETWORKINGSOCKETS_INTERFACE void SteamNetworkingSockets_DefaultPreFormatDeb
45134519
// Gah, some, but not all, of our code has newlines on the end
45144520
V_StripTrailingWhitespaceASCII( buf );
45154521

4522+
#if IsTraceLoggingEnabled()
45164523
// Emit an ETW event. Unfortunately, TraceLoggingLevel requires a constant argument
45174524
if ( IsTraceLoggingProviderEnabled( HTraceLogging_SteamNetworkingSockets ) )
45184525
{
@@ -4553,6 +4560,7 @@ STEAMNETWORKINGSOCKETS_INTERFACE void SteamNetworkingSockets_DefaultPreFormatDeb
45534560
);
45544561
}
45554562
}
4563+
#endif // IsTraceLoggingEnabled()
45564564

45574565
// Spew to log file?
45584566
#ifdef STEAMNETWORKINGSOCKETS_ENABLE_SYSTEMSPEW

0 commit comments

Comments
 (0)