1
0
mirror of https://github.com/postgres/postgres.git synced 2025-10-27 00:12:01 +03:00

Require C99 (and thus MSCV 2013 upwards).

In 86d78ef50e I enabled configure to check for C99 support, with the
goal of checking which platforms support C99.  While there are a few
machines without C99 support among our buildfarm animals,
de-supporting them for v12 was deemed acceptable.

While not tested in aforementioned commit, the biggest increase in
minimum compiler version comes from MSVC, which gained C99 support
fairly late. The subset in MSVC 2013 is sufficient for our needs, at
this point. While that is a significant increase in minimum version,
the existing windows binaries are already built with a new enough
version.

Make configure error out if C99 support could not be detected. For
MSVC builds, increase the minimum version to 2013.

The increase to MSVC 2013 allows us to get rid of VCBuildProject.pm,
as that was only required for MSVC 2005/2008.

Author: Andres Freund
Discussion: https://postgr.es/m/97d4b165-192d-3605-749c-f614a0c4e783@2ndquadrant.com
This commit is contained in:
Andres Freund
2018-08-23 18:33:40 -07:00
parent a569eea699
commit d9dd406fe2
11 changed files with 112 additions and 558 deletions

View File

@@ -867,19 +867,30 @@ BETTER: unrecognized node type: 42
<title>C Standard</title>
<para>
Code in <productname>PostgreSQL</productname> should only rely on language
features available in the C89 standard. That means a conforming
C89 compiler has to be able to compile postgres, at least aside
from a few platform dependent pieces. Features from later
revision of the C standard or compiler specific features can be
used, if a fallback is provided.
features available in the C99 standard. That means a conforming
C99 compiler has to be able to compile postgres, at least aside
from a few platform dependent pieces.
</para>
<para>
For example <literal>static inline</literal> and
<literal>_StaticAssert()</literal> are currently used, even
though they are from newer revisions of the C standard. If not
available we respectively fall back to defining the functions
without inline, and to using a C89 compatible replacement that
performs the same checks, but emits rather cryptic messages.
A few features included in the C99 standard are, at this time, not be
permitted to be used in core <productname>PostgreSQL</productname>
code. This currently includes variable length arrays, intermingled
declarations and code, <literal>//</literal> comments, universal
character names. Reasons for that include portability and historical
practices.
</para>
<para>
Features from later revision of the C standard or compiler specific
features can be used, if a fallback is provided.
</para>
<para>
For example <literal>_StaticAssert()</literal> and
<literal>__builtin_constant_p</literal> are currently used, even though
they are from newer revisions of the C standard and a
<productname>GCC</productname> extension respectively. If not available
we respectively fall back to using a C99 compatible replacement that
performs the same checks, but emits rather cryptic messages and do not
use <literal>__builtin_constant_p</literal>.
</para>
</simplesect>