fix windows contrib compile warnings for redefined macros - Mailing list pgsql-patches

From Andrew Dunstan
Subject fix windows contrib compile warnings for redefined macros
Date
Msg-id 4177F3AC.4090700@dunslane.net
Whole thread Raw
Responses Re: fix windows contrib compile warnings for redefined macros  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-patches
This patch fixes contrib so that it compiles under windows without
warnings about redefines for min, max, V_UNKNOWN and IDIGNORE

cheers

andrew
Index: intarray/_int.h
===================================================================
RCS file: /home/cvsmirror/pgsql/contrib/intarray/_int.h,v
retrieving revision 1.3
diff -c -r1.3 _int.h
*** intarray/_int.h    4 Aug 2003 00:43:10 -0000    1.3
--- intarray/_int.h    21 Oct 2004 17:31:18 -0000
***************
*** 14,21 ****
--- 14,25 ----
  /* number ranges for compression */
  #define MAXNUMRANGE 100

+ #ifndef max
  #define max(a,b)        ((a) >    (b) ? (a) : (b))
+ #endif
+ #ifndef min
  #define min(a,b)        ((a) <= (b) ? (a) : (b))
+ #endif
  #define abs(a)            ((a) <    (0) ? -(a) : (a))

  /* dimension of array */
Index: tsearch2/gistidx.h
===================================================================
RCS file: /home/cvsmirror/pgsql/contrib/tsearch2/gistidx.h,v
retrieving revision 1.1
diff -c -r1.1 gistidx.h
*** tsearch2/gistidx.h    21 Jul 2003 10:26:26 -0000    1.1
--- tsearch2/gistidx.h    21 Oct 2004 17:31:22 -0000
***************
*** 34,40 ****
--- 34,42 ----
  #define GETBIT(x,i) ( (GETBYTE(x,i) >> ( (i) % BITBYTE )) & 0x01 )

  #define abs(a)            ((a) <    (0) ? -(a) : (a))
+ #ifndef min
  #define min(a,b)            ((a) <    (b) ? (a) : (b))
+ #endif
  #define HASHVAL(val) (((unsigned int)(val)) % SIGLENBIT)
  #define HASH(sign, val) SETBIT((sign), HASHVAL(val))

Index: tsearch2/rewrite.c
===================================================================
RCS file: /home/cvsmirror/pgsql/contrib/tsearch2/rewrite.c,v
retrieving revision 1.3
diff -c -r1.3 rewrite.c
*** tsearch2/rewrite.c    28 Aug 2003 12:23:24 -0000    1.3
--- tsearch2/rewrite.c    21 Oct 2004 17:31:22 -0000
***************
*** 174,179 ****
--- 174,182 ----
      return plaintree(clean_NOT_intree(root), len);
  }

+ #ifdef V_UNKNOWN
+ #undef V_UNKNOWN
+ #endif
  #define V_UNKNOWN    0
  #define V_TRUE        1
  #define V_FALSE        2
Index: tsearch2/wparser_def.c
===================================================================
RCS file: /home/cvsmirror/pgsql/contrib/tsearch2/wparser_def.c,v
retrieving revision 1.10
diff -c -r1.10 wparser_def.c
*** tsearch2/wparser_def.c    29 Aug 2004 05:06:39 -0000    1.10
--- tsearch2/wparser_def.c    21 Oct 2004 17:31:23 -0000
***************
*** 76,86 ****
  #define ENDPUNCTOKEN(x) ( (x)==12 )


! #define IDIGNORE(x) ( (x)==13 || (x)==14 || (x)==12 || (x)==23 )
  #define HLIDIGNORE(x) ( (x)==5 || (x)==13 || (x)==15 || (x)==16 || (x)==17 )
  #define HTMLHLIDIGNORE(x) ( (x)==5 || (x)==15 || (x)==16 || (x)==17 )
  #define NONWORDTOKEN(x) ( (x)==12 || HLIDIGNORE(x) )
! #define NOENDTOKEN(x)    ( NONWORDTOKEN(x) || (x)==7 || (x)==8 || (x)==20 || (x)==21 || (x)==22 || IDIGNORE(x) )

  typedef struct
  {
--- 76,86 ----
  #define ENDPUNCTOKEN(x) ( (x)==12 )


! #define TS_IDIGNORE(x) ( (x)==13 || (x)==14 || (x)==12 || (x)==23 )
  #define HLIDIGNORE(x) ( (x)==5 || (x)==13 || (x)==15 || (x)==16 || (x)==17 )
  #define HTMLHLIDIGNORE(x) ( (x)==5 || (x)==15 || (x)==16 || (x)==17 )
  #define NONWORDTOKEN(x) ( (x)==12 || HLIDIGNORE(x) )
! #define NOENDTOKEN(x)    ( NONWORDTOKEN(x) || (x)==7 || (x)==8 || (x)==20 || (x)==21 || (x)==22 || TS_IDIGNORE(x) )

  typedef struct
  {

pgsql-patches by date:

Previous
From: Andrew Dunstan
Date:
Subject: fix for Makefile.shlib multiply defined target
Next
From: Tom Lane
Date:
Subject: Re: fix windows contrib compile warnings for redefined macros