/*
 * Copyright (c) 2003 by Hewlett-Packard Company.  All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

/* This generates a compilable program.  But it is really meant to be   */
/* be used only with cc -E, to inspect the expensions generated by      */
/* primitives.                                                          */

/* The result will not link or run.                                     */

#include <stdlib.h> /* for exit() */

void XSIZE_list_atomicXX(void)
{
# if defined(AO_HAVE_XSIZE_loadXX) || defined(AO_HAVE_XSIZE_storeXX) \
     || defined(AO_HAVE_XSIZE_fetch_and_addXX) \
     || defined(AO_HAVE_XSIZE_fetch_and_add1XX) \
     || defined(AO_HAVE_XSIZE_andXX) \
     || defined(AO_HAVE_XSIZE_compare_and_swapXX) \
     || defined(AO_HAVE_XSIZE_fetch_compare_and_swapXX)
    static volatile XCTYPE val /* = 0 */;
# endif
# if defined(AO_HAVE_XSIZE_compare_and_swapXX) \
     || defined(AO_HAVE_XSIZE_fetch_compare_and_swapXX)
    static XCTYPE oldval /* = 0 */;
# endif
# if defined(AO_HAVE_XSIZE_storeXX) \
     || defined(AO_HAVE_XSIZE_compare_and_swapXX) \
     || defined(AO_HAVE_XSIZE_fetch_compare_and_swapXX)
    static XCTYPE newval /* = 0 */;
# endif
# if defined(AO_HAVE_test_and_setXX)
    AO_TS_t ts = AO_TS_INITIALIZER;
# endif
# if defined(AO_HAVE_XSIZE_fetch_and_addXX) || defined(AO_HAVE_XSIZE_andXX) \
     || defined(AO_HAVE_XSIZE_orXX) || defined(AO_HAVE_XSIZE_xorXX)
    static XCTYPE incr /* = 0 */;
# endif

# if defined(AO_HAVE_nopXX)
    (void)"AO_nopXX(): ";
    AO_nopXX();
# else
    (void)"No AO_nopXX";
# endif

# ifdef AO_HAVE_XSIZE_loadXX
    (void)"AO_XSIZE_loadXX(&val):";
    (void)AO_XSIZE_loadXX(&val);
# else
    (void)"No AO_XSIZE_loadXX";
# endif
# ifdef AO_HAVE_XSIZE_storeXX
    (void)"AO_XSIZE_storeXX(&val, newval):";
    AO_XSIZE_storeXX(&val, newval);
# else
    (void)"No AO_XSIZE_storeXX";
# endif
# ifdef AO_HAVE_XSIZE_fetch_and_addXX
    (void)"AO_XSIZE_fetch_and_addXX(&val, incr):";
    (void)AO_XSIZE_fetch_and_addXX(&val, incr);
# else
    (void)"No AO_XSIZE_fetch_and_addXX";
# endif
# ifdef AO_HAVE_XSIZE_fetch_and_add1XX
    (void)"AO_XSIZE_fetch_and_add1XX(&val):";
    (void)AO_XSIZE_fetch_and_add1XX(&val);
# else
    (void)"No AO_XSIZE_fetch_and_add1XX";
# endif
# ifdef AO_HAVE_XSIZE_fetch_and_sub1XX
    (void)"AO_XSIZE_fetch_and_sub1XX(&val):";
    (void)AO_XSIZE_fetch_and_sub1XX(&val);
# else
    (void)"No AO_XSIZE_fetch_and_sub1XX";
# endif
# ifdef AO_HAVE_XSIZE_andXX
    (void)"AO_XSIZE_andXX(&val, incr):";
    AO_XSIZE_andXX(&val, incr);
# else
    (void)"No AO_XSIZE_andXX";
# endif
# ifdef AO_HAVE_XSIZE_orXX
    (void)"AO_XSIZE_orXX(&val, incr):";
    AO_XSIZE_orXX(&val, incr);
# else
    (void)"No AO_XSIZE_orXX";
# endif
# ifdef AO_HAVE_XSIZE_xorXX
    (void)"AO_XSIZE_xorXX(&val, incr):";
    AO_XSIZE_xorXX(&val, incr);
# else
    (void)"No AO_XSIZE_xorXX";
# endif
# ifdef AO_HAVE_XSIZE_compare_and_swapXX
    (void)"AO_XSIZE_compare_and_swapXX(&val, oldval, newval):";
    if (!AO_XSIZE_compare_and_swapXX(&val, oldval, newval))
      exit(1);
# else
    (void)"No AO_XSIZE_compare_and_swapXX";
# endif
  /* TODO: Add AO_compare_double_and_swap_doubleXX */
  /* TODO: Add AO_compare_and_swap_doubleXX */
# ifdef AO_HAVE_XSIZE_fetch_compare_and_swapXX
    (void)"AO_XSIZE_fetch_compare_and_swapXX(&val, oldval, newval):";
    if (AO_XSIZE_fetch_compare_and_swapXX(&val, oldval, newval) != oldval)
      exit(1);
# else
    (void)"No AO_XSIZE_fetch_compare_and_swapXX";
# endif

# if defined(AO_HAVE_test_and_setXX)
    (void)"AO_test_and_setXX(&ts):";
    (void)AO_test_and_setXX(&ts);
# else
    (void)"No AO_test_and_setXX";
# endif
}
