OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.dg/] [cpp/] [macro8.c] - Blame information for rev 298

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 298 jeremybenn
/* { dg-do compile } */
2
/* { dg-options -std=gnu89 } */
3
 
4
/* GCC 2.95.2 used to get the following variable argument macro
5
   expansions wrong.
6
 
7
   Source: Neil Booth, from PR 3852 with persmission.  31 Jul 2001.  */
8
 
9
#define TEST_WORSE(args...) (5, ## args)
10
#define TEST_BAD(foo, args...) (2, (foo), ## args)
11
 
12
extern void abort ();
13
 
14
static int add (int a, int b)
15
{
16
  return a + b;
17
}
18
 
19
int main ()
20
{
21
  /* Would expand to a single closing parenthesis, maybe because of
22
     the "no args requires space" brokenness.  */
23
  if (TEST_WORSE () != 5)
24
    abort ();
25
  /* The macro would expand to (0, (0) with a missing closing parenthesis.  */
26
  if (add TEST_BAD (5) != 7)
27
    abort ();
28
  return 0;
29
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.