DragonFly bugs List (threaded) for 2006-09
[
Date Prev][Date Next]
[
Thread Prev][Thread Next]
[
Date Index][
Thread Index]
/usr/include/machine/atomic.h is not C++ safe
Header file /usr/include/machine/atomic.h
(src/sys/i386/include/atomic.h in the source tree) is not C++ safe,
because it contains a variable named "new" which is a C++ keyword.
This file is indirectly included by header files like
<netinet/if_ether.h> therefore such files cannot be used by a C++
program.
The simple patch included below shows the location of the
problematic variable.
Thanks,
Pavlin
P.S. I am not on the mailing list, hence please CC me in your
replies.
--- atomic.h.org 2006-07-23 09:02:04.000000000 -0700
+++ atomic.h 2006-09-30 12:34:02.000000000 -0700
@@ -346,7 +346,7 @@
/*
* Atomic compare and set
*
- * if (*dst == old) *dst = new (all 32 bit words)
+ * if (*dst == old) *dst = src (all 32 bit words)
*
* Returns 0 on failure, non-zero on success
*
@@ -355,10 +355,10 @@
* version may be used by the dynamic linker
*/
#if defined(KLD_MODULE)
-extern int atomic_cmpset_int(volatile u_int *dst, u_int old, u_int new);
+extern int atomic_cmpset_int(volatile u_int *dst, u_int old, u_int src);
#else
static __inline int
-atomic_cmpset_int(volatile u_int *dst, u_int old, u_int new)
+atomic_cmpset_int(volatile u_int *dst, u_int old, u_int src)
{
int res = old;
@@ -366,7 +366,7 @@
"setz %%al; " \
"movzbl %%al,%0; " \
: "+a" (res), "=m" (*dst) \
- : "r" (new), "m" (*dst) \
+ : "r" (src), "m" (*dst) \
: "memory");
return res;
}
[
Date Prev][Date Next]
[
Thread Prev][Thread Next]
[
Date Index][
Thread Index]