Re: Re: Call for platforms

Giles Lean <giles@nemeton.com.au>

From: Giles Lean <giles@nemeton.com.au>
To: "Henry B. Hotz" <hotz@jpl.nasa.gov>
Cc: pgsql-hackers@postgresql.org
Date: 2001-04-10T09:52:57Z
Lists: pgsql-hackers
> At 1:50 AM -0400 4/6/01, Tom Lane wrote:
> >"Henry B. Hotz" <hotz@jpl.nasa.gov> writes:
> > > Bottom line:  7.1RC1 passes most of the regression tests on
> > > NetBSD/macppc.
> >
> >The only thing that surprised me here was all of the warnings from
> >libreadline calls:
> >
> > >> tab-complete.c: In function `initialize_readline':
> > >> tab-complete.c:103: warning: assignment from incompatible pointer type
> > >> tab-complete.c: In function `psql_completion':
> > >> tab-complete.c:292: warning: passing arg 2 of `completion_matches'
> > >> from incompatible pointer type
> > >> tab-complete.c:296: warning: passing arg 2 of `completion_matches'
> > >> from incompatible pointer type
> >
> >What version of libreadline do you have installed, and how does it
> >declare completion_matches()?

$ uname -srm
NetBSD 1.5 i386
$ grep CPFunction /usr/include/readline.h
typedef char   *CPFunction __P((const char *, int));
extern CPFunction  *rl_completion_entry_function;
char **completion_matches __P((const char *, CPFunction *));

Putting the 'const' in the relevant PostgreSQL functions (diff against
7.1RC3 below) removes these warnings.  I don't know what that does on
a machine using GNU readline ... I can check that in a day or two if
anyone's interested.

The NetBSD libedit-emulating-readline works just fine with psql even
without the warnings fixed -- they're harmless in this case.

Regards,

Giles

*** src/bin/psql/tab-complete.c-orig	Mon Apr  2 05:17:32 2001
--- src/bin/psql/tab-complete.c	Tue Apr 10 19:51:21 2001
***************
*** 70,80 ****
  
  
  /* Forward declaration of functions */
! static char **psql_completion(char *text, int start, int end);
! static char *create_command_generator(char *text, int state);
! static char *complete_from_query(char *text, int state);
! static char *complete_from_const(char *text, int state);
! static char *complete_from_list(char *text, int state);
  
  static PGresult *exec_query(char *query);
  char	   *quote_file_name(char *text, int match_type, char *quote_pointer);
--- 70,80 ----
  
  
  /* Forward declaration of functions */
! static char **psql_completion(const char *text, int start, int end);
! static char *create_command_generator(const char *text, int state);
! static char *complete_from_query(const char *text, int state);
! static char *complete_from_const(const char *text, int state);
! static char *complete_from_list(char const *text, int state);
  
  static PGresult *exec_query(char *query);
  char	   *quote_file_name(char *text, int match_type, char *quote_pointer);
***************
*** 177,183 ****
     libraries completion_matches() function, so we don't have to worry about it.
  */
  static char **
! psql_completion(char *text, int start, int end)
  {
  	/* This is the variable we'll return. */
  	char	  **matches = NULL;
--- 177,183 ----
     libraries completion_matches() function, so we don't have to worry about it.
  */
  static char **
! psql_completion(const char *text, int start, int end)
  {
  	/* This is the variable we'll return. */
  	char	  **matches = NULL;
***************
*** 796,802 ****
     as defined above.
  */
  static char *
! create_command_generator(char *text, int state)
  {
  	static int	list_index,
  				string_length;
--- 796,802 ----
     as defined above.
  */
  static char *
! create_command_generator(const char *text, int state)
  {
  	static int	list_index,
  				string_length;
***************
*** 829,835 ****
     etc.
  */
  static char *
! complete_from_query(char *text, int state)
  {
  	static int	list_index,
  				string_length;
--- 829,835 ----
     etc.
  */
  static char *
! complete_from_query(const char *text, int state)
  {
  	static int	list_index,
  				string_length;
***************
*** 877,883 ****
     SQL words that can appear at certain spot.
  */
  static char *
! complete_from_list(char *text, int state)
  {
  	static int	string_length,
  				list_index;
--- 877,883 ----
     SQL words that can appear at certain spot.
  */
  static char *
! complete_from_list(const char *text, int state)
  {
  	static int	string_length,
  				list_index;
***************
*** 911,917 ****
     The string to be passed must be in completion_charp.
  */
  static char *
! complete_from_const(char *text, int state)
  {
  	(void) text;				/* We don't care about what was entered
  								 * already. */
--- 911,917 ----
     The string to be passed must be in completion_charp.
  */
  static char *
! complete_from_const(const char *text, int state)
  {
  	(void) text;				/* We don't care about what was entered
  								 * already. */