This is an automated email from the ASF dual-hosted git repository.

wkaras pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new 0696e6747c Fix cmake test for 128 bit CAS. (#10680)
0696e6747c is described below

commit 0696e6747c24e97ad87bef062bc437cec5554d6b
Author: Walt Karas <[email protected]>
AuthorDate: Fri Oct 27 14:05:15 2023 -0400

    Fix cmake test for 128 bit CAS. (#10680)
    
    The cmake check_c_source_compiles() function seems to want to
    successfully link as well as compile the sample code.
    
    https://godbolt.org/z/oGGcGY7Gn
    
    
https://stackoverflow.com/questions/62391538/how-can-i-link-sync-bool-compare-and-swap-16
---
 cmake/Check128BitCas.cmake | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/cmake/Check128BitCas.cmake b/cmake/Check128BitCas.cmake
index 1e9a80b9ba..e743607ad7 100644
--- a/cmake/Check128BitCas.cmake
+++ b/cmake/Check128BitCas.cmake
@@ -25,13 +25,10 @@
 
 set(CHECK_PROGRAM
     "
-    int
-    main()
+    int main(void)
     {
         __int128_t x = 0;
-        __sync_bool_compare_and_swap(&x,0,10);
-
-        return 0;
+        return __sync_bool_compare_and_swap(&x,0,10);
     }
     "
 )
@@ -41,7 +38,7 @@ check_c_source_compiles("${CHECK_PROGRAM}" TS_HAS_128BIT_CAS)
 
 if(NOT TS_HAS_128BIT_CAS)
     unset(TS_HAS_128BIT_CAS CACHE)
-    set(CMAKE_REQUIRED_FLAGS "-Werror" "-mcx16")
+    set(CMAKE_REQUIRED_FLAGS "-Werror -mcx16")
     check_c_source_compiles("${CHECK_PROGRAM}" TS_HAS_128BIT_CAS)
     set(NEED_MCX16 ${TS_HAS_128BIT_CAS})
     unset(CMAKE_REQUIRED_FLAGS)

Reply via email to