>>>> "OG" == Olivier Galibert
<galibert(a)pobox.com> writes:
OG> On Thu, Jan 20, 2000 at 03:17:43AM -0800, Martin Buchholz wrote:
>>
>>>> "OG" == Olivier
Galibert <galibert(a)pobox.com> writes:
>>
OG> On Wed, Jan 19, 2000 at 04:35:23AM -0500, Olivier Galibert wrote:
> >> For now I'd say let's put it on hold, and I am
going to review my code
> >> for this problem. Most of the (macro-hidden) casts are unnecessay.
>
OG> And here it is. There are some LISP_TO_VOID and back, but that's
OG> where I thought it was the clearer thing to do. Martin?
>
> I just built with pdump for the first time. To make absolutely sure I
> get a core dump, I built using Sun CC (that's the C++ compiler).
>
> I fixed the following errors:
>
> "/net/lasker/xemacs/ws/dev/src/alloc.c", line 4273: Error: Cannot assign
void* to pdump_entry_list_elmt*.
OG> Note that these "errors" are only because you're compiling with a
C++
OG> compiler. The code is perfectly valid ISO C code. And frankly, I
OG> tend to consider all the added casts unnecessary noise.
OG> OTOH, being able to get the better warnings a C++ compiler can give
OG> you is a good thing, so I won't veto any patch on this basis.
I should document more clearly that XEmacs is written in "Clean C",
that is the intersection of ANSI C++ and ANSI C, for reasons of
cleanliness and having more compilation tools available.
> Here's my new patch, which supersedes Olivier's patch:
>
> (Oh, I still don't like those LISP_TO_VOIDs, but I don't understand
> the code enough to suggest an alternative right now.)
OG> The code does:
OG> if (the lisp object is actually a pointer) then
OG> add <delta> to the pointer
OG> endif
I'm looking at this code:
if (POINTER_TYPE_P (XTYPE (dobj)))
{
char *objp = (char *) LISP_TO_VOID (dobj);
if (objp)
objp += delta;
VOID_TO_LISP (*pobj, objp);
}
Should we ever be storing a NULL pointer? Shouldn't we be doing
assert (objp != NULL);
/* Here is code that doesn't use the fact that there is only one
Lisp_Type that is a pointer. It would need to be adjusted if
*pobj could be Qzero_bits. */
enum Lisp_Type type = XTYPE (*pobj);
if (POINTER_TYPE_P (type))
{
XSETOBJ (*pobj, type, (char *) XPNTR (*pobj) + delta);
}