Skip to content

Conversation

@krisukox
Copy link
Contributor

@krisukox krisukox commented Apr 12, 2023

This PR fixes the problem of analyzing C source files using clang-tidy. The problem was that we passed C++ flags even when compiling C source files. Clang-tidy complained about -stdlib=libc++.
In order to fix this, I introduced a statement that checks if the extension of the file is "c" and gets the correct compilation flags.

This issue appeared because in PR #67 we enabled -Werror by default.

Testing

https://github.com/swift-nav/starling/pull/7851
https://jenkins.ci.swift-nav.com/blue/organizations/jenkins/swift-nav%2Fstarling/detail/PR-7851/1/pipeline

@krisukox krisukox marked this pull request as ready for review April 12, 2023 11:43
@krisukox krisukox requested a review from jungleraptor April 12, 2023 12:31
Copy link
Contributor

@jungleraptor jungleraptor left a comment

Choose a reason for hiding this comment

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

Great fix.

So one thing is we were passing -Werror before the change (on linux at least), but maybe it wasn't getting added to the clang-tidy compile line because we were setting it as a toolchain feature?

@krisukox krisukox merged commit dce5885 into main Apr 12, 2023
@krisukox krisukox deleted the krisukox/fix-clang-tidy-c-flags branch April 12, 2023 16:27
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