From owner-freebsd-ports-bugs@freebsd.org Fri Aug 10 23:48:10 2018 Return-Path: Delivered-To: freebsd-ports-bugs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 412371078CBC for ; Fri, 10 Aug 2018 23:48:10 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id 7144481856 for ; Fri, 10 Aug 2018 23:48:09 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: by mailman.ysv.freebsd.org (Postfix) id 3340E1078CB7; Fri, 10 Aug 2018 23:48:09 +0000 (UTC) Delivered-To: ports-bugs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 112D01078CB6 for ; Fri, 10 Aug 2018 23:48:09 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.ysv.freebsd.org (mxrelay.ysv.freebsd.org [IPv6:2001:1900:2254:206a::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.ysv.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9A1FF81850 for ; Fri, 10 Aug 2018 23:48:08 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.ysv.freebsd.org (Postfix) with ESMTPS id DFF2BAECB for ; Fri, 10 Aug 2018 23:48:07 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id w7ANm7Pl070956 for ; Fri, 10 Aug 2018 23:48:07 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id w7ANm7Hk070955 for ports-bugs@FreeBSD.org; Fri, 10 Aug 2018 23:48:07 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: ports-bugs@FreeBSD.org Subject: [Bug 230517] lang/dmd2: compile error: "[-Wc++11-narrowing]" Date: Fri, 10 Aug 2018 23:48:07 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Ports & Packages X-Bugzilla-Component: Individual Port(s) X-Bugzilla-Version: Latest X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: higuchi@jt-sys.co.jp X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: cy@FreeBSD.org X-Bugzilla-Flags: maintainer-feedback? X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter flagtypes.name Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Aug 2018 23:48:10 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D230517 Bug ID: 230517 Summary: lang/dmd2: compile error: "[-Wc++11-narrowing]" Product: Ports & Packages Version: Latest Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: Individual Port(s) Assignee: cy@FreeBSD.org Reporter: higuchi@jt-sys.co.jp Assignee: cy@FreeBSD.org Flags: maintainer-feedback?(cy@FreeBSD.org) * Problem 1 clang++ stops at "[-Wc++11-narrowing]" error. (I think this is a bad behavior of clang++. I want report only.) Log =3D=3D=3D=3D=3D=3D=3D=3D c++ -m64 -c -Wno-deprecated -Wstrict-aliasing -fno-exceptions -fno-rtti -D__pasc al=3D -DMARS=3D1 -DTARGET_FREEBSD=3D1 -DDM_TARGET_CPU_X86=3D1 -DDMDV2=3D1 = -O2 -DDMDV2=3D1 - Iroot -Itk -Ibackend -I. -MMD -MF go.deps backend/go.c backend/go.c:80:11: error: constant expression evaluates to -1 which cannot= be narrowed to type 'mftype' (aka 'unsigned int') [-Wc++11-narrowing] { 0,MFall,MFcnp,MFcp,MFcse,MFda,MFdc,MFdv,MFli,MFliv,MFlocal,MFloop, ^~~~~ backend/go.h:39:17: note: expanded from macro 'MFall' #define MFall (~0) // do everything ^~~~ backend/go.c:80:11: note: insert an explicit cast to silence this issue { 0,MFall,MFcnp,MFcp,MFcse,MFda,MFdc,MFdv,MFli,MFliv,MFlocal,MFloop, ^~~~~ static_cast( ) backend/go.h:39:17: note: expanded from macro 'MFall' #define MFall (~0) // do everything ^~~~ backend/go.c:123:18: error: case value evaluates to -1, which cannot be narrowed to type 'unsigned int' [-Wc++11-narrowing] case -1: /* not in flagtab[] */ ^ backend/go.c:157:18: error: case value evaluates to -1, which cannot be narrowed to type 'unsigned int' [-Wc++11-narrowing] case -1: /* not in flagtab[] */ ^ 3 errors generated. gmake[3]: *** [posix.mak:384: go.o] Error 1 gmake[3]: Leaving directory '/usr/ports/lang/dmd2/work/.host_dmd-2.067.1/dmd2/sr c/dmd' *** Error code 2 Stop. make[2]: stopped in /usr/ports/lang/dmd2 *** Error code 1 Stop. make[1]: stopped in /usr/ports/lang/dmd2 *** Error code 1 Stop. make: stopped in /usr/ports/lang/dmd2 =3D=3D=3D=3D=3D=3D=3D=3D So, we have to add "-Wno-c++11-narrowing" to compile flags. * Problem 2 Makefile replaces "g++" to "c++" too much. lang/dmd2/Makefile =3D=3D=3D=3D=3D=3D=3D=3D @${REINPLACE_CMD} -e "s|g++|${CXX}|" \ -e "s|/etc|${PREFIX}/etc|" \ ${WRKSRC}/dmd/src/posix.mak =3D=3D=3D=3D=3D=3D=3D=3D This replaces "clang++" to "clanc++". ifeq ($(HOST_CC), clang++) | v ifeq ($(HOST_CC), clanc++) We have to replace default compiler only. =3D=3D=3D=3D=3D=3D=3D=3D @${REINPLACE_CMD} -e "s|HOST_CC=3Dg++|HOST_CC=3D${CXX}|" \ =3D=3D=3D=3D=3D=3D=3D=3D * Problem 3 After replacing, $(HOST_CC) is "c++", so this doesn't match to "clang++"=20 This causes lack of compile option. =3D=3D=3D=3D=3D=3D=3D=3D ifeq ($(HOST_CC), clang++) =3D=3D=3D=3D=3D=3D=3D=3D But we know that c++ of FreeBSD (>=3D10) is always clang++. So, we can replace "clang++" to "c++". (adhoc solution) Importing determine compiler type from dmd/src/posix.mak to .host_dmd-2.067.1/dmd2/src/dmd/posix.mak is the best solution. But it is too much code. =3D=3D=3D=3D=3D=3D=3D=3D # determine whether CXX is gcc or clang based CXX_VERSION:=3D$(shell $(CXX) --version) ifneq (,$(findstring g++,$(CXX_VERSION))$(findstring gcc,$(CXX_VERSION))$(findstring GCC,$(CXX_VERSION))) CXX_KIND=3Dg++ endif ifneq (,$(findstring clang,$(CXX_VERSION))) CXX_KIND=3Dclang++ endif =3D=3D=3D=3D=3D=3D=3D=3D * Solution =3D=3D=3D=3D=3D=3D=3D=3D diff -uprN dmd2.org/Makefile dmd2/Makefile --- dmd2.org/Makefile 2017-11-30 15:13:34.000000000 +0900 +++ dmd2/Makefile 2018-08-11 04:18:33.133369000 +0900 @@ -60,7 +60,8 @@ MAKE_ARGS+=3D DEBUG_FLAGS=3D-g\ -DDEBUG=3D1\ - MODULEDIR=3D ${PREFIX}/include/d/phobos2 post-patch: - @${REINPLACE_CMD} -e "s|g++|${CXX}|" \ + @${REINPLACE_CMD} -e "s|HOST_CXX=3Dg++|HOST_CXX=3D${CXX}|" \ + -e "s|-Wno-logical-op-parentheses|-Wno-logical-op-parentheses -Wno-c++11-narrowing|" \ -e "s|/etc|${PREFIX}/etc|" \ ${WRKSRC}/dmd/src/posix.mak @${REINPLACE_CMD} -e "s|gcc|${CC}|" ${WRKSRC}/dmd/src/link.d diff -uprN dmd2.org/Makefile.bootstrap dmd2/Makefile.bootstrap --- dmd2.org/Makefile.bootstrap 2017-02-14 15:27:28.000000000 +0900 +++ dmd2/Makefile.bootstrap 2018-08-11 04:24:33.011166000 +0900 @@ -38,7 +38,10 @@ MODEL=3D 32 MODULEDIR=3D ${PREFIX}/include/d/phobos2 post-patch: - @${REINPLACE_CMD} -e "s|g++|${CXX}|" ${WRKSRC}/posix.mak + @${REINPLACE_CMD} -e "s|HOST_CC=3Dg++|HOST_CC=3D${CXX}|" \ + -e "s|clang++|c++|" \ + -e "s|-Wno-logical-op-parentheses|-Wno-logical-op-parentheses -Wno-c++11-narrowing|" \ + ${WRKSRC}/posix.mak @${REINPLACE_CMD} -e "s|cc|${CC}|" ${WRKSRC}/../phobos/posix.mak @${REINPLACE_CMD} -e "s|/etc|${PREFIX}/etc|" \ -e "s|\(dmd\)|\12|gI" \ =3D=3D=3D=3D=3D=3D=3D=3D --=20 You are receiving this mail because: You are the assignee for the bug.=