[Gc] Compilation warnings with VC++ 2008

Christophe Meessen meessen at cppm.in2p3.fr
Sat Aug 23 02:40:28 PDT 2008


Hello,

I have just compiled gc-7.1 with VC++ 2008 and saw some warnings that
might be good to check.
I didn't check yet how it works with my code. It works well with g++ and
unix though.

1.- There is a list of warnings, when compiling the library, reporting
the use of insecure C calls. They are all removed when adding the
-D_CRT_SECURE_NO_WARNINGS in the compilation command line. I did it in
the NT_STATIC_THREAD file and it worked. I checked if there was a quick
fix to change the calls, but apparently there is not. See APPENDIX A of
this mail for the list of warning messages.

2.- There is another warning signaling some attribute mismatch with the
prototype of the new call betwenn the one of GC and the one of VC. In GC
we have 
    void *operator new[]( size_t size );
and in visual we have
   _Ret_bytecap_(_Size) void *__CRTDECL operator new[](size_t _Size)
       _THROW1(std::bad_alloc);    // allocate array or throw exception
Don't know what to do about it. It might just be the throw attribute.
See APPENDIX B of this mail for the list of warnings. Sorry it is in
french but the relevant part of the message should be clear enough.

3.- There is also a warning when linking but which doesn't seem critical :
LINK : warning LNK4224: /DEBUG:FULL n'est plus pris en charge ; ignoré
Sorry for the french, it just says it is not used anymore and is ignored.

-- APPENDIX A --

Here is the list of warnings reporting use of unsecure functions.

There are quite a few warnings with the file misc.c.

misc.c(510) : warning C4996: 'getenv': This function or variable may be
unsafe. Consider using _dupenv_s instead. To disable depreca
tion, use _CRT_SECURE_NO_WARNINGS. See online help for details. (Many
occurences in the file.)

misc.c(860) : warning C4996: 'strcat': This function or variable may be
unsafe. Consider using strcat_s instead. To disable deprecat
ion, use _CRT_SECURE_NO_WARNINGS. See online help for details.

misc.c(984) : 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.

Same type of warning, but with another function and in another file.
dbg_mlc.c(647) : warning C4996: 'strcpy': This function or variable may
be unsafe. Consider using strcpy_s instead. To disable depre
cation, use _CRT_SECURE_NO_WARNINGS. See online help for details.

malloc.c(250) : warning C4996: 'strcpy': This function or variable may
be unsafe. Consider using strcpy_s instead. To disable deprec
ation, use _CRT_SECURE_NO_WARNINGS. See online help for details.

msvc_dbg.c(180) : warning C4996: 'strncpy': This function or variable
may be unsafe. Consider using strncpy_s instead. To disable de
precation, use _CRT_SECURE_NO_WARNINGS. See online help for details.

-- APPENDIX B --

Warning message when compiling ge test program

         cl -Zi -Od -DDEBUG -c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo
-GS -D_X86_=1  -DWIN32 -D_WIN32 -W3 -D_WINNT -D_WIN32_WINNT=
0x0500 -DNTDDI_VERSION=0x05000000 -D_WIN32_IE=0x0500 -DWINVER=0x0500 
-D_MT -MTd -Iinclude -Ilibatomic_ops-1.2/src -DALL_INTERIOR_PO
INTERS -DGC_NOT_DLL test_cpp.CPP -D_CRT_SECURE_NO_WARNINGS
-DGC_WIN32_THREADS -DTHREAD_LOCAL_ALLOC /Fotest_cpp.obj
test_cpp.CPP
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\new(82) :
warning C4985: 'operator new[]' : attributs absents de la déclarat
ion précédente.
        C:\Documents and Settings\Christophe\Mes
documents\Sources\gc-7.1\include\gc_cpp.h(252) : voir la déclaration de
'operator n
ew[]'






More information about the Gc mailing list