Disable used-but-marked-unused warnings in System.Security.Cryptography.Native
authorOmair Majid <omajid@redhat.com>
Thu, 7 Mar 2019 06:13:49 +0000 (01:13 -0500)
committerJeremy Barton <jbarton@microsoft.com>
Thu, 7 Mar 2019 06:13:49 +0000 (22:13 -0800)
When building in non-portable mode, some OpenSSL 1.1 function defnitions
that are marked as unused can be picked up by our build. When those
functions are called, clang reports a warning and fails the build:

    src/Native/Unix/System.Security.Cryptography.Native/openssl.c:432:12:
    error: 'sk_ASN1_OBJECT_num' was marked unused but was used [-Werror,-Wused-but-marked-unused]
          return sk_ASN1_OBJECT_num(eku);
                 ^

This 'unused' attribute was recently added to sk_* methods in OpenSSL
1.1: https://github.com/openssl/openssl/pull/8246

Fixes dotnet/corefx#35807

Commit migrated from https://github.com/dotnet/corefx/commit/4819ac49f2e82158baeb464c56f4cd206da1bfec

src/libraries/Native/Unix/System.Security.Cryptography.Native/CMakeLists.txt

index 814a06cbf92bc71c9be8e9b74029aea5228d9974..cf897562f5a3db0cb9cf4a530b28d5bfbf83fa68 100644 (file)
@@ -6,6 +6,7 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
 add_compile_options(-Wno-cast-align)
 add_compile_options(-Wno-reserved-id-macro)
 add_compile_options(-Wno-documentation)
+add_compile_options(-Wno-used-but-marked-unused)
 
 add_definitions(-DPIC=1 -DOPENSSL_API_COMPAT=0x10100000L)