diff options
author | tsepez <tsepez@chromium.org> | 2014-10-22 19:39:24 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-10-23 02:41:36 +0000 |
commit | 26d859a2ddfd2aeac5d944831cd454d30d5a5d6b (patch) | |
tree | 1cced4e334f9d74b8606fcfbda2e4bb8815cecd9 /ipc | |
parent | a05223cb296cb5301f043d10867c027aa56ebff3 (diff) | |
download | chromium_src-26d859a2ddfd2aeac5d944831cd454d30d5a5d6b.zip chromium_src-26d859a2ddfd2aeac5d944831cd454d30d5a5d6b.tar.gz chromium_src-26d859a2ddfd2aeac5d944831cd454d30d5a5d6b.tar.bz2 |
Make IPC_ENUM_TRAITS_MIN_MAX_VALUE() work with c++11 enum class.
It is a matter of adding explicit casts to make legal comparisions.
BUG=425190
Review URL: https://codereview.chromium.org/669713003
Cr-Commit-Position: refs/heads/master@{#300826}
Diffstat (limited to 'ipc')
-rw-r--r-- | ipc/param_traits_macros.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/ipc/param_traits_macros.h b/ipc/param_traits_macros.h index ad87a93..f4248df 100644 --- a/ipc/param_traits_macros.h +++ b/ipc/param_traits_macros.h @@ -39,8 +39,11 @@ // Convenience macro for defining enumerated type traits for types which are // range-checked by the IPC system to be in the range of minvalue..maxvalue // inclusive. This macro should not need to be subsequently redefined. +// TODO(tsepez): Cast to std::underlying_type<>::type once that is permitted. #define IPC_ENUM_TRAITS_MIN_MAX_VALUE(type, minvalue, maxvalue) \ - IPC_ENUM_TRAITS_VALIDATE(type, (value >= (minvalue) && value <= (maxvalue))) + IPC_ENUM_TRAITS_VALIDATE( \ + type, (static_cast<int>(value) >= static_cast<int>(minvalue) && \ + static_cast<int>(value) <= static_cast<int>(maxvalue))) // Traits generation for enums. This macro may be redefined later. #define IPC_ENUM_TRAITS_VALIDATE(enum_name, validation_expression) \ |