Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Feb 2026 15:01:46 +0000
From:      Jan Beich <jbeich@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Cc:        Dimitry Andric <dim@FreeBSD.org>
Subject:   git: d50aa610760e - main - devel/spirv-llvm-translator: unbreak llvm12 flavor with clang 21
Message-ID:  <6998775a.230af.3bac26de@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by jbeich:

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

commit d50aa610760e499062d3f050b4402e97531fe376
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2026-02-19 12:31:30 +0000
Commit:     Jan Beich <jbeich@FreeBSD.org>
CommitDate: 2026-02-20 15:01:24 +0000

    devel/spirv-llvm-translator: unbreak llvm12 flavor with clang 21
    
    With clang 21 the llvm12 flavor of devel/spirv-llvm-translator fails to
    build, with errors similar to:
    
        In file included from /wrkdirs/usr/ports/devel/spirv-llvm-translator/work-llvm12/SPIRV-LLVM-Translator-12.0.1/lib/SPIRV/OCLTypeToSPIRV.cpp:44:
        In file included from /wrkdirs/usr/ports/devel/spirv-llvm-translator/work-llvm12/SPIRV-LLVM-Translator-12.0.1/lib/SPIRV/OCLUtil.h:42:
        In file included from /wrkdirs/usr/ports/devel/spirv-llvm-translator/work-llvm12/SPIRV-LLVM-Translator-12.0.1/lib/SPIRV/SPIRVInternal.h:43:
        In file included from /wrkdirs/usr/ports/devel/spirv-llvm-translator/work-llvm12/SPIRV-LLVM-Translator-12.0.1/lib/SPIRV/libSPIRV/SPIRVEnum.h:44:
        In file included from /wrkdirs/usr/ports/devel/spirv-llvm-translator/work-llvm12/SPIRV-LLVM-Translator-12.0.1/lib/SPIRV/libSPIRV/SPIRVOpCode.h:45:
        /wrkdirs/usr/ports/devel/spirv-llvm-translator/work-llvm12/SPIRV-LLVM-Translator-12.0.1/lib/SPIRV/libSPIRV/spirv_internal.hpp:120:31: error: constexpr variable 'FunctionControlOptNoneINTELMask' must be initialized by a constant expression
          120 | constexpr FunctionControlMask FunctionControlOptNoneINTELMask =
              |                               ^
          121 |     static_cast<FunctionControlMask>(IFunctionControlOptNoneINTELMask);
              |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        /wrkdirs/usr/ports/devel/spirv-llvm-translator/work-llvm12/SPIRV-LLVM-Translator-12.0.1/lib/SPIRV/libSPIRV/spirv_internal.hpp:121:5: note: integer value 65536 is outside the valid range of values [0, 15] for the enumeration type 'FunctionControlMask'
          121 |     static_cast<FunctionControlMask>(IFunctionControlOptNoneINTELMask);
              |     ^
    
    This is because clang 21 no longer allows enum values outside of the
    valid range. Upstream spirv refactored a lot in this area, so the llvm13
    flavor and later compile fine with clang 21.
    
    Fix it by explicitly making the underlying type for the two affected
    enums uint32_t.
    
    PR:             293293
    MFH:            2026Q1
---
 .../files.llvm12/patch-clang21                     | 34 ++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/devel/spirv-llvm-translator/files.llvm12/patch-clang21 b/devel/spirv-llvm-translator/files.llvm12/patch-clang21
new file mode 100644
index 000000000000..8b28d7caeb26
--- /dev/null
+++ b/devel/spirv-llvm-translator/files.llvm12/patch-clang21
@@ -0,0 +1,34 @@
+In file included from lib/SPIRV/OCLTypeToSPIRV.cpp:44:
+In file included from lib/SPIRV/OCLUtil.h:42:
+In file included from lib/SPIRV/SPIRVInternal.h:43:
+In file included from lib/SPIRV/libSPIRV/SPIRVEnum.h:44:
+In file included from lib/SPIRV/libSPIRV/SPIRVOpCode.h:45:
+lib/SPIRV/libSPIRV/spirv_internal.hpp:120:31: error: constexpr variable 'FunctionControlOptNoneINTELMask' must be initialized by a constant expression
+  120 | constexpr FunctionControlMask FunctionControlOptNoneINTELMask =
+      |                               ^
+  121 |     static_cast<FunctionControlMask>(IFunctionControlOptNoneINTELMask);
+      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+lib/SPIRV/libSPIRV/spirv_internal.hpp:121:5: note: integer value 65536 is outside the valid range of values [0, 15] for the enumeration type 'FunctionControlMask'
+  121 |     static_cast<FunctionControlMask>(IFunctionControlOptNoneINTELMask);
+      |     ^
+
+--- lib/SPIRV/libSPIRV/spirv.hpp.orig	2024-03-21 14:16:00 UTC
++++ lib/SPIRV/libSPIRV/spirv.hpp
+@@ -742,7 +742,7 @@ enum FunctionControlShift {
+     FunctionControlMax = 0x7fffffff,
+ };
+ 
+-enum FunctionControlMask {
++enum FunctionControlMask : uint32_t {
+     FunctionControlMaskNone = 0,
+     FunctionControlInlineMask = 0x00000001,
+     FunctionControlDontInlineMask = 0x00000002,
+@@ -805,7 +805,7 @@ enum MemoryAccessShift {
+     MemoryAccessMax = 0x7fffffff,
+ };
+ 
+-enum MemoryAccessMask {
++enum MemoryAccessMask : uint32_t {
+     MemoryAccessMaskNone = 0,
+     MemoryAccessVolatileMask = 0x00000001,
+     MemoryAccessAlignedMask = 0x00000002,


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6998775a.230af.3bac26de>