Skip to content

Commit

Permalink
Fix cmake test for 128 bit CAS. (#10680)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ywkaras authored Oct 27, 2023
1 parent edf70d4 commit 0696e67
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions cmake/Check128BitCas.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
"
)
Expand All @@ -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)
Expand Down

0 comments on commit 0696e67

Please sign in to comment.