Clean up redundant defines and warning suppressions in coreclr/vm/common.h - #130928
Merged
Conversation
…mon.h Remove stale USE_COM_CONTEXT_DEF and _CRT_DEPENDENCY_ defines (no longer referenced) from vm/common.h and the debug/md/unwinder stdafx.h files, and drop the blanket MSVC #pragma warning(disable:...) block from vm/common.h since those suppressions are already applied globally in eng/native/configurecompiler.cmake. Fix the two call sites that relied on the removed C4238 (rvalue used as lvalue) suppression by introducing named locals: - AllocateObject in gchelpers.cpp - OleVariant::ExtractWrappedObjectsFromArray in olevariant.cpp Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 19deab6e-8bcd-404b-957a-092862dc4014
|
Azure Pipelines: Successfully started running 3 pipeline(s). 12 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @agocke |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR removes stale/redundant preprocessor defines and per-header MSVC warning suppressions in CoreCLR’s vm/common.h, and updates the two affected call sites to avoid relying on MSVC warning C4238 suppression.
Changes:
- Removes the
_MSC_VER#pragma warning(...)suppression block and dead defines fromsrc/coreclr/vm/common.h. - Removes unused
USE_COM_CONTEXT_DEF/_CRT_DEPENDENCY_defines from severalstdafx.hfiles. - Adjusts two call sites (
gchelpers.cpp,olevariant.cpp) to avoid taking addresses of temporaries / passing rvalues where an lvalue is required.
Show a summary per file
| File | Description |
|---|---|
| src/coreclr/vm/olevariant.cpp | Introduces a named DECIMAL local before memcpyNoGCRefs to avoid C4238 (address-of-temporary) patterns. |
| src/coreclr/vm/gchelpers.cpp | Introduces a named OBJECTREF local before converting to _UNCHECKED_OBJECTREF to avoid C4238 (rvalue used as lvalue) patterns. |
| src/coreclr/vm/common.h | Removes stale defines and the header-local MSVC warning suppression block. |
| src/coreclr/unwinder/stdafx.h | Removes USE_COM_CONTEXT_DEF define (no remaining references). |
| src/coreclr/md/ceefilegen/stdafx.h | Removes _CRT_DEPENDENCY_ define (no remaining references). |
| src/coreclr/debug/ee/stdafx.h | Removes USE_COM_CONTEXT_DEF define (no remaining references). |
| src/coreclr/debug/daccess/stdafx.h | Removes USE_COM_CONTEXT_DEF define (no remaining references). |
Copilot's findings
- Files reviewed: 7/7 changed files
- Comments generated: 0
jkotas
reviewed
Jul 16, 2026
jkotas
reviewed
Jul 16, 2026
Open
3 tasks
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
elinor-fung
approved these changes
Jul 17, 2026
AaronRobinsonMSFT
enabled auto-merge (squash)
July 17, 2026 22:13
jkotas
approved these changes
Jul 18, 2026
This file contains hidden or 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
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.
Removes redundant/stale preprocessor defines and a block of blanket MSVC warning suppressions from
src/coreclr/vm/common.h, and cleans up deadUSE_COM_CONTEXT_DEF/_CRT_DEPENDENCY_defines from the debug/md/unwinderstdafx.hfiles.Changes
vm/common.h: Remove the#pragma warning(disable:...)block. The meaningful ones (4201, 4100, 4127, 4245, 4291, 4505) are already applied globally ineng/native/configurecompiler.cmake; the rest are off-by-default warnings.USE_COM_CONTEXT_DEFand_CRT_DEPENDENCY_have no remaining references insrc/coreclrand are removed.gchelpers.cpp/olevariant.cpp: Fix the two call sites that relied on the removed C4238 (rvalue used as lvalue) suppression by introducing named locals. No functional/GC behavior change.Note
This PR description was generated with the assistance of GitHub Copilot.