Thread: checksum_impl.h fails cpluspluscheck
./src/include/storage/checksum_impl.h: In function ‘uint32 pg_checksum_block(char*, uint32)’: ./src/include/storage/checksum_impl.h:154: warning: comparison between signed and unsigned integer expressions We could exclude that file from the check, but it's also easy to fix by making the variables unsigned: diff --git a/src/include/storage/checksum_impl.h b/src/include/storage/checksum_impl.h index ce1b124..7987b04 100644 --- a/src/include/storage/checksum_impl.h +++ b/src/include/storage/checksum_impl.h @@ -141,7 +141,7 @@ pg_checksum_block(char *data, uint32 size) uint32 sums[N_SUMS]; uint32 (*dataArr)[N_SUMS]= (uint32 (*)[N_SUMS]) data; uint32 result = 0; - int i, + unsigned int i, j; /* ensure that the size is compatible with the algorithm */ Preferences?
Peter Eisentraut <peter_e@gmx.net> writes: > ./src/include/storage/checksum_impl.h: In function �uint32 pg_checksum_block(char*, uint32)�: > ./src/include/storage/checksum_impl.h:154: warning: comparison between signed and unsigned integer expressions > We could exclude that file from the check, but it's also easy to fix by > making the variables unsigned: > ... > Preferences? Possibly use uint32 for consistency with the other vars in the function? No real objection to unsigned int, though, since it's the same thing in practice. regards, tom lane
On Sat, Jun 29, 2013 at 8:55 PM, Peter Eisentraut <peter_e@gmx.net> wrote: > ./src/include/storage/checksum_impl.h: In function ‘uint32 pg_checksum_block(char*, uint32)’: > ./src/include/storage/checksum_impl.h:154: warning: comparison between signed and unsigned integer expressions On the subject of checksum_impl.h, don't you think it's a bit unfortunate that clients have to do this?: + // checksum_impl.h uses Assert, which doesn't work outside the server + #undef Assert + #define Assert(X) + + #include "storage/checksum_impl.h" + Maybe external utilities ought to include another header that does all of this for them? -- Peter Geoghegan