Skip to content

Commit

Permalink
Fix building with clang 14 (#69990)
Browse files Browse the repository at this point in the history
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 #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
  • Loading branch information
omajid authored Jul 13, 2022
1 parent 78111ad commit f8bf0fc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/libraries/Native/Unix/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ if(CLR_CMAKE_TARGET_MACCATALYST OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS
endif()
set(CMAKE_INSTALL_PREFIX $ENV{__CMakeBinDir})
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -Wno-declaration-after-statement")
set(VERSION_FILE_PATH "${CMAKE_BINARY_DIR}/version.c")

# We mark the function which needs exporting with PALEXPORT
Expand Down

0 comments on commit f8bf0fc

Please sign in to comment.