reduce_contrib_build_special_cases_on_windows_v5.patch

text/plain

Filename: reduce_contrib_build_special_cases_on_windows_v5.patch
Type: text/plain
Part: 0
Message: Re: Reduce the number of special cases to build contrib modules on windows

Patch

Format: unified
Series: patch v5
File+
contrib/ltree/crc32.c 9 1
contrib/ltree/ltree.h 9 1
diff --git a/contrib/ltree/crc32.c b/contrib/ltree/crc32.c
index 8fed3346e8..b035706c05 100644
--- a/contrib/ltree/crc32.c
+++ b/contrib/ltree/crc32.c
@@ -9,7 +9,15 @@
 
 #include "postgres.h"
 
-#ifdef LOWER_NODE
+/*
+ * Below we ignore the fact that LOWER_NODE is defined when compiling with
+ * MSVC.  The reason for this is that earlier versions of the MSVC build
+ * scripts failed to define LOWER_NODE.  More recent version of the MSVC
+ * build scripts parse makefiles which results in LOWER_NODE now being
+ * defined.  We check for _MSC_VER here so as not to break pg_upgrade when
+ * upgrading from versions MSVC versions where LOWER_NODE was not defined.
+ */
+#if defined(LOWER_NODE) && !defined(_MSC_VER)
 #include <ctype.h>
 #define TOLOWER(x)	tolower((unsigned char) (x))
 #else
diff --git a/contrib/ltree/ltree.h b/contrib/ltree/ltree.h
index dc68a0c212..8c10384503 100644
--- a/contrib/ltree/ltree.h
+++ b/contrib/ltree/ltree.h
@@ -90,7 +90,15 @@ typedef struct
 #define LQL_NOT		0x10		/* level has '!' (NOT) prefix */
 #define LQL_COUNT	0x20		/* level is non-'*' and has repeat counts */
 
-#ifdef LOWER_NODE
+/*
+ * Below we ignore the fact that LOWER_NODE is defined when compiling with
+ * MSVC.  The reason for this is that earlier versions of the MSVC build
+ * scripts failed to define LOWER_NODE.  More recent version of the MSVC
+ * build scripts parse makefiles which results in LOWER_NODE now being
+ * defined.  We check for _MSC_VER here so as not to break pg_upgrade when
+ * upgrading from versions MSVC versions where LOWER_NODE was not defined.
+ */
+#if defined(LOWER_NODE) && !defined(_MSC_VER)
 #define FLG_CANLOOKSIGN(x) ( ( (x) & ( LQL_NOT | LVAR_ANYEND | LVAR_SUBLEXEME ) ) == 0 )
 #else
 #define FLG_CANLOOKSIGN(x) ( ( (x) & ( LQL_NOT | LVAR_ANYEND | LVAR_SUBLEXEME | LVAR_INCASE ) ) == 0 )