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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.dg/] [cpp/] [macro3.c] - Blame information for rev 853

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
/* { dg-do run } */
2
/* { dg-options "-std=c99" } */
3
 
4
/* First two tests sourced from a bug report of Thomas Pornin.
5
   Varargs test source Jamie Lokier.
6
   All adapted for the testsuite by Neil Booth, Oct 2000.  */
7
 
8
/* Tests various macro abuse is correctly expanded.  */
9
static int d = 4;
10
#define c(x) d
11
#define d(x) c(2)
12
 
13
#if 0
14
/* This macro chain above sucks up the whole file once it starts, so
15
   I've commented it out.  The example is left for idle amusement :-) */
16
#define a(x) b(
17
#define b(x) a(
18
#endif
19
 
20
#define apply(...)   apply2 (__VA_ARGS__)  
21
#define half(x)      ((x) / 2)
22
#define apply2(f,x)  f (x)
23
 
24
extern void abort (void);
25
extern void exit (int);
26
 
27
int main()
28
{
29
  /* Expands to c(2) then d.  */
30
  if (c(c)(c) != 4)
31
    abort ();
32
 
33
  if (apply (half, 200) != 100)
34
    abort ();
35
 
36
  exit (0);
37
}

powered by: WebSVN 2.1.0

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