Skip to content

Commit

Permalink
Make installers /Zc:strictStrings compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
am11 committed Mar 20, 2020
1 parent 5324f02 commit 4fc15c2
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion eng/native/configurecompiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ include(${CMAKE_CURRENT_LIST_DIR}/configureoptimization.cmake)
#-----------------------------------------------------

if(MSVC)
add_compile_options(/Zi /FC)
add_compile_options(/Zi /FC /Zc:strictStrings)
elseif (CLR_CMAKE_HOST_UNIX)
add_compile_options(-g)
add_compile_options(-Wall)
Expand Down
1 change: 0 additions & 1 deletion src/coreclr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ endif (CLR_CMAKE_HOST_WIN32)

if(MSVC)
set(CMAKE_CXX_STANDARD_LIBRARIES "") # do not link against standard win32 libs i.e. kernel32, uuid, user32, etc.
add_compile_options(/Zc:strictStrings)
if (CLR_CMAKE_HOST_ARCH_I386)
add_compile_options(/Gz)
endif (CLR_CMAKE_HOST_ARCH_I386)
Expand Down
1 change: 0 additions & 1 deletion src/coreclr/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ include(${CLR_ENG_NATIVE_DIR}/configurecompiler.cmake)
set(INC_PLATFORM_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/Common/Platform)
if (CLR_CMAKE_TARGET_WIN32)
add_definitions(-DWINDOWS)
add_compile_options(/Zc:strictStrings)
if (CLR_CMAKE_HOST_ARCH_I386)
add_compile_options(/Gz)
endif (CLR_CMAKE_HOST_ARCH_I386)
Expand Down
12 changes: 6 additions & 6 deletions src/installer/corehost/cli/hostmisc/pal.windows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,9 @@ static
bool get_wow_mode_program_files(pal::string_t* recv)
{
#if defined(TARGET_AMD64)
pal::char_t* env_key = _X("ProgramFiles(x86)");
const pal::char_t* env_key = _X("ProgramFiles(x86)");
#else
pal::char_t* env_key = _X("ProgramFiles");
const pal::char_t* env_key = _X("ProgramFiles");
#endif

return get_file_path_from_env(env_key,recv);
Expand Down Expand Up @@ -274,7 +274,7 @@ bool pal::get_default_installation_dir(pal::string_t* recv)
}
// ***************************

pal::char_t* program_files_dir;
const pal::char_t* program_files_dir;
if (pal::is_running_in_wow64())
{
program_files_dir = _X("ProgramFiles(x86)");
Expand All @@ -296,7 +296,7 @@ bool pal::get_default_installation_dir(pal::string_t* recv)

namespace
{
void get_dotnet_install_location_registry_path(HKEY * key_hive, pal::string_t * sub_key, pal::char_t ** value)
void get_dotnet_install_location_registry_path(HKEY * key_hive, pal::string_t * sub_key, const pal::char_t ** value)
{
*key_hive = HKEY_LOCAL_MACHINE;
// The registry search occurs in the 32-bit registry in all cases.
Expand Down Expand Up @@ -327,7 +327,7 @@ bool pal::get_dotnet_self_registered_config_location(pal::string_t* recv)
#else
HKEY key_hive;
pal::string_t sub_key;
pal::char_t* value;
const pal::char_t* value;
get_dotnet_install_location_registry_path(&key_hive, &sub_key, &value);

*recv = (key_hive == HKEY_CURRENT_USER ? _X("HKCU\\") : _X("HKLM\\")) + sub_key + _X("\\") + value;
Expand All @@ -354,7 +354,7 @@ bool pal::get_dotnet_self_registered_dir(pal::string_t* recv)

HKEY hkeyHive;
pal::string_t sub_key;
pal::char_t* value;
const pal::char_t* value;
get_dotnet_install_location_registry_path(&hkeyHive, &sub_key, &value);

// Must use RegOpenKeyEx to be able to specify KEY_WOW64_32KEY to access the 32-bit registry in all cases.
Expand Down

0 comments on commit 4fc15c2

Please sign in to comment.