Skip to contentSkip to conversation

Fix Clang compilation of BlueZ

PATCH In review StormByte 2 participants 2 messages Aug 7, 2018 Bluetooth drivers

lore
Share & tools
lore

StormByte

author
#0 lore raw

PATCH 1/1 Fix Clang compilation of BlueZ

When trying to compile as much as I can in Gentoo with CLang, I realized that Bluez is not compiling due to a function definition inside a function, which is not allowed by clang.

I am not sure if this may be the best solution, but I've made a patch that makes it compile without errors (not sure if it runs good yet though).

I hope it is useful for reviewing and applying if you consider necesary,

Thanks,

David C. Manuelda

profiles/midi/midi.c +9 -9
index 1ee5cb16f..8414e900f 100644
@@ -71,20 +71,20 @@ struct midi {
 	struct midi_write_parser midi_out;
 };
 
+void foreach_cb(const struct midi_write_parser *parser, void *user_data) {
+	struct midi *midi = user_data;
+	bt_gatt_client_write_without_response(midi->client,
+	                                      midi->midi_io_handle,
+	                                      false,
+	                                      midi_write_data(parser),
+	                                      midi_write_data_size(parser));
+}
+
 static bool midi_write_cb(struct io *io, void *user_data)
 {
 	struct midi *midi = user_data;
 	int err;
 
-	void foreach_cb(const struct midi_write_parser *parser, void *user_data) {
-		struct midi *midi = user_data;
-		bt_gatt_client_write_without_response(midi->client,
-		                                      midi->midi_io_handle,
-		                                      false,
-		                                      midi_write_data(parser),
-		                                      midi_write_data_size(parser));
-	};
-
 	do {
 		snd_seq_event_t *event = NULL;
 
#1 lore raw

Hi,

Quoted 8 lines · StormByte

When trying to compile as much as I can in Gentoo with CLang, I realized that Bluez is not compiling due to a function definition inside a function, which is not allowed by clang.

I am not sure if this may be the best solution, but I've made a patch that makes it compile without errors (not sure if it runs good yet though).

I hope it is useful for reviewing and applying if you consider necesary,

Apparently this one passed the review, but we normally don't allow such construction, anyway do you mind sending a proper patch as stated in HACKING?

Quoted 5 lines

Thanks,

David C. Manuelda

Signature · 1 line
Luiz Augusto von Dentz