1
0
Fork 0
mirror of https://github.com/Neargye/magic_enum.git synced 2026-01-09 23:34:23 +00:00
Commit graph

522 commits

Author SHA1 Message Date
Alexander Karatarakis
41c916432b
Fix underflow in out of range check (#88)
* Special case bool in cmp_less to avoid msvc's warnings

* Fix underflow in out of range check

The previous fix addressed bool but it seems that was not the heart
of the issue.

The problem is that (lhs - 1) can underflow.

Another example of the check trigger when it shouldn't is:
uint8_t with min_value set to 0 and a value of uint8_t::max
lhs-1 would underflow and find max (see added test).

The issue happens when lhs == rhs. To avoid that situation: flip the if-else!
`cmp_less(rhs, lhs)`means that rhs is strictly less than lhs, so
the check will not trigger when lhs == rhs.

Also, cleanup the bool special-case, as it is no longer necessary.

Note: for the bug to manifest, it is important that the min
of the enums is customized to be 0, so corresponding enum_range
specializations need to be present in the regression tests.
2021-06-25 15:00:54 +03:00
neargye
b927151677 update tests 2021-06-24 17:52:04 +03:00
neargye
739942ab7d fix enums with underlying type bool 2021-06-24 11:48:37 +03:00
neargye
5003c436d6 update readme 2021-06-24 11:46:20 +03:00
neargye
3d1f6a5a2a v0.7.3 2021-06-21 21:00:39 +03:00
neargye
25f32188ca update ci 2021-06-17 16:07:12 +03:00
sajimon
081a77b96a
Add ability to include external configuration header (#86)
* Add ability to include external configuration header

* Add documentation regarding MAGIC_ENUM_CONFIG_FILE
2021-06-17 16:06:27 +03:00
Flow86
8c130658e1
Add ARCH_INDEPENDENT so the generated cmake config files are really arch independent (#84)
closes #83
2021-05-27 12:08:01 +03:00
neargye
98ffd0e29b update ci 2021-05-27 11:10:10 +03:00
jimmyorourke
8deb7f96e7
fix typo in comment (#81) 2021-05-07 11:16:24 +03:00
neargye
5091dc6acf fix using leak 2021-04-28 13:10:59 +03:00
neargye
5b282dd4e8 fix range check 2021-04-22 12:43:04 +03:00
neargye
1db1f585f4 fix typo 2021-04-21 19:21:54 +03:00
neargye
c646c9d76d fix hard error if enum is empty or non-reflected 2021-04-21 19:19:03 +03:00
neargye
3cc7e2acde update catch2 2021-04-14 14:06:52 +03:00
neargye
e5c1508465 update ci 2021-04-14 14:02:49 +03:00
neargye
f9e08ba792 update readme 2021-03-27 18:51:46 +02:00
neargye
252cbd0136 update ci 2021-03-27 18:51:41 +02:00
Wmbat
c5b5eea3bd
Added build2 support information (#78) 2021-03-22 17:15:04 +02:00
Daniil Goncharov
ed2dbfd46c
workaround std::array in some cases is missing constexpr on some of its functions (#76) 2021-03-10 11:05:44 +02:00
Gregor Jasny
c1e7c1475a
chore: update catch2 to 2.13.4 for Apple Silicon support (#75) 2021-02-22 18:10:47 +02:00
Malcolm Parsons
58833fa067
Fix typo (#72) 2021-02-09 19:33:32 +02:00
neargye
9830d319c4 silence some warning 2021-01-23 07:47:05 +02:00
neargye
0810148bae update copyring 2021-01-23 07:47:01 +02:00
neargye
79fd207cca update doc 2021-01-12 10:31:53 +02:00
neargye
beb77df3f1 clean-up 2021-01-10 14:54:49 +02:00
bjacklyn
36ab9fa1a4
Detect values out of range and fail compilation (#70)
This checks for a value at (range_min - 1) and (range_max + 1) for numerical enums
(i.e. not flag enums) and fails compilation with a static_assert if any value is found

Co-authored-by: Brandon Jacklyn <bjacklyn@tesla.com>
2021-01-10 14:43:47 +02:00
neargye
806f2530ef clean-up 2020-12-29 18:56:51 +02:00
neargye
6654d24a82 update 2020-12-24 16:24:34 +02:00
neargye
dc8660e2bc v0.7.2 2020-12-23 14:18:20 +02:00
neargye
993e796e0d update doc 2020-12-23 14:17:39 +02:00
neargye
dee5abdfbd update doc
fix #68
2020-12-23 14:14:28 +02:00
neargye
9ed98e3463 fix #69 2020-12-21 17:52:42 +02:00
neargye
74106766b5 update ci 2020-12-04 18:08:09 +02:00
neargye
f4d98123d9 v0.7.1 2020-12-02 12:09:44 +02:00
nackdai
e24befa5fd
fix typo (#66) 2020-11-29 15:29:17 +02:00
neargye
9fb2ab9133 clean-up 2020-11-26 01:27:24 +02:00
neargye
4da4b75644 add namespace magic_enum:🎏:bitwise_operators 2020-11-25 11:17:29 +02:00
neargye
e8c57b0a2a update ci 2020-11-24 16:28:50 +02:00
neargye
72ba8a89d4 clean-up 2020-11-19 15:29:05 +02:00
Bela Schaum
1b587718b7
Compile fix for gcc 7.5 (#62) 2020-11-19 15:23:20 +02:00
neargye
6e932ef66d update ci 2020-11-11 17:32:27 +02:00
neargye
8f1d0ba39f fix clang with msvc 2020-11-10 19:14:54 +02:00
neargye
b828fe16f5 make the project to be used from a build directory
reference: https://cmake.org/cmake/help/latest/guide/tutorial/index.html#adding-export-configuration-step-11
2020-11-10 19:13:46 +02:00
Daniil Goncharov
ad441519c3 Create FUNDING.yml 2020-11-09 15:26:25 +02:00
neargye
ae7aabf63d update comments 2020-11-08 22:00:23 +02:00
tim-lyon-arup
caa2f9e6ef
Fix typo in readme (#61) 2020-10-22 15:48:26 +03:00
Florian Becker
bb32605276
Fix extra-semi-stmt (#60) 2020-10-21 18:02:40 +03:00
neargye
3080a1d726 update readme 2020-10-19 10:19:10 +03:00
neargye
77c66013db update ci 2020-10-18 21:23:35 +03:00