summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Hay <SteveHay@planit.com>2006-11-23 11:06:47 +0000
committerSteve Hay <SteveHay@planit.com>2006-11-23 11:06:47 +0000
commitc5b31784e02aac7c0b7f5bd436ee6d2fd57bbcf0 (patch)
treeb0452c3b41be0fa70f856672f15f1318199b29c6
parentbdd9a5d66f1cec83b81754b37c772cc5ede73afe (diff)
downloadperl-c5b31784e02aac7c0b7f5bd436ee6d2fd57bbcf0.tar.gz
Silence VC8's warnings about "unsafe" CRT functions and POSIX CRT
function names being deprecated, and add a note to perltodo to revisit this one day. p4raw-id: //depot/perl@29358
-rw-r--r--pod/perltodo.pod23
-rw-r--r--win32/Makefile6
-rw-r--r--win32/makefile.mk6
3 files changed, 35 insertions, 0 deletions
diff --git a/pod/perltodo.pod b/pod/perltodo.pod
index c0841770a1..026f2f6bb7 100644
--- a/pod/perltodo.pod
+++ b/pod/perltodo.pod
@@ -376,6 +376,29 @@ Currently, numerous functions look virtually, if not completely,
identical in both C<win32/wince.c> and C<win32/win32.c> files, which can't
be good.
+=head2 Use secure CRT functions when building with VC8 on Win32
+
+Visual C++ 2005 (VC++ 8.x) deprecated a number of CRT functions on the basis
+that they were "unsafe" and introduced differently named secure versions of
+them as replacements, e.g. instead of writing
+
+ FILE* f = fopen(__FILE__, "r");
+
+one should now write
+
+ FILE* f;
+ errno_t err = fopen_s(&f, __FILE__, "r");
+
+Currently, the warnings about these deprecations have been disabled by adding
+-D_CRT_SECURE_NO_DEPRECATE to the CFLAGS. It would be nice to remove that
+warning suppressant and actually make use of the new secure CRT functions.
+
+There is also a similar issue with POSIX CRT function names like fileno having
+been deprecated in favour of ISO C++ conformant names like _fileno. These
+warnings are also currently suppressed with the compiler option /wd4996. It
+might be nice to do as Microsoft suggest here too, although, unlike the secure
+functions issue, there is presumably little or no benefit in this case.
+
=head1 Tasks that need a knowledge of XS
These tasks would need C knowledge, and roughly the level of knowledge of
diff --git a/win32/Makefile b/win32/Makefile
index bf0a1bbd82..e4573b560e 100644
--- a/win32/Makefile
+++ b/win32/Makefile
@@ -454,6 +454,12 @@ DEFINES = $(DEFINES) -DWIN64 -DCONSERVATIVE
OPTIMIZE = $(OPTIMIZE) -Wp64 -fp:precise
!ENDIF
+# For now, silence VC++ 8.x's warnings about "unsafe" CRT functions and POSIX
+# CRT function names being deprecated.
+!IF "$(CCTYPE)" == "MSVC80" || "$(CCTYPE)" == "MSVC80FREE"
+DEFINES = $(DEFINES) -D_CRT_SECURE_NO_DEPRECATE -wd4996
+!ENDIF
+
# Use the MSVCRT read() fix if the PerlCRT was not chosen, but only when using
# VC++ 6.x or earlier. Later versions use MSVCR70.dll, MSVCR71.dll, etc, which
# do not require the fix.
diff --git a/win32/makefile.mk b/win32/makefile.mk
index 764e3d3aef..09f4b577ae 100644
--- a/win32/makefile.mk
+++ b/win32/makefile.mk
@@ -565,6 +565,12 @@ DEFINES += -DWIN64 -DCONSERVATIVE
OPTIMIZE += -Wp64 -fp:precise
.ENDIF
+# For now, silence VC++ 8.x's warnings about "unsafe" CRT functions and POSIX
+# CRT function names being deprecated.
+.IF "$(CCTYPE)" == "MSVC80" || "$(CCTYPE)" == "MSVC80FREE"
+DEFINES += -D_CRT_SECURE_NO_DEPRECATE -wd4996
+.ENDIF
+
# Use the MSVCRT read() fix if the PerlCRT was not chosen, but only when using
# VC++ 6.x or earlier. Later versions use MSVCR70.dll, MSVCR71.dll, etc, which
# do not require the fix.