Skip to content

Commit

Permalink
Remove support for unsupported MSVC versions (phpGH-17128)
Browse files Browse the repository at this point in the history
As of PHP 8.4.0, MSVC >= 1920 (aka. Visual Studio 2019 RTW 16.0) is
required anyway[1], so we can clean up a bit.

[1] <php@b3d6414>
  • Loading branch information
cmb69 authored Dec 12, 2024
1 parent 07cd468 commit 300811f
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 29 deletions.
3 changes: 0 additions & 3 deletions Zend/zend_config.w32.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@

#include <float.h>

#if _MSC_VER < 1900
#define snprintf _snprintf
#endif
#define strcasecmp(s1, s2) _stricmp(s1, s2)
#define strncasecmp(s1, s2, n) _strnicmp(s1, s2, n)

Expand Down
4 changes: 1 addition & 3 deletions Zend/zend_portability.h
Original file line number Diff line number Diff line change
Expand Up @@ -307,9 +307,7 @@ char *alloca();

#if defined(__GNUC__) && ZEND_GCC_VERSION >= 3004 && defined(__i386__)
# define ZEND_FASTCALL __attribute__((fastcall))
#elif defined(_MSC_VER) && defined(_M_IX86) && _MSC_VER == 1700
# define ZEND_FASTCALL __fastcall
#elif defined(_MSC_VER) && _MSC_VER >= 1800
#elif defined(_MSC_VER)
# define ZEND_FASTCALL __vectorcall
#else
# define ZEND_FASTCALL
Expand Down
2 changes: 1 addition & 1 deletion ext/openssl/openssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
/* Common */
#include <time.h>

#if (defined(PHP_WIN32) && defined(_MSC_VER) && _MSC_VER >= 1900)
#if (defined(PHP_WIN32) && defined(_MSC_VER))
#define timezone _timezone /* timezone is called _timezone in LibC */
#endif

Expand Down
2 changes: 1 addition & 1 deletion ext/soap/php_encoding.c
Original file line number Diff line number Diff line change
Expand Up @@ -2950,7 +2950,7 @@ static xmlNodePtr to_xml_datetime_ex(encodeTypePtr type, zval *data, char *forma
(ta->tm_gmtoff < 0) ? '-' : '+',
labs(ta->tm_gmtoff / 3600), labs( (ta->tm_gmtoff % 3600) / 60 ));
#else
# if defined(__CYGWIN__) || (defined(PHP_WIN32) && defined(_MSC_VER) && _MSC_VER >= 1900)
# if defined(__CYGWIN__) || (defined(PHP_WIN32) && defined(_MSC_VER))
snprintf(tzbuf, sizeof(tzbuf), "%c%02d:%02d", ((ta->tm_isdst ? _timezone - 3600:_timezone)>0)?'-':'+', abs((ta->tm_isdst ? _timezone - 3600 : _timezone) / 3600), abs(((ta->tm_isdst ? _timezone - 3600 : _timezone) % 3600) / 60));
# else
snprintf(tzbuf, sizeof(tzbuf), "%c%02d:%02d", ((ta->tm_isdst ? timezone - 3600:timezone)>0)?'-':'+', abs((ta->tm_isdst ? timezone - 3600 : timezone) / 3600), abs(((ta->tm_isdst ? timezone - 3600 : timezone) % 3600) / 60));
Expand Down
13 changes: 0 additions & 13 deletions ext/standard/string.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,21 +123,8 @@ PHPAPI struct lconv *localeconv_r(struct lconv *out)
tsrm_mutex_lock( locale_mutex );
#endif

/* cur->locinfo is struct __crt_locale_info which implementation is
hidden in vc14. TODO revisit this and check if a workaround available
and needed. */
#if defined(PHP_WIN32) && _MSC_VER < 1900 && defined(ZTS)
{
/* Even with the enabled per thread locale, localeconv
won't check any locale change in the master thread. */
_locale_t cur = _get_current_locale();
*out = *cur->locinfo->lconv;
_free_locale(cur);
}
#else
/* localeconv doesn't return an error condition */
*out = *localeconv();
#endif

#ifdef ZTS
tsrm_mutex_unlock( locale_mutex );
Expand Down
8 changes: 0 additions & 8 deletions win32/time.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,6 @@ struct itimerval {
struct timeval it_value; /* current value */
};

#if !defined(timespec) && _MSC_VER < 1900
struct timespec
{
time_t tv_sec; /* seconds */
long tv_nsec; /* nanoseconds */
};
#endif

#define ITIMER_REAL 0 /*generates sigalrm */
#define ITIMER_VIRTUAL 1 /*generates sigvtalrm */
#define ITIMER_VIRT 1 /*generates sigvtalrm */
Expand Down

0 comments on commit 300811f

Please sign in to comment.