Increase MSVC warning level to 4.

There are some exceptions, a subset of the exceptions used by Chromium. They didn't seem to be useful warnings.

In code which we don't change much, like the preprocessor, I just suppressed the warnings in the specific files rather than changing the code.

There should be no functional changes in this patch.
Review URL: https://codereview.appspot.com/5570066

git-svn-id: https://angleproject.googlecode.com/svn/trunk@964 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/common/version.h b/src/common/version.h
index 2b3871d..a1db923 100644
--- a/src/common/version.h
+++ b/src/common/version.h
@@ -1,7 +1,7 @@
 #define MAJOR_VERSION 1
 #define MINOR_VERSION 0
 #define BUILD_VERSION 0
-#define BUILD_REVISION 963
+#define BUILD_REVISION 964
 
 #define STRINGIFY(x) #x
 #define MACRO_STRINGIFY(x) STRINGIFY(x)
diff --git a/src/compiler/ConstantUnion.h b/src/compiler/ConstantUnion.h
index d28a11b..fd9d94d 100644
--- a/src/compiler/ConstantUnion.h
+++ b/src/compiler/ConstantUnion.h
@@ -11,6 +11,10 @@
 
 class ConstantUnion {
 public:
+    ConstantUnion()
+    {
+        iConst = 0;
+    }
 
     POOL_ALLOCATOR_NEW_DELETE(GlobalPoolAllocator)        
     void setIConst(int i) {iConst = i; type = EbtInt; }
@@ -54,8 +58,6 @@
         default:
             return false;
         }
-
-        return false;
     }
 
     bool operator!=(const int i) const
@@ -89,8 +91,6 @@
         default:
             return false;   // Invalid operation, handled at semantic analysis
         }
-
-        return false;
     }
 
     bool operator<(const ConstantUnion& constant) const
@@ -104,8 +104,6 @@
         default:
             return false;   // Invalid operation, handled at semantic analysis
         }
-
-        return false;
     }
 
     ConstantUnion operator+(const ConstantUnion& constant) const
diff --git a/src/compiler/Intermediate.cpp b/src/compiler/Intermediate.cpp
index e1e8da2..ca6d8f7 100644
--- a/src/compiler/Intermediate.cpp
+++ b/src/compiler/Intermediate.cpp
@@ -1371,8 +1371,6 @@
         newNode->setLine(getLine());
         return newNode;
     }
-
-    return this;
 }
 
 TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermConstantUnion* node)
diff --git a/src/compiler/OutputHLSL.cpp b/src/compiler/OutputHLSL.cpp
index e10c81f..5400f8c 100644
--- a/src/compiler/OutputHLSL.cpp
+++ b/src/compiler/OutputHLSL.cpp
@@ -1032,8 +1032,6 @@
 
 bool OutputHLSL::visitUnary(Visit visit, TIntermUnary *node)
 {
-    TInfoSinkBase &out = mBody;
-
     switch (node->getOp())
     {
       case EOpNegative:         outputTriplet(visit, "(-", "", ")");  break;
@@ -1110,7 +1108,6 @@
 
 bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node)
 {
-    ShShaderType shaderType = mContext.shaderType;
     TInfoSinkBase &out = mBody;
 
     switch (node->getOp())
@@ -1839,7 +1836,6 @@
 
             while (iterations > 0)
             {
-                int remainder = (limit - initial) % increment;
                 int clampedLimit = initial + increment * std::min(255, iterations);
 
                 // for(int index = initial; index < clampedLimit; index += increment)
diff --git a/src/compiler/glslang.l b/src/compiler/glslang.l
index 3c88cc6..bade256 100644
--- a/src/compiler/glslang.l
+++ b/src/compiler/glslang.l
@@ -24,9 +24,13 @@
 
 // Ignore errors in auto-generated code.
 #if defined(__GNUC__)
+#pragma GCC diagnostic ignored "-Wunused-function"
 #pragma GCC diagnostic ignored "-Wunused-variable"
 #elif defined(_MSC_VER)
 #pragma warning(disable: 4065)
+#pragma warning(disable: 4189)
+#pragma warning(disable: 4505)
+#pragma warning(disable: 4701)
 #endif
 }
 
diff --git a/src/compiler/glslang.y b/src/compiler/glslang.y
index bf3c124..b27d731 100644
--- a/src/compiler/glslang.y
+++ b/src/compiler/glslang.y
@@ -24,9 +24,13 @@
 
 // Ignore errors in auto-generated code.
 #if defined(__GNUC__)
+#pragma GCC diagnostic ignored "-Wunused-function"
 #pragma GCC diagnostic ignored "-Wunused-variable"
 #elif defined(_MSC_VER)
 #pragma warning(disable: 4065)
+#pragma warning(disable: 4189)
+#pragma warning(disable: 4505)
+#pragma warning(disable: 4701)
 #endif
 
 #include "compiler/SymbolTable.h"
diff --git a/src/compiler/glslang_lex.cpp b/src/compiler/glslang_lex.cpp
index 655a7bb..75659f8 100644
--- a/src/compiler/glslang_lex.cpp
+++ b/src/compiler/glslang_lex.cpp
@@ -9,14 +9,18 @@
 
 // Ignore errors in auto-generated code.
 #if defined(__GNUC__)
+#pragma GCC diagnostic ignored "-Wunused-function"
 #pragma GCC diagnostic ignored "-Wunused-variable"
 #elif defined(_MSC_VER)
 #pragma warning(disable: 4065)
+#pragma warning(disable: 4189)
+#pragma warning(disable: 4505)
+#pragma warning(disable: 4701)
 #endif
 
 
 
-#line 20 "./glslang_lex.cpp"
+#line 24 "./glslang_lex.cpp"
 
 #define  YY_INT_ALIGNED short int
 
diff --git a/src/compiler/glslang_tab.cpp b/src/compiler/glslang_tab.cpp
index cfce783..9847bd7 100644
--- a/src/compiler/glslang_tab.cpp
+++ b/src/compiler/glslang_tab.cpp
@@ -272,9 +272,13 @@
 
 // Ignore errors in auto-generated code.
 #if defined(__GNUC__)
+#pragma GCC diagnostic ignored "-Wunused-function"
 #pragma GCC diagnostic ignored "-Wunused-variable"
 #elif defined(_MSC_VER)
 #pragma warning(disable: 4065)
+#pragma warning(disable: 4189)
+#pragma warning(disable: 4505)
+#pragma warning(disable: 4701)
 #endif
 
 #include "compiler/SymbolTable.h"
@@ -742,26 +746,26 @@
 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
 static const yytype_uint16 yyrline[] =
 {
-       0,   160,   160,   195,   198,   211,   216,   221,   227,   230,
-     303,   306,   415,   425,   438,   446,   545,   548,   556,   560,
-     567,   571,   578,   584,   593,   601,   656,   663,   673,   676,
-     686,   696,   717,   718,   719,   724,   725,   734,   746,   747,
-     755,   766,   770,   771,   781,   791,   801,   814,   815,   825,
-     838,   842,   846,   850,   851,   864,   865,   878,   879,   892,
-     893,   910,   911,   924,   925,   926,   927,   928,   932,   935,
-     946,   954,   979,   984,   991,  1027,  1030,  1037,  1045,  1066,
-    1085,  1096,  1125,  1130,  1140,  1145,  1155,  1158,  1161,  1164,
-    1170,  1177,  1180,  1196,  1214,  1238,  1261,  1265,  1283,  1291,
-    1323,  1343,  1419,  1428,  1451,  1454,  1460,  1468,  1476,  1484,
-    1494,  1501,  1504,  1507,  1513,  1516,  1531,  1535,  1539,  1543,
-    1552,  1557,  1562,  1567,  1572,  1577,  1582,  1587,  1592,  1597,
-    1603,  1609,  1615,  1620,  1625,  1634,  1643,  1648,  1661,  1661,
-    1675,  1675,  1684,  1687,  1702,  1738,  1742,  1748,  1756,  1772,
-    1776,  1780,  1781,  1787,  1788,  1789,  1790,  1791,  1795,  1796,
-    1796,  1796,  1806,  1807,  1812,  1815,  1825,  1828,  1834,  1835,
-    1839,  1847,  1851,  1861,  1866,  1883,  1883,  1888,  1888,  1895,
-    1895,  1903,  1906,  1912,  1915,  1921,  1925,  1932,  1939,  1946,
-    1953,  1964,  1973,  1977,  1984,  1987,  1993,  1993
+       0,   164,   164,   199,   202,   215,   220,   225,   231,   234,
+     307,   310,   419,   429,   442,   450,   549,   552,   560,   564,
+     571,   575,   582,   588,   597,   605,   660,   667,   677,   680,
+     690,   700,   721,   722,   723,   728,   729,   738,   750,   751,
+     759,   770,   774,   775,   785,   795,   805,   818,   819,   829,
+     842,   846,   850,   854,   855,   868,   869,   882,   883,   896,
+     897,   914,   915,   928,   929,   930,   931,   932,   936,   939,
+     950,   958,   983,   988,   995,  1031,  1034,  1041,  1049,  1070,
+    1089,  1100,  1129,  1134,  1144,  1149,  1159,  1162,  1165,  1168,
+    1174,  1181,  1184,  1200,  1218,  1242,  1265,  1269,  1287,  1295,
+    1327,  1347,  1423,  1432,  1455,  1458,  1464,  1472,  1480,  1488,
+    1498,  1505,  1508,  1511,  1517,  1520,  1535,  1539,  1543,  1547,
+    1556,  1561,  1566,  1571,  1576,  1581,  1586,  1591,  1596,  1601,
+    1607,  1613,  1619,  1624,  1629,  1638,  1647,  1652,  1665,  1665,
+    1679,  1679,  1688,  1691,  1706,  1742,  1746,  1752,  1760,  1776,
+    1780,  1784,  1785,  1791,  1792,  1793,  1794,  1795,  1799,  1800,
+    1800,  1800,  1810,  1811,  1816,  1819,  1829,  1832,  1838,  1839,
+    1843,  1851,  1855,  1865,  1870,  1887,  1887,  1892,  1892,  1899,
+    1899,  1907,  1910,  1916,  1919,  1925,  1929,  1936,  1943,  1950,
+    1957,  1968,  1977,  1981,  1988,  1991,  1997,  1997
 };
 #endif
 
diff --git a/src/compiler/preprocessor/cpp.c b/src/compiler/preprocessor/cpp.c
index 03dd4f6..13a5df1 100644
--- a/src/compiler/preprocessor/cpp.c
+++ b/src/compiler/preprocessor/cpp.c
@@ -53,6 +53,12 @@
 
 #include "compiler/preprocessor/slglobals.h"
 
+#if defined(_MSC_VER)
+#pragma warning(disable: 4054)
+#pragma warning(disable: 4152)
+#pragma warning(disable: 4706)
+#endif
+
 static int CPPif(yystypepp * yylvalpp);
 
 /* Don't use memory.c's replacements, as we clean up properly here */
diff --git a/src/compiler/preprocessor/memory.c b/src/compiler/preprocessor/memory.c
index e6fea7a..029521a 100644
--- a/src/compiler/preprocessor/memory.c
+++ b/src/compiler/preprocessor/memory.c
@@ -52,6 +52,10 @@
 
 #include "compiler/preprocessor/memory.h"
 
+#if defined(_MSC_VER)
+#pragma warning(disable: 4706)
+#endif
+
 // default alignment and chunksize, if called with 0 arguments
 #define CHUNKSIZE       (64*1024)
 #define ALIGN           8
diff --git a/src/compiler/preprocessor/scanner.c b/src/compiler/preprocessor/scanner.c
index deedb43..60b66bd 100644
--- a/src/compiler/preprocessor/scanner.c
+++ b/src/compiler/preprocessor/scanner.c
@@ -665,8 +665,6 @@
             return 0;
         }
     }
-
-    return 0;
 } // yylex
 
 //Checks if the token just read is EOF or not.
diff --git a/src/compiler/preprocessor/symbols.c b/src/compiler/preprocessor/symbols.c
index 5baedf5..f18b256 100644
--- a/src/compiler/preprocessor/symbols.c
+++ b/src/compiler/preprocessor/symbols.c
@@ -51,6 +51,10 @@
 
 #include "compiler/preprocessor/slglobals.h"
 
+#if defined(_MSC_VER)
+#pragma warning(disable: 4706)
+#endif
+
 ///////////////////////////////////////////////////////////////////////////////////////////////
 /////////////////////////////////// Symbol Table Variables: ///////////////////////////////////
 ///////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/compiler/preprocessor/tokens.c b/src/compiler/preprocessor/tokens.c
index aa83d2f..d658c12 100644
--- a/src/compiler/preprocessor/tokens.c
+++ b/src/compiler/preprocessor/tokens.c
@@ -54,6 +54,11 @@
 #include "compiler/preprocessor/slglobals.h"
 #include "compiler/util.h"
 
+#if defined(_MSC_VER)
+#pragma warning(disable: 4054)
+#pragma warning(disable: 4152)
+#endif
+
 ///////////////////////////////////////////////////////////////////////////////////////////////
 //////////////////////// Preprocessor and Token Recorder and Playback: ////////////////////////
 ///////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/compiler/translator_common.vcproj b/src/compiler/translator_common.vcproj
index 46056a1..c7e7faf 100644
--- a/src/compiler/translator_common.vcproj
+++ b/src/compiler/translator_common.vcproj
@@ -50,7 +50,8 @@
 				BasicRuntimeChecks="3"

 				RuntimeLibrary="1"

 				UsePrecompiledHeader="0"

-				WarningLevel="3"

+				WarningLevel="4"

+				DisableSpecificWarnings="4100;4127;4189;4239;4244;4245;4389;4512;4702;4718"

 				Detect64BitPortabilityProblems="false"

 				DebugInformationFormat="4"

 				WarnAsError="true"

@@ -114,7 +115,8 @@
 				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;_SECURE_SCL=0"

 				RuntimeLibrary="0"

 				UsePrecompiledHeader="0"

-				WarningLevel="3"

+				WarningLevel="4"

+				DisableSpecificWarnings="4100;4127;4189;4239;4244;4245;4389;4512;4702;4718"

 				Detect64BitPortabilityProblems="false"

 				DebugInformationFormat="3"

 				WarnAsError="true"

@@ -179,7 +181,8 @@
 				BasicRuntimeChecks="3"

 				RuntimeLibrary="1"

 				UsePrecompiledHeader="0"

-				WarningLevel="3"

+				WarningLevel="4"

+				DisableSpecificWarnings="4100;4127;4189;4239;4244;4245;4389;4512;4702;4718"

 				Detect64BitPortabilityProblems="false"

 				DebugInformationFormat="3"

 				WarnAsError="true"

@@ -244,7 +247,8 @@
 				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;_SECURE_SCL=0"

 				RuntimeLibrary="0"

 				UsePrecompiledHeader="0"

-				WarningLevel="3"

+				WarningLevel="4"

+				DisableSpecificWarnings="4100;4127;4189;4239;4244;4245;4389;4512;4702;4718"

 				Detect64BitPortabilityProblems="false"

 				DebugInformationFormat="3"

 				WarnAsError="true"

diff --git a/src/compiler/translator_hlsl.vcproj b/src/compiler/translator_hlsl.vcproj
index 5c59504..708a3bd 100644
--- a/src/compiler/translator_hlsl.vcproj
+++ b/src/compiler/translator_hlsl.vcproj
@@ -50,7 +50,8 @@
 				BasicRuntimeChecks="3"

 				RuntimeLibrary="1"

 				UsePrecompiledHeader="0"

-				WarningLevel="3"

+				WarningLevel="4"

+				DisableSpecificWarnings="4100;4127;4189;4239;4244;4245;4389;4512;4702;4718"

 				DebugInformationFormat="4"

 				WarnAsError="true"

 			/>

@@ -115,7 +116,8 @@
 				RuntimeLibrary="0"

 				EnableFunctionLevelLinking="true"

 				UsePrecompiledHeader="0"

-				WarningLevel="3"

+				WarningLevel="4"

+				DisableSpecificWarnings="4100;4127;4189;4239;4244;4245;4389;4512;4702;4718"

 				DebugInformationFormat="3"

 				WarnAsError="true"

 			/>

@@ -179,7 +181,8 @@
 				BasicRuntimeChecks="3"

 				RuntimeLibrary="1"

 				UsePrecompiledHeader="0"

-				WarningLevel="3"

+				WarningLevel="4"

+				DisableSpecificWarnings="4100;4127;4189;4239;4244;4245;4389;4512;4702;4718"

 				DebugInformationFormat="3"

 				WarnAsError="true"

 			/>

@@ -245,7 +248,8 @@
 				RuntimeLibrary="0"

 				EnableFunctionLevelLinking="true"

 				UsePrecompiledHeader="0"

-				WarningLevel="3"

+				WarningLevel="4"

+				DisableSpecificWarnings="4100;4127;4189;4239;4244;4245;4389;4512;4702;4718"

 				DebugInformationFormat="3"

 				WarnAsError="true"

 			/>

diff --git a/src/libEGL/libEGL.cpp b/src/libEGL/libEGL.cpp
index fffda78..4b7f9e1 100644
--- a/src/libEGL/libEGL.cpp
+++ b/src/libEGL/libEGL.cpp
@@ -105,8 +105,6 @@
     {
         return error(EGL_BAD_ALLOC, EGL_NO_DISPLAY);
     }
-
-    return EGL_NO_DISPLAY;
 }
 
 EGLBoolean __stdcall eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
@@ -137,8 +135,6 @@
     {
         return error(EGL_BAD_ALLOC, EGL_FALSE);
     }
-
-    return EGL_FALSE;
 }
 
 EGLBoolean __stdcall eglTerminate(EGLDisplay dpy)
@@ -162,8 +158,6 @@
     {
         return error(EGL_BAD_ALLOC, EGL_FALSE);
     }
-
-    return EGL_FALSE;
 }
 
 const char *__stdcall eglQueryString(EGLDisplay dpy, EGLint name)
@@ -197,8 +191,6 @@
     {
         return error(EGL_BAD_ALLOC, (const char*)NULL);
     }
-
-    return NULL;
 }
 
 EGLBoolean __stdcall eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config)
@@ -234,8 +226,6 @@
     {
         return error(EGL_BAD_ALLOC, EGL_FALSE);
     }
-
-    return EGL_FALSE;
 }
 
 EGLBoolean __stdcall eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config)
@@ -273,8 +263,6 @@
     {
         return error(EGL_BAD_ALLOC, EGL_FALSE);
     }
-
-    return EGL_FALSE;
 }
 
 EGLBoolean __stdcall eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value)
@@ -302,8 +290,6 @@
     {
         return error(EGL_BAD_ALLOC, EGL_FALSE);
     }
-
-    return EGL_FALSE;
 }
 
 EGLSurface __stdcall eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list)
@@ -333,8 +319,6 @@
     {
         return error(EGL_BAD_ALLOC, EGL_NO_SURFACE);
     }
-
-    return EGL_NO_SURFACE;
 }
 
 EGLSurface __stdcall eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list)
@@ -357,8 +341,6 @@
     {
         return error(EGL_BAD_ALLOC, EGL_NO_SURFACE);
     }
-
-    return EGL_NO_SURFACE;
 }
 
 EGLSurface __stdcall eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list)
@@ -383,8 +365,6 @@
     {
         return error(EGL_BAD_ALLOC, EGL_NO_SURFACE);
     }
-
-    return EGL_NO_SURFACE;
 }
 
 EGLBoolean __stdcall eglDestroySurface(EGLDisplay dpy, EGLSurface surface)
@@ -414,8 +394,6 @@
     {
         return error(EGL_BAD_ALLOC, EGL_FALSE);
     }
-
-    return EGL_FALSE;
 }
 
 EGLBoolean __stdcall eglQuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value)
@@ -501,8 +479,6 @@
     {
         return error(EGL_BAD_ALLOC, EGL_FALSE);
     }
-
-    return EGL_FALSE;
 }
 
 EGLBoolean __stdcall eglQuerySurfacePointerANGLE(EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value)
@@ -540,8 +516,6 @@
     {
         return error(EGL_BAD_ALLOC, EGL_FALSE);
     }
-
-    return EGL_FALSE;
 }
 
 EGLBoolean __stdcall eglBindAPI(EGLenum api)
@@ -569,8 +543,6 @@
     {
         return error(EGL_BAD_ALLOC, EGL_FALSE);
     }
-
-    return EGL_FALSE;
 }
 
 EGLenum __stdcall eglQueryAPI(void)
@@ -587,8 +559,6 @@
     {
         return error(EGL_BAD_ALLOC, EGL_FALSE);
     }
-
-    return EGL_FALSE;
 }
 
 EGLBoolean __stdcall eglWaitClient(void)
@@ -605,8 +575,6 @@
     {
         return error(EGL_BAD_ALLOC, EGL_FALSE);
     }
-
-    return EGL_FALSE;
 }
 
 EGLBoolean __stdcall eglReleaseThread(void)
@@ -623,8 +591,6 @@
     {
         return error(EGL_BAD_ALLOC, EGL_FALSE);
     }
-
-    return EGL_FALSE;
 }
 
 EGLSurface __stdcall eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list)
@@ -653,8 +619,6 @@
     {
         return error(EGL_BAD_ALLOC, EGL_NO_SURFACE);
     }
-
-    return EGL_NO_SURFACE;
 }
 
 EGLBoolean __stdcall eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value)
@@ -680,8 +644,6 @@
     {
         return error(EGL_BAD_ALLOC, EGL_FALSE);
     }
-
-    return EGL_FALSE;
 }
 
 EGLBoolean __stdcall eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
@@ -729,8 +691,6 @@
     {
         return error(EGL_BAD_ALLOC, EGL_FALSE);
     }
-
-    return EGL_FALSE;
 }
 
 EGLBoolean __stdcall eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
@@ -775,8 +735,6 @@
     {
         return error(EGL_BAD_ALLOC, EGL_FALSE);
     }
-
-    return EGL_FALSE;
 }
 
 EGLBoolean __stdcall eglSwapInterval(EGLDisplay dpy, EGLint interval)
@@ -807,8 +765,6 @@
     {
         return error(EGL_BAD_ALLOC, EGL_FALSE);
     }
-
-    return EGL_FALSE;
 }
 
 EGLContext __stdcall eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list)
@@ -836,7 +792,7 @@
                     if (attribute[1] == EGL_TRUE)
                     {
                         return error(EGL_BAD_CONFIG, EGL_NO_CONTEXT);   // Unimplemented
-                        robust_access = true;
+                        // robust_access = true;
                     }
                     else if (attribute[1] != EGL_FALSE)
                         return error(EGL_BAD_ATTRIBUTE, EGL_NO_CONTEXT);
@@ -881,8 +837,6 @@
     {
         return error(EGL_BAD_ALLOC, EGL_NO_CONTEXT);
     }
-
-    return EGL_NO_CONTEXT;
 }
 
 EGLBoolean __stdcall eglDestroyContext(EGLDisplay dpy, EGLContext ctx)
@@ -912,8 +866,6 @@
     {
         return error(EGL_BAD_ALLOC, EGL_FALSE);
     }
-
-    return EGL_FALSE;
 }
 
 EGLBoolean __stdcall eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx)
@@ -954,9 +906,6 @@
             UNIMPLEMENTED();   // FIXME
         }
 
-        egl::Surface* previousDraw = static_cast<egl::Surface*>(egl::getCurrentDrawSurface());
-        egl::Surface* previousRead = static_cast<egl::Surface*>(egl::getCurrentReadSurface());
-
         egl::setCurrentDisplay(dpy);
         egl::setCurrentDrawSurface(draw);
         egl::setCurrentReadSurface(read);
@@ -969,8 +918,6 @@
     {
         return error(EGL_BAD_ALLOC, EGL_FALSE);
     }
-
-    return EGL_FALSE;
 }
 
 EGLContext __stdcall eglGetCurrentContext(void)
@@ -987,8 +934,6 @@
     {
         return error(EGL_BAD_ALLOC, EGL_NO_CONTEXT);
     }
-
-    return EGL_NO_CONTEXT;
 }
 
 EGLSurface __stdcall eglGetCurrentSurface(EGLint readdraw)
@@ -1016,8 +961,6 @@
     {
         return error(EGL_BAD_ALLOC, EGL_NO_SURFACE);
     }
-
-    return EGL_NO_SURFACE;
 }
 
 EGLDisplay __stdcall eglGetCurrentDisplay(void)
@@ -1034,8 +977,6 @@
     {
         return error(EGL_BAD_ALLOC, EGL_NO_DISPLAY);
     }
-
-    return EGL_NO_DISPLAY;
 }
 
 EGLBoolean __stdcall eglQueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value)
@@ -1061,8 +1002,6 @@
     {
         return error(EGL_BAD_ALLOC, EGL_FALSE);
     }
-
-    return EGL_FALSE;
 }
 
 EGLBoolean __stdcall eglWaitGL(void)
@@ -1079,8 +1018,6 @@
     {
         return error(EGL_BAD_ALLOC, EGL_FALSE);
     }
-
-    return EGL_FALSE;
 }
 
 EGLBoolean __stdcall eglWaitNative(EGLint engine)
@@ -1097,8 +1034,6 @@
     {
         return error(EGL_BAD_ALLOC, EGL_FALSE);
     }
-
-    return EGL_FALSE;
 }
 
 EGLBoolean __stdcall eglSwapBuffers(EGLDisplay dpy, EGLSurface surface)
@@ -1165,8 +1100,6 @@
     {
         return error(EGL_BAD_ALLOC, EGL_FALSE);
     }
-
-    return EGL_FALSE;
 }
 
 EGLBoolean __stdcall eglPostSubBufferNV(EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height)
@@ -1239,7 +1172,5 @@
     {
         return error(EGL_BAD_ALLOC, (__eglMustCastToProperFunctionPointerType)NULL);
     }
-
-    return NULL;
 }
 }
diff --git a/src/libEGL/libEGL.vcproj b/src/libEGL/libEGL.vcproj
index 4a25426..f90944f 100644
--- a/src/libEGL/libEGL.vcproj
+++ b/src/libEGL/libEGL.vcproj
@@ -50,7 +50,8 @@
 				BasicRuntimeChecks="3"

 				RuntimeLibrary="1"

 				UsePrecompiledHeader="0"

-				WarningLevel="3"

+				WarningLevel="4"

+				DisableSpecificWarnings="4100;4127;4189;4239;4244;4245;4389;4512;4702;4718"

 				Detect64BitPortabilityProblems="false"

 				DebugInformationFormat="4"

 				WarnAsError="true"

@@ -130,7 +131,8 @@
 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBEGL_EXPORTS;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;_SECURE_SCL=0"

 				RuntimeLibrary="0"

 				UsePrecompiledHeader="0"

-				WarningLevel="3"

+				WarningLevel="4"

+				DisableSpecificWarnings="4100;4127;4189;4239;4244;4245;4389;4512;4702;4718"

 				Detect64BitPortabilityProblems="false"

 				DebugInformationFormat="3"

 				WarnAsError="true"

@@ -213,7 +215,8 @@
 				BasicRuntimeChecks="3"

 				RuntimeLibrary="1"

 				UsePrecompiledHeader="0"

-				WarningLevel="3"

+				WarningLevel="4"

+				DisableSpecificWarnings="4100;4127;4189;4239;4244;4245;4389;4512;4702;4718"

 				Detect64BitPortabilityProblems="false"

 				DebugInformationFormat="3"

 				WarnAsError="true"

@@ -294,7 +297,8 @@
 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBEGL_EXPORTS;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;_SECURE_SCL=0"

 				RuntimeLibrary="0"

 				UsePrecompiledHeader="0"

-				WarningLevel="3"

+				WarningLevel="4"

+				DisableSpecificWarnings="4100;4127;4189;4239;4244;4245;4389;4512;4702;4718"

 				Detect64BitPortabilityProblems="false"

 				DebugInformationFormat="3"

 				WarnAsError="true"

diff --git a/src/libGLESv2/Buffer.h b/src/libGLESv2/Buffer.h
index 07c0aa2..7019c4e 100644
--- a/src/libGLESv2/Buffer.h
+++ b/src/libGLESv2/Buffer.h
@@ -48,12 +48,12 @@
     DISALLOW_COPY_AND_ASSIGN(Buffer);
 
     GLubyte *mContents;
-    size_t mSize;
+    GLsizeiptr mSize;
     GLenum mUsage;
 
     StaticVertexBuffer *mStaticVertexBuffer;
     StaticIndexBuffer *mStaticIndexBuffer;
-    size_t mUnmodifiedDataUse;
+    GLsizeiptr mUnmodifiedDataUse;
 };
 
 }
diff --git a/src/libGLESv2/Context.cpp b/src/libGLESv2/Context.cpp
index fe544ca..b00e40c 100644
--- a/src/libGLESv2/Context.cpp
+++ b/src/libGLESv2/Context.cpp
@@ -1192,6 +1192,7 @@
         break;
       default: 
         ASSERT(false);
+        return;
     }
 
     Query *queryObject = getQuery(query, true, target);
@@ -1229,6 +1230,7 @@
         break;
       default: 
         ASSERT(false);
+        return;
     }
 
     Query *queryObject = mState.activeQuery[qType].get();
@@ -2432,7 +2434,7 @@
     HRESULT result;
     IDirect3DSurface9 *systemSurface = NULL;
     bool directToPixels = getPackReverseRowOrder() && getPackAlignment() <= 4 && mDisplay->isD3d9ExDevice() &&
-                          x == 0 && y == 0 && width == desc.Width && height == desc.Height &&
+                          x == 0 && y == 0 && UINT(width) == desc.Width && UINT(height) == desc.Height &&
                           desc.Format == D3DFMT_A8R8G8B8 && format == GL_BGRA_EXT && type == GL_UNSIGNED_BYTE;
     if (directToPixels)
     {
@@ -2615,6 +2617,7 @@
               default:
                 UNIMPLEMENTED();   // FIXME
                 UNREACHABLE();
+                return;
             }
 
             switch (format)
@@ -3033,7 +3036,6 @@
 
 void Context::drawClosingLine(unsigned int first, unsigned int last, int minIndex)
 {
-    IDirect3DIndexBuffer9 *indexBuffer = NULL;
     bool succeeded = false;
     UINT offset;
 
diff --git a/src/libGLESv2/Program.cpp b/src/libGLESv2/Program.cpp
index bcab6f7..561852e 100644
--- a/src/libGLESv2/Program.cpp
+++ b/src/libGLESv2/Program.cpp
@@ -270,7 +270,7 @@
 
 GLint Program::getUniformLocation(std::string name)
 {
-    int subscript = 0;
+    unsigned int subscript = 0;
 
     // Strip any trailing array operator and retrieve the subscript
     size_t open = name.find_last_of('[');
diff --git a/src/libGLESv2/Texture.cpp b/src/libGLESv2/Texture.cpp
index 25d6abd..29177d2 100644
--- a/src/libGLESv2/Texture.cpp
+++ b/src/libGLESv2/Texture.cpp
@@ -2577,7 +2577,9 @@
       case GL_LINEAR_MIPMAP_LINEAR:
         mipmapping = true;
         break;
-      default: UNREACHABLE();
+      default:
+        UNREACHABLE();
+        return false;
     }
 
     if ((getInternalFormat() == GL_FLOAT && !getContext()->supportsFloat32LinearFilter()) ||
@@ -2746,9 +2748,6 @@
 
         if (mTexStorage != NULL)
         {
-            egl::Display *display = getDisplay();
-            IDirect3DDevice9 *device = display->getDevice();
-
             int levels = levelCount();
             for (int f = 0; f < 6; f++)
             {
diff --git a/src/libGLESv2/libGLESv2.cpp b/src/libGLESv2/libGLESv2.cpp
index e71ec28..73b7a2b 100644
--- a/src/libGLESv2/libGLESv2.cpp
+++ b/src/libGLESv2/libGLESv2.cpp
@@ -2980,7 +2980,11 @@
             {
                 attachmentObjectType = GL_TEXTURE;
             }
-            else UNREACHABLE();
+            else
+            {
+                UNREACHABLE();
+                return;
+            }
 
             switch (pname)
             {
@@ -3558,8 +3562,6 @@
     {
         return error(GL_OUT_OF_MEMORY, (GLubyte*)NULL);
     }
-
-    return NULL;
 }
 
 void __stdcall glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params)
diff --git a/src/libGLESv2/libGLESv2.vcproj b/src/libGLESv2/libGLESv2.vcproj
index c14a64b..b993305 100644
--- a/src/libGLESv2/libGLESv2.vcproj
+++ b/src/libGLESv2/libGLESv2.vcproj
@@ -50,7 +50,8 @@
 				BasicRuntimeChecks="3"
 				RuntimeLibrary="1"
 				UsePrecompiledHeader="0"
-				WarningLevel="3"
+				WarningLevel="4"
+				DisableSpecificWarnings="4100;4127;4189;4239;4244;4245;4389;4512;4702;4718"
 				Detect64BitPortabilityProblems="false"
 				DebugInformationFormat="4"
 				WarnAsError="true"
@@ -129,7 +130,8 @@
 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBGLESV2_EXPORTS;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;_SECURE_SCL=0"
 				RuntimeLibrary="0"
 				UsePrecompiledHeader="0"
-				WarningLevel="3"
+				WarningLevel="4"
+				DisableSpecificWarnings="4100;4127;4189;4239;4244;4245;4389;4512;4702;4718"
 				Detect64BitPortabilityProblems="false"
 				DebugInformationFormat="3"
 				WarnAsError="true"
@@ -212,7 +214,8 @@
 				BasicRuntimeChecks="3"
 				RuntimeLibrary="1"
 				UsePrecompiledHeader="0"
-				WarningLevel="3"
+				WarningLevel="4"
+				DisableSpecificWarnings="4100;4127;4189;4239;4244;4245;4389;4512;4702;4718"
 				Detect64BitPortabilityProblems="false"
 				DebugInformationFormat="3"
 				WarnAsError="true"
@@ -292,7 +295,8 @@
 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBGLESV2_EXPORTS;_CRT_SECURE_NO_DEPRECATE;NOMINMAX;_SECURE_SCL=0"
 				RuntimeLibrary="0"
 				UsePrecompiledHeader="0"
-				WarningLevel="3"
+				WarningLevel="4"
+				DisableSpecificWarnings="4100;4127;4189;4239;4244;4245;4389;4512;4702;4718"
 				Detect64BitPortabilityProblems="false"
 				DebugInformationFormat="3"
 				WarnAsError="true"