Subject: Re: weird lossage with xcompile macppc -> sparc
To: matthew green <mrg@eterna.com.au>
From: Bill Studenmund <wrstuden@netbsd.org>
List: tech-toolchain
Date: 09/23/2002 16:15:18
On Sat, 21 Sep 2002, matthew green wrote:
>
>
> hi folks.
>
>
> i'm having a weird problem with bin/sh building cross from macppc
> to sparc. i am getting this:
>
> /usr/src/bin/sh/eval.c: In function `evalcommand':
> /usr/src/bin/sh/eval.c:641: warning: comparison is always true due to limited range of data type
> /usr/src/bin/sh/eval.c:644: warning: comparison is always true due to limited range of data type
>
> because a "signedness" test in mksyntax.c fails somehow:
>
> /* Determine the characteristics of chars. */
> c = -1;
> if (c <= 0)
> sign = 1;
> else
> sign = 0;
>
> [ ... ]
>
> if (sign)
> fprintf(hfile, "#define UPEOF ((char)%d)\n\n", -base);
> else
> fprintf(hfile, "#define UPEOF ((unsigned char)%d)\n\n", -base);
>
>
> and UPEOF() is the macro involved above that causes the warning. it
> gets defined with a cast to "unsigned char" as sign gets set to 0.
Do a cc -E on the compile of mksyntax. See what type "c" is getting
defined to. It SHOULD be int8_t, and thus you should be getting "signed"
set to one.
Take care,
Bill