Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 6203583

Browse files
committed
Remove support for Visual Studio 2013
No members of the buildfarm are using this version of Visual Studio, resulting in all the code cleaned up here as being mostly dead, and VS2017 is the oldest version still supported. More versions could be cut, but the gain would be minimal, while removing only VS2013 has the advantage to remove from the core code all the dependencies on the value defined by _MSC_VER, where compatibility tweaks have accumulated across the years mostly around locales and strtof(), so that's a nice isolated cleanup. Note that this commit additionally allows a revert of 3154e16. The versions of Visual Studio now supported range from 2015 to 2022. Author: Michael Paquier Reviewed-by: Juan José Santamaría Flecha, Tom Lane, Thomas Munro, Justin Pryzby Discussion: https://postgr.es/m/YoH2IMtxcS3ncWn+@paquier.xyz
1 parent 4ca9985 commit 6203583

File tree

14 files changed

+24
-177
lines changed

14 files changed

+24
-177
lines changed

configure

+3-4
Original file line numberDiff line numberDiff line change
@@ -16809,10 +16809,9 @@ fi
1680916809

1681016810
if test "$PORTNAME" = "win32" -o "$PORTNAME" = "cygwin"; then
1681116811
# Cygwin and (apparently, based on test results) Mingw both
16812-
# have a broken strtof(), so substitute the same replacement
16813-
# code we use with VS2013. That's not a perfect fix, since
16814-
# (unlike with VS2013) it doesn't avoid double-rounding, but
16815-
# we have no better options. To get that, though, we have to
16812+
# have a broken strtof(), so substitute its implementation.
16813+
# That's not a perfect fix, since it doesn't avoid double-rounding,
16814+
# but we have no better options. To get that, though, we have to
1681616815
# force the file to be compiled despite HAVE_STRTOF.
1681716816
case " $LIBOBJS " in
1681816817
*" strtof.$ac_objext "* ) ;;

configure.ac

+3-4
Original file line numberDiff line numberDiff line change
@@ -1919,10 +1919,9 @@ fi
19191919

19201920
if test "$PORTNAME" = "win32" -o "$PORTNAME" = "cygwin"; then
19211921
# Cygwin and (apparently, based on test results) Mingw both
1922-
# have a broken strtof(), so substitute the same replacement
1923-
# code we use with VS2013. That's not a perfect fix, since
1924-
# (unlike with VS2013) it doesn't avoid double-rounding, but
1925-
# we have no better options. To get that, though, we have to
1922+
# have a broken strtof(), so substitute its implementation.
1923+
# That's not a perfect fix, since it doesn't avoid double-rounding,
1924+
# but we have no better options. To get that, though, we have to
19261925
# force the file to be compiled despite HAVE_STRTOF.
19271926
AC_LIBOBJ([strtof])
19281927
AC_MSG_NOTICE([On $host_os we will use our strtof wrapper.])

doc/src/sgml/install-windows.sgml

+3-5
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<productname>Windows</productname>. The simplest way to build with
2323
Microsoft tools is to install <productname>Visual Studio 2022</productname>
2424
and use the included compiler. It is also possible to build with the full
25-
<productname>Microsoft Visual C++ 2013 to 2022</productname>.
25+
<productname>Microsoft Visual C++ 2015 to 2022</productname>.
2626
In some cases that requires the installation of the
2727
<productname>Windows SDK</productname> in addition to the compiler.
2828
</para>
@@ -77,15 +77,13 @@
7777
<para>
7878
Both 32-bit and 64-bit builds are possible with the Microsoft Compiler suite.
7979
32-bit PostgreSQL builds are possible with
80-
<productname>Visual Studio 2013</productname> to
80+
<productname>Visual Studio 2015</productname> to
8181
<productname>Visual Studio 2022</productname>,
8282
as well as standalone Windows SDK releases 8.1a to 10.
8383
64-bit PostgreSQL builds are supported with
8484
<productname>Microsoft Windows SDK</productname> version 8.1a to 10 or
85-
<productname>Visual Studio 2013</productname> and above.
85+
<productname>Visual Studio 2015</productname> and above.
8686
<!--
87-
For 2013 requirements:
88-
https://docs.microsoft.com/en-us/visualstudio/productinfo/vs2013-sysrequirements-vs
8987
For 2015 requirements:
9088
https://docs.microsoft.com/en-us/visualstudio/productinfo/vs2015-sysrequirements-vs
9189
For 2017 requirements:

src/backend/main/main.c

-5
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,6 @@
3030
#include <sys/param.h>
3131
#endif
3232

33-
#if defined(_M_AMD64) && _MSC_VER == 1800
34-
#include <math.h>
35-
#include <versionhelpers.h>
36-
#endif
37-
3833
#include "bootstrap/bootstrap.h"
3934
#include "common/username.h"
4035
#include "port/atomics.h"

src/backend/optimizer/path/costsize.c

+1-3
Original file line numberDiff line numberDiff line change
@@ -5445,10 +5445,8 @@ calc_joinrel_size_estimate(PlannerInfo *root,
54455445
double outer_rows,
54465446
double inner_rows,
54475447
SpecialJoinInfo *sjinfo,
5448-
List *restrictlist_in)
5448+
List *restrictlist)
54495449
{
5450-
/* This apparently-useless variable dodges a compiler bug in VS2013: */
5451-
List *restrictlist = restrictlist_in;
54525450
JoinType jointype = sjinfo->jointype;
54535451
Selectivity fkselec;
54545452
Selectivity jselec;

src/backend/utils/adt/float.c

+1-5
Original file line numberDiff line numberDiff line change
@@ -249,13 +249,9 @@ float4in(PG_FUNCTION_ARGS)
249249
* precision). We'd prefer not to throw error for that, so try to
250250
* detect whether it's a "real" out-of-range condition by checking
251251
* to see if the result is zero or huge.
252-
*
253-
* Use isinf() rather than HUGE_VALF on VS2013 because it
254-
* generates a spurious overflow warning for -HUGE_VALF. Also use
255-
* isinf() if HUGE_VALF is missing.
256252
*/
257253
if (val == 0.0 ||
258-
#if !defined(HUGE_VALF) || (defined(_MSC_VER) && (_MSC_VER < 1900))
254+
#if !defined(HUGE_VALF)
259255
isinf(val)
260256
#else
261257
(val >= HUGE_VALF || val <= -HUGE_VALF)

src/backend/utils/adt/pg_locale.c

-40
Original file line numberDiff line numberDiff line change
@@ -950,7 +950,6 @@ cache_locale_time(void)
950950
* [2] https://docs.microsoft.com/en-us/windows/win32/intl/locale-names
951951
*/
952952

953-
#if _MSC_VER >= 1900
954953
/*
955954
* Callback function for EnumSystemLocalesEx() in get_iso_localename().
956955
*
@@ -1100,7 +1099,6 @@ get_iso_localename(const char *winlocname)
11001099

11011100
return NULL;
11021101
}
1103-
#endif /* _MSC_VER >= 1900 */
11041102

11051103
static char *
11061104
IsoLocaleName(const char *winlocname)
@@ -1115,46 +1113,8 @@ IsoLocaleName(const char *winlocname)
11151113
return iso_lc_messages;
11161114
}
11171115
else
1118-
{
1119-
#if (_MSC_VER >= 1900) /* Visual Studio 2015 or later */
11201116
return get_iso_localename(winlocname);
1121-
#else
1122-
_locale_t loct;
1123-
1124-
loct = _create_locale(LC_CTYPE, winlocname);
1125-
if (loct != NULL)
1126-
{
1127-
size_t rc;
1128-
char *hyphen;
1129-
1130-
/* Locale names use only ASCII, any conversion locale suffices. */
1131-
rc = wchar2char(iso_lc_messages, loct->locinfo->locale_name[LC_CTYPE],
1132-
sizeof(iso_lc_messages), NULL);
1133-
_free_locale(loct);
1134-
if (rc == -1 || rc == sizeof(iso_lc_messages))
1135-
return NULL;
11361117

1137-
/*
1138-
* Since the message catalogs sit on a case-insensitive
1139-
* filesystem, we need not standardize letter case here. So long
1140-
* as we do not ship message catalogs for which it would matter,
1141-
* we also need not translate the script/variant portion, e.g.
1142-
* uz-Cyrl-UZ to uz_UZ@cyrillic. Simply replace the hyphen with
1143-
* an underscore.
1144-
*
1145-
* Note that the locale name can be less-specific than the value
1146-
* we would derive under earlier Visual Studio releases. For
1147-
* example, French_France.1252 yields just "fr". This does not
1148-
* affect any of the country-specific message catalogs available
1149-
* as of this writing (pt_BR, zh_CN, zh_TW).
1150-
*/
1151-
hyphen = strchr(iso_lc_messages, '-');
1152-
if (hyphen)
1153-
*hyphen = '_';
1154-
return iso_lc_messages;
1155-
}
1156-
#endif /* Visual Studio 2015 or later */
1157-
}
11581118
#endif /* defined(_MSC_VER) */
11591119
return NULL; /* Not supported on this version of msvc/mingw */
11601120
}

src/include/port/win32_port.h

+1-6
Original file line numberDiff line numberDiff line change
@@ -531,13 +531,8 @@ typedef unsigned short mode_t;
531531

532532
#endif /* _MSC_VER */
533533

534-
#if (defined(_MSC_VER) && (_MSC_VER < 1900)) || \
535-
defined(__MINGW32__) || defined(__MINGW64__)
534+
#if defined(__MINGW32__) || defined(__MINGW64__)
536535
/*
537-
* VS2013 has a strtof() that seems to give correct answers for valid input,
538-
* even on the rounding edge cases, but which doesn't handle out-of-range
539-
* input correctly. Work around that.
540-
*
541536
* Mingw claims to have a strtof, and my reading of its source code suggests
542537
* that it ought to work (and not need this hack), but the regression test
543538
* results disagree with me; whether this is a version issue or not is not

src/port/chklocale.c

+5-28
Original file line numberDiff line numberDiff line change
@@ -191,42 +191,20 @@ static const struct encoding_match encoding_match_list[] = {
191191
/*
192192
* On Windows, use CP<code page number> instead of the nl_langinfo() result
193193
*
194-
* Visual Studio 2012 expanded the set of valid LC_CTYPE values, so have its
195-
* locale machinery determine the code page. See comments at IsoLocaleName().
196-
* For other compilers, follow the locale's predictable format.
197-
*
198-
* Visual Studio 2015 should still be able to do the same, but the declaration
199-
* of lc_codepage is missing in _locale_t, causing this code compilation to
200-
* fail, hence this falls back instead on GetLocaleInfoEx. VS 2015 may be an
201-
* exception and post-VS2015 versions should be able to handle properly the
202-
* codepage number using _create_locale(). So, instead of the same logic as
203-
* VS 2012 and VS 2013, this routine uses GetLocaleInfoEx to parse short
204-
* locale names like "de-DE", "fr-FR", etc. If those cannot be parsed correctly
205-
* process falls back to the pre-VS-2010 manual parsing done with
206-
* using <Language>_<Country>.<CodePage> as a base.
194+
* This routine uses GetLocaleInfoEx() to parse short locale names like
195+
* "de-DE", "fr-FR", etc. If those cannot be parsed correctly process falls
196+
* back to the pre-VS-2010 manual parsing done with using
197+
* <Language>_<Country>.<CodePage> as a base.
207198
*
208199
* Returns a malloc()'d string for the caller to free.
209200
*/
210201
static char *
211202
win32_langinfo(const char *ctype)
212203
{
213204
char *r = NULL;
214-
215-
#if defined(_MSC_VER) && (_MSC_VER < 1900)
216-
_locale_t loct = NULL;
217-
218-
loct = _create_locale(LC_CTYPE, ctype);
219-
if (loct != NULL)
220-
{
221-
r = malloc(16); /* excess */
222-
if (r != NULL)
223-
sprintf(r, "CP%u", loct->locinfo->lc_codepage);
224-
_free_locale(loct);
225-
}
226-
#else
227205
char *codepage;
228206

229-
#if defined(_MSC_VER) && (_MSC_VER >= 1900)
207+
#if defined(_MSC_VER)
230208
uint32 cp;
231209
WCHAR wctype[LOCALE_NAME_MAX_LENGTH];
232210

@@ -279,7 +257,6 @@ win32_langinfo(const char *ctype)
279257
}
280258
}
281259
}
282-
#endif
283260

284261
return r;
285262
}

src/port/strtof.c

-9
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,6 @@ strtof(const char *nptr, char **endptr)
5454

5555
#elif HAVE_BUGGY_STRTOF
5656
/*
57-
* On Windows, there's a slightly different problem: VS2013 has a strtof()
58-
* that returns the correct results for valid input, but may fail to report an
59-
* error for underflow or overflow, returning 0 instead. Work around that by
60-
* trying strtod() when strtof() returns 0.0 or [+-]Inf, and calling it an
61-
* error if the result differs. Also, strtof() doesn't handle subnormal input
62-
* well, so prefer to round the strtod() result in such cases. (Normally we'd
63-
* just say "too bad" if strtof() doesn't support subnormals, but since we're
64-
* already in here fixing stuff, we might as well do the best fix we can.)
65-
*
6657
* Cygwin has a strtof() which is literally just (float)strtod(), which means
6758
* we can't avoid the double-rounding problem; but using this wrapper does get
6859
* us proper over/underflow checks. (Also, if they fix their strtof(), the

src/tools/msvc/MSBuildProject.pm

+1-26
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
package MSBuildProject;
55

66
#
7-
# Package that encapsulates a MSBuild project file (Visual C++ 2013 or greater)
7+
# Package that encapsulates a MSBuild project file (Visual C++ 2015 or greater)
88
#
99
# src/tools/msvc/MSBuildProject.pm
1010
#
@@ -405,31 +405,6 @@ EOF
405405
return;
406406
}
407407

408-
package VC2013Project;
409-
410-
#
411-
# Package that encapsulates a Visual C++ 2013 project file
412-
#
413-
414-
use strict;
415-
use warnings;
416-
use base qw(MSBuildProject);
417-
418-
no warnings qw(redefine); ## no critic
419-
420-
sub new
421-
{
422-
my $classname = shift;
423-
my $self = $classname->SUPER::_new(@_);
424-
bless($self, $classname);
425-
426-
$self->{vcver} = '12.00';
427-
$self->{PlatformToolset} = 'v120';
428-
$self->{ToolsVersion} = '12.0';
429-
430-
return $self;
431-
}
432-
433408
package VC2015Project;
434409

435410
#

src/tools/msvc/README

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ MSVC build
44
==========
55

66
This directory contains the tools required to build PostgreSQL using
7-
Microsoft Visual Studio 2013 - 2022. This builds the whole backend, not just
7+
Microsoft Visual Studio 2015 - 2022. This builds the whole backend, not just
88
the libpq frontend library. For more information, see the documentation
99
chapter "Installation on Windows" and the description below.
1010

@@ -67,7 +67,7 @@ Install.pm module containing the install logic
6767
Mkvcbuild.pm module containing the code to generate the Visual
6868
Studio build (project/solution) files
6969
MSBuildProject.pm module containing the code to generate MSBuild based
70-
project files (Visual Studio 2013 or greater)
70+
project files (Visual Studio 2015 or greater)
7171
Project.pm module containing the common code to generate the
7272
Visual Studio project files. Also provides the
7373
common interface of all project file generators
@@ -88,10 +88,10 @@ config_default.pl to create the configuration arguments.
8888
These configuration arguments are passed over to Mkvcbuild::mkvcbuild
8989
(Mkvcbuild.pm) which creates the Visual Studio project and solution files.
9090
It does this by using VSObjectFactory::CreateSolution to create an object
91-
implementing the Solution interface (this could be either VS2013Solution,
91+
implementing the Solution interface (this could be either
9292
VS2015Solution, VS2017Solution, VS2019Solution or VS2022Solution, all in
9393
Solution.pm, depending on the user's build environment) and adding objects
94-
implementing the corresponding Project interface (VC2013Project,
94+
implementing the corresponding Project interface (
9595
VC2015Project, VC2017Project, VC2019Project or VC2022Project from
9696
MSBuildProject.pm) to it. When Solution::Save is called, the implementations
9797
of Solution and Project save their content in the appropriate format.

src/tools/msvc/Solution.pm

-28
Original file line numberDiff line numberDiff line change
@@ -1263,34 +1263,6 @@ sub GetFakeConfigure
12631263
return $cfg;
12641264
}
12651265

1266-
package VS2013Solution;
1267-
1268-
#
1269-
# Package that encapsulates a Visual Studio 2013 solution file
1270-
#
1271-
1272-
use Carp;
1273-
use strict;
1274-
use warnings;
1275-
use base qw(Solution);
1276-
1277-
no warnings qw(redefine); ## no critic
1278-
1279-
sub new
1280-
{
1281-
my $classname = shift;
1282-
my $self = $classname->SUPER::_new(@_);
1283-
bless($self, $classname);
1284-
1285-
$self->{solutionFileVersion} = '12.00';
1286-
$self->{vcver} = '12.00';
1287-
$self->{visualStudioName} = 'Visual Studio 2013';
1288-
$self->{VisualStudioVersion} = '12.0.21005.1';
1289-
$self->{MinimumVisualStudioVersion} = '10.0.40219.1';
1290-
1291-
return $self;
1292-
}
1293-
12941266
package VS2015Solution;
12951267

12961268
#

src/tools/msvc/VSObjectFactory.pm

+2-10
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,7 @@ sub CreateSolution
3333
$visualStudioVersion = DetermineVisualStudioVersion();
3434
}
3535

36-
if ($visualStudioVersion eq '12.00')
37-
{
38-
return new VS2013Solution(@_);
39-
}
40-
elsif ($visualStudioVersion eq '14.00')
36+
if ($visualStudioVersion eq '14.00')
4137
{
4238
return new VS2015Solution(@_);
4339
}
@@ -87,11 +83,7 @@ sub CreateProject
8783
$visualStudioVersion = DetermineVisualStudioVersion();
8884
}
8985

90-
if ($visualStudioVersion eq '12.00')
91-
{
92-
return new VC2013Project(@_);
93-
}
94-
elsif ($visualStudioVersion eq '14.00')
86+
if ($visualStudioVersion eq '14.00')
9587
{
9688
return new VC2015Project(@_);
9789
}

0 commit comments

Comments
 (0)