Bug 239192 - graphics/drm-legacy-kmod: fix build on CURRENT with clang
Summary: graphics/drm-legacy-kmod: fix build on CURRENT with clang
Status: Closed Overcome By Events
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-x11 (Nobody)
Depends on:
Reported: 2019-07-13 21:23 UTC by Piotr Kubaj
Modified: 2019-08-07 22:14 UTC (History)
3 users (show)

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

patch (922 bytes, patch)
2019-07-13 21:23 UTC, Piotr Kubaj
pkubaj: maintainer-approval? (x11)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Piotr Kubaj freebsd_committer 2019-07-13 21:23:40 UTC
Created attachment 205757 [details]

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.