re2: eliminate global c++ constructors
R=battre, battre, digit, rsc, digit
CC=re2-dev
http://codereview.appspot.com/6442107
diff --git a/re2/compile.cc b/re2/compile.cc
index c44efb6..9cddb71 100644
--- a/re2/compile.cc
+++ b/re2/compile.cc
@@ -44,7 +44,7 @@
static PatchList Append(Prog::Inst *inst0, PatchList l1, PatchList l2);
};
-static PatchList nullPatchList = { 0 };
+static PatchList nullPatchList;
// Returns patch list containing just p.
PatchList PatchList::Mk(uint32 p) {
@@ -106,11 +106,12 @@
uint32 begin;
PatchList end;
+ explicit Frag(LinkerInitialized) {}
Frag() : begin(0) { end.p = 0; } // needed so Frag can go in vector
Frag(uint32 begin, PatchList end) : begin(begin), end(end) {}
};
-static Frag kNullFrag;
+static Frag kNullFrag(LINKER_INITIALIZED);
// Input encodings.
enum Encoding {
@@ -588,7 +589,7 @@
};
void Compiler::Add_80_10ffff() {
- int inst[arraysize(prog_80_10ffff)];
+ int inst[arraysize(prog_80_10ffff)] = { 0 }; // does not need to be initialized; silences gcc warning
for (int i = 0; i < arraysize(prog_80_10ffff); i++) {
const ByteRangeProg& p = prog_80_10ffff[i];
int next = 0;