Переглянути джерело

Fix build error for deprecated function in UCRT. (#5162)

* Fix build error for deprecated function in UCRT.

This is for enable-lit by default.
gtest got link error for missing dup/dup2/close/creat.

* Update comment.

* Mark HLSL Change.
Xiang Li 2 роки тому
батько
коміт
947861e2c0
1 змінених файлів з 11 додано та 0 видалено
  1. 11 0
      utils/unittest/googletest/src/gtest-all.cc

+ 11 - 0
utils/unittest/googletest/src/gtest-all.cc

@@ -38,6 +38,17 @@
 // when it's fused.
 #include "gtest/gtest.h"
 
+// HLSL Change Begin.
+// Alias deprecated functions for UCRT due to these obsolete function have been
+// removed in the newer UCRT libraries.
+#ifdef _UCRT
+#define close _close
+#define creat _creat
+#define dup2  _dup2
+#define dup   _dup
+#endif
+// HLSL Change End.
+
 // The following lines pull in the real gtest *.cc files.
 #include "src/gtest.cc"
 #include "src/gtest-death-test.cc"