Fix locking for printing error messages.

Same as CL https://codereview.chromium.org/1071423003 (which has LGTM).

BUG= https://code.google.com/p/nativeclient/issues/detail?id=4138

Review URL: https://codereview.chromium.org/1097563003
diff --git a/src/IceClFlags.cpp b/src/IceClFlags.cpp
index 9e24665..fda4e06 100644
--- a/src/IceClFlags.cpp
+++ b/src/IceClFlags.cpp
@@ -245,6 +245,43 @@
   AppName = IceString(argv[0]);
 }
 
+void ClFlags::resetClFlags(ClFlags &OutFlags) {
+  // bool fields
+  OutFlags.AllowErrorRecovery = false;
+  OutFlags.AllowUninitializedGlobals = false;
+  OutFlags.DataSections = false;
+  OutFlags.DecorateAsm = false;
+  OutFlags.DisableInternal = false;
+  OutFlags.DisableIRGeneration = false;
+  OutFlags.DisableTranslation = false;
+  OutFlags.DumpStats = false;
+  OutFlags.FunctionSections = false;
+  OutFlags.GenerateUnitTestMessages = false;
+  OutFlags.PhiEdgeSplit = false;
+  OutFlags.RandomNopInsertion = false;
+  OutFlags.RandomRegAlloc = false;
+  OutFlags.SubzeroTimingEnabled = false;
+  OutFlags.TimeEachFunction = false;
+  OutFlags.UseSandboxing = false;
+  // Enum and integer fields.
+  OutFlags.Opt = Opt_m1;
+  OutFlags.OutFileType = FT_Iasm;
+  OutFlags.RandomMaxNopsPerInstruction = 0;
+  OutFlags.RandomNopProbabilityAsPercentage = 0;
+  OutFlags.TArch = TargetArch_NUM;
+  OutFlags.VMask = IceV_None;
+  // IceString fields.
+  OutFlags.DefaultFunctionPrefix = "";
+  OutFlags.DefaultGlobalPrefix = "";
+  OutFlags.TestPrefix = "";
+  OutFlags.TimingFocusOn = "";
+  OutFlags.TranslateOnly = "";
+  OutFlags.VerboseFocusOn = "";
+  // size_t and 64-bit fields.
+  OutFlags.NumTranslationThreads = 0;
+  OutFlags.RandomSeed = 0;
+}
+
 void ClFlags::getParsedClFlags(ClFlags &OutFlags) {
   if (::DisableIRGeneration)
     ::DisableTranslation = true;