Skip to content
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

Include What You Use #1224

Open
HTRamsey opened this issue Feb 12, 2025 · 4 comments
Open

Include What You Use #1224

HTRamsey opened this issue Feb 12, 2025 · 4 comments
Labels
bug Something isn't working

Comments

@HTRamsey
Copy link
Contributor

Don't know if this is of any value to you guys, so close if not. But here are the results of running IWYU.

freertos_tcp_iwyu.txt

@HTRamsey HTRamsey added the bug Something isn't working label Feb 12, 2025
@HTRamsey HTRamsey changed the title [BUG] Include What You Use Include What You Use Feb 12, 2025
@tony-josi-aws
Copy link
Member

@HTRamsey thanks for sharing this.

It would be great to have it included in the Github CI as a PR check as well to maintain it.

@HTRamsey
Copy link
Contributor Author

I just added

if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
    find_program(INCLUDE_WHAT_YOU_USE_PROGRAM include-what-you-use)
    if(INCLUDE_WHAT_YOU_USE_PROGRAM)
        set(CMAKE_C_INCLUDE_WHAT_YOU_USE ${INCLUDE_WHAT_YOU_USE_PROGRAM})
    endif()
endif()

@tony-josi-aws
Copy link
Member

I tried applying the fixes that were generated (both locally as well as freertos_tcp_iwyu.txt) using IWYU fix_includes.py tool:
python3 ~/Tools/include-what-you-use/fix_includes.py < freertos_tcp_iwyu.txt

It seems like the build fails after applying the fixes because of missing macro definitions, mostly from header files that depended on other header files included in the same source files, as far as I checked.

@HTRamsey
Copy link
Contributor Author

Might have to make the header files self contained using --check_also. There's also other stuff you can do in the documentation to fix some issues. But without some complex workflow set up for this, it might just be better to use it as a reference only and avoid the auto-fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants