view gcc/testsuite/gcc.dg/tm/attrs-1.c @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents
children
line wrap: on
line source

/* Test various erroneous or ignored uses of C2X attribute syntax.  */
/* { dg-do compile } */
/* { dg-options "-fgnu-tm" } */

void
f1 (void)
{
  __transaction_atomic [[outer()]] {} /* { dg-error "does not take any arguments" } */
}

void
f2 (void)
{
  __transaction_atomic [[not_a_tm_attribute]] {} /* { dg-warning "attribute directive ignored" } */
}

void
f3 (void)
{
  __transaction_atomic [[unknown_attribute(args of *unknown* attributes need only (be {balanced[(({{[[]]}}))]}!), as per standard C)]] {} /* { dg-warning "attribute directive ignored" } */
}

void
f4 (void)
{
  __transaction_atomic [[gnu::const]] {} /* { dg-warning "attribute directive ignored" } */
}

void
f5 (void)
{
  __transaction_atomic [[bad_namespace::outer]] {} /* { dg-warning "attribute directive ignored" } */
}

void
f6 (void)
{
  __transaction_atomic [[outer, outer]] {} /* { dg-warning "attribute duplicated" } */
}