-
Notifications
You must be signed in to change notification settings - Fork 56
Add include-what-you-use test for public headers #73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,6 +34,10 @@ | |
| #ifndef CYW43_INCLUDED_CYW43_SDIO_H | ||
| #define CYW43_INCLUDED_CYW43_SDIO_H | ||
|
|
||
| #include <stdint.h> | ||
| #include <stdbool.h> | ||
| #include <stddef.h> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we sort these alphabetically by file name? |
||
|
|
||
| // These must be provided by a port, if the SDIO bus interface is used. | ||
| void cyw43_sdio_init(void); | ||
| void cyw43_sdio_reinit(void); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,6 +34,11 @@ | |
| #ifndef CYW43_INCLUDED_CYW43_SPI_H | ||
| #define CYW43_INCLUDED_CYW43_SPI_H | ||
|
|
||
| #include "cyw43_internal.h" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That seems strange that a public header needs to include an internal header... need to think about this some more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Agreed. The supposedly internal cyw43_int_t in the supposedly public API makes for a visibilty mismatch. I'll handle the other remarks in the meantime. |
||
|
|
||
| #include <stdint.h> | ||
| #include <stddef.h> | ||
|
|
||
| // Test register value | ||
| #define TEST_PATTERN 0xFEEDBEADu | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,10 +48,32 @@ $(OBJ): | $(OBJ_DIRS) | |
| $(OBJ_DIRS): | ||
| $(MKDIR) -p $@ | ||
|
|
||
| # "Include-what-you-use"-test compilation for public headers | ||
| PUBLIC_HEADER := \ | ||
| src/cyw43.h \ | ||
| src/cyw43_btbus.h \ | ||
| src/cyw43_country.h \ | ||
| src/cyw43_sdio.h \ | ||
| src/cyw43_spi.h \ | ||
| src/cyw43_stats.h \ | ||
|
|
||
| vpath %.h . $(CYW43_TOP) | ||
|
|
||
| PUBLIC_HEADER_GCH := $(patsubst %,$(BUILD)/%.gch,$(PUBLIC_HEADER)) | ||
|
|
||
| # Static pattern rule testing header compilation by making a pre-compiled header of each | ||
| $(PUBLIC_HEADER_GCH): $(BUILD)/%.h.gch: %.h | ||
| # Pass -Wno-pedantic to suppress "empty translation unit" errors | ||
| $(CC) $(CFLAGS) -Wno-pedantic -c $< -o $@ | ||
|
|
||
| # Add to phony test target trigger | ||
| test: $(PUBLIC_HEADER_GCH) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we move this header test (pre-compiled headers) to a completely separate test? Eg |
||
|
|
||
| # Dependency generation | ||
| %.o: %.d | ||
| %.gch: %.d | ||
| CFLAGS += -MP -MMD | ||
| DEP := $(OBJ:.o=.d) | ||
| DEP := $(OBJ:.o=.d) $(PUBLIC_HEADER_GCH:.gch=.d) | ||
| $(DEP): | ||
|
|
||
| -include $(DEP) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This (cyw43_internal.h) is not a public header, so I don't think it needs anything added to it.