[PATCH] Fix to support old version of crtdefs.h
hayashi at clear-code.com
Thu Aug 2 09:41:09 UTC 2012
On Thu, 2 Aug 2012 12:52:20 +0400
Maxim Dounin <mdounin at mdounin.ru> wrote:
> On Thu, Aug 02, 2012 at 12:31:59PM +0900, HAYASHI Kentaro wrote:
> > Hi,
> > I attached a patch for fixing build problem (_CRT_SECURE_NO_DEPRECATE)
> > with Visual Studio 2005 Express.
> > The problem is that old version of crtdefs.h uses _CRT_SECURE_NO_DEPRECATE
> > (instead of _CRT_SECURE_NO_WARNINGS) for eliminating the warnings.
> > see: http://social.msdn.microsoft.com/forums/en-US/vcgeneral/thread/3373dd77-ed73-44a6-a52c-53dfd95099ac/
> > The purpose of this patch is supporting old version of crtdefs.h
> > by adding definition about _CRT_SECURE_NO_DEPRECATE.
> > As a result, nmake build process succeeds with Visual Studio 2005 Express under Wine.
> > NOTE:
> > * I used Wine to setup old version of crtdefs.h.
> > * I confirmed that VS2005 Express and VS2005 Express SP1 uses old version of crtdefs.h.
> > (It seems that VS2005 Express SP1 with latest hotfix use newer version of crtdefs.h)
> > * I confirmed that this patch does not affects build process
> > even if newer version of crtdefs.h is used.
> > I hope that this patch will be applied to nginx mainstream.
> > Index: src/os/win32/ngx_win32_config.h
> > ===================================================================
> > --- src/os/win32/ngx_win32_config.h (revision 4778)
> > +++ src/os/win32/ngx_win32_config.h (working copy)
> > @@ -19,6 +19,11 @@
> > /* enable getenv() and gmtime() in msvc8 */
> > #define _CRT_SECURE_NO_WARNINGS
> > +/* support old version of crtdefs.h in msvc8 */
> > +#if (_MSC_VER == 1400)
> > +#define _CRT_SECURE_NO_DEPRECATE
> > +#endif
> > +
> Thanks for your report.
> Any specific reason to explicitly check msvc version? I tend to
> think that just
> --- a/src/os/win32/ngx_win32_config.h
> +++ b/src/os/win32/ngx_win32_config.h
> @@ -18,6 +18,7 @@
> /* enable getenv() and gmtime() in msvc8 */
> #define _CRT_SECURE_NO_WARNINGS
> +#define _CRT_SECURE_NO_DEPRECATE
> * we need to include <windows.h> explicitly before <winsock2.h> because
> should be enough.
> Maxim Dounin
> nginx-devel mailing list
> nginx-devel at nginx.org
The patch checks explicitly msvc version because I just confirmed VS2005 Express series only.
So I checked VS2010 Express crtdefs.h additionally, it seems that there is no problem without checking explicitly msvc version.
As you mentioned above, just adding "#define _CRT_SECURE_NO_DEPRECATE" is enough.
HAYASHI Kentaro <hayashi at clear-code.com>
More information about the nginx-devel