[Bug 292869] x11/nvidia-driver: fix build with clang 21

[email protected]
Newsgroups gmane.os.freebsd.devel.x11
Message-ID <[email protected]/bugzilla/>
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=292869

            Bug ID: 292869
           Summary: x11/nvidia-driver: fix build with clang 21
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: Individual Port(s)
          Assignee: [email protected]
          Reporter: [email protected]
          Assignee: [email protected]
             Flags: maintainer-feedback?([email protected])

With clang 21 x11/nvidia-kmod fails to build, with errors similar to:

    cc  -O2 -pipe -fno-strict-aliasing -DNV_VERSION_STRING=\"580.126.09\"
-DNV_SPECTRE_V2=1 -Werror=undef  -Werror -D_KERNEL -DKLD_MODULE -nostdinc 
-Imachine -I/usr/src/sys/sys -I../common/inc -include
/wrkdirs/usr/ports/x11/nvidia-kmod/work/NVIDIA-FreeBSD-x86_64-580.126.09/src/nvidia-modeset/opt_global.h
-I. -I/usr/src/sys -I/usr/src/sys/contrib/ck/include -fno-common 
-fno-omit-frame-pointer -mno-omit-leaf-frame-pointer
-fdebug-prefix-map=./machine=/usr/src/sys/amd64/include
-fdebug-prefix-map=./x86=/usr/src/sys/x86/include
-fdebug-prefix-map=./i386=/usr/src/sys/i386/include    -MD 
-MF.depend.nvidia-modeset-freebsd.o -MTnvidia-modeset-freebsd.o -mcmodel=kernel
-mno-red-zone -mno-mmx -mno-sse -msoft-float  -fno-asynchronous-unwind-tables
-ffreestanding -fwrapv -fstack-protector  -Wall -Wstrict-prototypes
-Wmissing-prototypes -Wpointer-arith -Wcast-qual -Wundef -Wno-pointer-sign
-D__printf__=__freebsd_kprintf__ -Wmissing-include-dirs
-fdiagnostics-show-option -Wno-unknown-pragmas -Wswitch
-Wno-error=tautological-compare -Wno-error=empty-body
-Wno-error=parentheses-equality -Wno-error=unused-function
-Wno-error=pointer-sign -Wno-error=shift-negative-value
-Wno-address-of-packed-member -Wno-format-zero-length   -mno-aes -mno-avx 
-std=gnu17 -c nvidia-modeset-freebsd.c -o nvidia-modeset-freebsd.o
    nvidia-modeset-freebsd.c:296:32: error: passing 'printf' format string
where 'freebsd_kprintf' format string is expected [-Werror,-Wformat]
      296 |     ret = vsnprintf(str, size, format, ap);
          |                                ^

This is because the kernel headers rely on the `printf` attribute being
called `__printf__`, so that it can be redefined as `__freebsd_kprintf__`.

Change the `nvkms_snprintf` declaration in nvidia-modeset-os-interface.h
so they use `__printf__` instead, and add a similar attribute to
`nvkms_vsnprintf`.

-- 
You are receiving this mail because:
You are the assignee for the bug.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.