diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dd5c49092..0794684ef 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -63,13 +63,14 @@ jobs: - name: Bootstrap run: | sudo apt-get update - sudo apt-get --no-install-recommends install -y clang-format-14 clang-tidy-14 shellcheck + sudo apt-get --no-install-recommends install -y clang-format-14 clang-tidy-14 shellcheck iwyu python3 -m pip install yapf==0.31.0 sudo snap install shfmt npm install prettier@2.0.4 - name: Check run: | script/make-pretty check + script/check-iwyu-public-header markdown-lint-check: runs-on: ubuntu-22.04 diff --git a/include/openthread/backbone_router.h b/include/openthread/backbone_router.h index 89b5c7fb7..4b3d09ac6 100644 --- a/include/openthread/backbone_router.h +++ b/include/openthread/backbone_router.h @@ -35,6 +35,9 @@ #ifndef OPENTHREAD_BACKBONE_ROUTER_H_ #define OPENTHREAD_BACKBONE_ROUTER_H_ +#include + +#include #include #ifdef __cplusplus diff --git a/include/openthread/backbone_router_ftd.h b/include/openthread/backbone_router_ftd.h index e27551959..f4a5e3938 100644 --- a/include/openthread/backbone_router_ftd.h +++ b/include/openthread/backbone_router_ftd.h @@ -36,7 +36,12 @@ #ifndef OPENTHREAD_BACKBONE_ROUTER_FTD_H_ #define OPENTHREAD_BACKBONE_ROUTER_FTD_H_ +#include +#include + #include +#include +#include #include #include diff --git a/include/openthread/ble_secure.h b/include/openthread/ble_secure.h index 88fee32b7..fb96d4a8c 100644 --- a/include/openthread/ble_secure.h +++ b/include/openthread/ble_secure.h @@ -44,7 +44,12 @@ #ifndef OPENTHREAD_BLE_SECURE_H_ #define OPENTHREAD_BLE_SECURE_H_ +#include +#include #include + +#include +#include #include #include diff --git a/include/openthread/border_agent.h b/include/openthread/border_agent.h index 9038396b8..f9e8e2dd6 100644 --- a/include/openthread/border_agent.h +++ b/include/openthread/border_agent.h @@ -35,7 +35,11 @@ #ifndef OPENTHREAD_BORDER_AGENT_H_ #define OPENTHREAD_BORDER_AGENT_H_ +#include +#include + #include +#include #include #include diff --git a/include/openthread/border_router.h b/include/openthread/border_router.h index 2d427c17c..921983b95 100644 --- a/include/openthread/border_router.h +++ b/include/openthread/border_router.h @@ -35,7 +35,11 @@ #ifndef OPENTHREAD_BORDER_ROUTER_H_ #define OPENTHREAD_BORDER_ROUTER_H_ -#include +#include +#include + +#include +#include #include #include diff --git a/include/openthread/border_routing.h b/include/openthread/border_routing.h index 5ed54bf8f..3d795b211 100644 --- a/include/openthread/border_routing.h +++ b/include/openthread/border_routing.h @@ -35,7 +35,11 @@ #ifndef OPENTHREAD_BORDER_ROUTING_H_ #define OPENTHREAD_BORDER_ROUTING_H_ +#include +#include + #include +#include #include #include diff --git a/include/openthread/channel_manager.h b/include/openthread/channel_manager.h index d3e57ee1c..0933df986 100644 --- a/include/openthread/channel_manager.h +++ b/include/openthread/channel_manager.h @@ -35,6 +35,10 @@ #ifndef OPENTHREAD_CHANNEL_MANAGER_H_ #define OPENTHREAD_CHANNEL_MANAGER_H_ +#include +#include + +#include #include #ifdef __cplusplus diff --git a/include/openthread/channel_monitor.h b/include/openthread/channel_monitor.h index f6b96abc2..91663a307 100644 --- a/include/openthread/channel_monitor.h +++ b/include/openthread/channel_monitor.h @@ -35,6 +35,10 @@ #ifndef OPENTHREAD_CHANNEL_MONITOR_H_ #define OPENTHREAD_CHANNEL_MONITOR_H_ +#include +#include + +#include #include #ifdef __cplusplus diff --git a/include/openthread/child_supervision.h b/include/openthread/child_supervision.h index ef0a7c2e9..6267ee55b 100644 --- a/include/openthread/child_supervision.h +++ b/include/openthread/child_supervision.h @@ -35,6 +35,8 @@ #ifndef OPENTHREAD_CHILD_SUPERVISION_H_ #define OPENTHREAD_CHILD_SUPERVISION_H_ +#include + #include #ifdef __cplusplus diff --git a/include/openthread/cli.h b/include/openthread/cli.h index bcc907390..ef87de188 100644 --- a/include/openthread/cli.h +++ b/include/openthread/cli.h @@ -38,6 +38,7 @@ #include #include +#include #include #include diff --git a/include/openthread/coap.h b/include/openthread/coap.h index 76f8bed1f..8b2f25c70 100644 --- a/include/openthread/coap.h +++ b/include/openthread/coap.h @@ -35,8 +35,12 @@ #ifndef OPENTHREAD_COAP_H_ #define OPENTHREAD_COAP_H_ +#include +#include #include +#include +#include #include #include diff --git a/include/openthread/coap_secure.h b/include/openthread/coap_secure.h index 67043f55d..17bf15fd2 100644 --- a/include/openthread/coap_secure.h +++ b/include/openthread/coap_secure.h @@ -44,9 +44,15 @@ #ifndef OPENTHREAD_COAP_SECURE_H_ #define OPENTHREAD_COAP_SECURE_H_ +#include +#include #include #include +#include +#include +#include +#include #ifdef __cplusplus extern "C" { diff --git a/include/openthread/commissioner.h b/include/openthread/commissioner.h index 22147d343..be519b928 100644 --- a/include/openthread/commissioner.h +++ b/include/openthread/commissioner.h @@ -35,11 +35,14 @@ #ifndef OPENTHREAD_COMMISSIONER_H_ #define OPENTHREAD_COMMISSIONER_H_ -#include +#include +#include + +#include +#include #include #include #include -#include #ifdef __cplusplus extern "C" { diff --git a/include/openthread/crypto.h b/include/openthread/crypto.h index 7b3e184bf..da4c3e7d8 100644 --- a/include/openthread/crypto.h +++ b/include/openthread/crypto.h @@ -38,7 +38,6 @@ #include #include -#include #include #ifdef __cplusplus diff --git a/include/openthread/dataset.h b/include/openthread/dataset.h index 1444ca59d..2e270ee90 100644 --- a/include/openthread/dataset.h +++ b/include/openthread/dataset.h @@ -35,10 +35,15 @@ #ifndef OPENTHREAD_DATASET_H_ #define OPENTHREAD_DATASET_H_ +#include +#include + +#include #include #include #include #include +#include #ifdef __cplusplus extern "C" { diff --git a/include/openthread/dataset_ftd.h b/include/openthread/dataset_ftd.h index cb8aef17b..e0f8d7dd1 100644 --- a/include/openthread/dataset_ftd.h +++ b/include/openthread/dataset_ftd.h @@ -35,8 +35,11 @@ #ifndef OPENTHREAD_DATASET_FTD_H_ #define OPENTHREAD_DATASET_FTD_H_ +#include + #include -#include +#include +#include #ifdef __cplusplus extern "C" { diff --git a/include/openthread/dataset_updater.h b/include/openthread/dataset_updater.h index 02c170768..c1913a1f8 100644 --- a/include/openthread/dataset_updater.h +++ b/include/openthread/dataset_updater.h @@ -35,7 +35,10 @@ #ifndef OPENTHREAD_DATASET_UPDATER_H_ #define OPENTHREAD_DATASET_UPDATER_H_ +#include + #include +#include #include #ifdef __cplusplus diff --git a/include/openthread/diag.h b/include/openthread/diag.h index f8b62d93d..ad1ec63cf 100644 --- a/include/openthread/diag.h +++ b/include/openthread/diag.h @@ -35,6 +35,10 @@ #ifndef OPENTHREAD_DIAG_H_ #define OPENTHREAD_DIAG_H_ +#include +#include + +#include #include #include diff --git a/include/openthread/dns.h b/include/openthread/dns.h index d0ee1f581..289cb1e19 100644 --- a/include/openthread/dns.h +++ b/include/openthread/dns.h @@ -35,10 +35,10 @@ #ifndef OPENTHREAD_DNS_H_ #define OPENTHREAD_DNS_H_ +#include #include #include -#include #ifdef __cplusplus extern "C" { diff --git a/include/openthread/dns_client.h b/include/openthread/dns_client.h index 8833e0dff..4a1154f3a 100644 --- a/include/openthread/dns_client.h +++ b/include/openthread/dns_client.h @@ -35,7 +35,10 @@ #ifndef OPENTHREAD_DNS_CLIENT_H_ #define OPENTHREAD_DNS_CLIENT_H_ -#include +#include +#include + +#include #include #include diff --git a/include/openthread/dnssd_server.h b/include/openthread/dnssd_server.h index 78f7469c6..9d167d610 100644 --- a/include/openthread/dnssd_server.h +++ b/include/openthread/dnssd_server.h @@ -35,10 +35,11 @@ #ifndef OPENTHREAD_DNSSD_SERVER_H_ #define OPENTHREAD_DNSSD_SERVER_H_ +#include #include #include -#include +#include #include #ifdef __cplusplus diff --git a/include/openthread/heap.h b/include/openthread/heap.h index e6e27e5d1..156b8ce59 100644 --- a/include/openthread/heap.h +++ b/include/openthread/heap.h @@ -35,7 +35,7 @@ #ifndef OPENTHREAD_HEAP_H_ #define OPENTHREAD_HEAP_H_ -#include +#include #ifdef __cplusplus extern "C" { diff --git a/include/openthread/history_tracker.h b/include/openthread/history_tracker.h index e48e071d3..8f38d7f06 100644 --- a/include/openthread/history_tracker.h +++ b/include/openthread/history_tracker.h @@ -27,10 +27,15 @@ #ifndef OPENTHREAD_HISTORY_TRACKER_H_ #define OPENTHREAD_HISTORY_TRACKER_H_ +#include +#include + #include #include +#include #include #include +#include #ifdef __cplusplus extern "C" { diff --git a/include/openthread/icmp6.h b/include/openthread/icmp6.h index b903e8ecd..9446d7750 100644 --- a/include/openthread/icmp6.h +++ b/include/openthread/icmp6.h @@ -35,8 +35,13 @@ #ifndef OPENTHREAD_ICMP6_H_ #define OPENTHREAD_ICMP6_H_ +#include + +#include +#include #include #include +#include #ifdef __cplusplus extern "C" { diff --git a/include/openthread/instance.h b/include/openthread/instance.h index 689979e71..c9b97d470 100644 --- a/include/openthread/instance.h +++ b/include/openthread/instance.h @@ -35,11 +35,11 @@ #ifndef OPENTHREAD_INSTANCE_H_ #define OPENTHREAD_INSTANCE_H_ +#include +#include #include #include -#include -#include #ifdef __cplusplus extern "C" { @@ -52,7 +52,7 @@ extern "C" { * * @note This number versions both OpenThread platform and user APIs. */ -#define OPENTHREAD_API_VERSION (511) +#define OPENTHREAD_API_VERSION (512) /** * @addtogroup api-instance diff --git a/include/openthread/ip6.h b/include/openthread/ip6.h index 4c05b2bae..239cd2018 100644 --- a/include/openthread/ip6.h +++ b/include/openthread/ip6.h @@ -35,8 +35,13 @@ #ifndef OPENTHREAD_IP6_H_ #define OPENTHREAD_IP6_H_ +#include +#include + +#include +#include #include -#include +#include #ifdef __cplusplus extern "C" { diff --git a/include/openthread/jam_detection.h b/include/openthread/jam_detection.h index ddf523e9f..9dbaaa06d 100644 --- a/include/openthread/jam_detection.h +++ b/include/openthread/jam_detection.h @@ -35,6 +35,10 @@ #ifndef OPENTHREAD_JAM_DETECTION_H_ #define OPENTHREAD_JAM_DETECTION_H_ +#include +#include + +#include #include #ifdef __cplusplus diff --git a/include/openthread/joiner.h b/include/openthread/joiner.h index 98534db06..a723fb1d9 100644 --- a/include/openthread/joiner.h +++ b/include/openthread/joiner.h @@ -35,8 +35,11 @@ #ifndef OPENTHREAD_JOINER_H_ #define OPENTHREAD_JOINER_H_ +#include + +#include +#include #include -#include #ifdef __cplusplus extern "C" { diff --git a/include/openthread/link.h b/include/openthread/link.h index 5d41d1de1..c0a7546b0 100644 --- a/include/openthread/link.h +++ b/include/openthread/link.h @@ -35,8 +35,13 @@ #ifndef OPENTHREAD_LINK_H_ #define OPENTHREAD_LINK_H_ +#include +#include + #include #include +#include +#include #include #ifdef __cplusplus diff --git a/include/openthread/link_metrics.h b/include/openthread/link_metrics.h index dee38320c..db2c38d6a 100644 --- a/include/openthread/link_metrics.h +++ b/include/openthread/link_metrics.h @@ -35,8 +35,12 @@ #ifndef LINK_METRICS_H_ #define LINK_METRICS_H_ +#include +#include + +#include +#include #include -#include #include #ifdef __cplusplus diff --git a/include/openthread/link_raw.h b/include/openthread/link_raw.h index 92c7f9b3b..3b35e21b5 100644 --- a/include/openthread/link_raw.h +++ b/include/openthread/link_raw.h @@ -35,6 +35,11 @@ #ifndef OPENTHREAD_LINK_RAW_H_ #define OPENTHREAD_LINK_RAW_H_ +#include +#include + +#include +#include #include #ifdef __cplusplus diff --git a/include/openthread/logging.h b/include/openthread/logging.h index 3243f9b79..da6dbd677 100644 --- a/include/openthread/logging.h +++ b/include/openthread/logging.h @@ -35,8 +35,12 @@ #ifndef OPENTHREAD_LOGGING_H_ #define OPENTHREAD_LOGGING_H_ +#include +#include + #include #include +#include #ifdef __cplusplus extern "C" { diff --git a/include/openthread/mdns.h b/include/openthread/mdns.h index a40cbb8e7..c2c2d9b21 100644 --- a/include/openthread/mdns.h +++ b/include/openthread/mdns.h @@ -35,6 +35,7 @@ #ifndef OPENTHREAD_MULTICAST_DNS_H_ #define OPENTHREAD_MULTICAST_DNS_H_ +#include #include #include diff --git a/include/openthread/mesh_diag.h b/include/openthread/mesh_diag.h index 3c28ff1cf..113eb2933 100644 --- a/include/openthread/mesh_diag.h +++ b/include/openthread/mesh_diag.h @@ -35,8 +35,14 @@ #ifndef OPENTHREAD_MESH_DIAG_H_ #define OPENTHREAD_MESH_DIAG_H_ +#include +#include + +#include #include +#include #include +#include #ifdef __cplusplus extern "C" { diff --git a/include/openthread/message.h b/include/openthread/message.h index c0a4d1bcd..1397915a2 100644 --- a/include/openthread/message.h +++ b/include/openthread/message.h @@ -35,8 +35,11 @@ #ifndef OPENTHREAD_MESSAGE_H_ #define OPENTHREAD_MESSAGE_H_ +#include +#include + +#include #include -#include #ifdef __cplusplus extern "C" { diff --git a/include/openthread/multi_radio.h b/include/openthread/multi_radio.h index ed1a8767d..470ffbead 100644 --- a/include/openthread/multi_radio.h +++ b/include/openthread/multi_radio.h @@ -35,6 +35,11 @@ #ifndef OPENTHREAD_MULTI_RADIO_H_ #define OPENTHREAD_MULTI_RADIO_H_ +#include +#include + +#include +#include #include #ifdef __cplusplus diff --git a/include/openthread/nat64.h b/include/openthread/nat64.h index c6c6ace4a..17ed89121 100644 --- a/include/openthread/nat64.h +++ b/include/openthread/nat64.h @@ -35,8 +35,14 @@ #ifndef OPENTHREAD_NAT64_H_ #define OPENTHREAD_NAT64_H_ +#include +#include + +#include +#include #include #include +#include #ifdef __cplusplus extern "C" { diff --git a/include/openthread/ncp.h b/include/openthread/ncp.h index b985fbc0f..ea6c3b373 100644 --- a/include/openthread/ncp.h +++ b/include/openthread/ncp.h @@ -36,9 +36,12 @@ #define OPENTHREAD_NCP_H_ #include +#include +#include +#include +#include #include -#include #ifdef __cplusplus extern "C" { diff --git a/include/openthread/netdata.h b/include/openthread/netdata.h index a7a3dd4ac..f943ec0d0 100644 --- a/include/openthread/netdata.h +++ b/include/openthread/netdata.h @@ -35,8 +35,14 @@ #ifndef OPENTHREAD_NETDATA_H_ #define OPENTHREAD_NETDATA_H_ +#include +#include + #include +#include +#include #include +#include #ifdef __cplusplus extern "C" { diff --git a/include/openthread/netdata_publisher.h b/include/openthread/netdata_publisher.h index 3a181cda8..2f8f4142e 100644 --- a/include/openthread/netdata_publisher.h +++ b/include/openthread/netdata_publisher.h @@ -35,6 +35,12 @@ #ifndef OPENTHREAD_NETDATA_PUBLISHER_H_ #define OPENTHREAD_NETDATA_PUBLISHER_H_ +#include +#include + +#include +#include +#include #include #ifdef __cplusplus diff --git a/include/openthread/netdiag.h b/include/openthread/netdiag.h index 392c9a441..975081b2e 100644 --- a/include/openthread/netdiag.h +++ b/include/openthread/netdiag.h @@ -35,9 +35,16 @@ #ifndef OPENTHREAD_NETDIAG_H_ #define OPENTHREAD_NETDIAG_H_ +#include +#include + #include +#include +#include #include +#include #include +#include #ifdef __cplusplus extern "C" { diff --git a/include/openthread/network_time.h b/include/openthread/network_time.h index f391f053f..9685189d9 100644 --- a/include/openthread/network_time.h +++ b/include/openthread/network_time.h @@ -35,6 +35,8 @@ #ifndef OPENTHREAD_NETWORK_TIME_H_ #define OPENTHREAD_NETWORK_TIME_H_ +#include + #include #include diff --git a/include/openthread/ping_sender.h b/include/openthread/ping_sender.h index 0b7c22bf2..8aea89c87 100644 --- a/include/openthread/ping_sender.h +++ b/include/openthread/ping_sender.h @@ -35,6 +35,7 @@ #ifndef OPENTHREAD_PING_SENDER_H_ #define OPENTHREAD_PING_SENDER_H_ +#include #include #include diff --git a/include/openthread/platform/ble.h b/include/openthread/platform/ble.h index 3babae679..c75705a75 100644 --- a/include/openthread/platform/ble.h +++ b/include/openthread/platform/ble.h @@ -39,6 +39,7 @@ extern "C" { #endif +#include #include #include diff --git a/include/openthread/platform/border_routing.h b/include/openthread/platform/border_routing.h index dc11d12e9..954e455fc 100644 --- a/include/openthread/platform/border_routing.h +++ b/include/openthread/platform/border_routing.h @@ -37,7 +37,7 @@ #include -#include +#include #include #ifdef __cplusplus diff --git a/include/openthread/platform/crypto.h b/include/openthread/platform/crypto.h index c5997ee6f..f8d016035 100644 --- a/include/openthread/platform/crypto.h +++ b/include/openthread/platform/crypto.h @@ -35,10 +35,12 @@ #ifndef OPENTHREAD_PLATFORM_CRYPTO_H_ #define OPENTHREAD_PLATFORM_CRYPTO_H_ +#include #include #include #include +#include #ifdef __cplusplus extern "C" { diff --git a/include/openthread/platform/debug_uart.h b/include/openthread/platform/debug_uart.h index ddd31461d..b58753e4b 100644 --- a/include/openthread/platform/debug_uart.h +++ b/include/openthread/platform/debug_uart.h @@ -29,8 +29,10 @@ #ifndef OPENTHREAD_PLATFORM_DEBUG_UART_H_ #define OPENTHREAD_PLATFORM_DEBUG_UART_H_ +#include +#include + #include -#include /** * @file diff --git a/include/openthread/platform/diag.h b/include/openthread/platform/diag.h index da8a0d47d..9c75c9015 100644 --- a/include/openthread/platform/diag.h +++ b/include/openthread/platform/diag.h @@ -35,10 +35,12 @@ #ifndef OPENTHREAD_PLATFORM_DIAG_H_ #define OPENTHREAD_PLATFORM_DIAG_H_ -#include +#include +#include #include #include +#include #include #ifdef __cplusplus diff --git a/include/openthread/platform/dns.h b/include/openthread/platform/dns.h index 3ca6eac6c..e15f222e4 100644 --- a/include/openthread/platform/dns.h +++ b/include/openthread/platform/dns.h @@ -35,6 +35,8 @@ #ifndef OPENTHREAD_PLATFORM_DNS_H_ #define OPENTHREAD_PLATFORM_DNS_H_ +#include + #include #include diff --git a/include/openthread/platform/dnssd.h b/include/openthread/platform/dnssd.h index beff2fcbb..1cec91991 100644 --- a/include/openthread/platform/dnssd.h +++ b/include/openthread/platform/dnssd.h @@ -37,7 +37,6 @@ #include -#include #include #include #include diff --git a/include/openthread/platform/dso_transport.h b/include/openthread/platform/dso_transport.h index 03eb97e4b..01afbaf6c 100644 --- a/include/openthread/platform/dso_transport.h +++ b/include/openthread/platform/dso_transport.h @@ -35,9 +35,8 @@ #ifndef OPENTHREAD_PLATFORM_DSO_TRANSPORT_H_ #define OPENTHREAD_PLATFORM_DSO_TRANSPORT_H_ -#include +#include -#include #include #include #include diff --git a/include/openthread/platform/infra_if.h b/include/openthread/platform/infra_if.h index e4cd34ec7..60e67f3cd 100644 --- a/include/openthread/platform/infra_if.h +++ b/include/openthread/platform/infra_if.h @@ -35,6 +35,7 @@ #ifndef OPENTHREAD_PLATFORM_INFRA_IF_H_ #define OPENTHREAD_PLATFORM_INFRA_IF_H_ +#include #include #include diff --git a/include/openthread/platform/logging.h b/include/openthread/platform/logging.h index 01f7c4914..4c1f3f58d 100644 --- a/include/openthread/platform/logging.h +++ b/include/openthread/platform/logging.h @@ -35,9 +35,6 @@ #ifndef OPENTHREAD_PLATFORM_LOGGING_H_ #define OPENTHREAD_PLATFORM_LOGGING_H_ -#include -#include - #ifdef __cplusplus extern "C" { #endif diff --git a/include/openthread/platform/mdns_socket.h b/include/openthread/platform/mdns_socket.h index 009e5fbdc..db5922ab6 100644 --- a/include/openthread/platform/mdns_socket.h +++ b/include/openthread/platform/mdns_socket.h @@ -35,8 +35,10 @@ #ifndef OPENTHREAD_PLATFORM_MULTICAST_DNS_SOCKET_H_ #define OPENTHREAD_PLATFORM_MULTICAST_DNS_SOCKET_H_ +#include #include +#include #include #include #include diff --git a/include/openthread/platform/messagepool.h b/include/openthread/platform/messagepool.h index e098813a3..bd0484e19 100644 --- a/include/openthread/platform/messagepool.h +++ b/include/openthread/platform/messagepool.h @@ -35,9 +35,10 @@ #ifndef OPENTHREAD_PLATFORM_MESSAGEPOOL_H_ #define OPENTHREAD_PLATFORM_MESSAGEPOOL_H_ +#include #include -#include +#include /** * @addtogroup plat-messagepool diff --git a/include/openthread/platform/misc.h b/include/openthread/platform/misc.h index b2928776a..0b5b6241c 100644 --- a/include/openthread/platform/misc.h +++ b/include/openthread/platform/misc.h @@ -35,8 +35,7 @@ #ifndef OPENTHREAD_PLATFORM_MISC_H_ #define OPENTHREAD_PLATFORM_MISC_H_ -#include - +#include #include #ifdef __cplusplus diff --git a/include/openthread/platform/multipan.h b/include/openthread/platform/multipan.h index 897dcb297..4340263b4 100644 --- a/include/openthread/platform/multipan.h +++ b/include/openthread/platform/multipan.h @@ -46,6 +46,7 @@ #ifndef OPENTHREAD_PLATFORM_MULTIPAN_H_ #define OPENTHREAD_PLATFORM_MULTIPAN_H_ +#include #include #include diff --git a/include/openthread/platform/radio.h b/include/openthread/platform/radio.h index b49be9cfd..8c7971264 100644 --- a/include/openthread/platform/radio.h +++ b/include/openthread/platform/radio.h @@ -35,11 +35,13 @@ #ifndef OPENTHREAD_PLATFORM_RADIO_H_ #define OPENTHREAD_PLATFORM_RADIO_H_ +#include #include #include #include #include +#include #ifdef __cplusplus extern "C" { diff --git a/include/openthread/platform/settings.h b/include/openthread/platform/settings.h index baa3c0afa..d197022b0 100644 --- a/include/openthread/platform/settings.h +++ b/include/openthread/platform/settings.h @@ -35,6 +35,9 @@ #ifndef OPENTHREAD_PLATFORM_SETTINGS_H_ #define OPENTHREAD_PLATFORM_SETTINGS_H_ +#include + +#include #include #ifdef __cplusplus diff --git a/include/openthread/platform/toolchain.h b/include/openthread/platform/toolchain.h index acdd924b7..2b92ec347 100644 --- a/include/openthread/platform/toolchain.h +++ b/include/openthread/platform/toolchain.h @@ -57,7 +57,6 @@ #define OPENTHREAD_PLATFORM_TOOLCHAIN_H_ #include -#include #ifdef __cplusplus extern "C" { diff --git a/include/openthread/platform/trel.h b/include/openthread/platform/trel.h index 8401b0d8f..b03da73a5 100644 --- a/include/openthread/platform/trel.h +++ b/include/openthread/platform/trel.h @@ -35,9 +35,9 @@ #ifndef OPENTHREAD_PLATFORM_TREL_H_ #define OPENTHREAD_PLATFORM_TREL_H_ +#include #include -#include #include #include diff --git a/include/openthread/platform/udp.h b/include/openthread/platform/udp.h index e7d4961e0..74a306cbb 100644 --- a/include/openthread/platform/udp.h +++ b/include/openthread/platform/udp.h @@ -35,6 +35,9 @@ #ifndef OPENTHREAD_PLATFORM_UDP_H_ #define OPENTHREAD_PLATFORM_UDP_H_ +#include +#include +#include #include #ifdef __cplusplus diff --git a/include/openthread/radio_stats.h b/include/openthread/radio_stats.h index 3f5125bdf..c08c9502d 100644 --- a/include/openthread/radio_stats.h +++ b/include/openthread/radio_stats.h @@ -37,7 +37,6 @@ #include -#include #include #ifdef __cplusplus diff --git a/include/openthread/server.h b/include/openthread/server.h index 74e73bb48..9ea9e38b4 100644 --- a/include/openthread/server.h +++ b/include/openthread/server.h @@ -35,6 +35,11 @@ #ifndef OPENTHREAD_SERVER_H_ #define OPENTHREAD_SERVER_H_ +#include +#include + +#include +#include #include #ifdef __cplusplus diff --git a/include/openthread/sntp.h b/include/openthread/sntp.h index c9b5222ca..28230a8d3 100644 --- a/include/openthread/sntp.h +++ b/include/openthread/sntp.h @@ -37,6 +37,8 @@ #include +#include +#include #include #ifdef __cplusplus diff --git a/include/openthread/srp_client.h b/include/openthread/srp_client.h index 4c8ebae88..4383e24b1 100644 --- a/include/openthread/srp_client.h +++ b/include/openthread/srp_client.h @@ -35,7 +35,12 @@ #ifndef OPENTHREAD_SRP_CLIENT_H_ #define OPENTHREAD_SRP_CLIENT_H_ +#include +#include + #include +#include +#include #include #ifdef __cplusplus diff --git a/include/openthread/srp_client_buffers.h b/include/openthread/srp_client_buffers.h index 339d661e2..90e0367c4 100644 --- a/include/openthread/srp_client_buffers.h +++ b/include/openthread/srp_client_buffers.h @@ -35,7 +35,11 @@ #ifndef OPENTHREAD_SRP_CLIENT_BUFFERS_H_ #define OPENTHREAD_SRP_CLIENT_BUFFERS_H_ +#include + #include +#include +#include #include #ifdef __cplusplus diff --git a/include/openthread/srp_server.h b/include/openthread/srp_server.h index f97d7d31c..3ddeab329 100644 --- a/include/openthread/srp_server.h +++ b/include/openthread/srp_server.h @@ -35,9 +35,10 @@ #ifndef OPENTHREAD_SRP_SERVER_H_ #define OPENTHREAD_SRP_SERVER_H_ +#include #include -#include +#include #include #include diff --git a/include/openthread/tasklet.h b/include/openthread/tasklet.h index 18a08973c..9ccd8f230 100644 --- a/include/openthread/tasklet.h +++ b/include/openthread/tasklet.h @@ -35,6 +35,8 @@ #ifndef OPENTHREAD_TASKLET_H_ #define OPENTHREAD_TASKLET_H_ +#include + #include #ifdef __cplusplus diff --git a/include/openthread/tcat.h b/include/openthread/tcat.h index 65313448f..80256d7b8 100644 --- a/include/openthread/tcat.h +++ b/include/openthread/tcat.h @@ -45,6 +45,9 @@ #define OPENTHREAD_TCAT_H_ #include + +#include +#include #include #ifdef __cplusplus diff --git a/include/openthread/tcp.h b/include/openthread/tcp.h index a99b69cc2..31c51085a 100644 --- a/include/openthread/tcp.h +++ b/include/openthread/tcp.h @@ -35,6 +35,12 @@ #ifndef OPENTHREAD_TCP_H_ #define OPENTHREAD_TCP_H_ +#include +#include +#include + +#include +#include #include #ifdef __cplusplus @@ -64,7 +70,6 @@ typedef struct otLinkedBuffer size_t mLength; ///< Length of this linked buffer (number of bytes). } otLinkedBuffer; -struct otTcpEndpoint; typedef struct otTcpEndpoint otTcpEndpoint; /** @@ -554,7 +559,6 @@ otError otTcpAbort(otTcpEndpoint *aEndpoint); */ otError otTcpEndpointDeinitialize(otTcpEndpoint *aEndpoint); -struct otTcpListener; typedef struct otTcpListener otTcpListener; /** diff --git a/include/openthread/tcp_ext.h b/include/openthread/tcp_ext.h index cdb29aaa3..8568cf14c 100644 --- a/include/openthread/tcp_ext.h +++ b/include/openthread/tcp_ext.h @@ -35,6 +35,10 @@ #ifndef OPENTHREAD_TCP_EXT_H_ #define OPENTHREAD_TCP_EXT_H_ +#include +#include + +#include #include #ifdef __cplusplus diff --git a/include/openthread/thread.h b/include/openthread/thread.h index 8be4cec6e..5cbbad805 100644 --- a/include/openthread/thread.h +++ b/include/openthread/thread.h @@ -35,9 +35,15 @@ #ifndef OPENTHREAD_THREAD_H_ #define OPENTHREAD_THREAD_H_ +#include +#include + #include +#include +#include +#include #include -#include +#include #ifdef __cplusplus extern "C" { diff --git a/include/openthread/thread_ftd.h b/include/openthread/thread_ftd.h index 4571a0bf1..a9e66e924 100644 --- a/include/openthread/thread_ftd.h +++ b/include/openthread/thread_ftd.h @@ -35,9 +35,15 @@ #ifndef OPENTHREAD_THREAD_FTD_H_ #define OPENTHREAD_THREAD_FTD_H_ -#include -#include +#include +#include + +#include +#include +#include +#include #include +#include #ifdef __cplusplus extern "C" { diff --git a/include/openthread/trel.h b/include/openthread/trel.h index 23e4c47e6..4082d693c 100644 --- a/include/openthread/trel.h +++ b/include/openthread/trel.h @@ -35,7 +35,11 @@ #ifndef OPENTHREAD_TREL_H_ #define OPENTHREAD_TREL_H_ +#include +#include + #include +#include #include #include #include diff --git a/include/openthread/udp.h b/include/openthread/udp.h index 7c36bf049..d1679cbd5 100644 --- a/include/openthread/udp.h +++ b/include/openthread/udp.h @@ -35,6 +35,11 @@ #ifndef OPENTHREAD_UDP_H_ #define OPENTHREAD_UDP_H_ +#include +#include + +#include +#include #include #include diff --git a/script/bootstrap b/script/bootstrap index 3900df82f..227a6f92e 100755 --- a/script/bootstrap +++ b/script/bootstrap @@ -48,6 +48,8 @@ install_packages_pretty_format() # add shfmt for shell pretty command -v shfmt || sudo apt-get install shfmt || echo 'WARNING: could not install shfmt, which is useful if you plan to contribute shell scripts to the OpenThread project.' + + sudo apt-get --no-install-recommends install -y iwyu || echo 'WARNING: iwyu, which is useful to ensure applying the IWYU rules.' } install_packages_apt() @@ -122,6 +124,8 @@ install_packages_brew() # add yapf for pretty python3 -m pip install yapf || echo 'Failed to install python code formatter yapf. Install it manually if you need.' + + brew install include-what-you-use || echo 'WARNING: iwyu, which is useful to ensure applying the IWYU rules.' } install_packages_source() diff --git a/script/check-iwyu-public-header b/script/check-iwyu-public-header new file mode 100755 index 000000000..13cb4101c --- /dev/null +++ b/script/check-iwyu-public-header @@ -0,0 +1,44 @@ +#!/bin/bash +# +# Copyright (c) 2025, The OpenThread Authors. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. Neither the name of the copyright holder nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +# +# Run this command on parent directory of openthread +# + +set -euxo pipefail + +main() +{ + find include -name '*.h' -exec iwyu -I include {} \; 2>&1 \ + | fix_include -n --nosafe_headers \ + | tee >(cat 1>&2) \ + | grep 'IWYU edited 0 files on your behalf.' +} + +main "$@" diff --git a/src/core/common/type_traits.hpp b/src/core/common/type_traits.hpp index a3342c685..676bcdd85 100644 --- a/src/core/common/type_traits.hpp +++ b/src/core/common/type_traits.hpp @@ -34,6 +34,8 @@ #ifndef OT_TYPE_TRAITS_HPP_ #define OT_TYPE_TRAITS_HPP_ +#include + namespace ot { namespace TypeTraits { diff --git a/src/lib/spinel/logger.hpp b/src/lib/spinel/logger.hpp index 86d31b9c5..68963d9b5 100644 --- a/src/lib/spinel/logger.hpp +++ b/src/lib/spinel/logger.hpp @@ -29,6 +29,8 @@ #ifndef SPINEL_LOGGER_HPP_ #define SPINEL_LOGGER_HPP_ +#include + #include #include diff --git a/src/lib/spinel/spinel_decoder.hpp b/src/lib/spinel/spinel_decoder.hpp index d81e7111a..74337a877 100644 --- a/src/lib/spinel/spinel_decoder.hpp +++ b/src/lib/spinel/spinel_decoder.hpp @@ -37,6 +37,7 @@ #include #include +#include #include "spinel.h" diff --git a/src/lib/spinel/spinel_encoder.hpp b/src/lib/spinel/spinel_encoder.hpp index 6d2d7f640..c9c08c770 100644 --- a/src/lib/spinel/spinel_encoder.hpp +++ b/src/lib/spinel/spinel_encoder.hpp @@ -38,6 +38,7 @@ #include #include #include +#include #include "spinel.h" #include "spinel_buffer.hpp" diff --git a/src/posix/platform/infra_if.cpp b/src/posix/platform/infra_if.cpp index 89b1f7bdf..71c5d785c 100644 --- a/src/posix/platform/infra_if.cpp +++ b/src/posix/platform/infra_if.cpp @@ -55,6 +55,7 @@ #endif #include +#include #include #include "infra_if.hpp" diff --git a/src/posix/platform/openthread-core-posix-config.h b/src/posix/platform/openthread-core-posix-config.h index 352646a1c..64200a4e6 100644 --- a/src/posix/platform/openthread-core-posix-config.h +++ b/src/posix/platform/openthread-core-posix-config.h @@ -34,6 +34,8 @@ #ifndef OPENTHREAD_CORE_POSIX_CONFIG_H_ #define OPENTHREAD_CORE_POSIX_CONFIG_H_ +#include + #include "openthread-posix-daemon-config.h" #ifndef OPENTHREAD_CONFIG_NUM_MESSAGE_BUFFERS diff --git a/src/posix/platform/utils.hpp b/src/posix/platform/utils.hpp index 73c1e5298..41f64e234 100644 --- a/src/posix/platform/utils.hpp +++ b/src/posix/platform/utils.hpp @@ -29,6 +29,8 @@ #ifndef OT_POSIX_PLATFORM_UTILS_HPP_ #define OT_POSIX_PLATFORM_UTILS_HPP_ +#include + #include namespace ot {