Bug 224826 - sysutils/smartmontools: Fix build with clang 6.0.0
Summary: sysutils/smartmontools: Fix build with clang 6.0.0
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: freebsd-ports-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks: 224669
  Show dependency treegraph
 
Reported: 2018-01-01 19:20 UTC by Dimitry Andric
Modified: 2018-01-03 20:02 UTC (History)
1 user (show)

See Also:
samm: maintainer-feedback+
dim: merge-quarterly+


Attachments
Add spaces to avoid literal suffix error (1.02 KB, patch)
2018-01-01 19:20 UTC, Dimitry Andric
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dimitry Andric freebsd_committer freebsd_triage 2018-01-01 19:20:47 UTC
Created attachment 189324 [details]
Add spaces to avoid literal suffix error

While testing the new clang600-import branch (see bug 224669), I noticed that smartmontools fails to compile, due clang++ 6.0.0 now defaulting to -std=gnu++14 (like g++ 6 and higher):

os_freebsd.cpp:487:45: error: invalid suffix on literal; C++11 requires a space between literal and identifier [-Wreserved-user-defined-literal]
  else if (sscanf(dev, NVME_CTRLR_PREFIX"%d"NVME_NS_PREFIX"%d%c",
                                            ^

Here is a patch to fix it, adding spaces around the NVME_NS_PREFIX macro. This makes the source C++14 compatible.

Alternatively, the port Makefile could explicitly set USE_CXXSTD= gnu++98.
Comment 1 Oleksii Samorukov freebsd_committer freebsd_triage 2018-01-01 21:03:12 UTC
Accepted, please commit. I will also patch upstream as well.
Comment 2 Oleksii Samorukov freebsd_committer freebsd_triage 2018-01-01 21:12:48 UTC
Fixed in the upstream, see https://www.smartmontools.org/changeset/4681
Comment 3 commit-hook freebsd_committer freebsd_triage 2018-01-01 21:20:38 UTC
A commit references this bug:

Author: dim
Date: Mon Jan  1 21:19:34 UTC 2018
New revision: 457814
URL: https://svnweb.freebsd.org/changeset/ports/457814

Log:
  Make smartmontools 6.6 compile with clang 6.0.0 and higher

  Because clang 6.0.0 and higher default to -std=gnu++14, like gcc 6 and
  higher, compiling smartmontools results in the following error:

  os_freebsd.cpp:487:45: error: invalid suffix on literal; C++11 requires
  a space between literal and identifier [-Wreserved-user-defined-literal]
    else if (sscanf(dev, NVME_CTRLR_PREFIX"%d"NVME_NS_PREFIX"%d%c",
                                              ^

  Fix this by adding spaces around the NVME_NS_PREFIX macro. This makes
  the source C++14 compatible.

  Approved by:	samm@os2.kiev.ua (maintainer)
  PR:		224826
  MFH:		2018Q1

Changes:
  head/sysutils/smartmontools/Makefile
  head/sysutils/smartmontools/files/patch-os__freebsd.cpp
Comment 4 commit-hook freebsd_committer freebsd_triage 2018-01-02 18:20:58 UTC
A commit references this bug:

Author: dim
Date: Tue Jan  2 18:20:28 UTC 2018
New revision: 457915
URL: https://svnweb.freebsd.org/changeset/ports/457915

Log:
  MFH: r457814

  Make smartmontools 6.6 compile with clang 6.0.0 and higher

  Because clang 6.0.0 and higher default to -std=gnu++14, like gcc 6 and
  higher, compiling smartmontools results in the following error:

  os_freebsd.cpp:487:45: error: invalid suffix on literal; C++11 requires
  a space between literal and identifier [-Wreserved-user-defined-literal]
    else if (sscanf(dev, NVME_CTRLR_PREFIX"%d"NVME_NS_PREFIX"%d%c",
                                              ^

  Fix this by adding spaces around the NVME_NS_PREFIX macro. This makes
  the source C++14 compatible.

  Approved by:	portmgr (zi)
  Approved by:	samm@os2.kiev.ua (maintainer)
  PR:		224826

Changes:
_U  branches/2018Q1/
  branches/2018Q1/sysutils/smartmontools/Makefile
  branches/2018Q1/sysutils/smartmontools/files/patch-os__freebsd.cpp