vcpkg/ports/abseil/fix-uwp-build.patch
nicole mazzuca f9e78dcc68
[abseil] Add uwp support (#10301)
* [abseil] Add uwp support

* [abseil] Drop support with arm/arm64

* [opencensus-cpp] Add keyword supports

* update baseline

* [abseil] Enable arm support
2020-03-05 16:01:57 -08:00

67 lines
2.0 KiB
Diff

diff --git a/absl/base/internal/sysinfo.cc b/absl/base/internal/sysinfo.cc
index a0930e9..2ec5793 100644
--- a/absl/base/internal/sysinfo.cc
+++ b/absl/base/internal/sysinfo.cc
@@ -72,6 +72,12 @@ static int GetNumCPUs() {
#if defined(_WIN32)
static double GetNominalCPUFrequency() {
+// UWP apps don't have access to the registry and currently don't provide an
+// API informing about CPU nominal frequency.
+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && \
+ !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
+ return 1.0;
+#else
#pragma comment(lib, "advapi32.lib") // For Reg* functions.
HKEY key;
// Use the Reg* functions rather than the SH functions because shlwapi.dll
@@ -91,6 +97,7 @@ static double GetNominalCPUFrequency() {
}
}
return 1.0;
+#endif // WINAPI_PARTITION_APP && !WINAPI_PARTITION_DESKTOP
}
#elif defined(CTL_HW) && defined(HW_CPU_FREQ)
diff --git a/absl/debugging/symbolize_win32.inc b/absl/debugging/symbolize_win32.inc
index c3df46f..d324fc1 100644
--- a/absl/debugging/symbolize_win32.inc
+++ b/absl/debugging/symbolize_win32.inc
@@ -36,6 +36,11 @@ ABSL_NAMESPACE_BEGIN
static HANDLE process = NULL;
void InitializeSymbolizer(const char*) {
+// UWP doesn't support this function
+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && \
+ !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
+ return;
+#else
if (process != nullptr) {
return;
}
@@ -52,9 +57,16 @@ void InitializeSymbolizer(const char*) {
const unsigned long long error{GetLastError()}; // NOLINT(runtime/int)
ABSL_RAW_LOG(FATAL, "SymInitialize() failed: %llu", error);
}
+#endif
}
bool Symbolize(const void* pc, char* out, int out_size) {
+
+// UWP doesn't support this function
+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && \
+ !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
+ return false;
+#else
if (out_size <= 0) {
return false;
}
@@ -75,6 +87,7 @@ bool Symbolize(const void* pc, char* out, int out_size) {
out[out_size - 1] = '\0';
}
return true;
+#endif
}
ABSL_NAMESPACE_END