Skip to content

Commit

Permalink
Fix declaration hiding in host (#68684)
Browse files Browse the repository at this point in the history
  • Loading branch information
elinor-fung authored Apr 29, 2022
1 parent daec9dc commit 66bd8b1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
6 changes: 6 additions & 0 deletions src/native/corehost/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ include(${CLR_ENG_NATIVE_DIR}/configurecompiler.cmake)
if (MSVC)
# Host components don't try to handle asynchronous exceptions
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:/EHsc>)

# Explicitly re-enable warnings about declation hiding (currently disabled by configurecompiler.cmake)
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/we4456>) # declaration of 'identifier' hides previous local declaration
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/we4457>) # declaration of 'identifier' hides function parameter
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/we4458>) # declaration of 'identifier' hides class member
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/we4459>) # declaration of 'identifier' hides global declaration
elseif (CMAKE_CXX_COMPILER_ID MATCHES GNU)
# Prevents libc from calling pthread_cond_destroy on static objects in
# dlopen()'ed library which we dlclose() in pal::unload_library.
Expand Down
6 changes: 3 additions & 3 deletions src/native/corehost/fxr/framework_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ bool compare_by_name_and_version(const framework_info &a, const framework_info &
pal::readdir_onlydirectories(fx_shared_dir, &fx_names);
}

for (pal::string_t fx_name : fx_names)
for (pal::string_t fx_name_local : fx_names)
{
auto fx_dir = fx_shared_dir;
append_path(&fx_dir, fx_name.c_str());
append_path(&fx_dir, fx_name_local.c_str());

if (pal::directory_exists(fx_dir))
{
Expand All @@ -81,7 +81,7 @@ bool compare_by_name_and_version(const framework_info &a, const framework_info &
{
trace::verbose(_X("Found FX version [%s]"), ver.c_str());

framework_info info(fx_name, fx_dir, parsed, hive_depth);
framework_info info(fx_name_local, fx_dir, parsed, hive_depth);
framework_infos->push_back(info);
}
}
Expand Down
5 changes: 1 addition & 4 deletions src/native/corehost/fxr/fx_resolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,10 +268,7 @@ namespace
if (selected_ver != fx_ver_t())
{
// Compare the previous hive_dir selection with the current hive_dir to see which one is the better match
std::vector<fx_ver_t> version_list;
version_list.push_back(resolved_ver);
version_list.push_back(selected_ver);
resolved_ver = resolve_framework_reference_from_version_list(version_list, fx_ref);
resolved_ver = resolve_framework_reference_from_version_list({ resolved_ver, selected_ver }, fx_ref);
}

if (resolved_ver != selected_ver)
Expand Down

0 comments on commit 66bd8b1

Please sign in to comment.