Fix more Windows compile errors
- Silence warnings in sky code (unnecessary return)
- Disable some warnings for bison-generated code
- Missing include for htons et al.
- Don't build xdisplaycheck on Windows.
R=jam@chromium.org
Review URL: https://codereview.chromium.org/697183003
diff --git a/BUILD.gn b/BUILD.gn
index bda6162..150cc24 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -9,7 +9,7 @@
"//mojo",
"//sky",
]
- if (!is_android) {
+ if (!is_android && !is_win) {
deps += [ "//tools/xdisplaycheck" ]
}
}
diff --git a/base/win/win_util.cc b/base/win/win_util.cc
index f46242d..3ae42e4 100644
--- a/base/win/win_util.cc
+++ b/base/win/win_util.cc
@@ -119,14 +119,12 @@
static bool g_crash_on_process_detach = false;
-void GetNonClientMetrics(NONCLIENTMETRICS_XP* metrics) {
+void GetNonClientMetrics(NONCLIENTMETRICS* metrics) {
DCHECK(metrics);
metrics->cbSize = sizeof(*metrics);
- const bool success = !!SystemParametersInfo(
- SPI_GETNONCLIENTMETRICS,
- metrics->cbSize,
- reinterpret_cast<NONCLIENTMETRICS*>(metrics),
- 0);
+ const bool success =
+ !!SystemParametersInfo(
+ SPI_GETNONCLIENTMETRICS, metrics->cbSize, metrics, 0);
DCHECK(success);
}
diff --git a/base/win/win_util.h b/base/win/win_util.h
index 8513f62..9439597 100644
--- a/base/win/win_util.h
+++ b/base/win/win_util.h
@@ -33,30 +33,10 @@
struct _tagpropertykey;
typedef _tagpropertykey PROPERTYKEY;
-// This is the same as NONCLIENTMETRICS except that the
-// unused member |iPaddedBorderWidth| has been removed.
-struct NONCLIENTMETRICS_XP {
- UINT cbSize;
- int iBorderWidth;
- int iScrollWidth;
- int iScrollHeight;
- int iCaptionWidth;
- int iCaptionHeight;
- LOGFONTW lfCaptionFont;
- int iSmCaptionWidth;
- int iSmCaptionHeight;
- LOGFONTW lfSmCaptionFont;
- int iMenuWidth;
- int iMenuHeight;
- LOGFONTW lfMenuFont;
- LOGFONTW lfStatusFont;
- LOGFONTW lfMessageFont;
-};
-
namespace base {
namespace win {
-BASE_EXPORT void GetNonClientMetrics(NONCLIENTMETRICS_XP* metrics);
+BASE_EXPORT void GetNonClientMetrics(NONCLIENTMETRICS* metrics);
// Returns the string representing the current user sid.
BASE_EXPORT bool GetUserSidString(std::wstring* user_sid);
diff --git a/sky/engine/BUILD.gn b/sky/engine/BUILD.gn
index 1200619..4f8f0be 100644
--- a/sky/engine/BUILD.gn
+++ b/sky/engine/BUILD.gn
@@ -40,8 +40,11 @@
if (is_win) {
cflags += [
+ "/wd4065", # Switch statement contains 'default' but no 'case' labels.
+ # In generated parser code.
"/wd4305", # Truncation from 'type1' to 'type2'.
"/wd4324", # Struct padded due to declspec(align).
+ "/wd4702", # Unreachable code, happens in bison-generated code.
"/wd4714", # Function marked forceinline not inlined.
"/wd4800", # Value forced to bool.
"/wd4996", # Deprecated function call.
diff --git a/sky/engine/core/dom/Node.cpp b/sky/engine/core/dom/Node.cpp
index bc6f208..2efcb14 100644
--- a/sky/engine/core/dom/Node.cpp
+++ b/sky/engine/core/dom/Node.cpp
@@ -1882,7 +1882,6 @@
case Node::DOCUMENT_NODE:
case Node::DOCUMENT_FRAGMENT_NODE:
return toContainerNode(this)->countChildren();
- return 0;
}
ASSERT_NOT_REACHED();
return 0;
diff --git a/sky/engine/wtf/ByteOrder.h b/sky/engine/wtf/ByteOrder.h
index c437a21..9febf7d 100644
--- a/sky/engine/wtf/ByteOrder.h
+++ b/sky/engine/wtf/ByteOrder.h
@@ -35,4 +35,8 @@
#include <arpa/inet.h>
#endif
+#if OS(WIN)
+#include <winsock2.h>
+#endif
+
#endif // WTF_ByteOrder_h