Bug 271030

Summary: devel/gperf: fix build with clang 16
Product: Ports & Packages Reporter: Dimitry Andric <dim>
Component: Individual Port(s)Assignee: Dirk Meyer <dinoex>
Status: Closed FIXED    
Severity: Affects Some People CC: emaste
Priority: --- Flags: dinoex: maintainer-feedback+
Version: Latest   
Hardware: Any   
OS: Any   
Bug Depends on:    
Bug Blocks: 271047    
Attachments:
Description Flags
devel/gperf: fix build with clang 16 none

Description Dimitry Andric freebsd_committer freebsd_triage 2023-04-23 18:44:50 UTC
Since clang 16 (and gcc 11) the default C++ standard is now gnu++17.
Because devel/gperf's Makefile does not explicitly set its C++ standard,
this leads to an error:

  c++ -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -I. -c ./getline.cc
  ./getline.cc:58:7: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
        register int c = getc (stream);
        ^~~~~~~~~

Add USE_CXXSTD=gnu++89 to avoid this error.
Comment 1 Dimitry Andric freebsd_committer freebsd_triage 2023-04-23 18:45:15 UTC
Created attachment 241681 [details]
devel/gperf: fix build with clang 16
Comment 2 Dirk Meyer freebsd_committer freebsd_triage 2023-04-24 05:50:51 UTC
I will look into it.

any reason you prefer gnu++89 instead of a newer variant?
Comment 3 Dimitry Andric freebsd_committer freebsd_triage 2023-04-24 06:54:36 UTC
Actually this was a typo, it's gnu++98 :)

Looking at the code itself, it is definitely not c++11 or anything like that. It looks mostly like C++ how it was quite a while before it.

Until recently I think the defaults for clang++ and g++ have been gnu++14, so that would probably also work, but with a lot of additional warnings.
Comment 4 commit-hook freebsd_committer freebsd_triage 2023-05-02 17:11:57 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=984b20be70ad5b3814c1580bc82de57e3ed90f61

commit 984b20be70ad5b3814c1580bc82de57e3ed90f61
Author:     Dirk Meyer <dinoex@FreeBSD.org>
AuthorDate: 2023-05-02 17:11:26 +0000
Commit:     Dirk Meyer <dinoex@FreeBSD.org>
CommitDate: 2023-05-02 17:11:26 +0000

    devel/gperf: fix build with clang 16

    PR: 271030

 devel/gperf/Makefile | 2 ++
 1 file changed, 2 insertions(+)