Bug 272101

Summary: math/cbc: fix build with clang 16
Product: Ports & Packages Reporter: Dimitry Andric <dim>
Component: Individual Port(s)Assignee: Dimitry Andric <dim>
Status: Closed FIXED    
Severity: Affects Some People Flags: bugzilla: maintainer-feedback? (yuri)
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   
Bug Depends on:    
Bug Blocks: 271047    
Attachments:
Description Flags
math/cbc: fix build with clang 16 none

Description Dimitry Andric freebsd_committer freebsd_triage 2023-06-20 18:56:06 UTC
Since clang 16 (and gcc 11) the default C++ standard is now gnu++17.
Because math/cbc's build infrastructure does not explicitly set its C++
standard, this leads to errors:

  ./CbcSymmetry.hpp:83:30: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
      inline void color_vertex(register int k) { color = k; }
                               ^~~~~~~~~
  ./CbcSymmetry.hpp:91:24: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
      inline void bounds(register double a, register double b)
                         ^~~~~~~~~

To work around the error, add USE_CXXSTD=gnu++11 to compile for C++11
with GNU extensions instead.
Comment 1 Dimitry Andric freebsd_committer freebsd_triage 2023-06-20 18:56:31 UTC
Created attachment 242894 [details]
math/cbc: fix build with clang 16
Comment 2 Yuri Victorovich freebsd_committer freebsd_triage 2023-06-20 20:45:29 UTC
Thanks for the patch!
Approved.
Please commit it.
Comment 3 commit-hook freebsd_committer freebsd_triage 2023-06-21 18:28:54 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=22c4f7a75ed3de4b97368be49f1ab70ab0aabb27

commit 22c4f7a75ed3de4b97368be49f1ab70ab0aabb27
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2023-06-20 18:52:55 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2023-06-21 18:25:37 +0000

    math/cbc: fix build with clang 16

    Since clang 16 (and gcc 11) the default C++ standard is now gnu++17.
    Because math/cbc's build infrastructure does not explicitly set its C++
    standard, this leads to errors:

      ./CbcSymmetry.hpp:83:30: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
          inline void color_vertex(register int k) { color = k; }
                                   ^~~~~~~~~
      ./CbcSymmetry.hpp:91:24: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
          inline void bounds(register double a, register double b)
                             ^~~~~~~~~

    To work around the error, add USE_CXXSTD=gnu++11 to compile for C++11
    with GNU extensions instead.

    PR:             272101
    Approved by:    yuri (maintainer)
    MFH:            2023Q2

 math/cbc/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)