Fix build on clang 5 (dotnet/corefx#27178)
authorOmair Majid <omajid@redhat.com>
Fri, 16 Feb 2018 12:18:00 +0000 (07:18 -0500)
committerStephen Toub <stoub@microsoft.com>
Fri, 16 Feb 2018 12:18:00 +0000 (07:18 -0500)
commitf6746a3cc334e986c6fd9d7df80b6c13c9a38af6
tree25ebd2e0433c114c8ef903c47202a707f25534fe
parent8e76e3ffa9cde63a6aacffd23bc0ccf485b9a650
Fix build on clang 5 (dotnet/corefx#27178)

This contains two fixes, both related to new warnings introduced with
clang 5:
http://releases.llvm.org/5.0.0/tools/clang/docs/ReleaseNotes.html

1. clang 5 introduces a -Wzero-as-null-pointer-constant warning, which
becomes an error with Werror. This warning is not known by older
versions of clang and affects a lot of C/C++ code, such as:

    static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;

It also affects code we pick up from our dependency libraries. Lets
check if the compiler knows about this warning and disable it if so.

2. clang 5 introduces checks for casts. The library expects a `char *`,
so lets cast our pointer to the expected type so it will continue
working.

Commit migrated from https://github.com/dotnet/corefx/commit/a9f4a46f48baeaadd515d85ac9de1249b8023a5a
src/libraries/Native/Unix/CMakeLists.txt
src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_ssl.cpp
src/libraries/Native/Unix/configure.cmake