Re: broken locale in 7.0.2 without multibyte support (FreeBSD 4.1-RELEASE) ? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: broken locale in 7.0.2 without multibyte support (FreeBSD 4.1-RELEASE) ?
Date
Msg-id 6698.969212917@sss.pgh.pa.us
Whole thread Raw
In response to Re: broken locale in 7.0.2 without multibyte support (FreeBSD 4.1-RELEASE) ?  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: broken locale in 7.0.2 without multibyte support (FreeBSD 4.1-RELEASE) ?
Re: broken locale in 7.0.2 without multibyte support (FreeBSD 4.1-RELEASE) ?
List pgsql-hackers
Peter Eisentraut <peter_e@gmx.net> writes:
> I think that the problem might rather be that lower_text (and various
> other arrays) are not declared as unsigned char in the first place. That
> would also explain why -funsigned-chars fixes it. Because calling
> toupper() etc. with a signed char argument is in violation of the spec.

Well, we could fix it either by propagating use of "unsigned char" all
over the place, or by casting the arguments given to ctype macros.
The former would be a lot more invasive because it would propagate to
routines that don't actually call any ctype macros (since they'd have
to conform to prototypes, struct definitions, etc).  So I'm inclined to
go with the latter.  A quick search-and-replace scan ought to do it.

Also, on machines where the ctype macros actually are implemented as
array lookups, gcc -Wall should warn about any calls we miss, so as
long as someone is paying attention on such a platform, we don't have
to worry about the problem sneaking back in.

> (Hmm, template/aix contains this: CFLAGS='-qchars=signed ...'. That can't
> be good.)

Probably Andreas put that in --- maybe he still remembers why.  But it
shouldn't matter.  We need to be able to run on platforms where char is
signed and there's no handy "-funsigned-chars" compiler option.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Where to stick function setuid
Next
From: Tom Lane
Date:
Subject: Re: Where to stick function setuid