public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
From: Gary Hade <garyhade@us.ibm.com>
To: linux-ia64@vger.kernel.org
Subject: [Linux-ia64] C++ doesn't like asm/atomic.h
Date: Fri, 05 Apr 2002 21:40:34 +0000	[thread overview]
Message-ID: <marc-linux-ia64-105590701905396@msgid-missing> (raw)

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;
 }
 
 /*


             reply	other threads:[~2002-04-05 21:40 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-05 21:40 Gary Hade [this message]
2002-04-05 21:54 ` [Linux-ia64] C++ doesn't like asm/atomic.h 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=marc-linux-ia64-105590701905396@msgid-missing \
    --to=garyhade@us.ibm.com \
    --cc=linux-ia64@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox