Require MSVS 2015+ and remove checks for earlier versions

Simplify the code checking for _MSC_VER or __VISUALC__ or using
wxCHECK_VISUALC_VERSION() macro (which is not very useful any longer,
but keep it in case we need it again in the future).
This commit is contained in:
Vadim Zeitlin 2022-10-09 23:38:10 +02:00
parent 67b8ca5ef1
commit 924db833f4
26 changed files with 69 additions and 176 deletions

View file

@ -669,7 +669,7 @@
#define wxUSE_GRAPHICS_GDIPLUS wxUSE_GRAPHICS_CONTEXT
#if defined(_MSC_VER) && _MSC_VER >= 1600
#if defined(_MSC_VER)
#define wxUSE_GRAPHICS_DIRECT2D wxUSE_GRAPHICS_CONTEXT
#else
#cmakedefine01 wxUSE_GRAPHICS_DIRECT2D
@ -684,7 +684,7 @@
#cmakedefine01 wxUSE_ACTIVEX
#if defined(_MSC_VER) && _MSC_VER >= 1700 && !defined(_USING_V110_SDK71_)
#if defined(_MSC_VER)
#cmakedefine01 wxUSE_WINRT
#else
#cmakedefine01 wxUSE_WINRT

View file

@ -54,20 +54,8 @@
#ifdef wxMSVC_VERSION
#define wxCOMPILER_PREFIX wxCONCAT(vc, wxMSVC_VERSION)
#elif defined(wxMSVC_VERSION_AUTO) || defined(wxMSVC_VERSION_ABI_COMPAT)
#if _MSC_VER == 1300
#define wxCOMPILER_PREFIX vc70
#elif _MSC_VER == 1310
#define wxCOMPILER_PREFIX vc71
#elif _MSC_VER == 1400
#define wxCOMPILER_PREFIX vc80
#elif _MSC_VER == 1500
#define wxCOMPILER_PREFIX vc90
#elif _MSC_VER == 1600
#define wxCOMPILER_PREFIX vc100
#elif _MSC_VER == 1700
#define wxCOMPILER_PREFIX vc110
#elif _MSC_VER == 1800
#define wxCOMPILER_PREFIX vc120
#if _MSC_VER < 1900
#error "Unsupported MSVC compiler version, 2015 or later is required."
#elif _MSC_VER >= 1900 && _MSC_VER < 2000
#ifdef wxMSVC_VERSION_ABI_COMPAT
#define wxCOMPILER_PREFIX vc14x

View file

@ -35,18 +35,8 @@
define special symbols for different VC version instead of writing tests
for magic numbers such as 1200, 1300 &c repeatedly
*/
#if __VISUALC__ < 1400
# error "This Visual C++ version is not supported any longer (at least MSVC 2005 required)."
#elif __VISUALC__ < 1500
# define __VISUALC8__
#elif __VISUALC__ < 1600
# define __VISUALC9__
#elif __VISUALC__ < 1700
# define __VISUALC10__
#elif __VISUALC__ < 1800
# define __VISUALC11__
#elif __VISUALC__ < 1900
# define __VISUALC12__
#if __VISUALC__ < 1900
# error "This Visual C++ version is not supported any longer (at least MSVC 2015 required)."
#elif __VISUALC__ < 2000
/* There is no __VISUALC13__! */
# define __VISUALC14__

View file

@ -113,20 +113,6 @@
#if wxUSE_STD_CONTAINERS
# pragma warning(disable:4275)
#endif /* wxUSE_STD_CONTAINERS */
# ifdef __VISUALC5__
/* For VC++ 5.0 for release mode, the warning 'C4702: unreachable code */
/* is buggy, and occurs for code that does actually get executed */
# ifndef __WXDEBUG__
# pragma warning(disable:4702) /* unreachable code */
# endif
/* The VC++ 5.0 warning 'C4003: not enough actual parameters for macro'
* is incompatible with the wxWidgets headers since it is given when
* parameters are empty but not missing. */
# pragma warning(disable:4003) /* not enough actual parameters for macro */
# endif
/*
When compiling with VC++ 7 /Wp64 option we get thousands of warnings for
conversion from size_t to int or long. Some precious few of them might
@ -135,26 +121,22 @@
everywhere this method is used though we are quite sure that using >4GB
strings is a bad idea anyhow) so just disable it globally for now.
*/
#if wxCHECK_VISUALC_VERSION(7)
/* conversion from 'size_t' to 'unsigned long', possible loss of data */
#pragma warning(disable:4267)
#endif /* VC++ 7 or later */
/* conversion from 'size_t' to 'unsigned long', possible loss of data */
#pragma warning(disable:4267)
/*
VC++ 8 gives a warning when using standard functions such as sprintf,
localtime, ... -- stop this madness, unless the user had already done it
*/
#if wxCHECK_VISUALC_VERSION(8)
#ifndef _CRT_SECURE_NO_DEPRECATE
#define _CRT_SECURE_NO_DEPRECATE 1
#endif
#ifndef _CRT_NON_CONFORMING_SWPRINTFS
#define _CRT_NON_CONFORMING_SWPRINTFS 1
#endif
#ifndef _SCL_SECURE_NO_WARNINGS
#define _SCL_SECURE_NO_WARNINGS 1
#endif
#endif /* VC++ 8 */
#ifndef _CRT_SECURE_NO_DEPRECATE
#define _CRT_SECURE_NO_DEPRECATE 1
#endif
#ifndef _CRT_NON_CONFORMING_SWPRINTFS
#define _CRT_NON_CONFORMING_SWPRINTFS 1
#endif
#ifndef _SCL_SECURE_NO_WARNINGS
#define _SCL_SECURE_NO_WARNINGS 1
#endif
#endif /* __VISUALC__ */
/*
@ -310,7 +292,7 @@ typedef short int WXTYPE;
#elif defined(__clang__)
#define wx_truncate_cast(t, x) static_cast<t>(x)
#elif defined(__VISUALC__) && __VISUALC__ >= 1310
#elif defined(__VISUALC__)
template <typename T, typename X>
inline T wx_truncate_cast_impl(X x)
{
@ -549,7 +531,7 @@ typedef short int WXTYPE;
#endif
#elif defined(__GNUC__)
#define wxDEPRECATED_MSG(msg) __attribute__((deprecated(msg)))
#elif wxCHECK_VISUALC_VERSION(8)
#elif defined(__VISUALC__)
#define wxDEPRECATED_MSG(msg) __declspec(deprecated("deprecated: " msg))
#else
#define wxDEPRECATED_MSG(msg) wxDEPRECATED_DECL

View file

@ -71,8 +71,7 @@
/* This is defined when the compiler provides some type of extended locale
functions. Otherwise, we implement them ourselves to only support the
'C' locale */
#if defined(HAVE_LOCALE_T) || \
(wxCHECK_VISUALC_VERSION(8))
#if defined(HAVE_LOCALE_T) || defined(__VISUALC__)
#define wxHAS_XLOCALE_SUPPORT
#else
#undef wxHAS_XLOCALE_SUPPORT

View file

@ -138,7 +138,7 @@ enum wxPosixPermissions
#endif
// detect compilers which have support for huge stdio files
#if wxCHECK_VISUALC_VERSION(8)
#if defined(__VISUALC__)
#define wxHAS_HUGE_STDIO_FILES
#define wxFseek _fseeki64
#define wxFtell _ftelli64

View file

@ -1629,14 +1629,12 @@
// Enable support for Direct2D-based implementation of wxGraphicsContext.
//
// Default is 1 for compilers which support it, i.e. VC10+ currently. If you
// use an earlier MSVC version or another compiler and installed the necessary
// SDK components manually, you need to change this setting.
// Default is 1 for compilers which support it, i.e. MSVS currently. If you
// use another compiler and installed the necessary SDK components manually,
// you need to change this setting.
//
// Recommended setting: 1 for faster and better quality graphics under Windows
// 7 and later systems (if wxUSE_GRAPHICS_GDIPLUS is also enabled, earlier
// systems will fall back on using GDI+).
#if defined(_MSC_VER) && _MSC_VER >= 1600
// Recommended setting: 1 for faster and better quality graphics.
#if defined(_MSC_VER)
#define wxUSE_GRAPHICS_DIRECT2D wxUSE_GRAPHICS_CONTEXT
#else
#define wxUSE_GRAPHICS_DIRECT2D 0
@ -1683,12 +1681,10 @@
// Enable WinRT support
//
// Default is 1 for compilers which support it, i.e. VS2012+ currently. If you
// use an earlier MSVC version or another compiler and installed the necessary
// SDK components manually, you need to change this setting.
// Default is 1 for compilers which support it, i.e. MSVS currently.
//
// Recommended setting: 1
#if defined(_MSC_VER) && _MSC_VER >= 1700 && !defined(_USING_V110_SDK71_)
#if defined(_MSC_VER)
#define wxUSE_WINRT 1
#else
#define wxUSE_WINRT 0

View file

@ -133,27 +133,6 @@
# endif
#endif /* wxUSE_WINSOCK2 */
/*
* Unfortunately we can't use compiler TLS support if the library can be used
* inside a dynamically loaded DLL under Windows XP, as this can result in hard
* to diagnose crashes due to the bugs in Windows TLS support, see #13116.
*
* So we disable it unless we can be certain that the code will never run under
* XP, as is the case if we're using a compiler which doesn't support XP such
* as MSVC 11+, unless it's used with the special "_xp" toolset, in which case
* _USING_V110_SDK71_ is defined.
*
* However defining wxUSE_COMPILER_TLS as 2 overrides this safety check, see
* the comments in wx/setup.h.
*/
#if wxUSE_COMPILER_TLS == 1
#if !wxCHECK_VISUALC_VERSION(11) || defined(_USING_V110_SDK71_)
#undef wxUSE_COMPILER_TLS
#define wxUSE_COMPILER_TLS 0
#endif
#endif
/*
* disable the settings which don't work for some compilers
*/

View file

@ -37,15 +37,6 @@
#include <stdlib.h>
// Defining _CRTBLD should never be necessary at all, but keep it for now
// as there is no time to retest all the compilers before 3.0 release.
// Definitely do not use it with MSVS 2013 as defining it results in errors
// if the standard <assert.h> is included afterwards.
#if !defined(_CRTBLD) && !wxCHECK_VISUALC_VERSION(12)
// Needed when building with pure MS SDK
#define _CRTBLD
#endif
#include <crtdbg.h>
#undef WXDEBUG_NEW

View file

@ -1629,14 +1629,12 @@
// Enable support for Direct2D-based implementation of wxGraphicsContext.
//
// Default is 1 for compilers which support it, i.e. VC10+ currently. If you
// use an earlier MSVC version or another compiler and installed the necessary
// SDK components manually, you need to change this setting.
// Default is 1 for compilers which support it, i.e. MSVS currently. If you
// use another compiler and installed the necessary SDK components manually,
// you need to change this setting.
//
// Recommended setting: 1 for faster and better quality graphics under Windows
// 7 and later systems (if wxUSE_GRAPHICS_GDIPLUS is also enabled, earlier
// systems will fall back on using GDI+).
#if defined(_MSC_VER) && _MSC_VER >= 1600
// Recommended setting: 1 for faster and better quality graphics.
#if defined(_MSC_VER)
#define wxUSE_GRAPHICS_DIRECT2D wxUSE_GRAPHICS_CONTEXT
#else
#define wxUSE_GRAPHICS_DIRECT2D 0
@ -1683,12 +1681,10 @@
// Enable WinRT support
//
// Default is 1 for compilers which support it, i.e. VS2012+ currently. If you
// use an earlier MSVC version or another compiler and installed the necessary
// SDK components manually, you need to change this setting.
// Default is 1 for compilers which support it, i.e. MSVS currently.
//
// Recommended setting: 1
#if defined(_MSC_VER) && _MSC_VER >= 1700 && !defined(_USING_V110_SDK71_)
#if defined(_MSC_VER)
#define wxUSE_WINRT 1
#else
#define wxUSE_WINRT 0

View file

@ -23,14 +23,12 @@
// Enable support for Direct2D-based implementation of wxGraphicsContext.
//
// Default is 1 for compilers which support it, i.e. VC10+ currently. If you
// use an earlier MSVC version or another compiler and installed the necessary
// SDK components manually, you need to change this setting.
// Default is 1 for compilers which support it, i.e. MSVS currently. If you
// use another compiler and installed the necessary SDK components manually,
// you need to change this setting.
//
// Recommended setting: 1 for faster and better quality graphics under Windows
// 7 and later systems (if wxUSE_GRAPHICS_GDIPLUS is also enabled, earlier
// systems will fall back on using GDI+).
#if defined(_MSC_VER) && _MSC_VER >= 1600
// Recommended setting: 1 for faster and better quality graphics.
#if defined(_MSC_VER)
#define wxUSE_GRAPHICS_DIRECT2D wxUSE_GRAPHICS_CONTEXT
#else
#define wxUSE_GRAPHICS_DIRECT2D 0
@ -77,12 +75,10 @@
// Enable WinRT support
//
// Default is 1 for compilers which support it, i.e. VS2012+ currently. If you
// use an earlier MSVC version or another compiler and installed the necessary
// SDK components manually, you need to change this setting.
// Default is 1 for compilers which support it, i.e. MSVS currently.
//
// Recommended setting: 1
#if defined(_MSC_VER) && _MSC_VER >= 1700 && !defined(_USING_V110_SDK71_)
#if defined(_MSC_VER)
#define wxUSE_WINRT 1
#else
#define wxUSE_WINRT 0

View file

@ -462,7 +462,7 @@ wxPG_PROP_CLASS_SPECIFIC_3 = 0x00400000
#define wxPG_DEPRECATED_MACRO_VALUE(value, msg) value
#endif // clang || GCC
#if wxCHECK_VISUALC_VERSION(10) && !defined(WXBUILDING)
#if defined(__VISUALC__) && !defined(WXBUILDING)
#define wxPG_MUST_DEPRECATE_MACRO_NAME
#endif

View file

@ -2479,7 +2479,7 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
// The wxSTC_INDIC{0,1,2,S}_MASK values are no longer used in Scintilla
#if wxCHECK_VISUALC_VERSION(10)
#if defined(__VISUALC__)
#pragma deprecated(wxSTC_INDIC0_MASK, wxSTC_INDIC1_MASK, \
wxSTC_INDIC2_MASK, wxSTC_INDICS_MASK)
#endif
@ -2496,7 +2496,7 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
// The following entries have non-conformant prefixes.
#if wxCHECK_VISUALC_VERSION(10)
#if defined(__VISUALC__)
#pragma deprecated(wxSTC_SCMOD_NORM, wxSTC_SCMOD_SHIFT, wxSTC_SCMOD_CTRL, \
wxSTC_SCMOD_ALT, wxSTC_SCMOD_SUPER, wxSTC_SCMOD_META, \
wxSTC_SCVS_NONE, wxSTC_SCVS_RECTANGULARSELECTION, \

View file

@ -31,7 +31,7 @@
// RTTI well enough, so we can use it and work around harmless memory
// leaks reported by the static run-time libraries.
//
#if wxCHECK_VISUALC_VERSION(9)
#ifdef __VISUALC__
#define wxTRUST_CPP_RTTI 1
#else
#define wxTRUST_CPP_RTTI 0

View file

@ -1628,14 +1628,12 @@
// Enable support for Direct2D-based implementation of wxGraphicsContext.
//
// Default is 1 for compilers which support it, i.e. VC10+ currently. If you
// use an earlier MSVC version or another compiler and installed the necessary
// SDK components manually, you need to change this setting.
// Default is 1 for compilers which support it, i.e. MSVS currently. If you
// use another compiler and installed the necessary SDK components manually,
// you need to change this setting.
//
// Recommended setting: 1 for faster and better quality graphics under Windows
// 7 and later systems (if wxUSE_GRAPHICS_GDIPLUS is also enabled, earlier
// systems will fall back on using GDI+).
#if defined(_MSC_VER) && _MSC_VER >= 1600
// Recommended setting: 1 for faster and better quality graphics.
#if defined(_MSC_VER)
#define wxUSE_GRAPHICS_DIRECT2D wxUSE_GRAPHICS_CONTEXT
#else
#define wxUSE_GRAPHICS_DIRECT2D 0
@ -1682,12 +1680,10 @@
// Enable WinRT support
//
// Default is 1 for compilers which support it, i.e. VS2012+ currently. If you
// use an earlier MSVC version or another compiler and installed the necessary
// SDK components manually, you need to change this setting.
// Default is 1 for compilers which support it, i.e. MSVS currently.
//
// Recommended setting: 1
#if defined(_MSC_VER) && _MSC_VER >= 1700 && !defined(_USING_V110_SDK71_)
#if defined(_MSC_VER)
#define wxUSE_WINRT 1
#else
#define wxUSE_WINRT 0

View file

@ -126,7 +126,7 @@
/* Almost all compilers have strdup(), but VC++ and MinGW call it _strdup().
And we need to declare it manually for MinGW in strict ANSI mode. */
#if (defined(__VISUALC__) && __VISUALC__ >= 1400)
#if defined(__VISUALC__)
#define wxCRT_StrdupA _strdup
#elif defined(__MINGW32__)
wxDECL_FOR_STRICT_MINGW32(char*, _strdup, (const char *))
@ -202,9 +202,9 @@ extern unsigned long android_wcstoul(const wchar_t *nptr, wchar_t **endptr, int
#endif
/*
Only VC8 and later provide strnlen() and wcsnlen() functions under Windows.
Only MSVC provides strnlen() and wcsnlen() functions under Windows.
*/
#if wxCHECK_VISUALC_VERSION(8)
#ifdef __VISUALC__
#ifndef HAVE_STRNLEN
#define HAVE_STRNLEN
#endif

View file

@ -36,7 +36,7 @@
// The platform-specific locale type
// If wxXLocale_t is not defined, then only "C" locale support is provided
#ifdef wxHAS_XLOCALE_SUPPORT
#if wxCHECK_VISUALC_VERSION(8)
#if defined(__VISUALC__)
typedef _locale_t wxXLocale_t;
#define wxXLOCALE_IDENT(name) _ ## name
#elif defined(HAVE_LOCALE_T)

View file

@ -669,7 +669,7 @@
#define wxUSE_GRAPHICS_GDIPLUS wxUSE_GRAPHICS_CONTEXT
#if defined(_MSC_VER) && _MSC_VER >= 1600
#if defined(_MSC_VER)
#define wxUSE_GRAPHICS_DIRECT2D wxUSE_GRAPHICS_CONTEXT
#else
#define wxUSE_GRAPHICS_DIRECT2D 0
@ -684,7 +684,7 @@
#define wxUSE_ACTIVEX 0
#if defined(_MSC_VER) && _MSC_VER >= 1700 && !defined(_USING_V110_SDK71_)
#if defined(_MSC_VER)
#define wxUSE_WINRT 0
#else
#define wxUSE_WINRT 0

View file

@ -157,16 +157,9 @@ int wxGetTimeZone()
static bool s_tzSet = (_tzset(), true);
wxUnusedVar(s_tzSet);
// Starting with VC++ 8 timezone variable is deprecated and is not even
// available in some standard library version so use the new function for
// accessing it instead.
#if wxCHECK_VISUALC_VERSION(8)
long t;
_get_timezone(&t);
return t;
#else // VC++ < 8
return timezone;
#endif
long t;
_get_timezone(&t);
return t;
#else // Use some kind of time zone variable.
// In any case we must initialize the time zone before using it.
static bool s_tzSet = (tzset(), true);

View file

@ -98,7 +98,7 @@ wxXLocale::wxXLocale(wxLanguage lang)
}
#endif // wxUSE_INTL
#if wxCHECK_VISUALC_VERSION(8)
#if defined(__VISUALC__)
// ----------------------------------------------------------------------------
// implementation using MSVC locale API

View file

@ -49,12 +49,6 @@
#pragma warning(push)
#pragma warning(disable:4456)
#pragma warning(disable:4702)
// Also make nanosvg.h compile with older MSVC versions which didn't have
// strtoll().
#if _MSC_VER < 1800
#define strtoll _strtoi64
#endif
#endif
#if !wxUSE_NANOSVG_EXTERNAL || defined(wxUSE_NANOSVG_EXTERNAL_ENABLE_IMPL)

View file

@ -565,7 +565,7 @@ ID2D1Factory* wxD2D1Factory()
// https://msdn.microsoft.com/en-us/library/windows/desktop/ee794287(v=vs.85).aspx
// the Direct2D Debug Layer is only available starting with Windows 8
// and Visual Studio 2012.
#if defined(__WXDEBUG__) && defined(__VISUALC__) && wxCHECK_VISUALC_VERSION(11)
#if defined(__WXDEBUG__) && defined(__VISUALC__)
if ( wxTheAssertHandler && wxGetWinVersion() >= wxWinVersion_8 )
{
factoryOptions.debugLevel = D2D1_DEBUG_LEVEL_WARNING;

View file

@ -76,7 +76,7 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
// The wxSTC_INDIC{0,1,2,S}_MASK values are no longer used in Scintilla
#if wxCHECK_VISUALC_VERSION(10)
#if defined(__VISUALC__)
#pragma deprecated(wxSTC_INDIC0_MASK, wxSTC_INDIC1_MASK, \
wxSTC_INDIC2_MASK, wxSTC_INDICS_MASK)
#endif
@ -93,7 +93,7 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
// The following entries have non-conformant prefixes.
#if wxCHECK_VISUALC_VERSION(10)
#if defined(__VISUALC__)
#pragma deprecated(wxSTC_SCMOD_NORM, wxSTC_SCMOD_SHIFT, wxSTC_SCMOD_CTRL, \
wxSTC_SCMOD_ALT, wxSTC_SCMOD_SUPER, wxSTC_SCMOD_META, \
wxSTC_SCVS_NONE, wxSTC_SCVS_RECTANGULARSELECTION, \

View file

@ -1034,11 +1034,6 @@ void ArchiveTestCase<ClassFactoryT>::TestSmartIterator(wxInputStream& in)
template <class ClassFactoryT>
void ArchiveTestCase<ClassFactoryT>::TestSmartPairIterator(wxInputStream& in)
{
#if defined _MSC_VER && defined _MSC_VER < 1200
// With VC++ 5.0 the '=' operator of std::pair breaks when the second
// type is Ptr<EntryT>, so this iterator can't be made to work.
(void)in;
#else
typedef std::map<wxString, Ptr<EntryT> > ArchiveCatalog;
typedef typename ArchiveCatalog::iterator CatalogIter;
typedef wxArchiveIterator<InputStreamT,
@ -1052,7 +1047,6 @@ void ArchiveTestCase<ClassFactoryT>::TestSmartPairIterator(wxInputStream& in)
for (CatalogIter it = cat.begin(); it != cat.end(); ++it)
CPPUNIT_ASSERT(m_testEntries.count(it->second->GetName(wxPATH_UNIX)));
#endif
}
// try reading two entries at the same time

View file

@ -211,7 +211,7 @@ TEST_CASE("ArgsValidation", "[wxString][vararg][error]")
// default starting from VC8 and somehow even calling
// _set_printf_count_output() doesn't help here, so don't use "%n" at all
// with it.
#if wxCHECK_VISUALC_VERSION(8)
#if defined(__VISUALC__)
#define wxNO_PRINTF_PERCENT_N
#endif // VC8+

View file

@ -28,7 +28,7 @@
#define wxHAVE_U_ESCAPE
// and disable warning that using them results in with MSVC 8+
#if wxCHECK_VISUALC_VERSION(8)
#if defined(__VISUALC__)
// universal-character-name encountered in source
#pragma warning(disable:4428)
#endif
@ -48,8 +48,7 @@
(__MINGW64_VERSION_MAJOR == 5 && __MINGW64_VERSION_MINOR == 0 && __MINGW64_VERSION_BUGFIX >= 4)))
#define wxMINGW_WITH_FIXED_MANTISSA
#endif
#if (defined(__VISUALC__) && !wxCHECK_VISUALC_VERSION(14)) || \
(defined(__MINGW32__) && !defined(wxMINGW_WITH_FIXED_MANTISSA) && \
#if (defined(__MINGW32__) && !defined(wxMINGW_WITH_FIXED_MANTISSA) && \
(!defined(__USE_MINGW_ANSI_STDIO) || !__USE_MINGW_ANSI_STDIO))
#define wxDEFAULT_MANTISSA_SIZE_3
#endif