Skip to content

Conversation

@timwoj
Copy link
Member

@timwoj timwoj commented Jun 10, 2025

This changes the include style for directories outside of the current project tree to use -isystem instead of -I. This allows clang-tidy to ignore those files with the SystemHeaders: false configuration option. I only made this change for static plugins, since we probably won't be running clang-tidy with dynamic plugins.

if (FN_ARGS_INCLUDE_DIRS)
target_include_directories(${target_name} PRIVATE ${FN_ARGS_INCLUDE_DIRS})
foreach (_include_dir ${FN_ARGS_INCLUDE_DIRS})
cmake_path(IS_PREFIX PROJECT_SOURCE_DIR "${_include_dir}" _is_project_prefixed)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this for not doing it explicitly like done here?

https://github.com/zeek/zeek/blob/53c56491eec79fe8dffd38fef2429ac7ac505d1d/src/cluster/websocket/auxil/CMakeLists.txt#L9-L15

What are include dirs causing issues?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The difference is that adding the directories as system dirs allows me to ignore them all at once, instead of individually having to SKIP_LINTING on each file we might include from somewhere. For example, I can add /opt/homebrew/include on macOS and catch a lot of external files that we'd include.

As for what dirs were causing issues, I ran into openssl, krb5, hiredis, and a few others. Yes, I could extend the regex in .clang-tidy to include these (and I did at first), but this method makes more sense to me.

@timwoj timwoj force-pushed the topic/timw/clang-tidy-fixes branch from 8ca1061 to 3897377 Compare June 12, 2025 18:22
@timwoj timwoj merged commit e2211bc into master Jun 23, 2025
1 check passed
@timwoj timwoj deleted the topic/timw/clang-tidy-fixes branch June 23, 2025 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants