Bug 226708 - x11-wm/blackbox: Fix build with Clang 6
Summary: x11-wm/blackbox: Fix build with Clang 6
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Kubilay Kocak
URL:
Keywords: easy, needs-qa
Depends on:
Blocks:
 
Reported: 2018-03-18 20:00 UTC by Trond Endrestøl
Modified: 2018-08-21 14:46 UTC (History)
3 users (show)

See Also:
A.J.Caines: maintainer-feedback+
koobs: merge-quarterly+


Attachments
Patch for lib/EWMH.cc to be placed in the files directory (494 bytes, patch)
2018-03-18 20:00 UTC, Trond Endrestøl
no flags Details | Diff
Patch for Makefile (330 bytes, patch)
2018-03-18 20:01 UTC, Trond Endrestøl
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Trond Endrestøl 2018-03-18 20:00:55 UTC
Created attachment 191611 [details]
Patch for lib/EWMH.cc to be placed in the files directory

--- EWMH.lo ---
EWMH.cc:250:7: error: non-constant-expression cannot be narrowed from type 'long' to 'unsigned long' in initializer list [-Wc++11-narrowing]
    { static_cast<long>(x), static_cast<long>(y) };
      ^~~~~~~~~~~~~~~~~~~~
EWMH.cc:250:7: note: insert an explicit cast to silence this issue
    { static_cast<long>(x), static_cast<long>(y) };
      ^~~~~~~~~~~~~~~~~~~~
      static_cast<unsigned long>( )
EWMH.cc:250:29: error: non-constant-expression cannot be narrowed from type 'long' to 'unsigned long' in initializer list [-Wc++11-narrowing]
    { static_cast<long>(x), static_cast<long>(y) };
                            ^~~~~~~~~~~~~~~~~~~~
EWMH.cc:250:29: note: insert an explicit cast to silence this issue
    { static_cast<long>(x), static_cast<long>(y) };
                            ^~~~~~~~~~~~~~~~~~~~
                            static_cast<unsigned long>( )
2 errors generated.
*** [EWMH.lo] Error code 1

make[3]: stopped in /construction/xports/x11-wm/blackbox/work/blackbox-0.70.1/lib

Attached patch silences these error messages.
Comment 1 Trond Endrestøl 2018-03-18 20:01:43 UTC
Created attachment 191612 [details]
Patch for Makefile

Might as well increase PORTREVISION.
Comment 2 Andrew J. Caines 2018-03-18 21:15:57 UTC
Comment on attachment 191611 [details]
Patch for lib/EWMH.cc to be placed in the files directory

Thanks, Trond.
Comment 3 Andrew J. Caines 2018-03-18 21:16:02 UTC
Comment on attachment 191612 [details]
Patch for Makefile

Thanks, Trond.
Comment 4 Kubilay Kocak freebsd_committer freebsd_triage 2018-08-09 05:15:13 UTC
@Trond What is the uname -a output on the system you have observed this issue on?
Comment 5 Trond Endrestøl 2018-08-09 06:16:13 UTC
(In reply to Kubilay Kocak from comment #4)
I don't have access to that particular VM right now, but it's running base/head, I guess it ran r331123-ish at the time.
Comment 6 Kubilay Kocak freebsd_committer freebsd_triage 2018-08-09 06:23:40 UTC
Unrelated to this patch, found during QA, it appears the TOOLS_ONLY option (enabled) fails to build/install, due to a bug introduced 4 years [1] ago during staging, which removed the MAN1 variable a later INSTALL_MAN macro relied on.

Beside reporting it here for future reference, this is also probably the best evidence possible that the TOOLS_ONLY option isn't really valuable on its own, and particularly in contrast to the complexity it adds to the port (magic plist replacements, install_target hacks ":(", among other things). 

I strongly recommend removing it, but we can do that separately, as I'm trying to make the minimum number of changes possible to fix only this issue, comply with ports/framework guidelines/best-practices, and merge it to the quarterly branch.

[1] http://svnweb.freebsd.org/changeset/ports/346174
Comment 7 Kubilay Kocak freebsd_committer freebsd_triage 2018-08-09 06:25:03 UTC
(In reply to Trond.Endrestol from comment #5)

That's fine, after minor investigation, it appears to be "post-Clang 6 import" 12-CURRENT machines.

See Also:

https://lists.freebsd.org/pipermail/freebsd-ports/2018-August/114039.html
Comment 8 commit-hook freebsd_committer freebsd_triage 2018-08-09 06:43:39 UTC
A commit references this bug:

Author: koobs
Date: Thu Aug  9 06:42:49 UTC 2018
New revision: 476722
URL: https://svnweb.freebsd.org/changeset/ports/476722

Log:
  x11-wm/blackbox: Fix build with Clang 6, Fix TOOLS_ONLY option

  Clang 6 (on 12-CURRENT) reports the following error during build:

  EWMH.cc:250:7: error: non-constant-expression cannot be narrowed from type
  'long' to 'unsigned long' in initializer list [-Wc++11-narrowing]
      { static_cast<long>(x), static_cast<long>(y) };
        ^~~~~~~~~~~~~~~~~~~~

  There was also a bug introduced 4 years ago which removed the MAN1 variable a
  later INSTALL_MAN macro relied on [1]. This caused a build/install failure
  when the TOOLS_ONLY option was enabled.

  This change fixes those two issues.

  While I'm here level up port compliance:

    - Add LICENSE_FILE
    - Convert to OPTIONS helpers
    - Regenerate patches

  [1] http://svnweb.freebsd.org/changeset/ports/346174
  [2] https://lists.freebsd.org/pipermail/freebsd-ports/2018-August/114039.html

  PR:		226708
  Submitted by:	<Trond Endrestol ximalas info> (Clang 6 fix)
  Approved by:	Andrew J. Caines <A J Caines halplant com> (technically)
  Approved by:	portmgr (implicit, build fixes, framework compliance)
  Reported by:	Erich Dollansky <freebsd ed lists sumeritec com> [2]
  MFH:		2018Q3

Changes:
  head/x11-wm/blackbox/Makefile
  head/x11-wm/blackbox/files/patch-lib_Display.cc
  head/x11-wm/blackbox/files/patch-lib_EWMH.cc
  head/x11-wm/blackbox/files/patch-lib_Menu.cc
  head/x11-wm/blackbox/files/patch-lib_Texture.cc
  head/x11-wm/blackbox/files/patch-src_Screen.cc
  head/x11-wm/blackbox/files/patch-src_Slit.cc
  head/x11-wm/blackbox/files/patch-src_Window.cc
  head/x11-wm/blackbox/files/patch-src_blackbox.cc
  head/x11-wm/blackbox/files/patch-src_main.cc
  head/x11-wm/blackbox/files/patch-util_bsetroot.cc
Comment 9 Erich Dollansky 2018-08-09 07:10:38 UTC
I can confirm the error on FreeBSD 12:

FreeBSD 12.0-CURRENT #5 r337343
Comment 10 commit-hook freebsd_committer freebsd_triage 2018-08-21 07:16:36 UTC
A commit references this bug:

Author: koobs
Date: Tue Aug 21 07:16:16 UTC 2018
New revision: 477707
URL: https://svnweb.freebsd.org/changeset/ports/477707

Log:
  MFH: r476722 x11-wm/blackbox: Fix build with Clang 6, Fix TOOLS_ONLY option

  Clang 6 (on 12-CURRENT) reports the following error during build:

  EWMH.cc:250:7: error: non-constant-expression cannot be narrowed from type
  'long' to 'unsigned long' in initializer list [-Wc++11-narrowing]
      { static_cast<long>(x), static_cast<long>(y) };
        ^~~~~~~~~~~~~~~~~~~~

  There was also a bug introduced 4 years ago which removed the MAN1 variable a
  later INSTALL_MAN macro relied on [1]. This caused a build/install failure
  when the TOOLS_ONLY option was enabled.

  This change fixes those two issues.

  While I'm here level up port compliance:

    - Add LICENSE_FILE
    - Convert to OPTIONS helpers
    - Regenerate patches

  [1] http://svnweb.freebsd.org/changeset/ports/346174
  [2] https://lists.freebsd.org/pipermail/freebsd-ports/2018-August/114039.html

  PR:		226708
  Submitted by:	<Trond Endrestol ximalas info> (Clang 6 fix)
  Approved by:	Andrew J. Caines <A J Caines halplant com> (technically)
  Approved by:	portmgr (implicit, build fixes, framework compliance)
  Reported by:	Erich Dollansky <freebsd ed lists sumeritec com> [2]

  Approved by:	miwi (ports-secteam)

Changes:
_U  branches/2018Q3/
  branches/2018Q3/x11-wm/blackbox/Makefile
  branches/2018Q3/x11-wm/blackbox/files/patch-lib_Display.cc
  branches/2018Q3/x11-wm/blackbox/files/patch-lib_EWMH.cc
  branches/2018Q3/x11-wm/blackbox/files/patch-lib_Menu.cc
  branches/2018Q3/x11-wm/blackbox/files/patch-lib_Texture.cc
  branches/2018Q3/x11-wm/blackbox/files/patch-src_Screen.cc
  branches/2018Q3/x11-wm/blackbox/files/patch-src_Slit.cc
  branches/2018Q3/x11-wm/blackbox/files/patch-src_Window.cc
  branches/2018Q3/x11-wm/blackbox/files/patch-src_blackbox.cc
  branches/2018Q3/x11-wm/blackbox/files/patch-src_main.cc
  branches/2018Q3/x11-wm/blackbox/files/patch-util_bsetroot.cc
Comment 11 Andrew J. Caines 2018-08-21 14:46:47 UTC
Thank you.