Bug 276804

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

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(-)