Use return instead of exit() in configure
authorTom Lane <[email protected]>
Sun, 12 Dec 2021 19:54:37 +0000 (14:54 -0500)
committerTom Lane <[email protected]>
Sun, 12 Dec 2021 19:54:37 +0000 (14:54 -0500)
Using exit() requires stdlib.h, which is not included.  Use return
instead.  Also add return type for main().

This back-patches commit 1c0cf52b3 into out-of-support branches,
pursuant to a newly-established project policy that we'll try to keep
out-of-support branches buildable on modern platforms for at least
ten major releases back, ensuring people can test pg_dump and psql
compatibility against servers that far back.  With the current
development branch being v15, that works out to keeping 9.2 and up
buildable as of today.

This fix is needed to get through 'configure' when using recent
macOS (and possibly other clang-based toolchains).  It seems to
be sufficient to get through 'check-world', although there are
annoyances such as compiler warnings, which will be dealt with
separately.

Original patch by Peter Eisentraut

Discussion: https://postgr.es/m/d0316012-ece7-7b7e-2d36-9c38cb77cb3b@enterprisedb.com

config/c-compiler.m4
config/c-library.m4
configure

index 8a216c9f73c2e0d503fa7faf3b0e4cb1551fdda6..349e0932a9f0207295efab6e11d61be8a525ae0c 100644 (file)
@@ -84,8 +84,10 @@ int does_int64_work()
     return 0;
   return 1;
 }
+
+int
 main() {
-  exit(! does_int64_work());
+  return (! does_int64_work());
 }],
 [Ac_cachevar=yes],
 [Ac_cachevar=no],
index 70eb0e4dcf799deeec29eef1a6cba80419549d0d..d184921464567943e55b8841d03e90427992ae79 100644 (file)
@@ -250,8 +250,10 @@ int does_int64_snprintf_work()
     return 0;          /* either multiply or snprintf is busted */
   return 1;
 }
+
+int
 main() {
-  exit(! does_int64_snprintf_work());
+  return (! does_int64_snprintf_work());
 }],
 [pgac_cv_snprintf_long_long_int_format=$pgac_format; break],
 [],
index 6c2a1755ce7f8ff5a4ba886dd84ed0d660d8e17c..23486236442aa3daf0045c6caa7de2d99b32b4ed 100755 (executable)
--- a/configure
+++ b/configure
@@ -24588,8 +24588,10 @@ int does_int64_work()
     return 0;
   return 1;
 }
+
+int
 main() {
-  exit(! does_int64_work());
+  return (! does_int64_work());
 }
 _ACEOF
 rm -f conftest$ac_exeext
@@ -24725,8 +24727,10 @@ int does_int64_work()
     return 0;
   return 1;
 }
+
+int
 main() {
-  exit(! does_int64_work());
+  return (! does_int64_work());
 }
 _ACEOF
 rm -f conftest$ac_exeext
@@ -24829,8 +24833,10 @@ int does_int64_snprintf_work()
     return 0;          /* either multiply or snprintf is busted */
   return 1;
 }
+
+int
 main() {
-  exit(! does_int64_snprintf_work());
+  return (! does_int64_snprintf_work());
 }
 _ACEOF
 rm -f conftest$ac_exeext