Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Use return instead of exit() in configure
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 12 Dec 2021 19:54:32 +0000 (14:54 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 12 Dec 2021 19:54:32 +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 802f5539d34bdf133486556e03863588fa6320ba..60ad77c88adf3d750e3a6dc45de50af696cb4b03 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 949f3a5e341f6c40701d26b7362527ab57bc5212..c8ecbb6fa77b6d89fefc9c622b3fce8a10011d45 100644 (file)
@@ -251,8 +251,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 0f2d36e7fa84e19a66dd313074c35ca08e3309eb..b2ec267e5cf355f2a770190bb70b57a2ff8777ea 100755 (executable)
--- a/configure
+++ b/configure
@@ -25530,8 +25530,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
@@ -25669,8 +25671,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
@@ -25780,8 +25784,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