Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/mono/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -502,13 +502,14 @@ if(GCC)
set(WARNINGS "-Wall -Wunused -Wmissing-declarations -Wpointer-arith -Wno-cast-qual -Wwrite-strings -Wno-switch -Wno-switch-enum -Wno-unused-value -Wno-attributes -Wno-format-zero-length -Wno-unused-function")
set(WARNINGS_C "-Wmissing-prototypes -Wstrict-prototypes -Wnested-externs")

set(WERROR "-Werror=return-type")
set(WERROR_C "-Werror=implicit-function-declaration")

if (CMAKE_C_COMPILER_ID MATCHES "Clang")
set(WARNINGS "${WARNINGS} -Qunused-arguments -Wno-tautological-compare -Wno-parentheses-equality -Wno-self-assign -Wno-return-stack-address -Wno-constant-logical-operand -Wno-zero-length-array -Wno-asm-operand-widths")
append("-Werror=shorten-64-to-32 -Werror=implicit-int-conversion" WERROR)
endif()

set(WERROR "-Werror=return-type")
set(WERROR_C "-Werror=implicit-function-declaration")

check_c_compiler_flag("-Werror=incompatible-pointer-types" WERROR_INCOMPATIBLE_POINTER_TYPES)
if(WERROR_INCOMPATIBLE_POINTER_TYPES)
set(WERROR_C "${WERROR_C} -Werror=incompatible-pointer-types")
Expand Down
1 change: 0 additions & 1 deletion src/mono/cmake/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#pragma warning(disable:4152) // W4: nonstandard extension, function/data pointer conversion in expression
#pragma warning(disable:4201) // W4: nonstandard extension used: nameless struct/union
#pragma warning(disable:4210) // W4: nonstandard extension used: function given file scope
#pragma warning(disable:4244) // W2: integer conversion, possible loss of data
#pragma warning(disable:4245) // W4: signed/unsigned mismatch
#pragma warning(disable:4389) // W4: signed/unsigned mismatch
#pragma warning(disable:4505) // W4: unreferenced function with internal linkage has been removed
Expand Down
6 changes: 6 additions & 0 deletions src/mono/dlls/dbgshim/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ include(${CLR_ENG_NATIVE_DIR}/configurecompiler.cmake)

add_definitions(-D_WIN32_WINNT=0x0602)

if (CLR_CMAKE_HOST_UNIX)
if (CMAKE_C_COMPILER_ID MATCHES "Clang")
append("-Wno-shorten-64-to-32 -Wno-implicit-int-conversion" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
endif()
endif()

include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/../../..
${PROJECT_SOURCE_DIR}/../../
Expand Down
6 changes: 6 additions & 0 deletions src/mono/dlls/mscordbi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ endif()

add_definitions(-DDBI_COMPONENT_MONO)

if (CLR_CMAKE_HOST_UNIX)
if (CMAKE_C_COMPILER_ID MATCHES "Clang")
append("-Wno-shorten-64-to-32 -Wno-implicit-int-conversion" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
endif()
endif()

include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/../../..
${PROJECT_SOURCE_DIR}/../../
Expand Down
8 changes: 4 additions & 4 deletions src/mono/mono/arch/arm64/arm64-codegen.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ arm_is_bl_disp (void *code, void *target)
static G_GNUC_UNUSED inline unsigned int
arm_get_disp (void *p, void *target)
{
unsigned int disp = ((char*)target - (char*)p) / 4;
unsigned int disp = (unsigned int) ((char*)target - (char*)p) / 4;
Copy link
Member

@lateralusX lateralusX Jun 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GPTRDIFF_TO_UINT? Several occurrences through the file.


if (target)
g_assert (arm_is_bl_disp (p, target));
Expand All @@ -188,15 +188,15 @@ arm_get_disp (void *p, void *target)
static G_GNUC_UNUSED inline gboolean
arm_is_disp19 (void *code, void *target)
{
gint64 disp = ((char*)(target) - (char*)(code)) / 4;
gint64 disp = (unsigned int) (((char*)(target) - (char*)(code)) / 4);

return (disp > -(1 << 18)) && (disp < (1 << 18));
}

static G_GNUC_UNUSED inline unsigned int
arm_get_disp19 (void *p, void *target)
{
unsigned int disp = ((char*)target - (char*)p) / 4;
unsigned int disp = (unsigned int) (((char*)target - (char*)p) / 4);

if (target)
g_assert (arm_is_disp19 (p, target));
Expand Down Expand Up @@ -224,7 +224,7 @@ arm_get_disp19 (void *p, void *target)
static G_GNUC_UNUSED inline unsigned int
arm_get_disp15 (void *p, void *target)
{
unsigned int disp = ((char*)target - (char*)p) / 4;
unsigned int disp = (unsigned int) (((char*)target - (char*)p) / 4);
return (disp & 0x7fff);
}

Expand Down
6 changes: 3 additions & 3 deletions src/mono/mono/component/debugger-agent.c
Original file line number Diff line number Diff line change
Expand Up @@ -931,7 +931,7 @@ socket_transport_recv (void *buf, int len)

do {
again:
res = recv (fd, (char *) buf + total, len - total, flags);
res = (int)recv (fd, (char *) buf + total, len - total, flags);
if (res > 0)
total += res;
if (agent_config.keepalive) {
Expand Down Expand Up @@ -997,7 +997,7 @@ socket_transport_send (void *data, int len)
MONO_REQ_GC_SAFE_MODE;

do {
res = send (conn_fd, (const char*)data, len, 0);
res = (int) send (conn_fd, (const char*)data, len, 0);
} while (res == SOCKET_ERROR && get_last_sock_error () == MONO_EINTR);

if (res != len)
Expand Down Expand Up @@ -3561,7 +3561,7 @@ process_event (EventKind event, gpointer arg, gint32 il_offset, MonoContext *ctx
buffer_add_int (&buf, nevents);

for (l = events; l; l = l->next) {
buffer_add_byte (&buf, event); // event kind
buffer_add_byte (&buf, GINT_TO_UINT8 (event)); // event kind
buffer_add_int (&buf, GPOINTER_TO_INT (l->data)); // request id

ecount ++;
Expand Down
2 changes: 1 addition & 1 deletion src/mono/mono/eglib/gdir-unix.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ g_mkdir_with_parents (const gchar *pathname, int mode)
if (*d == '/' || *d == '\0') {
char orig = *d;
*d = '\0';
rv = mkdir (path, mode);
rv = mkdir (path, (mode_t)mode);
if (rv == -1 && errno != EEXIST) {
g_free (path);
return -1;
Expand Down
2 changes: 1 addition & 1 deletion src/mono/mono/eglib/gfile-posix.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ g_file_get_contents (const gchar *filename, gchar **contents, gsize *length, GEr
str = g_malloc (st.st_size + 1);
offset = 0;
do {
nread = read (fd, str + offset, st.st_size - offset);
nread = GSSIZE_TO_INT (read (fd, str + offset, st.st_size - offset));
if (nread > 0) {
offset += nread;
}
Expand Down
4 changes: 2 additions & 2 deletions src/mono/mono/eglib/giconv.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ static FORCE_INLINE (uint16_t)
read_uint16_endian (unsigned char *inptr, unsigned endian)
{
if (endian == G_LITTLE_ENDIAN)
return (inptr[1] << 8) | inptr[0];
return (inptr[0] << 8) | inptr[1];
return (uint16_t)((inptr[1] << 8) | inptr[0]);
return (uint16_t)((inptr[0] << 8) | inptr[1]);
}

static FORCE_INLINE (int)
Expand Down
Loading