Bug 239192

Summary: graphics/drm-legacy-kmod: fix build on CURRENT with clang
Product: Ports & Packages Reporter: Piotr Kubaj <pkubaj>
Component: Individual Port(s)Assignee: freebsd-x11 mailing list <x11>
Status: Closed Overcome By Events    
Severity: Affects Only Me CC: linimon, x11, zeising
Priority: --- Flags: bugzilla: maintainer-feedback? (x11)
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
patch pkubaj: maintainer-approval? (x11)

Description Piotr Kubaj freebsd_committer 2019-07-13 21:23:40 UTC
Created attachment 205757 [details]
patch

With powerpc64 switching to clang in head, I tried to compile drm-legacy with clang.

It fails with many similar errors:
/tmp/usr/ports/graphics/drm-legacy-kmod/work/drm-legacy-990f64b/src/dev/drm2/drm_crtc.c:229:63: error: passing 'int *' to parameter of type 'uint32_t *' (aka 'unsigned int *')
      converts between pointers to integer types with different sign [-Werror,-Wpointer-sign]
        ret = drm_gem_name_create(&dev->mode_config.crtc_names, obj, &new_id);
                                                                     ^~~~~~~
Add -Wno-error=pointer-sign to CFLAGS when using new clang.
Comment 1 Niclas Zeising freebsd_committer 2019-07-13 22:01:10 UTC
I have no problem with this change, but is it needed always when running clang, or just on powerpc64?  (I can't recall I've seen the issue with the base compiler on any FreeBSD version on amd64 or i386, although it certainly seems it should exist there as well).

As a side note, I wonder if explicit casts should be used instead, it's out of scope for this though.

Does drm-legacy-kmod work on powerpc(64)?
Comment 2 Jan Beich freebsd_committer 2019-07-13 22:30:32 UTC
(In reply to Piotr Kubaj from comment #0)
> Add -Wno-error=pointer-sign to CFLAGS when using new clang.

Already passed if WARNS is defined since base r169723.

$ make -V CWARNFLAGS:M\*pointer-sign\* -C $(make -V WRKSRC)/drm2/drm2
-Wno-pointer-sign -Wno-error-pointer-sign
Comment 3 Niclas Zeising freebsd_committer 2019-07-29 12:23:51 UTC
Piotr, did you find out why the correct flags weren't passed on to the build on ppc64?
Comment 4 Piotr Kubaj freebsd_committer 2019-08-07 22:14:55 UTC
(In reply to Niclas Zeising from comment #3)
This error happens only when using clang in base on powerpc64, but clang in base on powerpc64 can only be used on head. Since head can now use newer drm-kmod, there's no point in using legacy.