slang-users mailing list

[2009 Date Index] [2009 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

[slang-users] [PATCH] More Visual C build improvements


The following patch makes two changes to the Visual C build environment:

First, it removes the /YX compiler option.  This option, which used to trigger
implicit generation of precompiled headers, is not available in newer versions
of the compiler.  Microsoft says:

    The /YX compiler option generated automatic precompiled headers support.
    It was used by default from the development environment. If you remove /YX
    from your build configurations and replace it with nothing, it can result
    in faster builds. In addition to performance issues, /YX introduces the
    possibility of unexpected runtime behavior, it is preferable to use /Yc
    (Create Precompiled Header File) and /Yu (Use Precompiled Header File),
    which give you more control on how precompiled headers are used.

In other words, these days you need to maintain your own precompiled header
files explicitly if you decide to use them in your project.  I assume that's
not worth the effort here.

Second, we now define "_CRT_SECURE_NO_WARNINGS", which disables compile-time
warnings when "insecure" functions like strcpy() are used.  The Visual C
runtime provides "safe" alternatives, such as strcpy_s(), but updating S-Lang
to reference them probably won't improve things much (unless there's low
confidence in the current code's security with regard to things like buffer
overflows).

Alternatively, "_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES" could be defined,
which would cause the runtime to define strcpy() in terms of strcpy_s(), for
example.  That also feels like too much of an intrusive change here, but I
mention it for completeness.

Index: src/mkfiles/makefile.all
===================================================================
--- src/mkfiles/makefile.all    (revision 303)
+++ src/mkfiles/makefile.all    (working copy)
@@ -551,8 +551,9 @@

 !ifdef VC
 $(OBJDIR)\comp.rsp:
-       echo /nologo /W3 /YX /O2 /D "NDEBUG" /D $(CPU) > $(OBJDIR)\comp.rsp
-       echo /D "WIN32" /I "." /ML >> $(OBJDIR)\comp.rsp
+       echo /nologo /W3 /O2 /D "NDEBUG" /D $(CPU) > $(OBJDIR)\comp.rsp
+       echo /D "WIN32" /I "." /MT >> $(OBJDIR)\comp.rsp
+       echo /D "_CRT_SECURE_NO_WARNINGS " >> $(OBJDIR)\comp.rsp
 ! ifdef DLL
        echo /D SLANG_DLL >> $(OBJDIR)\comp.rsp
 ! endif

-- 
Jon Parise (jon of indelible.org)  ::  "Scientia potentia est"



[2009 date index] [2009 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]