diff options
author | igo95862 <igo95862@yandex.ru> | 2022-06-10 20:51:04 +0300 |
---|---|---|
committer | igo95862 <igo95862@yandex.ru> | 2022-07-25 23:29:17 +0300 |
commit | 724e13b346990be85c4bc332c78f29ed7ce83121 (patch) | |
tree | f5a7be3faefaf94c563b8be7aaf3da5b7d23ab11 /src/fundamental/macro-fundamental.h | |
parent | d3efe29452aeddc395865469b776fe7a1eb45eae (diff) | |
download | systemd-724e13b346990be85c4bc332c78f29ed7ce83121.tar.gz |
test-bus-objects: Test GetManagedObjects interfaces are correct
Objects without ObjectManager should not have
`org.freedesktop.DBus.ObjectManager` interface.
Object with ObjectManager should do.
Also added ASSERT_SE_NONNEG and ASSERT_NONNEG macros.
Diffstat (limited to 'src/fundamental/macro-fundamental.h')
-rw-r--r-- | src/fundamental/macro-fundamental.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/fundamental/macro-fundamental.h b/src/fundamental/macro-fundamental.h index 7cc34b6f1a..e5f6dc7f8c 100644 --- a/src/fundamental/macro-fundamental.h +++ b/src/fundamental/macro-fundamental.h @@ -95,6 +95,20 @@ _expr_; \ }) +#define ASSERT_NONNEG(expr) \ + ({ \ + typeof(expr) _expr_ = (expr), _zero = 0; \ + assert(_expr_ >= _zero); \ + _expr_; \ + }) + +#define ASSERT_SE_NONNEG(expr) \ + ({ \ + typeof(expr) _expr_ = (expr), _zero = 0; \ + assert_se(_expr_ >= _zero); \ + _expr_; \ + }) + #define assert_cc(expr) static_assert(expr, #expr) |