Menu

#226 The build fails with GCC 10

v1.0 (example)
open
None
2
2023-09-16
2019-12-06
No

Hello,
It seems that p7zip fails to build with GCC 10:

[    9s] ../../../../CPP/Windows/ErrorMsg.cpp: In function 'UString NWindows::NError::MyFormatMessage(DWORD)':
[    9s] ../../../../CPP/Common/MyWindows.h:83:40: error: narrowing conversion of '-2147467263' from 'LONG' {aka 'int'} to 'unsigned int' [-Wnarrowing]
[    9s]    83 | #define E_NOTIMPL ((HRESULT)0x80004001L)
[    9s]       |                                        ^
[    9s] ../../../../CPP/Windows/ErrorMsg.cpp:18:10: note: in expansion of macro 'E_NOTIMPL'
[    9s]    18 |     case E_NOTIMPL             : txt = "E_NOTIMPL"; break ;
[    9s]       |          ^~~~~~~~~
[    9s] ../../../../CPP/Common/MyWindows.h:84:44: error: narrowing conversion of '-2147467262' from 'LONG' {aka 'int'} to 'unsigned int' [-Wnarrowing]
[    9s]    84 | #define E_NOINTERFACE ((HRESULT)0x80004002L)
[    9s]       |                                            ^
[    9s] ../../../../CPP/Windows/ErrorMsg.cpp:19:10: note: in expansion of macro 'E_NOINTERFACE'
[    9s]    19 |     case E_NOINTERFACE         : txt = "E_NOINTERFACE"; break ;
[    9s]       |          ^~~~~~~~~~~~~
[    9s] ../../../../CPP/Common/MyWindows.h:85:38: error: narrowing conversion of '-2147467260' from 'LONG' {aka 'int'} to 'unsigned int' [-Wnarrowing]
[    9s]    85 | #define E_ABORT ((HRESULT)0x80004004L)
[    9s]       |                                      ^
[    9s] ../../../../CPP/Windows/ErrorMsg.cpp:20:10: note: in expansion of macro 'E_ABORT'
[    9s]    20 |     case E_ABORT               : txt = "E_ABORT"; break ;
[    9s]       |          ^~~~~~~
[    9s] ../../../../CPP/Common/MyWindows.h:86:37: error: narrowing conversion of '-2147467259' from 'LONG' {aka 'int'} to 'unsigned int' [-Wnarrowing]
[    9s]    86 | #define E_FAIL ((HRESULT)0x80004005L)
[    9s]       |                                     ^
[    9s] ../../../../CPP/Windows/ErrorMsg.cpp:21:10: note: in expansion of macro 'E_FAIL'
[    9s]    21 |     case E_FAIL                : txt = "E_FAIL"; break ;
[    9s]       |          ^~~~~~
[    9s] ../../../../CPP/Common/MyWindows.h:87:52: error: narrowing conversion of '-2147287039' from 'LONG' {aka 'int'} to 'unsigned int' [-Wnarrowing]
[    9s]    87 | #define STG_E_INVALIDFUNCTION ((HRESULT)0x80030001L)

Thank you!

Discussion

  • adrian_007

    adrian_007 - 2020-05-27

    That should do it:

    --- a/CPP/Windows/ErrorMsg.cpp  2020-05-28 00:35:02.729896917 +0200
    +++ b/CPP/Windows/ErrorMsg.cpp  2020-05-28 00:40:01.676442629 +0200
    @@ -13,7 +13,7 @@
       const char * txt = 0;
       AString msg;
    
    
    -  switch(errorCode) {
    +  switch(HRESULT(errorCode)) {
         case ERROR_NO_MORE_FILES   : txt = "No more files"; break ;
         case E_NOTIMPL             : txt = "E_NOTIMPL"; break ;
         case E_NOINTERFACE         : txt = "E_NOINTERFACE"; break ;
    @@ -43,7 +43,7 @@
       const char * txt = 0;
       AString msg;
    
    
    -  switch(messageID) {
    +  switch(HRESULT(messageID)) {
         case ERROR_NO_MORE_FILES   : txt = "No more files"; break ;
         case E_NOTIMPL             : txt = "E_NOTIMPL"; break ;
         case E_NOINTERFACE         : txt = "E_NOINTERFACE"; break ;
    
     
  • Dan Essin

    Dan Essin - 2023-02-17

    Whatever this was/is it "should do it" but it doesn't
    This is precisely what is in the downloaded code and it does not compile. Generates the same errors as above.

     
    • Sam Tansy

      Sam Tansy - 2023-09-16

      Have you tried 7zip? It has Linux version now, v23 for that matter, so this may be better option than here. P7zip 17.xx is somewhat maintained here.

       

Log in to post a comment.

MongoDB Logo MongoDB