Skip to content

Commit cf6fa4e

Browse files
committed
tree wide: add IWYU pragma: export where needed
We occasionally have some public `foo.h` header that includes a private `foo_arch.h` header. Users are expected to include the `foo.h` header and not the `foo_arch.h`. However, clangd will claim that the `#include` of `foo.h` is unused if only functions / macros/ types / ... from `foor_arch.h` is used and nothing from `foo.h`. This adds the `IWYU pragma: export` comment to the include of `foo_arch.h` in `foo.h`, so that clangd treats functions / macros / types provided by `foo_arch.h` as if they were instead provided by `foo.h`, which fixes the false positives.
1 parent 3cdc437 commit cf6fa4e

File tree

7 files changed

+7
-7
lines changed

7 files changed

+7
-7
lines changed

core/include/thread.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129
#include "thread_flags.h"
130130
#endif
131131

132-
#include "thread_arch.h"
132+
#include "thread_arch.h" /* IWYU pragma: export */
133133

134134
#ifdef __cplusplus
135135
extern "C" {

core/lib/include/irq.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ MAYBE_INLINE bool irq_is_enabled(void);
9191
MAYBE_INLINE bool irq_is_in(void);
9292

9393
#else
94-
#include "irq_arch.h"
94+
#include "irq_arch.h" /* IWYU pragma: export */
9595
#endif /* IRQ_API_INLINED */
9696

9797
#ifdef __cplusplus

drivers/include/periph/gpio_ll.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,7 @@ static inline void gpio_ll_switch_dir_input(gpio_port_t port, uword_t inputs)
866866

867867
/* the hardware specific implementation relies on the types such as gpio_port_t
868868
* to be provided */
869-
#include "gpio_ll_arch.h"
869+
#include "gpio_ll_arch.h" /* IWYU pragma: export */
870870

871871
#endif /* PERIPH_GPIO_LL_H */
872872
/** @} */

drivers/include/periph/timer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ bool timer_poll_channel(tim_t dev, int channel);
326326
#endif
327327

328328
#if defined(MODULE_PERIPH_TIMER_POLL)
329-
#include "timer_arch.h"
329+
#include "timer_arch.h" /* IWYU pragma: export */
330330
#endif
331331

332332
#ifdef __cplusplus

sys/include/architecture.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#include <inttypes.h>
2929
#include <limits.h>
3030

31-
#include "architecture_arch.h"
31+
#include "architecture_arch.h" /* IWYU pragma: export */
3232

3333
#ifdef __cplusplus
3434
extern "C" {

sys/include/atomic_utils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@
142142
#include "macros/utils.h"
143143
#include "sched.h"
144144

145-
#include "atomic_utils_arch.h"
145+
#include "atomic_utils_arch.h" /* IWYU pragma: export */
146146

147147
#ifdef __cplusplus
148148
extern "C" {

sys/include/flash_utils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
#include "kernel_defines.h"
5555

5656
#if IS_ACTIVE(HAS_FLASH_UTILS_ARCH)
57-
#include "flash_utils_arch.h"
57+
#include "flash_utils_arch.h" /* IWYU pragma: export */
5858
#endif
5959

6060
#ifdef __cplusplus

0 commit comments

Comments
 (0)