classification
Title: [2.7][Windows] Define _CRT_SECURE_NO_WARNINGS to build Modules\zlib\
Type: Stage: resolved
Components: Build Versions: Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: vstinner
Priority: normal Keywords: patch

Created on 2018-11-30 11:57 by vstinner, last changed 2018-12-06 10:58 by vstinner. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 10819 merged vstinner, 2018-11-30 12:00
Messages (2)
msg330777 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-11-30 11:57
The compilation of Modules\zlib\ on Python 2.7 emits a lot of warnings: see AppVeyor logs above. I propose to define _CRT_SECURE_NO_WARNINGS in the pythoncore project to make these warnings quiet, to spot more easily new warnings.

Attached PR adds _CRT_SECURE_NO_WARNINGS to Python 2.7 pythoncore project.

In the master branch, the following project also set _CRT_SECURE_NO_WARNINGS:

* PCbuild/_decimal.vcxproj
* PCbuild/_elementtree.vcxproj
* PCbuild/_ssl.vcxproj
* PCbuild/pyexpat.vcxproj

Note: In the master branch, encode_current_locale() of Python/fileutils.c also uses wcstombs(), but no warning is emitted, whereas the C file is compiled by the pythoncore project which doesn't define _CRT_SECURE_NO_WARNINGS.


AppVeyor logs:

[00:01:51] ..\Modules\zlib\gzlib.c(193): warning C4996: 'wcstombs': This function or variable may be unsafe. Consider using wcstombs_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [C:\projects\cpython\PCbuild\pythoncore.vcxproj]
[00:01:51]           C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\stdlib.h(534) : see declaration of 'wcstombs'
[00:01:51] ..\Modules\zlib\gzlib.c(208): warning C4996: 'wcstombs': This function or variable may be unsafe. Consider using wcstombs_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [C:\projects\cpython\PCbuild\pythoncore.vcxproj]
[00:01:51]           C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\stdlib.h(534) : see declaration of 'wcstombs'
[00:01:51] ..\Modules\zlib\gzlib.c(214): warning C4996: '_snprintf': This function or variable may be unsafe. Consider using _snprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [C:\projects\cpython\PCbuild\pythoncore.vcxproj]
[00:01:51]           C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\stdio.h(358) : see declaration of '_snprintf'
[00:01:51] ..\Modules\zlib\gzlib.c(245): warning C4996: '_wopen': This function or variable may be unsafe. Consider using _wsopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [C:\projects\cpython\PCbuild\pythoncore.vcxproj]
[00:01:51]           C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\io.h(276) : see declaration of '_wopen'
[00:01:51] ..\Modules\zlib\gzlib.c(245): warning C4996: 'open': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _open. See online help for details. [C:\projects\cpython\PCbuild\pythoncore.vcxproj]
[00:01:51]           C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\io.h(316) : see declaration of 'open'
[00:01:51] ..\Modules\zlib\gzlib.c(296): warning C4996: '_snprintf': This function or variable may be unsafe. Consider using _snprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [C:\projects\cpython\PCbuild\pythoncore.vcxproj]
[00:01:51]           C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\stdio.h(358) : see declaration of '_snprintf'
[00:01:51] ..\Modules\zlib\gzlib.c(612): warning C4996: '_snprintf': This function or variable may be unsafe. Consider using _snprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [C:\projects\cpython\PCbuild\pythoncore.vcxproj]
[00:01:51]           C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\stdio.h(358) : see declaration of '_snprintf'
[00:01:51]   gzread.c
[00:01:51] ..\Modules\zlib\gzread.c(35): warning C4996: 'read': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _read. See online help for details. [C:\projects\cpython\PCbuild\pythoncore.vcxproj]
[00:01:51]           C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\io.h(317) : see declaration of 'read'
[00:01:51] ..\Modules\zlib\gzread.c(41): warning C4996: 'strerror': This function or variable may be unsafe. Consider using strerror_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [C:\projects\cpython\PCbuild\pythoncore.vcxproj]
[00:01:51]           C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\string.h(126) : see declaration of 'strerror'
[00:01:51] ..\Modules\zlib\gzread.c(651): warning C4996: 'close': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _close. See online help for details. [C:\projects\cpython\PCbuild\pythoncore.vcxproj]
[00:01:51]           C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\io.h(306) : see declaration of 'close'
[00:01:51]   gzwrite.c
[00:01:51] ..\Modules\zlib\gzwrite.c(89): warning C4996: 'write': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _write. See online help for details. [C:\projects\cpython\PCbuild\pythoncore.vcxproj]
[00:01:51]           C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\io.h(322) : see declaration of 'write'
[00:01:51] ..\Modules\zlib\gzwrite.c(91): warning C4996: 'strerror': This function or variable may be unsafe. Consider using strerror_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [C:\projects\cpython\PCbuild\pythoncore.vcxproj]
[00:01:51]           C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\string.h(126) : see declaration of 'strerror'
[00:01:51] ..\Modules\zlib\gzwrite.c(110): warning C4996: 'write': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _write. See online help for details. [C:\projects\cpython\PCbuild\pythoncore.vcxproj]
[00:01:51]           C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\io.h(322) : see declaration of 'write'
[00:01:51] ..\Modules\zlib\gzwrite.c(112): warning C4996: 'strerror': This function or variable may be unsafe. Consider using strerror_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [C:\projects\cpython\PCbuild\pythoncore.vcxproj]
[00:01:51]           C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\string.h(126) : see declaration of 'strerror'
[00:01:51] ..\Modules\zlib\gzwrite.c(428): warning C4996: 'vsnprintf': This function or variable may be unsafe. Consider using vsnprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [C:\projects\cpython\PCbuild\pythoncore.vcxproj]
[00:01:51]           C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\stdio.h(350) : see declaration of 'vsnprintf'
[00:01:51] ..\Modules\zlib\gzwrite.c(661): warning C4996: 'close': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _close. See online help for details. [C:\projects\cpython\PCbuild\pythoncore.vcxproj]
[00:01:51]           C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\io.h(306) : see declaration of 'close'
msg331222 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-12-06 10:56
New changeset 49cedc51a68b4cd2525c14ab02bd1a483d8be389 by Victor Stinner in branch '2.7':
bpo-35359: Add _CRT_SECURE_NO_WARNINGS to pythoncore project (GH-10819)
https://github.com/python/cpython/commit/49cedc51a68b4cd2525c14ab02bd1a483d8be389
History
Date User Action Args
2018-12-06 10:58:55vstinnersetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2018-12-06 10:56:05vstinnersetmessages: + msg331222
2018-11-30 12:00:04vstinnersetkeywords: + patch
stage: patch review
pull_requests: + pull_request10063
2018-11-30 11:57:56vstinnercreate