Bug 276804 - devel/bossa: fix build with clang 18
Summary: devel/bossa: fix build with clang 18
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: Kyle Evans
URL:
Keywords:
Depends on:
Blocks: 276104
  Show dependency treegraph
 
Reported: 2024-02-03 13:25 UTC by Dimitry Andric
Modified: 2024-02-24 11:10 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (kevans)


Attachments
devel/bossa: fix build with clang 18 (1.65 KB, patch)
2024-02-03 13:26 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 2024-02-03 13:25:46 UTC
Clang 18 has a new warning about variable length arrays used in C++,
which is emitted when building devel/bossa:

  src/Flasher.cpp:115:28: error: variable length arrays in C++ are a Clang extension [-Werror,-Wvla-cxx-extension]
    115 |             uint8_t buffer[bufferSize];
        |                            ^~~~~~~~~~
  src/Flasher.cpp:115:28: note: read of non-const variable 'bufferSize' is not allowed in a constant expression
  src/Flasher.cpp:114:22: note: declared here
    114 |             uint32_t bufferSize = _samba.writeBufferSize();
        |                      ^
  [... more of these ...]

Since refactoring the code to no longer use VLAs is rather intrusive,
suppress the warnings instead.
Comment 1 Dimitry Andric freebsd_committer freebsd_triage 2024-02-03 13:26:48 UTC
Created attachment 248159 [details]
devel/bossa: fix build with clang 18
Comment 2 commit-hook freebsd_committer freebsd_triage 2024-02-24 11:03:43 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=30a231f8eb872f67eac8514ba96da91cc4b9f44f

commit 30a231f8eb872f67eac8514ba96da91cc4b9f44f
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2024-02-03 13:21:20 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2024-02-24 11:01:04 +0000

    devel/bossa: fix build with clang 18

    Clang 18 has a new warning about variable length arrays used in C++,
    which is emitted when building devel/bossa:

      src/Flasher.cpp:115:28: error: variable length arrays in C++ are a Clang extension [-Werror,-Wvla-cxx-extension]
        115 |             uint8_t buffer[bufferSize];
            |                            ^~~~~~~~~~
      src/Flasher.cpp:115:28: note: read of non-const variable 'bufferSize' is not allowed in a constant expression
      src/Flasher.cpp:114:22: note: declared here
        114 |             uint32_t bufferSize = _samba.writeBufferSize();
            |                      ^
      [... more of these ...]

    Since refactoring the code to no longer use VLAs is rather intrusive,
    suppress the warnings instead.

    While here, pet portlint.

    PR:             276804
    Approved by:    maintainer timeout (2 weeks)
    MFH:            2024Q1

 devel/bossa/Makefile | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
Comment 3 commit-hook freebsd_committer freebsd_triage 2024-02-24 11:06:44 UTC
A commit in branch 2024Q1 references this bug:

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

commit 9c744e2660ed1445a4b8453ec3fcdeba11e28f5a
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2024-02-03 13:21:20 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2024-02-24 11:06:04 +0000

    devel/bossa: fix build with clang 18

    Clang 18 has a new warning about variable length arrays used in C++,
    which is emitted when building devel/bossa:

      src/Flasher.cpp:115:28: error: variable length arrays in C++ are a Clang extension [-Werror,-Wvla-cxx-extension]
        115 |             uint8_t buffer[bufferSize];
            |                            ^~~~~~~~~~
      src/Flasher.cpp:115:28: note: read of non-const variable 'bufferSize' is not allowed in a constant expression
      src/Flasher.cpp:114:22: note: declared here
        114 |             uint32_t bufferSize = _samba.writeBufferSize();
            |                      ^
      [... more of these ...]

    Since refactoring the code to no longer use VLAs is rather intrusive,
    suppress the warnings instead.

    While here, pet portlint.

    PR:             276804
    Approved by:    maintainer timeout (2 weeks)
    MFH:            2024Q1

    (cherry picked from commit 30a231f8eb872f67eac8514ba96da91cc4b9f44f)

 devel/bossa/Makefile | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)