apparent tsearch breakage on 64-bit machines
apparent tsearch breakage on 64-bit machines
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
On my x86_64 machine, CVS HEAD is throwing the following scary-looking warnings: to_tsany.c: In function 'pushval_morph': to_tsany.c:247: warning: cast from pointer to integer of different size to_tsany.c: In function 'to_tsquery_byid': to_tsany.c:306: warning: cast to pointer from integer of different size to_tsany.c: In function 'plainto_tsquery_byid': to_tsany.c:344: warning: cast to pointer from integer of different size Whether the code is actually safe or not, these are not acceptable. regards, tom lane
Re: apparent tsearch breakage on 64-bit machines
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
I wrote: > Whether the code is actually safe or not, these [warnings] are not acceptable. On looking closer, it seems the intent is to pass an argument of unspecified type through parse_tsquery to a PushFunction: typedef void (*PushFunction)(void *opaque, TSQueryParserState state, char *, int, int2); extern TSQuery parse_tsquery(char *buf, PushFunction pushval, void *opaque, bool isplain); That's fine, but not in a way that throws compiler warnings. There is a standard solution for this task within PG: the arguments should be declared as Datum not void*. Use the DatumGetFoo/FooGetDatum macros to coerce back and forth. Also, the declaration of typedef PushFunction really ought to provide names for all the arguments, for documentation purposes. (Dare I suggest a comment block specifying the API?) regards, tom lane