Re: [Patch] Fix enum type mismatch

Lists: pgsql-hackers
From: Zdenek Kotala <Zdenek(dot)Kotala(at)Sun(dot)COM>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: [Patch] Fix enum type mismatch
Date: 2009-11-13 15:29:00
Message-ID: 1258126140.1316.7.camel@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Attached patch fixed following warning:

"../../../src/include/nodes/parsenodes.h", line 487: warning: enumerator
value overflows INT_MAX (2147483647)

The reason is clear, enum is int not unsigned.

It is short fix, but I'm thinking about enum conversion to #define. We
use e.g. in the same file.

60 typedef uint32 AclMode; /* a bitmask of privilege bits */
61
62 #define ACL_INSERT (1<<0) /* for relations */
63 #define ACL_SELECT (1<<1)
64 #define ACL_UPDATE (1<<2)
65 #define ACL_DELETE (1<<3)
66 #define ACL_TRUNCATE (1<<4)
67 #define ACL_REFERENCES (1<<5)
68 #define ACL_TRIGGER (1<<6)

Zdenek

Attachment Content-Type Size
parsenode.patch text/x-patch 454 bytes

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Zdenek Kotala <Zdenek(dot)Kotala(at)Sun(dot)COM>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [Patch] Fix enum type mismatch
Date: 2009-11-13 23:45:06
Message-ID: 28346.1258155906@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Zdenek Kotala <Zdenek(dot)Kotala(at)Sun(dot)COM> writes:
> Attached patch fixed following warning:
> "../../../src/include/nodes/parsenodes.h", line 487: warning: enumerator
> value overflows INT_MAX (2147483647)

> The reason is clear, enum is int not unsigned.

I think the compiler is entitled to assume either, actually.
But your fix is good either way. Applied.

regards, tom lane