1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +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

@ -22,7 +22,7 @@
Microsoft tools is to install <productname>Visual Studio Express 2017
for Windows Desktop</productname> and use the included
compiler. It is also possible to build with the full
<productname>Microsoft Visual C++ 2005 to 2017</productname>.
<productname>Microsoft Visual C++ 2013 to 2017</productname>.
In some cases that requires the installation of the
<productname>Windows SDK</productname> in addition to the compiler.
</para>
@ -77,20 +77,24 @@
<para>
Both 32-bit and 64-bit builds are possible with the Microsoft Compiler suite.
32-bit PostgreSQL builds are possible with
<productname>Visual Studio 2005</productname> to
<productname>Visual Studio 2013</productname> to
<productname>Visual Studio 2017</productname> (including Express editions),
as well as standalone Windows SDK releases 6.0 to 8.1.
64-bit PostgreSQL builds are supported with
<productname>Microsoft Windows SDK</productname> version 6.0a to 8.1 or
<productname>Visual Studio 2008</productname> and above. Compilation
is supported down to <productname>Windows XP</productname> and
<productname>Windows Server 2003</productname> when building with
<productname>Visual Studio 2005</productname> to
<productname>Visual Studio 2013</productname>. Building with
<productname>Visual Studio 2015</productname> is supported down to
<productname>Windows Vista</productname> and <productname>Windows Server 2008</productname>.
Building with <productname>Visual Studio 2017</productname> is supported
down to <productname>Windows 7 SP1</productname> and <productname>Windows Server 2008 R2 SP1</productname>.
<productname>Visual Studio 2013</productname> and above. Compilation
is supported down to <productname>Windows 7</productname> and
<productname>Windows Server 2008 R2 SP1</productname> when building with
<productname>Visual Studio 2013</productname> to
<productname>Visual Studio 2017</productname>.
<!--
For 2013 requirements:
https://docs.microsoft.com/en-us/visualstudio/productinfo/vs2013-sysrequirements-vs
For 2015 requirements:
https://docs.microsoft.com/en-us/visualstudio/productinfo/vs2015-sysrequirements-vs
For 2017 requirements:
https://docs.microsoft.com/en-us/visualstudio/productinfo/vs2017-system-requirements-vs
-->
</para>
<para>

View File

@ -85,7 +85,7 @@ su - postgres
<listitem>
<para>
You need an <acronym>ISO</acronym>/<acronym>ANSI</acronym> C compiler (at least
C89-compliant). Recent
C99-compliant). Recent
versions of <productname>GCC</productname> are recommended, but
<productname>PostgreSQL</productname> is known to build using a wide variety
of compilers from different vendors.

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>