From nobody@FreeBSD.org  Wed Aug  8 20:22:50 2012
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id E8D6F106566C
	for <freebsd-gnats-submit@FreeBSD.org>; Wed,  8 Aug 2012 20:22:50 +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 B9CDB8FC14
	for <freebsd-gnats-submit@FreeBSD.org>; Wed,  8 Aug 2012 20:22:50 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id q78KMov3090323
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 8 Aug 2012 20:22:50 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id q78KMomR090322;
	Wed, 8 Aug 2012 20:22:50 GMT
	(envelope-from nobody)
Message-Id: <201208082022.q78KMomR090322@red.freebsd.org>
Date: Wed, 8 Aug 2012 20:22:50 GMT
From: Dan McGregor <dan.mcgregor@usask.ca>
To: freebsd-gnats-submit@FreeBSD.org
Subject: mkcsmapper doesn't build with clang
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         170489
>Category:       bin
>Synopsis:       mkcsmapper doesn't build with clang
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Aug 08 20:30:01 UTC 2012
>Closed-Date:    Wed Aug 08 21:09:49 UTC 2012
>Last-Modified:  Wed Aug 08 21:09:49 UTC 2012
>Originator:     Dan McGregor
>Release:        9
>Organization:
>Environment:
FreeBSD current.local 9.1-PRERELEASE FreeBSD 9.1-PRERELEASE #8 r238800M: Thu Jul 26 13:59:32 CST 2012     dan@shadrach.dyndns.org:/usr/obj/usr/src/sys/SHADRACH  amd64
>Description:
mkcsmapper doesn't use the "input" function emitted by lex.  Since it's not needed clang throws a warning (new gcc does too), and FreeBSD is compiled with -Werror by default, causing a build error.

(148) dan@current:/usr/src% make buildenv
Entering world for amd64:amd64
(%h) %n@%m:%~%# cd usr.bin/mkcsmapper
(%h) %n@%m:%~%# make
lex -t  /usr/src/usr.bin/mkcsmapper/lex.l > lex.c
yacc -d -o yacc.c /usr/src/usr.bin/mkcsmapper/yacc.y
clang -O2 -pipe  -I/usr/src/usr.bin/mkcsmapper -I/usr/src/usr.bin/mkcsmapper/../mkcsmapper  -I/usr/src/usr.bin/mkcsmapper/../../lib/libc/iconv  -I/usr/src/usr.bin/mkcsmapper/../../lib/libiconv_modules/mapper_std  --param max-inline-insns-single=64 -g -std=gnu99 -Qunused-arguments -fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -Wold-style-definition -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -c lex.c
/usr/src/usr.bin/mkcsmapper/lex.l:493:12: error: function 'input' is not needed and will not be emitted
      [-Werror,-Wunneeded-internal-declaration]
static int input(void)
           ^
1 error generated.
*** [lex.o] Error code 1

Stop in /usr/src/usr.bin/mkcsmapper.
>How-To-Repeat:
Try to build current with WITH_ICONV set and CC/CXX set to clang.
>Fix:
#define-ing YY_NO_INPUT in the lex input file solves this.  Patch attached.

Patch attached with submission follows:

Index: lex.l
===================================================================
--- lex.l	(revision 239141)
+++ lex.l	(working copy)
@@ -41,6 +41,7 @@
 #include "ldef.h"
 #include "yacc.h"
 
+#define YY_NO_INPUT
 int line_number = 1;
 %}
 %option	nounput


>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: zeising 
State-Changed-When: Wed Aug 8 21:09:48 UTC 2012 
State-Changed-Why:  
Duplicate of bin/167481. Thanks for submission! 

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