[re2] Fix re2 build

Change-Id: Iaf29a0abb359e3edf6a98e60049d2d1cb1458fb0
Reviewed-on: https://fuchsia-review.googlesource.com/c/third_party/re2/+/525842
Reviewed-by: Shai Barack <shayba@google.com>
diff --git a/BUILD.gn b/BUILD.gn
index b65fde4..19f7d20 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -96,9 +96,7 @@
     "util/thread.cc",
     "util/thread.h",
   ]
-  public_deps = [
-    ":re2",
-  ]
+  public_deps = [ ":re2" ]
   configs -= [ "//build/config:default_warnings" ]
   configs += [ ":re2_warnings" ]
 }
@@ -124,9 +122,7 @@
     "re2/testing/string_generator_test.cc",
     "util/test.cc",
   ]
-  deps = [
-    ":testing",
-  ]
+  deps = [ ":testing" ]
   configs -= [ "//build/config:default_warnings" ]
   configs += [ ":re2_warnings" ]
 }
@@ -146,9 +142,7 @@
     "re2/testing/random_test.cc",
     "util/test.cc",
   ]
-  deps = [
-    ":testing",
-  ]
+  deps = [ ":testing" ]
   configs -= [ "//build/config:default_warnings" ]
   configs += [ ":re2_warnings" ]
 }
@@ -159,25 +153,15 @@
 
 source_set("benchmark") {
   testonly = true
-  sources = [
-    "util/benchmark.cc",
-  ]
-  deps = [
-    ":re2",
-  ]
-  public_deps = [
-    ":testing",
-  ]
+  sources = [ "util/benchmark.cc" ]
+  deps = [ ":re2" ]
+  public_deps = [ ":testing" ]
 }
 
 executable("regexp_benchmark") {
   testonly = true
-  sources = [
-    "re2/testing/regexp_benchmark.cc",
-  ]
-  deps = [
-    ":benchmark",
-  ]
+  sources = [ "re2/testing/regexp_benchmark.cc" ]
+  deps = [ ":benchmark" ]
 }
 
 fuchsia_unittest_component("regexp_benchmark_component") {
@@ -185,9 +169,14 @@
 }
 
 fuchsia_test_package("re2_tests") {
-  deps = [
+  test_components = [
     ":re2_slow_tests_component",
     ":re2_tests_bin_component",
     ":regexp_benchmark_component",
   ]
 }
+
+group("tests") {
+  testonly = true
+  deps = [ ":re2_tests" ]
+}
diff --git a/re2/regexp.h b/re2/regexp.h
index 39e2075..58b1439 100644
--- a/re2/regexp.h
+++ b/re2/regexp.h
@@ -495,7 +495,7 @@
       LOG(FATAL) << "Cannot AllocSub " << n;
     if (n > 1)
       submany_ = new Regexp*[n];
-    nsub_ = n;
+    nsub_ = static_cast<uint16>(n);
   }
 
   // Add Rune to LiteralString
diff --git a/re2/testing/regexp_benchmark.cc b/re2/testing/regexp_benchmark.cc
index 9a5128f..0220069 100644
--- a/re2/testing/regexp_benchmark.cc
+++ b/re2/testing/regexp_benchmark.cc
@@ -145,7 +145,7 @@
   for (int i = 0; i < nbytes; i++) {
     // Generate a one-byte rune that isn't a control character (e.g. '\n').
     // Clipping to 0x20 introduces some bias, but we don't need uniformity.
-    int byte = rand() & 0x7F;
+    char byte = rand() & 0x7F;
     if (byte < 0x20)
       byte = 0x20;
     (*text)[i] = byte;