Revision: 10241
Author:   [email protected]
Date:     Tue Dec 13 05:02:08 2011
Log: Fix GCC 4.7 warnings, which are related to char being signed in GCC
("narrowing conversion ... inside { } is ill-formed in C++11").

* src/mksnapshot.cc: Cast "char" to "unsigned char" when outputting snapshot.
* test/cctest/test-regexp.cc: Use static_cast to uc16 as the char
literal is signed.

Review URL: http://codereview.chromium.org/8825003
Patch from Tobias Burnus <[email protected]>.
http://code.google.com/p/v8/source/detail?r=10241

Modified:
 /branches/bleeding_edge/AUTHORS
 /branches/bleeding_edge/src/mksnapshot.cc
 /branches/bleeding_edge/test/cctest/test-regexp.cc

=======================================
--- /branches/bleeding_edge/AUTHORS     Tue Sep 13 07:38:39 2011
+++ /branches/bleeding_edge/AUTHORS     Tue Dec 13 05:02:08 2011
@@ -42,6 +42,7 @@
 Ryan Dahl <[email protected]>
 Sanjoy Das <[email protected]>
 Subrato K De <[email protected]>
+Tobias Burnus <[email protected]>
 Vlad Burlik <[email protected]>
 Yuqiang Xian <[email protected]>
 Zaheer Ahmad <[email protected]>
=======================================
--- /branches/bleeding_edge/src/mksnapshot.cc   Thu Oct 20 05:27:10 2011
+++ /branches/bleeding_edge/src/mksnapshot.cc   Tue Dec 13 05:02:08 2011
@@ -109,7 +109,7 @@
       if (j != 0) {
         fprintf(fp, ",");
       }
-      fprintf(fp, "%d", at(j));
+      fprintf(fp, "%u", static_cast<unsigned char>(at(j)));
     }
   }
   char at(int i) { return data_[i]; }
=======================================
--- /branches/bleeding_edge/test/cctest/test-regexp.cc Fri Oct 7 07:41:08 2011 +++ /branches/bleeding_edge/test/cctest/test-regexp.cc Tue Dec 13 05:02:08 2011
@@ -836,7 +836,8 @@
   Handle<Code> code = Handle<Code>::cast(code_object);

   int captures[4] = {42, 37, 87, 117};
-  const uc16 input_data[6] = {'f', 'o', 'o', 'f', 'o', '\xa0'};
+  const uc16 input_data[6] = {'f', 'o', 'o', 'f', 'o',
+                              static_cast<uc16>('\xa0')};
   Handle<String> input =
       factory->NewStringFromTwoByte(Vector<const uc16>(input_data, 6));
Handle<SeqTwoByteString> seq_input = Handle<SeqTwoByteString>::cast(input);
@@ -856,7 +857,8 @@
   CHECK_EQ(-1, captures[2]);
   CHECK_EQ(-1, captures[3]);

- const uc16 input_data2[9] = {'b', 'a', 'r', 'b', 'a', 'r', 'b', 'a', '\xa0'};
+  const uc16 input_data2[9] = {'b', 'a', 'r', 'b', 'a', 'r', 'b', 'a',
+                               static_cast<uc16>('\xa0')};
input = factory->NewStringFromTwoByte(Vector<const uc16>(input_data2, 9));
   seq_input = Handle<SeqTwoByteString>::cast(input);
   start_adr = seq_input->GetCharsAddress();

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to