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

Apply [[nodiscard]] to functions returning error codes #953

Merged
3 commits merged into from
May 30, 2019
Merged

Apply [[nodiscard]] to functions returning error codes #953

3 commits merged into from
May 30, 2019

Conversation

binarycrusader
Copy link
Member

Summary of the Pull Request

Functions returning status codes should use [[nodiscard]] as mentioned recently by @adiviness.

They should also use noexcept, but that's a much more invasive change, so this issue is just about [[nodiscard]].

References

#897

PR Checklist

Detailed Description of the Pull Request / Additional comments

  • applied [[nodiscard]] for all HRESULT, LRESULT, and NTSTATUS functions
  • fixed IntelliSense declaration complaints leading to function not
    implemented warnings
  • deleted declared but never implemented functions
  • fixed unused parameter warnings

Please note I only checked for functions that had a declaration in a header file of some kind, so there might still be some functions only defined and used within .cpp files that don't have [[nodiscard]] applied.

How verified:

  • bcz dbg
  • opencon
  • testcon
  • VS2019 debug build

- applied [[nodiscard]] for all HRESULT, LRESULT, and NTSTATUS functions
- fixed IntelliSense declaration complaints leading to function not
  implemented warnings
- deleted declared but never implemented functions
- fixed unused parameter warnings

How verified:
- bcz dbg
- opencon
- testcon
- VS2019 debug build
src/host/ConsoleArguments.hpp Show resolved Hide resolved
src/host/VtIo.cpp Show resolved Hide resolved
src/propsheet/fontdlg.cpp Outdated Show resolved Hide resolved
src/propsheet/fontdlg.cpp Outdated Show resolved Hide resolved
src/propsheet/misc.cpp Outdated Show resolved Hide resolved
src/server/IoDispatchers.cpp Outdated Show resolved Hide resolved
Copy link
Member

@zadjii-msft zadjii-msft left a comment

Choose a reason for hiding this comment

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

Seems good enough to me. Someone else (@miniksa) might hound you more on casting the HRESULT to void instead of LOG_IF_FAIL-ing, so I'm gonna let someone else make that call

@miniksa miniksa added the Area-CodeHealth Issues related to code cleanliness, linting, rules, warnings, errors, static analysis, etc. label May 23, 2019
@binarycrusader
Copy link
Member Author

Seems good enough to me. Someone else (@miniksa) might hound you more on casting the HRESULT to void instead of LOG_IF_FAIL-ing, so I'm gonna let someone else make that call

I've used WIL quite a bit, but never used the LOG_* macros so didn't think of applying them. Unless I hear otherwise, I'll assume that approach in the future, thanks.

src/propsheet/fontdlg.cpp Outdated Show resolved Hide resolved
src/propsheet/misc.cpp Outdated Show resolved Hide resolved
@ghost ghost added Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels May 23, 2019
- remove use of goto
- make MakeAltRasterFont return void
src/propsheet/console.h Show resolved Hide resolved
- remove vestigal function declarations
- fix inconsistent function declaration
@miniksa miniksa added the AutoMerge Marked for automatic merge by the bot when requirements are met label May 30, 2019
@ghost
Copy link

ghost commented May 30, 2019

Hello @miniksa!

Because this pull request has the AutoMerge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@ghost ghost merged commit e52170e into microsoft:master May 30, 2019
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-CodeHealth Issues related to code cleanliness, linting, rules, warnings, errors, static analysis, etc. AutoMerge Marked for automatic merge by the bot when requirements are met
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Code Health: apply [[nodiscard]] to functions that return status codes
6 participants