]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
crimson/os: use a constexpr function for sanity test
authorKefu Chai <kchai@redhat.com>
Tue, 8 Dec 2020 08:29:17 +0000 (16:29 +0800)
committerKefu Chai <kchai@redhat.com>
Tue, 8 Dec 2020 08:55:13 +0000 (16:55 +0800)
commit700cc70bbabb7f75db9ce3a8c36f5e1e164da4aa
tree572619df407abeddd0ab073ca4ebabc1fa8cae55
parent43c7c622ef227f087e33504364ec503a9d68ac62
crimson/os: use a constexpr function for sanity test

since match_stage_t is an alias of uint_8. it is an unsigned type, so an
instance of this type should be always greater or equal to 0.

this silences warning like:

stage_types.h:37:50: warning: comparison is always true due to limited range of data type [-Wtype-limits]
   37 |     static_assert(STAGE >= STAGE_BOTTOM && STAGE <= STAGE_TOP);
      |                                            ~~~~~~^~~~~~~~~~~~

also, GCC complains if it is able to assure that the compare always
returns true. so a function helps to silence it.

this warning is meaningless per-se, as we are using static_assert() to
perform sanity test at *compile-time*.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/crimson/os/seastore/onode_manager/staged-fltree/stages/stage_types.h