From f03e720727b0430f81fa611086bdd4ba1de8dcf1 Mon Sep 17 00:00:00 2001 From: smk2007 Date: Wed, 5 Feb 2020 16:19:10 -0800 Subject: [PATCH] Disable _tlgPragmaUtf8Begin and _tlgPragmaUtf8End as well. (#2977) --- .../core/platform/windows/logging/etw_sink.cc | 19 ++++++++++++++++++- .../core/platform/windows/telemetry.cc | 17 ++++++++++++++++- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/onnxruntime/core/platform/windows/logging/etw_sink.cc b/onnxruntime/core/platform/windows/logging/etw_sink.cc index 65dd588025..db29235599 100644 --- a/onnxruntime/core/platform/windows/logging/etw_sink.cc +++ b/onnxruntime/core/platform/windows/logging/etw_sink.cc @@ -23,10 +23,27 @@ #include //See: https://developercommunity.visualstudio.com/content/problem/85934/traceloggingproviderh-is-incompatible-with-utf-8.html +#ifdef _TlgPragmaUtf8Begin #undef _TlgPragmaUtf8Begin -#undef _TlgPragmaUtf8End #define _TlgPragmaUtf8Begin +#endif + +#ifdef _TlgPragmaUtf8End +#undef _TlgPragmaUtf8End #define _TlgPragmaUtf8End +#endif + +// Different versions of TraceLoggingProvider.h contain different macro variable names for the utf8 begin and end, +// and we need to cover the lower case version as well. +#ifdef _tlgPragmaUtf8Begin +#undef _tlgPragmaUtf8Begin +#define _tlgPragmaUtf8Begin +#endif + +#ifdef _tlgPragmaUtf8End +#undef _tlgPragmaUtf8End +#define _tlgPragmaUtf8End +#endif namespace onnxruntime { namespace logging { diff --git a/onnxruntime/core/platform/windows/telemetry.cc b/onnxruntime/core/platform/windows/telemetry.cc index 23092bbf21..b92ab3a695 100644 --- a/onnxruntime/core/platform/windows/telemetry.cc +++ b/onnxruntime/core/platform/windows/telemetry.cc @@ -21,11 +21,26 @@ //https://developercommunity.visualstudio.com/content/problem/85934/traceloggingproviderh-is-incompatible-with-utf-8.html #ifdef _TlgPragmaUtf8Begin #undef _TlgPragmaUtf8Begin -#undef _TlgPragmaUtf8End #define _TlgPragmaUtf8Begin +#endif + +#ifdef _TlgPragmaUtf8End +#undef _TlgPragmaUtf8End #define _TlgPragmaUtf8End #endif +// Different versions of TraceLoggingProvider.h contain different macro variable names for the utf8 begin and end, +// and we need to cover the lower case version as well. +#ifdef _tlgPragmaUtf8Begin +#undef _tlgPragmaUtf8Begin +#define _tlgPragmaUtf8Begin +#endif + +#ifdef _tlgPragmaUtf8End +#undef _tlgPragmaUtf8End +#define _tlgPragmaUtf8End +#endif + namespace onnxruntime { namespace {