From freebsd@grem.de  Mon Dec 31 03:49:59 2012
Return-Path: <freebsd@grem.de>
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 3D402AD4
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 31 Dec 2012 03:49:59 +0000 (UTC)
	(envelope-from freebsd@grem.de)
Received: from mail.grem.de (outcast.grem.de [213.239.217.27])
	by mx1.freebsd.org (Postfix) with SMTP id A26488FC08
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 31 Dec 2012 03:49:58 +0000 (UTC)
Received: (qmail 62356 invoked by uid 0); 31 Dec 2012 03:49:51 -0000
Message-Id: <20121231034951.62355.qmail@mail.grem.de>
Date: 31 Dec 2012 03:49:51 -0000
From: Michael Gmelin <freebsd@grem.de>
To: FreeBSD-gnats-submit@freebsd.org
Cc: glarkin@FreeBSD.org
Subject: [PATCH] devel/zthread: Patch to make zthread work with Clang and recent gcc
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         174852
>Category:       ports
>Synopsis:       [PATCH] devel/zthread: Patch to make zthread work with Clang and recent gcc
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    glarkin
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Dec 31 04:00:01 UTC 2012
>Closed-Date:    Thu Jan 17 14:00:03 EST 2013
>Last-Modified:  Thu Jan 17 19:10:00 UTC 2013
>Originator:     Michael Gmelin
>Release:        FreeBSD 9.0-RELEASE amd64
>Organization:
Grem Equity GmbH
>Environment:
System: FreeBSD bsd64.grem.de 9.0-RELEASE FreeBSD 9.0-RELEASE #0: Tue Jan  3 07:46:30 UTC
>Description:

Scoping issue, won't compile on amd64 using clang. Also a return type
specification issue clang is picky about.

../include/zthread/Guard.h:117:9: error: void function 'createScope'
should not return a value
      [-Wreturn-type]
        return false;
        ^      ~~~~~
../include/zthread/Guard.h:121:5: error: void function 'createScope'
should not return a value
      [-Wreturn-type]
    return true;

../include/zthread/Guard.h:431:38: error: use of undeclared identifier
'extract'
    LockingPolicy::shareScope(*this, extract(g));
                                     ^
./ConditionImpl.h:235:40: note: in instantiation of function template
specialization 'ZThread::Guard<ZThread::FastLock,
      ZThread::UnlockedScope>::Guard<ZThread::FastLock,
ZThread::LockedScope>' requested here
        Guard<FastLock, UnlockedScope> g2(g1);
                                       ^
Condition.cxx:52:12: note: in instantiation of member function
'ZThread::ConditionImpl<ZThread::fifo_list>::wait' requested here
    _impl->wait();
           ^
../include/zthread/Guard.h:82:22: note: must qualify identifier to find
this declaration in dependent base class
  static LockHolder& extract(T& t) {

Port maintainer (glarkin@FreeBSD.org) is cc'd.

Generated with FreeBSD Port Tools 0.99_6 (mode: change, diff: suffix)
>How-To-Repeat:
Build using clang or gcc46/gcc47

>Fix:
Apply the attached patch to specify the correct scope.

--- zthread-2.3.2_2.patch begins here ---
diff -ruN --exclude=CVS ../zthread.orig/Makefile ./Makefile
--- ../zthread.orig/Makefile	2012-12-31 04:26:47.126767001 +0100
+++ ./Makefile	2012-12-31 04:29:27.803847188 +0100
@@ -1,13 +1,9 @@
-# New ports collection makefile for:	ZThread
-# Date created:				23 May 2001
-# Whom:					pvh@egenetics.com
-#
-# $FreeBSD: ports/devel/zthread/Makefile,v 1.29 2012/11/17 05:57:07 svnexp Exp $
-#
+# Created by: pvh@egenetics.com
+# $FreeBSD: $
 
 PORTNAME=	zthread
 PORTVERSION=	2.3.2
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	devel
 MASTER_SITES=	SF/${PORTNAME}/ZThread/${PORTVERSION}
 DISTNAME=	ZThread-${PORTVERSION}
diff -ruN --exclude=CVS ../zthread.orig/files/patch-include__zthread__Guard.h ./files/patch-include__zthread__Guard.h
--- ../zthread.orig/files/patch-include__zthread__Guard.h	2012-12-31 04:26:47.103633055 +0100
+++ ./files/patch-include__zthread__Guard.h	2012-12-31 04:42:24.083650068 +0100
@@ -1,5 +1,32 @@
---- ./include/zthread/Guard.h.orig	2005-03-12 21:10:09.000000000 -0500
-+++ ./include/zthread/Guard.h	2009-04-23 15:03:09.000000000 -0400
+--- ./include/zthread/Guard.h.orig	2005-03-13 03:10:09.000000000 +0100
++++ ./include/zthread/Guard.h	2012-12-31 04:25:54.167937596 +0100
+@@ -108,7 +108,7 @@
+   }
+ 
+   template <class LockType>
+-  static void createScope(LockHolder<LockType>& l, unsigned long ms) {
++  static bool createScope(LockHolder<LockType>& l, unsigned long ms) {
+ 
+     if(Scope1::createScope(l, ms))
+       if(!Scope2::createScope(l, ms)) {
+@@ -428,7 +428,7 @@
+   template <class U, class V>
+   Guard(Guard<U, V>& g) : LockHolder<LockType>(g) {
+ 
+-    LockingPolicy::shareScope(*this, extract(g));
++    LockingPolicy::shareScope(*this, this->extract(g));
+     
+   }
+ 
+@@ -458,7 +458,7 @@
+   template <class U, class V>
+   Guard(Guard<U, V>& g, LockType& lock) : LockHolder<LockType>(lock) {
+ 
+-    LockingPolicy::transferScope(*this, extract(g));
++    LockingPolicy::transferScope(*this, this->extract(g));
+ 
+   }
+ 
 @@ -491,7 +491,7 @@
      
    try {
--- zthread-2.3.2_2.patch ends here ---

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->glarkin 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Mon Dec 31 04:00:14 UTC 2012 
Responsible-Changed-Why:  
Over to maintainer (via the GNATS Auto Assign Tool) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=174852 
State-Changed-From-To: open->closed 
State-Changed-By: glarkin 
State-Changed-When: Thu Jan 17 13:59:51 EST 2013 
State-Changed-Why:  
Committed, thank you! 

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

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/174852: commit references a PR
Date: Thu, 17 Jan 2013 18:59:17 +0000 (UTC)

 Author: glarkin
 Date: Thu Jan 17 18:59:07 2013
 New Revision: 310556
 URL: http://svnweb.freebsd.org/changeset/ports/310556
 
 Log:
   - Fixed clang and current gcc build
   - Suppressed warnings emitted by clang
   
   PR:		ports/174852
   Submitted by:	Michael Gmelin <freebsd@grem.de>
 
 Added:
   head/devel/zthread/files/patch-src__ThreadQueue.cxx   (contents, props changed)
 Modified:
   head/devel/zthread/Makefile
   head/devel/zthread/files/patch-include__zthread__Guard.h
 
 Modified: head/devel/zthread/Makefile
 ==============================================================================
 --- head/devel/zthread/Makefile	Thu Jan 17 18:57:54 2013	(r310555)
 +++ head/devel/zthread/Makefile	Thu Jan 17 18:59:07 2013	(r310556)
 @@ -1,9 +1,5 @@
 -# New ports collection makefile for:	ZThread
 -# Date created:				23 May 2001
 -# Whom:					pvh@egenetics.com
 -#
 +# Created by: pvh@egenetics.com
  # $FreeBSD$
 -#
  
  PORTNAME=	zthread
  PORTVERSION=	2.3.2
 @@ -23,6 +19,8 @@ MAKE_ARGS+=	INSTALL_PROGRAM="${INSTALL_S
  MAKE_ENV+=	SED=sed # req'd for LIBTOOL?!
  USE_LDCONFIG=	yes
  
 +OPTIONS_DEFINE=	DOCS
 +
  PORTDOCS=	AUTHORS ChangeLog NEWS README TODO
  
  post-extract:
 @@ -31,8 +29,10 @@ post-extract:
  post-patch:
  	@${FIND} ${WRKSRC} \( -name '*.orig' -or -name '*.swp' \) -delete
  
 +.include <bsd.port.options.mk>
 +
  post-install:
 -.if !defined(NOPORTDOCS)
 +.if ${PORT_OPTIONS:MDOCS}
  	@${INSTALL} -d ${DOCSDIR}
  	@cd ${WRKSRC} && ${INSTALL_DATA} ${PORTDOCS} ${DOCSDIR}
  .endif
 
 Modified: head/devel/zthread/files/patch-include__zthread__Guard.h
 ==============================================================================
 --- head/devel/zthread/files/patch-include__zthread__Guard.h	Thu Jan 17 18:57:54 2013	(r310555)
 +++ head/devel/zthread/files/patch-include__zthread__Guard.h	Thu Jan 17 18:59:07 2013	(r310556)
 @@ -1,5 +1,32 @@
  --- ./include/zthread/Guard.h.orig	2005-03-12 21:10:09.000000000 -0500
 -+++ ./include/zthread/Guard.h	2009-04-23 15:03:09.000000000 -0400
 ++++ ./include/zthread/Guard.h	2013-01-17 13:50:40.000000000 -0500
 +@@ -108,7 +108,7 @@
 +   }
 + 
 +   template <class LockType>
 +-  static void createScope(LockHolder<LockType>& l, unsigned long ms) {
 ++  static bool createScope(LockHolder<LockType>& l, unsigned long ms) {
 + 
 +     if(Scope1::createScope(l, ms))
 +       if(!Scope2::createScope(l, ms)) {
 +@@ -428,7 +428,7 @@
 +   template <class U, class V>
 +   Guard(Guard<U, V>& g) : LockHolder<LockType>(g) {
 + 
 +-    LockingPolicy::shareScope(*this, extract(g));
 ++    LockingPolicy::shareScope(*this, this->extract(g));
 +     
 +   }
 + 
 +@@ -458,7 +458,7 @@
 +   template <class U, class V>
 +   Guard(Guard<U, V>& g, LockType& lock) : LockHolder<LockType>(lock) {
 + 
 +-    LockingPolicy::transferScope(*this, extract(g));
 ++    LockingPolicy::transferScope(*this, this->extract(g));
 + 
 +   }
 + 
  @@ -491,7 +491,7 @@
       
     try {
 
 Added: head/devel/zthread/files/patch-src__ThreadQueue.cxx
 ==============================================================================
 --- /dev/null	00:00:00 1970	(empty, because file is newly added)
 +++ head/devel/zthread/files/patch-src__ThreadQueue.cxx	Thu Jan 17 18:59:07 2013	(r310556)
 @@ -0,0 +1,16 @@
 +--- ./src/ThreadQueue.cxx.orig	2005-03-12 22:55:23.000000000 -0500
 ++++ ./src/ThreadQueue.cxx	2013-01-17 13:48:32.000000000 -0500
 +@@ -139,11 +139,12 @@
 +     
 +     // Wake the main thread,if its waiting, when the last pending-thread becomes available;
 +     // Otherwise, take note that no wait for pending threads to finish is needed
 +-    if(_userThreads.empty())
 ++    if(_userThreads.empty()) {
 +       if(_waiter && _waiter != (ThreadImpl*)1)
 +         _waiter->getMonitor().notify();
 +       else
 +         _waiter = (ThreadImpl*)!_waiter;
 ++    }
 + 
 +     ZTDEBUG("1 pending-thread added.\n");
 + 
 _______________________________________________
 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:
