Attached patch gets rid of most of the remaining warnings on a VC++
build. Summary is:
* A bunch of places that had different const specifyer in the header and
  in the body of the function. (contrib/intarray, src/timezone)
* 1.2 and such constants are double and cause warning. Define as floats
  (contrib/pg_trgm and contrib/tsearch2)
* HAVE_STRERROR is defined by python, so only conditionally redefine it
  in pg_config.h
* NULL function pointer in SSL call cast to the correct pointer type
* ssize_t is defined in pg_config_os.h, remove from libpq-int.h
* Always skip warning 4102 ("label nnn: unreferenced label") caused by
  bison.
* Support for ignoring linker warnings, and ignore the warning about
  PRIVATE on DllRegisterServer. Can't fix properly because PRIVATE is
  not supported by mingw.

Index: contrib/intarray/_int_tool.c
===================================================================
RCS file: /projects/cvsroot/pgsql/contrib/intarray/_int_tool.c,v
retrieving revision 1.8
diff -c -r1.8 _int_tool.c
*** contrib/intarray/_int_tool.c        4 Oct 2006 00:29:45 -0000       1.8
--- contrib/intarray/_int_tool.c        25 Jan 2007 12:16:46 -0000
***************
*** 188,194 ****

  /* len >= 2 */
  bool
! isort(int4 *a, int len)
  {
        int4            tmp,
                                index;
--- 188,194 ----

  /* len >= 2 */
  bool
! isort(int4 *a, const int len)
  {
        int4            tmp,
                                index;
Index: contrib/pg_trgm/trgm_op.c
===================================================================
RCS file: /projects/cvsroot/pgsql/contrib/pg_trgm/trgm_op.c,v
retrieving revision 1.5
diff -c -r1.5 trgm_op.c
*** contrib/pg_trgm/trgm_op.c   30 May 2006 22:12:13 -0000      1.5
--- contrib/pg_trgm/trgm_op.c   25 Jan 2007 12:18:05 -0000
***************
*** 5,11 ****

  PG_MODULE_MAGIC;

! float4                trgm_limit = 0.3;

  PG_FUNCTION_INFO_V1(set_limit);
  Datum         set_limit(PG_FUNCTION_ARGS);
--- 5,11 ----

  PG_MODULE_MAGIC;

! float4                trgm_limit = 0.3f;

  PG_FUNCTION_INFO_V1(set_limit);
  Datum         set_limit(PG_FUNCTION_ARGS);
Index: contrib/tsearch2/rank.c
===================================================================
RCS file: /projects/cvsroot/pgsql/contrib/tsearch2/rank.c,v
retrieving revision 1.21
diff -c -r1.21 rank.c
*** contrib/tsearch2/rank.c     28 Dec 2006 01:09:01 -0000      1.21
--- contrib/tsearch2/rank.c     25 Jan 2007 12:19:30 -0000
***************
*** 37,43 ****
  PG_FUNCTION_INFO_V1(get_covers);
  Datum         get_covers(PG_FUNCTION_ARGS);

! static float weights[] = {0.1, 0.2, 0.4, 1.0};

  #define wpos(wep)     ( w[ WEP_GETWEIGHT(wep) ] )

--- 37,43 ----
  PG_FUNCTION_INFO_V1(get_covers);
  Datum         get_covers(PG_FUNCTION_ARGS);

! static float weights[] = {0.1f, 0.2f, 0.4f, 1.0f};

  #define wpos(wep)     ( w[ WEP_GETWEIGHT(wep) ] )

***************
*** 59,65 ****
  word_distance(int4 w)
  {
        if (w > 100)
!               return 1e-30;

        return 1.0 / (1.005 + 0.05 * exp(((float4) w) / 1.5 - 2));
  }
--- 59,65 ----
  word_distance(int4 w)
  {
        if (w > 100)
!               return (float4)1e-30;

        return 1.0 / (1.005 + 0.05 * exp(((float4) w) / 1.5 - 2));
  }
***************
*** 331,337 ****
                calc_rank_and(w, t, q) : calc_rank_or(w, t, q);

        if (res < 0)
!               res = 1e-20;

        if ((method & RANK_NORM_LOGLENGTH) && t->size > 0)
                res /= log((double) (cnt_length(t) + 1)) / log(2.0);
--- 331,337 ----
                calc_rank_and(w, t, q) : calc_rank_or(w, t, q);

        if (res < 0)
!               res = (float)1e-20;

        if ((method & RANK_NORM_LOGLENGTH) && t->size > 0)
                res /= log((double) (cnt_length(t) + 1)) / log(2.0);
Index: src/include/pg_config.h.win32
===================================================================
RCS file: /projects/cvsroot/pgsql/src/include/pg_config.h.win32,v
retrieving revision 1.39
diff -c -r1.39 pg_config.h.win32
*** src/include/pg_config.h.win32       5 Jan 2007 20:54:39 -0000       1.39
--- src/include/pg_config.h.win32       25 Jan 2007 13:10:02 -0000
***************
*** 366,372 ****
--- 366,374 ----
  #define HAVE_STRDUP 1

  /* Define to 1 if you have the `strerror' function. */
+ #ifndef HAVE_STRERROR
  #define HAVE_STRERROR 1
+ #endif

  /* Define to 1 if you have the `strerror_r' function. */
  /* #undef HAVE_STRERROR_R */
Index: src/interfaces/libpq/fe-secure.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/interfaces/libpq/fe-secure.c,v
retrieving revision 1.90
diff -c -r1.90 fe-secure.c
*** src/interfaces/libpq/fe-secure.c    5 Jan 2007 22:20:01 -0000       1.90
--- src/interfaces/libpq/fe-secure.c    25 Jan 2007 13:21:17 -0000
***************
*** 642,648 ****
                return 0;
        }
  #endif
!       if (PEM_read_PrivateKey(fp, pkey, cb, NULL) == NULL)
        {
                char       *err = SSLerrmessage();

--- 642,648 ----
                return 0;
        }
  #endif
!       if (PEM_read_PrivateKey(fp, pkey, (pem_password_cb *)cb, NULL) == NULL)
        {
                char       *err = SSLerrmessage();

Index: src/interfaces/libpq/libpq-int.h
===================================================================
RCS file: /projects/cvsroot/pgsql/src/interfaces/libpq/libpq-int.h,v
retrieving revision 1.117
diff -c -r1.117 libpq-int.h
*** src/interfaces/libpq/libpq-int.h    5 Jan 2007 22:20:01 -0000       1.117
--- src/interfaces/libpq/libpq-int.h    25 Jan 2007 12:12:57 -0000
***************
*** 38,48 ****
  #include <signal.h>
  #endif

- #ifdef WIN32_ONLY_COMPILER
- typedef int ssize_t;                  /* ssize_t doesn't exist in VC (at 
least not
-                                                                * VC6) */
- #endif
-
  /* include stuff common to fe and be */
  #include "getaddrinfo.h"
  #include "libpq/pqcomm.h"
--- 38,43 ----
Index: src/timezone/ialloc.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/timezone/ialloc.c,v
retrieving revision 1.7
diff -c -r1.7 ialloc.c
*** src/timezone/ialloc.c       15 Oct 2005 02:49:51 -0000      1.7
--- src/timezone/ialloc.c       25 Jan 2007 12:26:43 -0000
***************
*** 14,20 ****
  #define nonzero(n)    (((n) == 0) ? 1 : (n))

  char *
! imalloc(const int n)
  {
        return malloc((size_t) nonzero(n));
  }
--- 14,20 ----
  #define nonzero(n)    (((n) == 0) ? 1 : (n))

  char *
! imalloc(int n)
  {
        return malloc((size_t) nonzero(n));
  }
***************
*** 28,34 ****
  }

  void *
! irealloc(void *pointer, const int size)
  {
        if (pointer == NULL)
                return imalloc(size);
--- 28,34 ----
  }

  void *
! irealloc(void *pointer, int size)
  {
        if (pointer == NULL)
                return imalloc(size);
Index: src/timezone/zic.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/timezone/zic.c,v
retrieving revision 1.19
diff -c -r1.19 zic.c
*** src/timezone/zic.c  24 Oct 2006 15:11:03 -0000      1.19
--- src/timezone/zic.c  25 Jan 2007 12:20:42 -0000
***************
*** 104,113 ****
  };

  extern int    link(const char *fromname, const char *toname);
! static void addtt(pg_time_t starttime, int type);
  static int addtype(long gmtoff, const char *abbr, int isdst,
                int ttisstd, int ttisgmt);
! static void leapadd(pg_time_t t, int positive, int rolling, int count);
  static void adjleap(void);
  static void associate(void);
  static int    ciequal(const char *ap, const char *bp);
--- 104,113 ----
  };

  extern int    link(const char *fromname, const char *toname);
! static void addtt(const pg_time_t starttime, int type);
  static int addtype(long gmtoff, const char *abbr, int isdst,
                int ttisstd, int ttisgmt);
! static void leapadd(const pg_time_t t, int positive, int rolling, int count);
  static void adjleap(void);
  static void associate(void);
  static int    ciequal(const char *ap, const char *bp);
***************
*** 146,152 ****
                const char *typep, const char *monthp,
                const char *dayp, const char *timep);
  static void setboundaries(void);
! static pg_time_t tadd(pg_time_t t1, long t2);
  static void usage(void);
  static void writezone(const char *name);
  static int    yearistype(int year, const char *type);
--- 146,152 ----
                const char *typep, const char *monthp,
                const char *dayp, const char *timep);
  static void setboundaries(void);
! static pg_time_t tadd(const pg_time_t t1, long t2);
  static void usage(void);
  static void writezone(const char *name);
  static int    yearistype(int year, const char *type);
Index: src/tools/msvc/Project.pm
===================================================================
RCS file: /projects/cvsroot/pgsql/src/tools/msvc/Project.pm,v
retrieving revision 1.7
diff -c -r1.7 Project.pm
*** src/tools/msvc/Project.pm   24 Jan 2007 19:24:28 -0000      1.7
--- src/tools/msvc/Project.pm   25 Jan 2007 13:32:08 -0000
***************
*** 23,29 ****
          includes        => '',
          defines         => ';',
                solution        => $solution,
!         disablewarnings => '4018;4244;4273',
      };

        bless $self;
--- 23,30 ----
          includes        => '',
          defines         => ';',
                solution        => $solution,
!         disablewarnings => '4018;4244;4273;4102',
!         disablelinkerwarnings => ''
      };

        bless $self;
***************
*** 242,247 ****
--- 243,255 ----
        $self->AddFile("$dir\\win32ver.rc");
  }

+ sub DisableLinkerWarnings {
+    my ($self, $warnings) = @_;
+
+    $self->{disablelinkerwarnings} .= ';' unless 
($self->{disablelinkerwarnings} eq '');
+    $self->{disablelinkerwarnings} .= $warnings;
+ }
+
  sub Save {
        my ($self) = @_;

***************
*** 390,395 ****
--- 398,406 ----
                GenerateMapFile="FALSE" 
MapFileName=".\\$cfgname\\$self->{name}\\$self->{name}.map"
                SubSystem="1" TargetMachine="1"
  EOF
+    if ($self->{disablelinkerwarnings}) {
+       print $f 
"\t\tAdditionalOptions=\"/ignore:$self->{disablelinkerwarnings}\"\n";
+    }
        if ($self->{implib}) {
                my $l = $self->{implib};
                $l =~ s/__CFGNAME__/$cfgname/g;
Index: src/tools/msvc/mkvcbuild.pl
===================================================================
RCS file: /projects/cvsroot/pgsql/src/tools/msvc/mkvcbuild.pl,v
retrieving revision 1.11
diff -c -r1.11 mkvcbuild.pl
*** src/tools/msvc/mkvcbuild.pl 24 Jan 2007 19:24:28 -0000      1.11
--- src/tools/msvc/mkvcbuild.pl 25 Jan 2007 13:31:27 -0000
***************
*** 135,140 ****
--- 135,141 ----
  $pgevent->AddResourceFile('src\bin\pgevent','Eventlog message formatter');
  $pgevent->RemoveFile('src\bin\pgevent\win32ver.rc');
  $pgevent->UseDef('src\bin\pgevent\pgevent.def');
+ $pgevent->DisableLinkerWarnings('4104');

  my $psql = AddSimpleFrontend('psql', 1);
  $psql->AddIncludeDir('src\bin\pg_dump');
---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
       subscribe-nomail command to [EMAIL PROTECTED] so that your
       message can get through to the mailing list cleanly

Reply via email to