Subject: Re: weird lossage with xcompile macppc -> sparc
To: Martin Husemann <martin@duskware.de>
From: Bill Studenmund <wrstuden@netbsd.org>
List: tech-toolchain
Date: 09/23/2002 16:09:14
On Sat, 21 Sep 2002, Martin Husemann wrote:

> On Sat, Sep 21, 2002 at 04:15:02PM +1000, matthew green wrote:
>
> > because a "signedness" test in mksyntax.c fails somehow:
>
> Uhmm, mksyntax is run as a host program, so it determines the hosts char
> signedness. borken.

Are you sure that's what it's doing? Look closer at the code; it's not.
:-)

> > 	if (sign)
> > 		fprintf(hfile, "#define UPEOF ((char)%d)\n\n", -base);
> > 	else
> > 		fprintf(hfile, "#define UPEOF ((unsigned char)%d)\n\n", -base);
>
> And I must be missing something here: if "char" is signed, use
>
>  ((char)-1)

That one really should be (signed char).

> if char is unsigned, use
>
>  ((unsigned char)-1)
>
> Isn't the "unsigned" in the latter case redundant anyway?

It's a bit hazy now, but back when this code was made cross-compilable,
some of the host tools included syntax.h too. They were the ones that
needed char vs unsigned char. You're right that "char" will always be fine
for the cross-compilers. And it really should be unsigned char vs signed
char.

Take care,

Bill