* 2.2.18 asm-alpha/system.h has a problem
@ 2000-12-17 23:34 Daiki Matsuda
2000-12-18 9:31 ` Peter Samuelson
0 siblings, 1 reply; 10+ messages in thread
From: Daiki Matsuda @ 2000-12-17 23:34 UTC (permalink / raw)
To: linux-kernel
[-- Attachment #1: Type: Text/Plain, Size: 288 bytes --]
Hi, all.
I encounterd the problem that 'cdrdao' is not compilable in 2.2.18 on
Alpha. And I researched a little.
So, then new code added in include/asm-alpha/system.h on 2.2.18 has a
problem in C++. The 'new' may be the reserved word in C++. And I send
its patch.
Regards
Daiki Matsuda
[-- Attachment #2: asm-alpha.system.h.patch --]
[-- Type: Text/Plain, Size: 1625 bytes --]
--- linux/include/asm-alpha/system.h.old Sun Dec 17 17:53:28 2000
+++ linux/include/asm-alpha/system.h Sun Dec 17 17:54:51 2000
@@ -390,7 +390,7 @@
#define __HAVE_ARCH_CMPXCHG 1
extern __inline__ unsigned long
-__cmpxchg_u32(volatile int *m, int old, int new)
+__cmpxchg_u32(volatile int *m, int old_val, int new_val)
{
unsigned long prev, cmp;
@@ -409,13 +409,13 @@
"3: br 1b\n"
".previous"
: "=&r"(prev), "=&r"(cmp), "=m"(*m)
- : "r"((long) old), "r"(new), "m"(*m) : "memory");
+ : "r"((long) old_val), "r"(new_val), "m"(*m) : "memory");
return prev;
}
extern __inline__ unsigned long
-__cmpxchg_u64(volatile long *m, unsigned long old, unsigned long new)
+__cmpxchg_u64(volatile long *m, unsigned long old_val, unsigned long new_val)
{
unsigned long prev, cmp;
@@ -434,7 +434,7 @@
"3: br 1b\n"
".previous"
: "=&r"(prev), "=&r"(cmp), "=m"(*m)
- : "r"((long) old), "r"(new), "m"(*m) : "memory");
+ : "r"((long) old_val), "r"(new_val), "m"(*m) : "memory");
return prev;
}
@@ -444,16 +444,16 @@
extern void __cmpxchg_called_with_bad_pointer(void);
static __inline__ unsigned long
-__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
+__cmpxchg(volatile void *ptr, unsigned long old_val, unsigned long new_val, int size)
{
switch (size) {
case 4:
- return __cmpxchg_u32(ptr, old, new);
+ return __cmpxchg_u32(ptr, old_val, new_val);
case 8:
- return __cmpxchg_u64(ptr, old, new);
+ return __cmpxchg_u64(ptr, old_val, new_val);
}
__cmpxchg_called_with_bad_pointer();
- return old;
+ return old_val;
}
#define cmpxchg(ptr,o,n) \
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: 2.2.18 asm-alpha/system.h has a problem
2000-12-17 23:34 2.2.18 asm-alpha/system.h has a problem Daiki Matsuda
@ 2000-12-18 9:31 ` Peter Samuelson
2000-12-18 14:49 ` Andrea Arcangeli
0 siblings, 1 reply; 10+ messages in thread
From: Peter Samuelson @ 2000-12-18 9:31 UTC (permalink / raw)
To: Daiki Matsuda; +Cc: linux-kernel
[Daiki Matsuda]
> I encounterd the problem that 'cdrdao' is not compilable in 2.2.18 on
> Alpha. And I researched a little.
Then cdrdao has a problem. It should not be including kernel headers
directly. You are changing perfectly legal C.
Peter
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: 2.2.18 asm-alpha/system.h has a problem
2000-12-18 9:31 ` Peter Samuelson
@ 2000-12-18 14:49 ` Andrea Arcangeli
2000-12-18 15:03 ` Peter Samuelson
2000-12-18 18:15 ` Timur Tabi
0 siblings, 2 replies; 10+ messages in thread
From: Andrea Arcangeli @ 2000-12-18 14:49 UTC (permalink / raw)
To: Peter Samuelson; +Cc: Daiki Matsuda, linux-kernel
On Mon, Dec 18, 2000 at 03:31:54AM -0600, Peter Samuelson wrote:
> directly. You are changing perfectly legal C.
You're right that's not kernel issue and patch can be rejected, but he's not
really changing anything :). If changing that helps then it's a compiler bug.
Andrea
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: 2.2.18 asm-alpha/system.h has a problem
2000-12-18 14:49 ` Andrea Arcangeli
@ 2000-12-18 15:03 ` Peter Samuelson
2000-12-18 15:14 ` Andrea Arcangeli
2000-12-18 18:15 ` Timur Tabi
1 sibling, 1 reply; 10+ messages in thread
From: Peter Samuelson @ 2000-12-18 15:03 UTC (permalink / raw)
To: Andrea Arcangeli; +Cc: Daiki Matsuda, linux-kernel
[Peter Samuelson]
> > You are changing perfectly legal C.
[Andrea Arcangeli]
> You're right that's not kernel issue and patch can be rejected, but
> he's not really changing anything :). If changing that helps then
> it's a compiler bug.
Not a compiler bug, a source bug of assuming a C header file can be
included by a C++ program. The right solution, as always, is to make a
copy of the header (assuming you really do need it) and edit the copy
as necessary. This is a simple variation on the #ifdef __KERNEL__
issue.
Peter
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: 2.2.18 asm-alpha/system.h has a problem
2000-12-18 14:49 ` Andrea Arcangeli
2000-12-18 15:03 ` Peter Samuelson
@ 2000-12-18 18:15 ` Timur Tabi
2000-12-18 18:20 ` Miquel van Smoorenburg
2000-12-18 18:20 ` Alan Cox
1 sibling, 2 replies; 10+ messages in thread
From: Timur Tabi @ 2000-12-18 18:15 UTC (permalink / raw)
To: linux-kernel
** Reply to message from Peter Samuelson <peter@cadcamlab.org> on Mon, 18 Dec
2000 09:03:00 -0600 (CST)
> Not a compiler bug, a source bug of assuming a C header file can be
> included by a C++ program. The right solution, as always, is to make a
> copy of the header (assuming you really do need it) and edit the copy
> as necessary.
That just creates more maintenance problems. What if the kernel header file
changes? Then he'll have to change his copy as well. He'll forever need to
check changes in that kernel header file, or risk having an obscure bug that's
otherwise hard to track.
Yes, it's perfectly valid C, but so what? That doesn't mean that it's a good
idea. It does no harm to make a minor change to the header file to allow a C++
compiler to digest it. I consider it to be a "professional courtesy" of a C
programmer for a C++ programmer. All the C programmer needs to do is
acknowledge that someone might want to use a C++ compiler on the code, and just
make a few minor changes that have no negative affect at all.
--
Timur Tabi - ttabi@interactivesi.com
Interactive Silicon - http://www.interactivesi.com
When replying to a mailing-list message, please direct the reply to the mailing list only. Don't send another copy to me.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: 2.2.18 asm-alpha/system.h has a problem
2000-12-18 18:15 ` Timur Tabi
@ 2000-12-18 18:20 ` Miquel van Smoorenburg
2000-12-18 18:20 ` Alan Cox
1 sibling, 0 replies; 10+ messages in thread
From: Miquel van Smoorenburg @ 2000-12-18 18:20 UTC (permalink / raw)
To: linux-kernel
In article <20001218184531Z132357-439+4699@vger.kernel.org>,
Timur Tabi <ttabi@interactivesi.com> wrote:
>** Reply to message from Peter Samuelson <peter@cadcamlab.org> on Mon, 18 Dec
>2000 09:03:00 -0600 (CST)
>> Not a compiler bug, a source bug of assuming a C header file can be
>> included by a C++ program. The right solution, as always, is to make a
>> copy of the header (assuming you really do need it) and edit the copy
>> as necessary.
>
>That just creates more maintenance problems. What if the kernel header file
>changes? Then he'll have to change his copy as well. He'll forever need to
>check changes in that kernel header file, or risk having an obscure bug that's
>otherwise hard to track.
No, in fact that is the desired behaviour. If the kernel include files
change, chances are very big that the source of the utility (or library)
needs adjustments as well. In fact if you simply recompile the old
source with the new header files you might get unwanted and unexpected
behaviour, whereas if you recompile with the older header defs you'll
simply use an advertized api that might not be the latest but works
Mike.
--
RAND USR 16514
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: 2.2.18 asm-alpha/system.h has a problem
2000-12-18 18:15 ` Timur Tabi
2000-12-18 18:20 ` Miquel van Smoorenburg
@ 2000-12-18 18:20 ` Alan Cox
1 sibling, 0 replies; 10+ messages in thread
From: Alan Cox @ 2000-12-18 18:20 UTC (permalink / raw)
To: Timur Tabi; +Cc: linux-kernel
> programmer for a C++ programmer. All the C programmer needs to do is
> acknowledge that someone might want to use a C++ compiler on the code, and just
> make a few minor changes that have no negative affect at all.
All C++ folks need to do is to use
extern "C" {
#include "macrosforthestuffthecplusplusstandardspeoplegotwrong.h"
#include "cheaderfile"
#include "nowmakethemacrosgoaway.h"
}
where those redefine new private etc
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2000-12-18 18:50 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-12-17 23:34 2.2.18 asm-alpha/system.h has a problem Daiki Matsuda
2000-12-18 9:31 ` Peter Samuelson
2000-12-18 14:49 ` Andrea Arcangeli
2000-12-18 15:03 ` Peter Samuelson
2000-12-18 15:14 ` Andrea Arcangeli
2000-12-18 15:24 ` Peter Samuelson
2000-12-18 15:41 ` Andrea Arcangeli
2000-12-18 18:15 ` Timur Tabi
2000-12-18 18:20 ` Miquel van Smoorenburg
2000-12-18 18:20 ` Alan Cox
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox