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

Update deprecated headers #36417

Merged
merged 3 commits into from
Dec 25, 2019
Merged

Conversation

jbytheway
Copy link
Contributor

Summary

SUMMARY: None

Purpose of change

More static analysis.

This check doesn't really matter from a code quality perspective, it's just for the sake of having a standard and being consistent about how we include C standard library headers.

Describe the solution

Enable the clang-tidy check modernize-deprecated-headers.

Get clang-tidy to update all the existing old-style includes.

Fix a couple of unrelated clang-tidy errors.

Describe alternatives you've considered

We could standardize in the opposite direction, but that's not easy to check automatically.

Technically we ought to switch all our library calls to have a std:: prefix when using these headers. I think the calls that need changing can be detected using IWYU. I might do that at some point, but I don't think it needs to be in the same PR.

Testing

Compiled the code.

Additional context

Inspired by a review comment on a recent PR.

Convert all C library includes to their C++ equivalents (stdio.h ->
cstdio, etc.).
Enable this clang-tidy check.
@ZhilkinSerg ZhilkinSerg added [C++] Changes (can be) made in C++. Previously named `Code` Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style labels Dec 24, 2019
if( you.wield( *orig ) ) {
orig = &you.weapon;
} else {
if( !you.wield( *orig ) ) {
Copy link
Member

Choose a reason for hiding this comment

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

This seems unrelated? Also I'm not sure the logic is correct.

Copy link
Member

Choose a reason for hiding this comment

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

I see orig is never read again, so it's correct.

@ZhilkinSerg ZhilkinSerg merged commit 582be4f into CleverRaven:master Dec 25, 2019
@jbytheway jbytheway deleted the deprecated_headers branch December 30, 2019 00:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C++] Changes (can be) made in C++. Previously named `Code` Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants