Hackers,

I'm seeing this:

gcc -O2 -fno-strict-aliasing -g -Wall -Wmissing-prototypes -Wmissing-declarations -I/home/alvherre/CVS/pgsql/source/00orig/src/interfaces/libpq -I../../../src/include -I/home/alvherre/CVS/pgsql/source/00orig/src/include -D_GNU_SOURCE  -DFRONTEND  -c -o pg_backup_db.o /home/alvherre/CVS/pgsql/source/00orig/src/bin/pg_dump/pg_backup_db.c -MMD
/home/alvherre/CVS/pgsql/source/00orig/src/bin/pg_dump/pg_backup_db.c: In function `_isIdentChar':
/home/alvherre/CVS/pgsql/source/00orig/src/bin/pg_dump/pg_backup_db.c:874: warning: comparison is always true due to limited range of data type
/home/alvherre/CVS/pgsql/source/00orig/src/bin/pg_dump/pg_backup_db.c: In function `_isDQChar':
/home/alvherre/CVS/pgsql/source/00orig/src/bin/pg_dump/pg_backup_db.c:891: warning: comparison is always true due to limited range of data type

If I change _isIdentChar to be

static int _isIdentChar(unsigned char c)

I get instead

/home/alvherre/CVS/pgsql/source/00orig/src/bin/pg_dump/pg_backup_db.c: In function `_isIdentChar':
/home/alvherre/CVS/pgsql/source/00orig/src/bin/pg_dump/pg_backup_db.c:874: warning: comparison is always true due to limited range of data type
/home/alvherre/CVS/pgsql/source/00orig/src/bin/pg_dump/pg_backup_db.c:874: warning: comparison is always false due to limited range of data type

(yes, both lines), which is kind of strange.

This is

gcc (GCC) 3.4.1 (Mandrakelinux (Alpha 3.4.1-3mdk)

-- 
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"La fuerza no estï¿½ en los medios fï¿½sicos
sino que reside en una voluntad indomable" (Gandhi)


Mon, 23 Aug 2004 11:58:55 -0400
Alvaro Herrera <alvherre@dcc.uchile.cl>
New warning in pg_dump
At 01:58 AM 24/08/2004, Alvaro Herrera wrote:
>static int _isIdentChar(unsigned char c)

I think the correct thing to do is to leave it as (signed) char, and remove 
the comparison to \200 = -127. All chars will be >= -127. I will fix this 
in the next release.


----------------------------------------------------------------
Philip Warner                    |     __---_____
Albatross Consulting Pty. Ltd.   |----/       -  \
(A.B.N. 75 008 659 498)          |          /(@)   ______---_
Tel: (+61) 0500 83 82 81         |                 _________  \
Fax: (+61) 03 5330 3172          |                 ___________ |
Http://www.rhyme.com.au          |                /           \|
                                  |    --________--
PGP key available upon request,  |  /
and from pgp.mit.edu:11371       |/ 


Tue, 24 Aug 2004 12:29:30 +1000
Philip Warner <pjw@rhyme.com.au>
Re: New warning in pg_dump
Philip Warner <pjw@rhyme.com.au> writes:
> At 01:58 AM 24/08/2004, Alvaro Herrera wrote:
>> static int _isIdentChar(unsigned char c)

> I think the correct thing to do is to leave it as (signed) char, and remove 
> the comparison to \200 = -127.

No, that isn't the right thing, because not all platforms think char is
signed.  I prefer declaring it as unsigned, which means you drop the
\377 end instead ...

			regards, tom lane

Mon, 23 Aug 2004 23:27:48 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: New warning in pg_dump 
At 01:27 PM 24/08/2004, Tom Lane wrote:
>I prefer declaring it as unsigned, which means you drop the
>\377 end instead ...

No problem.


----------------------------------------------------------------
Philip Warner                    |     __---_____
Albatross Consulting Pty. Ltd.   |----/       -  \
(A.B.N. 75 008 659 498)          |          /(@)   ______---_
Tel: (+61) 0500 83 82 81         |                 _________  \
Fax: (+61) 03 5330 3172          |                 ___________ |
Http://www.rhyme.com.au          |                /           \|
                                  |    --________--
PGP key available upon request,  |  /
and from pgp.mit.edu:11371       |/ 


Tue, 24 Aug 2004 13:32:07 +1000
Philip Warner <pjw@rhyme.com.au>
Re: New warning in pg_dump 