-
Notifications
You must be signed in to change notification settings - Fork 674
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
Add const keyword to resolve warnings (treated as errors) C26462 and C26496 #8567
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
llongley
approved these changes
Jun 20, 2023
ranjeshj
approved these changes
Jun 20, 2023
karkarl
reviewed
Jun 20, 2023
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
kmahone
pushed a commit
that referenced
this pull request
Jul 7, 2023
…C26496 (#8567) * Add const keyword as needed to resolve warnings C26462,C26496 * fix typo * few more fixes * add deprecated link * fix pointer in const --------- Co-authored-by: Dmitriy Komin <[email protected]> Co-authored-by: Ranjesh Jaganathan <[email protected]> Co-authored-by: Karen Lai <[email protected]>
kmahone
added a commit
that referenced
this pull request
Jul 7, 2023
Includes these fixes: * [Fix Deprecated icons ](#8576) * [Fix Voice Access 'Show Bubbles' annotation of WebView2 Content](#8551) * [Add const keyword to resolve warnings (treated as errors) C26462 and C26496](#8567) * [[WebView2] Apply text scale factor to CoreWebView2 content](#8540) * [Fix horizontal scrolling on trackpad](#8403)
ronanlee777
added a commit
to ronanlee777/csharp-microsoft
that referenced
this pull request
Aug 5, 2024
Includes these fixes: * [Fix Deprecated icons ](microsoft/microsoft-ui-xaml#8576) * [Fix Voice Access 'Show Bubbles' annotation of WebView2 Content](microsoft/microsoft-ui-xaml#8551) * [Add const keyword to resolve warnings (treated as errors) C26462 and C26496](microsoft/microsoft-ui-xaml#8567) * [[WebView2] Apply text scale factor to CoreWebView2 content](microsoft/microsoft-ui-xaml#8540) * [Fix horizontal scrolling on trackpad](microsoft/microsoft-ui-xaml#8403)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In recent weeks, WinUI2 builds (local and lab) are failing due to the static analysis warnings (treated as errors) C26462 and C26496. These warnings enforce the C++ Core Guidelines rule "Con.4: Use const to define objects with values that do not change after construction."
C26462 and C26496 have been part of build/PrefastWarnings.ruleset since July 2020 and their handling in the build does not appear to have changed, so it's not clear why new occurrences are being picked up now. My best guess is that recent fixes/improvements to VS toolset have enabled new classes of this condition to be identified, and as the update rolls out, we are seeing increasing build failures of this sort.
Address the 100 newly identified "should use const" warnings (-> errors) by adding const keyword to variable/pointer variable declarations.