From nobody@FreeBSD.org  Wed Sep 12 14:42:01 2012
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DC611106564A
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 12 Sep 2012 14:42:01 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id AC0CB8FC15
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 12 Sep 2012 14:42:01 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.5/8.14.5) with ESMTP id q8CEg1cI060448
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 12 Sep 2012 14:42:01 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.5/8.14.5/Submit) id q8CEg12I060447;
	Wed, 12 Sep 2012 14:42:01 GMT
	(envelope-from nobody)
Message-Id: <201209121442.q8CEg12I060447@red.freebsd.org>
Date: Wed, 12 Sep 2012 14:42:01 GMT
From: Vitaly Magerya <vmagerya@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [patch] sysutils/uhidd: make it work with clang (encoding-related)
X-Send-Pr-Version: www-3.1
X-GNATS-Notify: kaiwang27@gmail.com

>Number:         171575
>Category:       ports
>Synopsis:       [patch] sysutils/uhidd: make it work with clang (encoding-related)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Sep 12 14:50:02 UTC 2012
>Closed-Date:    Thu Nov 15 10:21:48 UTC 2012
>Last-Modified:  Thu Nov 15 10:21:48 UTC 2012
>Originator:     Vitaly Magerya
>Release:        FreeBSD 9.1-RC1 amd64
>Organization:
>Environment:
>Description:
Currently building sysutils/uhidd does not work if you set
CC=clang in make.conf:

    usage_in_page.c:4602:11: error: illegal character encoding
    in string literal [-Werror,-Winvalid-source-encoding]
                            return("Horizontal Moir<E9>");
                                   ^
    usage_in_page.c:4604:11: error: illegal character encoding
    in string literal [-Werror,-Winvalid-source-encoding]
                            return("Vertical Moir<E9>");
                                   ^
    2 errors generated.

It appears that GCC defaults to UTF-8, while clang can only
handle ASCII, so combination of UTF-8 and -Werror causes errors.
>How-To-Repeat:

>Fix:
There are two ways of fixing this: one is to change non-ASCII
characters into escape sequences like this:

diff -ruN uhidd.orig/files/patch-uhidd-usage_in_page.awk uhidd/files/patch-uhidd-usage_in_page.awk
--- uhidd.orig/files/patch-uhidd-usage_in_page.awk      1970-01-01 03:00:00.000000000 +0300
+++ uhidd/files/patch-uhidd-usage_in_page.awk   2012-09-12 17:17:33.000000000 +0300
@@ -0,0 +1,10 @@
+--- uhidd/usage_in_page.awk.orig       2012-09-12 17:15:02.000000000 +0300
++++ uhidd/usage_in_page.awk    2012-09-12 17:16:54.000000000 +0300
+@@ -33,6 +33,7 @@
+       str = substr($0, index($0, $2), length)
+       gsub(/\\/, "\\\\", str)
+       gsub("\"", "\\\"", str)
++      gsub("Moir.*", "Moir\\xc3\\xa9", str);
+       printf("\t\t\treturn(\"%s\");\n", str);
+     }
+ }

Another (and I think this is a slightly better fix) is to simply
disable -Werror; see the attached patch.

Patch attached with submission follows:

diff -ruN uhidd.orig/Makefile uhidd/Makefile
--- uhidd.orig/Makefile	2012-09-12 16:42:14.000000000 +0300
+++ uhidd/Makefile	2012-09-12 17:30:06.000000000 +0300
@@ -34,6 +34,8 @@
 
 .include <bsd.port.pre.mk>
 
+MAKE_ENV+=	NO_WERROR=y
+
 .if defined(DEBUG_FLAGS)
 MAKE_ENV+=	DEBUG_FLAGS='${DEBUG_FLAGS}'
 .endif


>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: edwin 
State-Changed-When: Wed Sep 12 14:50:14 UTC 2012 
State-Changed-Why:  
Awaiting maintainers feedback (via the GNATS Auto Assign Tool) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=171575 

From: Edwin Groothuis <edwin@FreeBSD.org>
To: kaiw@freebsd.org
Cc: bug-followup@FreeBSD.org
Subject: Re: ports/171575: [patch] sysutils/uhidd: make it work with clang (encoding-related)
Date: Wed, 12 Sep 2012 14:50:11 UT

 Maintainer of sysutils/uhidd,
 
 Please note that PR ports/171575 has just been submitted.
 
 If it contains a patch for an upgrade, an enhancement or a bug fix
 you agree on, reply to this email stating that you approve the patch
 and a committer will take care of it.
 
 The full text of the PR can be found at:
     http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/171575
 
 -- 
 Edwin Groothuis via the GNATS Auto Assign Tool
 edwin@FreeBSD.org

From: Vitaly Magerya <vmagerya@gmail.com>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/171575: [patch] sysutils/uhidd: make it work with clang (encoding-related)
Date: Wed, 12 Sep 2012 18:08:04 +0300

 --bcaec501c140c7fcd104c9828e1b
 Content-Type: text/plain; charset=UTF-8
 
 Actually, in the above patch it's better to add NO_WERROR to
 MAKE_ENV a few lines above. Like in the new attachment.
 
 --bcaec501c140c7fcd104c9828e1b
 Content-Type: text/plain; charset=US-ASCII; name="uhidd-no-werror-2.diff.txt"
 Content-Disposition: attachment; filename="uhidd-no-werror-2.diff.txt"
 Content-Transfer-Encoding: base64
 X-Attachment-Id: file0
 
 LS0tIE1ha2VmaWxlLm9yaWcJMjAxMi0wOS0xMiAxODowMjoxOC4wMDAwMDAwMDAgKzAzMDAKKysr
 IE1ha2VmaWxlCTIwMTItMDktMTIgMTg6MDI6MzUuMDAwMDAwMDAwICswMzAwCkBAIC0xOSw3ICsx
 OSw3IEBACiAKIE9QVElPTlM9CURFVkQgIkluc3RhbGwgZGV2ZCBmaWxlcyIgb24KIAotTUFLRV9F
 TlYrPQlTWVNESVI9JHtTWVNESVJ9CitNQUtFX0VOVis9CVNZU0RJUj0ke1NZU0RJUn0gTk9fV0VS
 Uk9SPXllcwogS01PRERJUj89CS9ib290L21vZHVsZXMKIFNSQ19CQVNFPz0JL3Vzci9zcmMKIFNZ
 U0RJUj89CSR7U1JDX0JBU0V9L3N5cwo=
 --bcaec501c140c7fcd104c9828e1b--

From: Jan Beich <jbeich@tormail.org>
To: Vitaly Magerya <vmagerya@gmail.com>
Cc: bug-followup@FreeBSD.org
Subject: Re: ports/171575: [patch] sysutils/uhidd: make it work with clang (encoding-related)
Date: Thu, 13 Sep 2012 06:12:24 -0500

 --=-=-=
 Content-Type: text/plain
 
 Vitaly Magerya <vmagerya@gmail.com> writes:
 
 > Another (and I think this is a slightly better fix) is to simply
 > disable -Werror; see the attached patch.
 [...]
 > +MAKE_ENV+=	NO_WERROR=y
 
 What if there's a KPI change? Let's use -Wno-error=invalid-source-encoding
 until clang grows support for iconv (-finput-charset, et al.)
 
 
 --=-=-=
 Content-Type: text/x-patch
 Content-Disposition: attachment; filename=clang_literal_workaround.diff
 
 Index: sysutils/uhidd/Makefile
 ===================================================================
 --- sysutils/uhidd/Makefile	(revision 303636)
 +++ sysutils/uhidd/Makefile	(working copy)
 @@ -34,6 +34,10 @@ MAN8=		uhidd.8
  
  .include <bsd.port.pre.mk>
  
 +.if !empty(CC:M*clang*)
 +CFLAGS+=	-Wno-error=invalid-source-encoding
 +.endif
 +
  .if defined(DEBUG_FLAGS)
  MAKE_ENV+=	DEBUG_FLAGS='${DEBUG_FLAGS}'
  .endif
 
 --=-=-=--

From: Vitaly Magerya <vmagerya@gmail.com>
To: Jan Beich <jbeich@tormail.org>
Cc: bug-followup@FreeBSD.org
Subject: Re: ports/171575: [patch] sysutils/uhidd: make it work with clang
 (encoding-related)
Date: Thu, 13 Sep 2012 14:26:31 +0300

 Jan Beich wrote:
 > What if there's a KPI change?
 > [...]
 > +.if !empty(CC:M*clang*)
 > +CFLAGS+=	-Wno-error=invalid-source-encoding
 > +.endif
 
 The reason I did not propose this is because /usr/bin/cc will become
 clang some time soon, so that kind of detection will not work (and gcc
 does not recognize that option, so one can't use it unconditionally).
 
 If preserving -Werror is desired, the first patch in the PR above can be
 used (I'm afraid it's formatting is broken, but the idea should be clear).

From: Kai Wang <kaiwang27@gmail.com>
To: bug-followup@FreeBSD.org, vmagerya@gmail.com
Cc:  
Subject: Re: ports/171575: [patch] sysutils/uhidd: make it work with clang
 (encoding-related)
Date: Thu, 15 Nov 2012 11:16:46 +0100

 I think maybe we can close this PR?  The issue is workaround'ed by
 commit r306286, and I will integrate the patch in r306286 to upstream.
State-Changed-From-To: feedback->closed 
State-Changed-By: n_hibma 
State-Changed-When: Thu Nov 15 10:21:32 UTC 2012 
State-Changed-Why:  
Already fixed. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=171575 
>Unformatted:
