On Fri, Feb 21, 2020 at 7:00 AM Tom Lane <t...@sss.pgh.pa.us> wrote:
> wchar.h
>
> All of the above are required by C99 and/or SUSv2, and the configure-using
> buildfarm members are unanimous in reporting that they have them, and
> msvc/Solution.pm expects Windows to have them.

I think the same now applies to <wctype.h>, without gaur.  So I
propose the attached.  I split it into two patches, because 0001 is
based on scraping build farm configure output, while 0002 is an
educated guess and might finish up needing to be reverted if I'm
wrong.
From ce1646b8a6397a5fc4b965cd4eadc6d334215cce Mon Sep 17 00:00:00 2001
From: Thomas Munro <thomas.mu...@gmail.com>
Date: Sat, 23 Jul 2022 15:19:54 +1200
Subject: [PATCH 1/2] Remove configure probe for wctype.h.

This is present in POSIX and Windows.
---
 configure                          | 2 +-
 configure.ac                       | 1 -
 src/backend/utils/adt/formatting.c | 2 --
 src/include/pg_config.h.in         | 3 ---
 src/include/regex/regcustom.h      | 2 --
 src/include/tsearch/ts_locale.h    | 2 --
 src/tools/msvc/Solution.pm         | 1 -
 7 files changed, 1 insertion(+), 12 deletions(-)

diff --git a/configure b/configure
index e80d371da7..6651321208 100755
--- a/configure
+++ b/configure
@@ -13875,7 +13875,7 @@ $as_echo "#define HAVE_STDBOOL_H 1" >>confdefs.h
 fi
 
 
-for ac_header in atomic.h copyfile.h execinfo.h getopt.h ifaddrs.h langinfo.h mbarrier.h poll.h sys/epoll.h sys/event.h sys/ipc.h sys/personality.h sys/prctl.h sys/procctl.h sys/resource.h sys/select.h sys/sem.h sys/shm.h sys/signalfd.h sys/sockio.h sys/uio.h sys/un.h termios.h ucred.h wctype.h
+for ac_header in atomic.h copyfile.h execinfo.h getopt.h ifaddrs.h langinfo.h mbarrier.h poll.h sys/epoll.h sys/event.h sys/ipc.h sys/personality.h sys/prctl.h sys/procctl.h sys/resource.h sys/select.h sys/sem.h sys/shm.h sys/signalfd.h sys/sockio.h sys/uio.h sys/un.h termios.h ucred.h
 do :
   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
 ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
diff --git a/configure.ac b/configure.ac
index 6d3d2f3ffa..1e92fd6abd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1469,7 +1469,6 @@ AC_CHECK_HEADERS(m4_normalize([
 	sys/un.h
 	termios.h
 	ucred.h
-	wctype.h
 ]))
 
 # On BSD, test for net/if.h will fail unless sys/socket.h
diff --git a/src/backend/utils/adt/formatting.c b/src/backend/utils/adt/formatting.c
index e909c1a200..5ba1ff4666 100644
--- a/src/backend/utils/adt/formatting.c
+++ b/src/backend/utils/adt/formatting.c
@@ -75,9 +75,7 @@
  * declare them in <wchar.h>, so include that too.
  */
 #include <wchar.h>
-#ifdef HAVE_WCTYPE_H
 #include <wctype.h>
-#endif
 
 #ifdef USE_ICU
 #include <unicode/ustring.h>
diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in
index 21e9283731..000ed9bde2 100644
--- a/src/include/pg_config.h.in
+++ b/src/include/pg_config.h.in
@@ -700,9 +700,6 @@
 /* Define to 1 if you have the `wcstombs_l' function. */
 #undef HAVE_WCSTOMBS_L
 
-/* Define to 1 if you have the <wctype.h> header file. */
-#undef HAVE_WCTYPE_H
-
 /* Define to 1 if you have the <winldap.h> header file. */
 #undef HAVE_WINLDAP_H
 
diff --git a/src/include/regex/regcustom.h b/src/include/regex/regcustom.h
index 100c52d640..4e215267f8 100644
--- a/src/include/regex/regcustom.h
+++ b/src/include/regex/regcustom.h
@@ -46,9 +46,7 @@
  * declare them in <wchar.h>, so include that too.
  */
 #include <wchar.h>
-#ifdef HAVE_WCTYPE_H
 #include <wctype.h>
-#endif
 
 #include "mb/pg_wchar.h"
 
diff --git a/src/include/tsearch/ts_locale.h b/src/include/tsearch/ts_locale.h
index 7d7c4e16c6..949258760d 100644
--- a/src/include/tsearch/ts_locale.h
+++ b/src/include/tsearch/ts_locale.h
@@ -24,9 +24,7 @@
  * declare them in <wchar.h>, so include that too.
  */
 #include <wchar.h>
-#ifdef HAVE_WCTYPE_H
 #include <wctype.h>
-#endif
 
 /* working state for tsearch_readline (should be a local var in caller) */
 typedef struct
diff --git a/src/tools/msvc/Solution.pm b/src/tools/msvc/Solution.pm
index 2f364ab112..f8df6acabe 100644
--- a/src/tools/msvc/Solution.pm
+++ b/src/tools/msvc/Solution.pm
@@ -426,7 +426,6 @@ sub GenerateFiles
 		HAVE_UUID_UUID_H                         => undef,
 		HAVE_WINLDAP_H                           => undef,
 		HAVE_WCSTOMBS_L                          => 1,
-		HAVE_WCTYPE_H                            => 1,
 		HAVE_VISIBILITY_ATTRIBUTE                => undef,
 		HAVE_WRITEV                              => undef,
 		HAVE_X509_GET_SIGNATURE_NID              => 1,
-- 
2.36.1

From d48f7ccb5a7fd8bab3ff938f66eb6254d07a8926 Mon Sep 17 00:00:00 2001
From: Thomas Munro <thomas.mu...@gmail.com>
Date: Sat, 23 Jul 2022 15:23:09 +1200
Subject: [PATCH 2/2] Remove <wchar.h> needed by some pre-C99 systems.

According to the comments removed by this commit, unnamed pre-C99
systems required <wchar.h>, where <wctype.h> should be enough now.  If
this was a reference to decommissioned build farm animal gaur, we should
now be able able to remove that code.
---
 src/backend/utils/adt/formatting.c | 6 ------
 src/include/regex/regcustom.h      | 6 ------
 src/include/tsearch/ts_locale.h    | 8 +-------
 3 files changed, 1 insertion(+), 19 deletions(-)

diff --git a/src/backend/utils/adt/formatting.c b/src/backend/utils/adt/formatting.c
index 5ba1ff4666..6f8734a947 100644
--- a/src/backend/utils/adt/formatting.c
+++ b/src/backend/utils/adt/formatting.c
@@ -69,12 +69,6 @@
 #include <math.h>
 #include <float.h>
 #include <limits.h>
-
-/*
- * towlower() and friends should be in <wctype.h>, but some pre-C99 systems
- * declare them in <wchar.h>, so include that too.
- */
-#include <wchar.h>
 #include <wctype.h>
 
 #ifdef USE_ICU
diff --git a/src/include/regex/regcustom.h b/src/include/regex/regcustom.h
index 4e215267f8..fc158e1bb7 100644
--- a/src/include/regex/regcustom.h
+++ b/src/include/regex/regcustom.h
@@ -40,12 +40,6 @@
 
 #include <ctype.h>
 #include <limits.h>
-
-/*
- * towlower() and friends should be in <wctype.h>, but some pre-C99 systems
- * declare them in <wchar.h>, so include that too.
- */
-#include <wchar.h>
 #include <wctype.h>
 
 #include "mb/pg_wchar.h"
diff --git a/src/include/tsearch/ts_locale.h b/src/include/tsearch/ts_locale.h
index 949258760d..d14cb4ed26 100644
--- a/src/include/tsearch/ts_locale.h
+++ b/src/include/tsearch/ts_locale.h
@@ -14,18 +14,12 @@
 
 #include <ctype.h>
 #include <limits.h>
+#include <wctype.h>
 
 #include "lib/stringinfo.h"
 #include "mb/pg_wchar.h"
 #include "utils/pg_locale.h"
 
-/*
- * towlower() and friends should be in <wctype.h>, but some pre-C99 systems
- * declare them in <wchar.h>, so include that too.
- */
-#include <wchar.h>
-#include <wctype.h>
-
 /* working state for tsearch_readline (should be a local var in caller) */
 typedef struct
 {
-- 
2.36.1

Reply via email to