]> granicus.if.org Git - php/commitdiff
Various fixes to allow support for new VS2014 features
authorChris Tankersley <chris@ctankersley.com>
Thu, 2 Oct 2014 18:05:31 +0000 (11:05 -0700)
committerChris Tankersley <chris@ctankersley.com>
Wed, 5 Nov 2014 23:00:09 +0000 (18:00 -0500)
 - 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

Zend/zend_config.w32.h
win32/build/confutils.js
win32/php_stdint.h
win32/time.h

index 6ea67602b49826137219d091fe6641b7a90e68a8..5353064be1763b680735634a1243fe3cc2c6bbcd 100644 (file)
@@ -47,7 +47,9 @@ typedef unsigned int uint;
 #define HAVE_CLASS_ISTDIOSTREAM
 #define istdiostream stdiostream
 
+#if _MSC_VER < 1900
 #define snprintf _snprintf
+#endif
 #if _MSC_VER < 1500
 #define vsnprintf _vsnprintf
 #endif
index ae668fee260dcf3bdadf2f17707aed132974da56..c54ff68f8419641331c5468f4c2fda1958505915 100644 (file)
@@ -49,6 +49,7 @@ VC_VERSIONS[1500] = 'MSVC9 (Visual C++ 2008)';
 VC_VERSIONS[1600] = 'MSVC10 (Visual C++ 2010)';\r
 VC_VERSIONS[1700] = 'MSVC11 (Visual C++ 2012)';\r
 VC_VERSIONS[1800] = 'MSVC12 (Visual C++ 2013)';\r
+VC_VERSIONS[1900] = 'MSVC14 (Visual C++ 2014)';\r
 \r
 var VC_VERSIONS_SHORT = new Array();\r
 VC_VERSIONS_SHORT[1200] = 'VC6';\r
@@ -59,6 +60,7 @@ VC_VERSIONS_SHORT[1500] = 'VC9';
 VC_VERSIONS_SHORT[1600] = 'VC10';\r
 VC_VERSIONS_SHORT[1700] = 'VC11';\r
 VC_VERSIONS_SHORT[1800] = 'VC12';\r
+VC_VERSIONS_SHORT[1900] = 'VC14';\r
 \r
 if (PROGRAM_FILES == null) {\r
        PROGRAM_FILES = "C:\\Program Files";\r
@@ -1531,9 +1533,11 @@ function output_as_table(header, ar_out)
                tmin = 0;\r
                tmax = 0;\r
                for (k = 0; k < ar_out.length; k++) {\r
-                       var t = ar_out[k][j].length;\r
-                       if (t > tmax) tmax = t;\r
-                       else if (t < tmin) tmin = t;\r
+                       if(typeof ar_out[k][j] != 'undefined') {\r
+                               var t = ar_out[k][j].length;\r
+                               if (t > tmax) tmax = t;\r
+                               else if (t < tmin) tmin = t;\r
+                       }\r
                }\r
                if (tmax > header[j].length) {\r
                        max[j] = tmax;\r
@@ -1574,8 +1578,10 @@ function output_as_table(header, ar_out)
                line = ar_out[i];\r
                for (j=0; j < l; j++) {\r
                        out += " " + line[j];\r
-                       for (var k = 0; k < (max[j] - line[j].length); k++){\r
-                               out += " ";\r
+                       if(typeof line[j] != 'undefined') {\r
+                               for (var k = 0; k < (max[j] - line[j].length); k++){\r
+                                       out += " ";\r
+                               }\r
                        }\r
                        out += " |";\r
                }\r
@@ -2052,7 +2058,7 @@ function AC_DEFINE(name, value, comment, quote)
        }\r
        if (quote && typeof(value) == "string") {\r
                value = '"' + value.replace(new RegExp('(["\\\\])', "g"), '\\$1') + '"';\r
-       } else if (value.length == 0) {\r
+       } else if (typeof(value) != "undefined" && value.length == 0) {\r
                value = '""';\r
        }\r
        var item = new Array(value, comment);\r
index 71aec2a35807fc2957ec9513191a0869f715c823..d5b90ebe265e3c1d1975245c60e6b043965cc624 100644 (file)
 #error "Use this header only with Microsoft Visual C++ compilers!"
 #endif // _MSC_VER ]
 
+// Starting with VS2014, many of the C11 features are now included, so we only
+// need many of these typedefs and defines for older VS suites
+#if _MSC_VER < 1900
+
 #ifndef _MSC_STDINT_H_ // [
 #define _MSC_STDINT_H_
 
@@ -85,9 +89,6 @@ typedef __int64           int64_t;
 #ifndef uint8_t
 typedef unsigned __int8   uint8_t;
 #endif
-#ifndef u_char
-typedef unsigned __int8   u_char;
-#endif
 typedef unsigned __int16  uint16_t;
 #ifndef uint32_t
 typedef unsigned __int32  uint32_t;
@@ -254,3 +255,11 @@ static __inline int64_t llabs(int64_t i)
 
 
 #endif // _MSC_STDINT_H_ ]
+
+#else
+#include <stdint.h>
+#endif
+
+#ifndef u_char
+typedef unsigned __int8   u_char;
+#endif
index d5d86eb1ed78198abad45c09a6c339b4e823307c..c6679b6d9a49d77b6f553517e34516228e7857e8 100644 (file)
@@ -29,12 +29,14 @@ struct itimerval {
 };
 
 #ifndef timespec
+#if _MSC_VER < 1900
 struct timespec
 {
        time_t   tv_sec;   /* seconds */
        long     tv_nsec;  /* nanoseconds */
 };
 #endif
+#endif
 
 #define ITIMER_REAL    0               /*generates sigalrm */
 #define ITIMER_VIRTUAL 1               /*generates sigvtalrm */