diff --git a/src/mono/configure.ac b/src/mono/configure.ac
index 72abca2bbf3652..13d7df9c64f495 100644
--- a/src/mono/configure.ac
+++ b/src/mono/configure.ac
@@ -888,7 +888,7 @@ AC_ARG_ENABLE(visibility-hidden,
WARN=''
if test x"$GCC" = xyes; then
WARN='-Wall -Wunused -Wmissing-declarations -Wpointer-arith -Wno-cast-qual -Wwrite-strings -Wno-switch -Wno-switch-enum -Wno-unused-value -Wno-attributes'
- CFLAGS="$CFLAGS -Wmissing-prototypes -Wstrict-prototypes -Wnested-externs -Wno-format-zero-length"
+ CFLAGS="$CFLAGS -Wmissing-prototypes -Wstrict-prototypes -Wnested-externs -Wno-format-zero-length -Wc++-compat"
# We require C99 with some GNU extensions, e.g. `linux` macro
CFLAGS="$CFLAGS -std=gnu99"
diff --git a/src/mono/mono.proj b/src/mono/mono.proj
index a11853b47c527b..d0107b4a4c9e66 100644
--- a/src/mono/mono.proj
+++ b/src/mono/mono.proj
@@ -693,6 +693,11 @@
<_MonoCXXFLAGS Include="-Wl,--build-id=sha1" />
+
+
+ <_MonoConfigureParams Include="--enable-werror" />
+
+
<_MonoConfigureParams Include="--host=$(_MonoTuple)" />
<_MonoConfigureParams Include="--target=$(_MonoTuple)" />
diff --git a/src/mono/mono/metadata/w32socket-internals.h b/src/mono/mono/metadata/w32socket-internals.h
index 6cdb94063b17c3..0fe5209c321d5e 100644
--- a/src/mono/mono/metadata/w32socket-internals.h
+++ b/src/mono/mono/metadata/w32socket-internals.h
@@ -64,7 +64,7 @@ SOCKET
mono_w32socket_accept (SOCKET s, struct sockaddr *addr, socklen_t *addrlen, gboolean blocking);
int
-mono_w32socket_connect (SOCKET s, const struct sockaddr *name, int namelen, gboolean blocking);
+mono_w32socket_connect (SOCKET s, const struct sockaddr *name, socklen_t namelen, gboolean blocking);
int
mono_w32socket_recv (SOCKET s, char *buf, int len, int flags, gboolean blocking);
diff --git a/src/mono/mono/metadata/w32socket-unix.c b/src/mono/mono/metadata/w32socket-unix.c
index ac3bd0f85ff2a1..f5803a42a40b3f 100644
--- a/src/mono/mono/metadata/w32socket-unix.c
+++ b/src/mono/mono/metadata/w32socket-unix.c
@@ -191,7 +191,7 @@ mono_w32socket_accept (SOCKET sock, struct sockaddr *addr, socklen_t *addrlen, g
}
int
-mono_w32socket_connect (SOCKET sock, const struct sockaddr *addr, int addrlen, gboolean blocking)
+mono_w32socket_connect (SOCKET sock, const struct sockaddr *addr, socklen_t addrlen, gboolean blocking)
{
SocketHandle *sockethandle;
gint ret;
diff --git a/src/mono/mono/mini/helpers.c b/src/mono/mono/mini/helpers.c
index b62361ed532a15..0a7b0d9b43373b 100644
--- a/src/mono/mono/mini/helpers.c
+++ b/src/mono/mono/mini/helpers.c
@@ -124,10 +124,8 @@ mono_disassemble_code (MonoCompile *cfg, guint8 *code, int size, char *id)
#ifdef HOST_WIN32
const char *tmp = g_get_tmp_dir ();
#endif
- char *objdump_args = g_getenv ("MONO_OBJDUMP_ARGS");
char *as_file;
char *o_file;
- char *cmd;
int unused G_GNUC_UNUSED;
#ifdef HOST_WIN32
@@ -255,9 +253,10 @@ mono_disassemble_code (MonoCompile *cfg, guint8 *code, int size, char *id)
#endif
#ifdef HAVE_SYSTEM
- cmd = g_strdup_printf (ARCH_PREFIX AS_CMD " %s -o %s", as_file, o_file);
+ char *cmd = g_strdup_printf (ARCH_PREFIX AS_CMD " %s -o %s", as_file, o_file);
unused = system (cmd);
g_free (cmd);
+ char *objdump_args = g_getenv ("MONO_OBJDUMP_ARGS");
if (!objdump_args)
objdump_args = g_strdup ("");
diff --git a/src/mono/mono/mini/simd-intrinsics-netcore.c b/src/mono/mono/mini/simd-intrinsics-netcore.c
index ab9b3c6b290333..3888ea3bf1d557 100644
--- a/src/mono/mono/mini/simd-intrinsics-netcore.c
+++ b/src/mono/mono/mini/simd-intrinsics-netcore.c
@@ -28,6 +28,7 @@ mono_simd_intrinsics_init (void)
#include "mono/utils/bsearch.h"
#include
#include
+#include
#if defined (MONO_ARCH_SIMD_INTRINSICS) && defined(ENABLE_NETCORE)
@@ -2177,13 +2178,10 @@ MONO_EMPTY_SOURCE_FILE (simd_intrinsics_netcore);
#if defined(ENABLE_NETCORE) && defined(TARGET_AMD64)
-gboolean
-mono_cpuidex (int id, int sub_id, int *p_eax, int *p_ebx, int *p_ecx, int *p_edx);
-
void
ves_icall_System_Runtime_Intrinsics_X86_X86Base___cpuidex (int abcd[4], int function_id, int subfunction_id)
{
- mono_cpuidex (function_id, subfunction_id,
+ mono_hwcap_x86_call_cpuidex (function_id, subfunction_id,
&abcd [0], &abcd [1], &abcd [2], &abcd [3]);
}
#endif
diff --git a/src/mono/mono/utils/mono-hwcap-vars.h b/src/mono/mono/utils/mono-hwcap-vars.h
index b408568c729f4d..2c60a6441394db 100644
--- a/src/mono/mono/utils/mono-hwcap-vars.h
+++ b/src/mono/mono/utils/mono-hwcap-vars.h
@@ -81,4 +81,7 @@ MONO_HWCAP_VAR(x86_has_lzcnt)
MONO_HWCAP_VAR(x86_has_popcnt)
MONO_HWCAP_VAR(x86_has_avx)
+gboolean
+mono_hwcap_x86_call_cpuidex (int id, int sub_id, int *p_eax, int *p_ebx, int *p_ecx, int *p_edx);
+
#endif
diff --git a/src/mono/mono/utils/mono-hwcap-x86.c b/src/mono/mono/utils/mono-hwcap-x86.c
index f1949f5a8dc439..40bf6d37fe7856 100644
--- a/src/mono/mono/utils/mono-hwcap-x86.c
+++ b/src/mono/mono/utils/mono-hwcap-x86.c
@@ -30,7 +30,7 @@
#endif
gboolean
-mono_cpuidex (int id, int sub_id, int *p_eax, int *p_ebx, int *p_ecx, int *p_edx)
+mono_hwcap_x86_call_cpuidex (int id, int sub_id, int *p_eax, int *p_ebx, int *p_ecx, int *p_edx)
{
#if defined(_MSC_VER)
int info [4];
@@ -111,7 +111,7 @@ mono_hwcap_arch_init (void)
{
int eax, ebx, ecx, edx;
- if (mono_cpuidex (1, 0, &eax, &ebx, &ecx, &edx)) {
+ if (mono_hwcap_x86_call_cpuidex (1, 0, &eax, &ebx, &ecx, &edx)) {
if (edx & (1 << 15)) {
mono_hwcap_x86_has_cmov = TRUE;
@@ -144,16 +144,16 @@ mono_hwcap_arch_init (void)
mono_hwcap_x86_has_avx = TRUE;
}
- if (mono_cpuidex (0x80000000, 0, &eax, &ebx, &ecx, &edx)) {
+ if (mono_hwcap_x86_call_cpuidex (0x80000000, 0, &eax, &ebx, &ecx, &edx)) {
if ((unsigned int) eax >= 0x80000001 && ebx == 0x68747541 && ecx == 0x444D4163 && edx == 0x69746E65) {
- if (mono_cpuidex (0x80000001, 0, &eax, &ebx, &ecx, &edx)) {
+ if (mono_hwcap_x86_call_cpuidex (0x80000001, 0, &eax, &ebx, &ecx, &edx)) {
if (ecx & (1 << 6))
mono_hwcap_x86_has_sse4a = TRUE;
}
}
}
- if (mono_cpuidex (0x80000001, 0, &eax, &ebx, &ecx, &edx)) {
+ if (mono_hwcap_x86_call_cpuidex (0x80000001, 0, &eax, &ebx, &ecx, &edx)) {
if (ecx & (1 << 5))
mono_hwcap_x86_has_lzcnt = TRUE;
}