Description:
We (the Microsoft C++ team) use the MySQL project as part of our "Real world code" tests. I noticed a few issues in windows specific code when building MySQL with the MSVC compiler in its conformance mode (/permissive-). For more information on /permissive- see our blog https://blogs.msdn.microsoft.com/vcblog/2016/11/16/permissive-switch/.
failure:
D:\MySQL\src\libmysql\authentication_win\handshake.h(103,40): error C4596: 'packet_processing_loop': illegal qualified name in member declaration
int Handshake::packet_processing_loop();
^
D:\MySQL\src\libmysql\authentication_win\handshake_client.cc(267,21): warning C4267: '=': conversion from 'size_t' to 'byte', possible loss of data
*ptr++= len >> 8;
^
D:\MySQL\src\rapid\plugin\group_replication\libmysqlgcs\include\mysql\gcs\xplatform\my_xp_cond.h(126,48): error C4596: 'get_milliseconds': illegal qualified name in member declaration
static DWORD My_xp_cond_win::get_milliseconds(const struct timespec *abstime);
D:\MySQL\src\sql\mysqld.cc(5295,6): error C2664: 'BOOL NTService::got_service_option(char **,char *)': cannot convert argument 2 from 'const char [15]' to 'char *' [D:\MySQL\build_x86\sql\sql.vcxproj]
D:\MySQL\src\sql\mysqld.cc(5295,6): error C2664: if (Service.got_service_option(argv, "install-manual")) [D:\MySQL\build_x86\sql\sql.vcxproj]
D:\MySQL\src\sql\mysqld.cc(5295,6): error C2664: ^ [D:\MySQL\build_x86\sql\sql.vcxproj]
D:\MySQL\src\sql\mysqld.cc(5295,6): message : Conversion from string literal loses const qualifier (see /Zc:strictStrings) [D:\MySQL\build_x86\sql\sql.vcxproj]
D:\MySQL\src\sql\mysqld.cc(7248,59): error C2440: '=': cannot convert from 'const char [6]' to 'char *' [D:\MySQL\build_x86\sql\sql.vcxproj]
D:\MySQL\src\sql\mysqld.cc(7248,59): error C2440: shared_memory_base_name= default_shared_memory_base_name; [D:\MySQL\build_x86\sql\sql.vcxproj]
D:\MySQL\src\sql\mysqld.cc(7248,59): error C2440: ^ [D:\MySQL\build_x86\sql\sql.vcxproj]
D:\MySQL\src\sql\mysqld.cc(7248,59): message : Conversion from string literal loses const qualifier (see /Zc:strictStrings) [D:\MySQL\build_x86\sql\sql.vcxproj]
How to repeat:
1.git clone -b 5.7 https://github.com/mysql/mysql-server.git D:\MySQL\src
2.it's rely on boost 1.59,so extract boost_1_59_0.zip to D:\MySQL\
3.set _CL_=/permissive-
4.mkdir build_x86 && pushd build_x86
5.cmake -G "Visual Studio 15 2017" -DCMAKE_SYSTEM_VERSION=10.0.17134.0 -DWITH_NDB_JAVA=0 -DWITH_BOOST=..\boost_1_59_0 ..\src
6.msbuild /p:Configuration=Debug;Platform=Win32 build_x86\MySQL.sln /t:Rebuild /m /p:BuildInParallel=true