Get rid of _FX_OS_.
Use build/build_config.h to standarize on Chromium's platform defines,
except for _FX_OS_WASM_, which is replaced with __wasm__.
Change-Id: I80b97d3c54583ca79f7cfa0b699fdee70cd7769a
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/53790
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fxcrt/cfx_datetime.cpp b/core/fxcrt/cfx_datetime.cpp
index d6450fc..56c6609 100644
--- a/core/fxcrt/cfx_datetime.cpp
+++ b/core/fxcrt/cfx_datetime.cpp
@@ -9,8 +9,8 @@
#include "build/build_config.h"
#include "core/fxcrt/fx_system.h"
-#if _FX_OS_ == _FX_OS_LINUX_ || defined(OS_ANDROID) || defined(OS_MACOSX) || \
- _FX_OS_ == _FX_OS_WASM_
+#if defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_MACOSX) || \
+ defined(OS_ASMJS) || defined(__wasm__)
#include <sys/time.h>
#include <time.h>
#endif
diff --git a/core/fxcrt/fx_system.h b/core/fxcrt/fx_system.h
index 47084b8..34c3960 100644
--- a/core/fxcrt/fx_system.h
+++ b/core/fxcrt/fx_system.h
@@ -17,46 +17,28 @@
#include <string.h>
#include <wchar.h>
-// _FX_OS_ values:
-#define _FX_OS_WIN32_ 1
-#define _FX_OS_WIN64_ 2
-#define _FX_OS_LINUX_ 4
-#define _FX_OS_MACOSX_ 7
-#define _FX_OS_WASM_ 13
-
// _FX_PLATFORM_ values;
-#define _FX_PLATFORM_WINDOWS_ 1 // _FX_OS_WIN32_ or _FX_OS_WIN64_.
-#define _FX_PLATFORM_LINUX_ 2 // _FX_OS_LINUX_ or _FX_OS_WASM_.
-#define _FX_PLATFORM_APPLE_ 3 // _FX_OS_MACOSX_ always.
+#define _FX_PLATFORM_WINDOWS_ 1
+#define _FX_PLATFORM_LINUX_ 2
+#define _FX_PLATFORM_APPLE_ 3
-#ifndef _FX_OS_
#if defined(_WIN32)
-#define _FX_OS_ _FX_OS_WIN32_
#define _FX_PLATFORM_ _FX_PLATFORM_WINDOWS_
#elif defined(_WIN64)
-#define _FX_OS_ _FX_OS_WIN64_
#define _FX_PLATFORM_ _FX_PLATFORM_WINDOWS_
#elif defined(__linux__)
-#define _FX_OS_ _FX_OS_LINUX_
#define _FX_PLATFORM_ _FX_PLATFORM_LINUX_
#elif defined(__APPLE__)
-#define _FX_OS_ _FX_OS_MACOSX_
#define _FX_PLATFORM_ _FX_PLATFORM_APPLE_
#elif defined(__asmjs__) || defined(__wasm__)
-#define _FX_OS_ _FX_OS_WASM_
#define _FX_PLATFORM_ _FX_PLATFORM_LINUX_
#endif
-#endif // _FX_OS_
-
-#if !defined(_FX_OS_) || _FX_OS_ == 0
-#error Sorry, can not figure out target OS. Please specify _FX_OS_ macro.
-#endif
#if defined(_MSC_VER) && _MSC_VER < 1900
#error Sorry, VC++ 2015 or later is required to compile PDFium.
#endif // defined(_MSC_VER) && _MSC_VER < 1900
-#if _FX_OS_ == _FX_OS_WASM_ && defined(PDF_ENABLE_V8)
+#if defined(__wasm__) && defined(PDF_ENABLE_V8)
#error Cannot compile v8 with wasm.
#endif // PDF_ENABLE_V8
diff --git a/xfa/fwl/cfwl_notedriver.cpp b/xfa/fwl/cfwl_notedriver.cpp
index 0d54a20..b074fc9 100644
--- a/xfa/fwl/cfwl_notedriver.cpp
+++ b/xfa/fwl/cfwl_notedriver.cpp
@@ -83,14 +83,14 @@
}
void CFWL_NoteDriver::Run() {
-#if _FX_OS_ == _FX_OS_LINUX_ || defined(OS_WIN)
+#if defined(OS_LINUX) || defined(OS_WIN)
for (;;) {
CFWL_NoteLoop* pTopLoop = GetTopLoop();
if (!pTopLoop || !pTopLoop->ContinueModal())
break;
UnqueueMessageAndProcess(pTopLoop);
}
-#endif // _FX_OS_ == _FX_OS_LINUX_ || defined(OS_WIN)
+#endif // defined(OS_LINUX) || defined(OS_WIN)
}
void CFWL_NoteDriver::NotifyTargetHide(CFWL_Widget* pNoteTarget) {