Re: [HACKERS] [Patch] Fix enum type mismatch

2009-11-13 Thread Tom Lane
Zdenek Kotala  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

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


[HACKERS] [Patch] Fix enum type mismatch

2009-11-13 Thread Zdenek Kotala
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
diff -r 68b8827f4738 src/include/nodes/parsenodes.h
--- a/src/include/nodes/parsenodes.h	Fri Nov 13 11:17:04 2009 +
+++ b/src/include/nodes/parsenodes.h	Fri Nov 13 16:21:38 2009 +0100
@@ -484,7 +484,7 @@
 	CREATE_TABLE_LIKE_INDEXES		= 1 << 2,
 	CREATE_TABLE_LIKE_STORAGE		= 1 << 3,
 	CREATE_TABLE_LIKE_COMMENTS		= 1 << 4,
-	CREATE_TABLE_LIKE_ALL			= 0x
+	CREATE_TABLE_LIKE_ALL			= 0x7FFF	/* enum is int */ 
 } CreateStmtLikeOption;
 
 /*

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers