From 2efb013a5124a9f9ae6ca86ca74d89f62fde992d Mon Sep 17 00:00:00 2001 From: Omair Majid Date: Tue, 14 Apr 2020 13:34:16 -0400 Subject: [PATCH] Fix corefx to build on clang 10 Clang 10 adds/enables new warnings, some of which is affecting the corefx code. Disable them. This is a "backport" of dotnet/runtime#33734 to corefx. After this commit, I can build all of corefx with Clang 10. --- src/Native/Unix/CMakeLists.txt | 7 +++++++ src/Native/Unix/configure.cmake | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/src/Native/Unix/CMakeLists.txt b/src/Native/Unix/CMakeLists.txt index f1d6a9ac599b..d2f7540926d9 100644 --- a/src/Native/Unix/CMakeLists.txt +++ b/src/Native/Unix/CMakeLists.txt @@ -247,6 +247,13 @@ endfunction() include(configure.cmake) +if (HAVE_WNO_ALLOCA) + add_compile_options(-Wno-alloca) +endif() +if (HAVE_WNO_IMPLICIT_INT_FLOAT_CONVERSION) + add_compile_options(-Wno-implicit-int-float-conversion) +endif() + if (NOT CLR_CMAKE_PLATFORM_WASM) add_subdirectory(System.IO.Compression.Native) add_subdirectory(System.IO.Ports.Native) diff --git a/src/Native/Unix/configure.cmake b/src/Native/Unix/configure.cmake index 061c40e6a64a..6756ea26a5e3 100644 --- a/src/Native/Unix/configure.cmake +++ b/src/Native/Unix/configure.cmake @@ -1,3 +1,4 @@ +include(CheckCCompilerFlag) include(CheckCSourceCompiles) include(CheckCSourceRuns) include(CheckFunctionExists) @@ -31,6 +32,9 @@ endif () # which are not distinguished from the test failing. So no error for that one. set(CMAKE_REQUIRED_FLAGS "-Werror -Wno-error=unused-value") +check_c_compiler_flag(-Wno-alloca HAVE_WNO_ALLOCA) +check_c_compiler_flag(-Wno-implicit-int-float-conversion HAVE_WNO_IMPLICIT_INT_FLOAT_CONVERSION) + # in_pktinfo: Find whether this struct exists check_include_files( "sys/socket.h;linux/in.h"