# /W3 is added by default by CMake, so remove it
string(REPLACE "/W3" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
string(REPLACE "/W3" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
- # set default warning level to 3 but allow targets to override it.
- add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/W$<GENEX_EVAL:$<IF:$<BOOL:$<TARGET_PROPERTY:MSVC_WARNING_LEVEL>>,$<TARGET_PROPERTY:MSVC_WARNING_LEVEL>,3>>>)
+
+ # [[! Microsoft.Security.SystemsADM.10086 !]] - SDL required warnings
+ # set default warning level to 4 but allow targets to override it.
+ add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/W$<GENEX_EVAL:$<IF:$<BOOL:$<TARGET_PROPERTY:MSVC_WARNING_LEVEL>>,$<TARGET_PROPERTY:MSVC_WARNING_LEVEL>,4>>>)
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/WX>) # treat warnings as errors
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/Oi>) # enable intrinsics
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/Oy->) # disable suppressing of the creation of frame pointers on the call stack for quicker function calls
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4065>) # switch statement contains 'default' but no 'case' labels
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4100>) # 'identifier' : unreferenced formal parameter
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4127>) # conditional expression is constant
+ add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4131>) # 'function' : uses old-style declarator
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4189>) # local variable is initialized but not referenced
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4200>) # nonstandard extension used : zero-sized array in struct/union
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4201>) # nonstandard extension used : nameless struct/union
+ add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4206>) # nonstandard extension used : translation unit is empty
+ add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4239>) # nonstandard extension used : 'token' : conversion from 'type' to 'type'
+ add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4244>) # conversion from 'type1' to 'type2', possible loss of data
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4245>) # conversion from 'type1' to 'type2', signed/unsigned mismatch
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4291>) # no matching operator delete found; memory will not be freed if initialization throws an exception
+ add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4310>) # cast truncates constant value
+ add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4324>) # 'struct_name' : structure was padded due to __declspec(align())
+ add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4366>) # The result of the unary 'operator' operator may be unaligned
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4456>) # declaration of 'identifier' hides previous local declaration
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4457>) # declaration of 'identifier' hides function parameter
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4458>) # declaration of 'identifier' hides class member
+ add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4459>) # declaration of 'identifier' hides global declaration
+ add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4463>) # overflow; assigning value to bit-field that can only hold values from low_value to high_value
+ add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4505>) # unreferenced function with internal linkage has been removed
+ add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4611>) # interaction between 'function' and C++ object destruction is non-portable
+ add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4701>) # potentially uninitialized local variable 'var' used
+ add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4702>) # unreachable code
+ add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4703>) # potentially uninitialized local pointer variable 'var' used
+ add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4706>) # assignment within conditional expression
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4733>) # Inline asm assigning to 'FS:0' : handler not registered as safe handler
+ add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4815>) # 'var': zero-sized array in stack object will have no elements (unless the object is an aggregate that has been aggregate initialized)
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4838>) # conversion from 'type_1' to 'type_2' requires a narrowing conversion
+ add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4918>) # 'character' : invalid character in pragma optimization list
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4960>) # 'function' is too big to be profiled
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4961>) # No profile data was merged into '.pgd file', profile-guided optimizations disabled
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd5105>) # macro expansion producing 'defined' has undefined behavior
+ add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd5205>) # delete of an abstract class 'type-name' that has a non-virtual destructor results in undefined behavior
# Treat Warnings as Errors:
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/we4007>) # 'main' : must be __cdecl.
padding_size, (total_ephemeral_size - padding_size)));
}
-#ifdef _MSC_VER
-#pragma warning(disable:4706) // "assignment within conditional expression" is intentional in this function.
-#endif // _MSC_VER
-
heap_segment*
gc_heap::soh_get_segment_to_expand()
{
}
#endif //!USE_REGIONS
-#ifdef _MSC_VER
-#pragma warning(default:4706)
-#endif // _MSC_VER
-
//returns 0 in case of allocation failure
heap_segment*
gc_heap::get_segment (size_t size, gc_oh_num oh)
}
dprintf (3, ("[%s] h%2d age %d region %Ix (%Id)%s",
- msg, hn, (int)heap_segment_age_in_free (region),
+ msg, hn, (int)heap_segment_age_in_free (region),
heap_segment_mem (region), get_region_committed_size (region),
((heap_segment_committed (region) == heap_segment_reserved (region)) ? "(FC)" : "")));
}
{
num_decommit_regions_by_time++;
size_decommit_regions_by_time += get_region_committed_size (region);
- dprintf (REGIONS_LOG, ("h%2d region %Ix age %2d, decommit",
+ dprintf (REGIONS_LOG, ("h%2d region %Ix age %2d, decommit",
i, heap_segment_mem (region), heap_segment_age_in_free (region)));
region_free_list::unlink_region (region);
region_free_list::add_region (region, global_regions_to_decommit);
return !sufficient_p;
}
-#ifdef _MSC_VER
-#pragma warning(disable:4706) // "assignment within conditional expression" is intentional in this function.
-#endif // _MSC_VER
-
inline
BOOL gc_heap::a_fit_free_list_p (int gen_number,
size_t size,
return can_fit;
}
-#ifdef _MSC_VER
-#pragma warning(default:4706)
-#endif // _MSC_VER
-
BOOL gc_heap::a_fit_segment_end_p (int gen_number,
heap_segment* seg,
size_t size,
if (n < max_generation)
{
- int highest_gen_number =
+ int highest_gen_number =
#ifdef USE_REGIONS
max_generation;
#else //USE_REGIONS
{
dprintf (REGIONS_LOG, ("before equalize: gen: %d avg surv: %Id max_surv: %Id imbalance: %d", gen_idx, avg_surv_per_heap, max_surv_per_heap, max_surv_per_heap*100/avg_surv_per_heap));
}
- //
+ //
// step 2:
// remove regions from surplus heaps until all heaps are <= average
// put removed regions into surplus regions
- //
+ //
// step 3:
// put regions into size classes by survivorship
// put deficit heaps into size classes by deficit
while (seg)
{
- uint8_t* start =
+ uint8_t* start =
#ifdef USE_REGIONS
get_region_start (seg);
#else
#if defined(USE_REGIONS) && defined(BACKGROUND_GC)
if (should_update_end_mark_size())
{
- background_soh_size_end_mark += generation_end_seg_allocated (older_gen) -
+ background_soh_size_end_mark += generation_end_seg_allocated (older_gen) -
r_older_gen_end_seg_allocated;
}
#endif //USE_REGIONS && BACKGROUND_GC
while (max_gen_tail_region)
{
- background_soh_size_end_mark += heap_segment_allocated (max_gen_tail_region) -
+ background_soh_size_end_mark += heap_segment_allocated (max_gen_tail_region) -
heap_segment_mem (max_gen_tail_region);
max_gen_tail_region = heap_segment_next (max_gen_tail_region);
int plan_gen_num = heap_segment_plan_gen_num (region);
generation_allocation_size (generation_of (plan_gen_num)) += heap_segment_survived (region);
- dprintf (REGIONS_LOG, ("sip: g%d alloc size is now %Id", plan_gen_num,
+ dprintf (REGIONS_LOG, ("sip: g%d alloc size is now %Id", plan_gen_num,
generation_allocation_size (generation_of (plan_gen_num))));
}
heap_segment* gen0_seg = generation_start_segment (gen);
while (gen0_seg)
{
- uint8_t* end = in_range_for_segment (current_alloc_allocated, gen0_seg) ?
+ uint8_t* end = in_range_for_segment (current_alloc_allocated, gen0_seg) ?
current_alloc_allocated : heap_segment_allocated (gen0_seg);
gen0_size += end - heap_segment_mem (gen0_seg);
if (gc_heap::current_c_gc_state == c_gc_state_planning)
{
// During BGC sweep since we can be deleting SOH segments, we avoid walking the segment
- // list.
+ // list.
generation* oldest_gen = pGenGCHeap->generation_of (max_generation);
totsize = pGenGCHeap->background_soh_size_end_mark - generation_free_list_space (oldest_gen) - generation_free_obj_space (oldest_gen);
stop_gen_index--;
set_property(TARGET ${jitName} APPEND_STRING PROPERTY LINK_FLAGS ${JIT_EXPORTS_LINKER_OPTION})
set_property(TARGET ${jitName} APPEND_STRING PROPERTY LINK_DEPENDS ${JIT_EXPORTS_FILE})
- set_target_properties(${jitName} PROPERTIES MSVC_WARNING_LEVEL 4)
target_link_libraries(${jitName}
${JIT_LINK_LIBRARIES}
#ifdef FEATURE_64BIT_ALIGNMENT
if (pMT->RequiresAlign8())
{
- CHECK_AND_TEAR_DOWN((((size_t)this) & 0x7) == (pMT->IsValueType()? 4:0));
+ CHECK_AND_TEAR_DOWN((((size_t)this) & 0x7) == (size_t)(pMT->IsValueType()?4:0));
}
lastTest = 9;
#endif // FEATURE_64BIT_ALIGNMENT
nullptr
));
- THROW_FAIL_IF_FALSE(lcid == V_I4(&result));
+ THROW_FAIL_IF_FALSE(lcid == (LCID)V_UI4(&result));
}
namespace
# add the library
add_library (mono-embedding-api-test SHARED mono-embedding-api-test.c api-types.h api-functions.h)
+set_target_properties(mono-embedding-api-test PROPERTIES MSVC_WARNING_LEVEL 3)
target_link_libraries(mono-embedding-api-test monoapi ${LINK_LIBRARIES_ADDITIONAL})
if(CLR_CMAKE_HOST_OSX)