[PATCH 1/2] dbus-service: Do not auto-emit property changes
by Denis Kenzior
This is a behavioral change to not emit property changes by default
after the set callback 'complete' method is called. This allows
applications a bit more flexibility in if & when they actually emit the
property changed signal. Two common scenarios are:
- The property is set to value 'A' and a D-Bus client requests
the property to be set to 'A'. Generally most D-Bus
applications would want to silently accept such a request and
not emit a PropertyChanged signal needlessly. With ell's
current behavior the signal is emitted regardless.
- A property 'set' might be set successfully, but its actual
value is updated via some asynchronous means (perhaps inotify,
netlink, etc). So it would be advantageous for applications to
call the 'complete' callback and have the property changed
signal be emitted when the relevant async notification arrives.
The implications of this behavior change is that property setter
implementations must manually invoke l_dbus_property_changed whenever
the underlying property value has been updated in order for the relevant
signal to be emitted. Alternatively, supplying
L_DBUS_PROPERTY_FLAG_AUTO_EMIT flag in l_dbus_interface_property() will
preserve the current behavior.
---
ell/dbus-service.c | 43 +++++++++++++++++++++++++++++++++++--------
ell/dbus-service.h | 1 +
2 files changed, 36 insertions(+), 8 deletions(-)
diff --git a/ell/dbus-service.c b/ell/dbus-service.c
index fb839f9da6a5..e60eafc28221 100644
--- a/ell/dbus-service.c
+++ b/ell/dbus-service.c
@@ -1230,9 +1230,10 @@ bool _dbus_object_tree_property_changed(struct l_dbus *dbus,
return true;
}
-static void pending_property_set_done(struct l_dbus *dbus,
+static void pending_property_set_done_common(struct l_dbus *dbus,
struct l_dbus_message *message,
- struct l_dbus_message *reply)
+ struct l_dbus_message *reply,
+ bool auto_emit)
{
const char *member;
const char *interface_name;
@@ -1260,7 +1261,8 @@ static void pending_property_set_done(struct l_dbus *dbus,
&variant))
goto done;
- _dbus_object_tree_property_changed(dbus,
+ if (auto_emit)
+ _dbus_object_tree_property_changed(dbus,
l_dbus_message_get_path(message),
interface_name, property_name);
done:
@@ -1268,6 +1270,20 @@ done:
l_dbus_message_unref(reply);
}
+static void pending_property_set_done_emit(struct l_dbus *dbus,
+ struct l_dbus_message *message,
+ struct l_dbus_message *reply)
+{
+ pending_property_set_done_common(dbus, message, reply, true);
+}
+
+static void pending_property_set_done(struct l_dbus *dbus,
+ struct l_dbus_message *message,
+ struct l_dbus_message *reply)
+{
+ pending_property_set_done_common(dbus, message, reply, false);
+}
+
static struct l_dbus_message *old_set_property(struct l_dbus *dbus,
struct l_dbus_message *message,
void *user_data)
@@ -1278,6 +1294,7 @@ static struct l_dbus_message *old_set_property(struct l_dbus *dbus,
struct l_dbus_message_iter variant;
struct _dbus_object_tree *tree = _dbus_get_tree(dbus);
struct l_dbus_message *reply;
+ l_dbus_property_complete_cb_t complete_cb;
interface = l_hashmap_lookup(tree->interfaces,
l_dbus_message_get_interface(message));
@@ -1305,11 +1322,16 @@ static struct l_dbus_message *old_set_property(struct l_dbus *dbus,
"Property %s is read-only",
property_name);
+ if (property->flags & L_DBUS_PROPERTY_FLAG_AUTO_EMIT)
+ complete_cb = pending_property_set_done_emit;
+ else
+ complete_cb = pending_property_set_done;
+
reply = property->setter(dbus, l_dbus_message_ref(message), &variant,
- pending_property_set_done, user_data);
+ complete_cb, user_data);
if (reply)
- pending_property_set_done(dbus, message, reply);
+ complete_cb(dbus, message, reply);
return NULL;
}
@@ -1863,6 +1885,7 @@ static struct l_dbus_message *properties_set(struct l_dbus *dbus,
struct _dbus_object_tree *tree = _dbus_get_tree(dbus);
const struct object_node *object;
struct l_dbus_message *reply;
+ l_dbus_property_complete_cb_t complete_cb;
if (!l_dbus_message_get_arguments(message, "ssv", &interface_name,
&property_name, &variant))
@@ -1907,12 +1930,16 @@ static struct l_dbus_message *properties_set(struct l_dbus *dbus,
"Object has no interface %s",
interface_name);
+ if (property->flags & L_DBUS_PROPERTY_FLAG_AUTO_EMIT)
+ complete_cb = pending_property_set_done_emit;
+ else
+ complete_cb = pending_property_set_done;
+
reply = property->setter(dbus, l_dbus_message_ref(message), &variant,
- pending_property_set_done,
- instance->user_data);
+ complete_cb, instance->user_data);
if (reply)
- pending_property_set_done(dbus, message, reply);
+ complete_cb(dbus, message, reply);
return NULL;
}
diff --git a/ell/dbus-service.h b/ell/dbus-service.h
index 153bb3a22798..1a150498a703 100644
--- a/ell/dbus-service.h
+++ b/ell/dbus-service.h
@@ -46,6 +46,7 @@ enum l_dbus_signal_flag {
enum l_dbus_property_flag {
L_DBUS_PROPERTY_FLAG_DEPRECATED = 1,
+ L_DBUS_PROPERTY_FLAG_AUTO_EMIT = 2,
};
typedef struct l_dbus_message *(*l_dbus_interface_method_cb_t) (struct l_dbus *,
--
2.21.0
2 years, 5 months
[PATCH v2] unit: Add test-casese for l_ringbuf_append function
by Przemysław Fierek
This patch adds unit-tests for previously submitted `l_ringbuf_append`
function. Second version contains fixes from the code review.
---
unit/test-ringbuf.c | 86 ++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 85 insertions(+), 1 deletion(-)
diff --git a/unit/test-ringbuf.c b/unit/test-ringbuf.c
index 906161b..e18206f 100644
--- a/unit/test-ringbuf.c
+++ b/unit/test-ringbuf.c
@@ -131,6 +131,89 @@ static void test_printf(const void *data)
l_ringbuf_free(rb);
}
+static void test_append(const void *unused)
+{
+ static const uint8_t data[6] = {1, 2, 3, 4, 5, 6};
+ static const size_t rb_size = 12;
+ static const size_t rb_capa = 16;
+ size_t len_no_wrap;
+ ssize_t appended;
+ ssize_t space_left;
+ void *rb_data;
+ struct l_ringbuf *rb;
+
+ rb = l_ringbuf_new(rb_size);
+ assert(rb != NULL);
+ assert(l_ringbuf_capacity(rb) == rb_capa);
+
+ appended = l_ringbuf_append(rb, data, sizeof(data));
+ assert(appended == sizeof(data));
+
+ appended = l_ringbuf_append(rb, data, sizeof(data));
+ assert(appended == sizeof(data));
+
+ space_left = minsize(l_ringbuf_avail(rb), sizeof(data));
+ appended = l_ringbuf_append(rb, data, sizeof(data));
+ assert(appended == space_left);
+
+ rb_data = l_ringbuf_peek(rb, 0, &len_no_wrap);
+ assert(memcmp(rb_data, data, sizeof(data)) == 0);
+ l_ringbuf_drain(rb, sizeof(data));
+
+ rb_data = l_ringbuf_peek(rb, 0, &len_no_wrap);
+ assert(memcmp(rb_data, data, sizeof(data)) == 0);
+ l_ringbuf_drain(rb, sizeof(data));
+
+ rb_data = l_ringbuf_peek(rb, 0, &len_no_wrap);
+ assert(memcmp(rb_data, data, len_no_wrap) == 0);
+ l_ringbuf_drain(rb, len_no_wrap);
+
+ l_ringbuf_free(rb);
+}
+
+static void test_append2(const void *unused)
+{
+ static const uint8_t expected_data1[14] = {3, 4, 5, 6, 1, 2, 3, 4, 5,
+ 6, 1, 2, 3, 4};
+ static const uint8_t expected_data2[2] = {5, 6};
+ static const uint8_t data[6] = {1, 2, 3, 4, 5, 6};
+ static const size_t rb_size = 12;
+ static const size_t rb_capa = 16;
+ size_t len_no_wrap;
+ ssize_t appended;
+ ssize_t space_left;
+ void *rb_data;
+ struct l_ringbuf *rb;
+
+ rb = l_ringbuf_new(rb_size);
+ assert(rb != NULL);
+ assert(l_ringbuf_capacity(rb) == rb_capa);
+
+ appended = l_ringbuf_append(rb, data, sizeof(data));
+ assert(appended == sizeof(data));
+
+ appended = l_ringbuf_append(rb, data, sizeof(data));
+ assert(appended == sizeof(data));
+
+ space_left = minsize(l_ringbuf_avail(rb), sizeof(data));
+ l_ringbuf_drain(rb, sizeof(data) - space_left);
+
+ appended = l_ringbuf_append(rb, data, sizeof(data));
+ assert(appended == sizeof(data));
+
+ rb_data = l_ringbuf_peek(rb, 0, &len_no_wrap);
+ assert(len_no_wrap == sizeof(expected_data1));
+ assert(memcmp(expected_data1, rb_data, len_no_wrap) == 0);
+
+ l_ringbuf_drain(rb, len_no_wrap);
+
+ rb_data = l_ringbuf_peek(rb, 0, &len_no_wrap);
+ assert(len_no_wrap == sizeof(expected_data2));
+ assert(memcmp(expected_data2, rb_data, len_no_wrap) == 0);
+
+ l_ringbuf_free(rb);
+}
+
int main(int argc, char *argv[])
{
l_test_init(&argc, &argv);
@@ -138,7 +221,8 @@ int main(int argc, char *argv[])
l_test_add("/ringbuf/power2", test_power2, NULL);
l_test_add("/ringbuf/alloc", test_alloc, NULL);
l_test_add("/ringbuf/printf", test_printf, NULL);
+ l_test_add("/ringbuf/append", test_append, NULL);
+ l_test_add("/ringbuf/append2", test_append2, NULL);
return l_test_run();
-
}
--
2.17.1
2 years, 5 months
[PATCH] unit: Add test-casese for l_ringbuf_append function
by Przemysław Fierek
This patch adds unit-tests for previously submitted `l_ringbuf_append`
function.
---
unit/test-ringbuf.c | 83 ++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 82 insertions(+), 1 deletion(-)
diff --git a/unit/test-ringbuf.c b/unit/test-ringbuf.c
index 906161b..ce2c5f9 100644
--- a/unit/test-ringbuf.c
+++ b/unit/test-ringbuf.c
@@ -131,6 +131,86 @@ static void test_printf(const void *data)
l_ringbuf_free(rb);
}
+static void test_append(const void *unused)
+{
+ static uint8_t data[6] = {1, 2, 3, 4, 5, 6};
+ static size_t rb_size = 12;
+ static size_t rb_capa = 16;
+ static size_t len_no_wrap;
+ static ssize_t appended, space_left;
+ static void *rb_data;
+ struct l_ringbuf *rb;
+
+ rb = l_ringbuf_new(rb_size);
+ assert(rb != NULL);
+ assert(l_ringbuf_capacity(rb) == rb_capa);
+
+ appended = l_ringbuf_append(rb, data, sizeof(data));
+ assert(appended == sizeof(data));
+
+ appended = l_ringbuf_append(rb, data, sizeof(data));
+ assert(appended == sizeof(data));
+
+ space_left = minsize(l_ringbuf_avail(rb), sizeof(data));
+ appended = l_ringbuf_append(rb, data, sizeof(data));
+ assert(appended == space_left);
+
+ rb_data = l_ringbuf_peek(rb, 0, &len_no_wrap);
+ assert(memcmp(rb_data, data, sizeof(data)) == 0);
+ l_ringbuf_drain(rb, sizeof(data));
+
+ rb_data = l_ringbuf_peek(rb, 0, &len_no_wrap);
+ assert(memcmp(rb_data, data, sizeof(data)) == 0);
+ l_ringbuf_drain(rb, sizeof(data));
+
+ rb_data = l_ringbuf_peek(rb, 0, &len_no_wrap);
+ assert(memcmp(rb_data, data, len_no_wrap) == 0);
+ l_ringbuf_drain(rb, len_no_wrap);
+
+ l_ringbuf_free(rb);
+}
+
+static void test_append2(const void *unused)
+{
+ static uint8_t expected_data1[14] = {3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4};
+ static uint8_t expected_data2[2] = {5, 6};
+ static uint8_t data[6] = {1, 2, 3, 4, 5, 6};
+ static size_t rb_size = 12;
+ static size_t rb_capa = 16;
+ static size_t len_no_wrap;
+ static ssize_t appended, space_left;
+ static void *rb_data;
+ struct l_ringbuf *rb;
+
+ rb = l_ringbuf_new(rb_size);
+ assert(rb != NULL);
+ assert(l_ringbuf_capacity(rb) == rb_capa);
+
+ appended = l_ringbuf_append(rb, data, sizeof(data));
+ assert(appended == sizeof(data));
+
+ appended = l_ringbuf_append(rb, data, sizeof(data));
+ assert(appended == sizeof(data));
+
+ space_left = minsize(l_ringbuf_avail(rb), sizeof(data));
+ l_ringbuf_drain(rb, sizeof(data) - space_left);
+
+ appended = l_ringbuf_append(rb, data, sizeof(data));
+ assert(appended == sizeof(data));
+
+ rb_data = l_ringbuf_peek(rb, 0, &len_no_wrap);
+ assert(len_no_wrap == sizeof(expected_data1));
+ assert(memcmp(expected_data1, rb_data, len_no_wrap) == 0);
+
+ l_ringbuf_drain(rb, len_no_wrap);
+
+ rb_data = l_ringbuf_peek(rb, 0, &len_no_wrap);
+ assert(len_no_wrap == sizeof(expected_data2));
+ assert(memcmp(expected_data2, rb_data, len_no_wrap) == 0);
+
+ l_ringbuf_free(rb);
+}
+
int main(int argc, char *argv[])
{
l_test_init(&argc, &argv);
@@ -138,7 +218,8 @@ int main(int argc, char *argv[])
l_test_add("/ringbuf/power2", test_power2, NULL);
l_test_add("/ringbuf/alloc", test_alloc, NULL);
l_test_add("/ringbuf/printf", test_printf, NULL);
+ l_test_add("/ringbuf/append", test_append, NULL);
+ l_test_add("/ringbuf/append2", test_append2, NULL);
return l_test_run();
-
}
--
2.17.1
2 years, 5 months
[PATCH v2] ringbuf: Add l_ringbuf_append function
by Przemysław Fierek
---
ell/ell.sym | 1 +
ell/ringbuf.c | 69 ++++++++++++++++++++++++++++++++++++---------------
ell/ringbuf.h | 2 ++
3 files changed, 52 insertions(+), 20 deletions(-)
diff --git a/ell/ell.sym b/ell/ell.sym
index d759de6..46df1bd 100644
--- a/ell/ell.sym
+++ b/ell/ell.sym
@@ -395,6 +395,7 @@ global:
l_ringbuf_printf;
l_ringbuf_vprintf;
l_ringbuf_read;
+ l_ringbuf_append;
/* settings */
l_settings_new;
l_settings_free;
diff --git a/ell/ringbuf.c b/ell/ringbuf.c
index 49f370c..7c9777c 100644
--- a/ell/ringbuf.c
+++ b/ell/ringbuf.c
@@ -321,7 +321,7 @@ LIB_EXPORT int l_ringbuf_printf(struct l_ringbuf *ringbuf,
LIB_EXPORT int l_ringbuf_vprintf(struct l_ringbuf *ringbuf,
const char *format, va_list ap)
{
- size_t avail, offset, end;
+ size_t avail;
char *str;
int len;
@@ -342,28 +342,10 @@ LIB_EXPORT int l_ringbuf_vprintf(struct l_ringbuf *ringbuf,
return -1;
}
- /* Determine possible length of string before wrapping */
- offset = ringbuf->in & (ringbuf->size - 1);
- end = minsize((size_t) len, ringbuf->size - offset);
- memcpy(ringbuf->buffer + offset, str, end);
-
- if (ringbuf->in_tracing)
- ringbuf->in_tracing(ringbuf->buffer + offset, end,
- ringbuf->in_data);
-
- if (len - end > 0) {
- /* Put the remainder of string at the beginning */
- memcpy(ringbuf->buffer, str + end, len - end);
-
- if (ringbuf->in_tracing)
- ringbuf->in_tracing(ringbuf->buffer, len - end,
- ringbuf->in_data);
- }
+ len = l_ringbuf_append(ringbuf, str, (size_t) len);
l_free(str);
- ringbuf->in += len;
-
return len;
}
@@ -420,3 +402,50 @@ LIB_EXPORT ssize_t l_ringbuf_read(struct l_ringbuf *ringbuf, int fd)
return consumed;
}
+
+/**
+ * l_ringbuf_append:
+ * @ringbuf: Ring Buffer object
+ * @data: data to be appended
+ * @len: data length
+ *
+ * Appends data to the ring buffer.
+ *
+ * Returns: Number of appended bytes or -1 if the append failed.
+ **/
+ssize_t l_ringbuf_append(struct l_ringbuf *ringbuf, void *data, size_t len)
+{
+ size_t avail, offset, end, left;
+
+ if (!ringbuf || data == NULL)
+ return -1;
+
+ /* Determine how much can actually be appended */
+ avail = ringbuf->size - ringbuf->in + ringbuf->out;
+
+ if (!avail)
+ return -1;
+
+ /* Determine how much to append before wrapping */
+ offset = ringbuf->in & (ringbuf->size - 1);
+ end = minsize(len, ringbuf->size - offset);
+ memcpy(ringbuf->buffer + offset, data, end);
+
+ if (ringbuf->in_tracing)
+ ringbuf->in_tracing(ringbuf->buffer + offset, end,
+ ringbuf->in_data);
+
+ left = minsize(avail - end, len - end);
+
+ if (left > 0) {
+ memcpy(ringbuf->buffer, data + end, left);
+
+ if (ringbuf->in_tracing)
+ ringbuf->in_tracing(ringbuf->buffer, left,
+ ringbuf->in_data);
+ }
+
+ ringbuf->in += end + left;
+
+ return (end + left);
+}
diff --git a/ell/ringbuf.h b/ell/ringbuf.h
index 846f7a5..ba41324 100644
--- a/ell/ringbuf.h
+++ b/ell/ringbuf.h
@@ -58,6 +58,8 @@ int l_ringbuf_vprintf(struct l_ringbuf *ringbuf, const char *format,
va_list ap);
ssize_t l_ringbuf_read(struct l_ringbuf *ringbuf, int fd);
+ssize_t l_ringbuf_append(struct l_ringbuf *ringbuf, void *data, size_t len);
+
#ifdef __cplusplus
}
#endif
--
2.17.1
2 years, 5 months
[PATCH] ringbuf: Add l_ringbuf_append function
by Przemysław Fierek
This patch adds `l_ringbuf_append` function which allows to append
data to the ring buffer.
---
ell/ringbuf.c | 69 ++++++++++++++++++++++++++++++++++++---------------
ell/ringbuf.h | 2 ++
2 files changed, 51 insertions(+), 20 deletions(-)
diff --git a/ell/ringbuf.c b/ell/ringbuf.c
index 49f370c..a23f91a 100644
--- a/ell/ringbuf.c
+++ b/ell/ringbuf.c
@@ -321,7 +321,7 @@ LIB_EXPORT int l_ringbuf_printf(struct l_ringbuf *ringbuf,
LIB_EXPORT int l_ringbuf_vprintf(struct l_ringbuf *ringbuf,
const char *format, va_list ap)
{
- size_t avail, offset, end;
+ size_t avail;
char *str;
int len;
@@ -342,28 +342,10 @@ LIB_EXPORT int l_ringbuf_vprintf(struct l_ringbuf *ringbuf,
return -1;
}
- /* Determine possible length of string before wrapping */
- offset = ringbuf->in & (ringbuf->size - 1);
- end = minsize((size_t) len, ringbuf->size - offset);
- memcpy(ringbuf->buffer + offset, str, end);
-
- if (ringbuf->in_tracing)
- ringbuf->in_tracing(ringbuf->buffer + offset, end,
- ringbuf->in_data);
-
- if (len - end > 0) {
- /* Put the remainder of string at the beginning */
- memcpy(ringbuf->buffer, str + end, len - end);
-
- if (ringbuf->in_tracing)
- ringbuf->in_tracing(ringbuf->buffer, len - end,
- ringbuf->in_data);
- }
+ len = l_ringbuf_append(ringbuf, str, len);
l_free(str);
- ringbuf->in += len;
-
return len;
}
@@ -420,3 +402,50 @@ LIB_EXPORT ssize_t l_ringbuf_read(struct l_ringbuf *ringbuf, int fd)
return consumed;
}
+
+/**
+ * l_ringbuf_append:
+ * @ringbuf: Ring Buffer object
+ * @data: data to be appended
+ * @len: data length
+ *
+ * Appends data to the ring buffer.
+ *
+ * Returns: Number of appended bytes or -1 if the append failed.
+ **/
+ssize_t l_ringbuf_append(struct l_ringbuf *ringbuf, void *data, ssize_t len)
+{
+ size_t avail, offset, end, left;
+
+ if (!ringbuf || data == NULL)
+ return -1;
+
+ /* Determine how much can actually be appended */
+ avail = ringbuf->size - ringbuf->in + ringbuf->out;
+
+ if (!avail)
+ return -1;
+
+ /* Determine how much to append before wrapping */
+ offset = ringbuf->in & (ringbuf->size - 1);
+ end = minsize((size_t) len, ringbuf->size - offset);
+ memcpy(ringbuf->buffer + offset, data, end);
+
+ if (ringbuf->in_tracing)
+ ringbuf->in_tracing(ringbuf->buffer + offset, end,
+ ringbuf->in_data);
+
+ left = minsize(avail - end, len - end);
+
+ if (left > 0) {
+ memcpy(ringbuf->buffer, data + end, left);
+
+ if (ringbuf->in_tracing)
+ ringbuf->in_tracing(ringbuf->buffer, left,
+ ringbuf->in_data);
+ }
+
+ ringbuf->in += end + left;
+
+ return (end + left);
+}
diff --git a/ell/ringbuf.h b/ell/ringbuf.h
index 846f7a5..05a37d2 100644
--- a/ell/ringbuf.h
+++ b/ell/ringbuf.h
@@ -58,6 +58,8 @@ int l_ringbuf_vprintf(struct l_ringbuf *ringbuf, const char *format,
va_list ap);
ssize_t l_ringbuf_read(struct l_ringbuf *ringbuf, int fd);
+ssize_t l_ringbuf_append(struct l_ringbuf *ringbuf, void *data, ssize_t len);
+
#ifdef __cplusplus
}
#endif
--
2.17.1
2 years, 5 months
[PATCH] util: Fix -Wcast-align error in l_container_of
by Michał Lowas-Rzechonek
This fixes the following build warning:
ell/util.h:40:3: error: cast increases required alignment of target type [-Werror=cast-align]
(type *)((char *) __mptr - offsetof(type, member)); \
Which is a false positive, as recalculating struct pointer does
not affect alignment requirements of the pointer in any way.
---
ell/util.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ell/util.h b/ell/util.h
index 4f20ef0..fe7c7e2 100644
--- a/ell/util.h
+++ b/ell/util.h
@@ -37,7 +37,7 @@ extern "C" {
#define l_container_of(ptr, type, member) ({ \
const __typeof__(((type *) 0)->member) *__mptr = (ptr); \
- (type *)((char *) __mptr - offsetof(type, member)); \
+ (type *)(void *)((char *) __mptr - offsetof(type, member)); \
})
#define likely(x) __builtin_expect(!!(x), 1)
--
2.23.0
2 years, 5 months
Warn-to-error on -Werror=cast-align
by Gix, Brian
In the BlueZ build, we apparently use stricter Warn to Error checking than what is currently set up for ELL.
I got my son a new Raspberry PI, and the first thing he tried to build was ELL and BlueZ... On THAT PATFORM
ONLY, Raspbian (Raspbian 10 (buster)) with kernel 4.19, we get failures building ell/dbus.c. Everything builds
correctly in the ELL tree, using standard bootstrap-configure, however when using -Werror=cast-align, I get the
following (see below) build issues in dbus.c, genl.c, dhcp-transport.c, plus a few unit tests... In BlueZ
these errors show up with the *default* build procedure:
So my question for Marcel is: Do we need the alignment check in BlueZ?
And for Denis and Marcel, Do we care if there are alignment warnings in ELL?
Here is a dump of the make output after:
$ export CFLAGS=-Werror=cast-align
$ ./bootstrap-configure
pi@raspberrypi:~/ell $ make -k
make --no-print-directory all-am
CC ell/genl.lo
ell/genl.c: In function ‘l_genl_attr_next’:
ell/genl.c:1677:5: error: cast increases required alignment of target type [-Werror=cast-align]
(struct nlattr*)(((char*)(nla)) + \
^
ell/genl.c:1738:20: note: in expansion of macro ‘NLA_NEXT’
attr->next_data = NLA_NEXT(nla, attr->next_len);
^~~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:1864: ell/genl.lo] Error 1
CC ell/dbus.lo
In file included from ell/dbus.c:38:
ell/dbus.c: In function ‘classic_free’:
ell/util.h:40:3: error: cast increases required alignment of target type [-Werror=cast-align]
(type *)((char *) __mptr - offsetof(type, member)); \
^
ell/dbus.c:582:3: note: in expansion of macro ‘l_container_of’
l_container_of(dbus, struct l_dbus_classic, super);
^~~~~~~~~~~~~~
ell/dbus.c: In function ‘classic_recv_message’:
ell/util.h:40:3: error: cast increases required alignment of target type [-Werror=cast-align]
(type *)((char *) __mptr - offsetof(type, member)); \
^
ell/dbus.c:661:3: note: in expansion of macro ‘l_container_of’
l_container_of(dbus, struct l_dbus_classic, super);
^~~~~~~~~~~~~~
ell/dbus.c: In function ‘classic_add_match’:
ell/util.h:40:3: error: cast increases required alignment of target type [-Werror=cast-align]
(type *)((char *) __mptr - offsetof(type, member)); \
^
ell/dbus.c:812:3: note: in expansion of macro ‘l_container_of’
l_container_of(dbus, struct l_dbus_classic, super);
^~~~~~~~~~~~~~
ell/dbus.c: In function ‘classic_remove_match’:
ell/util.h:40:3: error: cast increases required alignment of target type [-Werror=cast-align]
(type *)((char *) __mptr - offsetof(type, member)); \
^
ell/dbus.c:836:3: note: in expansion of macro ‘l_container_of’
l_container_of(dbus, struct l_dbus_classic, super);
^~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:1864: ell/dbus.lo] Error 1
CC ell/dhcp-transport.lo
In file included from ell/dhcp-transport.c:44:
ell/dhcp-transport.c: In function ‘_dhcp_default_transport_broadcast’:
ell/util.h:40:3: error: cast increases required alignment of target type [-Werror=cast-align]
(type *)((char *) __mptr - offsetof(type, member)); \
^
ell/dhcp-transport.c:203:3: note: in expansion of macro ‘l_container_of’
l_container_of(s, struct dhcp_default_transport, super);
^~~~~~~~~~~~~~
ell/dhcp-transport.c: In function ‘_dhcp_default_transport_send’:
ell/util.h:40:3: error: cast increases required alignment of target type [-Werror=cast-align]
(type *)((char *) __mptr - offsetof(type, member)); \
^
ell/dhcp-transport.c:246:3: note: in expansion of macro ‘l_container_of’
l_container_of(s, struct dhcp_default_transport, super);
^~~~~~~~~~~~~~
ell/dhcp-transport.c: In function ‘_dhcp_default_transport_bind’:
ell/util.h:40:3: error: cast increases required alignment of target type [-Werror=cast-align]
(type *)((char *) __mptr - offsetof(type, member)); \
^
ell/dhcp-transport.c:316:3: note: in expansion of macro ‘l_container_of’
l_container_of(s, struct dhcp_default_transport, super);
^~~~~~~~~~~~~~
ell/dhcp-transport.c: In function ‘_dhcp_default_transport_open’:
ell/util.h:40:3: error: cast increases required alignment of target type [-Werror=cast-align]
(type *)((char *) __mptr - offsetof(type, member)); \
^
ell/dhcp-transport.c:454:3: note: in expansion of macro ‘l_container_of’
l_container_of(s, struct dhcp_default_transport, super);
^~~~~~~~~~~~~~
ell/dhcp-transport.c: In function ‘_dhcp_default_transport_close’:
ell/util.h:40:3: error: cast increases required alignment of target type [-Werror=cast-align]
(type *)((char *) __mptr - offsetof(type, member)); \
^
ell/dhcp-transport.c:476:3: note: in expansion of macro ‘l_container_of’
l_container_of(s, struct dhcp_default_transport, super);
^~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:1864: ell/dhcp-transport.lo] Error 1
CC unit/test-genl-msg.o
unit/test-genl-msg.c: In function ‘parse_set_station’:
unit/test-genl-msg.c:63:10: error: cast increases required alignment of target type [-Werror=cast-align]
nlmsg = (struct nlmsghdr *) set_station_request;
^
unit/test-genl-msg.c: In function ‘parse_set_rekey_offload’:
unit/test-genl-msg.c:159:10: error: cast increases required alignment of target type [-Werror=cast-align]
nlmsg = (struct nlmsghdr *) set_rekey_offload_request;
^
unit/test-genl-msg.c: In function ‘parse_libnl_nested’:
unit/test-genl-msg.c:287:10: error: cast increases required alignment of target type [-Werror=cast-align]
nlmsg = (struct nlmsghdr *) libnl_nested;
^
cc1: all warnings being treated as errors
make[1]: *** [Makefile:1848: unit/test-genl-msg.o] Error 1
CC unit/test-dbus-watch.o
In file included from ./ell/ell.h:23,
from unit/test-dbus-watch.c:30:
unit/test-dbus-watch.c: In function ‘test_add_match’:
./ell/util.h:40:3: error: cast increases required alignment of target type [-Werror=cast-align]
(type *)((char *) __mptr - offsetof(type, member)); \
^
unit/test-dbus-watch.c:111:3: note: in expansion of macro ‘l_container_of’
l_container_of(dbus, struct filter_test_state, dbus);
^~~~~~~~~~~~~~
unit/test-dbus-watch.c: In function ‘test_remove_match’:
./ell/util.h:40:3: error: cast increases required alignment of target type [-Werror=cast-align]
(type *)((char *) __mptr - offsetof(type, member)); \
^
unit/test-dbus-watch.c:127:3: note: in expansion of macro ‘l_container_of’
l_container_of(dbus, struct filter_test_state, dbus);
^~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:1848: unit/test-dbus-watch.o] Error 1
make[1]: Target 'all-am' not remade because of errors.
make: *** [Makefile:1199: all] Error 2
pi@raspberrypi:~/ell $
2 years, 5 months