Removing obsolete configure checks
Over in the thread at [1]/messages/by-id/5d398bbb-262a-5fed-d839-d0e5cff3c0d7@2ndquadrant.com we agreed to remove assorted code that copes
with missing <stdint.h>, on the grounds that C99 requires that header
so we should not have to cater anymore for platforms without it.
This logic could obviously be carried further. I scraped the buildfarm
configure logs to see what other tests seem pointless (on the grounds that
every active animal reports the same result) and found a fair number.
I think we can just remove these tests, and the corresponding
src/port/ files where there is one:
fseeko
isinf
memmove
rint
signed types
utime
utime.h
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. Removing src/port/isinf.c
will let us get rid of a few more configure tests too:
# Look for a way to implement a substitute for isinf()
AC_CHECK_FUNCS([fpclass fp_class fp_class_d class], [break])
although that code path is never taken so it won't save much.
I believe that we can also get rid of these tests:
flexible array members
cbrt
intptr_t
uintptr_t
as these features are likewise required by C99. Solution.pm thinks that
MSVC does not have the above, but I suspect its information is out of
date. We could soon find out from the buildfarm, of course.
I also noted that these header checks are passing everywhere,
which is unsurprising because they're required by C99 and/or POSIX:
ANSI C header files
inttypes.h
memory.h
stdlib.h
string.h
strings.h
sys/stat.h
sys/types.h
unistd.h
Unfortunately we're not actually asking for any of those to be probed
for --- it looks like Autoconf just up and does that of its own accord.
So we can't get rid of the tests and save configure cycles thereby.
But we can skip testing the HAVE_FOO_H symbols for them. We mostly
were already, but there's one or two exceptions.
There are a few other tests that are getting the same results in
all buildfarm configure checks, but Solution.pm is injecting different
results for Windows, such as what to expand "inline" to. Conceivably
we could hard-code that based on the WIN32 #define and remove the
configure probes, but I'm inclined to think it's not worth the
trouble and possible loss of flexibility.
Barring objections I'll go make this happen.
regards, tom lane
[1]: /messages/by-id/5d398bbb-262a-5fed-d839-d0e5cff3c0d7@2ndquadrant.com
On 2020-02-20 19:00, Tom Lane wrote:
I think we can just remove these tests, and the corresponding
src/port/ files where there is one:fseeko
isinf
memmove
rint
signed types
utime
utime.h
wchar.h
makes sense
I believe that we can also get rid of these tests:
flexible array members
cbrt
intptr_t
uintptr_tas these features are likewise required by C99. Solution.pm thinks that
MSVC does not have the above, but I suspect its information is out of
date. We could soon find out from the buildfarm, of course.
The flexible array members test on Solution.pm looks correct to me
(define to empty if supported, else define to 1). cbrt is probably a
mistake or outdated. The intptr_t/uintptr_t results are inconsistent:
It correctly defines intptr_t to empty, so that it will use the existing
typedef, but it does not define HAVE_INTPTR_T, but nothing uses that
anyway. But these are gone now anyway.
I also noted that these header checks are passing everywhere,
which is unsurprising because they're required by C99 and/or POSIX:ANSI C header files
inttypes.h
memory.h
stdlib.h
string.h
strings.h
sys/stat.h
sys/types.h
unistd.hUnfortunately we're not actually asking for any of those to be probed
for --- it looks like Autoconf just up and does that of its own accord.
So we can't get rid of the tests and save configure cycles thereby.
But we can skip testing the HAVE_FOO_H symbols for them. We mostly
were already, but there's one or two exceptions.
Autoconf git master seems to have modernized that a little bit. For
instance, HAVE_STDLIB_H and HAVE_STRING_H are always defined to 1, just
for backward compatibility. If we wanted to fiddle with this, I'd
consider importing the updated macro. Not sure if it's worth it though.
There are a few other tests that are getting the same results in
all buildfarm configure checks, but Solution.pm is injecting different
results for Windows, such as what to expand "inline" to.
MSVC indeed does not appear to support plain inline.
Conceivably
we could hard-code that based on the WIN32 #define and remove the
configure probes, but I'm inclined to think it's not worth the
trouble and possible loss of flexibility.
Right, better to leave it.
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes:
On 2020-02-20 19:00, Tom Lane wrote:
I believe that we can also get rid of these tests:
flexible array members
cbrt
intptr_t
uintptr_t
as these features are likewise required by C99. Solution.pm thinks that
MSVC does not have the above, but I suspect its information is out of
date. We could soon find out from the buildfarm, of course.
The flexible array members test on Solution.pm looks correct to me
(define to empty if supported, else define to 1).
Yeah, I misread it the first time.
cbrt is probably a mistake or outdated.
Right; at least, Microsoft's documentation claims to have it. We'll
soon find out.
The intptr_t/uintptr_t results are inconsistent:
It correctly defines intptr_t to empty, so that it will use the existing
typedef, but it does not define HAVE_INTPTR_T, but nothing uses that
anyway. But these are gone now anyway.
I forgot that your pending patch would nuke those, or I wouldn't
have listed them.
Unfortunately we're not actually asking for any of those to be probed
for --- it looks like Autoconf just up and does that of its own accord.
So we can't get rid of the tests and save configure cycles thereby.
But we can skip testing the HAVE_FOO_H symbols for them. We mostly
were already, but there's one or two exceptions.
Autoconf git master seems to have modernized that a little bit. For
instance, HAVE_STDLIB_H and HAVE_STRING_H are always defined to 1, just
for backward compatibility. If we wanted to fiddle with this, I'd
consider importing the updated macro. Not sure if it's worth it though.
Hmm. If I thought they'd actually put out a new release sometime soon,
I'd be content to wait for that. Seems like they have forgotten the
rule about "great artists ship", though. Maybe we need to just
periodically grab their git master? Keeping all committers in sync
would be a problem though.
regards, tom lane
On Fri, Feb 21, 2020 at 7:00 AM Tom Lane <tgl@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.
Attachments:
0001-Remove-configure-probe-for-wctype.h.patchtext/x-patch; charset=US-ASCII; name=0001-Remove-configure-probe-for-wctype.h.patchDownload
From ce1646b8a6397a5fc4b965cd4eadc6d334215cce Mon Sep 17 00:00:00 2001
From: Thomas Munro <thomas.munro@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
0002-Remove-wchar.h-needed-by-some-pre-C99-systems.patchtext/x-patch; charset=US-ASCII; name=0002-Remove-wchar.h-needed-by-some-pre-C99-systems.patchDownload
From d48f7ccb5a7fd8bab3ff938f66eb6254d07a8926 Mon Sep 17 00:00:00 2001
From: Thomas Munro <thomas.munro@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
Thomas Munro <thomas.munro@gmail.com> writes:
On Fri, Feb 21, 2020 at 7:00 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
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.
+1. SUSv2 is perfectly clear that <wctype.h> is supposed to declare
these functions. I'm not surprised that gaur's 1996-ish system headers
failed to see into the future; but prairiedog is up to speed on this
point, and I should think all the surviving BF animals are too.
regards, tom lane
On Sat, Jul 23, 2022 at 4:05 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
Thomas Munro <thomas.munro@gmail.com> writes:
On Fri, Feb 21, 2020 at 7:00 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
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.+1. SUSv2 is perfectly clear that <wctype.h> is supposed to declare
these functions. I'm not surprised that gaur's 1996-ish system headers
failed to see into the future; but prairiedog is up to speed on this
point, and I should think all the surviving BF animals are too.
Thanks. After looking more closely I pushed it as one commit. (I
suspect that we have some redundant #includes around here but my
current mission is focused on redundant configure/portability gloop.)