Skip to content

Commit e6acc97

Browse files
Mono - Add error on warnings (#67926)
* Mono - Add error on warnings * Use standard macro for uint8_t max size.
1 parent c8a1748 commit e6acc97

File tree

5 files changed

+10
-7
lines changed

5 files changed

+10
-7
lines changed

src/mono/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
264264
set(INTERNAL_ZLIB 1)
265265
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>") # statically link VC runtime library
266266
add_compile_options(/W4) # set warning level 4
267+
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/WX>) # treat warnings as errors
267268
add_compile_options(/EHsc) # set exception handling behavior
268269
add_compile_options(/FC) # use full pathnames in diagnostics
269270
add_link_options(/STACK:0x800000) # set stack size to 8MB (default is 1MB)

src/mono/mono/component/debugger-protocol.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,17 @@ static int32_t packet_id = 0;
1414
int
1515
m_dbgprot_buffer_add_command_header (MdbgProtBuffer *data, int command_set, int command, MdbgProtBuffer *out)
1616
{
17+
g_assert (command_set <= UINT8_MAX);
18+
g_assert (command <= UINT8_MAX);
1719
int id = dbg_rt_atomic_inc_int32_t ((volatile int32_t *)&packet_id);
1820

1921
uint32_t len = (uint32_t)(data->p - data->buf + HEADER_LENGTH);
2022
m_dbgprot_buffer_init (out, len);
2123
m_dbgprot_buffer_add_int (out, len);
2224
m_dbgprot_buffer_add_int (out, id);
2325
m_dbgprot_buffer_add_byte (out, 0); /* flags */
24-
m_dbgprot_buffer_add_byte (out, command_set);
25-
m_dbgprot_buffer_add_byte (out, command);
26+
m_dbgprot_buffer_add_byte (out, (uint8_t)command_set);
27+
m_dbgprot_buffer_add_byte (out, (uint8_t)command);
2628
m_dbgprot_buffer_add_data (out, data->buf, (uint32_t) (data->p - data->buf));
2729
return id;
2830
}

src/mono/mono/metadata/object-internals.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ mono_array_handle_length (MonoArrayHandle arr)
241241
// in order to mimic non-_internal but without the GC mode transitions, or at least,
242242
// to avoid the runtime using the embedding API, whether or not it has GC mode transitions.
243243
static inline char*
244-
mono_array_addr_with_size_internal (MonoArray *array, int size, uintptr_t idx)
244+
mono_array_addr_with_size_internal (MonoArray *array, size_t size, uintptr_t idx)
245245
{
246246
return mono_array_addr_with_size_fast (array, size, idx);
247247
}

src/mono/mono/metadata/sysmath.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ ves_icall_System_MathF_Asinh (float x)
214214
float
215215
ves_icall_System_MathF_Atan (float x)
216216
{
217-
return atan (x);
217+
return atanf (x);
218218
}
219219

220220
float
@@ -292,7 +292,7 @@ ves_icall_System_MathF_Sin (float x)
292292
float
293293
ves_icall_System_MathF_Sinh (float x)
294294
{
295-
return sinh (x);
295+
return sinhf (x);
296296
}
297297

298298
float
@@ -310,7 +310,7 @@ ves_icall_System_MathF_Tan (float x)
310310
float
311311
ves_icall_System_MathF_Tanh (float x)
312312
{
313-
return tanh (x);
313+
return tanhf (x);
314314
}
315315

316316
float

src/mono/mono/mini/mini-amd64.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8108,7 +8108,7 @@ mono_arch_emit_epilog (MonoCompile *cfg)
81088108
for (i = 0; i < AMD64_NREG; ++i) {
81098109
if (AMD64_IS_CALLEE_SAVED_REG (i) && (cfg->arch.saved_iregs & (1 << i))) {
81108110
/* Restore only used_int_regs, not arch.saved_iregs */
8111-
int restore_reg = (cfg->used_int_regs & (1 << i));
8111+
size_t restore_reg = (cfg->used_int_regs & (size_t)(1 << i));
81128112
if (restore_reg) {
81138113
amd64_mov_reg_membase (code, i, cfg->frame_reg, save_area_offset, 8);
81148114
mono_emit_unwind_op_same_value (cfg, code, i);

0 commit comments

Comments
 (0)