-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Fix NULL conversion warnings found in Alpine x64 Source-Build #100796
Conversation
Tagging subscribers to this area: @mangod9 |
@@ -242,21 +242,21 @@ void CustomAssemblyBinder::PrepareForLoadContextRelease(INT_PTR ptrManagedStrong | |||
CustomAssemblyBinder::CustomAssemblyBinder() | |||
{ | |||
m_pDefaultBinder = NULL; | |||
m_ptrManagedStrongAssemblyLoadContext = NULL; | |||
m_ptrManagedStrongAssemblyLoadContext = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I worry that this kind of change reduces code readability? Are these new warnings related to a tooling update?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With a more recent musl libc (the version in Alpine 3.19), NULL is defined as nullptr directly, making what was suppressable warnings with our current toolsets into unsupressable compiler errors. This PR includes fixes for all the locations that were now procuding errors for an x64 build on Alpine 3.19 (what the source-build pipeline tests).
In the future, I plan to follow up with re-enabling the warnings and fixing the remaining cases
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so is there no way to #ifdef NULL to 0 somehow for this platform?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR uses (UINT_PTR)NULL
instead of 0 in a similar case, it seems like it would be better here too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here it would be actually (INT_PTR)NULL
Okay this PR has now included all of the various different changes to handle the three different definitions of
This generally involved changing code like |
…L problem with them
c905c35
to
138eefb
Compare
I've taken a different approach here that should still work and cut the diff in half (and removed the majority of the changes required for non Alpine). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One suggestion and a few nits to consider. Thanks!
…legating constructors. Also remove the explicit bool cast as it breaks comparisons against NULL with MSVC's definition.
Fixes dotnet/source-build#4298