OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.dg/] [cpp/] [trad/] [defined.c] - Blame information for rev 378

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

Line No. Rev Author Line
1 298 jeremybenn
/* Copyright (C) 2000 Free Software Foundation, Inc.  */
2
 
3
/* { dg-do preprocess } */
4
 
5
/* Tests tradcpp0 with defined.  The defined operator in traditional C
6
   works just the same as the defined operator in Standard C.  */
7
 
8
/* Source: Zack Weinberg, glibc, Neil Booth 11 Dec 2000.  */
9
 
10
#if defined REGPARMS
11
#error REGPARMS should not be defined
12
#endif
13
 
14
#define REGPARMS 1
15
#if !defined REGPARMS
16
#error REGPARMS should be defined
17
#endif
18
 
19
#define defined                 /* { dg-error "defined" } */
20
 
21
/* No diagnostics, though you could argue there should be.  */
22
#if defined defined
23
#error defined is defined!
24
#endif
25
 
26
#define is_Z_defined defined Z
27
 
28
#if defined Z
29
#error Z is not defined
30
#endif
31
 
32
/* The behavior of "defined" when it comes from a macro expansion is
33
   now documented.  */
34
#if is_Z_defined
35
#error Macro expanding into defined operator test 1
36
#endif
37
 
38
#define Z
39
 
40
#if !defined Z
41
#error Z is defined
42
#endif
43
 
44
#if !is_Z_defined
45
#error Macro expanding into defined operator test 2
46
#endif
47
 
48
#undef is_Z_defined
49
#undef Z
50
 
51
/* Do all the tests over again with the () form of defined.  */
52
 
53
/* No diagnostics, though you could argue there should be.  */
54
#if defined(defined)
55
#error defined is defined!
56
#endif
57
 
58
#define is_Z_defined defined ( Z )
59
 
60
#if defined(Z)
61
#error Z is not defined
62
#endif
63
 
64
/* The behavior of "defined" when it comes from a macro expansion is
65
   now documented.  */
66
#if is_Z_defined
67
#error Macro expanding into defined operator test 1
68
#endif
69
 
70
#define Z
71
 
72
#if !defined(Z)
73
#error Z is defined
74
#endif
75
 
76
#if !is_Z_defined
77
#error Macro expanding into defined operator test 2
78
#endif

powered by: WebSVN 2.1.0

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