Bug 1377948 Silence two warnings that occur as errors on the MinGW build draft
authorTom Ritter <tom@mozilla.com>
Mon, 03 Jul 2017 15:53:42 -0500
changeset 603351 238e7a7f7af3a667a66fec1db8aacbc2e82dbce3
parent 603344 b9601d0b48832365010292c044afe18779443454
child 635913 a4655008b5b1d51136a96d719fc0d4fc60b84b3a
push id66769
push userbmo:tom@mozilla.com
push dateMon, 03 Jul 2017 20:54:16 +0000
bugs1377948
milestone56.0a1
Bug 1377948 Silence two warnings that occur as errors on the MinGW build MozReview-Commit-ID: LQBAoLVpVab
js/src/moz.build
js/src/vm/Time.cpp
old mode 100644
new mode 100755
old mode 100644
new mode 100755
--- a/js/src/vm/Time.cpp
+++ b/js/src/vm/Time.cpp
@@ -264,18 +264,20 @@ size_t
 PRMJ_FormatTime(char* buf, int buflen, const char* fmt, PRMJTime* prtm)
 {
     size_t result = 0;
 #if defined(XP_UNIX) || defined(XP_WIN)
     struct tm a;
     int fake_tm_year = 0;
 #ifdef XP_WIN
     _invalid_parameter_handler oldHandler;
+#ifndef __MINGW32__
     int oldReportMode;
-#endif
+#endif // __MINGW32__
+#endif //XP_WIN
 
     memset(&a, 0, sizeof(struct tm));
 
     a.tm_sec = prtm->tm_sec;
     a.tm_min = prtm->tm_min;
     a.tm_hour = prtm->tm_hour;
     a.tm_mday = prtm->tm_mday;
     a.tm_mon = prtm->tm_mon;
@@ -338,25 +340,33 @@ PRMJ_FormatTime(char* buf, int buflen, c
      * Even with the above, SunOS 4 seems to detonate if tm_zone and tm_gmtoff
      * are null.  This doesn't quite work, though - the timezone is off by
      * tzoff + dst.  (And mktime seems to return -1 for the exact dst
      * changeover time.)
      */
 
 #ifdef XP_WIN
     oldHandler = _set_invalid_parameter_handler(PRMJ_InvalidParameterHandler);
+#ifndef __MINGW32__
+    /*
+     * MinGW doesn't have _CrtSetReportMode and defines it to be a no-op.
+     * We ifdef it off to avoid warnings about unused variables
+     */
     oldReportMode = _CrtSetReportMode(_CRT_ASSERT, 0);
-#endif
+#endif // __MINGW32__
+#endif // XP_WIN
 
     result = strftime(buf, buflen, fmt, &a);
 
 #ifdef XP_WIN
     _set_invalid_parameter_handler(oldHandler);
+#ifndef __MINGW32__
     _CrtSetReportMode(_CRT_ASSERT, oldReportMode);
-#endif
+#endif // __MINGW32__
+#endif // XP_WIN
 
     if (fake_tm_year && result) {
         char real_year[16];
         char fake_year[16];
         size_t real_year_len;
         size_t fake_year_len;
         char* p;