Proposed patch to clean up signed-ness warnings

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp>
Cc: pgsql-patches(at)postgreSQL(dot)org
Subject: Proposed patch to clean up signed-ness warnings
Date: 2005-09-22 22:29:11
Message-ID: 16595.1127428151@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

With gcc 4 spreading, it seems like it's past time to do something about
all those signed-vs-unsigned-char warnings that it emits. (Translation:
now that I have to use gcc 4 regularly, I got annoyed enough to fix it
;-))

I looked into it a little and determined that nearly all the warnings
were associated with the multibyte code. Outside the mb subsystem,
our code pretty much uses "char *" for strings, but inside mb it's
mostly "unsigned char *", which is needed because there are lots of
inequality comparisons in there. It seemed to me that the cleanest
fix was to change the external API of the mb subsystem to take and
return "char *", while still using "unsigned char *" internally.
The attached patch eliminates all signed-ness warnings in CVS tip
using this approach. It's kinda long and tedious, but straightforward,
and quite a lot of the changes simplify existing code by removing
casts that aren't needed anymore.

Two questions for the list:

1. Can anyone think of a cleaner way to do this?

2. Is there objection to applying this patch now (ie, before beta3)?
It's not quite a bug fix, but I think it'll make it easier to find
bugs going forward.

regards, tom lane

Attachment Content-Type Size
unsigned.patch.gz application/octet-stream 16.2 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2005-09-22 22:36:36 Re: 2 forks for md5?
Previous Message Alvaro Herrera 2005-09-22 22:18:35 Re: Hierarchical Queries--Stalled No Longer...

Browse pgsql-patches by date

  From Date Subject
Next Message Tatsuo Ishii 2005-09-22 23:13:10 Re: Proposed patch to clean up signed-ness warnings
Previous Message Bruce Momjian 2005-09-22 16:03:51 Re: [PORTS] Solaris - psql returns 0 instead of 1 for file not found.