Bug 292192 - graphics/drm-66-kmod: fix build with clang 21
Summary: graphics/drm-66-kmod: fix build with clang 21
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: freebsd-x11 (Nobody)
URL:
Keywords:
Depends on:
Blocks: 292067
  Show dependency treegraph
 
Reported: 2026-01-05 00:19 UTC by Dimitry Andric
Modified: 2026-01-14 19:05 UTC (History)
1 user (show)

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


Attachments
graphics/drm-66-kmod: fix build with clang 21 (1.72 KB, patch)
2026-01-05 00:20 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 2026-01-05 00:19:07 UTC
With clang 21 graphics/drm-66-kmod fails to compile, with errors similar
to:

    In file included from /wrkdirs/usr/ports/graphics/drm-66-kmod/work/drm-kmod-drm_v6.6.25_9/drivers/gpu/drm/i915/i915_active.c:12:
    /wrkdirs/usr/ports/graphics/drm-66-kmod/work/drm-kmod-drm_v6.6.25_9/drivers/gpu/drm/i915/gt/intel_ring.h:63:2: error: default initialization of an object of type 'typeof (ring->size)' (aka 'const unsigned int') leaves the object uninitialized [-Werror,-Wdefault-const-init-var-unsafe]
       63 |         typecheck(typeof(ring->size), next);
          |         ^
    /usr/src/sys/compat/linuxkpi/common/include/linux/typecheck.h:31:9: note: expanded from macro 'typecheck'
       31 | ({      type __var1; \
          |              ^

The thread at https://lkml.org/lkml/2025/5/6/1681 appears to imply that
it is safe to suppress the new -Wdefault-const-init-var-unsafe warning.
Comment 1 Dimitry Andric freebsd_committer freebsd_triage 2026-01-05 00:20:16 UTC
Created attachment 266829 [details]
graphics/drm-66-kmod: fix build with clang 21
Comment 2 Ed Maste freebsd_committer freebsd_triage 2026-01-05 02:05:37 UTC
Comment on attachment 266829 [details]
graphics/drm-66-kmod: fix build with clang 21

LGTM. In my local tree for testing I added `CFLAGS+=-Wno-default-const-init-var-unsafe` unconditionally.

Incidentally I noticed the comment on ports COMPILER_VERSION was incorrect for compilers with major version >= 10 -- https://reviews.freebsd.org/D54509
Comment 3 commit-hook freebsd_committer freebsd_triage 2026-01-14 19:04:37 UTC
A commit in branch main references this bug:

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

commit 2b49118158d0aa7cb20d98e470ee080ee0fdc931
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2026-01-05 00:19:34 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2026-01-14 19:02:31 +0000

    graphics/drm-66-kmod: fix build with clang 21

    With clang 21 graphics/drm-66-kmod fails to compile, with errors similar
    to:

        In file included from /wrkdirs/usr/ports/graphics/drm-66-kmod/work/drm-kmod-drm_v6.6.25_9/drivers/gpu/drm/i915/i915_active.c:12:
        /wrkdirs/usr/ports/graphics/drm-66-kmod/work/drm-kmod-drm_v6.6.25_9/drivers/gpu/drm/i915/gt/intel_ring.h:63:2: error: default initialization of an object of type 'typeof (ring->size)' (aka 'const unsigned int') leaves the object uninitialized [-Werror,-Wdefault-const-init-var-unsafe]
           63 |         typecheck(typeof(ring->size), next);
              |         ^
        /usr/src/sys/compat/linuxkpi/common/include/linux/typecheck.h:31:9: note: expanded from macro 'typecheck'
           31 | ({      type __var1; \
              |              ^

    The thread at https://lkml.org/lkml/2025/5/6/1681 appears to imply that
    it is safe to suppress the new -Wdefault-const-init-var-unsafe warning.

    PR:             292192
    Approved by:    emaste (maintainer)
    MFH:            2026Q1

 graphics/drm-66-kmod/Makefile | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
Comment 4 commit-hook freebsd_committer freebsd_triage 2026-01-14 19:04:38 UTC
A commit in branch 2026Q1 references this bug:

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

commit 6ab5fcd46c68322837520afa04f91922836ad6ff
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2026-01-05 00:19:34 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2026-01-14 19:04:18 +0000

    graphics/drm-66-kmod: fix build with clang 21

    With clang 21 graphics/drm-66-kmod fails to compile, with errors similar
    to:

        In file included from /wrkdirs/usr/ports/graphics/drm-66-kmod/work/drm-kmod-drm_v6.6.25_9/drivers/gpu/drm/i915/i915_active.c:12:
        /wrkdirs/usr/ports/graphics/drm-66-kmod/work/drm-kmod-drm_v6.6.25_9/drivers/gpu/drm/i915/gt/intel_ring.h:63:2: error: default initialization of an object of type 'typeof (ring->size)' (aka 'const unsigned int') leaves the object uninitialized [-Werror,-Wdefault-const-init-var-unsafe]
           63 |         typecheck(typeof(ring->size), next);
              |         ^
        /usr/src/sys/compat/linuxkpi/common/include/linux/typecheck.h:31:9: note: expanded from macro 'typecheck'
           31 | ({      type __var1; \
              |              ^

    The thread at https://lkml.org/lkml/2025/5/6/1681 appears to imply that
    it is safe to suppress the new -Wdefault-const-init-var-unsafe warning.

    PR:             292192
    Approved by:    emaste (maintainer)
    MFH:            2026Q1

    (cherry picked from commit 2b49118158d0aa7cb20d98e470ee080ee0fdc931)

 graphics/drm-66-kmod/Makefile | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)