From c7a68894f5ebea72d1e763544eeae164cee8e650 Mon Sep 17 00:00:00 2001 From: Luca Burelli Date: Tue, 1 Oct 2024 17:01:55 +0200 Subject: [PATCH] device.h: fix inconsistent semicolon logic for DEVICE_DT_DEFINE When CONFIG_LLEXT_EXPORT_DEVICES is not enabled, the DEVICE_DT_DEFINE macro ends with the contents of the Z_DEVICE_DEFINE macro, which always includes a terminating semicolon. When CONFIG_LLEXT_EXPORT_DEVICES is enabled, the macro ends with Z_DEVICE_EXPORT, which does _not_ include a terminating semicolon. This leads to a syntax error in places where the DEVICE_DT_DEFINE macro is used without it. Fix this by adjusting the added code when CONFIG_LLEXT_EXPORT_DEVICES is enabled to include a semicolon after the Z_DEVICE_EXPORT macro; also use the opportunity to remove a stray backslash. Signed-off-by: Luca Burelli --- include/zephyr/device.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/zephyr/device.h b/include/zephyr/device.h index 8328ace40e99..1cb55c043d6b 100644 --- a/include/zephyr/device.h +++ b/include/zephyr/device.h @@ -208,7 +208,7 @@ typedef int16_t device_handle_t; level, prio, api, \ &Z_DEVICE_STATE_NAME(Z_DEVICE_DT_DEV_ID(node_id)), \ __VA_ARGS__) \ - IF_ENABLED(CONFIG_LLEXT_EXPORT_DEVICES, (; Z_DEVICE_EXPORT(node_id))) \ + IF_ENABLED(CONFIG_LLEXT_EXPORT_DEVICES, (Z_DEVICE_EXPORT(node_id);)) /** * @brief Like DEVICE_DT_DEFINE(), but uses an instance of a `DT_DRV_COMPAT`