diff options
author | Alex Richardson <arichardson@FreeBSD.org> | 2022-08-12 10:18:05 +0000 |
---|---|---|
committer | Simon McVittie <smcv@collabora.com> | 2022-09-21 11:35:05 +0000 |
commit | 464b51acdeb46620114a54ebf74f5feb39ebb55c (patch) | |
tree | cf200a03b67946b7607787b65469522a0d0ccd2c /dbus | |
parent | 8c0d9709f3a4e80b0faccc0aee0aa24516902257 (diff) | |
download | dbus-464b51acdeb46620114a54ebf74f5feb39ebb55c.tar.gz |
dbus-internals: use size_t in _DBUS_ALIGN_VALUE()
When targeting CHERI-enabled architectures such as Arm Morello, performing
a bitwise and with uintptr_t values can result in an ambiguous operation
compiler warning. Fix this warning by telling compiler which operand is
(potentially) a pointer and which one is an integer by changing the
boundary type to size_t. This change has no functional effect on other
architectures but is required to build with -Werror for Morello.
Example warning message:
```
warning: binary expression on capability types 'unsigned __intcap' and 'unsigned __intcap'; it is not clear which should be used as the source of provenance; currently provenance is inherited from the left-hand side [-Wcheri-provenance]
_dbus_assert (_DBUS_ALIGN_VALUE (insert_at, 8) == (unsigned) insert_at);
```
Diffstat (limited to 'dbus')
-rw-r--r-- | dbus/dbus-internals.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/dbus/dbus-internals.h b/dbus/dbus-internals.h index c7967d24..deee366f 100644 --- a/dbus/dbus-internals.h +++ b/dbus/dbus-internals.h @@ -277,7 +277,8 @@ _dbus_assert_error_xor_bool (const DBusError *error, */ #define _DBUS_ALIGN_VALUE(this, boundary) \ - (( ((uintptr_t)(this)) + (((uintptr_t)(boundary)) -1)) & (~(((uintptr_t)(boundary))-1))) + ((((uintptr_t) (this)) + (((size_t) (boundary)) - 1)) & \ + (~(((size_t) (boundary)) - 1))) #define _DBUS_ALIGN_ADDRESS(this, boundary) \ ((void*)_DBUS_ALIGN_VALUE(this, boundary)) |