Skip to content

Commit 6a9245f

Browse files
Reenable 4244 (#68615)
* Remove disable of 4244 in root compiler settings.
1 parent 15d8c86 commit 6a9245f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+226
-194
lines changed

eng/native/configurecompiler.cmake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,6 @@ if (MSVC)
592592
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4201>) # nonstandard extension used : nameless struct/union
593593
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4206>) # nonstandard extension used : translation unit is empty
594594
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4239>) # nonstandard extension used : 'token' : conversion from 'type' to 'type'
595-
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4244>) # conversion from 'type1' to 'type2', possible loss of data
596595
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4245>) # conversion from 'type1' to 'type2', signed/unsigned mismatch
597596
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4291>) # no matching operator delete found; memory will not be freed if initialization throws an exception
598597
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4310>) # cast truncates constant value

src/coreclr/binder/inc/bindertracing.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ namespace BinderTracing
173173
};
174174

175175
// This must match the BindingPathSource value map in ClrEtwAll.man
176-
enum PathSource
176+
enum PathSource : uint16_t
177177
{
178178
ApplicationAssemblies,
179179
Unused,

src/coreclr/debug/daccess/daccess.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4794,7 +4794,7 @@ ClrDataAccess::SetAllCodeNotifications(
47944794
PTR_HOST_TO_TADDR(((ClrDataModule*)mod)->GetModule()) :
47954795
NULL;
47964796

4797-
if (jn.SetAllNotifications(modulePtr, flags, &changedTable))
4797+
if (jn.SetAllNotifications(modulePtr, (USHORT)flags, &changedTable))
47984798
{
47994799
if (!changedTable ||
48004800
(changedTable && jn.UpdateOutOfProcTable()))

src/coreclr/debug/daccess/request.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1738,7 +1738,7 @@ ClrDataAccess::GetMethodTableData(CLRDATA_ADDRESS mt, struct DacpMethodTableData
17381738
MTData->Module = HOST_CDADDR(pMT->GetModule());
17391739
MTData->Class = HOST_CDADDR(pMT->GetClass());
17401740
MTData->ParentMethodTable = HOST_CDADDR(pMT->GetParentMethodTable());;
1741-
MTData->wNumInterfaces = pMT->GetNumInterfaces();
1741+
MTData->wNumInterfaces = (WORD)pMT->GetNumInterfaces();
17421742
MTData->wNumMethods = pMT->GetNumMethods();
17431743
MTData->wNumVtableSlots = pMT->GetNumVtableSlots();
17441744
MTData->wNumVirtuals = pMT->GetNumVirtuals();

src/coreclr/debug/daccess/task.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3459,7 +3459,7 @@ ClrDataMethodDefinition::SetCodeNotification(
34593459
}
34603460
else
34613461
{
3462-
if (jn.SetNotification(modulePtr, m_token, flags) &&
3462+
if (jn.SetNotification(modulePtr, m_token, (USHORT)flags) &&
34633463
jn.UpdateOutOfProcTable())
34643464
{
34653465
// new notification added

src/coreclr/debug/ee/amd64/amd64walker.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -486,9 +486,9 @@ static bool IsWrite(Amd64InstrDecode::InstrForm form, int pp, bool W, bool L, bo
486486
return isWrite;
487487
}
488488

489-
static int opSize(Amd64InstrDecode::InstrForm form, int pp, bool W, bool L, bool fPrefix66)
489+
static uint8_t opSize(Amd64InstrDecode::InstrForm form, int pp, bool W, bool L, bool fPrefix66)
490490
{
491-
int opSize = 0;
491+
uint8_t opSize = 0;
492492
bool P = !((pp == 1) || fPrefix66);
493493
switch (form)
494494
{

src/coreclr/dlls/mscorpe/pewriter.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ void PERelocSection::AddBaseReloc(unsigned rva, int type, unsigned short highAdj
109109
relocSize++;
110110
unsigned short* offset = (unsigned short*) section->getBlock(2);
111111
if(offset) {
112-
*offset = VAL16((rva & 0xFFF) | (type << 12));
112+
*offset = VAL16((unsigned short)(rva & 0xFFF) | (unsigned short)(type << 12));
113113
}
114114
}
115115

@@ -1308,7 +1308,7 @@ HRESULT PEWriter::linkSortSections(entry * entries,
13081308
_ASSERTE(index == -1 || index == atoi(p));
13091309

13101310
e->nameLength = (unsigned char)(p - e->name);
1311-
e->index = index;
1311+
e->index = (char)index;
13121312
e->arrayIndex = (unsigned short)(cur - getSectStart());
13131313
e++;
13141314
}
@@ -1589,7 +1589,7 @@ HRESULT PEWriter::link() {
15891589
iUniqueSections++; // One more for .reloc
15901590
filePos = sizeof(IMAGE_DOS_HEADER)+sizeof(x86StubPgm) + m_ntHeadersSize;
15911591

1592-
m_ntHeaders->FileHeader.NumberOfSections = VAL16(iUniqueSections);
1592+
m_ntHeaders->FileHeader.NumberOfSections = (WORD)VAL16(iUniqueSections);
15931593

15941594
filePos += iUniqueSections * sizeof(IMAGE_SECTION_HEADER);
15951595
filePos = roundUp(filePos, VAL32(m_ntHeaders->OptionalHeader.FileAlignment));

src/coreclr/dlls/mscorpe/pewriter.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -305,9 +305,9 @@ inline unsigned PEWriter::getSubsystem() {
305305
}
306306

307307
inline void PEWriter::setSubsystem(unsigned subsystem, unsigned major, unsigned minor) {
308-
m_ntHeaders->OptionalHeader.Subsystem = VAL16(subsystem);
309-
m_ntHeaders->OptionalHeader.MajorSubsystemVersion = VAL16(major);
310-
m_ntHeaders->OptionalHeader.MinorSubsystemVersion = VAL16(minor);
308+
m_ntHeaders->OptionalHeader.Subsystem = (USHORT)VAL16(subsystem);
309+
m_ntHeaders->OptionalHeader.MajorSubsystemVersion = (USHORT)VAL16(major);
310+
m_ntHeaders->OptionalHeader.MinorSubsystemVersion = (USHORT)VAL16(minor);
311311
}
312312

313313
inline void PEWriter::setCharacteristics(unsigned mask) {

src/coreclr/gc/gc.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3024,7 +3024,7 @@ void gc_heap::fire_pevents()
30243024
// Not every heap will compact LOH, the ones that didn't will just have 0s
30253025
// in its info.
30263026
FIRE_EVENT(GCLOHCompact,
3027-
get_num_heaps(),
3027+
(uint16_t)get_num_heaps(),
30283028
(uint32_t)(sizeof (etw_loh_compact_info)),
30293029
(void *)loh_compact_info);
30303030
}
@@ -5039,7 +5039,7 @@ BOOL gc_heap::reserve_initial_memory (size_t normal_size, size_t large_size, siz
50395039

50405040
int numa_node = block_index % numa_node_count;
50415041
bool pinned_block = block_index >= numa_node_count;
5042-
block->memory_base = (uint8_t*)virtual_alloc (block->block_size, use_large_pages_p && !pinned_block, numa_node);
5042+
block->memory_base = (uint8_t*)virtual_alloc (block->block_size, use_large_pages_p && !pinned_block, (uint16_t)numa_node);
50435043
if (block->memory_base == nullptr)
50445044
{
50455045
dprintf(2, ("failed to reserve %Id bytes for on NUMA node %u", block->block_size, numa_node));
@@ -5998,7 +5998,7 @@ class heap_select
59985998
uint16_t proc_no[MAX_SUPPORTED_CPUS];
59995999
uint16_t node_no[MAX_SUPPORTED_CPUS];
60006000
uint16_t max_node_no = 0;
6001-
for (int i = 0; i < n_heaps; i++)
6001+
for (uint16_t i = 0; i < n_heaps; i++)
60026002
{
60036003
if (!GCToOSInterface::GetProcessorForHeap (i, &proc_no[i], &node_no[i]))
60046004
break;
@@ -6188,7 +6188,7 @@ class heap_select
61886188

61896189
for (int i = gc_heap::n_heaps; i < (int)g_num_active_processors; i++)
61906190
{
6191-
if (!GCToOSInterface::GetProcessorForHeap (i, &proc_no, &node_no))
6191+
if (!GCToOSInterface::GetProcessorForHeap ((uint16_t)i, &proc_no, &node_no))
61926192
break;
61936193

61946194
int start_heap = (int)numa_node_to_heap_map[node_no];
@@ -6211,8 +6211,8 @@ class heap_select
62116211
current_heap_on_node = start_heap;
62126212
}
62136213

6214-
proc_no_to_heap_no[proc_no] = current_heap_on_node;
6215-
proc_no_to_numa_node[proc_no] = node_no;
6214+
proc_no_to_heap_no[proc_no] = (uint16_t)current_heap_on_node;
6215+
proc_no_to_numa_node[proc_no] = (uint16_t)node_no;
62166216

62176217
current_heap_on_node++;
62186218
}
@@ -6263,7 +6263,7 @@ class heap_select
62636263
}
62646264
} while (!found_node_with_heaps_p);
62656265

6266-
return start_index;
6266+
return (uint16_t)start_index;
62676267
}
62686268
};
62696269
uint8_t* heap_select::sniff_buffer;
@@ -16178,7 +16178,7 @@ BOOL gc_heap::a_fit_segment_end_p (int gen_number,
1617816178
{
1617916179
#ifdef USE_REGIONS
1618016180
*commit_failed_p = TRUE;
16181-
#else
16181+
#else
1618216182
if (!hard_limit_short_seg_end_p)
1618316183
{
1618416184
dprintf (2, ("can't grow segment, doing a full gc"));
@@ -32231,7 +32231,7 @@ heap_segment* gc_heap::walk_relocation_sip (heap_segment* current_heap_segment,
3223132231
}
3223232232
else
3223332233
{
32234-
if (!plug_start)
32234+
if (!plug_start)
3223532235
{
3223632236
plug_start = obj;
3223732237
}
@@ -45769,7 +45769,7 @@ void gc_heap::do_post_gc()
4576945769
last_gc_info->memory_load = settings.exit_memory_load;
4577045770
else if (settings.entry_memory_load != 0)
4577145771
last_gc_info->memory_load = settings.entry_memory_load;
45772-
last_gc_info->condemned_generation = settings.condemned_generation;
45772+
last_gc_info->condemned_generation = (uint8_t)settings.condemned_generation;
4577345773
last_gc_info->compaction = settings.compaction;
4577445774
last_gc_info->concurrent = settings.concurrent;
4577545775

src/coreclr/gc/gcee.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ void GCHeap::ReportGenerationBounds()
6464
{
6565
uint64_t range = static_cast<uint64_t>(rangeEnd - rangeStart);
6666
uint64_t rangeReserved = static_cast<uint64_t>(rangeEndReserved - rangeStart);
67-
FIRE_EVENT(GCGenerationRange, generation, rangeStart, range, rangeReserved);
67+
FIRE_EVENT(GCGenerationRange, (uint8_t)generation, rangeStart, range, rangeReserved);
6868
}, nullptr);
6969
}
7070
}
@@ -325,19 +325,19 @@ bool GCHeap::IsConcurrentGCInProgress()
325325
}
326326

327327
#ifdef FEATURE_EVENT_TRACE
328-
void gc_heap::fire_etw_allocation_event (size_t allocation_amount,
329-
int gen_number,
328+
void gc_heap::fire_etw_allocation_event (size_t allocation_amount,
329+
int gen_number,
330330
uint8_t* object_address,
331331
size_t object_size)
332332
{
333333
#ifdef FEATURE_REDHAWK
334334
FIRE_EVENT(GCAllocationTick_V1, (uint32_t)allocation_amount, (uint32_t)gen_to_oh (gen_number));
335335
#else
336-
FIRE_EVENT(GCAllocationTick_V4,
337-
allocation_amount,
336+
FIRE_EVENT(GCAllocationTick_V4,
337+
allocation_amount,
338338
(uint32_t)gen_to_oh (gen_number),
339-
heap_number,
340-
object_address,
339+
heap_number,
340+
object_address,
341341
object_size);
342342
#endif //FEATURE_REDHAWK
343343
}

0 commit comments

Comments
 (0)