Bug 272014 - audio/festival: fix build with clang 16
Summary: audio/festival: 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: Dimitry Andric
URL:
Keywords:
Depends on:
Blocks: 271047
  Show dependency treegraph
 
Reported: 2023-06-15 16:33 UTC by Dimitry Andric
Modified: 2023-06-16 18:08 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (freebsd-2024)


Attachments
audio/festival: fix build with clang 16 (1.17 KB, patch)
2023-06-15 16:33 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-06-15 16:33:05 UTC
Since clang 16 (and gcc 11) the default C++ standard is now gnu++17.
Because audio/festival's build infrastructure does not explicitly set
its C++ standard, this leads to an error:

  regexp.cc:178:22: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
  STATIC char *regnext(register char *p);
                       ^~~~~~~~~

To work around the error, define the register keyword away using
CXXFLAGS.
Comment 1 Dimitry Andric freebsd_committer freebsd_triage 2023-06-15 16:33:23 UTC
Created attachment 242794 [details]
audio/festival: fix build with clang 16
Comment 2 Mikhail T. 2023-06-16 00:37:18 UTC
Maybe, if we're manipulating CXXFLAGS anyway, add an explicit -std=gnu++11 instead? If only because we don't know, what else might be broken (subtly) by the switch to 17?
Comment 3 Fernando Apesteguía freebsd_committer freebsd_triage 2023-06-16 09:52:11 UTC
^Triage: reporter is committer, assign accordingly.

LGTM.

Builds fine with current LLVM_DEFAULT and with llvm=16. Tested in 12.4{amd64,i386} and -current amd64.

I also removed -Dregister= and added -std=gnu11 and builds fine in all production releases too (plus -current).
Comment 4 Dimitry Andric freebsd_committer freebsd_triage 2023-06-16 17:46:38 UTC
(In reply to Fernando Apesteguía from comment #3)
Yeah that is also a fine solution. I'll check if the program respects USE_CXXSTD, since that is a more standardized method.
Comment 5 commit-hook freebsd_committer freebsd_triage 2023-06-16 18:05:57 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=9a521a21bc60d34292ce87e3099f52ec9232d022

commit 9a521a21bc60d34292ce87e3099f52ec9232d022
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2023-06-15 16:31:34 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2023-06-16 18:03:01 +0000

    audio/festival: fix build with clang 16

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

      regexp.cc:178:22: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
      STATIC char *regnext(register char *p);
                           ^~~~~~~~~

    To work around the error, add USE_CXXSTD=gnu++11 to compile for C++11
    with GNU extensions instead. While here, pet portlint a little.

    PR:             272014
    Approved by:    fernape
    MFH:            2023Q2

 audio/festival/Makefile | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)