Bug 271030 - devel/gperf: fix build with clang 16
Summary: devel/gperf: fix build with clang 16
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: Dirk Meyer
URL:
Keywords:
Depends on:
Blocks: 271047
  Show dependency treegraph
 
Reported: 2023-04-23 18:44 UTC by Dimitry Andric
Modified: 2023-05-02 17:40 UTC (History)
1 user (show)

See Also:
dinoex: maintainer-feedback+


Attachments
devel/gperf: fix build with clang 16 (997 bytes, patch)
2023-04-23 18:45 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 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(+)