Skip to content

Commit 6b0eca0

Browse files
committed
Various fixes to allow support for new VS2014 features
- Added some typeof checks to handle JS errors introduced in VS2014 - Added VS2014 to the list of compilers - Changed to use stdint.h if we are using VS2014 or higher - Skip defining timespec if we're using VS2014 or higher - Moved u_char typedef out to always be defined regardless of VS version
1 parent e24c24c commit 6b0eca0

File tree

4 files changed

+28
-9
lines changed

4 files changed

+28
-9
lines changed

Zend/zend_config.w32.h

+2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ typedef unsigned int uint;
4747
#define HAVE_CLASS_ISTDIOSTREAM
4848
#define istdiostream stdiostream
4949

50+
#if _MSC_VER < 1900
5051
#define snprintf _snprintf
52+
#endif
5153
#if _MSC_VER < 1500
5254
#define vsnprintf _vsnprintf
5355
#endif

win32/build/confutils.js

+12-6
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ VC_VERSIONS[1500] = 'MSVC9 (Visual C++ 2008)';
4949
VC_VERSIONS[1600] = 'MSVC10 (Visual C++ 2010)';
5050
VC_VERSIONS[1700] = 'MSVC11 (Visual C++ 2012)';
5151
VC_VERSIONS[1800] = 'MSVC12 (Visual C++ 2013)';
52+
VC_VERSIONS[1900] = 'MSVC14 (Visual C++ 2014)';
5253

5354
var VC_VERSIONS_SHORT = new Array();
5455
VC_VERSIONS_SHORT[1200] = 'VC6';
@@ -59,6 +60,7 @@ VC_VERSIONS_SHORT[1500] = 'VC9';
5960
VC_VERSIONS_SHORT[1600] = 'VC10';
6061
VC_VERSIONS_SHORT[1700] = 'VC11';
6162
VC_VERSIONS_SHORT[1800] = 'VC12';
63+
VC_VERSIONS_SHORT[1900] = 'VC14';
6264

6365
if (PROGRAM_FILES == null) {
6466
PROGRAM_FILES = "C:\\Program Files";
@@ -1531,9 +1533,11 @@ function output_as_table(header, ar_out)
15311533
tmin = 0;
15321534
tmax = 0;
15331535
for (k = 0; k < ar_out.length; k++) {
1534-
var t = ar_out[k][j].length;
1535-
if (t > tmax) tmax = t;
1536-
else if (t < tmin) tmin = t;
1536+
if(typeof ar_out[k][j] != 'undefined') {
1537+
var t = ar_out[k][j].length;
1538+
if (t > tmax) tmax = t;
1539+
else if (t < tmin) tmin = t;
1540+
}
15371541
}
15381542
if (tmax > header[j].length) {
15391543
max[j] = tmax;
@@ -1574,8 +1578,10 @@ function output_as_table(header, ar_out)
15741578
line = ar_out[i];
15751579
for (j=0; j < l; j++) {
15761580
out += " " + line[j];
1577-
for (var k = 0; k < (max[j] - line[j].length); k++){
1578-
out += " ";
1581+
if(typeof line[j] != 'undefined') {
1582+
for (var k = 0; k < (max[j] - line[j].length); k++){
1583+
out += " ";
1584+
}
15791585
}
15801586
out += " |";
15811587
}
@@ -2052,7 +2058,7 @@ function AC_DEFINE(name, value, comment, quote)
20522058
}
20532059
if (quote && typeof(value) == "string") {
20542060
value = '"' + value.replace(new RegExp('(["\\\\])', "g"), '\\$1') + '"';
2055-
} else if (value.length == 0) {
2061+
} else if (typeof(value) != "undefined" && value.length == 0) {
20562062
value = '""';
20572063
}
20582064
var item = new Array(value, comment);

win32/php_stdint.h

+12-3
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@
3333
#error "Use this header only with Microsoft Visual C++ compilers!"
3434
#endif // _MSC_VER ]
3535

36+
// Starting with VS2014, many of the C11 features are now included, so we only
37+
// need many of these typedefs and defines for older VS suites
38+
#if _MSC_VER < 1900
39+
3640
#ifndef _MSC_STDINT_H_ // [
3741
#define _MSC_STDINT_H_
3842

@@ -85,9 +89,6 @@ typedef __int64 int64_t;
8589
#ifndef uint8_t
8690
typedef unsigned __int8 uint8_t;
8791
#endif
88-
#ifndef u_char
89-
typedef unsigned __int8 u_char;
90-
#endif
9192
typedef unsigned __int16 uint16_t;
9293
#ifndef uint32_t
9394
typedef unsigned __int32 uint32_t;
@@ -254,3 +255,11 @@ static __inline int64_t llabs(int64_t i)
254255

255256

256257
#endif // _MSC_STDINT_H_ ]
258+
259+
#else
260+
#include <stdint.h>
261+
#endif
262+
263+
#ifndef u_char
264+
typedef unsigned __int8 u_char;
265+
#endif

win32/time.h

+2
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,14 @@ struct itimerval {
2929
};
3030

3131
#ifndef timespec
32+
#if _MSC_VER < 1900
3233
struct timespec
3334
{
3435
time_t tv_sec; /* seconds */
3536
long tv_nsec; /* nanoseconds */
3637
};
3738
#endif
39+
#endif
3840

3941
#define ITIMER_REAL 0 /*generates sigalrm */
4042
#define ITIMER_VIRTUAL 1 /*generates sigvtalrm */

0 commit comments

Comments
 (0)