Menu

#589 compiler warnings on Linux

2.0 Series
open
5
2014-07-20
2007-03-08
Paul Wise
No

If possible, I'd like to fix some of the warnings spit out by g++ and mingw during compilation on Linux, would that be ok? I'll only commit simple stuff. There are a lot of "foo has virtual functions but non-virtual destructor" warnings in the LZMA code, not sure what the deal is there, they are the biggest source of warnings at the moment. A sample of the warnings, with dupes removed:

g++ -o build/release/tests/required/exehead/zlib/INFBLOCK.o -c -x c -DCOMPRESS_MF_BT -DEXEHEAD -DNSIS_COMPRESS_USE_ZLIB Source/zlib/INFBLOCK.C
Source/zlib/INFBLOCK.C: In function 'inflate_flush':
Source/zlib/INFBLOCK.C:115: warning: incompatible implicit declaration of built-in function 'memcpy'
Source/zlib/INFBLOCK.C: In function 'inflate':
Source/zlib/INFBLOCK.C:442: warning: incompatible implicit declaration of built-in function 'memcpy'

g++ -o build/release/tests/textrunner.o -c -DCOMPRESS_MF_BT Source/Tests/textrunner.cpp
Source/Tests/textrunner.cpp:22:2: warning: no newline at end of file

i586-mingw32msvc-g++ -o build/release/zip2exe/main.o -c Contrib/zip2exe/main.cpp
Contrib/zip2exe/main.cpp: In function `BOOL DlgProc(HWND__*, UINT, WPARAM, LPARAM)':
Contrib/zip2exe/main.cpp:671: warning: passing negative value `-0x000000001' for converting 2 of `UINT DragQueryFileA(HDROP__*, UINT, CHAR*, UINT)'

i586-mingw32msvc-gcc -o build/release/stub_zlib_solid/exec.o -c -Os -Wall -x c -fno-strict-aliasing -DEXEHEAD -DWIN32_LEAN_AND_MEAN -D_WIN32_IE=0x0500 -DNSIS_COMPRESS_USE_ZLIB -DZEXPORT=__stdcall -DNSIS_COMPRESS_WHOLE Source/exehead/exec.c
Source/exehead/exec.c: In function `ExecuteEntry':
Source/exehead/exec.c:1147: warning: unused variable `rkn'
Source/exehead/exec.c:1177: warning: unused variable `rkn'

i586-mingw32msvc-gcc -o build/release/nsExec/nsexec.o -c -Os -Wall -fno-strict-aliasing Contrib/nsExec/nsexec.c
Contrib/nsExec/nsexec.c: In function `ExecScript':
Contrib/nsExec/nsexec.c:258: warning: suggest parentheses around assignment used as truth value
Contrib/nsExec/nsexec.c:190: warning: 'hUnusedBuf' might be used uninitialized in this function
Contrib/nsExec/nsexec.c: At top level:
Contrib/nsExec/../ExDLL/exdll.h:106: warning: 'getuservariable' defined but not used
Contrib/nsExec/../ExDLL/exdll.h:112: warning: 'setuservariable' defined but not used

g++ -o build/release/makensis/tokens.o -c -O2 -Wall -m32 -D_WIN32_IE=0x0500 Source/tokens.cpp
Source/7zip/7zip/../Common/MyWindows.h:123: warning: 'struct IUnknown' has virtual functions but non-virtual destructor
Source/7zip/7zip/IStream.h:34: warning: 'struct ISequentialInStream' has virtual functions but non-virtual destructor
Source/7zip/7zip/IStream.h:47: warning: 'struct ISequentialOutStream' has virtual functions but non-virtual destructor
Source/7zip/7zip/IStream.h:57: warning: 'struct IInStream' has virtual functions but non-virtual destructor
Source/7zip/7zip/IStream.h:62: warning: 'struct IOutStream' has virtual functions but non-virtual destructor
Source/7zip/7zip/IStream.h:68: warning: 'struct IStreamGetSize' has virtual functions but non-virtual destructor
Source/7zip/7zip/IStream.h:73: warning: 'struct IOutStreamFlush' has virtual functions but non-virtual destructor
Source/7zip/7zip/Compress/LZMA/../../ICoder.h:30: warning: 'struct ICompressProgressInfo' has virtual functions but non-virtual destructor
Source/7zip/7zip/Compress/LZMA/../../ICoder.h:35: warning: 'struct ICompressCoder' has virtual functions but non-virtual destructor
Source/7zip/7zip/Compress/LZMA/../../ICoder.h:44: warning: 'struct ICompressCoder2' has virtual functions but non-virtual destructor
Source/7zip/7zip/Compress/LZMA/../../ICoder.h:76: warning: 'struct ICompressSetCoderProperties' has virtual functions but non-virtual destructor
Source/7zip/7zip/Compress/LZMA/../../ICoder.h:89: warning: 'struct ICompressSetDecoderProperties2' has virtual functions but non-virtual destructor
Source/7zip/7zip/Compress/LZMA/../../ICoder.h:94: warning: 'struct ICompressWriteCoderProperties' has virtual functions but non-virtual destructor
Source/7zip/7zip/Compress/LZMA/../../ICoder.h:99: warning: 'struct ICompressGetInStreamProcessedSize' has virtual functions but non-virtual destructor
Source/7zip/7zip/Compress/LZMA/../../ICoder.h:104: warning: 'struct ICompressSetCoderMt' has virtual functions but non-virtual destructor
Source/7zip/7zip/Compress/LZMA/../../ICoder.h:109: warning: 'struct ICompressGetSubStreamSize' has virtual functions but non-virtual destructor
Source/7zip/7zip/Compress/LZMA/../../ICoder.h:114: warning: 'struct ICompressSetInStream' has virtual functions but non-virtual destructor
Source/7zip/7zip/Compress/LZMA/../../ICoder.h:120: warning: 'struct ICompressSetOutStream' has virtual functions but non-virtual destructor
Source/7zip/7zip/Compress/LZMA/../../ICoder.h:126: warning: 'struct ICompressSetInStreamSize' has virtual functions but non-virtual destructor
Source/7zip/7zip/Compress/LZMA/../../ICoder.h:131: warning: 'struct ICompressSetOutStreamSize' has virtual functions but non-virtual destructor
Source/7zip/7zip/Compress/LZMA/../../ICoder.h:136: warning: 'struct ICompressFilter' has virtual functions but non-virtual destructor
Source/7zip/7zip/Compress/LZMA/../../ICoder.h:147: warning: 'struct ICryptoProperties' has virtual functions but non-virtual destructor
Source/7zip/7zip/Compress/LZMA/../../ICoder.h:153: warning: 'struct ICryptoSetPassword' has virtual functions but non-virtual destructor
Source/7zip/7zip/Compress/LZMA/../../ICoder.h:158: warning: 'struct ICryptoSetCRC' has virtual functions but non-virtual destructor
Source/7zip/7zip/Compress/LZMA/../LZ/IMatchFinder.h:22: warning: 'struct IInWindowStream' has virtual functions but non-virtual destructor
Source/7zip/7zip/Compress/LZMA/../LZ/IMatchFinder.h:35: warning: 'struct IMatchFinder' has virtual functions but non-virtual destructor
Source/7zip/7zip/Compress/LZMA/../LZ/IMatchFinder.h:43: warning: 'struct IMatchFinderSetNumPasses' has virtual functions but non-virtual destructor

g++ -o build/release/makensis/lang.o -c -O2 -Wall -m32 -D_WIN32_IE=0x0500 Source/lang.cpp
Source/lang.cpp:43: warning: non-local variable '<anonymous struct> NLFStrings [94]' uses anonymous type

g++ -o build/release/VPatch/Source/GenPat/main.o -c -O2 -Wall Contrib/VPatch/Source/GenPat/main.cpp
Contrib/VPatch/Source/GenPat/main.cpp: In function 'int main(int, char**)':
Contrib/VPatch/Source/GenPat/main.cpp:183: warning: 'previousPatchSize' may be used uninitialized in this function

i586-mingw32msvc-gcc -o build/release/UserInfo/UserInfo.o -c -Os -Wall -fno-strict-aliasing Contrib/UserInfo/UserInfo.c
Contrib/UserInfo/UserInfo.c: In function `GetAccountType':
Contrib/UserInfo/UserInfo.c:31: warning: missing braces around initializer
Contrib/UserInfo/UserInfo.c:31: warning: (near initialization for `SystemSidAuthority.Value')
Contrib/UserInfo/UserInfo.c:59: warning: suggest parentheses around assignment used as truth value
Contrib/UserInfo/UserInfo.c: At top level:
Contrib/UserInfo/../ExDLL/exdll.h:85: warning: 'popstring' defined but not used
Contrib/UserInfo/../ExDLL/exdll.h:106: warning: 'getuservariable' defined but not used
Contrib/UserInfo/../ExDLL/exdll.h:112: warning: 'setuservariable' defined but not used

i586-mingw32msvc-gcc -o build/release/StartMenu/StartMenu.o -c -Os -Wall -fno-strict-aliasing Contrib/StartMenu/StartMenu.c
Contrib/StartMenu/StartMenu.c: In function `Show':
Contrib/StartMenu/StartMenu.c:118: warning: unused variable `nResult'
Contrib/StartMenu/StartMenu.c: At top level:
Contrib/StartMenu/../ExDLL/exdll.h:106: warning: 'getuservariable' defined but not used
Contrib/StartMenu/../ExDLL/exdll.h:112: warning: 'setuservariable' defined but not used

i586-mingw32msvc-g++ -o build/release/NSISdl/nsisdl.o -c -Os -Wall -fno-strict-aliasing Contrib/NSISdl/nsisdl.cpp
Contrib/NSISdl/nsisdl.cpp: In function `void download(HWND__*, int, char*, stack_t**)':
Contrib/NSISdl/nsisdl.cpp:359: warning: 'cl' might be used uninitialized in this function

i586-mingw32msvc-g++ -o build/release/NSISdl/connection.o -c -Os -Wall -fno-strict-aliasing Contrib/NSISdl/connection.cpp
Contrib/NSISdl/connection.cpp: In member function `void JNL_Connection::run(int, int, int*, int*)':
Contrib/NSISdl/connection.cpp:151: warning: comparison between signed and unsigned integer expressions
Contrib/NSISdl/connection.cpp:152: warning: comparison between signed and unsigned integer expressions
Contrib/NSISdl/connection.cpp:153: warning: comparison between signed and unsigned integer expressions

i586-mingw32msvc-gcc -o build/release/Math/Source/MyMath.o -c -Os -Wall -fno-strict-aliasing -x c++ Contrib/Math/Source/MyMath.c
In file included from Contrib/Math/Source/MyMath.c:2:
Contrib/Math/Source/MyMath.h:166:51: warning: no newline at end of file
Contrib/Math/Source/MyMath.c: In function `void FloatFormatE(char*, double, int)':
Contrib/Math/Source/MyMath.c:279: warning: unused variable 'fzfill'

i586-mingw32msvc-gcc -o build/release/Math/Source/Math.o -c -Os -Wall -fno-strict-aliasing -x c++ Contrib/Math/Source/Math.c
In file included from Contrib/Math/Source/Math.c:2:
Contrib/Math/Source/Math.c: In function `void RunTree(ExpressionItem*, ExpressionItem*&, int)':
Contrib/Math/Source/Math.c:1449: warning: cast to pointer from integer of different size

i586-mingw32msvc-g++ -o build/release/Makensisw/utils.o -c -DRELEASE=2.2 Contrib/Makensisw/utils.cpp
Contrib/Makensisw/utils.cpp:31: warning: converting to non-pointer type `char' from NULL
Contrib/Makensisw/utils.cpp:31: warning: converting to non-pointer type `char' from NULL
Contrib/Makensisw/utils.cpp:31: warning: converting to non-pointer type `char' from NULL
Contrib/Makensisw/utils.cpp:31: warning: converting to non-pointer type `char' from NULL
Contrib/Makensisw/utils.cpp:31: warning: converting to non-pointer type `char' from NULL
Contrib/Makensisw/utils.cpp: In function `char* BuildSymbols()':
Contrib/Makensisw/utils.cpp:659: warning: converting to non-pointer type `char' from NULL

i586-mingw32msvc-g++ -o build/release/Makensisw/toolbar.o -c -DRELEASE=2.2 Contrib/Makensisw/toolbar.cpp
Contrib/Makensisw/toolbar.cpp: In function `void ShowToolbarDropdownMenu()':
Contrib/Makensisw/toolbar.cpp:224: warning: passing NULL used for non-pointer converting 2 of `BOOL TrackPopupMenu(HMENU__*, UINT, int, int, int, HWND__*, const RECT*)'

i586-mingw32msvc-g++ -o build/release/Makensisw/makensisw.o -c -DRELEASE=2.2 Contrib/Makensisw/makensisw.cpp
Contrib/Makensisw/makensisw.cpp: In function `BOOL DialogProc(HWND__*, UINT, WPARAM, LPARAM)':
Contrib/Makensisw/makensisw.cpp:106: warning: passing NULL used for non-pointer converting 3 of `LRESULT SendMessageA(HWND__*, UINT, WPARAM, LPARAM)'
Contrib/Makensisw/makensisw.cpp:210: warning: passing negative value `-0x000000001' for converting 2 of `UINT DragQueryFileA(HDROP__*, UINT, CHAR*, UINT)'
Contrib/Makensisw/makensisw.cpp:298: warning: passing NULL used for non-pointer converting 6 of `void* CreateFileA(const CHAR*, DWORD, DWORD, _SECURITY_ATTRIBUTES*, DWORD, DWORD, void*)'
Contrib/Makensisw/makensisw.cpp:305: warning: passing NULL used for non-pointer converting 6 of `void* CreateFileA(const CHAR*, DWORD, DWORD, _SECURITY_ATTRIBUTES*, DWORD, DWORD, void*)'
Contrib/Makensisw/makensisw.cpp: In function `BOOL SymbolSetProc(HWND__*, UINT, WPARAM, LPARAM)':
Contrib/Makensisw/makensisw.cpp:1180: warning: passing NULL used for non-pointer converting 4 of `LRESULT SendMessageA(HWND__*, UINT, WPARAM, LPARAM)'
Contrib/Makensisw/makensisw.cpp:1183: warning: passing NULL used for non-pointer converting 4 of `LRESULT SendMessageA(HWND__*, UINT, WPARAM, LPARAM)'

i586-mingw32msvc-g++ -o build/release/Library/TypeLib/TypeLib.o -c -Os -Wall -fno-strict-aliasing Contrib/Library/TypeLib/TypeLib.cpp
Contrib/Library/TypeLib/../../ExDLL/exdll.h:106: warning: 'char* getuservariable(int)' defined but not used
Contrib/Library/TypeLib/../../ExDLL/exdll.h:112: warning: 'void setuservariable(int, const char*)' defined but not used

i586-mingw32msvc-g++ -o build/release/InstallOptions/InstallerOptions.o -c -Os -Wall -fno-strict-aliasing Contrib/InstallOptions/InstallerOptions.cpp
Contrib/InstallOptions/InstallerOptions.cpp: In function `BOOL ParentWndProc(HWND__*, UINT, WPARAM, LPARAM)':
Contrib/InstallOptions/InstallerOptions.cpp:734: warning: comparison between signed and unsigned integer expressions
Contrib/InstallOptions/InstallerOptions.cpp: In function `int createCfgDlg()':
Contrib/InstallOptions/InstallerOptions.cpp:1096: warning: comparison between signed and unsigned integer expressions
Contrib/InstallOptions/InstallerOptions.cpp:1265: warning: passing negative value `-0x000000001' for converting 3 of `LRESULT mySendMessage(HWND__*, UINT, WPARAM, LPARAM)'
Contrib/InstallOptions/InstallerOptions.cpp:1278: warning: passing negative value `-0x000000001' for converting 3 of `LRESULT mySendMessage(HWND__*, UINT, WPARAM, LPARAM)'
Contrib/InstallOptions/../ExDLL/exdll.h: At global scope:
Contrib/InstallOptions/../ExDLL/exdll.h:85: warning: 'int dontuseme(char*)' defined but not used
Contrib/InstallOptions/../ExDLL/exdll.h:106: warning: 'char* getuservariable(int)' defined but not used
Contrib/InstallOptions/../ExDLL/exdll.h:112: warning: 'void setuservariable(int, const char*)' defined but not used

i586-mingw32msvc-g++ -o build/release/BgImage/BgImage.o -c -Os -Wall -fno-strict-aliasing Contrib/BgImage/BgImage.cpp
Contrib/BgImage/BgImage.cpp: In function `void SetBg(HWND__*, int, char*, stack_t**)':
Contrib/BgImage/BgImage.cpp:120: warning: cast to pointer from integer of different size
Contrib/BgImage/BgImage.cpp: In function `void AddImage(HWND__*, int, char*, stack_t**)':
Contrib/BgImage/BgImage.cpp:228: warning: converting of negative value `-0x000000001' to `COLORREF'

Discussion

  • Amir Szekely

    Amir Szekely - 2007-03-09

    Logged In: YES
    user_id=584402
    Originator: NO

    Sure, go ahead. As long as it works on Windows as well and doesn't break backward compatibility, change whatever you want. At the worst case, I'll fit it later.

    As for the non-virtual destructors, that's how the code comes from 7z. It'd probably be better to disable the warning using -Wno-non-virtual-dtor than modifying all the source code.

     
  • Paul Wise

    Paul Wise - 2007-03-11

    Logged In: YES
    user_id=35028
    Originator: YES

    308 warnings left, down from 358

    Summary of the remainder and possible solutions:

    LZMA 'has virtual functions but non-virtual destructor'
    Maybe upstream has fixed this?
    lots of warnings from variables in Contrib/ExDLL/exdll.h not being used
    hmmmmm
    Source/exehead/exec.c bogus 'warning: unused variable `rkn'
    Dunno what is wrong with g++ here, rkn is used in the log_printf calls
    Contrib/Makensisw/utils.cpp:31 generates 5 warnings: 'converting to non-pointer type `char' from NULL'
    Maybe change them to '\0' or ""?
    Contrib/Math/Source/Math.c:1449: warning: cast to pointer from integer of different size
    unsure about this
    Contrib/InstallOptions/InstallerOptions.cpp:1096: warning: comparison between signed and unsigned integer expressions
    bit complex for after midnight brains

    And the rest are some problems in windows or other headers.

     
  • Amir Szekely

    Amir Szekely - 2007-03-14

    Logged In: YES
    user_id=584402
    Originator: NO

    The latest LZMA SDK is used. Or at least, the non-beta latest. There's 4.44 beta and we're using 4.43.

    rkn is not used because log_printf is defined as nothing when NSIS_SUPPORT_LOGGING is not defined.

     
  • Paul Wise

    Paul Wise - 2007-04-01

    warning removal patch

     
  • Paul Wise

    Paul Wise - 2007-04-01

    Logged In: YES
    user_id=35028
    Originator: YES

    After applying the attached patch (please review) to CVS, I get only these warnings (skipped System and NSIS Menu):

    Contrib/Math/Source/Math.c: In function `void RunTree(ExpressionItem*, ExpressionItem*&, int)':
    Contrib/Math/Source/Math.c:1449: warning: cast to pointer from integer of different size

    Math.c line 1449 contains

    aritem->param2 = (EIPARAM) *((__int64*)&(index->param1));

    Contrib/NSISdl/connection.cpp: In member function `void JNL_Connection::run(int, int, int*, int*)':
    Contrib/NSISdl/connection.cpp:151: warning: comparison between signed and unsigned integer expressions
    Contrib/NSISdl/connection.cpp:152: warning: comparison between signed and unsigned integer expressions
    Contrib/NSISdl/connection.cpp:153: warning: comparison between signed and unsigned integer expressions

    Those three lines have this:

    FD_SET(m_socket,&f[0]);

    After that there are some warnings from the test source code:

    Source/Tests/compression.cpp: In member function 'void CompressionTest::randData(IGrowBuf&, int)':
    Source/Tests/compression.cpp:22: warning: comparison between signed and unsigned integer expressions

    Source/Tests/mmap.cpp: In member function 'void MMapTest::testMMapFile()':
    Source/Tests/mmap.cpp:47: warning: comparison between signed and unsigned integer expressions

    Source/7zip/LZMADecode.c: In function 'lzmaDecode':
    Source/7zip/LZMADecode.c:236: warning: dereferencing type-punned pointer will break strict-aliasing rules
    Source/7zip/LZMADecode.c:237: warning: dereferencing type-punned pointer will break strict-aliasing rules
    Source/7zip/LZMADecode.c:238: warning: dereferencing type-punned pointer will break strict-aliasing rules
    Source/7zip/LZMADecode.c:239: warning: dereferencing type-punned pointer will break strict-aliasing rules
    Source/7zip/LZMADecode.c:245: warning: dereferencing type-punned pointer will break strict-aliasing rules
    Source/7zip/LZMADecode.c:274: warning: dereferencing type-punned pointer will break strict-aliasing rules
    Source/7zip/LZMADecode.c:277: warning: dereferencing type-punned pointer will break strict-aliasing rules
    Source/7zip/LZMADecode.c:334: warning: dereferencing type-punned pointer will break strict-aliasing rules
    Source/7zip/LZMADecode.c:337: warning: dereferencing type-punned pointer will break strict-aliasing rules
    Source/7zip/LZMADecode.c:340: warning: dereferencing type-punned pointer will break strict-aliasing rules
    Source/7zip/LZMADecode.c:362: warning: dereferencing type-punned pointer will break strict-aliasing rules
    Source/7zip/LZMADecode.c:369: warning: dereferencing type-punned pointer will break strict-aliasing rules
    Source/7zip/LZMADecode.c:382: warning: dereferencing type-punned pointer will break strict-aliasing rules
    Source/7zip/LZMADecode.c:391: warning: dereferencing type-punned pointer will break strict-aliasing rules
    Source/7zip/LZMADecode.c:392: warning: dereferencing type-punned pointer will break strict-aliasing rules
    Source/7zip/LZMADecode.c:403: warning: dereferencing type-punned pointer will break strict-aliasing rules
    Source/7zip/LZMADecode.c:430: warning: dereferencing type-punned pointer will break strict-aliasing rules

    Source/zlib/INFBLOCK.C: In function 'inflate_flush':
    Source/zlib/INFBLOCK.C:115: warning: implicit declaration of function 'memcpy'
    Source/zlib/INFBLOCK.C:115: warning: incompatible implicit declaration of built-in function 'memcpy'
    Source/zlib/INFBLOCK.C: In function 'inflate':
    Source/zlib/INFBLOCK.C:442: warning: incompatible implicit declaration of built-in function 'memcpy'
    Source/zlib/INFBLOCK.C:477: warning: pointer targets in passing argument 4 of 'huft_build' differ in signedness
    Source/zlib/INFBLOCK.C:477: warning: pointer targets in passing argument 5 of 'huft_build' differ in signedness
    Source/zlib/INFBLOCK.C: In function 'huft_build':
    Source/zlib/INFBLOCK.C:160: warning: 'r.base' may be used uninitialized in this function

    Plus a few warnings and errors from makensis when running the test .nsi files.
    File Added: remove-warnings.patch

     
  • Amir Szekely

    Amir Szekely - 2007-04-01

    Logged In: YES
    user_id=584402
    Originator: NO

    I still think -Wno-non-virtual-dtor would be a better idea as it won't require changing 7z source code for every new release.

    SECURITY_NT_AUTHORITY is already defined as {0,0,0,0,5}. Why the extra braces?

    Everything else is good to go.

     
  • Paul Wise

    Paul Wise - 2007-04-02

    Logged In: YES
    user_id=35028
    Originator: YES

    Re -Wno-non-virtual-dtor, sounds good as long as you can restrict it to the 7z code.

    In the mingw winnt.h include file, I see this comment a few lines up from the definition of SECURITY_NT_AUTHORITY:

    /*
    * To prevent gcc compiler warnings, bracket these defines when initialising
    * a SID_IDENTIFIER_AUTHORITY, eg.
    * SID_IDENTIFIER_AUTHORITY aNullSidAuthority = {SECURITY_NULL_SID_AUTHORITY};
    */

     
  • Amir Szekely

    Amir Szekely - 2007-04-02

    Logged In: YES
    user_id=584402
    Originator: NO

    7z code already has specific defines in Source\SConscript for COMPRESS_MF_BT. The only question is how to add it nicely so it'd only show for gcc. Probably another flag named IGNORE_VDTOR_WARNINGS which will be empty for all other configurations and -Wno-non-virtual-dtor for gnu.

    Ah, SID_IDENTIFIER_AUTHORITY is defined as a structure containing an array. That makes sense.

     
  • Paul Wise

    Paul Wise - 2007-04-02

    Logged In: YES
    user_id=35028
    Originator: YES

    Committed the patch, except for the 7zip stuff.

     
  • Amir Szekely

    Amir Szekely - 2007-04-11
    • status: open --> pending-fixed
     
  • Amir Szekely

    Amir Szekely - 2007-04-11

    Logged In: YES
    user_id=584402
    Originator: NO

    I've added -Wno-non-virtual-dtor and fixed quite a lot of other warnings found with cl /W4. I still have a few to go, but they probably won't show without -Wall on gcc. So we can see this issue as closed, right?

     
  • Paul Wise

    Paul Wise - 2007-04-12

    Logged In: YES
    user_id=35028
    Originator: YES

    -Wno-non-virtual-dtor needs to be included in anything that potentially references 7z headers (inc Source/build.cpp, the lzma tests and similar). ATM, it only seems to be set when building the lzma code. Plus there are some other warnings that aren't fixed yet, will post soon.

     
  • Paul Wise

    Paul Wise - 2007-04-12
    • status: pending-fixed --> open-fixed
     
  • Amir Szekely

    Amir Szekely - 2007-04-13

    Logged In: YES
    user_id=584402
    Originator: NO

    I've moved -Wno-non-virtual-dtor to makensis_env so it'll cover everything. I can't think of any better way to cover just files that include something related to 7-zip. Fixing it at 7-zip's side will probably work best here.

     
  • Paul Wise

    Paul Wise - 2007-04-16

    Logged In: YES
    user_id=35028
    Originator: YES

    Hmm, I'm getting a few warnings about -Wno-non-virtual-dtor being only for C++ code. Also it needs to be applied to the LZMA tests as well.

    The rest of the warnings I could trigger before the FTBFS:

    g++ -o build/release/tests/required/exehead/zlib/INFBLOCK.o -c -Wall -g -O2 -x c -DCOMPRESS_MF_BT -DEXEHEAD -DNSIS_COMPRESS_USE_ZLIB Source/zlib/INFBLOCK.C
    Source/zlib/INFBLOCK.C: In function 'inflate_flush':
    Source/zlib/INFBLOCK.C:115: warning: implicit declaration of function 'memcpy'
    Source/zlib/INFBLOCK.C:115: warning: incompatible implicit declaration of built-in function 'memcpy'
    Source/zlib/INFBLOCK.C: In function 'inflate':
    Source/zlib/INFBLOCK.C:442: warning: incompatible implicit declaration of built-in function 'memcpy'
    Source/zlib/INFBLOCK.C:477: warning: pointer targets in passing argument 4 of 'huft_build' differ in signedness
    Source/zlib/INFBLOCK.C:477: warning: pointer targets in passing argument 5 of 'huft_build' differ in signedness
    Source/zlib/INFBLOCK.C: In function 'huft_build':
    Source/zlib/INFBLOCK.C:160: warning: 'r.base' may be used uninitialized in this function

    i586-mingw32msvc-gcc -o build/release/Math/Source/Math.o -c -Os -Wall -fno-strict-aliasing -x c++ Contrib/Math/Source/Math.c
    Contrib/Math/Source/Math.c: In function `void RunTree(ExpressionItem*, ExpressionItem*&, int)':
    Contrib/Math/Source/Math.c:1449: warning: cast to pointer from integer of different size

    i586-mingw32msvc-g++ -o build/release/NSISdl/connection.o -c -Os -Wall -fno-strict-aliasing Contrib/NSISdl/connection.cpp
    Contrib/NSISdl/connection.cpp: In member function `void JNL_Connection::run(int, int, int*, int*)':
    Contrib/NSISdl/connection.cpp:151: warning: comparison between signed and unsigned integer expressions
    Contrib/NSISdl/connection.cpp:152: warning: comparison between signed and unsigned integer expressions
    Contrib/NSISdl/connection.cpp:153: warning: comparison between signed and unsigned integer expressions

     
  • Paul Wise

    Paul Wise - 2007-04-17

    Logged In: YES
    user_id=35028
    Originator: YES

    Fixed the FTBFS, more warnings:

    Contrib/Makensisw/makensisw.h:146: warning: 'BOOL DialogProc(HWND__*, UINT, WPARAM, LPARAM)' declared `static' but never defined

    i586-mingw32msvc-gcc -o build/release/zip2exe/zlib/crc32.o -c -Wall -g -O2 -O2 -Wall -fno-strict-aliasing -Ibuild/release/zip2exe -IContrib/zip2exe Contrib/zip2exe/zlib/crc32.c
    Contrib/zip2exe/main.cpp: In function `void makeEXE(HWND__*)':
    Contrib/zip2exe/main.cpp:492: warning: unused variable 'outpath'
    Contrib/zip2exe/main.cpp: In function `BOOL DlgProc(HWND__*, UINT, WPARAM, LPARAM)':
    Contrib/zip2exe/main.cpp:736: warning: comparison between signed and unsigned integer expressions
    Contrib/zip2exe/main.cpp:768: warning: comparison between signed and unsigned integer expressions

    i586-mingw32msvc-gcc -o build/release/zip2exe/zlib/unzip.o -c -Wall -g -O2 -O2 -Wall -fno-strict-aliasing -Ibuild/release/zip2exe -IContrib/zip2exe Contrib/zip2exe/zlib/unzip.c
    Contrib/zip2exe/zlib/unzip.c: In function `unzlocal_GetCurrentFileInfoInternal':
    Contrib/zip2exe/zlib/unzip.c:610: warning: suggest explicit braces to avoid ambiguous `else'
    Contrib/zip2exe/zlib/unzip.c:690: warning: suggest explicit braces to avoid ambiguous `else'
    Contrib/zip2exe/zlib/unzip.c:715: warning: suggest explicit braces to avoid ambiguous `else'
    Contrib/zip2exe/zlib/unzip.c: In function `unzlocal_CheckCurrentFileCoherencyHeader':
    Contrib/zip2exe/zlib/unzip.c:979: warning: suggest explicit braces to avoid ambiguous `else'
    Contrib/zip2exe/zlib/unzip.c: In function `unzGetGlobalComment':
    Contrib/zip2exe/zlib/unzip.c:1537: warning: unused variable `err'

    gcc -o build/release/tests/required/7zip/LZMADecode.o -c -Wall -g -O2 -DCOMPRESS_MF_BT -Ibuild/release/tests -ISource/Tests Source/7zip/LZMADecode.c
    Source/7zip/LZMADecode.c: In function 'lzmaDecode':
    Source/7zip/LZMADecode.c:236: warning: dereferencing type-punned pointer will break strict-aliasing rules
    Source/7zip/LZMADecode.c:237: warning: dereferencing type-punned pointer will break strict-aliasing rules
    Source/7zip/LZMADecode.c:238: warning: dereferencing type-punned pointer will break strict-aliasing rules
    Source/7zip/LZMADecode.c:239: warning: dereferencing type-punned pointer will break strict-aliasing rules
    Source/7zip/LZMADecode.c:245: warning: dereferencing type-punned pointer will break strict-aliasing rules
    Source/7zip/LZMADecode.c:274: warning: dereferencing type-punned pointer will break strict-aliasing rules
    Source/7zip/LZMADecode.c:277: warning: dereferencing type-punned pointer will break strict-aliasing rules
    Source/7zip/LZMADecode.c:334: warning: dereferencing type-punned pointer will break strict-aliasing rules
    Source/7zip/LZMADecode.c:337: warning: dereferencing type-punned pointer will break strict-aliasing rules
    Source/7zip/LZMADecode.c:340: warning: dereferencing type-punned pointer will break strict-aliasing rules
    Source/7zip/LZMADecode.c:362: warning: dereferencing type-punned pointer will break strict-aliasing rules
    Source/7zip/LZMADecode.c:369: warning: dereferencing type-punned pointer will break strict-aliasing rules
    Source/7zip/LZMADecode.c:382: warning: dereferencing type-punned pointer will break strict-aliasing rules
    Source/7zip/LZMADecode.c:391: warning: dereferencing type-punned pointer will break strict-aliasing rules
    Source/7zip/LZMADecode.c:392: warning: dereferencing type-punned pointer will break strict-aliasing rules
    Source/7zip/LZMADecode.c:403: warning: dereferencing type-punned pointer will break strict-aliasing rules
    Source/7zip/LZMADecode.c:430: warning: dereferencing type-punned pointer will break strict-aliasing rules

     
  • Paul Wise

    Paul Wise - 2007-04-17
    • status: open-fixed --> open
     
  • Paul Wise

    Paul Wise - 2007-10-11

    Logged In: YES
    user_id=35028
    Originator: YES

    With the new version of mingw32, I get tons and tons of these:

    Contrib/MakeLangId/MakeLangId.cpp:185: warning: deprecated conversion from string constant to 'char*'

    A sample of line numbers with svn 5335:

    Contrib/BgImage/BgImage.cpp:114
    Contrib/BgImage/BgImage.cpp:133
    Contrib/BgImage/BgImage.cpp:214
    Contrib/BgImage/BgImage.cpp:222
    Contrib/BgImage/BgImage.cpp:254
    Contrib/BgImage/BgImage.cpp:264
    Contrib/BgImage/BgImage.cpp:274
    Contrib/BgImage/BgImage.cpp:292
    Contrib/BgImage/BgImage.cpp:563
    Contrib/InstallOptions/InstallerOptions.cpp:416
    Contrib/InstallOptions/InstallerOptions.cpp:465
    Contrib/InstallOptions/InstallerOptions.cpp:495
    Contrib/InstallOptions/InstallerOptions.cpp:499
    Contrib/InstallOptions/InstallerOptions.cpp:585
    Contrib/InstallOptions/InstallerOptions.cpp:1108
    Contrib/MakeLangId/MakeLangId.cpp:90
    Contrib/MakeLangId/MakeLangId.cpp:185
    Contrib/Makensisw/jnetlib/connection.cpp:16
    Contrib/Makensisw/jnetlib/connection.cpp:57
    Contrib/Makensisw/jnetlib/connection.cpp:69
    Contrib/Makensisw/jnetlib/connection.cpp:80
    Contrib/Makensisw/jnetlib/connection.cpp:131
    Contrib/Makensisw/jnetlib/connection.cpp:142
    Contrib/Makensisw/jnetlib/connection.cpp:160
    Contrib/Makensisw/jnetlib/connection.cpp:169
    Contrib/Makensisw/jnetlib/httpget.h:74
    Contrib/Makensisw/jnetlib/httpget.cpp:148
    Contrib/Makensisw/jnetlib/httpget.cpp:178
    Contrib/Makensisw/jnetlib/httpget.cpp:227
    Contrib/Makensisw/jnetlib/httpget.cpp:274
    Contrib/Makensisw/jnetlib/httpget.cpp:274
    Contrib/Makensisw/jnetlib/httpget.cpp:318
    Contrib/Makensisw/jnetlib/httpget.cpp:366
    Contrib/Makensisw/jnetlib/httpget.cpp:367
    Contrib/Makensisw/jnetlib/httpget.cpp:367
    Contrib/Makensisw/jnetlib/httpget.cpp:391
    Contrib/Makensisw/makensisw.h:103
    Contrib/Makensisw/makensisw.h:111
    Contrib/Makensisw/makensisw.cpp:388
    Contrib/Makensisw/makensisw.cpp:390
    Contrib/Makensisw/makensisw.cpp:397
    Contrib/Makensisw/makensisw.cpp:986
    Contrib/Makensisw/makensisw.cpp:1028
    Contrib/Makensisw/makensisw.cpp:1285
    Contrib/Makensisw/update.cpp:61
    Contrib/Makensisw/update.cpp:66
    Contrib/Makensisw/update.cpp:68
    Contrib/Makensisw/update.cpp:78
    Contrib/Makensisw/update.cpp:79
    Contrib/Makensisw/update.cpp:132
    Contrib/NSISdl/connection.cpp:16
    Contrib/NSISdl/connection.cpp:55
    Contrib/NSISdl/connection.cpp:67
    Contrib/NSISdl/connection.cpp:78
    Contrib/NSISdl/connection.cpp:129
    Contrib/NSISdl/connection.cpp:140
    Contrib/NSISdl/connection.cpp:158
    Contrib/NSISdl/connection.cpp:167
    ontrib/NSISdl/httpget.cpp:146
    Contrib/NSISdl/httpget.cpp:176
    Contrib/NSISdl/httpget.cpp:225
    Contrib/NSISdl/httpget.cpp:272
    Contrib/NSISdl/httpget.cpp:316
    Contrib/NSISdl/httpget.cpp:364
    Contrib/NSISdl/httpget.cpp:365
    Contrib/NSISdl/httpget.cpp:389
    Contrib/NSISdl/httpget.cpp:487
    Contrib/NSISdl/nsisdl.cpp:379
    Contrib/NSISdl/nsisdl.cpp:384
    Contrib/NSISdl/nsisdl.cpp:386
    Contrib/NSISdl/nsisdl.cpp:406
    Contrib/NSISdl/nsisdl.cpp:407
    Contrib/NSISdl/nsisdl.cpp:413
    Contrib/NSISdl/nsisdl.cpp:432
    Contrib/NSISdl/nsisdl.cpp:436
    Contrib/NSISdl/nsisdl.cpp:443
    Contrib/NSISdl/nsisdl.cpp:449
    Contrib/NSISdl/nsisdl.cpp:451
    Contrib/NSISdl/nsisdl.cpp:463
    Contrib/NSISdl/nsisdl.cpp:542
    Contrib/NSISdl/nsisdl.cpp:549
    Contrib/NSISdl/nsisdl.cpp:558
    Contrib/NSISdl/nsisdl.cpp:565
    Source/build.cpp:913
    Source/build.cpp:915
    Source/build.cpp:1466
    Source/build.cpp:1586
    Source/build.cpp:1643
    Source/build.cpp:1645
    Source/build.cpp:1647
    Source/build.cpp:1903
    Source/build.cpp:1940
    Source/build.cpp:3228
    Source/build.cpp:3264
    Source/lang.cpp:141
    Source/lang.cpp:380
    Source/lang.cpp:382
    Source/lang.cpp:819
    Source/lineparse.cpp:116
    Source/makenssi.cpp:334
    Source/script.cpp:3642
    Source/script.cpp:3824
    Source/script.cpp:4501
    Source/script.cpp:4789
    Source/script.cpp:4790
    Source/script.cpp:4797
    Source/script.cpp:5308
    Source/script.cpp:5841
    Source/tokens.cpp:281
    Contrib/zip2exe/main.cpp:53
    Contrib/zip2exe/main.cpp:302
    Contrib/zip2exe/main.cpp:303
    Contrib/zip2exe/main.cpp:304
    Contrib/zip2exe/main.cpp:305
    Contrib/zip2exe/main.cpp:306
    Contrib/zip2exe/main.cpp:307
    Contrib/zip2exe/main.cpp:384
    Contrib/zip2exe/main.cpp:407
    Contrib/zip2exe/main.cpp:508
    Contrib/zip2exe/main.cpp:513

     
  • Amir Szekely

    Amir Szekely - 2007-10-14

    Logged In: YES
    user_id=584402
    Originator: NO

    Does BgImage's warnings go away if you make my_pushstring accept const char*?

     
  • Paul Wise

    Paul Wise - 2007-10-15

    Logged In: YES
    user_id=35028
    Originator: YES

    Yep.

    I went through the other ones, but for many I ran into issues with Win32 functions or some other part of the code.

    Using the -Wno-write-strings option might be a good idea.

     
  • Amir Szekely

    Amir Szekely - 2007-10-16

    Logged In: YES
    user_id=584402
    Originator: NO

    But there's no real need for those strings to be writable. pushstring and friends can and should accept const char pointers.

     

Log in to post a comment.