Commit Graph

729 Commits

Author SHA1 Message Date
Tom Lane b8464d2f5d Fix configure's AC_CHECK_DECLS tests to work correctly with clang.
Back-port commit 16fbac39f into 9.3 and 9.2, so that these
out-of-support branches can be built with clang without wading
through a pile of warnings about strlcpy and related functions.
check_decls.m4 required some adaptation to work with autoconf 2.63,
but nothing too major.

Discussion: https://postgr.es/m/26819.1542515567@sss.pgh.pa.us
Discussion: https://postgr.es/m/1081321.1663775084@sss.pgh.pa.us
2022-09-21 15:42:00 -04:00
Tom Lane 5d3ce0d823 Disable -Wdeprecated-non-prototype in the back branches.
There doesn't seem to be any good ABI-preserving way to silence
clang 15's -Wdeprecated-non-prototype warnings about our tree-walk
APIs.  While we've fixed it properly in HEAD, the only way to not
see hundreds of these in the back branches is to disable the
warnings.  We're not going to do anything about them, so we might
as well disable them.

I noticed that we also get some of these warnings about fmgr.c's
support for V0 function call convention, in branches before v10
where we removed that.  That's another area we aren't going to
change, so turning off the warning seems fine for that too.

Per project policy, this is a candidate for back-patching into
out-of-support branches: it suppresses annoying compiler warnings
but changes no behavior.  Hence, back-patch all the way to 9.2.

Discussion: https://postgr.es/m/CA+hUKGKpHPDTv67Y+s6yiC8KH5OXeDg6a-twWo_xznKTcG0kSA@mail.gmail.com
2022-09-20 18:59:54 -04:00
Tom Lane cea316881f Disable -Wsometimes-uninitialized warnings in the 9.2 branch.
In 9.2, we didn't yet teach the compiler that elog(ERROR) doesn't
return, which means that the compiler's opinion about whether
variable dereferences are reachable isn't worth much.  Back-patching
the commits that fixed that seems unduly invasive, so instead silence
related complaints with a big hammer.

-Wsometimes-uninitialized is a clang-ism; gcc seems to spell
this warning option differently.  However, I do not observe
any such compiler warnings in 9.2 with gcc 11.2.1, so for now
we needn't do anything for gcc.

Discussion: https://postgr.es/m/d0316012-ece7-7b7e-2d36-9c38cb77cb3b@enterprisedb.com
2021-12-13 01:28:13 -05:00
Tom Lane ebd952f3f4 Clean up compilation warnings coming from PL/Perl with clang-12~
clang-12 has introduced -Wcompound-token-split-by-macro, that is causing
a large amount of warnings when building PL/Perl because of its
interactions with upstream Perl.  This commit adds one -Wno to CFLAGS at
./configure time if the flag is supported by the compiler to silence all
those warnings.

This back-patches commit 9ff47ea41 into out-of-support branches,
pursuant to newly-established project policy.  The point is to
suppress scary-looking warnings so that people building these
branches needn't expend brain cells verifying that it's safe
to ignore the warnings.

Discussion: https://postgr.es/m/d0316012-ece7-7b7e-2d36-9c38cb77cb3b@enterprisedb.com
2021-12-12 18:06:15 -05:00
Tom Lane 276c017f12 Use -Wno-format-truncation and -Wno-stringop-truncation, if available.
This back-patches commit e71658523 into out-of-support branches,
pursuant to newly-established project policy.  The point is to
suppress scary-looking warnings so that people building these
branches needn't expend brain cells verifying that it's safe
to ignore the warnings.

Also back-patch the adjacent test from commit 73b416b2e (Suppress
clang's unhelpful gripes about -pthread switch being unused) and
the necessary autoconf macro from fdea2530b.

Discussion: https://postgr.es/m/d0316012-ece7-7b7e-2d36-9c38cb77cb3b@enterprisedb.com
2021-12-12 16:46:14 -05:00
Tom Lane 8786f783ab Stamp 9.2.24. 2017-11-06 17:17:39 -05:00
Tom Lane f60a236bab Make [U]INT64CONST safe for use in #if conditions.
Instead of using a cast to force the constant to be the right width,
assume we can plaster on an L, UL, LL, or ULL suffix as appropriate.
The old approach to this is very hoary, dating from before we were
willing to require compilers to have working int64 types.

This fix makes the PG_INT64_MIN, PG_INT64_MAX, and PG_UINT64_MAX
constants safe to use in preprocessor conditions, where a cast
doesn't work.  Other symbolic constants that might be defined using
[U]INT64CONST are likewise safer than before.

Also fix the SIZE_MAX macro to be similarly safe, if we are forced
to provide a definition for that.  The test added in commit 2e70d6b5e
happens to do what we want even with the hack "(size_t) -1" definition,
but we could easily get burnt on other tests in future.

Back-patch to all supported branches, like the previous commits.

Discussion: https://postgr.es/m/15883.1504278595@sss.pgh.pa.us
2017-09-01 15:14:18 -04:00
Tom Lane 2f4ffae5ad Stamp 9.2.23. 2017-08-28 17:30:10 -04:00
Tom Lane 56fc4f7c9c Stamp 9.2.22. 2017-08-07 17:19:50 -04:00
Tom Lane 456c7dff2a PL/Perl portability fix: absorb relevant -D switches from Perl.
Back-patch of commit 3c163a7fc7,
which see for more info.

Also throw in commit b4cc35fbb7,
so Coverity doesn't whine about the back branches.

Ashutosh Sharma, some adjustments by me

Discussion: https://postgr.es/m/CANFyU97OVQ3+Mzfmt3MhuUm5NwPU=-FtbNH5Eb7nZL9ua8=rcA@mail.gmail.com
2017-07-31 12:38:35 -04:00
Tom Lane 1ad47d574e Stamp 9.2.21. 2017-05-08 17:22:52 -04:00
Tom Lane fb50c38e9c Support OpenSSL 1.1.0 in 9.3 and 9.2.
This commit back-patches the equivalent of the 9.5-branch commits
e2838c580 and 48e5ba61e, so that we can work with OpenSSL 1.1.0
in all supported branches.

Original patches by Andreas Karlsson and Heikki Linnakangas,
back-patching work by Andreas Karlsson.

Patch: https://postgr.es/m/0c817abb-3f7d-20fb-583a-58f7593a0bea@proxel.se
Discussion: https://postgr.es/m/5129.1492293840@sss.pgh.pa.us
2017-04-17 13:52:42 -04:00
Tom Lane 06a0f6de31 Stamp 9.2.20. 2017-02-06 16:52:27 -05:00
Heikki Linnakangas 2a931efb76 Fix typos in comments.
Backpatch to all supported versions, where applicable, to make backpatching
of future fixes go more smoothly.

Josh Soref

Discussion: https://www.postgresql.org/message-id/CACZqfqCf+5qRztLPgmmosr-B0Ye4srWzzw_mo4c_8_B_mtjmJQ@mail.gmail.com
2017-02-06 11:34:32 +02:00
Tom Lane b3453562b3 Stamp 9.2.19. 2016-10-24 16:17:41 -04:00
Tom Lane 01de6f3fd8 Stamp 9.2.18. 2016-08-08 16:33:27 -04:00
Tom Lane e9dca8ce14 Stamp 9.2.17. 2016-05-09 16:56:07 -04:00
Tom Lane 4edcd5f5d2 Stamp 9.2.16. 2016-03-28 16:14:18 -04:00
Tom Lane e39f86fe00 Cope if platform declares mbstowcs_l(), but not locale_t, in <xlocale.h>.
Previously, we included <xlocale.h> only if necessary to get the definition
of type locale_t.  According to notes in PGAC_TYPE_LOCALE_T, this is
important because on some versions of glibc that file supplies an
incompatible declaration of locale_t.  (This info may be obsolete, because
on my RHEL6 box that seems to be the *only* definition of locale_t; but
there may still be glibc's in the wild for which it's a live concern.)

It turns out though that on FreeBSD and maybe other BSDen, you can get
locale_t from stdlib.h or locale.h but mbstowcs_l() and friends only from
<xlocale.h>.  This was leaving us compiling calls to mbstowcs_l() and
friends with no visible prototype, which causes a warning and could
possibly cause actual trouble, since it's not declared to return int.

Hence, adjust the configure checks so that we'll include <xlocale.h>
either if it's necessary to get type locale_t or if it's necessary to
get a declaration of mbstowcs_l().

Report and patch by Aleksander Alekseev, somewhat whacked around by me.
Back-patch to all supported branches, since we have been using
mbstowcs_l() since 9.1.
2016-03-15 13:19:58 -04:00
Tom Lane a060605801 Stamp 9.2.15. 2016-02-08 16:19:37 -05:00
Tom Lane bcce4a5e3a Cope with Readline's failure to track SIGWINCH events outside of input.
It emerges that libreadline doesn't notice terminal window size change
events unless they occur while collecting input.  This is easy to stumble
over if you resize the window while using a pager to look at query output,
but it can be demonstrated without any pager involvement.  The symptom is
that queries exceeding one line are misdisplayed during subsequent input
cycles, because libreadline has the wrong idea of the screen dimensions.

The safest, simplest way to fix this is to call rl_reset_screen_size()
just before calling readline().  That causes an extra ioctl(TIOCGWINSZ)
for every command; but since it only happens when reading from a tty, the
performance impact should be negligible.  A more valid objection is that
this still leaves a tiny window during entry to readline() wherein delivery
of SIGWINCH will be missed; but the practical consequences of that are
probably negligible.  In any case, there doesn't seem to be any good way to
avoid the race, since readline exposes no functions that seem safe to call
from a generic signal handler --- rl_reset_screen_size() certainly isn't.

It turns out that we also need an explicit rl_initialize() call, else
rl_reset_screen_size() dumps core when called before the first readline()
call.

rl_reset_screen_size() is not present in old versions of libreadline,
so we need a configure test for that.  (rl_initialize() is present at
least back to readline 4.0, so we won't bother with a test for it.)
We would need a configure test anyway since libedit's emulation of
libreadline doesn't currently include such a function.  Fortunately,
libedit seems not to have any corresponding bug.

Merlin Moncure, adjusted a bit by me
2015-12-16 16:58:56 -05:00
Tom Lane 6915708641 Stamp 9.2.14. 2015-10-05 15:15:56 -04:00
Noah Misch 12073b9aad AIX: Test the -qlonglong option before use.
xlc provides "long long" unconditionally at C99-compatible language
levels, and this option provokes a warning.  The warning interferes with
"configure" tests that fail in response to any warning.  Notably, before
commit 85a2a8903f, it interfered with the
test for -qnoansialias.  Back-patch to 9.0 (all supported versions).
2015-07-17 03:02:18 -04:00
Tom Lane 89b8cf47b8 Make numeric form of PG version number readily available in Makefiles.
Expose PG_VERSION_NUM (e.g., "90600") as a Make variable; but for
consistency with the other Make variables holding similar info,
call the variable just VERSION_NUM not PG_VERSION_NUM.

There was some discussion of making this value available as a pg_config
value as well.  However, that would entail substantially more work than
this two-line patch.  Given that there was not exactly universal consensus
that we need this at all, let's just do a minimal amount of work for now.

Back-patch of commit a5d489ccb7, so that this
variable is actually useful for its intended purpose sometime before 2020.

Michael Paquier, reviewed by Pavel Stehule
2015-07-05 12:01:01 -04:00
Alvaro Herrera c538d73632 Test -lrt for sched_yield
Apparently, this is needed in some Solaris versions.

Author: Oskari Saarenmaa
2015-06-30 14:20:38 -03:00
Tom Lane 582eff507e Stamp 9.2.13. 2015-06-09 15:33:16 -04:00
Tom Lane 3f7928a289 Stamp 9.2.12. 2015-06-01 15:10:35 -04:00
Tom Lane 520fecfae5 Stamp 9.2.11. 2015-05-18 14:34:28 -04:00
Tom Lane 9f20f2fc43 Stamp 9.2.10. 2015-02-02 15:44:39 -05:00
Noah Misch 5ca4e444cb On Darwin, detect and report a multithreaded postmaster.
Darwin --enable-nls builds use a substitute setlocale() that may start a
thread.  Buildfarm member orangutan experienced BackendList corruption
on account of different postmaster threads executing signal handlers
simultaneously.  Furthermore, a multithreaded postmaster risks undefined
behavior from sigprocmask() and fork().  Emit LOG messages about the
problem and its workaround.  Back-patch to 9.0 (all supported versions).
2015-01-07 22:41:49 -05:00
Noah Misch cec0c2182c Diagnose incompatible OpenLDAP versions during build and test.
With OpenLDAP versions 2.4.24 through 2.4.31, inclusive, PostgreSQL
backends can crash at exit.  Raise a warning during "configure" based on
the compile-time OpenLDAP version number, and test the crash scenario in
the dblink test suite.  Back-patch to 9.0 (all supported versions).
2014-07-22 11:01:51 -04:00
Tom Lane e1ea61a301 Stamp 9.2.9. 2014-07-21 15:12:31 -04:00
Noah Misch a919937f11 Add mkdtemp() to libpgport.
This function is pervasive on free software operating systems; import
NetBSD's implementation.  Back-patch to 8.4, like the commit that will
harness it.
2014-06-14 09:41:17 -04:00
Tom Lane f07692e190 Stamp 9.2.8. 2014-03-17 15:36:46 -04:00
Tom Lane 6237fadcc9 Stamp 9.2.7. 2014-02-17 14:38:15 -05:00
Tom Lane 8b47c9d413 Stamp 9.2.6. 2013-12-02 16:00:18 -05:00
Peter Eisentraut 7800229b36 Stamp 9.2.5. 2013-10-07 23:16:13 -04:00
Tom Lane 8714465f0f Fix configure probe for sys/ucred.h.
The configure script's test for <sys/ucred.h> did not work on OpenBSD,
because on that platform <sys/param.h> has to be included first.
As a result, socket peer authentication was disabled on that platform.
Problem introduced in commit be4585b1c2.

Andres Freund, slightly simplified by me.
2013-07-25 11:39:15 -04:00
Tom Lane 73c122769c Stamp 9.2.4. 2013-04-01 14:20:36 -04:00
Tom Lane 51dac56ad5 Stamp 9.2.3. 2013-02-04 16:28:13 -05:00
Tom Lane 31e0349a16 Ignore libedit/libreadline while probing for standard functions.
Some versions of libedit expose bogus definitions of setproctitle(),
optreset, and perhaps other symbols that we don't want configure to pick up
on.  There was a previous report of similar problems with strlcpy(), which
we addressed in commit 59cf88da91, but the
problem has evidently grown in scope since then.  In hopes of not having to
deal with it again in future, rearrange configure's tests for supplied
functions so that we ignore libedit/libreadline except when probing
specifically for functions we expect them to provide.

Per report from Christoph Berg, though this is slightly more aggressive
than his proposed patch.
2012-12-18 16:22:19 -05:00
Tom Lane a20751ef44 Stamp 9.2.2. 2012-12-03 15:16:10 -05:00
Tom Lane e0327d1030 Stamp 9.2.1. 2012-09-19 17:47:58 -04:00
Tom Lane ef47adb414 Stamp 9.2.0. 2012-09-06 17:26:17 -04:00
Tom Lane e46794420e Make configure probe for mbstowcs_l as well as wcstombs_l.
We previously supposed that any given platform would supply both or neither
of these functions, so that one configure test would be sufficient.  It now
appears that at least on AIX this is not the case ... which is likely an
AIX bug, but nonetheless we need to cope with it.  So use separate tests.
Per bug #6758; thanks to Andrew Hastie for doing the followup testing
needed to confirm what was happening.

Backpatch to 9.1, where we began using these functions.
2012-08-31 14:18:02 -04:00
Tom Lane e8c736ca71 Stamp 9.2rc1. 2012-08-23 18:06:49 -04:00
Tom Lane 33f40976a7 Check LIBXML_VERSION instead of testing in configure script.
We had put a test for libxml2's xmlStructuredErrorContext variable in
configure, but of course that doesn't work on Windows builds.  The next
best alternative seems to be to test the LIBXML_VERSION symbol provided
by xmlversion.h.

Per report from Talha Bin Rizwan, though this fixes it in a different way
than his proposed patch.
2012-08-17 00:05:33 -04:00
Tom Lane d5bcb33603 Stamp 9.2beta4. 2012-08-14 18:38:49 -04:00
Tom Lane f30b05b8a4 Stamp 9.2beta3. 2012-08-02 18:23:20 -04:00
Tom Lane 4bec93ac0f Stamp 9.2beta2. 2012-05-31 19:16:55 -04:00