Bug 174852 - [PATCH] devel/zthread: Patch to make zthread work with Clang and recent gcc
Summary: [PATCH] devel/zthread: Patch to make zthread work with Clang and recent gcc
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Greg Larkin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-12-31 04:00 UTC by Michael Gmelin
Modified: 2013-01-17 19:10 UTC (History)
1 user (show)

See Also:


Attachments
zthread-2.3.2_2.patch (1.98 KB, patch)
2012-12-31 04:00 UTC, Michael Gmelin
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Gmelin 2012-12-31 04:00:01 UTC
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)

Fix: Apply the attached patch to specify the correct scope.
How-To-Repeat: Build using clang or gcc46/gcc47
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2012-12-31 04:00:14 UTC
Responsible Changed
From-To: freebsd-ports-bugs->glarkin

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 dfilter service freebsd_committer freebsd_triage 2013-01-17 18:59:17 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"
Comment 3 Greg Larkin freebsd_committer freebsd_triage 2013-01-17 18:59:51 UTC
State Changed
From-To: open->closed

Committed, thank you!