From: lawadr <3211473+lawadr@users.noreply.github.com> Date: Fri, 17 Mar 2023 16:35:13 +0000 (+0000) Subject: Fix regex for visibility attribute tests X-Git-Tag: 2.1.0-beta1~22 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a4e1f1c981c04d36c3cf4e9eed93f10280f97579;p=thirdparty%2Fzlib-ng.git Fix regex for visibility attribute tests The previous regex of `not supported` was very specific to a particular compiler (Clang 3.4+). As Clang isn't the only compiler that throws a warning (but otherwise succeeds) when a visibility isn't supported, make the regex more generic to hit all such cases. Testing on Compiler Explorer shows that looking for the string `visibility` has a better hit rate. `attribute` is perhaps more dangerously generic, and `hidden`/`internal` doesn't always show up in warning messages when the visibility attribute itself isn't available. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 265772dd..466d12de 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -374,7 +374,7 @@ check_c_source_compiles( int main() { return 0; }" - HAVE_ATTRIBUTE_VISIBILITY_HIDDEN FAIL_REGEX "not supported") + HAVE_ATTRIBUTE_VISIBILITY_HIDDEN FAIL_REGEX "visibility") if(HAVE_ATTRIBUTE_VISIBILITY_HIDDEN) add_definitions(-DHAVE_VISIBILITY_HIDDEN) endif() @@ -388,7 +388,7 @@ check_c_source_compiles( int main() { return 0; }" - HAVE_ATTRIBUTE_VISIBILITY_INTERNAL FAIL_REGEX "not supported") + HAVE_ATTRIBUTE_VISIBILITY_INTERNAL FAIL_REGEX "visibility") if(HAVE_ATTRIBUTE_VISIBILITY_INTERNAL) add_definitions(-DHAVE_VISIBILITY_INTERNAL) endif()