]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/os: do not return a value for non-reachable branch
authorKefu Chai <kchai@redhat.com>
Sat, 15 Aug 2020 11:04:19 +0000 (19:04 +0800)
committerKefu Chai <kchai@redhat.com>
Sun, 16 Aug 2020 01:37:21 +0000 (09:37 +0800)
for silencing a warning like

btree/btree_lba_manager.cc:177:12: warning: binding dereferenced null pointer to reference has undefined behavior [-Wnull-dereference]
    return *static_cast<btree_range_pin_t*>(nullptr);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

ceph_abort_msg() is marked [[noreturn]], so we can just use it here
without worrying about complains from compiler.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/crimson/os/seastore/lba_manager/btree/btree_lba_manager.cc

index c90e41f058ab5c247af8bc9c72bd1c143bcff8bb..012b1ba61e6e5ad019a44d3211469a9b216663fc 100644 (file)
@@ -173,8 +173,7 @@ btree_range_pin_t &BtreeLBAManager::get_pin(CachedExtent &e)
     return static_cast<BtreeLBAPin &>(
       e.cast<LogicalCachedExtent>()->get_pin()).pin;
   } else {
-    assert(0 == "impossible");
-    return *static_cast<btree_range_pin_t*>(nullptr);
+    ceph_abort_msg("impossible");
   }
 }