-
Notifications
You must be signed in to change notification settings - Fork 4.9k
[release/3.1] Fix building with clang 13 #43104
Conversation
87b5027
to
9a2586c
Compare
@omajid what's the status of this? Is this still needed? |
Yes, still needed: we would like to build .NET Core 3.1 on recent versions of Fedora (and even Alpine, see #43130) that fail because of warnings. (The alternative is each Linux distro carrying the patches locally, but that seems unnecessary for well understood changes like disabling compiler warnings). |
Ok, would you mind rebasing on top of the target branch and pushing that? |
Yup, just wanted to find some time to see if this improves things on alpine too. |
72f0d9a
to
124bc55
Compare
@safern I have rebased it and re-tested it. |
Test failures are in libraries, which look unrelated to my changes? |
The failures are unrelated but would be fixed by grabbing these lines. Could go in this PR or another. |
Branch is closed as of now. But we can merge this when is open. Thanks, @danmoseley for the pointer. If @omajid has time to port that it can be done here, if not I'll do it in a separate PR. |
@omajid the branch is open again. Can you please port the suggested lines mentioned above to get rid of the failure? |
124bc55
to
cb14d25
Compare
The test fixes were ported separately by #43137. I have rebased this PR on top of that. |
Clang 13 now enables cast-function-type warning which results in build errors that look like this: /corefx/src/Native/Unix/System.Native/pal_process.c(382,76): error G39B05358: cast from 'void (*)(int, siginfo_t *, void *)' to 'void (*)(int)' converts to incompatible function type [-Werror,-Wcast-function-type] [/corefx/src/Native/build-native.proj] void (*oldhandler)(int) = (sa_old.sa_flags & SA_SIGINFO) ? (void (*)(int))sa_old.sa_sigaction : sa_old.sa_handler; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Disable this warning using -Wno-cast-function-type warning. That seems lower-risk than any functional code change. Clang 13 also enables reserved-identifier warning which results in build errors like this: /corefx/src/Native/Unix/System.Native/pal_process.c(819,17): error GA61F72A6: identifier '__cpu' is reserved because it starts with '__' [-Werror,-Wreserved-identifier] [/corefx/src/Native/build-native.proj] if (CPU_ISSET(cpu, &set)) ^ /usr/include/sched.h:94:34: note: expanded from macro 'CPU_ISSET' # define CPU_ISSET(cpu, cpusetp) __CPU_ISSET_S (cpu, sizeof (cpu_set_t), \ ^ This really seems like a bug in clang that it's complaining about code in system libraries that we are using via wrapper-macros. But there are other instances of this warning that are speciifc to our code too, such as `__padding` in src/Native/Unix/System.Native/pal_interfaceaddresses.h. Disable this warning too. Tested with Clang 13 rc1.
cb14d25
to
8cfbb7e
Compare
/azp run corefx-ci |
Azure Pipelines successfully started running 1 pipeline(s). |
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.
The changes themselves make sense and are the least risky for servicing. @danmoseley can this be servicing-consider?
Is it worth it? It is out of support in 4 months. |
Closing since 3.1 is going out of support. |
Clang now enables cast-function-type warning which results in build
errors that look like this:
Disable this warning using -Wno-cast-function-type warning. That seems
lower-risk than any functional code change.
Clang 13 also enables reserved-identifier warning which results in build errors
like this:
This really seems like a bug in clang that it's complaiing about code in
system libraries that we are using via wrapper-macros. But there are
other instances of this warning that are speciifc to our code too, such
as
__padding
insrc/Native/Unix/System.Native/pal_interfaceaddresses.h. Disable this
warning too.
Tested with Clang 13 rc1