Re: Warning is adjusted of pgbench. - Mailing list pgsql-patches

From Tom Lane
Subject Re: Warning is adjusted of pgbench.
Date
Msg-id 14365.1190925936@sss.pgh.pa.us
Whole thread Raw
In response to Re: Warning is adjusted of pgbench.  (Magnus Hagander <magnus@hagander.net>)
List pgsql-patches
Magnus Hagander <magnus@hagander.net> writes:
> On Tue, Aug 07, 2007 at 04:58:19PM +0900, Hiroshi Saito wrote:
>> pgbench.c: In function `main':
>> pgbench.c:1257: warning: implicit declaration of function `getopt'
>>
>> adjustment of some reference is required for this.

> Why do you need to #undef EXEC_BACKEND, and is there a specific reason for
> removing the include of win32.h?

I've applied the attached modified version of this patch; it keeps
win32.h in there (correctly re-marked as a system header).  I think
the fundamental issue must be that Hiroshi's system sets HAVE_GETOPT and
HAVE_GETOPT_H.  The former causes port.h to not supply a declaration
of getopt(), so we'd better include <getopt.h> to declare it.

Together with the changes for FRONTEND applied a little bit ago,
I hope that this issue is fully resolved in CVS HEAD.  Let me know if
there's still a problem.

            regards, tom lane

Index: pgbench.c
===================================================================
RCS file: /cvsroot/pgsql/contrib/pgbench/pgbench.c,v
retrieving revision 1.71
retrieving revision 1.72
diff -c -r1.71 -r1.72
*** pgbench.c    25 Aug 2007 09:21:14 -0000    1.71
--- pgbench.c    27 Sep 2007 20:39:43 -0000    1.72
***************
*** 24,33 ****
  #include <ctype.h>

  #ifdef WIN32
! #include "win32.h"
  #else
  #include <sys/time.h>
  #include <unistd.h>

  #ifdef HAVE_GETOPT_H
  #include <getopt.h>
--- 24,34 ----
  #include <ctype.h>

  #ifdef WIN32
! #include <win32.h>
  #else
  #include <sys/time.h>
  #include <unistd.h>
+ #endif   /* ! WIN32 */

  #ifdef HAVE_GETOPT_H
  #include <getopt.h>
***************
*** 40,54 ****
  #ifdef HAVE_SYS_RESOURCE_H
  #include <sys/resource.h>        /* for getrlimit */
  #endif
- #endif   /* ! WIN32 */

  extern char *optarg;
  extern int    optind;

- #ifdef WIN32
- #undef select
- #endif
-

  /********************************************************************
   * some configurable parameters */
--- 41,50 ----

pgsql-patches by date:

Previous
From: Tom Lane
Date:
Subject: Re: Warning is adjusted of pgbench.
Next
From: Tom Lane
Date:
Subject: Re: Eliminate more detoast copies for packed varlenas