Re: svn commit: r240549 - head/sys/arm/tegra

2012-09-16 Thread David Chisnall
On 16 Sep 2012, at 10:37, Chris Rees wrote:

 Actually:
 
 for (;;)
;

This form will generate a compiler warning, because it looks like a missing 
loop body.  You can silence the warning by this form:

for (;;) {}

This makes it clear that you have an explicit body containing no statements.  

David___
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: r240850 - head/lib/libstand

2012-09-24 Thread David Chisnall
On 23 Sep 2012, at 20:27, Garrett Cooper wrote:

+1. free(3) should silently ignore NULL parameters passed into it.

Indeed.  The C standard's description for free() states that:

 If ptr is a null pointer, no action occurs.

This means that a standards-compilant compiler is entirely at liberty to elide 
these checks (not sure if GCC or LLVM does, but both have optimisation passes 
that optimise based on assumptions about standard library functions, although 
they may not run when compiled in a freestanding environment).

The only reasons for a NULL check before free() should be:

- Sanity checking (i.e. this pointer is never meant to be NULL, assert that it 
isnt)
- Recursive cleanup (don't dereference this pointer to clean up its elements if 
it is NULL)

David___
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: r241373 - head/lib/libc/stdlib

2012-10-09 Thread David Chisnall
On 9 Oct 2012, at 17:33, Andrey Chernov wrote:

 Do you check assembler output for _both_ cases?
 In my testing clang and gcc xor's 'junk' properly in case it have
 'volatile' keyword (as in srandomdev()) and elide it without 'volatile'.
 IMHO this change should be backed out for srandomdev() and adding
 'volatile' for sranddev() instead.

In it's original form, it is very dangerous - the whole expression reduces to 
undefined and so the LLVM IR for the call is:

call void @srand(i32 undef)

The back end is then free to use any value for the call argument, including any 
register value or 0.  Since the value is passed in a register, it will probably 
just use whatever the last value there is, which may or may not be anything 
sensible.  On MIPS, for example, this is most likely to be tv, and so is 100% 
deterministic.

Adding the volatile means that we are doing an XOR with a value left on the 
stack.  If this is early on in the application, then it is most likely to be 0. 
 If it's later on, then there may be a value here, but it's still not very 
likely to be something particularly unpredictable.  

David
___
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: r241931 - in head/sys: conf kern

2012-10-23 Thread David Chisnall
On 23 Oct 2012, at 16:05, Andre Oppermann wrote:

 For zero copy send we're trying to come up with a sendfile-like
 approach where the page is simply wired into kernel space.  The
 application then is not allowed to touch it until the socket
 buffer has released it again.  The main issue here is how to
 provide feedback to the application when it is safe for reuse.

It's been a few years since I used it, but I thought that aio_write() already 
provided this.  The application may not modify the contents of the memory 
pointed to by aio_buf until after it has received notification that the write 
has finished.  This happens either via a signal directly, a signal polled by 
kqueue, or a call to aio_return().

David
___
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: r236137 - head/contrib/gcc/config/i386

2012-05-28 Thread David Chisnall
On 28 May 2012, at 20:33, Dimitry Andric wrote:

 On the other hand, it's really platform-dependent: I've checked several
 Linux distributions, and it is fairly unpredictable whether their gcc
 passes --hash-style to the linker, or if they do, which option they use.

Can we make it dependent on the triple?  i.e. if the triple is 
arch-whatever-freebsd9 or greater, make it pass the flag, otherwise don't 
bother?  Or is it not worth caring about older FreeBSD?  There's no real 
disadvantage in passing it unconditionally (marginally longer link times) and 
potentially a big benefit.  I don't see a problem with committing it upstream, 
but it would be nice to pull that change in locally before 9.1 and not have to 
wait for LLVM 3.2 before we got to make use of it.

Misleading and poorly designed benchmarks on Phoronix are at stake!

David___
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: r236137 - head/contrib/gcc/config/i386

2012-05-30 Thread David Chisnall
On 30 May 2012, at 09:01, Marius Strobl wrote:

 Ehm, yes, but given that this wouldn't be the first such flag we have
 is avoiding it really worth the link time and run time overheads in
 the long term? 

Given the small overhead of the extra hashes, yes.  At some point in the 
future, we can turn off the older ones and get a tiny reduction in overhead, 
but doing it now would cause much more pain for users in not being able to copy 
binaries from slightly newer to slightly older machines than we'd save from a 
tiny increase in binary size.

This is the archetypal change for incremental deployment, let's not make our 
users' lives difficult just because we can.

David
Who doesn't want to be woken up by mobs of users with flaming torches and 
pitchforks.___
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: r236456 - in head/sys: amd64/include i386/include

2012-06-04 Thread David Chisnall
On 4 Jun 2012, at 11:00, Tijl Coosemans wrote:

 On 02-06-2012 20:10, Konstantin Belousov wrote:
 Author: kib
 Date: Sat Jun  2 18:10:16 2012
 New Revision: 236456
 URL: http://svn.freebsd.org/changeset/base/236456
 
 Log:
  Use plain store for atomic_store_rel on x86, instead of implicitly
  locked xchg instruction.  IA32 memory model guarantees that store has
  release semantic, since stores cannot pass loads or stores.
 
 They can pass non-temporal stores can't they?

Now that we have support for C11 atomics via stdatomic.h (in current and 
stable), it would be nice to compare their performance with the assembly 
versions.  There is the potential for greater optimisation, because the 
compiler treats any asm block as a full barrier, so only the CPU, not the 
compiler, can reorder loads and stores across it.  With the C11 stuff, on a new 
compiler (clang or gcc 4.7), the compiler can perform any reordering of loads 
and stores that does not violate the semantics specified by the atomic 
operation.

David___
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: r236889 - head/lib/libc/locale

2012-06-11 Thread David Chisnall
Author: theraven
Date: Mon Jun 11 14:02:02 2012
New Revision: 236889
URL: http://svn.freebsd.org/changeset/base/236889

Log:
  Fix a leak when setting the global character locale to C from something 
else.
  
  Reported by:  mm

Modified:
  head/lib/libc/locale/setrunelocale.c

Modified: head/lib/libc/locale/setrunelocale.c
==
--- head/lib/libc/locale/setrunelocale.cMon Jun 11 13:17:45 2012
(r236888)
+++ head/lib/libc/locale/setrunelocale.cMon Jun 11 14:02:02 2012
(r236889)
@@ -89,6 +89,17 @@ const _RuneLocale *__getCurrentRuneLocal
return XLOCALE_CTYPE(__get_locale())-runes;
 }
 
+static void free_runes(_RuneLocale *rl)
+{
+   /* FIXME: The EUC check here is a hideous abstraction violation. */
+   if ((rl != _DefaultRuneLocale)  (rl)) {
+   if (strcmp(rl-__encoding, EUC) == 0) {
+   free(rl-__variable);
+   }
+   free(rl);
+   }
+}
+
 static int
 __setrunelocale(struct xlocale_ctype *l, const char *encoding)
 {
@@ -102,6 +113,7 @@ __setrunelocale(struct xlocale_ctype *l,
 * The C and POSIX locale are always here.
 */
if (strcmp(encoding, C) == 0 || strcmp(encoding, POSIX) == 0) {
+   free_runes(saved.runes);
(void) _none_init(l, (_RuneLocale*)_DefaultRuneLocale);
return (0);
}
@@ -153,13 +165,7 @@ __setrunelocale(struct xlocale_ctype *l,
 
if (ret == 0) {
/* Free the old runes if it exists. */
-   /* FIXME: The EUC check here is a hideous abstraction 
violation. */
-   if ((saved.runes != _DefaultRuneLocale)  (saved.runes)) {
-   if (strcmp(saved.runes-__encoding, EUC) == 0) {
-   free(saved.runes-__variable);
-   }
-   free(saved.runes);
-   }
+   free_runes(saved.runes);
} else {
/* Restore the saved version if this failed. */
memcpy(l, saved, sizeof(struct xlocale_ctype));
___
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: r236890 - in head: gnu/lib/libsupc++ lib/libcxxrt

2012-06-11 Thread David Chisnall
Author: theraven
Date: Mon Jun 11 15:40:57 2012
New Revision: 236890
URL: http://svn.freebsd.org/changeset/base/236890

Log:
  Clean up some symbol versions for libsupc++ / libcxxrt.
  
  MFC after:1 week
  Reviewed by:  kan

Modified:
  head/gnu/lib/libsupc++/Version.map
  head/lib/libcxxrt/Version.map

Modified: head/gnu/lib/libsupc++/Version.map
==
--- head/gnu/lib/libsupc++/Version.map  Mon Jun 11 14:02:02 2012
(r236889)
+++ head/gnu/lib/libsupc++/Version.map  Mon Jun 11 15:40:57 2012
(r236890)
@@ -126,26 +126,22 @@ CXXABI_1.3 {
 # __gnu_cxx::_verbose_terminate_handler()
 _ZN9__gnu_cxx27__verbose_terminate_handlerEv;
 
-# operator new and new[], 32-bit size_t
-_Znaj;
-_ZnajRKSt9nothrow_t;
-_Znwj;
-_ZnwjRKSt9nothrow_t;
-
-# operator new and new[], 64-bit size_t
-_Znam;
-_ZnamRKSt9nothrow_t;
-_Znwm;
-_ZnwmRKSt9nothrow_t;
+  local:
+*;
+};
+
+GLIBCXX_3.4 {
+# operator new and new[]
+_Znai[jm];
+_Zna[jm]RKSt9nothrow_t;
+_Znw[jm];
+_Znw[jm]RKSt9nothrow_t;
 
 # operator delete and delete[]
 _ZdaPv;
 _ZdaPvRKSt9nothrow_t;
 _ZdlPv;
 _ZdlPvRKSt9nothrow_t;
-
-  local:
-*;
 };
 
 CXXABI_1.3.1 {

Modified: head/lib/libcxxrt/Version.map
==
--- head/lib/libcxxrt/Version.map   Mon Jun 11 14:02:02 2012
(r236889)
+++ head/lib/libcxxrt/Version.map   Mon Jun 11 15:40:57 2012
(r236890)
@@ -306,11 +306,6 @@ CXXRT_1.0 {
 std::type_info::__is_pointer_p() const;
 
 
-operator delete[](void*);
-operator delete(void*);
-operator new[](unsigned long);
-operator new(unsigned long);
-operator new(unsigned long, std::nothrow_t const);
 
 };
 __cxa_allocate_dependent_exception;
@@ -321,3 +316,16 @@ CXXRT_1.0 {
 __cxa_rethrow_primary_exception;
 
 } CXXABI_1.3.1;
+
+GLIBCXX_3.4 {
+extern C++ {
+operator delete[](void*);
+operator delete(void*);
+operator new[](unsigned int);
+operator new(unsigned int);
+operator new(unsigned int, std::nothrow_t const);
+operator new[](unsigned long);
+operator new(unsigned long);
+operator new(unsigned long, std::nothrow_t const);
+};
+};
___
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: r237434 - in head/lib/libc: amd64/sys gen i386/sys include sys

2012-06-22 Thread David Chisnall
On 22 Jun 2012, at 08:34, Marius Strobl wrote:

 I don't know much about x86 CPUs but is my understanding correct
 that TSCs are not synchronized in any way across CPUs, i.e.
 reading it on different CPUs may result in time going backwards
 etc., which is okay for this application though?

As long as the initial value is set on every context switch, it only matters 
that the TSC is monotonic and increments at an approximately constant rate.  It 
is also possible to set the TSC value, but that's less useful in this context.

The one thing to be careful about is the fact that certain power saving states 
will affect the speed at which the TSC increments, and so it is important to 
update the ticks-per-second value whenever a core goes into a low power state.

This is more or less the same approach used by Xen, so most of the issues have 
been ironed out: Oracle complained to CPU vendors about a few corner cases and, 
because Oracle customers tend to buy a lot of expensive Xeon and Opteron chips, 
they were fixed quite promptly.  

David

___
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: r238118 - head/lib/libc/gen

2012-07-04 Thread David Chisnall
On 4 Jul 2012, at 21:32, Andrey Chernov wrote:

 1) /dev/urandom may not exist in jails/sandboxes while sysctls (or old way 
 initialization) always exists.

From the perspective of Capsicum sandboxes, a device node is better than a 
sysctl.  The kernel must hard-code policy about which sysctls are permitted, 
but access to file descriptors is decided on a per-sandbox basis and is 
configurable by the user.  The same applies to jails, although it's slightly 
more effort to make device nodes appear inside a jail.

David___
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: r238182 - head/lib/libc/locale

2012-07-06 Thread David Chisnall
Author: theraven
Date: Fri Jul  6 20:16:22 2012
New Revision: 238182
URL: http://svn.freebsd.org/changeset/base/238182

Log:
  Restore the __collate_load_error global that was accidentally removed in the
  xlocale refactoring.
  
  MFC after:1 week

Modified:
  head/lib/libc/locale/collate.c
  head/lib/libc/locale/setrunelocale.c

Modified: head/lib/libc/locale/collate.c
==
--- head/lib/libc/locale/collate.c  Fri Jul  6 20:14:27 2012
(r238181)
+++ head/lib/libc/locale/collate.c  Fri Jul  6 20:16:22 2012
(r238182)
@@ -56,11 +56,11 @@ __FBSDID($FreeBSD$);
  * We also modify the collation table test functions to search the thread-local
  * table first and the global table second.  
  */
-#define __collate_load_error (table-__collate_load_error)
 #define __collate_substitute_nontrivial 
(table-__collate_substitute_nontrivial)
 #define __collate_substitute_table_ptr (table-__collate_substitute_table_ptr)
 #define __collate_char_pri_table_ptr (table-__collate_char_pri_table_ptr)
 #define __collate_chain_pri_table (table-__collate_chain_pri_table)
+int __collate_load_error;
 
 
 struct xlocale_collate __xlocale_global_collate = {
@@ -109,7 +109,9 @@ __collate_load(const char *encoding, loc
 int
 __collate_load_tables(const char *encoding)
 {
-   return __collate_load_tables_l(encoding, __xlocale_global_collate);
+   int ret = __collate_load_tables_l(encoding, __xlocale_global_collate);
+   __collate_load_error = __xlocale_global_collate.__collate_load_error;
+   return ret;
 }
 
 int
@@ -123,7 +125,7 @@ __collate_load_tables_l(const char *enco
 
/* 'encoding' must be already checked. */
if (strcmp(encoding, C) == 0 || strcmp(encoding, POSIX) == 0) {
-   __collate_load_error = 1;
+   table-__collate_load_error = 1;
return (_LDP_CACHE);
}
 
@@ -240,7 +242,7 @@ __collate_load_tables_l(const char *enco
break;
}
}
-   __collate_load_error = 0;
+   table-__collate_load_error = 0;
 
return (_LDP_LOADED);
 }

Modified: head/lib/libc/locale/setrunelocale.c
==
--- head/lib/libc/locale/setrunelocale.cFri Jul  6 20:14:27 2012
(r238181)
+++ head/lib/libc/locale/setrunelocale.cFri Jul  6 20:16:22 2012
(r238182)
@@ -67,7 +67,6 @@ extern _RuneLocale*_Read_RuneMagi(FILE 
 
 static int __setrunelocale(struct xlocale_ctype *l, const char *);
 
-#define __collate_load_error (table-__collate_load_error)
 #define __collate_substitute_nontrivial 
(table-__collate_substitute_nontrivial)
 #define __collate_substitute_table_ptr (table-__collate_substitute_table_ptr)
 #define __collate_char_pri_table_ptr (table-__collate_char_pri_table_ptr)
___
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: r227467 - head/share/monetdef

2011-11-12 Thread David Chisnall
Author: theraven
Date: Sat Nov 12 14:39:20 2011
New Revision: 227467
URL: http://svn.freebsd.org/changeset/base/227467

Log:
  Fix the number of decimal digits used for Swiss Francs (0 - 2).  Found by 
the libc++ test suite.  If there is some locale test suite somewhere, it might 
be worth running it...
  
  Approved by:  dim (mentor)

Modified:
  head/share/monetdef/zh_CN.UTF-8.src

Modified: head/share/monetdef/zh_CN.UTF-8.src
==
--- head/share/monetdef/zh_CN.UTF-8.src Sat Nov 12 10:30:14 2011
(r227466)
+++ head/share/monetdef/zh_CN.UTF-8.src Sat Nov 12 14:39:20 2011
(r227467)
@@ -18,9 +18,9 @@ CNY 
 # negative_sign
 -
 # int_frac_digits
-0
+2
 # frac_digits
-0
+2
 # p_cs_precedes
 1
 # p_sep_by_space
___
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: r227472 - head/lib/msun/src

2011-11-12 Thread David Chisnall
Author: theraven
Date: Sat Nov 12 19:55:48 2011
New Revision: 227472
URL: http://svn.freebsd.org/changeset/base/227472

Log:
  Expose the unimplemented libm functions in the math.h header.  This allows 
C++'s cmath to work without the compiler complaining that the C++ versions 
are calling implicitly-declared functions.  You will still get a linker error 
when they are called.  OpenBSD 5.0 claims to fully implement the C99 math.h 
stuff, so might be worth investigating...
  
  Reviewed by:  das
  Approved by:  dim (mentor)

Modified:
  head/lib/msun/src/math.h

Modified: head/lib/msun/src/math.h
==
--- head/lib/msun/src/math.hSat Nov 12 19:45:56 2011(r227471)
+++ head/lib/msun/src/math.hSat Nov 12 19:55:48 2011(r227472)
@@ -395,32 +395,32 @@ float significandf(float);
  * long double versions of ISO/POSIX math functions
  */
 #if __ISO_C_VISIBLE = 1999
-#if 0
+#if _DECLARE_C99_LDBL_MATH
 long doubleacoshl(long double);
 #endif
 long doubleacosl(long double);
-#if 0
+#if _DECLARE_C99_LDBL_MATH
 long doubleasinhl(long double);
 #endif
 long doubleasinl(long double);
 long doubleatan2l(long double, long double);
-#if 0
+#if _DECLARE_C99_LDBL_MATH
 long doubleatanhl(long double);
 #endif
 long doubleatanl(long double);
 long doublecbrtl(long double);
 long doubleceill(long double);
 long doublecopysignl(long double, long double) __pure2;
-#if 0
+#if _DECLARE_C99_LDBL_MATH
 long doublecoshl(long double);
 #endif
 long doublecosl(long double);
-#if 0
+#if _DECLARE_C99_LDBL_MATH
 long doubleerfcl(long double);
 long doubleerfl(long double);
 #endif
 long doubleexp2l(long double);
-#if 0
+#if _DECLARE_C99_LDBL_MATH
 long doubleexpl(long double);
 long doubleexpm1l(long double);
 #endif
@@ -435,18 +435,18 @@ long double   frexpl(long double value, in
 long doublehypotl(long double, long double);
 intilogbl(long double) __pure2;
 long doubleldexpl(long double, int);
-#if 0
+#if _DECLARE_C99_LDBL_MATH
 long doublelgammal(long double);
 #endif
 long long  llrintl(long double);
 long long  llroundl(long double);
-#if 0
+#if _DECLARE_C99_LDBL_MATH
 long doublelog10l(long double);
 long doublelog1pl(long double);
 long doublelog2l(long double);
 #endif
 long doublelogbl(long double);
-#if 0
+#if _DECLARE_C99_LDBL_MATH
 long doublelogl(long double);
 #endif
 long   lrintl(long double);
@@ -458,7 +458,7 @@ long double nextafterl(long double, long
 double nexttoward(double, long double);
 float  nexttowardf(float, long double);
 long doublenexttowardl(long double, long double);
-#if 0
+#if _DECLARE_C99_LDBL_MATH
 long doublepowl(long double, long double);
 #endif
 long doubleremainderl(long double, long double);
@@ -467,16 +467,16 @@ long double   rintl(long double);
 long doubleroundl(long double);
 long doublescalblnl(long double, long);
 long doublescalbnl(long double, int);
-#if 0
+#if _DECLARE_C99_LDBL_MATH
 long doublesinhl(long double);
 #endif
 long doublesinl(long double);
 long doublesqrtl(long double);
-#if 0
+#if _DECLARE_C99_LDBL_MATH
 long doubletanhl(long double);
 #endif
 long doubletanl(long double);
-#if 0
+#if _DECLARE_C99_LDBL_MATH
 long doubletgammal(long double);
 #endif
 long doubletruncl(long double);
___
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: r227474 - head/sys/amd64/include

2011-11-12 Thread David Chisnall
Author: theraven
Date: Sat Nov 12 20:16:06 2011
New Revision: 227474
URL: http://svn.freebsd.org/changeset/base/227474

Log:
  Fix SIGATOMIC_M{IN,AX} on x86-64.  These are meant to be the minimum values 
that are allowed in a sig_atomic_t, but it looks like they were just copied 
from the x86 versions, so these definitions violate the C and C++ specs.  
Mismatch was spotted by the libc++ test suite.
  
  Approved by:  dim (mentor)

Modified:
  head/sys/amd64/include/_stdint.h

Modified: head/sys/amd64/include/_stdint.h
==
--- head/sys/amd64/include/_stdint.hSat Nov 12 20:01:30 2011
(r227473)
+++ head/sys/amd64/include/_stdint.hSat Nov 12 20:16:06 2011
(r227474)
@@ -150,8 +150,8 @@
 #definePTRDIFF_MAX INT64_MAX
 
 /* Limits of sig_atomic_t. */
-#defineSIG_ATOMIC_MIN  INT32_MIN
-#defineSIG_ATOMIC_MAX  INT32_MAX
+#defineSIG_ATOMIC_MIN  LONG_MIN
+#defineSIG_ATOMIC_MAX  LONG_MAX
 
 /* Limit of size_t. */
 #defineSIZE_MAXUINT64_MAX
___
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: r227476 - head/include

2011-11-12 Thread David Chisnall
Author: theraven
Date: Sat Nov 12 20:45:10 2011
New Revision: 227476
URL: http://svn.freebsd.org/changeset/base/227476

Log:
  Don't expose the wctype.h macros in C++ mode.  They cause problems when
  people try to invoke the namespaced versions of the functions of the
  same names.
  
  Approved by:  dim (mentor)

Modified:
  head/include/wctype.h

Modified: head/include/wctype.h
==
--- head/include/wctype.h   Sat Nov 12 20:25:11 2011(r227475)
+++ head/include/wctype.h   Sat Nov 12 20:45:10 2011(r227476)
@@ -89,6 +89,7 @@ wint_tnextwctype(wint_t, wctype_t);
 #endif
 __END_DECLS
 
+#ifndef __cplusplus
 #defineiswalnum(wc)__istype((wc), _CTYPE_A|_CTYPE_D)
 #defineiswalpha(wc)__istype((wc), _CTYPE_A)
 #defineiswblank(wc)__istype((wc), _CTYPE_B)
@@ -113,6 +114,7 @@ __END_DECLS
 #defineiswphonogram(wc)__istype((wc), _CTYPE_Q)
 #defineiswrune(wc) __istype((wc), 0xFF00L)
 #defineiswspecial(wc)  __istype((wc), _CTYPE_T)
-#endif
+#endif /* __BSD_VISIBLE */
+#endif /* __cplusplus */
 
 #endif /* _WCTYPE_H_ */
___
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: r227487 - head/include

2011-11-13 Thread David Chisnall
Author: theraven
Date: Sun Nov 13 16:18:48 2011
New Revision: 227487
URL: http://svn.freebsd.org/changeset/base/227487

Log:
  The spec says that FILE must be defined in wchar.h, but it wasn't.  It
  is now.  Also hide some macros in C++ mode that will break C++
  namespaced calls.
  
  Approved by:  dim (mentor)

Modified:
  head/include/stdio.h
  head/include/wchar.h

Modified: head/include/stdio.h
==
--- head/include/stdio.hSun Nov 13 11:53:18 2011(r227486)
+++ head/include/stdio.hSun Nov 13 16:18:48 2011(r227487)
@@ -107,7 +107,7 @@ struct __sbuf {
  * inline functions.  To preserve ABI compat, these members must not
  * be disturbed.  These members are marked below with (*).
  */
-typedefstruct __sFILE {
+struct __sFILE {
unsigned char *_p;  /* (*) current position in (some) buffer */
int _r; /* (*) read space left for getc() */
int _w; /* (*) write space left for putc() */
@@ -144,8 +144,11 @@ typedefstruct __sFILE {
int _fl_count;  /* recursive lock count */
int _orientation;   /* orientation for fwide() */
__mbstate_t _mbstate;   /* multibyte conversion state */
-} FILE;
-
+};
+#ifndef _STDFILE_DECLARED
+#define _STDFILE_DECLARED
+typedef struct __sFILE FILE;
+#endif
 #ifndef _STDSTREAM_DECLARED
 __BEGIN_DECLS
 extern FILE *__stdinp;
@@ -467,6 +470,7 @@ static __inline int __sputc(int _c, FILE
__swbuf((int)(c), p) : \
(*(p)-_p = (c), (int)*(p)-_p++))
 #endif
+#ifndef __cplusplus
 
 #define__sfeof(p)  (((p)-_flags  __SEOF) != 0)
 #define__sferror(p)(((p)-_flags  __SERR) != 0)
@@ -506,6 +510,7 @@ extern int __isthreaded;
 #definegetchar_unlocked()  getc_unlocked(stdin)
 #defineputchar_unlocked(x) putc_unlocked(x, stdout)
 #endif
+#endif /* __cplusplus */
 
 __END_DECLS
 #endif /* !_STDIO_H_ */

Modified: head/include/wchar.h
==
--- head/include/wchar.hSun Nov 13 11:53:18 2011(r227486)
+++ head/include/wchar.hSun Nov 13 16:18:48 2011(r227487)
@@ -97,20 +97,23 @@ typedef __wint_twint_t;
 #defineWEOF((wint_t)-1)
 #endif
 
-struct __sFILE;
+#ifndef _STDFILE_DECLARED
+#define _STDFILE_DECLARED
+typedef struct __sFILE FILE;
+#endif
 struct tm;
 
 __BEGIN_DECLS
 wint_t btowc(int);
-wint_t fgetwc(struct __sFILE *);
+wint_t fgetwc(FILE *);
 wchar_t*
-   fgetws(wchar_t * __restrict, int, struct __sFILE * __restrict);
-wint_t fputwc(wchar_t, struct __sFILE *);
-intfputws(const wchar_t * __restrict, struct __sFILE * __restrict);
-intfwide(struct __sFILE *, int);
-intfwprintf(struct __sFILE * __restrict, const wchar_t * __restrict, ...);
-intfwscanf(struct __sFILE * __restrict, const wchar_t * __restrict, ...);
-wint_t getwc(struct __sFILE *);
+   fgetws(wchar_t * __restrict, int, FILE * __restrict);
+wint_t fputwc(wchar_t, FILE *);
+intfputws(const wchar_t * __restrict, FILE * __restrict);
+intfwide(FILE *, int);
+intfwprintf(FILE * __restrict, const wchar_t * __restrict, ...);
+intfwscanf(FILE * __restrict, const wchar_t * __restrict, ...);
+wint_t getwc(FILE *);
 wint_t getwchar(void);
 size_t mbrlen(const char * __restrict, size_t, mbstate_t * __restrict);
 size_t mbrtowc(wchar_t * __restrict, const char * __restrict, size_t,
@@ -118,13 +121,13 @@ size_tmbrtowc(wchar_t * __restrict, con
 intmbsinit(const mbstate_t *);
 size_t mbsrtowcs(wchar_t * __restrict, const char ** __restrict, size_t,
mbstate_t * __restrict);
-wint_t putwc(wchar_t, struct __sFILE *);
+wint_t putwc(wchar_t, FILE *);
 wint_t putwchar(wchar_t);
 intswprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict,
...);
 intswscanf(const wchar_t * __restrict, const wchar_t * __restrict, ...);
-wint_t ungetwc(wint_t, struct __sFILE *);
-intvfwprintf(struct __sFILE * __restrict, const wchar_t * __restrict,
+wint_t ungetwc(wint_t, FILE *);
+intvfwprintf(FILE * __restrict, const wchar_t * __restrict,
__va_list);
 intvswprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict,
__va_list);
@@ -167,9 +170,9 @@ int wprintf(const wchar_t * __restrict, 
 intwscanf(const wchar_t * __restrict, ...);
 
 #ifndef _STDSTREAM_DECLARED
-extern struct __sFILE *__stdinp;
-extern struct __sFILE *__stdoutp;
-extern struct __sFILE *__stderrp;
+extern FILE *__stdinp;
+extern FILE *__stdoutp;
+extern FILE *__stderrp;
 #define_STDSTREAM_DECLARED
 #endif
 
@@ -179,7 +182,7 @@ extern struct __sFILE *__stderrp;
 #defineputwchar(wc)fputwc(wc, __stdoutp)
 
 #if __ISO_C_VISIBLE = 1999
-intvfwscanf(struct __sFILE * __restrict, const wchar_t * __restrict,
+intvfwscanf(FILE * 

svn commit: r227490 - head/include

2011-11-13 Thread David Chisnall
Author: theraven
Date: Sun Nov 13 17:07:26 2011
New Revision: 227490
URL: http://svn.freebsd.org/changeset/base/227490

Log:
  Hide some more macros that will break C++ when compiling in C++ mode.
  
  Approved by:  dim (mentor)

Modified:
  head/include/ctype.h

Modified: head/include/ctype.h
==
--- head/include/ctype.hSun Nov 13 17:06:33 2011(r227489)
+++ head/include/ctype.hSun Nov 13 17:07:26 2011(r227490)
@@ -80,6 +80,7 @@ int   isspecial(int);
 #endif
 __END_DECLS
 
+#ifndef __cplusplus
 #defineisalnum(c)  __sbistype((c), _CTYPE_A|_CTYPE_D)
 #defineisalpha(c)  __sbistype((c), _CTYPE_A)
 #defineiscntrl(c)  __sbistype((c), _CTYPE_C)
@@ -93,6 +94,7 @@ __END_DECLS
 #defineisxdigit(c) __isctype((c), _CTYPE_X) /* ANSI -- locale 
independent */
 #definetolower(c)  __sbtolower(c)
 #definetoupper(c)  __sbtoupper(c)
+#endif /* !__cplusplus */
 
 #if __XSI_VISIBLE
 /*
@@ -112,7 +114,7 @@ __END_DECLS
 #definetoascii(c)  ((c)  0x7F)
 #endif
 
-#if __ISO_C_VISIBLE = 1999
+#if __ISO_C_VISIBLE = 1999  !defined(__cplusplus)
 #defineisblank(c)  __sbistype((c), _CTYPE_B)
 #endif
 
___
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: r227467 - head/share/monetdef

2011-11-13 Thread David Chisnall
Hmm, apparently I can't tell the difference between H and N.  Still, as long as 
the fix is right, even if the explanation isn't...

David

On 13 Nov 2011, at 19:59, Erik Cederstrand wrote:

 Hi David,
 
 Those aren't Swiss Francs. They're yuan renminbi (CNY). It does seen they 
 have 2 digits, though.
 
 Thanks,
 Erik
 
 Den 12/11/2011 kl. 15.39 skrev David Chisnall:
 
 Author: theraven
 Date: Sat Nov 12 14:39:20 2011
 New Revision: 227467
 URL: http://svn.freebsd.org/changeset/base/227467
 
 Log:
 Fix the number of decimal digits used for Swiss Francs (0 - 2).  Found by 
 the libc++ test suite.  If there is some locale test suite somewhere, it 
 might be worth running it...
 
 Approved by: dim (mentor)
 
 Modified:
 head/share/monetdef/zh_CN.UTF-8.src
 
 Modified: head/share/monetdef/zh_CN.UTF-8.src
 ==
 --- head/share/monetdef/zh_CN.UTF-8.src  Sat Nov 12 10:30:14 2011
 (r227466)
 +++ head/share/monetdef/zh_CN.UTF-8.src  Sat Nov 12 14:39:20 2011
 (r227467)
 @@ -18,9 +18,9 @@ CNY 
 # negative_sign
 -
 # int_frac_digits
 -0
 +2
 # frac_digits
 -0
 +2
 # p_cs_precedes
 1
 # p_sep_by_space
 
 

___
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: r227487 - head/include

2011-11-14 Thread David Chisnall
On 14 Nov 2011, at 18:02, David Schultz wrote:

 On Mon, Nov 14, 2011, Dimitry Andric wrote:
 On 2011-11-14 09:21, Stefan Farfeleder wrote:
 On Sun, Nov 13, 2011 at 04:18:48PM +, David Chisnall wrote:
 Author: theraven
 Date: Sun Nov 13 16:18:48 2011
 New Revision: 227487
 URL: http://svn.freebsd.org/changeset/base/227487
 
 Log:
  The spec says that FILE must be defined in wchar.h, but it wasn't.  It
  is now.  Also hide some macros in C++ mode that will break C++
  namespaced calls.
 
  Approved by:  dim (mentor)
 
 I think this change is wrong. Whic spec are you referring to? C99
 defines FILE only in 7.19.1#2 (stdio.h). In other headers FILE is used
 as parameter type for functions but that does not mean it is exported to
 user space.
 
 http://pubs.opengroup.org/onlinepubs/007908799/xsh/wchar.h.html
 
 It's a niggling detail, but that's an extension to the C standard,
 so properly speaking, it belongs in an
  #if __POSIX_VISIBLE = 200809 || XSI_VISIBLE
 (or something like that).  The formals were struct __sFILE *
 instead of FILE * for that reason -- see r103177.
 
 P.S. You're looking at a very old version of POSIX.  Check out:
 http://pubs.opengroup.org/onlinepubs/9699919799/

The C99 and C1x specifications both seem to require stdio.h to be included 
before wchar.h.  I think this therefore places including wchar.h and not 
stdio.h in the category of undefined (or, at least, not defined) behaviour, so 
we are free to do anything in this case.  I would say that accepting the code 
and working as the programmer expected is the least harmful thing to do here.  
This is what Darwin libc does (actually, it #includes stdio.h in wchar.h).  

David___
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: r227536 - in head: release share/man/man7

2011-11-17 Thread David Chisnall

On 17 Nov 2011, at 14:31, Alexey Dokuchaev wrote:

 Kinda gross but FBSD-9.0-RELEASE-amd64-amd64-bootonly.iso?
 
 Can't we use one if they are equal?
 
 I'd prefer consistency. [...]
 
 But it looks so plain stupid!

I've had someone ask me what amd64-amd64 meant when I pointed them as the RC 
announcement.  I replied that I had no idea and suggested that possibly RE had 
been handed over to the department of redundancy department.  Having read this 
thread, I can now confidently say... that I still have no idea.

But (with my compiler-writer hat on) please tell me that we're not inventing 
yet another incompatible form of target triple.  We have at least twice as many 
as we need already...

David___
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: r227818 - head/lib/libc/locale

2011-11-22 Thread David Chisnall
Author: theraven
Date: Tue Nov 22 14:11:42 2011
New Revision: 227818
URL: http://svn.freebsd.org/changeset/base/227818

Log:
  Fix a crash when trying to duplicate a locale that contains some implicit C 
locale components.
  
  Reported by:  Michael Butler
  Approved by:  dim (mentor)

Modified:
  head/lib/libc/locale/xlocale.c

Modified: head/lib/libc/locale/xlocale.c
==
--- head/lib/libc/locale/xlocale.c  Tue Nov 22 13:30:36 2011
(r227817)
+++ head/lib/libc/locale/xlocale.c  Tue Nov 22 14:11:42 2011
(r227818)
@@ -200,8 +200,13 @@ static int dupcomponent(int type, locale
if (new-components[type]) {
strncpy(new-components[type]-locale, src-locale, 
ENCODING_LEN);
}
-   } else {
+   } else if (base-components[type]) {
new-components[type] = xlocale_retain(base-components[type]);
+   } else {
+   /* If the component was NULL, return success - if base is a 
valid
+* locale then the flag indicating that this isn't present 
should be
+* set.  If it isn't a valid locale, then we're stuck anyway. */
+   return 1;
}
return (0 != new-components[type]);
 }
___
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: r227812 - head/lib/libc/string

2011-11-22 Thread David Chisnall
On 22 Nov 2011, at 11:21, Bruce Evans wrote:

 If this optimization were any good, then the compiler would already do
 it.  In fact, gcc-4.2.1 already does it -- the reverse of it -- it rewrites:
 
   if ((i == 0) | (j == 0)) return; test();
 
 into:
 
   if (i == 0 || j == 0) return; test();

In general, I prefer | in cases where execution order does not matter because 
it frees the compiler up to insert branches or not, depending on which is more 
efficient for the target.  

In this case, either | or || is fine, because neither reads any memory or has 
side effects so | and || are equivalent to the compiler, but the use of | tells 
a human reading the code that the order is unimportant.  

David___
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: r227812 - head/lib/libc/string

2011-11-23 Thread David Chisnall
On 22 Nov 2011, at 20:27, David Schultz wrote:

 Benchmark or not, I think you'll have a very hard time finding a
 single real program that routinely calls strcasecmp() with
 identical pointers!

I've seen this pattern very often.  Often the linker is able to combine 
constant strings defined in different compilation units.  With link-time 
optimisation, there are also more opportunities for the compiler to do this.  

A fairly common pattern is to define constant strings as macros in a header and 
then use them as keys in a dictionary, first hashed and then compared with 
strcmp().  In this case, the == check is a significant win.  I've had to work 
around the fact that FreeBSD's libc is significantly slower than GNU libc in 
this instance by adding an extra == outside of strcmp() - this increases the 
size of the code everywhere this pattern is used, increasing cache usage, and 
lowering overall performance (and good luck coming up with a microbenchmark 
that demonstrates that - although I'd be happy to provide you with a 
Google-authord paper from a couple of years ago explaining why it's so hard to 
benchmark accurately on modern machines...).

It's also worth noting that the cost of the extra branch is more or less 
trivial, as every single character in the input strings will also need to be 
compared.  This change turns a linear complexity case into a constant 
complexity case, so it's a clear algorithmic improvement for a case that, while 
rare, is not as improbable as you seem to suppose.

As to the | vs || issue - by all means change it to || if it fits better with 
the FreeBSD style.  In the general case I prefer to use | to hint to the 
compiler and readers of the code that short-circuit evaluation is not required 
and to remove a sequence point and make life easier for the optimiser.  In this 
case, the two are equivalent so it's just a hint to the reader, and apparently 
(judging by the responses so far) one that is not well understood.

David___
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: r227983 - in head: . contrib/libc++ contrib/libc++/include contrib/libc++/include/ext contrib/libc++/src contrib/libc++/src/support contrib/libcxxrt etc/mtree lib lib/libc++ lib/libcxxr...

2011-11-25 Thread David Chisnall
Author: theraven
Date: Fri Nov 25 20:59:04 2011
New Revision: 227983
URL: http://svn.freebsd.org/changeset/base/227983

Log:
  Import libc++ / libcxxrt into base.  Not build by default yet (use
  MK_LIBCPLUSPLUS=yes to enable).  This is a work-in-progress.  It works for
  me, but is not guaranteed to work for anyone else and may eat your dog.
  
  To build C++ using libc++, add -stdlib=libc++ to your CXX and LD flags.
  
  Bug reports welcome, bug fixes even more welcome...
  
  Approved by:  dim (mentor)

Added:
  head/contrib/libc++/
  head/contrib/libc++/FREEBSD-upgrade
  head/contrib/libc++/include/
  head/contrib/libc++/include/__bit_reference
 - copied unchanged from r227828, vendor/libc++/dist/include/__bit_reference
  head/contrib/libc++/include/__config
 - copied unchanged from r227828, vendor/libc++/dist/include/__config
  head/contrib/libc++/include/__debug
 - copied unchanged from r227828, vendor/libc++/dist/include/__debug
  head/contrib/libc++/include/__functional_03
 - copied unchanged from r227828, vendor/libc++/dist/include/__functional_03
  head/contrib/libc++/include/__functional_base
 - copied unchanged from r227828, 
vendor/libc++/dist/include/__functional_base
  head/contrib/libc++/include/__functional_base_03
 - copied unchanged from r227828, 
vendor/libc++/dist/include/__functional_base_03
  head/contrib/libc++/include/__hash_table
 - copied unchanged from r227828, vendor/libc++/dist/include/__hash_table
  head/contrib/libc++/include/__locale
 - copied unchanged from r227828, vendor/libc++/dist/include/__locale
  head/contrib/libc++/include/__mutex_base
 - copied unchanged from r227828, vendor/libc++/dist/include/__mutex_base
  head/contrib/libc++/include/__split_buffer
 - copied unchanged from r227828, vendor/libc++/dist/include/__split_buffer
  head/contrib/libc++/include/__sso_allocator
 - copied unchanged from r227828, vendor/libc++/dist/include/__sso_allocator
  head/contrib/libc++/include/__std_stream
 - copied unchanged from r227828, vendor/libc++/dist/include/__std_stream
  head/contrib/libc++/include/__tree
 - copied unchanged from r227828, vendor/libc++/dist/include/__tree
  head/contrib/libc++/include/__tuple
 - copied unchanged from r227828, vendor/libc++/dist/include/__tuple
  head/contrib/libc++/include/__tuple_03
 - copied unchanged from r227828, vendor/libc++/dist/include/__tuple_03
  head/contrib/libc++/include/algorithm
 - copied unchanged from r227828, vendor/libc++/dist/include/algorithm
  head/contrib/libc++/include/array
 - copied unchanged from r227828, vendor/libc++/dist/include/array
  head/contrib/libc++/include/atomic
 - copied unchanged from r227828, vendor/libc++/dist/include/atomic
  head/contrib/libc++/include/bitset
 - copied unchanged from r227828, vendor/libc++/dist/include/bitset
  head/contrib/libc++/include/cassert
 - copied unchanged from r227828, vendor/libc++/dist/include/cassert
  head/contrib/libc++/include/ccomplex
 - copied unchanged from r227828, vendor/libc++/dist/include/ccomplex
  head/contrib/libc++/include/cctype
 - copied unchanged from r227828, vendor/libc++/dist/include/cctype
  head/contrib/libc++/include/cerrno
 - copied unchanged from r227828, vendor/libc++/dist/include/cerrno
  head/contrib/libc++/include/cfenv
 - copied unchanged from r227828, vendor/libc++/dist/include/cfenv
  head/contrib/libc++/include/cfloat
 - copied unchanged from r227828, vendor/libc++/dist/include/cfloat
  head/contrib/libc++/include/chrono
 - copied unchanged from r227828, vendor/libc++/dist/include/chrono
  head/contrib/libc++/include/cinttypes
 - copied unchanged from r227828, vendor/libc++/dist/include/cinttypes
  head/contrib/libc++/include/ciso646
 - copied unchanged from r227828, vendor/libc++/dist/include/ciso646
  head/contrib/libc++/include/climits
 - copied unchanged from r227828, vendor/libc++/dist/include/climits
  head/contrib/libc++/include/clocale
 - copied unchanged from r227828, vendor/libc++/dist/include/clocale
  head/contrib/libc++/include/cmath
 - copied unchanged from r227828, vendor/libc++/dist/include/cmath
  head/contrib/libc++/include/codecvt
 - copied unchanged from r227828, vendor/libc++/dist/include/codecvt
  head/contrib/libc++/include/complex
 - copied unchanged from r227828, vendor/libc++/dist/include/complex
  head/contrib/libc++/include/complex.h
 - copied unchanged from r227828, vendor/libc++/dist/include/complex.h
  head/contrib/libc++/include/condition_variable
 - copied unchanged from r227828, 
vendor/libc++/dist/include/condition_variable
  head/contrib/libc++/include/csetjmp
 - copied unchanged from r227828, vendor/libc++/dist/include/csetjmp
  head/contrib/libc++/include/csignal
 - copied unchanged from r227828, vendor/libc++/dist/include/csignal
  head/contrib/libc++/include/cstdarg
 - copied unchanged from r227828, vendor/libc++/dist/include/cstdarg
  

svn commit: r227999 - head/lib/libc/gen

2011-11-26 Thread David Chisnall
Author: theraven
Date: Sat Nov 26 15:57:09 2011
New Revision: 227999
URL: http://svn.freebsd.org/changeset/base/227999

Log:
  Return not-implemented from pthread_once and pthread_key_create, rather
  than silently failing and returning success.
  
  Without this, code calls pthread_once(), receives a return value of
  success, and thinks that the passed function has been called.
  
  Approved by:  dim (mentor)

Modified:
  head/lib/libc/gen/_pthread_stubs.c

Modified: head/lib/libc/gen/_pthread_stubs.c
==
--- head/lib/libc/gen/_pthread_stubs.c  Sat Nov 26 14:26:37 2011
(r227998)
+++ head/lib/libc/gen/_pthread_stubs.c  Sat Nov 26 15:57:09 2011
(r227999)
@@ -30,6 +30,7 @@ __FBSDID($FreeBSD$);
 #include signal.h
 #include pthread.h
 #include stdlib.h
+#include errno.h
 
 #include libc_private.h
 
@@ -53,6 +54,7 @@ static intstub_main(void);
 static void*stub_null(void);
 static struct pthread  *stub_self(void);
 static int stub_zero(void);
+static int stub_fail(void);
 static int stub_true(void);
 static voidstub_exit(void);
 
@@ -93,7 +95,7 @@ pthread_func_entry_t __thr_jtable[PJT_MA
{PJT_DUAL_ENTRY(stub_exit)},/* PJT_EXIT */
{PJT_DUAL_ENTRY(stub_null)},/* PJT_GETSPECIFIC */
{PJT_DUAL_ENTRY(stub_zero)},/* PJT_JOIN */
-   {PJT_DUAL_ENTRY(stub_zero)},/* PJT_KEY_CREATE */
+   {PJT_DUAL_ENTRY(stub_fail)},/* PJT_KEY_CREATE */
{PJT_DUAL_ENTRY(stub_zero)},/* PJT_KEY_DELETE */
{PJT_DUAL_ENTRY(stub_zero)},/* PJT_KILL */
{PJT_DUAL_ENTRY(stub_main)},/* PJT_MAIN_NP */
@@ -105,7 +107,7 @@ pthread_func_entry_t __thr_jtable[PJT_MA
{PJT_DUAL_ENTRY(stub_zero)},/* PJT_MUTEX_LOCK */
{PJT_DUAL_ENTRY(stub_zero)},/* PJT_MUTEX_TRYLOCK */
{PJT_DUAL_ENTRY(stub_zero)},/* PJT_MUTEX_UNLOCK */
-   {PJT_DUAL_ENTRY(stub_zero)},/* PJT_ONCE */
+   {PJT_DUAL_ENTRY(stub_fail)},/* PJT_ONCE */
{PJT_DUAL_ENTRY(stub_zero)},/* PJT_RWLOCK_DESTROY */
{PJT_DUAL_ENTRY(stub_zero)},/* PJT_RWLOCK_INIT */
{PJT_DUAL_ENTRY(stub_zero)},/* PJT_RWLOCK_RDLOCK */
@@ -293,6 +295,12 @@ stub_self(void)
 }
 
 static int
+stub_fail(void)
+{
+   return ENOSYS;
+}
+
+static int
 stub_main(void)
 {
return (-1);
___
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: r228002 - head/lib/libc/gen

2011-11-26 Thread David Chisnall
Author: theraven
Date: Sat Nov 26 16:49:25 2011
New Revision: 228002
URL: http://svn.freebsd.org/changeset/base/228002

Log:
  style(9) fix.
  
  Approved by:  dim (mentor)

Modified:
  head/lib/libc/gen/_pthread_stubs.c

Modified: head/lib/libc/gen/_pthread_stubs.c
==
--- head/lib/libc/gen/_pthread_stubs.c  Sat Nov 26 16:38:49 2011
(r228001)
+++ head/lib/libc/gen/_pthread_stubs.c  Sat Nov 26 16:49:25 2011
(r228002)
@@ -297,7 +297,7 @@ stub_self(void)
 static int
 stub_fail(void)
 {
-   return ENOSYS;
+   return (ENOSYS);
 }
 
 static int
___
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-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


Re: svn commit: r228114 - head/lib/libedit/edit/readline

2011-11-29 Thread David Chisnall
On 29 Nov 2011, at 04:50, Max Khon wrote:

  All this makes it possible to build and link gdb with -ledit.

When I had a quick look a couple of days ago, kadmin and [k]gdb were the only 
things that linked against readline in base.  With them now linking against 
libedit, can we remove readline from base?

David___
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: r228322 - in head: include lib/libc/stdlib sys/sys

2011-12-07 Thread David Chisnall
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/libc/stdlib/at_quick_exit.3Wed Dec  7 15:25:48 2011
(r228322)
@@ -0,0 +1,58 @@
+.\  Copyright (c) 2011 David Chisnall
+.\  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 AUTHOR 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 AUTHOR 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.
+.\ 
+.\  $FreeBSD$
+.\ /
+.Dd December 7, 2011o.Dt ATEXIT 3
+.Dt AT_QUICK_EXIT 3
+.Os
+.Sh NAME
+.Nm at_quick_exit
+.Nd Registers a cleanup function to run on quick exit.
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In stdlib.h
+.Ft int
+.Fn at_quick_exit void (*func)(void)
+.Sh DESCRIPTION
+The
+.Fn at_quick_exit
+function registers a cleanup function to be called when the program exits as a
+result of calling 
+.Xr quick_exit 3 .
+The cleanup functions are called in the reverse order and will not be called if
+the program exits by calling 
+.Xr exit 3 ,
+.Xr _Exit 3 ,
+or
+.Xr abort 3 .
+.El
+.Sh SEE ALSO
+.Xr exit 3 ,
+.Xr at_quick_exit 3
+.Sh STANDARDS
+The
+.Fn at_quick_exit
+function conforms to the C1x draft specification.

Modified: head/lib/libc/stdlib/atexit.3
==
--- head/lib/libc/stdlib/atexit.3   Wed Dec  7 13:37:42 2011
(r228321)
+++ head/lib/libc/stdlib/atexit.3   Wed Dec  7 15:25:48 2011
(r228322)
@@ -79,6 +79,7 @@ No memory was available to add the funct
 The existing list of functions is unmodified.
 .El
 .Sh SEE ALSO
+.Xr at_quick_exit 3
 .Xr exit 3
 .Sh STANDARDS
 The

Modified: head/lib/libc/stdlib/exit.3
==
--- head/lib/libc/stdlib/exit.3 Wed Dec  7 13:37:42 2011(r228321)
+++ head/lib/libc/stdlib/exit.3 Wed Dec  7 15:25:48 2011(r228322)
@@ -118,7 +118,9 @@ never return.
 .Xr _exit 2 ,
 .Xr wait 2 ,
 .Xr atexit 3 ,
+.Xr at_quick_exit 3 ,
 .Xr intro 3 ,
+.Xr quick_exit 3 ,
 .Xr sysexits 3 ,
 .Xr tmpfile 3
 .Sh STANDARDS

Added: head/lib/libc/stdlib/quick_exit.3
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/libc/stdlib/quick_exit.3   Wed Dec  7 15:25:48 2011
(r228322)
@@ -0,0 +1,55 @@
+.\  Copyright (c) 2011 David Chisnall
+.\  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 AUTHOR 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 AUTHOR 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.
+.\ 
+.\  $FreeBSD$
+.\ /
+.Dd December 7

svn commit: r228323 - head/lib/libc/stdlib

2011-12-07 Thread David Chisnall
Author: theraven
Date: Wed Dec  7 16:12:54 2011
New Revision: 228323
URL: http://svn.freebsd.org/changeset/base/228323

Log:
  style(9) cleanups.
  
  Approved by:  brooks (mentor)

Modified:
  head/lib/libc/stdlib/quick_exit.c

Modified: head/lib/libc/stdlib/quick_exit.c
==
--- head/lib/libc/stdlib/quick_exit.c   Wed Dec  7 15:25:48 2011
(r228322)
+++ head/lib/libc/stdlib/quick_exit.c   Wed Dec  7 16:12:54 2011
(r228323)
@@ -39,9 +39,6 @@ struct quick_exit_handler {
void (*cleanup)(void);
 };
 
-__attribute((weak))
-void _ZSt9terminatev(void);
-
 /**
  * Lock protecting the handlers list.
  */
@@ -56,26 +53,26 @@ at_quick_exit(void (*func)(void))
 {
struct quick_exit_handler *h = malloc(sizeof(struct 
quick_exit_handler));
 
-   if (0 == h) {
+   if (NULL == h)
return 1;
-   }
h-cleanup = func;
pthread_mutex_lock(atexit_mutex);
h-next = handlers;
handlers = h;
pthread_mutex_unlock(atexit_mutex);
-   return 0;
+   return (0);
 }
 
-void quick_exit(int status)
+void
+quick_exit(int status)
 {
+   struct quick_exit_handler *h;
+
/*
 * XXX: The C++ spec requires us to call std::terminate if there is an
 * exception here.
 */
-   for (struct quick_exit_handler *h = handlers ; NULL != h ; h = h-next)
-   {
+   for (h = handlers; NULL != h; h = h-next)
h-cleanup();
-   }
_Exit(status);
 }
___
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: r228329 - head/lib/libc/stdlib

2011-12-07 Thread David Chisnall
Author: theraven
Date: Wed Dec  7 21:02:35 2011
New Revision: 228329
URL: http://svn.freebsd.org/changeset/base/228329

Log:
  Some fixes to the man pages for [at_]quick_exit(3)
  
  Reviewed by:pluknet
  Approved by:dim (mentor)

Modified:
  head/lib/libc/stdlib/at_quick_exit.3
  head/lib/libc/stdlib/quick_exit.3

Modified: head/lib/libc/stdlib/at_quick_exit.3
==
--- head/lib/libc/stdlib/at_quick_exit.3Wed Dec  7 21:00:33 2011
(r228328)
+++ head/lib/libc/stdlib/at_quick_exit.3Wed Dec  7 21:02:35 2011
(r228329)
@@ -23,13 +23,13 @@
 .\  SUCH DAMAGE.
 .\ 
 .\  $FreeBSD$
-.\ /
-.Dd December 7, 2011o.Dt ATEXIT 3
+.\
+.Dd December 7, 2011
 .Dt AT_QUICK_EXIT 3
 .Os
 .Sh NAME
 .Nm at_quick_exit
-.Nd Registers a cleanup function to run on quick exit.
+.Nd registers a cleanup function to run on quick exit
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
@@ -48,10 +48,13 @@ the program exits by calling 
 .Xr _Exit 3 ,
 or
 .Xr abort 3 .
-.El
+.Sh RETURN VALUES
+The 
+.Fn at_quick_exit
+function returns the value 0 if successful and a non-zero value on failure.
 .Sh SEE ALSO
 .Xr exit 3 ,
-.Xr at_quick_exit 3
+.Xr quick_exit 3
 .Sh STANDARDS
 The
 .Fn at_quick_exit

Modified: head/lib/libc/stdlib/quick_exit.3
==
--- head/lib/libc/stdlib/quick_exit.3   Wed Dec  7 21:00:33 2011
(r228328)
+++ head/lib/libc/stdlib/quick_exit.3   Wed Dec  7 21:02:35 2011
(r228329)
@@ -23,13 +23,13 @@
 .\  SUCH DAMAGE.
 .\ 
 .\  $FreeBSD$
-.\ /
-.Dd December 7, 2011o.Dt ATEXIT 3
+.\
+.Dd December 7, 2011
 .Dt QUICK_EXIT 3
 .Os
 .Sh NAME
 .Nm quick_exit
-.Nd Exits a program quickly, running minimal cleanup
+.Nd exits a program quickly, running minimal cleanup
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
@@ -44,12 +44,14 @@ with
 .Xr at_quick_exit 3
 but not any C++ destructors or cleanup code registered with
 .Xr atexit 3 .
-.El
+.Sh RETURN VALUES
+The
+.Fn quick_exit
+function does not return.
 .Sh SEE ALSO
-.Xr exit 3 ,
-.Xr at_quick_exit 3
+.Xr at_quick_exit 3 ,
+.Xr exit 3
 .Sh STANDARDS
 The
 .Fn quick_exit
 function conforms to the C1x draft specification.
-
___
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: r228322 - in head: include lib/libc/stdlib sys/sys

2011-12-07 Thread David Chisnall
On 7 Dec 2011, at 19:11, David Schultz wrote:

 Why not use the standard spelling, '_Noreturn'?  In pre-C1X modes,
 _Noreturn is a reserved identifier since it starts with an underscore
 and capital letter, so it's not considered namespace pollution.

Because that would be too obvious...

David
___
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: r228330 - in head: include sys/sys

2011-12-07 Thread David Chisnall
Author: theraven
Date: Wed Dec  7 21:17:50 2011
New Revision: 228330
URL: http://svn.freebsd.org/changeset/base/228330

Log:
  As per das@'s suggestion, s/__noreturn/_Noreturn/, since the latter is an
  identifier reserved for the implementation in C99 and earlier so there is
  no sensible reason for introducing yet another reserved identifier when we
  could just use the one C1x uses.
  
  Approved by:  brooks (mentor)

Modified:
  head/include/stdlib.h
  head/sys/sys/cdefs.h

Modified: head/include/stdlib.h
==
--- head/include/stdlib.h   Wed Dec  7 21:02:35 2011(r228329)
+++ head/include/stdlib.h   Wed Dec  7 21:17:50 2011(r228330)
@@ -76,7 +76,7 @@ extern int __mb_cur_max;
 extern int ___mb_cur_max(void);
 #defineMB_CUR_MAX  (___mb_cur_max())
 
-__noreturn void abort(void);
+_Noreturn void  abort(void);
 int abs(int) __pure2;
 int atexit(void (*)(void));
 double  atof(const char *);
@@ -86,7 +86,7 @@ void  *bsearch(const void *, const void *
size_t, int (*)(const void *, const void *));
 void   *calloc(size_t, size_t) __malloc_like;
 div_t   div(int, int) __pure2;
-__noreturn void exit(int);
+_Noreturn void  exit(int);
 voidfree(void *);
 char   *getenv(const char *);
 longlabs(long) __pure2;
@@ -145,14 +145,14 @@ unsigned long long
 strtoull(const char * __restrict, char ** __restrict, int);
 #endif /* __LONG_LONG_SUPPORTED */
 
-__noreturn void _Exit(int);
+_Noreturn void  _Exit(int);
 #endif /* __ISO_C_VISIBLE = 1999 */
 
 /*
  * If we're in a mode greater than C99, expose C1x functions.
  */
 #if __ISO_C_VISIBLE  1999
-__noreturn void quick_exit(int)
+_Noreturn void quick_exit(int)
 int
 at_quick_exit(void (*func)(void));
 #endif /* __ISO_C_VISIBLE  1999 */

Modified: head/sys/sys/cdefs.h
==
--- head/sys/sys/cdefs.hWed Dec  7 21:02:35 2011(r228329)
+++ head/sys/sys/cdefs.hWed Dec  7 21:17:50 2011(r228330)
@@ -220,13 +220,13 @@
 
 
 #if defined(__cplusplus)  __cplusplus = 201103L
-#define__noreturn  [[noreturn]]
+#define_Noreturn   [[noreturn]]
 #elif defined(__STDC_VERSION__)  __STDC_VERSION__  201000L
-#define__noreturn  _Noreturn
+/* Do nothing - _Noreturn is a keyword */
 #elif defined(__GNUC__)
-#define__noreturn  __attribute__((__noreturn__))
+#define_Noreturn   __attribute__((__noreturn__))
 #else
-#define__noreturn
+#define_Noreturn
 #endif
 
 #if __GNUC_PREREQ__(2, 96)
___
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: r228330 - in head: include sys/sys

2011-12-12 Thread David Chisnall
On 11 Dec 2011, at 21:12, Andreas Tobler wrote:

 As far as I understand, GCC does not support this attribute [[noreturn]] yet. 
 But it defines both, __cplusplus and __cplusplus=201103L. On gcc-4.7 
 __cplusplus=201103L is the default when we build libstdc++.

Advertising C++11 compatibility and then not supporting fairly simple C++11 
features seems like a pretty major GCC bug.  

 So I think we have to extend the check as below or we can reorder the defines 
 that GNUC is before the __cplusplus   __cplusplus= 201103L.

I'd rather prefer the standard version to the non-standard version, but maybe 
we can add an extra check to see if your compiler incompetent.

David___
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: r228528 - head/lib/libc/stdlib

2011-12-15 Thread David Chisnall
Author: theraven
Date: Thu Dec 15 11:16:41 2011
New Revision: 228528
URL: http://svn.freebsd.org/changeset/base/228528

Log:
  Small style(9) improvements.
  
  Approved by:  dim (mentor)

Modified:
  head/lib/libc/stdlib/quick_exit.c

Modified: head/lib/libc/stdlib/quick_exit.c
==
--- head/lib/libc/stdlib/quick_exit.c   Thu Dec 15 11:15:23 2011
(r228527)
+++ head/lib/libc/stdlib/quick_exit.c   Thu Dec 15 11:16:41 2011
(r228528)
@@ -51,10 +51,12 @@ static struct quick_exit_handler *handle
 int
 at_quick_exit(void (*func)(void))
 {
-   struct quick_exit_handler *h = malloc(sizeof(struct 
quick_exit_handler));
+   struct quick_exit_handler *h;
+   
+   h = malloc(sizeof(*h));
 
if (NULL == h)
-   return 1;
+   return (1);
h-cleanup = func;
pthread_mutex_lock(atexit_mutex);
h-next = handlers;
___
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: r228529 - head/sys/sys

2011-12-15 Thread David Chisnall
Author: theraven
Date: Thu Dec 15 11:21:56 2011
New Revision: 228529
URL: http://svn.freebsd.org/changeset/base/228529

Log:
  Add a pointless and superfluous GNUism that people at a certain large data
  aggregation and advertising company seem to believe is standard.
  
  Approved by:  dim (mentor)

Modified:
  head/sys/sys/stdint.h

Modified: head/sys/sys/stdint.h
==
--- head/sys/sys/stdint.h   Thu Dec 15 11:16:41 2011(r228528)
+++ head/sys/sys/stdint.h   Thu Dec 15 11:21:56 2011(r228529)
@@ -64,4 +64,11 @@ typedef  __uintmax_t uintmax_t;
 #define_UINTMAX_T_DECLARED
 #endif
 
+/* GNU and Darwin define this and people seem to think it's portable */
+#if defined(UINTPTR_MAX)  defined(UINT64_MAX)  (UINTPTR_MAX == UINT64_MAX)
+#define__WORDSIZE  64
+#else
+#define__WORDSIZE  32
+#endif
+
 #endif /* !_SYS_STDINT_H_ */
___
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: r228143 - in head: . share/mk tools/build/options

2011-12-19 Thread David Chisnall
On 19 Dec 2011, at 19:52, Warner Losh wrote:

 -1.  The needs of the many?  Please.  Let's break a useful feature because 
 some people don't understand it and are impatient?  That's lame.

How useful is gprof-based profiling these days?  Now that we have the DTrace 
pid provider, don't we have access to much more fine-grained profiling 
information without the need for shipping two versions of every library?

David___
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: r228859 - head/sys/sys

2011-12-24 Thread David Chisnall
Author: theraven
Date: Sat Dec 24 13:28:49 2011
New Revision: 228859
URL: http://svn.freebsd.org/changeset/base/228859

Log:
  Some GCC-compatibility definitions.  Define clang's feature test pseudomacros
  to always evaluate to 0 if we are using a compiler that doesn't implement 
them.
  This lets us use the macros easily in standard headers (e.g. stdatomic.h, 
which
  should be the subject of my next commit).
  
  Approved by:  dim (mentor)

Modified:
  head/sys/sys/cdefs.h

Modified: head/sys/sys/cdefs.h
==
--- head/sys/sys/cdefs.hSat Dec 24 12:28:23 2011(r228858)
+++ head/sys/sys/cdefs.hSat Dec 24 13:28:49 2011(r228859)
@@ -617,4 +617,14 @@
 #endif
 #endif
 
+#ifndef__has_feature
+#define__has_feature(x) 0
+#endif
+#ifndef__has_include
+#define__has_include(x) 0
+#endif
+#ifndef__has_builtin
+#define__has_builtin(x) 0
+#endif
+
 #endif /* !_SYS_CDEFS_H_ */
___
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: r228862 - head/include

2011-12-24 Thread David Chisnall
Author: theraven
Date: Sat Dec 24 15:17:01 2011
New Revision: 228862
URL: http://svn.freebsd.org/changeset/base/228862

Log:
  Initial implementation of stdatomic.h.  Works (at least in the parts that were
  tested) with clang and gcc, and more efficiently with clang+a big out-of-tree
  diff that I need to commit soon (once it's been tidied and reviewed a bit).
  
  Large portions by: ed
  Reviewed by:  ed
  Approved by:  dim (mentor)

Added:
  head/include/stdatomic.h   (contents, props changed)

Added: head/include/stdatomic.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/include/stdatomic.hSat Dec 24 15:17:01 2011(r228862)
@@ -0,0 +1,296 @@
+/*-
+ * Copyright (c) 2011 Ed Schouten e...@freebsd.org
+ *David Chisnall thera...@freebsd.org
+ * 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 AUTHOR 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 AUTHOR 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.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _STDATOMIC_H_
+#define_STDATOMIC_H_
+
+#include sys/cdefs.h
+#include sys/_types.h
+
+#if __has_feature(cxx_atomic)
+#define__CLANG_ATOMICS
+#elif defined(__GNUC__)
+#define__GNUC_ATOMICS
+#else
+#error stdatomic.h does not support your compiler
+#endif
+
+#ifdef __GNUC_ATOMICS
+#define_Atomic(T)  struct { volatile T 
__val; }
+#endif
+
+/*
+ * 7.17.2 Initialization.
+ */
+
+#if defined(__CLANG_ATOMICS)
+#defineATOMIC_VAR_INIT(value)  (value)
+#defineatomic_init(obj, value) __atomic_init(obj, 
value)
+#elif defined(__GNUC_ATOMICS)
+#defineATOMIC_VAR_INIT(value)  { .__val = (value) }
+#defineatomic_init(obj, value) (obj = 
ATOMIC_VAR_INIT(value))
+#endif
+
+/*
+ * Clang and recent GCC both provide predefined macros for the memory
+ * orderings.  If we are using a compiler that doesn't define them, use the
+ * clang values - these will be ignored in the fallback path.
+ */
+
+#ifndef __ATOMIC_RELAXED
+#define __ATOMIC_RELAXED   0
+#endif
+#ifndef __ATOMIC_CONSUME
+#define __ATOMIC_CONSUME   1
+#endif
+#ifndef __ATOMIC_ACQUIRE
+#define __ATOMIC_ACQUIRE   2
+#endif
+#ifndef __ATOMIC_RELEASE
+#define __ATOMIC_RELEASE   3
+#endif
+#ifndef __ATOMIC_ACQ_REL
+#define __ATOMIC_ACQ_REL   4
+#endif
+#ifndef __ATOMIC_SEQ_CST
+#define __ATOMIC_SEQ_CST   5
+#endif
+
+/*
+ * 7.17.3 Order and consistency.
+ *
+ * The memory_order_* constants that denote the barrier behaviour of the
+ * atomic operations.  
+ */
+
+enum memory_order {
+   memory_order_relaxed = __ATOMIC_RELAXED,
+   memory_order_consume = __ATOMIC_CONSUME,
+   memory_order_acquire = __ATOMIC_ACQUIRE,
+   memory_order_release = __ATOMIC_RELEASE,
+   memory_order_acq_rel = __ATOMIC_ACQ_REL,
+   memory_order_seq_cst = __ATOMIC_SEQ_CST
+};
+
+/*
+ * 7.17.4 Fences.
+ */
+
+#if defined(__CLANG_ATOMICS)
+#defineatomic_thread_fence(order)  __atomic_thread_fence(order)
+#elif defined(__GNUC_ATOMICS)
+#defineatomic_thread_fence(order)  __sync_synchronize()
+#endif
+#defineatomic_signal_fence(order)  __asm volatile ( : : : 
memory);
+
+/*
+ * 7.17.5 Lock-free property.
+ */
+
+#if defined(__CLANG_ATOMICS)
+#defineatomic_is_lock_free(obj)__atomic_is_lock_free(obj)
+#elif defined(__GNUC_ATOMICS)
+#defineatomic_is_lock_free(obj)(sizeof((obj-__val)) = 
sizeof(void *))
+#endif
+
+/*
+ * 7.17.6 Atomic integer types.
+ */
+
+typedef _Atomic(_Bool) atomic_bool;
+typedef _Atomic(char

svn commit: r228863 - head/include

2011-12-24 Thread David Chisnall
Author: theraven
Date: Sat Dec 24 15:31:06 2011
New Revision: 228863
URL: http://svn.freebsd.org/changeset/base/228863

Log:
  ...and actually install it.
  
  Approved by:  dim (mentor)

Modified:
  head/include/Makefile

Modified: head/include/Makefile
==
--- head/include/Makefile   Sat Dec 24 15:17:01 2011(r228862)
+++ head/include/Makefile   Sat Dec 24 15:31:06 2011(r228863)
@@ -19,7 +19,7 @@ INCS= a.out.h ar.h assert.h bitstring.h 
printf.h proc_service.h pthread.h \
pthread_np.h pwd.h ranlib.h readpassphrase.h regex.h \
res_update.h resolv.h runetype.h search.h semaphore.h setjmp.h \
-   signal.h spawn.h stab.h \
+   signal.h spawn.h stab.h stdatomic.h \
stdbool.h stddef.h stdio.h stdlib.h string.h stringlist.h \
strings.h sysexits.h tar.h termios.h tgmath.h \
time.h timeconv.h timers.h ttyent.h \
___
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: r228875 - head/include

2011-12-25 Thread David Chisnall
Author: theraven
Date: Sun Dec 25 16:03:54 2011
New Revision: 228875
URL: http://svn.freebsd.org/changeset/base/228875

Log:
  Restore __is_threaded in C++ mode.  Some Google stuff needs it apparently.
  
  Reported by:  swills
  Approved by:  dim (mentor)

Modified:
  head/include/stdio.h

Modified: head/include/stdio.h
==
--- head/include/stdio.hSun Dec 25 14:29:36 2011(r228874)
+++ head/include/stdio.hSun Dec 25 16:03:54 2011(r228875)
@@ -470,6 +470,9 @@ static __inline int __sputc(int _c, FILE
__swbuf((int)(c), p) : \
(*(p)-_p = (c), (int)*(p)-_p++))
 #endif
+
+extern int __isthreaded;
+
 #ifndef __cplusplus
 
 #define__sfeof(p)  (((p)-_flags  __SEOF) != 0)
@@ -477,7 +480,6 @@ static __inline int __sputc(int _c, FILE
 #define__sclearerr(p)  ((void)((p)-_flags = ~(__SERR|__SEOF)))
 #define__sfileno(p)((p)-_file)
 
-extern int __isthreaded;
 
 #definefeof(p) (!__isthreaded ? __sfeof(p) : (feof)(p))
 #defineferror(p)   (!__isthreaded ? __sferror(p) : (ferror)(p))
___
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: r228918 - head/sys/sys

2011-12-27 Thread David Chisnall
Author: theraven
Date: Tue Dec 27 21:36:31 2011
New Revision: 228918
URL: http://svn.freebsd.org/changeset/base/228918

Log:
  Define NULL to nullptr in C++11 mode (not strictly required, but it makes
  migrating code to C++11 easier).
  
  Approved by:  dim (mentor)

Modified:
  head/sys/sys/_null.h

Modified: head/sys/sys/_null.h
==
--- head/sys/sys/_null.hTue Dec 27 20:03:57 2011(r228917)
+++ head/sys/sys/_null.hTue Dec 27 21:36:31 2011(r228918)
@@ -31,7 +31,9 @@
 #if !defined(__cplusplus)
 #defineNULL((void *)0)
 #else
-#if defined(__GNUG__)  defined(__GNUC__)  __GNUC__ = 4
+#if __cplusplus = 201103L
+#defineNULLnullptr
+#elif defined(__GNUG__)  defined(__GNUC__)  __GNUC__ = 4
 #defineNULL__null
 #else
 #if defined(__LP64__)
___
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: r228878 - head/include

2011-12-30 Thread David Chisnall
On 30 Dec 2011, at 16:52, Sean C. Farley wrote:

 My quick googling didn't show anything at all about the C++ standard and 
 stdbool.h or __bool_true_false_are_defined.  It was probably originally set 
 because bool, true, and false are all C++ keywords so certain code that 
 wanted to ifdef on them didn't also need to check __cplusplus.
 
 I did not find anything definitive either.

It's usually a better idea to check the spec than Google...

stdbool.h is not part of the C++ standard, and so it is free to contain 
anything in C++ mode, just as any other non-standard header is.  The cstdbool 
header is defined by the C++11 spec as containing JUST the 
__bool_true_false_are_defined macro.  The purpose of this header in C++ mode is 
to allow the inclusion of C++ headers that expect to be able to use true and 
false and guard this by the use of the __bool_true_false_are_defined macro.

David___
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: r233235 - in head: contrib/libcxxrt lib/libcxxrt

2012-03-20 Thread David Chisnall
Author: theraven
Date: Tue Mar 20 17:58:15 2012
New Revision: 233235
URL: http://svn.freebsd.org/changeset/base/233235

Log:
  Import new version of libcxxrt.  Now works correctly with libobjc2 to 
implement
  the unified exception model for Objective-C++.
  
  Approved by:  dim (mentor)

Deleted:
  head/contrib/libcxxrt/typeinfo
Modified:
  head/contrib/libcxxrt/dynamic_cast.cc
  head/contrib/libcxxrt/exception.cc
  head/contrib/libcxxrt/typeinfo.h
  head/lib/libcxxrt/Version.map
Directory Properties:
  head/contrib/libcxxrt/   (props changed)

Modified: head/contrib/libcxxrt/dynamic_cast.cc
==
--- head/contrib/libcxxrt/dynamic_cast.cc   Tue Mar 20 17:43:30 2012
(r233234)
+++ head/contrib/libcxxrt/dynamic_cast.cc   Tue Mar 20 17:58:15 2012
(r233235)
@@ -46,9 +46,65 @@ struct vtable_header
  */
 #define ADD_TO_PTR(x, off) (__typeof__(x))(((char*)x) + off)
 
-bool __class_type_info::can_cast_to(const struct __class_type_info *other) 
const
+bool std::type_info::__do_catch(std::type_info const *ex_type,
+void **exception_object,
+unsigned int outer) const
 {
-return this == other;
+   const type_info *type = this;
+
+   if (type == ex_type)
+   {
+   return true;
+   }
+   if (const __class_type_info *cti = dynamic_castconst __class_type_info 
*(type))
+   {
+   return ex_type-__do_upcast(cti, exception_object);
+   }
+   return false;
+}
+
+bool __pbase_type_info::__do_catch(std::type_info const *ex_type,
+   void **exception_object,
+   unsigned int outer) const
+{
+   if (ex_type == this)
+   {
+   return true;
+   }
+   if (!ex_type-__is_pointer_p())
+   {
+   // Can't catch a non-pointer type in a pointer catch
+   return false;
+   }
+
+   if (!(outer  1))
+   {
+   // If the low bit is cleared on this means that we've gone
+   // through a pointer that is not const qualified.
+   return false;
+   }
+   // Clear the low bit on outer if we're not const qualified.
+   if (!(__flags  __const_mask))
+   {
+   outer = ~1;
+   }
+
+   const __pbase_type_info *ptr_type =
+   static_castconst __pbase_type_info*(ex_type);
+
+   if (ptr_type-__flags  ~__flags)
+   {
+   // Handler pointer is less qualified
+   return false;
+   }
+
+   // Special case for void* handler.  
+   if(*__pointee == typeid(void))
+   {
+   return true;
+   }
+
+   return __pointee-__do_catch(ptr_type-__pointee, exception_object, 
outer);
 }
 
 void *__class_type_info::cast_to(void *obj, const struct __class_type_info 
*other) const
@@ -60,12 +116,6 @@ void *__class_type_info::cast_to(void *o
return 0;
 }
 
-
-bool __si_class_type_info::can_cast_to(const struct __class_type_info *other) 
const
-{
-return this == other || __base_type-can_cast_to(other);
-}
-
 void *__si_class_type_info::cast_to(void *obj, const struct __class_type_info 
*other) const
 {
if (this == other)
@@ -74,31 +124,32 @@ void *__si_class_type_info::cast_to(void
}
return __base_type-cast_to(obj, other);
 }
-
-
-bool __vmi_class_type_info::can_cast_to(const struct __class_type_info *other) 
const
+bool __si_class_type_info::__do_upcast(const __class_type_info *target,
+ void **thrown_object) const
 {
-   if (this == other)
+   if (this == target)
{
return true;
}
-   for (unsigned int i=0 ; i__base_count ; i++)
-   {
-   const __base_class_type_info *info = __base_info[i];
-if(info-isPublic()  info-__base_type-can_cast_to(other))
-{
-return true;
-}
-   }
-   return false;
+   return __base_type-__do_upcast(target, thrown_object);
 }
 
 void *__vmi_class_type_info::cast_to(void *obj, const struct __class_type_info 
*other) const
 {
-   if (this == other)
+   if (__do_upcast(other, obj))
{
return obj;
}
+   return 0;
+}
+
+bool __vmi_class_type_info::__do_upcast(const __class_type_info *target,
+ void **thrown_object) const
+{
+   if (this == target)
+   {
+   return true;
+   }
for (unsigned int i=0 ; i__base_count ; i++)
{
const __base_class_type_info *info = __base_info[i];
@@ -111,6 +162,7 @@ void *__vmi_class_type_info::cast_to(voi
// virtual table of the virtual base offset for the virtual base
// referenced (negative).'
 
+   void *obj = *thrown_object;
if (info-isVirtual())
{
 

svn commit: r233391 - head/contrib/libstdc++/libsupc++

2012-03-23 Thread David Chisnall
Author: theraven
Date: Fri Mar 23 20:10:56 2012
New Revision: 233391
URL: http://svn.freebsd.org/changeset/base/233391

Log:
  Revert ABI breakage in libsupc++.
  
  Unfortunately, the ABI was broken upstream for the 4.2 release, which we
  imported.  We then shipped the broken version for several years and certain
  ports (e.g. libobjc2) depend on it, so we're stuck with it for now...
  
  We should revisit this for 10.0, since we're allowed to break the ABI then, 
but
  until then we should keep the ABI we shipped with 8.x and 9.x.
  
  Reviewed by:  kan
  Approved by:  dim (mentor)
  MFC after:1 week

Modified:
  head/contrib/libstdc++/libsupc++/typeinfo

Modified: head/contrib/libstdc++/libsupc++/typeinfo
==
--- head/contrib/libstdc++/libsupc++/typeinfo   Fri Mar 23 20:09:21 2012
(r233390)
+++ head/contrib/libstdc++/libsupc++/typeinfo   Fri Mar 23 20:10:56 2012
(r233391)
@@ -100,12 +100,6 @@ namespace std 
 bool operator!=(const type_info __arg) const
 { return !operator==(__arg); }
 
-// Return true if this is a pointer type of some kind
-virtual bool __is_pointer_p() const;
-
-// Return true if this is a function type
-virtual bool __is_function_p() const;
-
 // Try and catch a thrown type. Store an adjusted pointer to the
 // caught type in THR_OBJ. If THR_TYPE is not a pointer type, then
 // THR_OBJ points to the thrown object. If THR_TYPE is a pointer
@@ -119,6 +113,12 @@ namespace std 
 virtual bool __do_upcast(const __cxxabiv1::__class_type_info *__target,
 void **__obj_ptr) const;
 
+// Return true if this is a pointer type of some kind
+virtual bool __is_pointer_p() const;
+
+// Return true if this is a function type
+virtual bool __is_function_p() const;
+
   protected:
 const char *__name;
 
___
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: r233600 - head/include

2012-03-28 Thread David Chisnall
Author: theraven
Date: Wed Mar 28 12:11:54 2012
New Revision: 233600
URL: http://svn.freebsd.org/changeset/base/233600

Log:
  Correctly expose xlocale functions if people include the headers in the wrong
  order (as some ports apparently do).
  
  Approved by:  dim (mentor)

Modified:
  head/include/ctype.h
  head/include/inttypes.h
  head/include/langinfo.h
  head/include/monetary.h
  head/include/stdio.h
  head/include/stdlib.h
  head/include/string.h
  head/include/time.h
  head/include/wchar.h

Modified: head/include/ctype.h
==
--- head/include/ctype.hWed Mar 28 11:37:06 2012(r233599)
+++ head/include/ctype.hWed Mar 28 12:11:54 2012(r233600)
@@ -79,7 +79,7 @@ int   isrune(int);
 intisspecial(int);
 #endif
 
-#if __POSIX_VISIBLE = 200809
+#if __POSIX_VISIBLE = 200809 || defined(_XLOCALE_H_)
 #include xlocale/_ctype.h
 #endif
 __END_DECLS

Modified: head/include/inttypes.h
==
--- head/include/inttypes.h Wed Mar 28 11:37:06 2012(r233599)
+++ head/include/inttypes.h Wed Mar 28 12:11:54 2012(r233600)
@@ -45,6 +45,9 @@ typedef struct {
 } imaxdiv_t;
 
 __BEGIN_DECLS
+#ifdef _XLOCALE_H_
+#include xlocale/_inttypes.h
+#endif
 intmax_t   imaxabs(intmax_t) __pure2;
 imaxdiv_t  imaxdiv(intmax_t, intmax_t) __pure2;
 

Modified: head/include/langinfo.h
==
--- head/include/langinfo.h Wed Mar 28 11:37:06 2012(r233599)
+++ head/include/langinfo.h Wed Mar 28 12:11:54 2012(r233600)
@@ -131,7 +131,7 @@ typedef __nl_item   nl_item;
 __BEGIN_DECLS
 char   *nl_langinfo(nl_item);
 
-#if __POSIX_VISIBLE = 200809
+#if __POSIX_VISIBLE = 200809 || defined(_XLOCALE_H_)
 #include xlocale/_langinfo.h
 #endif
 __END_DECLS

Modified: head/include/monetary.h
==
--- head/include/monetary.h Wed Mar 28 11:37:06 2012(r233599)
+++ head/include/monetary.h Wed Mar 28 12:11:54 2012(r233600)
@@ -43,6 +43,9 @@ typedef   __ssize_t   ssize_t;
 #endif
 
 __BEGIN_DECLS
+#ifdef _XLOCALE_H_
+#include xlocale/_monetary.h
+#endif
 ssize_tstrfmon(char * __restrict, size_t, const char * __restrict, 
...);
 __END_DECLS
 

Modified: head/include/stdio.h
==
--- head/include/stdio.hWed Mar 28 11:37:06 2012(r233599)
+++ head/include/stdio.hWed Mar 28 12:11:54 2012(r233600)
@@ -225,6 +225,9 @@ __END_DECLS
 #definestderr  __stderrp
 
 __BEGIN_DECLS
+#ifdef _XLOCALE_H_
+#include xlocale/_stdio.h
+#endif
 /*
  * Functions defined in ANSI C standard.
  */

Modified: head/include/stdlib.h
==
--- head/include/stdlib.h   Wed Mar 28 11:37:06 2012(r233599)
+++ head/include/stdlib.h   Wed Mar 28 12:11:54 2012(r233600)
@@ -72,6 +72,9 @@ typedef struct {
 #defineRAND_MAX0x7fff
 
 __BEGIN_DECLS
+#ifdef _XLOCALE_H_
+#include xlocale/_stdlib.h
+#endif
 extern int __mb_cur_max;
 extern int ___mb_cur_max(void);
 #defineMB_CUR_MAX  (___mb_cur_max())

Modified: head/include/string.h
==
--- head/include/string.h   Wed Mar 28 11:37:06 2012(r233599)
+++ head/include/string.h   Wed Mar 28 12:11:54 2012(r233600)
@@ -133,7 +133,7 @@ void swab(const void * __restrict, void
 
 #endif /* __BSD_VISIBLE */
 
-#if __POSIX_VISIBLE = 200809
+#if __POSIX_VISIBLE = 200809 || defined(_XLOCALE_H_)
 #include xlocale/_string.h
 #endif
 __END_DECLS

Modified: head/include/time.h
==
--- head/include/time.h Wed Mar 28 11:37:06 2012(r233599)
+++ head/include/time.h Wed Mar 28 12:11:54 2012(r233600)
@@ -184,7 +184,7 @@ time_t timelocal(struct tm * const);
 time_t timegm(struct tm * const);
 #endif /* __BSD_VISIBLE */
 
-#if __POSIX_VISIBLE = 200809
+#if __POSIX_VISIBLE = 200809 || defined(_XLOCALE_H_)
 #include xlocale/_time.h
 #endif
 __END_DECLS

Modified: head/include/wchar.h
==
--- head/include/wchar.hWed Mar 28 11:37:06 2012(r233599)
+++ head/include/wchar.hWed Mar 28 12:11:54 2012(r233600)
@@ -225,7 +225,7 @@ size_t  wcslcat(wchar_t *, const wchar_t 
 size_t wcslcpy(wchar_t *, const wchar_t *, size_t);
 #endif
 
-#if __POSIX_VISIBLE = 200809
+#if __POSIX_VISIBLE = 200809 || defined(_XLOCALE_H_)
 #include xlocale/_wchar.h
 #endif
 __END_DECLS
___

Re: svn commit: r233294 - in head: . contrib/com_err crypto/heimdal crypto/heimdal/admin crypto/heimdal/appl crypto/heimdal/appl/afsutil crypto/heimdal/appl/ftp crypto/heimdal/appl/ftp/common crypto/h

2012-03-29 Thread David Chisnall
On 29 Mar 2012, at 04:36, Doug Barton wrote:

 All of the stuff that pkgng relies on (including the tool itself) are
 going to be in the ports collection, where they belong. We should have
 moved pkg_* there years ago, but this change is at least a step in the
 right direction.

Wait... what?  Why should pkgng be in ports (other than now, while it's under 
development)?  I'd like to see it used for managing some of the optional parts 
of the base system and probably eventually replacing freebsd-update, not have 
it as another bolt-on that is not part of the core system.  Not to mention the 
bootstrapping problem if every user who wants to use binary packages needs to 
use ports to build pkgng.

David___
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: r233699 - head/contrib/libstdc++/libsupc++

2012-03-30 Thread David Chisnall
Author: theraven
Date: Fri Mar 30 12:48:36 2012
New Revision: 233699
URL: http://svn.freebsd.org/changeset/base/233699

Log:
  Undo the earlier revert of the ABI change in libsupc++.  On further 
discussion,
  posting an errata notice with 9.1 is the less painful solution.
  
  Approved by:  dim (mentor)

Modified:
  head/contrib/libstdc++/libsupc++/typeinfo

Modified: head/contrib/libstdc++/libsupc++/typeinfo
==
--- head/contrib/libstdc++/libsupc++/typeinfo   Fri Mar 30 12:34:34 2012
(r233698)
+++ head/contrib/libstdc++/libsupc++/typeinfo   Fri Mar 30 12:48:36 2012
(r233699)
@@ -100,6 +100,12 @@ namespace std 
 bool operator!=(const type_info __arg) const
 { return !operator==(__arg); }
 
+// Return true if this is a pointer type of some kind
+virtual bool __is_pointer_p() const;
+
+// Return true if this is a function type
+virtual bool __is_function_p() const;
+
 // Try and catch a thrown type. Store an adjusted pointer to the
 // caught type in THR_OBJ. If THR_TYPE is not a pointer type, then
 // THR_OBJ points to the thrown object. If THR_TYPE is a pointer
@@ -113,12 +119,6 @@ namespace std 
 virtual bool __do_upcast(const __cxxabiv1::__class_type_info *__target,
 void **__obj_ptr) const;
 
-// Return true if this is a pointer type of some kind
-virtual bool __is_pointer_p() const;
-
-// Return true if this is a function type
-virtual bool __is_function_p() const;
-
   protected:
 const char *__name;
 
___
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: r233749 - in head/gnu/lib: libstdc++ libsupc++

2012-03-31 Thread David Chisnall
Author: theraven
Date: Sat Mar 31 14:25:12 2012
New Revision: 233749
URL: http://svn.freebsd.org/changeset/base/233749

Log:
  Make libsupc++ build as a shared library and make libstdc++ a filter library
  for it.
  
  This allows people to swap out libsupc++ for libcxxrt easily, so we can begin
  the libstdc++ - libc++ migration.
  
  Approved by:  dim (mentor)

Added:
  head/gnu/lib/libsupc++/Version.map
 - copied, changed from r232970, 
head/contrib/libstdc++/config/abi/pre/gnu.ver
Modified:
  head/gnu/lib/libstdc++/Makefile
  head/gnu/lib/libsupc++/Makefile

Modified: head/gnu/lib/libstdc++/Makefile
==
--- head/gnu/lib/libstdc++/Makefile Sat Mar 31 14:03:16 2012
(r233748)
+++ head/gnu/lib/libstdc++/Makefile Sat Mar 31 14:25:12 2012
(r233749)
@@ -25,7 +25,7 @@ CXXFLAGS+=-fno-implicit-templates -ffun
 PO_CXXFLAGS=   ${CXXFLAGS:N-ffunction-sections}
 
 DPADD= ${LIBM}
-LDADD= -lm
+LDADD= -lm  -Wl,-f,libsupc++.so.1
 
 # libstdc++ sources
 SRCS+= bitmap_allocator.cc pool_allocator.cc \

Modified: head/gnu/lib/libsupc++/Makefile
==
--- head/gnu/lib/libsupc++/Makefile Sat Mar 31 14:03:16 2012
(r233748)
+++ head/gnu/lib/libsupc++/Makefile Sat Mar 31 14:25:12 2012
(r233749)
@@ -7,8 +7,8 @@ SRCDIR= ${.CURDIR}/../../../contrib/libs
 
 .PATH: ${SRCDIR} ${GCCLIB}/libiberty
 
-# Static only.
 LIB=   supc++
+SHLIB_MAJOR=1
 SRCS+= del_op.cc del_opnt.cc del_opv.cc del_opvnt.cc eh_alloc.cc eh_arm.cc \
eh_aux_runtime.cc eh_call.cc eh_catch.cc eh_exception.cc eh_globals.cc \
eh_personality.cc eh_term_handler.cc eh_terminate.cc eh_throw.cc \
@@ -36,4 +36,9 @@ unwind.h: ${GCCDIR}/unwind-generic.h
 SRCS+= unwind.h
 CLEANFILES+=   unwind.h
 
+# Symbol versioning
+
+VERSION_MAP=   ${.CURDIR}/Version.map
+
+
 .include bsd.lib.mk

Copied and modified: head/gnu/lib/libsupc++/Version.map (from r232970, 
head/contrib/libstdc++/config/abi/pre/gnu.ver)
==
--- head/contrib/libstdc++/config/abi/pre/gnu.ver   Wed Mar 14 14:34:14 
2012(r232970, copy source)
+++ head/gnu/lib/libsupc++/Version.map  Sat Mar 31 14:25:12 2012
(r233749)
@@ -19,676 +19,7 @@
 ## Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
 ## USA.
 
-GLIBCXX_3.4 {
-
-  global:
-
-# Names inside the 'extern' block are demangled names.
-extern C++
-{
-  std::[A-Za]*;
-# std::ba[a-r]*;
-  std::basic_[a-e]*;
-  std::basic_f[a-r]*;
-# std::basic_fstream;
-  std::basic_f[t-z]*;
-  std::basic_[g-h]*;
-  std::basic_i[a-e]*;
-# std::basic_ifstream;
-  std::basic_i[g-r]*;
-  std::basic_istr[a-d]*;
-# std::basic_istream;
-  std::basic_istr[f-z]*;
-  std::basic_i[t-z]*;
-  std::basic_[j-n]*;
-  std::basic_o[a-e]*;
-# std::basic_ofstream;
-# std::basic_o[g-z]*;
-  std::basic_o[g-r]*;
-  std::basic_ostr[a-d]*;
-  std::basic_ostr[f-z]*;
-  std::basic_[p-r]*;
-  std::basic_streambuf*;
-# std::basic_string
-# std::basic_stringbuf
-  std::basic_stringstream*;
-  std::basic_[t-z]*;
-  std::ba[t-z]*;
-  std::b[b-z]*;
-  std::c[a-g]*;
-# std::char_traits;
-  std::c[i-z]*;
-  std::[d-h]*;
-  std::i[a-n]*;
-  std::ios_base::[A-Ha-z]*;
-  std::ios_base::_M_grow_words*;
-  std::ios_base::_M_init*;
-  std::ios_base::Init::[A-Za-z]*;
-  std::ios_base::[J-Za-z]*;
-  std::i[p-r]*;
-# std::istream
-# std::istreambuf_iterator
-  std::istringstream*;
-  std::istrstream*;
-  std::i[t-z]*;
-  std::[A-Zj-k]*;
-  std::length_error*;
-  std::logic_error*;
-  std::locale::[A-Za-e]*;
-  std::locale::facet::[A-Za-z]*;
-  std::locale::facet::_S_get_c_locale*;
-  std::locale::facet::_S_clone_c_locale*;
-  std::locale::facet::_S_create_c_locale*;
-  std::locale::facet::_S_destroy_c_locale*;
-  std::locale::[A-Zg-h]*;
-  std::locale::id::[A-Za-z]*;
-  std::locale::id::_M_id*;
-  std::locale::[A-Zj-z]*;
-  std::locale::_[A-Ha-z]*;
-  std::locale::_Impl::[A-Za-z]*;
-# std::locale::_Impl::_M_[A-Za-z]*;
-  std::locale::_[J-Ra-z]*;
-  std::locale::_S_normalize_category*;
-  std::locale::_[T-Za-z]*;
-# std::[A-Zm-r]*;
-  std::[A-Zm]*;
-  std::n[^u]*;
-  std::nu[^m]*;
-  std::num[^e]*;
-  std::[p-r]*;
-  std::ostrstream*;
-  std::out_of_range*;
-  std::overflow_error*;
-  std::set_new_handler*;
-  std::set_terminate*;
-  std::set_unexpected*;
-# std::string
-  std::strstream*;
-  std::strstreambuf*;
-  std::[A-Zt-z]*;
-  std::_List_node_base::hook*;
-  std::_List_node_base::swap*;
-  

svn commit: r233757 - head/sys/sys

2012-04-01 Thread David Chisnall
Author: theraven
Date: Sun Apr  1 09:35:23 2012
New Revision: 233757
URL: http://svn.freebsd.org/changeset/base/233757

Log:
  Bump __FreeBSD_version for xlocale cleanup, as requested by ports people.
  
  Approved by:  dim (mentor)

Modified:
  head/sys/sys/param.h

Modified: head/sys/sys/param.h
==
--- head/sys/sys/param.hSun Apr  1 08:58:21 2012(r233756)
+++ head/sys/sys/param.hSun Apr  1 09:35:23 2012(r233757)
@@ -58,7 +58,7 @@
  * in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 109  /* Master, propagated to newvers */
+#define __FreeBSD_version 110  /* Master, propagated to newvers */
 
 /*
  * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
___
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: r233749 - in head/gnu/lib: libstdc++ libsupc++

2012-04-02 Thread David Chisnall
On 2 Apr 2012, at 02:03, Alexander Kabaev wrote:

 there are reports of this commit breaking complex C++ binaries such as
 build as part of KDE4. This is being looked at.

Do you have any more information about what is broken? (Run-time failures, 
linker failures?)

David___
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: r232351 - in head/sys: kern sys ufs/ffs ufs/ufs

2012-04-07 Thread David Chisnall
On 7 Apr 2012, at 18:10, David Schultz wrote:

 The biggest hinderance to using extern inline is that gcc and C99
 disagree about what it means, unless you use a reasonably recent
 compiler in C99 mode.  I first tried to use extern inline in the
 tree several years after I backported gcc's C99 inline support,
 and it still turned out to be a headache.

You can detect which inlining mode is going to happen by checking the value of 
__STDC_VERSION__ and the value of __GNUC_GNU_INLINE__.  If __STDC_VERSION__ is 
= 199901L and __GNUC_GNU_INLINE__ is not defined then you're in C99 inlining 
mode, otherwise you're in GNU inlining mode.  

On some projects with headers that need to work in both modes, we've written 
some INLINE_EXTERN macros that do the right thing in whichever mode we find 
ourselves compiling.  It might be worth putting these in cdefs.h if they're 
generally useful.

David___
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: r234573 - head/include/xlocale

2012-04-22 Thread David Chisnall
Author: theraven
Date: Sun Apr 22 16:58:14 2012
New Revision: 234573
URL: http://svn.freebsd.org/changeset/base/234573

Log:
  Fix a bug caused by some misplaced brackets.
  
  Reported by:  das

Modified:
  head/include/xlocale/_ctype.h

Modified: head/include/xlocale/_ctype.h
==
--- head/include/xlocale/_ctype.h   Sun Apr 22 16:13:23 2012
(r234572)
+++ head/include/xlocale/_ctype.h   Sun Apr 22 16:58:14 2012
(r234573)
@@ -78,8 +78,8 @@ __maskrune_l(__ct_rune_t __c, unsigned l
 {
int __limit;
_RuneLocale *runes = __runes_for_locale(__loc, __limit);
-   return (__c  0 || __c = _CACHED_RUNES) ? ___runetype_l(__c, __loc) :
-  runes-__runetype[__c]  __f;
+   return ((__c  0 || __c = _CACHED_RUNES) ? ___runetype_l(__c, __loc) :
+   runes-__runetype[__c])  __f;
 }
 
 _XLOCALE_INLINE int
___
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: r234578 - head/lib/libc/locale

2012-04-22 Thread David Chisnall
Author: theraven
Date: Sun Apr 22 18:51:38 2012
New Revision: 234578
URL: http://svn.freebsd.org/changeset/base/234578

Log:
  Fix some incorrect symbol versions.
  
  Reported by:  das

Modified:
  head/lib/libc/locale/Symbol.map

Modified: head/lib/libc/locale/Symbol.map
==
--- head/lib/libc/locale/Symbol.map Sun Apr 22 18:18:49 2012
(r234577)
+++ head/lib/libc/locale/Symbol.map Sun Apr 22 18:51:38 2012
(r234578)
@@ -60,13 +60,9 @@ FBSD_1.0 {
nextwctype;
nl_langinfo;
__maskrune;
-   __maskrune_l;
__sbmaskrune;
-   __sbmaskrune_l;
__istype;
-   __istype_l;
__sbistype;
-   __sbistype_l;
__isctype;
__toupper;
__sbtoupper;
@@ -197,6 +193,10 @@ FBSD_1.3 {
wcstoul_l;
wcstoull_l;
wcstoumax_l;
+   __sbistype_l;
+   __maskrune_l;
+   __sbmaskrune_l;
+   __istype_l;
__runes_for_locale;
_ThreadRuneLocale;
 };
___
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: r234732 - head/usr.sbin/wpa/hostapd

2012-04-27 Thread David Chisnall
Author: theraven
Date: Fri Apr 27 15:35:09 2012
New Revision: 234732
URL: http://svn.freebsd.org/changeset/base/234732

Log:
  Add a note to hostapd.conf about an unhelpful error message in the hope that
  it won't confuse anyone else in the future.
  
  MFC after:1 week

Modified:
  head/usr.sbin/wpa/hostapd/hostapd.conf.5

Modified: head/usr.sbin/wpa/hostapd/hostapd.conf.5
==
--- head/usr.sbin/wpa/hostapd/hostapd.conf.5Fri Apr 27 13:58:09 2012
(r234731)
+++ head/usr.sbin/wpa/hostapd/hostapd.conf.5Fri Apr 27 15:35:09 2012
(r234732)
@@ -67,7 +67,8 @@ The following parameters are recognized:
 Interface name.
 Should be set in
 .Dq hostap
-mode.
+mode.  Make certain that there are no spaces after the interface name, 
+or hostapd will complain that the interface does not exist.
 .It Va debug
 Debugging mode: 0 = no, 1 = minimal, 2 = verbose, 3 = msg dumps, 4 =
 excessive.
___
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: r234958 - head/include

2012-05-03 Thread David Chisnall
Author: theraven
Date: Thu May  3 15:54:06 2012
New Revision: 234958
URL: http://svn.freebsd.org/changeset/base/234958

Log:
  Fix stdatomic.h after clang decided to rename all of its builtins to include
  a c11 prefix to disambiguate them from the one provided by GCC.
  
  Note: Clang 3.1 also supports the GCC builtins for libstdc++ 4.7 
compatibility,
  but I don't recommend using them because they are very poorly designed.
  
  MFC after:2 weeks

Modified:
  head/include/stdatomic.h

Modified: head/include/stdatomic.h
==
--- head/include/stdatomic.hThu May  3 15:51:34 2012(r234957)
+++ head/include/stdatomic.hThu May  3 15:54:06 2012(r234958)
@@ -51,7 +51,7 @@
 
 #if defined(__CLANG_ATOMICS)
 #defineATOMIC_VAR_INIT(value)  (value)
-#defineatomic_init(obj, value) __atomic_init(obj, value)
+#defineatomic_init(obj, value) __c11_atomic_init(obj, value)
 #else
 #defineATOMIC_VAR_INIT(value)  { .__val = (value) }
 #defineatomic_init(obj, value) do {
\
@@ -104,7 +104,10 @@ enum memory_order {
  * 7.17.4 Fences.
  */
 
-#if defined(__CLANG_ATOMICS) || defined(__GNUC_ATOMICS)
+#ifdef __CLANG_ATOMICS
+#defineatomic_thread_fence(order)  __c11_atomic_thread_fence(order)
+#defineatomic_signal_fence(order)  __c11_atomic_signal_fence(order)
+#elif defined(__GNUC_ATOMICS)
 #defineatomic_thread_fence(order)  __atomic_thread_fence(order)
 #defineatomic_signal_fence(order)  __atomic_signal_fence(order)
 #else
@@ -118,7 +121,7 @@ enum memory_order {
 
 #if defined(__CLANG_ATOMICS)
 #defineatomic_is_lock_free(obj) \
-   __atomic_is_lock_free(sizeof(obj))
+   __c11_atomic_is_lock_free(sizeof(obj))
 #elif defined(__GNUC_ATOMICS)
 #defineatomic_is_lock_free(obj) \
__atomic_is_lock_free(sizeof((obj)-__val))
@@ -182,28 +185,28 @@ typedef _Atomic(__uintmax_t)  atomic_uin
 #if defined(__CLANG_ATOMICS)
 #defineatomic_compare_exchange_strong_explicit(object, expected,   
\
 desired, success, failure) \
-   __atomic_compare_exchange_strong(object, expected, desired, \
+   __c11_atomic_compare_exchange_strong(object, expected, desired, \
success, failure)
 #defineatomic_compare_exchange_weak_explicit(object, expected, 
\
 desired, success, failure) \
-   __atomic_compare_exchange_weak(object, expected, desired,   \
+   __c11_atomic_compare_exchange_weak(object, expected, desired,   \
success, failure)
 #defineatomic_exchange_explicit(object, desired, order)
\
-   __atomic_exchange(object, desired, order)
+   __c11_atomic_exchange(object, desired, order)
 #defineatomic_fetch_add_explicit(object, operand, order)   
\
-   __atomic_fetch_add(object, operand, order)
+   __c11_atomic_fetch_add(object, operand, order)
 #defineatomic_fetch_and_explicit(object, operand, order)   
\
-   __atomic_fetch_and(object, operand, order)
+   __c11_atomic_fetch_and(object, operand, order)
 #defineatomic_fetch_or_explicit(object, operand, order)
\
-   __atomic_fetch_or(object, operand, order)
+   __c11_atomic_fetch_or(object, operand, order)
 #defineatomic_fetch_sub_explicit(object, operand, order)   
\
-   __atomic_fetch_sub(object, operand, order)
+   __c11_atomic_fetch_sub(object, operand, order)
 #defineatomic_fetch_xor_explicit(object, operand, order)   
\
-   __atomic_fetch_xor(object, operand, order)
+   __c11_atomic_fetch_xor(object, operand, order)
 #defineatomic_load_explicit(object, order) 
\
-   __atomic_load(object, order)
+   __c11_atomic_load(object, order)
 #defineatomic_store_explicit(object, desired, order)   
\
-   __atomic_store(object, desired, order)
+   __c11_atomic_store(object, desired, order)
 #elif defined(__GNUC_ATOMICS)
 #defineatomic_compare_exchange_strong_explicit(object, expected,   
\
 desired, success, failure) \
___
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: r234976 - in head/contrib/libc++: include src

2012-05-03 Thread David Chisnall
Author: theraven
Date: Thu May  3 17:44:07 2012
New Revision: 234976
URL: http://svn.freebsd.org/changeset/base/234976

Log:
  Import new version of libc++.  Among other improvements, this comes with an
  atomic header that works with clang 3.1 (and, importantly, the pre-3.1
  snapshot currently in head)

Modified:
  head/contrib/libc++/include/__config
  head/contrib/libc++/include/__tuple
  head/contrib/libc++/include/algorithm
  head/contrib/libc++/include/atomic
  head/contrib/libc++/include/cmath
  head/contrib/libc++/include/limits
  head/contrib/libc++/include/memory
  head/contrib/libc++/include/random
  head/contrib/libc++/include/system_error
  head/contrib/libc++/include/tuple
  head/contrib/libc++/include/type_traits
  head/contrib/libc++/include/utility
  head/contrib/libc++/src/iostream.cpp
  head/contrib/libc++/src/stdexcept.cpp
  head/contrib/libc++/src/utility.cpp
Directory Properties:
  head/contrib/libc++/   (props changed)

Modified: head/contrib/libc++/include/__config
==
--- head/contrib/libc++/include/__configThu May  3 17:08:40 2012
(r234975)
+++ head/contrib/libc++/include/__configThu May  3 17:44:07 2012
(r234976)
@@ -384,7 +384,9 @@ template unsigned struct __static_asse
 #endif
 
 #ifdef _LIBCPP_HAS_NO_CONSTEXPR
-#define constexpr const
+#define _LIBCPP_CONSTEXPR
+#else
+#define _LIBCPP_CONSTEXPR constexpr
 #endif
 
 #ifndef __has_feature

Modified: head/contrib/libc++/include/__tuple
==
--- head/contrib/libc++/include/__tuple Thu May  3 17:08:40 2012
(r234975)
+++ head/contrib/libc++/include/__tuple Thu May  3 17:44:07 2012
(r234976)
@@ -216,7 +216,7 @@ struct __tuple_convertible_imp : public 
 template class _Tp0, class ..._Tp, class _Up0, class ..._Up
 struct __tuple_convertible_imptrue, __tuple_types_Tp0, _Tp..., 
__tuple_types_Up0, _Up... 
 : public integral_constantbool,
-   is_constructible_Up0, _Tp0::value 
+   is_convertible_Tp0, _Up0::value 
__tuple_convertible_imptrue, 
__tuple_types_Tp..., __tuple_types_Up... ::value {};
 
 template 
@@ -235,6 +235,33 @@ struct __tuple_convertible_Tp, _Up, tru
  typename __make_tuple_types_Tp::type, typename 
__make_tuple_types_Up::type
 {};
 
+// __tuple_constructible
+
+template bool, class _Tp, class _Up
+struct __tuple_constructible_imp : public false_type {};
+
+template class _Tp0, class ..._Tp, class _Up0, class ..._Up
+struct __tuple_constructible_imptrue, __tuple_types_Tp0, _Tp..., 
__tuple_types_Up0, _Up... 
+: public integral_constantbool,
+   is_constructible_Up0, _Tp0::value 
+   __tuple_constructible_imptrue, 
__tuple_types_Tp..., __tuple_types_Up... ::value {};
+
+template 
+struct __tuple_constructible_imptrue, __tuple_types, __tuple_types 
+: public true_type {};
+
+template class _Tp, class _Up, bool = __tuple_liketypename 
remove_reference_Tp::type::value,
+bool = __tuple_like_Up::value
+struct __tuple_constructible
+: public false_type {};
+
+template class _Tp, class _Up
+struct __tuple_constructible_Tp, _Up, true, true
+: public __tuple_constructible_imptuple_sizetypename 
remove_reference_Tp::type::value ==
+ tuple_size_Up::value,
+ typename __make_tuple_types_Tp::type, typename 
__make_tuple_types_Up::type
+{};
+
 // __tuple_assignable
 
 template bool, class _Tp, class _Up

Modified: head/contrib/libc++/include/algorithm
==
--- head/contrib/libc++/include/algorithm   Thu May  3 17:08:40 2012
(r234975)
+++ head/contrib/libc++/include/algorithm   Thu May  3 17:44:07 2012
(r234976)
@@ -2508,11 +2508,16 @@ private:
 _Engine_result_type __mask0_;
 _Engine_result_type __mask1_;
 
+#ifdef _LIBCPP_HAS_NO_CONSTEXPR
 static const _Working_result_type _Rp = _Engine::_Max - _Engine::_Min
- + 
_Working_result_type(1);
-static const size_t __m = __log2_Working_result_type, _Rp::value;
-static const size_t _WDt = numeric_limits_Working_result_type::digits;
-static const size_t _EDt = numeric_limits_Engine_result_type::digits;
+  + _Working_result_type(1);
+#else
+static _LIBCPP_CONSTEXPR const _Working_result_type _Rp = _Engine::max() - 
_Engine::min()
+  + 
_Working_result_type(1);
+#endif
+static _LIBCPP_CONSTEXPR const size_t __m = __log2_Working_result_type, 
_Rp::value;
+static _LIBCPP_CONSTEXPR const size_t _WDt = 
numeric_limits_Working_result_type::digits;
+static _LIBCPP_CONSTEXPR 

Re: svn commit: r235267 - in head/usr.bin/sort: . nls

2012-05-11 Thread David Chisnall
On 11 May 2012, at 08:48, Konstantin Belousov wrote:

 On Fri, May 11, 2012 at 12:37:16PM +, Gabor Kovesdan wrote:
 Author: gabor
 Date: Fri May 11 12:37:16 2012
 New Revision: 235267
 URL: http://svn.freebsd.org/changeset/base/235267
 
 +bool byte_sort = false;
 +
 +static wchar_t **wmonths = NULL;
 +static unsigned char **cmonths = NULL;
 
 Such initializations are useless. You only increase the size of the binary
 on the disk as the consequence.

Really?  The C specification requires all globals and statics that are not 
explicitly initialised to be set to their zero value, so this initialisation 
has no effect on the resulting binary[1].  These are placed in the BSS section, 
irrespective of whether the initialisation is implicit or explicit and the 
loader is responsible for allocating space for them - all that is stored in the 
binary is the size.

For local variables, initialisation like this has no effect even at low 
optimisation levels - dead stores will be removed.  It does, however, make it 
more difficult for the compiler to distinguish between initialised and 
initialised sensibly in some cases.

David

[1] In a standards-compliant compiler.  Apparently a few shipping compilers for 
embedded systems fail to respect this, but everything FreeBSD is compiled with 
does.___
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: r236148 - head/lib/msun/src

2012-05-27 Thread David Chisnall
Author: theraven
Date: Sun May 27 12:54:41 2012
New Revision: 236148
URL: http://svn.freebsd.org/changeset/base/236148

Log:
  Allow inclusion of libc++ cmath to work after including math.h
  
  Submitted by: Yamaya Takashi
  Reviewed by:  das
  MFC after:1 week

Modified:
  head/lib/msun/src/math.h

Modified: head/lib/msun/src/math.h
==
--- head/lib/msun/src/math.hSun May 27 12:47:35 2012(r236147)
+++ head/lib/msun/src/math.hSun May 27 12:54:41 2012(r236148)
@@ -395,35 +395,15 @@ float significandf(float);
  * long double versions of ISO/POSIX math functions
  */
 #if __ISO_C_VISIBLE = 1999
-#if _DECLARE_C99_LDBL_MATH
-long doubleacoshl(long double);
-#endif
 long doubleacosl(long double);
-#if _DECLARE_C99_LDBL_MATH
-long doubleasinhl(long double);
-#endif
 long doubleasinl(long double);
 long doubleatan2l(long double, long double);
-#if _DECLARE_C99_LDBL_MATH
-long doubleatanhl(long double);
-#endif
 long doubleatanl(long double);
 long doublecbrtl(long double);
 long doubleceill(long double);
 long doublecopysignl(long double, long double) __pure2;
-#if _DECLARE_C99_LDBL_MATH
-long doublecoshl(long double);
-#endif
 long doublecosl(long double);
-#if _DECLARE_C99_LDBL_MATH
-long doubleerfcl(long double);
-long doubleerfl(long double);
-#endif
 long doubleexp2l(long double);
-#if _DECLARE_C99_LDBL_MATH
-long doubleexpl(long double);
-long doubleexpm1l(long double);
-#endif
 long doublefabsl(long double) __pure2;
 long doublefdiml(long double, long double);
 long doublefloorl(long double);
@@ -435,20 +415,9 @@ long doublefrexpl(long double value, in
 long doublehypotl(long double, long double);
 intilogbl(long double) __pure2;
 long doubleldexpl(long double, int);
-#if _DECLARE_C99_LDBL_MATH
-long doublelgammal(long double);
-#endif
 long long  llrintl(long double);
 long long  llroundl(long double);
-#if _DECLARE_C99_LDBL_MATH
-long doublelog10l(long double);
-long doublelog1pl(long double);
-long doublelog2l(long double);
-#endif
 long doublelogbl(long double);
-#if _DECLARE_C99_LDBL_MATH
-long doublelogl(long double);
-#endif
 long   lrintl(long double);
 long   lroundl(long double);
 long doublemodfl(long double, long double *); /* fundamentally !__pure2 */
@@ -458,30 +427,54 @@ long double   nextafterl(long double, long
 double nexttoward(double, long double);
 float  nexttowardf(float, long double);
 long doublenexttowardl(long double, long double);
-#if _DECLARE_C99_LDBL_MATH
-long doublepowl(long double, long double);
-#endif
 long doubleremainderl(long double, long double);
 long doubleremquol(long double, long double, int *);
 long doublerintl(long double);
 long doubleroundl(long double);
 long doublescalblnl(long double, long);
 long doublescalbnl(long double, int);
-#if _DECLARE_C99_LDBL_MATH
-long doublesinhl(long double);
-#endif
 long doublesinl(long double);
 long doublesqrtl(long double);
-#if _DECLARE_C99_LDBL_MATH
-long doubletanhl(long double);
-#endif
 long doubletanl(long double);
-#if _DECLARE_C99_LDBL_MATH
-long doubletgammal(long double);
-#endif
 long doubletruncl(long double);
 
 #endif /* __ISO_C_VISIBLE = 1999 */
 __END_DECLS
 
 #endif /* !_MATH_H_ */
+
+/* separate header for cmath */
+#ifndef _MATH_EXTRA_H_
+#if __ISO_C_VISIBLE = 1999
+#if _DECLARE_C99_LDBL_MATH
+
+#define _MATH_EXTRA_H_
+
+/*
+ * extra long double versions of math functions for C99 and cmath
+ */
+__BEGIN_DECLS
+
+long doubleacoshl(long double);
+long doubleasinhl(long double);
+long doubleatanhl(long double);
+long doublecoshl(long double);
+long doubleerfcl(long double);
+long doubleerfl(long double);
+long doubleexpl(long double);
+long doubleexpm1l(long double);
+long doublelgammal(long double);
+long doublelog10l(long double);
+long doublelog1pl(long double);
+long doublelog2l(long double);
+long doublelogl(long double);
+long doublepowl(long double, long double);
+long doublesinhl(long double);
+long doubletanhl(long double);
+long doubletgammal(long double);
+
+__END_DECLS
+
+#endif /* !_DECLARE_C99_LDBL_MATH */
+#endif /* __ISO_C_VISIBLE = 1999 */
+#endif /* !_MATH_EXTRA_H_ */
___
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: r236177 - head/gnu/lib/libsupc++

2012-05-28 Thread David Chisnall
Author: theraven
Date: Mon May 28 12:11:00 2012
New Revision: 236177
URL: http://svn.freebsd.org/changeset/base/236177

Log:
  Correctly export operator new / delete for things linking against libsupc++ 
but
  not libstdc++.
  
  Unfortunately, it appears that libsupc++ / libstdc++ have a different idea of
  the type of size_t to the rest of the world, which may cause problems later
  on...
  
  Reported by:  des
  MFC after:1 week

Modified:
  head/gnu/lib/libsupc++/Version.map

Modified: head/gnu/lib/libsupc++/Version.map
==
--- head/gnu/lib/libsupc++/Version.map  Mon May 28 10:45:51 2012
(r236176)
+++ head/gnu/lib/libsupc++/Version.map  Mon May 28 12:11:00 2012
(r236177)
@@ -126,6 +126,16 @@ CXXABI_1.3 {
 # __gnu_cxx::_verbose_terminate_handler()
 _ZN9__gnu_cxx27__verbose_terminate_handlerEv;
 
+# new / delete operators
+_Znaj;
+_ZnajRKSt9nothrow_t;
+_Znwj;
+_ZnwjRKSt9nothrow_t;
+_ZdaPv;
+_ZdaPvRKSt9nothrow_t;
+_ZdlPv;
+_ZdlPvRKSt9nothrow_t;
+
   local:
 *;
 };
___
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: r230225 - head/include

2012-01-16 Thread David Chisnall
Author: theraven
Date: Mon Jan 16 18:19:53 2012
New Revision: 230225
URL: http://svn.freebsd.org/changeset/base/230225

Log:
  Use the signal fence builtin in stdatomic.h when using the clang atomic
  builtins, rather than the __asm hack.  Somehow I missed the existence of this
  builtin originally and only noticed that it was there when I went to implement
  it...
  
  Note: Trunk clang now has support for (most of) the C[++]11 atomics stuff.
  Please test!
  
  Approved by:  brooks (mentor)

Modified:
  head/include/stdatomic.h

Modified: head/include/stdatomic.h
==
--- head/include/stdatomic.hMon Jan 16 17:31:26 2012(r230224)
+++ head/include/stdatomic.hMon Jan 16 18:19:53 2012(r230225)
@@ -104,10 +104,7 @@ enum memory_order {
  * 7.17.4 Fences.
  */
 
-#if defined(__CLANG_ATOMICS)
-#defineatomic_thread_fence(order)  __atomic_thread_fence(order)
-#defineatomic_signal_fence(order)  __asm volatile ( : : : 
memory)
-#elif defined(__GNUC_ATOMICS)
+#if defined(__CLANG_ATOMICS) || defined(__GNUC_ATOMICS)
 #defineatomic_thread_fence(order)  __atomic_thread_fence(order)
 #defineatomic_signal_fence(order)  __atomic_signal_fence(order)
 #else
___
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: r230267 - head/include

2012-01-17 Thread David Chisnall
Author: theraven
Date: Tue Jan 17 15:20:41 2012
New Revision: 230267
URL: http://svn.freebsd.org/changeset/base/230267

Log:
  Fix clang atomic to use for atomic_is_lock_free().
  
  Reviewed by:  ed
  Approved by:  dim (mentor)

Modified:
  head/include/stdatomic.h

Modified: head/include/stdatomic.h
==
--- head/include/stdatomic.hTue Jan 17 13:52:04 2012(r230266)
+++ head/include/stdatomic.hTue Jan 17 15:20:41 2012(r230267)
@@ -118,7 +118,7 @@ enum memory_order {
 
 #if defined(__CLANG_ATOMICS)
 #defineatomic_is_lock_free(obj) \
-   __atomic_is_lock_free(obj)
+   __atomic_is_lock_free(sizeof(obj))
 #elif defined(__GNUC_ATOMICS)
 #defineatomic_is_lock_free(obj) \
__atomic_is_lock_free(sizeof((obj)-__val))
___
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: r230201 - head/lib/libc/gen

2012-01-19 Thread David Chisnall
On 19 Jan 2012, at 18:09, Ed Schouten wrote:

 In the very nearby future (after I switch SPARC64 and MIPS to
 libcompiler_rt), it should be possible to safely use C11's stdatomic.h
 on all supported architectures. The C11 interface allows any operation
 to be combined with any type of barrier.
 
 Maybe we should simply migrate this code to use stdatomic.h then?

Currently, that will give worse code if we use gcc 4.2.1, but (I hope!) better 
code if we use clang.  With GCC, we are implementing atomic_thread_fence() as 
__sync_synchronize(), which is a full barrier, and ignoring its argument.  It 
would probably be worth postponing any such migration until:

1) Clang is the default compiler, and
2) The bugs in LLVM that cause the back end to fatal error on any nontrivial 
code using atomics are fixed.

David___
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: r230201 - head/lib/libc/gen

2012-01-20 Thread David Chisnall
On 20 Jan 2012, at 00:46, David Xu wrote:

 It depends on hardware, if it is a large machine with lots of cpu,
 a small conflict on dual-core machine can become a large conflict
 on large machine because it is possible more cpus are now
 running same code which becomes a bottleneck. On a large machine
 which has 1024 cores, many code need to be redesigned.

You'll also find that the relative cost of atomic instructions varies a lot 
between CPU models.  Between Core 2 and Sandy Bridge Core i7, the relative cost 
of an atomic add (full barrier) dropped by about two thirds.  The cache 
coherency logic has been significantly improved on the newer chips.  

For portable code, it's worth remembering that ARMv8 (which doesn't entirely 
exist yet) contains a set of barriers that closely match the semantics of the 
C[++]11 memory ordering.  They do this not for performance (directly), but for 
power efficiency - so using the least-restrictive required locking will 
eventually result in code for mobile devices that uses less battery power, if 
it's in a hot path.  

David___
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: r227753 - in head: contrib/gdtoa include lib/libc/gdtoa lib/libc/gen lib/libc/locale lib/libc/regex lib/libc/stdio lib/libc/stdlib lib/libc/stdtime lib/libc/string

2012-01-30 Thread David Chisnall
On 18 Jan 2012, at 19:07, David Schultz wrote:

 This patch appears to cause a large performance regression.  For
 example, I measured a 78% slowdown for strtol(42, ...).

That's definitely worth taking a closer look at.  I think we can cache some 
things in TLS and avoid some pthread_getspecific calls.  The current code is 
the 'make it work' version.  The 'make it fast' version is planned...

 Furthermore, the resulting static binary for a trivial program
 goes from 7k to 303k, due to pulling in malloc, stdio, and all the
 pthread stubs.  

That's not ideal, but I'm not sure if it's avoidable.  Is statically linking 
libc something people regularly do?

 Presumably the capabilities of the non-xlocale
 entry points aren't appreciably changed,

Well... actually they are.  All of them now use the per-thread locale if one is 
set, and only fall back to the global one if it isn't.  The behaviour is only 
unchanged if nothing in the program calls uselocale().

 so there ought to be a
 way to avoid the overhead for them.  Do you have any thoughts on this?

Yup.  A quick-and-dirty hack would be to add a flag that was set on the first 
call to uselocale() and to always use the global locale if this is not set.  
That should remove a lot of the overhead in cases where no one uses the 
per-thread locales.  

We can also probably store the locale in TLS, which (on platforms with fast 
TLS) should speed up the lookup a bit.  

 Some more minor issues...
 
 It's also customary to document public APIs so that, for
 instance, `man printf_l' pulls up a page with the prototype,
 required #includes, and behavior.  Aliasing manpages with
 MLINKS as appropriate is fine; for instance, Darwin's manpages
 on these functions look like a good example to follow.

Yup, all of the foo_l manpages are missing.  They're on my TODO, unless any 
docs people want to get there first...

 Finally, I'm not usually one to be picky about style, but could
 you make a pass to clean things up a little bit to match the
 surrounding code, wrap multiline comments to 80 columns, etc?
 You've also added new copyright notices for one-line changes
 (e.g., stdio/vdprintf.c, gdtoa/machdep_ldis?.c) and multiple
 copyright notices in the same file (locale/collate.c), which
 could be cleaned up concurrently.

I'll take a look.

David___
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: r231673 - in head: etc/mtree include include/xlocale lib/libc/locale sys/sys

2012-02-14 Thread David Chisnall
 | 
\
-   LC_MONETARY_MASK | LC_NUMERIC_MASK | LC_TIME_MASK)
-
-#define LC_GLOBAL_LOCALE ((locale_t)-1)
-
-__BEGIN_DECLS
-
-typedef struct _xlocale *locale_t;
-/**
- * Creates a new locale.  
- */
-locale_tnewlocale(int mask, const char *locale, locale_t base);
-
-/**
- * Returns an identical duplicate of the passed locale.  The returned locale
- * must be freed with freelocale().  The returned locale will share components
- * with the original.
- */
-locale_tduplocale(locale_t base);
-/*
- * Free a locale_t.  This is quite a poorly named function.  It actually
- * disclaims a reference to a locale_t, rather than freeing it.  
- */
-int freelocale(locale_t loc);
-
-/*
- * Returns the name of the locale for a particular component of a locale_t.
- */
-const char *querylocale(int mask, locale_t loc);
-
-/*
- * Installs the specified locale_t as this thread's locale.
- */
-locale_tuselocale(locale_t loc);
-
+#include xlocale/_locale.h
+#endif
 __END_DECLS
 
-#endif /* __POSIX_VISIBLE = 200809 */
-
 
 #endif /* _LOCALE_H_ */

Modified: head/include/runetype.h
==
--- head/include/runetype.h Tue Feb 14 12:00:34 2012(r231672)
+++ head/include/runetype.h Tue Feb 14 12:03:23 2012(r231673)
@@ -85,11 +85,21 @@ typedef struct {
 #define_RUNE_MAGIC_1   RuneMagi  /* Indicates version 0 of 
RuneLocale */
 __BEGIN_DECLS
 extern const _RuneLocale _DefaultRuneLocale;
-__attribute__((deprecated))
-extern _RuneLocale *_CurrentRuneLocale;
-/* TODO: This is called quite a lot, so we should use a __thread variable when
- * it's available. */
-extern _RuneLocale *__getCurrentRuneLocale(void);
+extern const _RuneLocale *_CurrentRuneLocale;
+extern const _Thread_local _RuneLocale *_ThreadRuneLocale;
+#if defined(__NO_TLS) || defined(__RUNETYPE_INTERNAL)
+extern const _RuneLocale *__getCurrentRuneLocale(void);
+#else
+static inline const _RuneLocale *__getCurrentRuneLocale(void)
+{
+
+   if (_ThreadRuneLocale) 
+   return _ThreadRuneLocale;
+   if (_CurrentRuneLocale) 
+   return _CurrentRuneLocale;
+   return _DefaultRuneLocale;
+}
+#endif /* __NO_TLS || __RUNETYPE_INTERNAL */
 #define _CurrentRuneLocale (__getCurrentRuneLocale())
 __END_DECLS
 

Modified: head/include/string.h
==
--- head/include/string.h   Tue Feb 14 12:00:34 2012(r231672)
+++ head/include/string.h   Tue Feb 14 12:03:23 2012(r231673)
@@ -132,6 +132,10 @@ voidswab(const void * __restrict, void
 #endif /* _SWAB_DECLARED */
 
 #endif /* __BSD_VISIBLE */
+
+#if __POSIX_VISIBLE = 200809
+#include xlocale/_string.h
+#endif
 __END_DECLS
 
 #endif /* _STRING_H_ */

Modified: head/include/time.h
==
--- head/include/time.h Tue Feb 14 12:00:34 2012(r231672)
+++ head/include/time.h Tue Feb 14 12:03:23 2012(r231673)
@@ -183,6 +183,10 @@ void tzsetwall(void);
 time_t timelocal(struct tm * const);
 time_t timegm(struct tm * const);
 #endif /* __BSD_VISIBLE */
+
+#if __POSIX_VISIBLE = 200809
+#include xlocale/_time.h
+#endif
 __END_DECLS
 
 #endif /* !_TIME_H_ */

Modified: head/include/wchar.h
==
--- head/include/wchar.hTue Feb 14 12:00:34 2012(r231672)
+++ head/include/wchar.hTue Feb 14 12:03:23 2012(r231673)
@@ -224,6 +224,10 @@ wchar_t*fgetwln(FILE * __restrict, size
 size_t wcslcat(wchar_t *, const wchar_t *, size_t);
 size_t wcslcpy(wchar_t *, const wchar_t *, size_t);
 #endif
+
+#if __POSIX_VISIBLE = 200809
+#include xlocale/_wchar.h
+#endif
 __END_DECLS
 
 #endif /* !_WCHAR_H_ */

Modified: head/include/wctype.h
==
--- head/include/wctype.h   Tue Feb 14 12:00:34 2012(r231672)
+++ head/include/wctype.h   Tue Feb 14 12:03:23 2012(r231673)
@@ -87,6 +87,11 @@ wint_t   iswrune(wint_t);
 wint_t iswspecial(wint_t);
 wint_t nextwctype(wint_t, wctype_t);
 #endif
+
+#if __POSIX_VISIBLE = 200809
+#define _XLOCALE_WCTYPES 1
+#include xlocale/_ctype.h
+#endif /* __POSIX_VISIBLE = 200809 */
 __END_DECLS
 
 #ifndef __cplusplus

Modified: head/include/xlocale.h
==
--- head/include/xlocale.h  Tue Feb 14 12:00:34 2012(r231672)
+++ head/include/xlocale.h  Tue Feb 14 12:03:23 2012(r231673)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2011 The FreeBSD Foundation
+ * Copyright (c) 2011, 2012 The FreeBSD Foundation
  * All rights reserved.
  *
  * This software was developed by David Chisnall under sponsorship from
@@ -8,16 +8,16 @@
  * Redistribution and use in source and binary forms, with or without
  * modification

svn commit: r231682 - in head: include lib/libc/locale

2012-02-14 Thread David Chisnall
Author: theraven
Date: Tue Feb 14 14:24:37 2012
New Revision: 231682
URL: http://svn.freebsd.org/changeset/base/231682

Log:
  Fix a misplaced __NO_TLS locations, and change a GNUism to a C11ism for
  consistency.
  
  Approved by:  brooks (mentor)

Modified:
  head/include/runetype.h
  head/lib/libc/locale/setrunelocale.c
  head/lib/libc/locale/xlocale_private.h

Modified: head/include/runetype.h
==
--- head/include/runetype.h Tue Feb 14 14:19:53 2012(r231681)
+++ head/include/runetype.h Tue Feb 14 14:24:37 2012(r231682)
@@ -86,10 +86,10 @@ typedef struct {
 __BEGIN_DECLS
 extern const _RuneLocale _DefaultRuneLocale;
 extern const _RuneLocale *_CurrentRuneLocale;
-extern const _Thread_local _RuneLocale *_ThreadRuneLocale;
 #if defined(__NO_TLS) || defined(__RUNETYPE_INTERNAL)
 extern const _RuneLocale *__getCurrentRuneLocale(void);
 #else
+extern const _Thread_local _RuneLocale *_ThreadRuneLocale;
 static inline const _RuneLocale *__getCurrentRuneLocale(void)
 {
 

Modified: head/lib/libc/locale/setrunelocale.c
==
--- head/lib/libc/locale/setrunelocale.cTue Feb 14 14:19:53 2012
(r231681)
+++ head/lib/libc/locale/setrunelocale.cTue Feb 14 14:24:37 2012
(r231682)
@@ -183,6 +183,8 @@ __wrap_setrunelocale(const char *locale)
_CurrentRuneLocale = __xlocale_global_ctype.runes;
return (_LDP_LOADED);
 }
+
+#ifndef __NO_TLS
 void
 __set_thread_rune_locale(locale_t loc) {
 
@@ -192,10 +194,11 @@ __set_thread_rune_locale(locale_t loc) {
_ThreadRuneLocale = XLOCALE_CTYPE(loc)-runes;
}
 }
+#endif
+
 void *
 __ctype_load(const char *locale, locale_t unused)
 {
-#ifndef __NO_TLS
struct xlocale_ctype *l = calloc(sizeof(struct xlocale_ctype), 1);
l-header.header.destructor = destruct_ctype;
if (__setrunelocale(l, locale))
@@ -204,5 +207,4 @@ __ctype_load(const char *locale, locale_
return NULL;
}
return l;
-#endif
 }

Modified: head/lib/libc/locale/xlocale_private.h
==
--- head/lib/libc/locale/xlocale_private.h  Tue Feb 14 14:19:53 2012
(r231681)
+++ head/lib/libc/locale/xlocale_private.h  Tue Feb 14 14:24:37 2012
(r231682)
@@ -183,7 +183,7 @@ extern int __has_thread_locale;
  * The per-thread locale.  Avoids the need to use pthread lookup functions when
  * getting the per-thread locale.
  */
-extern __thread locale_t __thread_locale;
+extern _Thread_local locale_t __thread_locale;
 
 /**
  * Returns the current locale for this thread, or the global locale if none is
___
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: r232351 - in head/sys: kern sys ufs/ffs ufs/ufs

2012-03-02 Thread David Chisnall
On 2 Mar 2012, at 12:53, Konstantin Belousov wrote:

 This part of the change breaks KBI. I suggest that for merge to stable/9 
 you would leave the bread and breadn as functions.

Can we not do this for the general case?  Provide them as inline extern 
functions in the header, and implement them elsewhere, so the compiler will 
inline them in recompiled code but not break code that isn't?

I'm not sure if we have a guide for how to maintain ABI compatibility, but this 
should probably be one of the standard things to do.  The recent long 
discussion about what people want from FreeBSD indicated that a lot of people 
downstream wanted a stable ABI with a 10-year window and ABIs churn on releases 
was keeping a lot of people on 7.x or earlier...

Of course, the non-inline implementations of the can be conditionally compiled 
with COMPAT_9, so that people who don't care about backwards compatibility 
don't have to have them in their kernels...

David___
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: r232498 - in head: etc/mtree include include/xlocale lib/libc/locale sys/sys

2012-03-04 Thread David Chisnall
==
--- head/include/runetype.h Sun Mar  4 15:25:11 2012(r232497)
+++ head/include/runetype.h Sun Mar  4 15:31:13 2012(r232498)
@@ -85,11 +85,21 @@ typedef struct {
 #define_RUNE_MAGIC_1   RuneMagi  /* Indicates version 0 of 
RuneLocale */
 __BEGIN_DECLS
 extern const _RuneLocale _DefaultRuneLocale;
-__attribute__((deprecated))
-extern _RuneLocale *_CurrentRuneLocale;
-/* TODO: This is called quite a lot, so we should use a __thread variable when
- * it's available. */
-extern _RuneLocale *__getCurrentRuneLocale(void);
+extern const _RuneLocale *_CurrentRuneLocale;
+#if defined(__NO_TLS) || defined(__RUNETYPE_INTERNAL)
+extern const _RuneLocale *__getCurrentRuneLocale(void);
+#else
+extern _Thread_local const _RuneLocale *_ThreadRuneLocale;
+static inline const _RuneLocale *__getCurrentRuneLocale(void)
+{
+
+   if (_ThreadRuneLocale) 
+   return _ThreadRuneLocale;
+   if (_CurrentRuneLocale) 
+   return _CurrentRuneLocale;
+   return _DefaultRuneLocale;
+}
+#endif /* __NO_TLS || __RUNETYPE_INTERNAL */
 #define _CurrentRuneLocale (__getCurrentRuneLocale())
 __END_DECLS
 

Modified: head/include/string.h
==
--- head/include/string.h   Sun Mar  4 15:25:11 2012(r232497)
+++ head/include/string.h   Sun Mar  4 15:31:13 2012(r232498)
@@ -132,6 +132,10 @@ voidswab(const void * __restrict, void
 #endif /* _SWAB_DECLARED */
 
 #endif /* __BSD_VISIBLE */
+
+#if __POSIX_VISIBLE = 200809
+#include xlocale/_string.h
+#endif
 __END_DECLS
 
 #endif /* _STRING_H_ */

Modified: head/include/time.h
==
--- head/include/time.h Sun Mar  4 15:25:11 2012(r232497)
+++ head/include/time.h Sun Mar  4 15:31:13 2012(r232498)
@@ -183,6 +183,10 @@ void tzsetwall(void);
 time_t timelocal(struct tm * const);
 time_t timegm(struct tm * const);
 #endif /* __BSD_VISIBLE */
+
+#if __POSIX_VISIBLE = 200809
+#include xlocale/_time.h
+#endif
 __END_DECLS
 
 #endif /* !_TIME_H_ */

Modified: head/include/wchar.h
==
--- head/include/wchar.hSun Mar  4 15:25:11 2012(r232497)
+++ head/include/wchar.hSun Mar  4 15:31:13 2012(r232498)
@@ -224,6 +224,10 @@ wchar_t*fgetwln(FILE * __restrict, size
 size_t wcslcat(wchar_t *, const wchar_t *, size_t);
 size_t wcslcpy(wchar_t *, const wchar_t *, size_t);
 #endif
+
+#if __POSIX_VISIBLE = 200809
+#include xlocale/_wchar.h
+#endif
 __END_DECLS
 
 #endif /* !_WCHAR_H_ */

Modified: head/include/wctype.h
==
--- head/include/wctype.h   Sun Mar  4 15:25:11 2012(r232497)
+++ head/include/wctype.h   Sun Mar  4 15:31:13 2012(r232498)
@@ -87,6 +87,11 @@ wint_t   iswrune(wint_t);
 wint_t iswspecial(wint_t);
 wint_t nextwctype(wint_t, wctype_t);
 #endif
+
+#if __POSIX_VISIBLE = 200809
+#define _XLOCALE_WCTYPES 1
+#include xlocale/_ctype.h
+#endif /* __POSIX_VISIBLE = 200809 */
 __END_DECLS
 
 #ifndef __cplusplus

Modified: head/include/xlocale.h
==
--- head/include/xlocale.h  Sun Mar  4 15:25:11 2012(r232497)
+++ head/include/xlocale.h  Sun Mar  4 15:31:13 2012(r232498)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2011 The FreeBSD Foundation
+ * Copyright (c) 2011, 2012 The FreeBSD Foundation
  * All rights reserved.
  *
  * This software was developed by David Chisnall under sponsorship from
@@ -8,16 +8,16 @@
  * 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.
+ * 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 AUTHOR 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 AUTHOR OR CONTRIBUTORS BE LIABLE

svn commit: r232601 - in head/lib/libc: locale regex

2012-03-06 Thread David Chisnall
Author: theraven
Date: Tue Mar  6 12:53:44 2012
New Revision: 232601
URL: http://svn.freebsd.org/changeset/base/232601

Log:
  Remove some duplicated copyright notices.
  
  Approved by:  dim (mentor)

Modified:
  head/lib/libc/locale/collate.c
  head/lib/libc/regex/regcomp.c

Modified: head/lib/libc/locale/collate.c
==
--- head/lib/libc/locale/collate.c  Tue Mar  6 12:20:37 2012
(r232600)
+++ head/lib/libc/locale/collate.c  Tue Mar  6 12:53:44 2012
(r232601)
@@ -8,11 +8,6 @@
  * Portions of this software were developed by David Chisnall
  * under sponsorship from the FreeBSD Foundation.
  *
- * Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
- * Portions of this software were developed by David Chisnall
- * under sponsorship from the FreeBSD Foundation.
- *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:

Modified: head/lib/libc/regex/regcomp.c
==
--- head/lib/libc/regex/regcomp.c   Tue Mar  6 12:20:37 2012
(r232600)
+++ head/lib/libc/regex/regcomp.c   Tue Mar  6 12:53:44 2012
(r232601)
@@ -11,11 +11,6 @@
  * This code is derived from software contributed to Berkeley by
  * Henry Spencer.
  *
- * Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
- * Portions of this software were developed by David Chisnall
- * under sponsorship from the FreeBSD Foundation.
- *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
___
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: r232570 - head/sys/boot/i386/boot2

2012-03-08 Thread David Chisnall
On 8 Mar 2012, at 16:05, John Baldwin wrote:

 On Wednesday, March 07, 2012 5:00:19 pm Jung-uk Kim wrote:
 On Monday 05 March 2012 02:53 pm, John Baldwin wrote:
 Author: jhb
 Date: Mon Mar  5 19:53:17 2012
 New Revision: 232570
 URL: http://svn.freebsd.org/changeset/base/232570
 
 Log:
  Fix boot2 to handle boot config files that only contain a custom
 path to a loader or kernel.  Specifically, kname cannot be pointed
 at cmd[] since it's value is change to be an empty string after the
 initial call to parse, and cmd[]'s value can be changed (thus
 losing a prior setting for kname) due to user input at the boot
 prompt.  While here, ensure that that initial boot config file text
 is nul-terminated, that ops is initialized to zero, and that kname
 is always initialized to a valid string.
 
 As many people pointed out, Clang overflows boot2 again after this 
 commit.  Long long time ago, I asked this question on arch@:
 
 http://docs.freebsd.org/cgi/mid.cgi?200509081418.47794.jkim
 
 Why can't we do that now?  Can't we build separate ufs1-only and 
 ufs2-only boot2's, at least?  Having ufs1+ufs2 boot block is great 
 but I see very little benefit to support that in 2012. :-/
 
 As I said on the reply to current@, I think having separate boot blocks will 
 be a headache and PITA for our users.  Let's see if we can get boot2 to fit 
 without breaking functionality first.  It is a shame that gcc outperforms 
 clang so drastically in this case (gcc's boot2 is about 250 bytes smaller 
 than 
 clang's).

I'm going to take a look at the sequence of optimisations that are run with 
-Os.  It's currently mostly the same as -O2, which is probably not ideal.  I'll 
also see if I can create a .ll from boot2 that we can add to the LLVM unit 
tests so that anyone who pushes it over the size boundary will get a buildbot 
failure.

David___
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: r232926 - in head: include/xlocale lib/libc/locale

2012-03-13 Thread David Chisnall
Author: theraven
Date: Tue Mar 13 14:14:13 2012
New Revision: 232926
URL: http://svn.freebsd.org/changeset/base/232926

Log:
  More xlocale cleanups.
  
  Approved by:  dim (mentor)

Modified:
  head/include/xlocale/_ctype.h
  head/lib/libc/locale/Symbol.map

Modified: head/include/xlocale/_ctype.h
==
--- head/include/xlocale/_ctype.h   Tue Mar 13 14:10:33 2012
(r232925)
+++ head/include/xlocale/_ctype.h   Tue Mar 13 14:14:13 2012
(r232926)
@@ -68,19 +68,19 @@ _RuneLocale *__runes_for_locale(locale_t
 #endif /* _XLOCALE_INLINE */
 
 #ifdef _XLOCALE_WCTYPES
-static __inline int
-__maskrune_l(__ct_rune_t _c, unsigned long _f, locale_t locale)
+_XLOCALE_INLINE int
+__maskrune_l(__ct_rune_t __c, unsigned long __f, locale_t __loc)
 {
-   int mb_sb_limit;
-   _RuneLocale *runes = __runes_for_locale(locale, mb_sb_limit);
-   return (_c  0 || _c = _CACHED_RUNES) ? ___runetype_l(_c, locale) :
-  runes-__runetype[_c]  _f;
+   int __limit;
+   _RuneLocale *runes = __runes_for_locale(__loc, __limit);
+   return (__c  0 || __c = _CACHED_RUNES) ? ___runetype_l(__c, __loc) :
+  runes-__runetype[__c]  __f;
 }
 
-static __inline int
-__istype_l(__ct_rune_t _c, unsigned long _f, locale_t locale)
+_XLOCALE_INLINE __inline int
+__istype_l(__ct_rune_t __c, unsigned long __f, locale_t __loc)
 {
-   return (!!__maskrune_l(_c, _f, locale));
+   return (!!__maskrune_l(__c, __f, __loc));
 }
 
 #define XLOCALE_ISCTYPE(fname, cat) \
@@ -88,25 +88,25 @@ __istype_l(__ct_rune_t _c, unsigned long
_XLOCALE_INLINE int isw##fname##_l(int __c, locale_t __l)\
{ return __istype_l(__c, cat, __l); }
 #else
-static __inline int
-__sbmaskrune_l(__ct_rune_t _c, unsigned long _f, locale_t locale)
+_XLOCALE_INLINE int
+__sbmaskrune_l(__ct_rune_t __c, unsigned long __f, locale_t __loc)
 {
-   int mb_sb_limit;
-   _RuneLocale *runes = __runes_for_locale(locale, mb_sb_limit);
-   return (_c  0 || _c = mb_sb_limit) ? 0 :
-  runes-__runetype[_c]  _f;
+   int __limit;
+   _RuneLocale *runes = __runes_for_locale(__loc, __limit);
+   return (__c  0 || __c = __limit) ? 0 :
+  runes-__runetype[__c]  __f;
 }
 
-static __inline int
-__sbistype_l(__ct_rune_t _c, unsigned long _f, locale_t locale)
+_XLOCALE_INLINE int
+__sbistype_l(__ct_rune_t __c, unsigned long __f, locale_t __loc)
 {
-   return (!!__sbmaskrune_l(_c, _f, locale));
+   return (!!__sbmaskrune_l(__c, __f, __loc));
 }
 
-#define XLOCALE_ISCTYPE(fname, cat) \
-   _XLOCALE_INLINE int is##fname##_l(int c, locale_t l); \
-   _XLOCALE_INLINE int is##fname##_l(int c, locale_t l)\
-   { return __sbistype_l(c, cat, l); }
+#define XLOCALE_ISCTYPE(__fname, __cat) \
+   _XLOCALE_INLINE int is##__fname##_l(int, locale_t); \
+   _XLOCALE_INLINE int is##__fname##_l(int __c, locale_t __l)\
+   { return __sbistype_l(__c, __cat, __l); }
 #endif
 
 XLOCALE_ISCTYPE(alnum, _CTYPE_A|_CTYPE_D)
@@ -136,15 +136,15 @@ _XLOCALE_INLINE int towupper_l(int, loca
 
 _XLOCALE_INLINE int towlower_l(int __c, locale_t __l)
 {
-   int mb_sb_limit;
-   _RuneLocale *__runes = __runes_for_locale(__l, mb_sb_limit);
+   int __limit;
+   _RuneLocale *__runes = __runes_for_locale(__l, __limit);
return (__c  0 || __c = _CACHED_RUNES) ? ___tolower_l(__c, __l) :
   __runes-__maplower[__c];
 }
 _XLOCALE_INLINE int towupper_l(int __c, locale_t __l)
 {
-   int mb_sb_limit;
-   _RuneLocale *__runes = __runes_for_locale(__l, mb_sb_limit);
+   int __limit;
+   _RuneLocale *__runes = __runes_for_locale(__l, __limit);
return (__c  0 || __c = _CACHED_RUNES) ? ___toupper_l(__c, __l) :
   __runes-__mapupper[__c];
 }

Modified: head/lib/libc/locale/Symbol.map
==
--- head/lib/libc/locale/Symbol.map Tue Mar 13 14:10:33 2012
(r232925)
+++ head/lib/libc/locale/Symbol.map Tue Mar 13 14:14:13 2012
(r232926)
@@ -60,9 +60,13 @@ FBSD_1.0 {
nextwctype;
nl_langinfo;
__maskrune;
+   __maskrune_l;
__sbmaskrune;
+   __sbmaskrune_l;
__istype;
+   __istype_l;
__sbistype;
+   __sbistype_l;
__isctype;
__toupper;
__sbtoupper;
___
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: r232927 - head/include/xlocale

2012-03-13 Thread David Chisnall
Author: theraven
Date: Tue Mar 13 15:21:14 2012
New Revision: 232927
URL: http://svn.freebsd.org/changeset/base/232927

Log:
  Add missing prototypes.
  
  Approved by:  dim (mentor)

Modified:
  head/include/xlocale/_ctype.h

Modified: head/include/xlocale/_ctype.h
==
--- head/include/xlocale/_ctype.h   Tue Mar 13 14:14:13 2012
(r232926)
+++ head/include/xlocale/_ctype.h   Tue Mar 13 15:21:14 2012
(r232927)
@@ -89,6 +89,11 @@ __istype_l(__ct_rune_t __c, unsigned lon
{ return __istype_l(__c, cat, __l); }
 #else
 _XLOCALE_INLINE int
+__sbmaskrune_l(__ct_rune_t __c, unsigned long __f, locale_t __loc);
+_XLOCALE_INLINE int
+__sbistype_l(__ct_rune_t __c, unsigned long __f, locale_t __loc);
+
+_XLOCALE_INLINE int
 __sbmaskrune_l(__ct_rune_t __c, unsigned long __f, locale_t __loc)
 {
int __limit;
___
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: r232929 - head/include/xlocale

2012-03-13 Thread David Chisnall
Author: theraven
Date: Tue Mar 13 17:32:55 2012
New Revision: 232929
URL: http://svn.freebsd.org/changeset/base/232929

Log:
  Fix the other missing prototypes.
  
  Approved by:  dim (mentor)

Modified:
  head/include/xlocale/_ctype.h

Modified: head/include/xlocale/_ctype.h
==
--- head/include/xlocale/_ctype.h   Tue Mar 13 16:42:39 2012
(r232928)
+++ head/include/xlocale/_ctype.h   Tue Mar 13 17:32:55 2012
(r232929)
@@ -69,6 +69,11 @@ _RuneLocale  *__runes_for_locale(locale_t
 
 #ifdef _XLOCALE_WCTYPES
 _XLOCALE_INLINE int
+__maskrune_l(__ct_rune_t __c, unsigned long __f, locale_t __loc);
+_XLOCALE_INLINE __inline int
+__istype_l(__ct_rune_t __c, unsigned long __f, locale_t __loc);
+
+_XLOCALE_INLINE int
 __maskrune_l(__ct_rune_t __c, unsigned long __f, locale_t __loc)
 {
int __limit;
___
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: r232931 - head/include/xlocale

2012-03-13 Thread David Chisnall
Author: theraven
Date: Tue Mar 13 18:53:28 2012
New Revision: 232931
URL: http://svn.freebsd.org/changeset/base/232931

Log:
  And remove the duplicate inlines...
  
  Approved by:  dim (mentor)

Modified:
  head/include/xlocale/_ctype.h

Modified: head/include/xlocale/_ctype.h
==
--- head/include/xlocale/_ctype.h   Tue Mar 13 18:39:57 2012
(r232930)
+++ head/include/xlocale/_ctype.h   Tue Mar 13 18:53:28 2012
(r232931)
@@ -70,7 +70,7 @@ _RuneLocale   *__runes_for_locale(locale_t
 #ifdef _XLOCALE_WCTYPES
 _XLOCALE_INLINE int
 __maskrune_l(__ct_rune_t __c, unsigned long __f, locale_t __loc);
-_XLOCALE_INLINE __inline int
+_XLOCALE_INLINE int
 __istype_l(__ct_rune_t __c, unsigned long __f, locale_t __loc);
 
 _XLOCALE_INLINE int
@@ -82,7 +82,7 @@ __maskrune_l(__ct_rune_t __c, unsigned l
   runes-__runetype[__c]  __f;
 }
 
-_XLOCALE_INLINE __inline int
+_XLOCALE_INLINE int
 __istype_l(__ct_rune_t __c, unsigned long __f, locale_t __loc)
 {
return (!!__maskrune_l(__c, __f, __loc));
___
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: r232971 - head/include

2012-03-14 Thread David Chisnall
Author: theraven
Date: Wed Mar 14 14:39:07 2012
New Revision: 232971
URL: http://svn.freebsd.org/changeset/base/232971

Log:
  Expose some C11 stuff that is also C++11 stuff in C++11 mode.
  
  Approved by:  dim (mentor)

Modified:
  head/include/stdlib.h

Modified: head/include/stdlib.h
==
--- head/include/stdlib.h   Wed Mar 14 14:34:14 2012(r232970)
+++ head/include/stdlib.h   Wed Mar 14 14:39:07 2012(r232971)
@@ -151,7 +151,7 @@ _Noreturn void   _Exit(int);
 /*
  * If we're in a mode greater than C99, expose C11 functions.
  */
-#if __ISO_C_VISIBLE = 2011
+#if __ISO_C_VISIBLE = 2011 || __cplusplus = 201103L
 void * aligned_alloc(size_t, size_t);
 intat_quick_exit(void (*)(void));
 _Noreturn void
___
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: r232972 - in head/contrib/libc++: include src

2012-03-14 Thread David Chisnall
Author: theraven
Date: Wed Mar 14 14:40:22 2012
New Revision: 232972
URL: http://svn.freebsd.org/changeset/base/232972

Log:
  Import a slightly newer libc++, with some bugs fixed that were found by 
running
  the test suite on FreeBSD.
  
  Approved by:  dim (mentor)

Modified:
  head/contrib/libc++/include/__config
  head/contrib/libc++/include/cstdlib
  head/contrib/libc++/src/exception.cpp
  head/contrib/libc++/src/new.cpp
Directory Properties:
  head/contrib/libc++/   (props changed)

Modified: head/contrib/libc++/include/__config
==
--- head/contrib/libc++/include/__configWed Mar 14 14:39:07 2012
(r232971)
+++ head/contrib/libc++/include/__configWed Mar 14 14:40:22 2012
(r232972)
@@ -245,6 +245,10 @@ typedef __char32_t char32_t;
 #define _LIBCPP_HAS_NO_CONSTEXPR
 #endif
 
+#if __FreeBSD__
+#define _LIBCPP_HAS_QUICK_EXIT
+#endif
+
 #if (__has_feature(cxx_noexcept))
 #  define _NOEXCEPT noexcept
 #  define _NOEXCEPT_(x) noexcept(x)

Modified: head/contrib/libc++/include/cstdlib
==
--- head/contrib/libc++/include/cstdlib Wed Mar 14 14:39:07 2012
(r232971)
+++ head/contrib/libc++/include/cstdlib Wed Mar 14 14:40:22 2012
(r232972)
@@ -131,6 +131,10 @@ using ::mbtowc;
 using ::wctomb;
 using ::mbstowcs;
 using ::wcstombs;
+#ifdef _LIBCPP_HAS_QUICK_EXIT
+using ::at_quick_exit;
+using ::quick_exit;
+#endif
 
 // MSVC already has the correct prototype in stdlib.h.h #ifdef __cplusplus
 #if !defined(_MSC_VER)  !defined(__sun__)

Modified: head/contrib/libc++/src/exception.cpp
==
--- head/contrib/libc++/src/exception.cpp   Wed Mar 14 14:39:07 2012
(r232971)
+++ head/contrib/libc++/src/exception.cpp   Wed Mar 14 14:40:22 2012
(r232972)
@@ -114,13 +114,17 @@ exception::~exception() _NOEXCEPT
 {
 }
 
-bad_exception::~bad_exception() _NOEXCEPT
+const char* exception::what() const _NOEXCEPT
 {
+  return std::exception;
 }
 
-const char* exception::what() const _NOEXCEPT
+#endif  // _LIBCPPABI_VERSION
+#endif //LIBCXXRT
+#ifndef _LIBCPPABI_VERSION
+
+bad_exception::~bad_exception() _NOEXCEPT
 {
-  return std::exception;
 }
 
 const char* bad_exception::what() const _NOEXCEPT
@@ -128,8 +132,8 @@ const char* bad_exception::what() const 
   return std::bad_exception;
 }
 
-#endif  // _LIBCPPABI_VERSION
-#endif //LIBCXXRT
+#endif
+
 
 exception_ptr::~exception_ptr() _NOEXCEPT
 {

Modified: head/contrib/libc++/src/new.cpp
==
--- head/contrib/libc++/src/new.cpp Wed Mar 14 14:39:07 2012
(r232971)
+++ head/contrib/libc++/src/new.cpp Wed Mar 14 14:40:22 2012
(r232972)
@@ -24,8 +24,6 @@
 static std::new_handler __new_handler;
 #endif
 
-#if !defined (LIBCXXRT) //  !defined(_LIBCPPABI_VERSION)
-
 // Implement all new and delete operators as weak definitions
 // in this shared library, so that they can be overriden by programs
 // that define non-weak copies of the functions.
@@ -134,8 +132,6 @@ operator delete[] (void* ptr, const std:
 ::operator delete[](ptr);
 }
 
-#endif  // !_LIBCPPABI_VERSION  !LIBCXXRT
-
 namespace std
 {
 
@@ -171,6 +167,8 @@ bad_alloc::what() const _NOEXCEPT
 return std::bad_alloc;
 }
 
+#endif //LIBCXXRT
+
 bad_array_new_length::bad_array_new_length() _NOEXCEPT
 {
 }
@@ -186,7 +184,6 @@ bad_array_new_length::what() const _NOEX
 }
 
 #endif
-#endif //LIBCXXRT
 
 void
 __throw_bad_alloc()
___
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: r233173 - head/lib/libc/locale

2012-03-19 Thread David Chisnall
Author: theraven
Date: Mon Mar 19 11:47:37 2012
New Revision: 233173
URL: http://svn.freebsd.org/changeset/base/233173

Log:
  Make __get_locale() static inline, not just inline, so when compiling libc in
  debug mode (without optimisations) it doesn't generate a linker failure.
  
  Approved by:  dim (mentor)

Modified:
  head/lib/libc/locale/xlocale_private.h

Modified: head/lib/libc/locale/xlocale_private.h
==
--- head/lib/libc/locale/xlocale_private.h  Mon Mar 19 11:32:42 2012
(r233172)
+++ head/lib/libc/locale/xlocale_private.h  Mon Mar 19 11:47:37 2012
(r233173)
@@ -191,7 +191,7 @@ extern _Thread_local locale_t __thread_l
  * this call is not guaranteed to remain valid after the locale changes.  As
  * such, this should only be called within libc functions.
  */
-inline locale_t __get_locale(void)
+static inline locale_t __get_locale(void)
 {
 
if (!__has_thread_locale) {
___
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: r233174 - head/lib/libcxxrt

2012-03-19 Thread David Chisnall
Author: theraven
Date: Mon Mar 19 11:53:33 2012
New Revision: 233174
URL: http://svn.freebsd.org/changeset/base/233174

Log:
  Add symbol versioning to libcxxrt.
  
  Approved by:  dim (mentor)

Added:
  head/lib/libcxxrt/Version.map   (contents, props changed)
Modified:
  head/lib/libcxxrt/Makefile

Modified: head/lib/libcxxrt/Makefile
==
--- head/lib/libcxxrt/Makefile  Mon Mar 19 11:47:37 2012(r233173)
+++ head/lib/libcxxrt/Makefile  Mon Mar 19 11:53:33 2012(r233174)
@@ -21,5 +21,6 @@ SRCS+=libelftc_dem_gnu3.c\
 
 WARNS=0
 CFLAGS+=  -I${SRCDIR}
+VERSION_MAP=  ${.CURDIR}/Version.map
 
 .include bsd.lib.mk

Added: head/lib/libcxxrt/Version.map
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/libcxxrt/Version.map   Mon Mar 19 11:53:33 2012
(r233174)
@@ -0,0 +1,318 @@
+# $FreeBSD$
+# Define the same version as the libsupc++ from gcc 4.2.1 so that we can use
+# libcxxrt as a drop-in replacement.
+
+CXXABI_1.3 {
+
+  global:
+
+# ABI functions with C linkage
+__cxa_allocate_exception;
+__cxa_bad_cast;
+__cxa_bad_typeid;
+__cxa_begin_catch;
+__cxa_begin_cleanup;
+__cxa_call_unexpected;
+__cxa_current_exception_type;
+__cxa_demangle;
+__cxa_end_catch;
+__cxa_end_cleanup;
+__cxa_free_exception;
+__cxa_get_globals;
+__cxa_get_globals_fast;
+__cxa_guard_abort;
+__cxa_guard_acquire;
+__cxa_guard_release;
+__cxa_pure_virtual;
+__cxa_rethrow;
+__cxa_throw;
+__cxa_type_match;
+__cxa_vec_cctor;
+__cxa_vec_cleanup;
+__cxa_vec_ctor;
+__cxa_vec_delete2;
+__cxa_vec_delete3;
+__cxa_vec_delete;
+__cxa_vec_dtor;
+__cxa_vec_new2;
+__cxa_vec_new3;
+__cxa_vec_new;
+__dynamic_cast;
+__gxx_personality_sj0;
+__gxx_personality_v0;
+
+extern C++ {
+# Type info classes and their destructors
+__cxxabiv1::__array_type_info;
+__cxxabiv1::__array_type_info::~__array_type_info();
+__cxxabiv1::__class_type_info;
+__cxxabiv1::__class_type_info::~__class_type_info();
+__cxxabiv1::__enum_type_info;
+__cxxabiv1::__enum_type_info::~__enum_type_info();
+__cxxabiv1::__function_type_info::;
+__cxxabiv1::__function_type_info::~__function_type_info();
+__cxxabiv1::__fundamental_type_info;
+__cxxabiv1::__fundamental_type_info::~__fundamental_type_info();
+__cxxabiv1::__pbase_type_info;
+__cxxabiv1::__pbase_type_info::~__pbase_type_info();
+__cxxabiv1::__pointer_to_member_type_info;
+
__cxxabiv1::__pointer_to_member_type_info::~__pointer_to_member_type_info();
+__cxxabiv1::__pointer_type_info;
+__cxxabiv1::__pointer_type_info::~__pointer_type_info();
+__cxxabiv1::__si_class_type_info;
+__cxxabiv1::__si_class_type_info::~__si_class_type_info();
+__cxxabiv1::__vmi_class_type_info;
+__cxxabiv1::__vmi_class_type_info::~__vmi_class_type_info();
+
+# vtables typeinfo classes.
+vtable for __cxxabiv1::__array_type_info;
+vtable for __cxxabiv1::__class_type_info;
+vtable for __cxxabiv1::__enum_type_info;
+vtable for __cxxabiv1::__function_type_info;
+vtable for __cxxabiv1::__fundamental_type_info;
+vtable for __cxxabiv1::__pbase_type_info;
+vtable for __cxxabiv1::__pointer_to_member_type_info;
+vtable for __cxxabiv1::__pointer_type_info;
+vtable for __cxxabiv1::__si_class_type_info;
+vtable for __cxxabiv1::__vmi_class_type_info;
+
+# Type info for built-in types
+typeinfo for bool const*;
+typeinfo for bool;
+typeinfo for char const*;
+typeinfo for char;
+typeinfo for double const*;
+typeinfo for double;
+typeinfo for float const*;
+typeinfo for float;
+typeinfo for int const*;
+typeinfo for int;
+typeinfo for long const*;
+typeinfo for long double const*;
+typeinfo for long double;
+typeinfo for long long const*;
+typeinfo for long long;
+typeinfo for long;
+typeinfo for short const*;
+typeinfo for short;
+typeinfo for signed char const*;
+typeinfo for signed char;
+typeinfo for unsigned char const*;
+typeinfo for unsigned char;
+typeinfo for unsigned int const*;
+typeinfo for unsigned int;
+typeinfo for unsigned long const*;
+typeinfo for unsigned long long const*;
+typeinfo for unsigned long long;
+typeinfo for unsigned long;
+typeinfo for unsigned short const*;
+typeinfo for unsigned short;
+typeinfo for void const*;
+typeinfo for void;
+typeinfo for wchar_t const*;
+

Re: svn commit: r250245 - head/lib/libc/locale

2013-05-05 Thread David Chisnall
On 5 May 2013, at 19:31, Andrey Chernov a...@freebsd.org wrote:

 It is better to fix this function return type to match POSIX standard
 rather than to document its non-standard behavior. We try to follow
 POSIX when possible and this is the case.

We follow Darwin in this case, which returns 0 on success or -1 on error.  
'Fixing' this will break code written for Darwin and testing the return value.  
Not fixing it will not break POSIX code that ignores the (unexpected) return 
value.

David

___
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: r250430 - head/sbin/dmesg

2013-05-10 Thread David Chisnall
On 10 May 2013, at 10:01, Eitan Adler ead...@freebsd.org wrote:

 I thought style(9) disliked the leading (void) but I could be wrong.

The cast to (void) tells the compiler that you are ignoring the return result.  
Without it, you will introduce new warnings and break the build on certain 
compiler versions with -Werror.

David

___
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: r250430 - head/sbin/dmesg

2013-05-10 Thread David Chisnall
On 10 May 2013, at 10:12, Eitan Adler ead...@freebsd.org wrote:

   I don't remember any recent tool which uses that cast
 to remove errors.

clang -Wunused-result
gcc -Wunused-result

David

___
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: r250986 - head/sys/dev/usb

2013-05-26 Thread David Chisnall
On 26 May 2013, at 03:45, Bruce Evans b...@optusnet.com.au wrote:

 Hmm, it would be useful to have a compiler flag for initializing all
 local variables to trap representations on entry to functions. 

The clang memory sanitizer does this.

David

___
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: r251820 - head/gnu/lib/libsupc++

2013-06-16 Thread David Chisnall
Author: theraven
Date: Sun Jun 16 21:15:35 2013
New Revision: 251820
URL: http://svnweb.freebsd.org/changeset/base/251820

Log:
  Fix some missing symbols in the libsupc++ Version.map
  
  MFC after:1 week

Modified:
  head/gnu/lib/libsupc++/Version.map

Modified: head/gnu/lib/libsupc++/Version.map
==
--- head/gnu/lib/libsupc++/Version.map  Sun Jun 16 20:51:44 2013
(r251819)
+++ head/gnu/lib/libsupc++/Version.map  Sun Jun 16 21:15:35 2013
(r251820)
@@ -147,6 +147,13 @@ GLIBCXX_3.4 {
   std::set_terminate*;
   std::set_unexpected*;
 
+  std::unexpected();
+  std::get_terminate();
+  std::get_unexpected();
+  std::uncaught_exception();
+  std::terminate();
+
+
   std::bad_alloc;
   std::bad_cast;
   std::exception*;
@@ -154,14 +161,20 @@ GLIBCXX_3.4 {
   typeinfo for std::bad_alloc;
   typeinfo for std::bad_cast;
   typeinfo for std::exception;
+  typeinfo for std::type_info;
 
   typeinfo name for std::bad_alloc;
   typeinfo name for std::bad_cast;
   typeinfo name for std::exception;
+  typeinfo name for std::type_info;
 
   vtable for std::bad_alloc;
   vtable for std::bad_cast;
   vtable for std::exception;
+  vtable for std::type_info;
+
+  std::type_info::__*;
+  std::type_info::~type_info();
 };
 };
 
___
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: r251856 - head/usr.bin/dtc

2013-06-17 Thread David Chisnall
Author: theraven
Date: Mon Jun 17 15:34:22 2013
New Revision: 251856
URL: http://svnweb.freebsd.org/changeset/base/251856

Log:
  Add a checker to dtc, based on a feature request from rwatson / brooks.
  This checks that every node that has children specifies their register sizes.
  This is not enabled by default, as the default sizes are sometimes required
  (including by some DTS in the tree), but can help when writing new device
  trees so that you can check that you actually meant the defaults.

Modified:
  head/usr.bin/dtc/checking.cc
  head/usr.bin/dtc/dtc.1

Modified: head/usr.bin/dtc/checking.cc
==
--- head/usr.bin/dtc/checking.ccMon Jun 17 15:30:47 2013
(r251855)
+++ head/usr.bin/dtc/checking.ccMon Jun 17 15:34:22 2013
(r251856)
@@ -33,6 +33,8 @@
 #include checking.hh
 #include stdio.h
 
+
+
 namespace dtc
 {
 namespace fdt
@@ -40,6 +42,54 @@ namespace fdt
 namespace checking
 {
 
+namespace
+{
+   /**
+* Checker that verifies that every node that has children has
+* #address-cells and #size-cells properties.
+*/
+   struct address_cells_checker : public checker
+   {
+   address_cells_checker(const char *name) : checker(name) {}
+   virtual bool check_node(device_tree *tree, node *n)
+   {
+   // If this has no children, it trivially meets the
+   // conditions.
+   if (n-child_begin() == n-child_end())
+   {
+   return true;
+   }
+   bool found_address = false;
+   bool found_size = false;
+   for (node::property_iterator i=n-property_begin(),
+e=n-property_end() ; i!=e ; ++i)
+   {
+   if (!found_address)
+   {
+   found_address = ((*i)-get_key() == 
#address-cells);
+   }
+   if (!found_size)
+   {
+   found_size = ((*i)-get_key() == 
#size-cells);
+   }
+   if (found_size  found_address)
+   {
+   break;
+   }
+   }
+   if (!found_address)
+   {
+   report_error(Missing #address-cells 
property);
+   }
+   if (!found_size)
+   {
+   report_error(Missing #size-cells 
property);
+   }
+   return found_address  found_size;
+   }
+   };
+} // anonymous namespace
+
 bool
 checker::visit_node(device_tree *tree, node *n)
 {
@@ -157,6 +207,8 @@ check_manager::check_manager()
add_property_type_checkerproperty_value::STRING(
type-model, string(model));
add_property_size_checker(type-phandle, string(phandle), 4);
+   disabled_checkers.insert(std::make_pair(string(cells-attributes),
+   new address_cells_checker(cells-attributes)));
 }
 
 bool

Modified: head/usr.bin/dtc/dtc.1
==
--- head/usr.bin/dtc/dtc.1  Mon Jun 17 15:30:47 2013(r251855)
+++ head/usr.bin/dtc/dtc.1  Mon Jun 17 15:34:22 2013(r251856)
@@ -214,6 +214,12 @@ property.
 Checks the type of the
 .Va compatible
 property.
+.It cells-attributes
+Checks that all nodes with children have both
+.Va #address-cells
+and
+.Va #size-cells
+properties.
 .El
 .Sh EXAMPLES
 The command:
___
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: r251934 - head/usr.bin/dtc

2013-06-18 Thread David Chisnall
Author: theraven
Date: Tue Jun 18 10:26:22 2013
New Revision: 251934
URL: http://svnweb.freebsd.org/changeset/base/251934

Log:
  Fix bug in destructor for checker manager in DTC that caused segfaults on
  exit.

Modified:
  head/usr.bin/dtc/checking.cc

Modified: head/usr.bin/dtc/checking.cc
==
--- head/usr.bin/dtc/checking.ccTue Jun 18 09:54:09 2013
(r251933)
+++ head/usr.bin/dtc/checking.ccTue Jun 18 10:26:22 2013
(r251934)
@@ -195,6 +195,7 @@ check_manager::~check_manager()
while (disabled_checkers.begin() != disabled_checkers.end())
{
delete disabled_checkers.begin()-second;
+   disabled_checkers.erase(disabled_checkers.begin());
}
 }
 
___
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: r251886 - in head: contrib/apr contrib/apr-util contrib/serf contrib/sqlite3 contrib/subversion share/mk usr.bin usr.bin/svn usr.bin/svn/lib usr.bin/svn/lib/libapr usr.bin/svn/lib/liba

2013-06-19 Thread David Chisnall
On 19 Jun 2013, at 16:13, John Baldwin j...@freebsd.org wrote:

 portsnap does not work for src.  (I thought we had already covered that
 in earlier threads?)  portsnap only moves forward.  It is a very important
 feature for our users that whatever tool they use for source updating be
 bidirectional.  In particular it is very common practice to use a bisect
 operation to isolate changes responsible for regressions.

Freebsd-update can manage the src tree.  I'm not entirely clear on what 
use-case we are addressing here.  Is it:

- FreeBSD developers, who are probably okay with installing a port, but would 
prefer a version that didn't depend on kitchen/sink?

- Users, who wish to be able to update the source tree and then either build 
world, or build some optional parts that are not part of the default install?

- Some other category of svn consumer?

I think having a definitive statement as to the intention of svnlite would help 
frame the discussion in a more productive format.

David

___
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: r251886 - in head: contrib/apr contrib/apr-util contrib/serf contrib/sqlite3 contrib/subversion share/mk usr.bin usr.bin/svn usr.bin/svn/lib usr.bin/svn/lib/libapr usr.bin/svn/lib/liba

2013-06-20 Thread David Chisnall
On 20 Jun 2013, at 00:10, Warner Losh i...@bsdimp.com wrote:

 - FreeBSD developers, who are probably okay with installing a port, but 
 would prefer a version that didn't depend on kitchen/sink?
 
 - Users, who wish to be able to update the source tree and then either build 
 world, or build some optional parts that are not part of the default install?
 
 - Some other category of svn consumer?
 
 I think having a definitive statement as to the intention of svnlite would 
 help frame the discussion in a more productive format.
 
 How do I roll back to last week with FreeBSD-update?

Which of the classes of user that I outlined do you think wants to be able to 
do that?  As a FreeBSD user, I never felt the desire to do that, but maybe I 
was unusual.  As a FreeBSD developer, I don't mind installing the svn port to 
be able to do it (although I'd prefer a more lightweight port).  I would expect 
the same to apply to the sort of engaged user who is willing to bisect to track 
down a bug.  

David



signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: svn commit: r251886 - in head: contrib/apr contrib/apr-util contrib/serf contrib/sqlite3 contrib/subversion share/mk usr.bin usr.bin/svn usr.bin/svn/lib usr.bin/svn/lib/libapr usr.bin/svn/lib/liba

2013-06-20 Thread David Chisnall
On 20 Jun 2013, at 14:09, Julian Elischer jul...@freebsd.org wrote:

 Which of the classes of user that I outlined do you think wants to be able 
 to do that?  As a FreeBSD user, I never felt the desire to do that, but 
 maybe I was unusual. As a FreeBSD developer, I don't mind installing the svn 
 port to be able to do it (although I'd prefer a more lightweight port).  I 
 would expect the same to apply to the sort of engaged user who is willing to 
 bisect to track down a bug.
 bug reporter:   I have this new bug...
 developer:Can you try rolling back to xyzzy
 bug reporter:  Yeah that fixes it..
 developer:   Ok.. patch will follow

And do you think that the sort of user who is sufficiently engaged with the 
project to do this is the sort of user who would not be willing to do so if it 
meant installing the subversion port?  If so, then there is a clear case for 
svnlite.  

David



signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: svn commit: r251886 - in head: contrib/apr contrib/apr-util contrib/serf contrib/sqlite3 contrib/subversion share/mk usr.bin usr.bin/svn usr.bin/svn/lib usr.bin/svn/lib/libapr usr.bin/svn/lib/liba

2013-06-20 Thread David Chisnall
On 20 Jun 2013, at 20:34, Warner Losh i...@bsdimp.com wrote:

 People trying new versions of FreeBSD. Some of them install the release, 
 others might install a snapshot, some will do an install world. But if it 
 worked in release 9.3 and broke in 9.4, then to find where they would need to 
 install an svn port to get all the points in between.
 
 Not having to install a port, possibly a port that got messed up by the world 
 you just build, is a big win for me in my mind. Users often have commented to 
 me that running FreeBSD gets harder and harder with more hoops to jump 
 through to do things that used to be easy. Installing svn is one more hoop. 
 It, by itself isn't a huge hoop, but if we can avoid that hoop we should.
 
 I do mind installing a port to do this. We've kicked too much out of the tree 
 in the name of anti-bloat, and frankly I'm glad to see this.

This rationale makes sense to me.

 I think insisting on a definitive statement on svn lite's mission statement 
 is a way to obstruct progress. Sometimes you just need to things because they 
 feel right, not because they have been through a 20-step approval process...

When we add something to base, it should always be for a reason with a defined 
use-case that can't be (easily) solved by existing means.  I think we have that 
rationale now, and I'm happy.  A long discussion could have been circumvented 
by providing it up-front.

David



signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: svn commit: r261283 - in head: contrib/libc++ contrib/libc++/include contrib/libc++/include/experimental contrib/libc++/include/ext contrib/libc++/src etc/mtree lib/libc++ sys/sys tools/build/mk

2014-02-03 Thread David Chisnall
On 3 Feb 2014, at 18:32, Alexander Kabaev kab...@gmail.com wrote:

 More than likely. It does appear libc++ does not go through same pains
 to maintain ABI stable as libstdc++ does. The lack of all and any
 symbol versions in shared library binary strongly suggests that not
 only they do not bother with ABI stability, they simply can't enforce
 it at the moment even if they wanted to.

libc++ aims to provide a stable ABI, however it does so in a manner that is 
intended to integrate with the source language, rather than by applying linker 
hacks post facto (which is very hard to do write with C++).  Every std:: class 
in libc++ is implemented inside a version namespace inside std, and then 
imported into std:: in the header.  ABI-breaking classes should be inside a new 
version namespace.

If you have examples where the ABI was not accidentally changed, then please 
report them as bugs and we will try to fix them.  If you just have unfounded 
supposition, then it is not helpful to the discussion.

David

___
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: r261283 - in head: contrib/libc++ contrib/libc++/include contrib/libc++/include/experimental contrib/libc++/include/ext contrib/libc++/src etc/mtree lib/libc++ sys/sys tools/build/mk

2014-02-04 Thread David Chisnall
On 3 Feb 2014, at 22:00, Alexander Kabaev kab...@gmail.com wrote:

 At the very least, new library did remove
 _ZNKSt3__111__libcpp_db12__comparableEPKvS2_ which was public before.

This symbol is part of the debugging infrastructure and is used when you build 
your code with aggressive debug checks by defining _LIBCPP_DEBUG2 when you 
build your code.  It is not intended for deployment builds and so is not part 
of the stable API.  You can only access it by explicitly enabling debug builds.

 Your definition of ABI stability might be different from mine, but in
 my book that counts as a backward compatibility breakage. And even if
 that symbol was not supposed to be lined to by anyone, it should not
 have been exported in the first place.

It sounds like you're just looking at the output from nm, without bothering to 
check how the symbols are used.  

David

___
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: r261801 - head/contrib/libc++/include

2014-02-12 Thread David Chisnall
On 12 Feb 2014, at 18:42, Jung-uk Kim j...@freebsd.org wrote:

 It seems Apple removed it later.
 
 http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20131125/094181.html
 
 Do you know what they did?

They decided to break ABI compatibility with the version of XCode that ships 
with the bug.  This is probably not an option for us, although we might 
consider it for FreeBSD 11 with a library version bump (it would still be a lot 
of pain, as you wouldn't be able to mix C++ libraries), but probably not unless 
we see bug reports related to our slight standards non-compliance (std::pair 
having an explicit constructor) causing real problems.

David

___
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: r261801 - head/contrib/libc++/include

2014-02-13 Thread David Chisnall
On 13 Feb 2014, at 01:04, Alexander Kabaev kab...@gmail.com wrote:

 The refusal to use tools that are there precisely to help to help with
 the binary compatibility in favor of mindless library bumps is just sad.

Perhaps you could share with the class.  What is the correct way of solving 
this problem?  

For those just joining the discussion, the issue is that std::pair was 
originally declared with an explicit constructor and should have an implicit 
constructor, which has a different calling convention.  This means that we 
can't share the two std::pair implementations across libraries, because they 
will try to call the constructor with the wrong arguments.  Because of 
templates and C++ name mangling, this ends up being propagated into most 
libraries that link against libc++, and calling from one with the old 
definition to one with the new definition end up causing segfaults (if we're 
lucky - I think the symptom that we're seeing is actually dereferencing a junk 
value in a register, so it may cause random memory writes, but I'd have to 
check the ABI).  

Given that neither redeclaring the new std::pair in a new namespace, nor 
exporting both constructor symbols using symbol versioning (the two approaches 
that we've already discussed) will work, what are the tools that apparently 
we're refusing to use that will work?

David

___
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: r261916 - head/sys/dev/xen/console

2014-02-15 Thread David Chisnall
On 15 Feb 2014, at 17:02, Bruce Evans b...@optusnet.com.au wrote:

 Why?  There are hundreds if not thousands of static inline functions in
 headers, and most of these functions are not always used, so there would
 be [hundreds if not thousands] * [number of #includes] compiler warnings
 if compilers warned about things like this.  They could handle include
 files specially, but shouldn't.

They do, and absolutely should, handle include files separately.  If you have a 
static inline function in a header that is not used in a specific compilation 
unit, then that is a little bit of extra work for the compiler as it has to 
parse it without it being used, but it is not a problem.  It is a safe 
assumption that it is used by at least one compilation unit and so is not dead 
code (and even if it isn't yet, it is part of an API, and so removing it would 
be an error).

In contrast, a static inline function in the main source file for a compilation 
unit is definitely a bug.  It is obviously dead code.  It is likely that it 
either should have been removed when all callers were deleted, or should not 
have been static but accidentally was.  

David

___
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: r261916 - head/sys/dev/xen/console

2014-02-16 Thread David Chisnall
On 16 Feb 2014, at 04:09, Bruce Evans b...@optusnet.com.au wrote:

 [a long list of corner cases where the warning may not be correct]

Fortunately, the goal of compiler warnings is not to address every possible 
case, but rather to minimise false positives while still giving useful results. 
 The warning can be turned off if you are using the C preprocessor in a way 
designed to provide cautionary tales to young programmers, but for everyone 
else it makes sense to have it on by default.

Anyone using a single file as both the main file for a compilation unit and as 
an included file in others, deserves to have a new antipattern named after them 
so that their name can live in infamy, but should not in any way be allowed to 
influence the design of compiler warnings.

David

___
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: r262394 - head/usr.bin/dtc

2014-02-23 Thread David Chisnall
Author: theraven
Date: Sun Feb 23 21:13:07 2014
New Revision: 262394
URL: http://svnweb.freebsd.org/changeset/base/262394

Log:
  Fix parsing multiple roots with whitespace between them.
  
  Patch by:   Patrick Wildt

Modified:
  head/usr.bin/dtc/fdt.cc

Modified: head/usr.bin/dtc/fdt.cc
==
--- head/usr.bin/dtc/fdt.cc Sun Feb 23 21:13:04 2014(r262393)
+++ head/usr.bin/dtc/fdt.cc Sun Feb 23 21:13:07 2014(r262394)
@@ -1059,6 +1059,7 @@ device_tree::parse_roots(input_buffer i
{
valid = false;
}
+   input.next_token();
}
 }
 
___
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: r262282 - in head: contrib/dma contrib/dma/debian contrib/dma/debian/migrate contrib/dma/debian/source contrib/dma/test etc/mtree libexec libexec/dma share/mk tools/build/mk tools/buil

2014-02-25 Thread David Chisnall
On 25 Feb 2014, at 07:52, Baptiste Daroussin b...@freebsd.org wrote:

 On Tue, Feb 25, 2014 at 05:22:22PM +1100, Peter Jeremy wrote:
 On 2014-Feb-22 13:14:38 +0100, Baptiste Daroussin b...@freebsd.org wrote:
 On Sat, Feb 22, 2014 at 07:23:50PM +1100, Peter Jeremy wrote:
 I'd also query the reason for including Debian-specific code in the
 FreeBSD base.
 
 Where have you seen debian specific code?
 
 /usr/src/contrib/dma/debian - as far as I can tell, this directory is
 Debion specific.  I thought we stripped out irrelevant code from third
 party imports but looking wider, there is similarly irrelevant code in
 a variety of other contrib imports.  I'll withdraw that objection.
 
 -- 
 Peter Jeremy
 
 Have you already looked at how contrib works? who cares FYI you can also find
 some win32 specific code in there, debian packaging code, rpm spec files etc.

For the libc++ imports, we strip out the support directory, which contains 
Solaris and Win32-specific stuff.  If we end up with a support/freebsd, then 
we'll bring that in, but not support/solaris and support/win32.  That stuff is 
in the vendor branch, but it just seems polite not to make people who check out 
head get files that are never used when building FreeBSD in any configuration.

David

___
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


  1   2   3   >