cpp-common/bt2: remove redundant assertions
authorSimon Marchi <simon.marchi@efficios.com>
Wed, 13 Mar 2024 15:04:07 +0000 (11:04 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Tue, 26 Mar 2024 18:56:36 +0000 (14:56 -0400)
commitbd6e66fd0c3012ad6bcb03cdb3fb687767fb6ccf
treef328c74c29681cef61b45e60f4c69cf550c240b2
parent5ca48ae961d956ce188ff45b2d2c04127874276a
cpp-common/bt2: remove redundant assertions

Remove some redundant BT_ASSERT and BT_ASSERT_DBG.

 - Most `as*()` methods call a constructor that does the exact same
   check.  Some exceptions are field class types that have signed and
   unsigned variants, where the base class' assertion does not check the
   signedness.  Another one is `CommonNullValue::asNull`, where the
   `CommonNullValue` constructor does not take a lib object pointer, so
   does not do a check.
 - Things that end up constructing a `BorrowedObject` don't need to do
   a null pointer check, as `BorrowedObject`'s constructor does one.
 - `BorrowedObjectIterator::operator*` does not need an assertion on the
   length, as `operator[]` of the container is expected to do it (either
   directly, or rely on the preconditions in the lib).

Change-Id: I6f11680628607eee11164a2e9d3f9de7fc7468cb
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12052
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
src/cpp-common/bt2/borrowed-object-iterator.hpp
src/cpp-common/bt2/field-class.hpp
src/cpp-common/bt2/field-path.hpp
src/cpp-common/bt2/field.hpp
src/cpp-common/bt2/message.hpp
src/cpp-common/bt2/optional-borrowed-object.hpp
src/cpp-common/bt2/self-component-port.hpp
src/cpp-common/bt2/self-message-iterator.hpp
src/cpp-common/bt2/shared-object.hpp
src/cpp-common/bt2/value.hpp
This page took 0.024707 seconds and 4 git commands to generate.