Fix building with clang 14 (#69990)
authorOmair Majid <omajid@redhat.com>
Wed, 13 Jul 2022 16:40:52 +0000 (11:40 -0500)
committerGitHub <noreply@github.com>
Wed, 13 Jul 2022 16:40:52 +0000 (18:40 +0200)
commitf8bf0fcc30d2e1f606266db1b644266c7bdbf063
tree8c4ff1b685b4b1c3cbbde70f3b2e78f614bb6aae
parent78111ad07e09e4e1b9d9e2f620bd56a2711ecb78
Fix building with clang 14 (#69990)

Under clang 14, building runtime on Linux with a simple ./build.sh
fails with hundreds of errors that all look like this:

    runtime/src/libraries/Native/Unix/System.Native/pal_networking.c(2610,9):
    error GD58BE485: mixing declarations and code is incompatible with
    standards before C99 [-Wdeclaration-after-statement]
    [runtime/src/libraries/Native/build-native.proj]

This issue is not present in the main branch. It appears to have been
fixed by https://github.com/dotnet/runtime/pull/66410/ which turned off
that warning.

Tested with:

    $ clang --version
    clang version 14.0.0 (Fedora 14.0.0-1.fc36)
    Target: x86_64-redhat-linux-gnu
    Thread model: posix
    InstalledDir: /usr/bin
src/libraries/Native/Unix/CMakeLists.txt