cmake HAVE_IB_GCC_ATOMIC_BUILTINS examples

alibaba/AliSQL storage/innobase/CMakeLists.txt :65

CHECK_C_SOURCE_RUNS(
  "
  int main()
  {
    long	x;
    long	y;
    long	res;

    x = 10;
    y = 123;
    res = __sync_bool_compare_and_swap(&x, x, y);
    if (!res || x != y) {
      return(1);
    }

    x = 10;
    y = 123;
    res = __sync_bool_compare_and_swap(&x, x + 1, y);
    if (res || x != 10) {
      return(1);
    }
    x = 10;
    y = 123;
    res = __sync_add_and_fetch(&x, y);
    if (res != 123 + 10 || x != 123 + 10) {
      return(1);
    }
    return(0);
  }"
  HAVE_IB_GCC_ATOMIC_BUILTINS
  )

alibaba/AliSQL storage/innobase/CMakeLists.txt :166

ADD_DEFINITIONS(-DHAVE_IB_GCC_ATOMIC_BUILTINS=1)

alibaba/AliSQLBackup storage/innobase/CMakeLists.txt :63

CHECK_C_SOURCE_RUNS(
  "
  int main()
  {
    long	x;
    long	y;
    long	res;

    x = 10;
    y = 123;
    res = __sync_bool_compare_and_swap(&x, x, y);
    if (!res || x != y) {
      return(1);
    }

    x = 10;
    y = 123;
    res = __sync_bool_compare_and_swap(&x, x + 1, y);
    if (res || x != 10) {
      return(1);
    }
    x = 10;
    y = 123;
    res = __sync_add_and_fetch(&x, y);
    if (res != 123 + 10 || x != 123 + 10) {
      return(1);
    }
    return(0);
  }"
  HAVE_IB_GCC_ATOMIC_BUILTINS
  )

alibaba/AliSQLBackup storage/innobase/CMakeLists.txt :152

ADD_DEFINITIONS(-DHAVE_IB_GCC_ATOMIC_BUILTINS=1)