|
121 | 121 | { |
122 | 122 |
|
123 | 123 | #define END_COMPOUND_MACRO \ |
124 | | - __pragma(warning(push)) \ |
125 | | - __pragma(warning(disable:4127)) \ |
| 124 | + __pragma(warning(disable:4127)) /* conditional expression is constant */ \ |
126 | 125 | } \ |
127 | 126 | while (false) \ |
128 | | - __pragma(warning(pop)) |
| 127 | + __pragma(warning(default:4127)) |
| 128 | + |
| 129 | +//----------------------------------------------------------------------------- |
| 130 | +// global helper functions |
| 131 | +//----------------------------------------------------------------------------- |
| 132 | + |
| 133 | +template <typename TFlag> |
| 134 | +inline TFlag CombineFlags(TFlag flag1, TFlag flag2) |
| 135 | +{ |
| 136 | + using TUnderlying = std::underlying_type_t<TFlag>; |
| 137 | + return static_cast<TFlag>(static_cast<TUnderlying>(flag1) | static_cast<TUnderlying>(flag2)); |
| 138 | +} |
| 139 | + |
| 140 | +//----------------------------------------------------------------------------- |
| 141 | + |
| 142 | +template <typename TFlag, typename... TOthers> |
| 143 | +inline TFlag CombineFlags(TFlag flag1, TFlag flag2, TOthers... others) |
| 144 | +{ |
| 145 | + return CombineFlags(flag1, CombineFlags(flag2, others...)); |
| 146 | +} |
129 | 147 |
|
130 | 148 | //----------------------------------------------------------------------------- |
131 | 149 | // PulseValueScope |
@@ -160,9 +178,11 @@ class PulseValueScope |
160 | 178 | //----------------------------------------------------------------------------- |
161 | 179 |
|
162 | 180 | #define BEGIN_PULSE_VALUE_SCOPE(ADDRESS, VALUE) \ |
163 | | - { \ |
164 | | - PulseValueScope<std::remove_reference<decltype(*(ADDRESS))>::type> t_PulseValueScope((ADDRESS), (VALUE)); |
| 181 | + { \ |
| 182 | + __pragma(warning(disable:4456)) /* declaration hides previous local declaration */ \ |
| 183 | + PulseValueScope<std::remove_reference<decltype(*(ADDRESS))>::type> t_PulseValueScope((ADDRESS), (VALUE)); \ |
| 184 | + __pragma(warning(default:4456)) |
165 | 185 |
|
166 | 186 | #define END_PULSE_VALUE_SCOPE \ |
167 | | - IGNORE_UNUSED(t_PulseValueScope); \ |
168 | | - } |
| 187 | + IGNORE_UNUSED(t_PulseValueScope); \ |
| 188 | + } |
0 commit comments