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

Unified Diff: base/metrics/histogram_macros_internal.h

Issue 2886933003: Use stricter type checking in UMA_HISTOGRAM_ENUMERATION (Closed)
Patch Set: fix new errors Created 3 years, 5 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
Index: base/metrics/histogram_macros_internal.h
diff --git a/base/metrics/histogram_macros_internal.h b/base/metrics/histogram_macros_internal.h
index c107a4729d26243d6e81d510e03fb769abb137aa..2bb0e0a39d237c5beb39a1f3cd4528cd9a89cc42 100644
--- a/base/metrics/histogram_macros_internal.h
+++ b/base/metrics/histogram_macros_internal.h
@@ -139,6 +139,12 @@
// types.
#define INTERNAL_HISTOGRAM_ENUMERATION_WITH_FLAG(name, sample, boundary, flag) \
do { \
+ static_assert( \
+ !std::is_enum<std::remove_const<std::remove_reference<decltype( \
dcheng 2017/07/17 09:13:59 I think std::decay can replace the use of std::rem
+ boundary)>::type>::type>::value || \
+ std::is_enum<std::remove_const< \
+ std::remove_reference<decltype(sample)>::type>::type>::value, \
+ "Unexpected: |boundary| is enum, but |sample| is not."); \
static_assert( \
!std::is_enum<decltype(sample)>::value || \
!std::is_enum<decltype(boundary)>::value || \

Powered by Google App Engine
This is Rietveld 408576698