]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Fix regex for visibility attribute tests
authorlawadr <3211473+lawadr@users.noreply.github.com>
Fri, 17 Mar 2023 16:35:13 +0000 (16:35 +0000)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Mon, 27 Mar 2023 18:05:40 +0000 (20:05 +0200)
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.

CMakeLists.txt

index 265772dd261008f459fd86b2ea167049a2970c2d..466d12deb3d05b9bb51c903e9bb70375b58ec3fa 100644 (file)
@@ -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()