Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1572)

Unified Diff: webrtc/base/flags.cc

Issue 2110963004: Remove CHECK around duplicate FLAG lookup. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Added explanatory comment. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/flags.cc
diff --git a/webrtc/base/flags.cc b/webrtc/base/flags.cc
index 0c0f4491c83057d8062d4d9f1e6ce3756c192ccb..248c5c3f185e974a00a34112ba69dd892467066b 100644
--- a/webrtc/base/flags.cc
+++ b/webrtc/base/flags.cc
@@ -257,8 +257,10 @@ int FlagList::SetFlagsFromCommandLine(int* argc, const char** argv,
void FlagList::Register(Flag* flag) {
assert(flag != NULL && strlen(flag->name()) > 0);
- RTC_CHECK(!Lookup(flag->name())) << "flag " << flag->name()
- << " declared twice";
+ // NOTE: Don't call Lookup() within Register because it accesses the name_
+ // of other flags in list_, and if the flags are coming from two different
+ // compilation units, the initialization order between them is undefined, and
+ // this will trigger an asan initialization-order-fiasco error.
flag->next_ = list_;
list_ = flag;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698