Clang 16 has a new error about integer values being outside the valid range for enum types, which shows up when building multimedia/phonon: /wrkdirs/usr/ports/multimedia/phonon/work/.build/phonon/experimental/phonon4qt5experimental_autogen/EWIEGA46WW/../../../../../phonon-4.11.1/phonon/experimental/visualization.h:45:27: error: integer value 4294967294 is outside the valid range of values [0, 7] for the enumeration type 'ObjectDescriptionType' [-Wenum-constexpr-conversion] typedef ObjectDescription<static_cast<Phonon::ObjectDescriptionType>(VisualizationType)> VisualizationDescription; ^ /wrkdirs/usr/ports/multimedia/phonon/work/.build/phonon/experimental/phonon4qt5experimental_autogen/EWIEGA46WW/../../../../../phonon-4.11.1/phonon/experimental/visualization.h:46:32: error: integer value 4294967294 is outside the valid range of values [0, 7] for the enumeration type 'ObjectDescriptionType' [-Wenum-constexpr-conversion] typedef ObjectDescriptionModel<static_cast<Phonon::ObjectDescriptionType>(VisualizationType)> VisualizationDescriptionModel; ^ /wrkdirs/usr/ports/multimedia/phonon/work/phonon-4.11.1/phonon/objectdescription.h:189:41: error: integer value 4294967294 is outside the valid range of values [0, 7] for the enumeration type 'ObjectDescriptionType' [-Wenum-constexpr-conversion] static inline ObjectDescription<T> fromIndex(int index) { //krazy:exclude=inline ^ /wrkdirs/usr/ports/multimedia/phonon/work/phonon-4.11.1/phonon/objectdescription.h:260:45: error: integer value 4294967294 is outside the valid range of values [0, 7] for the enumeration type 'ObjectDescriptionType' [-Wenum-constexpr-conversion] friend class ObjectDescriptionModel<T>; ^ This is because enum ObjectDescriptionType only has 6 members, and therefore only gets 3 bits allocated by default. In that case, values like 4294967294 (0xfffffffe) do not fit in it. Work around the problem by declaring enum ObjectDescriptionType to explicitly be of type unsigned, so it can fit 32 bits.
Created attachment 242814 [details] multimedia/phonon: fix build with clang 16
This is fixed by https://cgit.freebsd.org/ports/commit/?id=83e1d12fd0838b9cb38867f54bef20790e05b3af
Note that clang upstream plans to make -Wenum-constexpr-conversion a hard error in the future (i.e it cannot be turned off anymore), so at some point actually fixing the problem should be done. In that case, the above patch still applies. :)
For the record, upstream ended up doing the same thing that's been done in https://cgit.freebsd.org/ports/commit/?id=83e1d12fd0838b9cb38867f54bef20790e05b3af I've posted a comment to https://invent.kde.org/libraries/phonon/-/merge_requests/13 pointing out what dim's mentioned here, hopefully this leads to a proper fix there.
(In reply to Raphael Kubo da Costa from comment #4) Point them to https://reviews.llvm.org/D150226, where it seems like the possibility of disabling this error is going to go away after clang 17.
I have submitted https://invent.kde.org/libraries/phonon/-/merge_requests/16 for the future-proof fix.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=73b6e876a9d3bb44fb7560c5efd99f9fe5f334b7 commit 73b6e876a9d3bb44fb7560c5efd99f9fe5f334b7 Author: Raphael Kubo da Costa <rakuco@FreeBSD.org> AuthorDate: 2023-08-05 15:01:50 +0000 Commit: Raphael Kubo da Costa <rakuco@FreeBSD.org> CommitDate: 2023-08-05 15:03:07 +0000 multimedia/phonon: Switch to upstream's fix for clang 16 build issues Instead of passing a compiler flag to work around a clang 16 build issue, adopt the fix that dim@ landed upstream that fixes the code in question. PR: 272029 Approved by: kde (arrowd) Differential Revision: https://reviews.freebsd.org/D41307 multimedia/phonon/Makefile | 9 ++---- ...a3eb81bcbc730e44c27a0d060a85cf9213d.patch (new) | 36 ++++++++++++++++++++++ 2 files changed, 38 insertions(+), 7 deletions(-)