Bug 244235

Summary: x11/xkbcomp: Fix build with clang 10.0.0
Product: Ports & Packages Reporter: Dimitry Andric <dim>
Component: Individual Port(s)Assignee: freebsd-x11 (Nobody) <x11>
Status: Closed FIXED    
Severity: Affects Some People CC: manu, zeising
Priority: --- Flags: bugzilla: maintainer-feedback? (x11)
Version: Latest   
Hardware: Any   
OS: Any   
Bug Depends on:    
Bug Blocks: 244251    
Attachments:
Description Flags
Use strcmp instead of custom macros none

Description Dimitry Andric freebsd_committer freebsd_triage 2020-02-19 19:42:57 UTC
Created attachment 211766 [details]
Use strcmp instead of custom macros

Fix clang 10.0.0 errors:

xkbcomp.c:228:37: error: result of comparison against a string literal is unspecified (use an explicit string comparison function instead) [-Werror,-Wstring-compare]
        if ((argv[i][0] != '-') || (uStringEqual(argv[i], "-")))
                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~
./utils.h:195:30: note: expanded from macro 'uStringEqual'
#define uStringEqual(s1,s2)     (uStringCompare(s1,s2)==Equal)
                                 ^~~~~~~~~~~~~~~~~~~~~
./utils.h:198:38: note: expanded from macro 'uStringCompare'
                                 (s1)!=(s2):strcmp(s1,s2))
                                     ^ ~~~~

Don't attempt to do this macro trickery, and simply use strcmp instead,
where it applies.
Comment 1 Emmanuel Vadot freebsd_committer freebsd_triage 2020-02-19 20:00:28 UTC
Hi Dim,
Could you open an MR upstream too ?
https://gitlab.freedesktop.org/xorg/app/xkbcomp/
I don't mind having patches in the ports tree but I prefer having them when upstream is aware of the issue and at least ack. If they are slow we can always add them.
Thanks.
Comment 2 Dimitry Andric freebsd_committer freebsd_triage 2020-02-19 20:28:47 UTC
Submitted https://gitlab.freedesktop.org/xorg/app/xkbcomp/merge_requests/5
Comment 3 Niclas Zeising freebsd_committer freebsd_triage 2020-02-20 08:45:14 UTC
Hold this until the patch has landed upstream (since it's well on the way).  Then you have approval to commit this.

I've asked upstream to roll this (and some other changes since the last xkbcomp release) into a new release as well, but there's no need to wait for that.
Comment 4 commit-hook freebsd_committer freebsd_triage 2020-02-20 20:31:01 UTC
A commit references this bug:

Author: zeising
Date: Thu Feb 20 20:30:10 UTC 2020
New revision: 526587
URL: https://svnweb.freebsd.org/changeset/ports/526587

Log:
  x11/xkbcomp: Update to 1.4.3

  Update x11/xkbcomp to 1.4.3, this fixes the build with llvm 10.

  Changelog:
  https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=244235

  PR:		244235 (based on)
  Submitted by:	dim

Changes:
  head/x11/xkbcomp/Makefile
  head/x11/xkbcomp/distinfo
Comment 5 Niclas Zeising freebsd_committer freebsd_triage 2020-02-20 20:31:44 UTC
I took the liberty of updating the port to the new release, which includes your fix.
Thanks for the help in getting it submitted upstream!