Bug 224930 - archivers/p7zip: fails to build with clang 6.0 (blocks 49 ports)
Summary: archivers/p7zip: fails to build with clang 6.0 (blocks 49 ports)
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Raphael Kubo da Costa
URL:
Keywords:
Depends on:
Blocks: 224669
  Show dependency treegraph
 
Reported: 2018-01-05 12:39 UTC by Jan Beich
Modified: 2018-01-05 21:46 UTC (History)
0 users

See Also:
rakuco: maintainer-feedback+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Beich freebsd_committer freebsd_triage 2018-01-05 12:39:06 UTC
FreeBSD -CURRENT plans to update base Clang to 6.0.0 soon. While testing this port failed to build.

../../../../CPP/Windows/ErrorMsg.cpp:24:10: error: case value evaluates to -2147024809, which cannot
      be narrowed to type 'DWORD' (aka 'unsigned int') [-Wc++11-narrowing]
    case E_INVALIDARG          : txt = "E_INVALIDARG"; break ;
         ^
../../../../CPP/Common/MyWindows.h:89:22: note: expanded from macro 'E_INVALIDARG'
#define E_INVALIDARG ((HRESULT)0x80070057L)
                     ^
../../../../CPP/Windows/ErrorMsg.cpp:23:10: error: case value evaluates to -2147024882, which cannot
      be narrowed to type 'DWORD' (aka 'unsigned int') [-Wc++11-narrowing]
    case E_OUTOFMEMORY         : txt = "E_OUTOFMEMORY"; break ;
         ^
../../../../CPP/Common/MyWindows.h:88:23: note: expanded from macro 'E_OUTOFMEMORY'
#define E_OUTOFMEMORY ((HRESULT)0x8007000EL)
                      ^
../../../../CPP/Windows/ErrorMsg.cpp:22:10: error: case value evaluates to -2147287039, which cannot
      be narrowed to type 'DWORD' (aka 'unsigned int') [-Wc++11-narrowing]
    case STG_E_INVALIDFUNCTION : txt = "STG_E_INVALIDFUNCTION"; break ;
         ^
../../../../CPP/Common/MyWindows.h:87:31: note: expanded from macro 'STG_E_INVALIDFUNCTION'
#define STG_E_INVALIDFUNCTION ((HRESULT)0x80030001L)
                              ^
../../../../CPP/Windows/ErrorMsg.cpp:21:10: error: case value evaluates to -2147467259, which cannot
      be narrowed to type 'DWORD' (aka 'unsigned int') [-Wc++11-narrowing]
    case E_FAIL                : txt = "E_FAIL"; break ;
         ^
../../../../CPP/Common/MyWindows.h:86:16: note: expanded from macro 'E_FAIL'
#define E_FAIL ((HRESULT)0x80004005L)
               ^
../../../../CPP/Windows/ErrorMsg.cpp:20:10: error: case value evaluates to -2147467260, which cannot
      be narrowed to type 'DWORD' (aka 'unsigned int') [-Wc++11-narrowing]
    case E_ABORT               : txt = "E_ABORT"; break ;
         ^
../../../../CPP/Common/MyWindows.h:85:17: note: expanded from macro 'E_ABORT'
#define E_ABORT ((HRESULT)0x80004004L)
                ^
../../../../CPP/Windows/ErrorMsg.cpp:19:10: error: case value evaluates to -2147467262, which cannot
      be narrowed to type 'DWORD' (aka 'unsigned int') [-Wc++11-narrowing]
    case E_NOINTERFACE         : txt = "E_NOINTERFACE"; break ;
         ^
../../../../CPP/Common/MyWindows.h:84:23: note: expanded from macro 'E_NOINTERFACE'
#define E_NOINTERFACE ((HRESULT)0x80004002L)
                      ^
../../../../CPP/Windows/ErrorMsg.cpp:18:10: error: case value evaluates to -2147467263, which cannot
      be narrowed to type 'DWORD' (aka 'unsigned int') [-Wc++11-narrowing]
    case E_NOTIMPL             : txt = "E_NOTIMPL"; break ;
         ^
../../../../CPP/Common/MyWindows.h:83:19: note: expanded from macro 'E_NOTIMPL'
#define E_NOTIMPL ((HRESULT)0x80004001L)
                  ^

To reproduce:
$ poudriere jail -cj clang6-amd64 -a amd64 -v projects/clang600-import -m svn+https
$ poudriere bulk -Ctj clang6-amd64 archivers/p7zip

http://package18.nyi.freebsd.org/data/headamd64PR224669-default/2018-01-02_08h32m49s/logs/errors/p7zip-16.02.log
Comment 1 Jan Beich freebsd_committer freebsd_triage 2018-01-05 12:47:24 UTC
GCC 6+ doesn't complain. Maybe try the following:

USES+=		compiler
CXXFLAGS+=	${CXXFLAGS_${CHOSEN_COMPILER_TYPE}}
CXXFLAGS_clang=	-Wno-error=narrowing
Comment 2 commit-hook freebsd_committer freebsd_triage 2018-01-05 21:45:53 UTC
A commit references this bug:

Author: rakuco
Date: Fri Jan  5 21:45:14 UTC 2018
New revision: 458172
URL: https://svnweb.freebsd.org/changeset/ports/458172

Log:
  Add a patch to fix the build with Clang 6.0.

      ../../../../CPP/Windows/ErrorMsg.cpp:24:10: error: case value evaluates to -2147024809, which cannot be narrowed to type 'DWORD' (aka 'unsigned int') [-Wc++11-narrowing]
          case E_INVALIDARG          : txt = "E_INVALIDARG"; break ;
               ^
      ../../../../CPP/Common/MyWindows.h:89:22: note: expanded from macro 'E_INVALIDARG'
      #define E_INVALIDARG ((HRESULT)0x80070057L)
                           ^

  HRESULT causes the macro to be parsed as a signed long, so we need to force it
  to be checked as an unsigned long instead.

  PR:		224930

Changes:
  head/archivers/p7zip/files/patch-CPP_Windows_ErrorMsg.cpp