[pcre-dev] [PATCH] Quash deprecation warnings on Windows

Top Page
Delete this message
Author: Daniel Richard G
Date:  
To: pcre-dev
Subject: [pcre-dev] [PATCH] Quash deprecation warnings on Windows
In building PCRE 8.32 on Windows, I noticed the following warnings come up
numerous times:

--------8<--------
warning #1786: function "fopen" (declared at line 237 of "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\stdio.h") was declared "deprecated ("This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.") "
warning #1786: function "getenv" (declared at line 447 of "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\stdlib.h") was declared "deprecated ("This function or variable may be unsafe. Consider using _dupenv_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.") "
warning #1786: function "sprintf" (declared at line 366 of "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\stdio.h") was declared "deprecated ("This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.") "
warning #1786: function "strcpy" (declared at line 74 of "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h") was declared "deprecated ("This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.") "
warning #1786: function "strerror" (declared at line 126 of "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h") was declared "deprecated ("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.") "
warning #1786: function "strncpy" (declared at line 157 of "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h") was declared "deprecated ("This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.") "
-------->8--------

The attached patch adds _CRT_SECURE_NO_WARNINGS to the CMake config header
template to shoo these away.


--Daniel


--
Daniel Richard G. || danielg@??? || Software Developer
Teragram Linguistic Technologies (a division of SAS)
http://www.teragram.com/Index: config-cmake.h.in
===================================================================
--- config-cmake.h.in    (revision 1228)
+++ config-cmake.h.in    (working copy)
@@ -51,4 +51,8 @@
 #define MAX_NAME_SIZE    32
 #define MAX_NAME_COUNT    10000
 
+#ifdef _MSC_VER
+#  define _CRT_SECURE_NO_WARNINGS 1
+#endif
+
 /* end config.h for CMake builds */