JosiahWI commented on code in PR #10680:
URL: https://github.com/apache/trafficserver/pull/10680#discussion_r1373502643


##########
cmake/Check128BitCas.cmake:
##########
@@ -25,18 +25,16 @@
 
 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);

Review Comment:
   ```suggestion
           return __sync_bool_compare_and_swap(&x,0,10) ? 0 : 1;
   ```
   As the name suggests, `__sync_bool_compare_and_swap` returns a `bool`. 
https://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Atomic-Builtins.html



##########
cmake/Check128BitCas.cmake:
##########
@@ -25,18 +25,16 @@
 
 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);
     }
     "
 )
 
 include(CheckCSourceCompiles)
+set(CMAKE_REQUIRED_FLAGS "-march=native")
 check_c_source_compiles("${CHECK_PROGRAM}" TS_HAS_128BIT_CAS)
 

Review Comment:
   It might be wise to `unset(CMAKE_REQUIRED_FLAGS)`, because otherwise the 
variable persists and could influence the next call to 
`check_c_source_compiles` unintentionally.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to