Skip to content

Commit

Permalink
Add make fixincludes target to invoke iwyu
Browse files Browse the repository at this point in the history
  • Loading branch information
fragglet committed Oct 13, 2024
1 parent 8921f87 commit d60a263
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/.iwyu-overrides.imp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[
# Override for bugs at time of writing (8.22):
{ symbol: [ "va_start", private, "<stdarg.h>", public ] },
{ symbol: [ "va_arg", private, "<stdarg.h>", public ] },
{ symbol: [ "va_end", private, "<stdarg.h>", public ] },
{ symbol: [ "SIGIO", private, "<signal.h>", public ] },
{ symbol: [ "SIGTSTP", private, "<signal.h>", public ] },
{ symbol: [ "SIGPOLL", private, "<signal.h>", public ] },
{ symbol: [ "SIGWINCH", private, "<signal.h>", public ] },
{ symbol: [ "SIGCONT", private, "<signal.h>", public ] },
{ symbol: [ "size_t", private, "<stdlib.h>", public ] },
]
9 changes: 9 additions & 0 deletions src/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ CFLAGS := -g -MMD -Wall -I. -O2 $(shell pkg-config --cflags $(REQUIRED_PKGS)) \
LDFLAGS := $(shell pkg-config --libs $(REQUIRED_PKGS)) \
$(LIBSIXEL_LDFLAGS) $(NCURSES_LDFLAGS)

IWYU = iwyu
IWYU_FLAGS = --error --mapping_file=.iwyu-overrides.imp
IWYU_TRANSFORMED_FLAGS = $(patsubst %,-Xiwyu %,$(IWYU_FLAGS)) $(CFLAGS)

HELP_FILES = \
../COPYING.md \
help/common.md \
Expand Down Expand Up @@ -96,6 +100,11 @@ wadgadget : $(OBJS)
%.o : %.c
$(CC) $(CFLAGS) -c $< -o $@

fixincludes:
for d in $(patsubst %.o,%.c,$(OBJS)); do \
$(IWYU) $(IWYU_TRANSFORMED_FLAGS) 2>&1 $$d | fix_include; \
done

help_text.c: $(HELP_FILES) help/make_help.py
help/make_help.py $(HELP_FILES) > $@

Expand Down

0 comments on commit d60a263

Please sign in to comment.