From nobody@FreeBSD.org  Sun May  5 17:57:32 2013
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1])
	by hub.freebsd.org (Postfix) with ESMTP id B3B05C22
	for <freebsd-gnats-submit@FreeBSD.org>; Sun,  5 May 2013 17:57:32 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from oldred.FreeBSD.org (oldred.freebsd.org [8.8.178.121])
	by mx1.freebsd.org (Postfix) with ESMTP id A60A3784
	for <freebsd-gnats-submit@FreeBSD.org>; Sun,  5 May 2013 17:57:32 +0000 (UTC)
Received: from oldred.FreeBSD.org ([127.0.1.6])
	by oldred.FreeBSD.org (8.14.5/8.14.5) with ESMTP id r45HvWHb022049
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 5 May 2013 17:57:32 GMT
	(envelope-from nobody@oldred.FreeBSD.org)
Received: (from nobody@localhost)
	by oldred.FreeBSD.org (8.14.5/8.14.5/Submit) id r45HvWxf022048;
	Sun, 5 May 2013 17:57:32 GMT
	(envelope-from nobody)
Message-Id: <201305051757.r45HvWxf022048@oldred.FreeBSD.org>
Date: Sun, 5 May 2013 17:57:32 GMT
From: Norikatsu Shigemura <nork@FreeBSD.org>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [ports/net/pchar] Fix compile error by avoid sizeof(bool) test, and Reduce compiler warning.
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         178350
>Category:       ports
>Synopsis:       net/pchar: Fix compile error by avoid sizeof(bool) test, and Reduce compiler warning.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    wg
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun May 05 18:00:00 UTC 2013
>Closed-Date:    Sat Jun 08 13:02:04 UTC 2013
>Last-Modified:  Sat Jun  8 13:10:00 UTC 2013
>Originator:     Norikatsu Shigemura
>Release:        FreeBSD/amd64 10.0-CURRENT
>Organization:
Personal
>Environment:
FreeBSD pelsia.ninth-nine.com 10.0-CURRENT FreeBSD 10.0-CURRENT #147 r250254M: Sun May  5 21:15:09 JST 2013     nork@pelsia.ninth-nine.com:/usr/obj/usr/src/sys/PELSIA  amd64
>Description:
pchar's configure did test noncompliance sizeof(bool) on C++ compiler.
To avoid this issue, I submit to set 'ac_cv_sizeof_bool=1' on CONFIGURE_ENV.

And I fixed some simple and blatant compiler warnings.
>How-To-Repeat:
cd /usr/ports/net/pchar
env CXX=clang++ make
 :
checking size of bool... 0
 :
===>  Building for pchar-1.5
clang++ -O2 -pipe -march=core2 -fno-strict-aliasing -I. -DSIZEOF_BOOL=0 -DHAVE_SOCKLEN_T=1 -DSTDC_HEADERS=1 -DHAVE_UNISTD_H=1 -DHAVE_STRINGS_H=1 -DHAVE_SOCKADDR_SA_LEN=1 -DHAVE_HERROR=1 -DHAVE_SNPRINTF=1 -DHAVE_LIBM=1 -DHAVE_IPV6=1 -DHAVE_PCAP=1 -DHAVE_LIBPCAP=1 -DHAVE_BPF=1 -c main.cc -o main.o
In file included from main.cc:48:
./pc.h:28:15: error: expected '}'
typedef enum {false, true} bool;
              ^
./pc.h:28:14: note: to match this '{'
typedef enum {false, true} bool;
             ^
./pc.h:28:28: error: redeclaration of C++ built-in type 'bool'
typedef enum {false, true} bool;
                           ^
2 errors generated.
*** [main.o] Error code 1
>Fix:
Please apply my attached patch file.

Patch attached with submission follows:

Index: Makefile
===================================================================
--- Makefile	(revision 317421)
+++ Makefile	(working copy)
@@ -17,6 +17,7 @@
 .include <bsd.port.pre.mk>
 
 CONFIGURE_ARGS= --with-pcap
+CONFIGURE_ENV+=	ac_cv_sizeof_bool=1
 
 .if !defined(NOPORTDOCS)
 post-install:
Index: files/patch-Pctest.h
===================================================================
--- files/patch-Pctest.h	(revision 0)
+++ files/patch-Pctest.h	(working copy)
@@ -0,0 +1,11 @@
+--- Pctest.h.orig	2005-02-13 05:32:18.000000000 +0900
++++ Pctest.h	2013-05-06 00:39:43.413338781 +0900
+@@ -86,7 +86,7 @@
+     virtual char *GetPrintableAddress() = 0;
+     virtual char *GetPrintableAddress(void *a) = 0;
+     virtual char *GetName(void *a) = 0;
+-    virtual char *GetAddressFamilyString() = 0;
++    virtual const char *GetAddressFamilyString() = 0;
+     virtual int GetAddressFamily() = 0;
+ 
+     // Get input and output sockets needed
Index: files/patch-PctestIpv4.h
===================================================================
--- files/patch-PctestIpv4.h	(revision 0)
+++ files/patch-PctestIpv4.h	(working copy)
@@ -0,0 +1,11 @@
+--- PctestIpv4.h.orig	2005-02-13 05:32:18.000000000 +0900
++++ PctestIpv4.h	2013-05-06 00:36:17.432762986 +0900
+@@ -77,7 +77,7 @@
+     virtual char *GetPrintableAddress();
+     virtual char *GetPrintableAddress(void *a);
+     virtual char *GetName(void *a);
+-    virtual char *GetAddressFamilyString() { return "AF_INET"; };
++    virtual const char *GetAddressFamilyString() { return "AF_INET"; };
+     virtual int GetAddressFamily() { return (AF_INET); };
+     
+   protected:
Index: files/patch-PctestIpv6.h
===================================================================
--- files/patch-PctestIpv6.h	(revision 0)
+++ files/patch-PctestIpv6.h	(working copy)
@@ -0,0 +1,11 @@
+--- PctestIpv6.h.orig	2005-02-13 05:32:18.000000000 +0900
++++ PctestIpv6.h	2013-05-06 00:36:41.683117194 +0900
+@@ -82,7 +82,7 @@
+     virtual char *GetPrintableAddress();
+     virtual char *GetPrintableAddress(void *a);
+     virtual char *GetName(void *a);
+-    virtual char *GetAddressFamilyString() { return "AF_INET6"; }
++    virtual const char *GetAddressFamilyString() { return "AF_INET6"; }
+     virtual int GetAddressFamily() { return (AF_INET6); }
+     
+   protected:
Index: files/patch-main.cc
===================================================================
--- files/patch-main.cc	(revision 0)
+++ files/patch-main.cc	(working copy)
@@ -0,0 +1,20 @@
+--- main.cc.orig	2005-02-13 05:32:18.000000000 +0900
++++ main.cc	2013-05-06 00:41:42.842653383 +0900
+@@ -292,7 +292,7 @@
+ //
+ // Output:  ASCII representation of network protocol name.
+ //
+-char *GetPrintableNetworkProtocol(NetworkProtocolType np)
++const char *GetPrintableNetworkProtocol(NetworkProtocolType np)
+ {
+     switch (np) {
+     case (NetworkProtocolIpv4Udp): 
+@@ -371,7 +371,7 @@
+ 	case 'b': {
+ 	    Burst = atoi(optarg);
+ 	    if (Burst < 1) {
+-		fprintf(stderr, "Warning: burst size %d too small; resetting to 1\n");
++		fprintf(stderr, "Warning: burst size %u too small; resetting to 1\n", Burst);
+ 		Burst = 1;
+ 	    }
+ 	    break;


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->wg 
Responsible-Changed-By: wg 
Responsible-Changed-When: Sat Jun 8 12:49:17 UTC 2013 
Responsible-Changed-Why:  
I'll take it. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=178350 
State-Changed-From-To: open->closed 
State-Changed-By: wg 
State-Changed-When: Sat Jun 8 13:02:03 UTC 2013 
State-Changed-Why:  
Committed. Thanks! 

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

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/178350: commit references a PR
Date: Sat,  8 Jun 2013 13:01:24 +0000 (UTC)

 Author: wg
 Date: Sat Jun  8 13:01:16 2013
 New Revision: 320248
 URL: http://svnweb.freebsd.org/changeset/ports/320248
 
 Log:
   - Fix build with clang and warnings [1]
   - Use PLIST_FILES instead of pkg-plist
   - NOPORTDOCS -> PORT_OPTIONS:MDOCS
   
   PR:		ports/178350 [1]
   Submitted by:	nork [1]
   Approved by:	culot / jpaetzel (mentors, implicit)
 
 Added:
   head/net/pchar/files/
   head/net/pchar/files/patch-Pctest.h   (contents, props changed)
   head/net/pchar/files/patch-PctestIpv4.h   (contents, props changed)
   head/net/pchar/files/patch-PctestIpv6.h   (contents, props changed)
   head/net/pchar/files/patch-main.cc   (contents, props changed)
 Deleted:
   head/net/pchar/pkg-plist
 Modified:
   head/net/pchar/Makefile
 
 Modified: head/net/pchar/Makefile
 ==============================================================================
 --- head/net/pchar/Makefile	Sat Jun  8 12:56:56 2013	(r320247)
 +++ head/net/pchar/Makefile	Sat Jun  8 13:01:16 2013	(r320248)
 @@ -14,14 +14,19 @@ COMMENT=	Sandia Internet path characteri
  GNU_CONFIGURE=	yes
  MAN8=		pchar.8
  
 -.include <bsd.port.pre.mk>
 -
  CONFIGURE_ARGS= --with-pcap
 +CONFIGURE_ENV+=	ac_cv_sizeof_bool=1
 +
 +PLIST_FILES=	sbin/pchar
 +
 +PORTDOCS=	README CHANGES FAQ
 +
 +.include <bsd.port.options.mk>
  
 -.if !defined(NOPORTDOCS)
 +.if ${PORT_OPTIONS:MDOCS}
  post-install:
  	@${MKDIR} ${DOCSDIR}
 -	cd ${WRKSRC} ; ${INSTALL_DATA} README CHANGES FAQ ${DOCSDIR}
 +	${INSTALL_DATA} ${PORTDOCS:S|^|${WRKSRC}/|} ${DOCSDIR}
  .endif
  
 -.include <bsd.port.post.mk>
 +.include <bsd.port.mk>
 
 Added: head/net/pchar/files/patch-Pctest.h
 ==============================================================================
 --- /dev/null	00:00:00 1970	(empty, because file is newly added)
 +++ head/net/pchar/files/patch-Pctest.h	Sat Jun  8 13:01:16 2013	(r320248)
 @@ -0,0 +1,11 @@
 +--- Pctest.h.orig	2005-02-13 05:32:18.000000000 +0900
 ++++ Pctest.h	2013-05-06 00:39:43.413338781 +0900
 +@@ -86,7 +86,7 @@
 +     virtual char *GetPrintableAddress() = 0;
 +     virtual char *GetPrintableAddress(void *a) = 0;
 +     virtual char *GetName(void *a) = 0;
 +-    virtual char *GetAddressFamilyString() = 0;
 ++    virtual const char *GetAddressFamilyString() = 0;
 +     virtual int GetAddressFamily() = 0;
 + 
 +     // Get input and output sockets needed
 
 Added: head/net/pchar/files/patch-PctestIpv4.h
 ==============================================================================
 --- /dev/null	00:00:00 1970	(empty, because file is newly added)
 +++ head/net/pchar/files/patch-PctestIpv4.h	Sat Jun  8 13:01:16 2013	(r320248)
 @@ -0,0 +1,11 @@
 +--- PctestIpv4.h.orig	2005-02-13 05:32:18.000000000 +0900
 ++++ PctestIpv4.h	2013-05-06 00:36:17.432762986 +0900
 +@@ -77,7 +77,7 @@
 +     virtual char *GetPrintableAddress();
 +     virtual char *GetPrintableAddress(void *a);
 +     virtual char *GetName(void *a);
 +-    virtual char *GetAddressFamilyString() { return "AF_INET"; };
 ++    virtual const char *GetAddressFamilyString() { return "AF_INET"; };
 +     virtual int GetAddressFamily() { return (AF_INET); };
 +     
 +   protected:
 
 Added: head/net/pchar/files/patch-PctestIpv6.h
 ==============================================================================
 --- /dev/null	00:00:00 1970	(empty, because file is newly added)
 +++ head/net/pchar/files/patch-PctestIpv6.h	Sat Jun  8 13:01:16 2013	(r320248)
 @@ -0,0 +1,11 @@
 +--- PctestIpv6.h.orig	2005-02-13 05:32:18.000000000 +0900
 ++++ PctestIpv6.h	2013-05-06 00:36:41.683117194 +0900
 +@@ -82,7 +82,7 @@
 +     virtual char *GetPrintableAddress();
 +     virtual char *GetPrintableAddress(void *a);
 +     virtual char *GetName(void *a);
 +-    virtual char *GetAddressFamilyString() { return "AF_INET6"; }
 ++    virtual const char *GetAddressFamilyString() { return "AF_INET6"; }
 +     virtual int GetAddressFamily() { return (AF_INET6); }
 +     
 +   protected:
 
 Added: head/net/pchar/files/patch-main.cc
 ==============================================================================
 --- /dev/null	00:00:00 1970	(empty, because file is newly added)
 +++ head/net/pchar/files/patch-main.cc	Sat Jun  8 13:01:16 2013	(r320248)
 @@ -0,0 +1,20 @@
 +--- main.cc.orig	2005-02-13 05:32:18.000000000 +0900
 ++++ main.cc	2013-05-06 00:41:42.842653383 +0900
 +@@ -292,7 +292,7 @@
 + //
 + // Output:  ASCII representation of network protocol name.
 + //
 +-char *GetPrintableNetworkProtocol(NetworkProtocolType np)
 ++const char *GetPrintableNetworkProtocol(NetworkProtocolType np)
 + {
 +     switch (np) {
 +     case (NetworkProtocolIpv4Udp): 
 +@@ -371,7 +371,7 @@
 + 	case 'b': {
 + 	    Burst = atoi(optarg);
 + 	    if (Burst < 1) {
 +-		fprintf(stderr, "Warning: burst size %d too small; resetting to 1\n");
 ++		fprintf(stderr, "Warning: burst size %u too small; resetting to 1\n", Burst);
 + 		Burst = 1;
 + 	    }
 + 	    break;
 _______________________________________________
 svn-ports-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-ports-all
 To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
 
>Unformatted:
