public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
* [Linux-ia64] C++ doesn't like asm/atomic.h
@ 2002-04-05 21:40 Gary Hade
  2002-04-05 21:54 ` David Mosberger
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: Gary Hade @ 2002-04-05 21:40 UTC (permalink / raw)
  To: linux-ia64

asm/atomic.h is not palatable to C++ due to it's use 
of the C++ keyword "new".

Script started on Fri Apr  5 12:03:38 2002
elm3a87.eng:/home/garyh cat x.C
#include <asm/atomic.h>
elm3a87.eng:/home/garyh c++ -c x.C
In file included from x.C:1:
/usr/include/asm/atomic.h: In function `int ia64_atomic_add (int,
atomic_t *)':
/usr/include/asm/atomic.h:33: parse error before `new'
/usr/include/asm/atomic.h:39: parse error before `='
/usr/include/asm/atomic.h:41: parse error before `;'
/usr/include/asm/atomic.h: In function `int ia64_atomic_sub (int,
atomic_t *)':
/usr/include/asm/atomic.h:47: parse error before `new'
/usr/include/asm/atomic.h:53: parse error before `='
/usr/include/asm/atomic.h:54: parse error before `)'
/usr/include/asm/atomic.h:54: `_n_' undeclared (first use this
function)
/usr/include/asm/atomic.h:54: (Each undeclared identifier is reported
only once for each function it appears in.)
/usr/include/asm/atomic.h:55: parse error before `;'
elm3a87.eng:/home/garyh exit
exit

Script done on Fri Apr	5 12:03:55 2002

Patch for 2.4.18 included below.

Gary

-- 
Gary Hade
IBM Linux Technology Center
503-578-4503  IBM T/L: 775-4503
garyhade@us.ibm.com
http://www.ibm.com/linux/ltc


--- linux/include/asm-ia64/atomic.h.orig	Fri Apr  5 11:56:12 2002
+++ linux/include/asm-ia64/atomic.h	Fri Apr  5 11:55:21 2002
@@ -30,29 +30,29 @@
 static __inline__ int
 ia64_atomic_add (int i, atomic_t *v)
 {
-	__s32 old, new;
+	__s32 old_val, new_val;
 	CMPXCHG_BUGCHECK_DECL
 
 	do {
 		CMPXCHG_BUGCHECK(v);
-		old = atomic_read(v);
-		new = old + i;
-	} while (ia64_cmpxchg("acq", v, old, old + i, sizeof(atomic_t)) != old);
-	return new;
+		old_val = atomic_read(v);
+		new_val = old_val + i;
+	} while (ia64_cmpxchg("acq", v, old_val, old_val + i, sizeof(atomic_t)) != old_val);
+	return new_val;
 }
 
 static __inline__ int
 ia64_atomic_sub (int i, atomic_t *v)
 {
-	__s32 old, new;
+	__s32 old_val, new_val;
 	CMPXCHG_BUGCHECK_DECL
 
 	do {
 		CMPXCHG_BUGCHECK(v);
-		old = atomic_read(v);
-		new = old - i;
-	} while (ia64_cmpxchg("acq", v, old, new, sizeof(atomic_t)) != old);
-	return new;
+		old_val = atomic_read(v);
+		new_val = old_val - i;
+	} while (ia64_cmpxchg("acq", v, old_val, new_val, sizeof(atomic_t)) != old_val);
+	return new_val;
 }
 
 /*


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2002-04-08 23:27 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-04-05 21:40 [Linux-ia64] C++ doesn't like asm/atomic.h Gary Hade
2002-04-05 21:54 ` David Mosberger
2002-04-08 16:00 ` Gary Hade
2002-04-08 17:26 ` David Mosberger
2002-04-08 17:51 ` Ulrich Drepper
2002-04-08 19:00 ` David Mosberger
2002-04-08 19:23 ` Ulrich Drepper
2002-04-08 19:33 ` Gary Hade
2002-04-08 20:13 ` David Mosberger
2002-04-08 20:23 ` Ulrich Drepper
2002-04-08 20:40 ` David Mosberger
2002-04-08 22:59 ` Keith Owens
2002-04-08 23:27 ` Gary Hade

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox