Remove unneeded include from SkFloatingPoint.h.
The _POSIX_VERSION check was initially added in
https://skia.googlesource.com/skia/+/d3fbd34099, and its usage was
removed in https://skia.googlesource.com/skia/+/d7dc76f7e9. Since that's
long gone, remove the include associated with that. Then do IWYU to fix
the build.
Change-Id: Ic256d64a2e02bd8ada03513bb04b0e733576c474
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/482256
Auto-Submit: Lei Zhang <thestig@chromium.org>
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Herb Derby <herb@google.com>
diff --git a/include/private/SkFloatingPoint.h b/include/private/SkFloatingPoint.h
index 241d9f2..fbabd0e 100644
--- a/include/private/SkFloatingPoint.h
+++ b/include/private/SkFloatingPoint.h
@@ -26,11 +26,6 @@
#endif
#endif
-// For _POSIX_VERSION
-#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
-#include <unistd.h>
-#endif
-
constexpr float SK_FloatSqrt2 = 1.41421356f;
constexpr float SK_FloatPI = 3.14159265f;
constexpr double SK_DoublePI = 3.14159265358979323846264338327950288;
diff --git a/src/core/SkVM.cpp b/src/core/SkVM.cpp
index efe4df6..553fd0e 100644
--- a/src/core/SkVM.cpp
+++ b/src/core/SkVM.cpp
@@ -36,6 +36,10 @@
#endif
#endif
+#if !defined(SK_BUILD_FOR_WIN)
+#include <unistd.h>
+#endif
+
// #define SKVM_LLVM_WAIT_FOR_COMPILATION
bool gSkVMAllowJIT{false};
diff --git a/src/ports/SkOSFile_posix.cpp b/src/ports/SkOSFile_posix.cpp
index fa5987c..a76be4f 100644
--- a/src/ports/SkOSFile_posix.cpp
+++ b/src/ports/SkOSFile_posix.cpp
@@ -24,6 +24,13 @@
#include "src/ports/SkOSFile_ios.h"
#endif
+void sk_fsync(FILE* f) {
+#if !defined(SK_BUILD_FOR_ANDROID) && !defined(__UCLIBC__) && !defined(_NEWLIB_VERSION)
+ int fd = fileno(f);
+ fsync(fd);
+#endif
+}
+
bool sk_exists(const char *path, SkFILE_Flags flags) {
int mode = F_OK;
if (flags & kRead_SkFILE_Flag) {
diff --git a/src/ports/SkOSFile_stdio.cpp b/src/ports/SkOSFile_stdio.cpp
index fe2b749..4e0bb98 100644
--- a/src/ports/SkOSFile_stdio.cpp
+++ b/src/ports/SkOSFile_stdio.cpp
@@ -12,10 +12,6 @@
#include <stdio.h>
#include <sys/stat.h>
-#ifdef SK_BUILD_FOR_UNIX
-#include <unistd.h>
-#endif
-
#ifdef _WIN32
#include <direct.h>
#include <io.h>
@@ -128,14 +124,6 @@
fflush(f);
}
-void sk_fsync(FILE* f) {
-#if !defined(_WIN32) && !defined(SK_BUILD_FOR_ANDROID) && !defined(__UCLIBC__) \
- && !defined(_NEWLIB_VERSION)
- int fd = fileno(f);
- fsync(fd);
-#endif
-}
-
size_t sk_ftell(FILE* f) {
long curr = ftell(f);
if (curr < 0) {
diff --git a/src/ports/SkOSFile_win.cpp b/src/ports/SkOSFile_win.cpp
index 09f727e..2f5fc16 100644
--- a/src/ports/SkOSFile_win.cpp
+++ b/src/ports/SkOSFile_win.cpp
@@ -20,6 +20,10 @@
#include <stdio.h>
#include <sys/stat.h>
+void sk_fsync(FILE* f) {
+ _commit(sk_fileno(f));
+}
+
bool sk_exists(const char *path, SkFILE_Flags flags) {
int mode = 0; // existence
if (flags & kRead_SkFILE_Flag) {