From db13010c1338d471c713a652e0940afba627b8bc Mon Sep 17 00:00:00 2001 From: Adam Simpkins Date: Mon, 27 Nov 2017 21:30:58 -0800 Subject: [PATCH] logging: fix unused variable warning in non-debug builds Summary: Use FOLLY_SAFE_DCHECK() rather than assert() to avoid compiler errors about this variable being unused in builds where assert() statements are disabled. Reviewed By: bolinfest, yfeldblum Differential Revision: D6421978 fbshipit-source-id: ab1019fa1fa420856e1bf3bc39c441662c4efd75 --- folly/experimental/logging/LogConfigParser.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/folly/experimental/logging/LogConfigParser.cpp b/folly/experimental/logging/LogConfigParser.cpp index 7e51472e..55244207 100644 --- a/folly/experimental/logging/LogConfigParser.cpp +++ b/folly/experimental/logging/LogConfigParser.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include using std::shared_ptr; @@ -330,7 +331,9 @@ LogConfig::CategoryConfigMap parseCategoryConfigs(StringPiece value) { auto emplaceResult = categoryConfigs.emplace(canonicalName, std::move(categoryConfig)); - assert(emplaceResult.second); + FOLLY_SAFE_DCHECK( + emplaceResult.second, + "category name must be new since it was not in seenCategories"); } return categoryConfigs; -- 2.34.1