Re: svn commit: r228004 - in head: contrib/libcxxrt lib/libcxxrt

2011-11-27 Thread Bjoern A. Zeeb

On Sat, 26 Nov 2011, David Schultz wrote:


On Sat, Nov 26, 2011, Bjoern A. Zeeb wrote:

On Sat, 26 Nov 2011, David Chisnall wrote:


Author: theraven
Date: Sat Nov 26 18:46:33 2011
New Revision: 228004
URL: http://svn.freebsd.org/changeset/base/228004

Log:
Update libcxxrt to remove the pthread dependency.

Also add the license from upstream to contrib.


Did the license really come in this format with long lines?  It would
be great, given it looks very close to a 2-clause BSD license to make
it as close as we can get to our standard license template.


It looks like the license file came from the vendor branch.  If
it's published by the vendor that way, we shouldn't be introducing
gratuitous style differences.


If it's coming like that from the vendor it would be nice if someone
could reach out and ask them to consider the formating as in
/usr/share/examples/etc/bsd-style-copyright.

/bz

--
Bjoern A. Zeeb You have to have visions!
 Stop bit received. Insert coin for new address family.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r228004 - in head: contrib/libcxxrt lib/libcxxrt

2011-11-27 Thread David Chisnall
On 27 Nov 2011, at 09:19, Bjoern A. Zeeb wrote:

 On Sat, 26 Nov 2011, David Schultz wrote:
 
 On Sat, Nov 26, 2011, Bjoern A. Zeeb wrote:
 On Sat, 26 Nov 2011, David Chisnall wrote:
 
 Author: theraven
 Date: Sat Nov 26 18:46:33 2011
 New Revision: 228004
 URL: http://svn.freebsd.org/changeset/base/228004
 
 Log:
 Update libcxxrt to remove the pthread dependency.
 
 Also add the license from upstream to contrib.
 
 Did the license really come in this format with long lines?  It would
 be great, given it looks very close to a 2-clause BSD license to make
 it as close as we can get to our standard license template.
 
 It looks like the license file came from the vendor branch.  If
 it's published by the vendor that way, we shouldn't be introducing
 gratuitous style differences.
 
 If it's coming like that from the vendor it would be nice if someone
 could reach out and ask them to consider the formating as in
 /usr/share/examples/etc/bsd-style-copyright.

I'll do that and import it in the next merge.

David

P.S. Rumour has that some very modern text editors have a feature that lets 
them wrap the text to the size of the current window / 
terminal...___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r228004 - in head: contrib/libcxxrt lib/libcxxrt

2011-11-26 Thread David Chisnall
Author: theraven
Date: Sat Nov 26 18:46:33 2011
New Revision: 228004
URL: http://svn.freebsd.org/changeset/base/228004

Log:
  Update libcxxrt to remove the pthread dependency.
  
  Also add the license from upstream to contrib.
  
  Approved by:  dim (mentor)

Added:
  head/contrib/libcxxrt/LICENSE
 - copied unchanged from r227996, vendor/libcxxrt/dist/LICENSE
Modified:
  head/contrib/libcxxrt/exception.cc
  head/contrib/libcxxrt/memory.cc
  head/lib/libcxxrt/Makefile
Directory Properties:
  head/contrib/libcxxrt/   (props changed)

Copied: head/contrib/libcxxrt/LICENSE (from r227996, 
vendor/libcxxrt/dist/LICENSE)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/contrib/libcxxrt/LICENSE   Sat Nov 26 18:46:33 2011
(r228004, copy of r227996, vendor/libcxxrt/dist/LICENSE)
@@ -0,0 +1,14 @@
+The BSD License
+
+Copyright 2010-2011 PathScale, Inc. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without 
modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this 
list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright notice, 
this list of conditions and the following disclaimer in the documentation 
and/or other materials provided with the distribution.
+
+
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' 
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+The views and conclusions contained in the software and documentation are 
those of the authors and should not be interpreted as representing official 
policies, either expressed or implied, of PathScale, Inc.

Modified: head/contrib/libcxxrt/exception.cc
==
--- head/contrib/libcxxrt/exception.cc  Sat Nov 26 18:02:39 2011
(r228003)
+++ head/contrib/libcxxrt/exception.cc  Sat Nov 26 18:46:33 2011
(r228004)
@@ -8,6 +8,17 @@
 #include dwarf_eh.h
 #include cxxabi.h
 
+#pragma weak pthread_key_create
+#pragma weak pthread_setspecific
+#pragma weak pthread_getspecific
+#pragma weak pthread_once
+#pragma weak pthread_once
+#pragma weak pthread_cond_signal
+#pragma weak pthread_cond_wait
+#pragma weak pthread_mutex_lock
+#pragma weak pthread_mutex_unlock
+
+
 using namespace ABI_NAMESPACE;
 
 /**
@@ -289,11 +300,31 @@ static void thread_cleanup(void* thread_
 static pthread_once_t once_control = PTHREAD_ONCE_INIT;
 
 /**
+ * We may not be linked against a full pthread implementation.  If we're not,
+ * then we need to fake the thread-local storage by storing 'thread-local'
+ * things in a global.
+ */
+static bool fakeTLS;
+/**
+ * Thread-local storage for a single-threaded program.
+ */
+static __cxa_thread_info singleThreadInfo;
+/**
  * Initialise eh_key.
  */
 static void init_key(void)
 {
+   if ((0 == pthread_key_create) ||
+   (0 == pthread_setspecific) ||
+   (0 == pthread_getspecific))
+   {
+   fakeTLS = true;
+   return;
+   }
pthread_key_create(eh_key, thread_cleanup);
+   pthread_setspecific(eh_key, (void*)0x42);
+   fakeTLS = (pthread_getspecific(eh_key) != (void*)0x42);
+   pthread_setspecific(eh_key, 0);
 }
 
 /**
@@ -301,7 +332,11 @@ static void init_key(void)
  */
 static __cxa_thread_info *thread_info()
 {
-   pthread_once(once_control, init_key);
+   if ((0 == pthread_once) || pthread_once(once_control, init_key))
+   {
+   fakeTLS = true;
+   }
+   if (fakeTLS) { return singleThreadInfo; }
__cxa_thread_info *info = 
(__cxa_thread_info*)pthread_getspecific(eh_key);
if (0 == info)
{
@@ -316,6 +351,7 @@ static __cxa_thread_info *thread_info()
  */
 static __cxa_thread_info *thread_info_fast()
 {
+   if (fakeTLS) { return singleThreadInfo; }
return (__cxa_thread_info*)pthread_getspecific(eh_key);
 }
 /**
@@ -367,7 +403,10 @@ static char *emergency_malloc(size_t siz
// Only 4 emergency buffers allowed per thread!
if (info-emergencyBuffersHeld  3) { return 0; }
 
-   pthread_mutex_lock(emergency_malloc_lock);
+   if 

Re: svn commit: r228004 - in head: contrib/libcxxrt lib/libcxxrt

2011-11-26 Thread Bjoern A. Zeeb

On Sat, 26 Nov 2011, David Chisnall wrote:


Author: theraven
Date: Sat Nov 26 18:46:33 2011
New Revision: 228004
URL: http://svn.freebsd.org/changeset/base/228004

Log:
 Update libcxxrt to remove the pthread dependency.

 Also add the license from upstream to contrib.


Did the license really come in this format with long lines?  It would
be great, given it looks very close to a 2-clause BSD license to make
it as close as we can get to our standard license template.



 Approved by:   dim (mentor)

Added:
 head/contrib/libcxxrt/LICENSE
- copied unchanged from r227996, vendor/libcxxrt/dist/LICENSE
Modified:
 head/contrib/libcxxrt/exception.cc
 head/contrib/libcxxrt/memory.cc
 head/lib/libcxxrt/Makefile
Directory Properties:
 head/contrib/libcxxrt/   (props changed)

Copied: head/contrib/libcxxrt/LICENSE (from r227996, 
vendor/libcxxrt/dist/LICENSE)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/contrib/libcxxrt/LICENSE   Sat Nov 26 18:46:33 2011
(r228004, copy of r227996, vendor/libcxxrt/dist/LICENSE)
@@ -0,0 +1,14 @@
+The BSD License
+
+Copyright 2010-2011 PathScale, Inc. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without 
modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this 
list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright notice, 
this list of conditions and the following disclaimer in the documentation 
and/or other materials provided with the distribution.
+
+
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' 
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+The views and conclusions contained in the software and documentation are 
those of the authors and should not be interpreted as representing official 
policies, either expressed or implied, of PathScale, Inc.

Modified: head/contrib/libcxxrt/exception.cc
==
--- head/contrib/libcxxrt/exception.cc  Sat Nov 26 18:02:39 2011
(r228003)
+++ head/contrib/libcxxrt/exception.cc  Sat Nov 26 18:46:33 2011
(r228004)
@@ -8,6 +8,17 @@
#include dwarf_eh.h
#include cxxabi.h

+#pragma weak pthread_key_create
+#pragma weak pthread_setspecific
+#pragma weak pthread_getspecific
+#pragma weak pthread_once
+#pragma weak pthread_once
+#pragma weak pthread_cond_signal
+#pragma weak pthread_cond_wait
+#pragma weak pthread_mutex_lock
+#pragma weak pthread_mutex_unlock
+
+
using namespace ABI_NAMESPACE;

/**
@@ -289,11 +300,31 @@ static void thread_cleanup(void* thread_
static pthread_once_t once_control = PTHREAD_ONCE_INIT;

/**
+ * We may not be linked against a full pthread implementation.  If we're not,
+ * then we need to fake the thread-local storage by storing 'thread-local'
+ * things in a global.
+ */
+static bool fakeTLS;
+/**
+ * Thread-local storage for a single-threaded program.
+ */
+static __cxa_thread_info singleThreadInfo;
+/**
 * Initialise eh_key.
 */
static void init_key(void)
{
+   if ((0 == pthread_key_create) ||
+   (0 == pthread_setspecific) ||
+   (0 == pthread_getspecific))
+   {
+   fakeTLS = true;
+   return;
+   }
pthread_key_create(eh_key, thread_cleanup);
+   pthread_setspecific(eh_key, (void*)0x42);
+   fakeTLS = (pthread_getspecific(eh_key) != (void*)0x42);
+   pthread_setspecific(eh_key, 0);
}

/**
@@ -301,7 +332,11 @@ static void init_key(void)
 */
static __cxa_thread_info *thread_info()
{
-   pthread_once(once_control, init_key);
+   if ((0 == pthread_once) || pthread_once(once_control, init_key))
+   {
+   fakeTLS = true;
+   }
+   if (fakeTLS) { return singleThreadInfo; }
__cxa_thread_info *info = 
(__cxa_thread_info*)pthread_getspecific(eh_key);
if (0 == info)
{
@@ -316,6 +351,7 @@ static __cxa_thread_info *thread_info()
 */
static __cxa_thread_info *thread_info_fast()
{
+   if (fakeTLS) { return singleThreadInfo; }
return (__cxa_thread_info*)pthread_getspecific(eh_key);
}
/**
@@ -367,7 +403,10 @@ static char 

Re: svn commit: r228004 - in head: contrib/libcxxrt lib/libcxxrt

2011-11-26 Thread David Schultz
On Sat, Nov 26, 2011, Bjoern A. Zeeb wrote:
 On Sat, 26 Nov 2011, David Chisnall wrote:
 
 Author: theraven
 Date: Sat Nov 26 18:46:33 2011
 New Revision: 228004
 URL: http://svn.freebsd.org/changeset/base/228004
 
 Log:
  Update libcxxrt to remove the pthread dependency.
 
  Also add the license from upstream to contrib.
 
 Did the license really come in this format with long lines?  It would
 be great, given it looks very close to a 2-clause BSD license to make
 it as close as we can get to our standard license template.

It looks like the license file came from the vendor branch.  If
it's published by the vendor that way, we shouldn't be introducing
gratuitous style differences.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org