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/] [if-oppr.c] - Blame information for rev 823

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

Line No. Rev Author Line
1 149 jeremybenn
/* Copyright (C) 2000 Free Software Foundation, Inc.  */
2
 
3
/* Test the full range of preprocessor operator precedence.  Each
4
   operator is tested with one of immediately higher precedence to
5
   verify it is of strictly lower precedence.  To avoid complications,
6
   each test uses just those two operators.  Occasionally this assumes
7
   correct operation of if-then-else, so the first tests verify this.  */
8
 
9
/* { dg-do preprocess } */
10
 
11
/* Ensure correct functioning of if-then-else.  */
12
#if 1
13
#else
14
#error #else block evaluated for true conditional
15
#endif
16
 
17
#if 0
18
#error #if block evaluated for false conditional
19
#else
20
#endif
21
 
22
/* , not higher than ?.  This is not a syntax error if it is.  */
23
#if 1 ? 0, 1: 1 /* { dg-error "without" "? higher precedence than ," } */
24
#error
25
#endif
26
 
27
/* : strictly higher than ?.  This would give a syntax error otherwise.  */
28
#if 0 ? 0 : 1 ? 1 : 1
29
#endif
30
 
31
/* || strictly higher than ?:. */
32
#if 1 ? 0: 0 || 1
33
#error operator ?: has higher precedence than operator ||
34
#endif
35
 
36
/* && strictly higher than ||.  */
37
#if 1 || 0 && 0
38
#else
39
#error operator || has higher precedence than operator &&
40
#endif
41
 
42
/* | strictly higher than &&.  */
43
#if 0 && 0 | 1
44
#error operator && has higher precedence than operator |
45
#endif
46
 
47
/* ^ strictly higher than |.  */
48
#if 1 | 0 ^ 1
49
#else
50
#error operator | has higher precedence than operator ^
51
#endif
52
 
53
/* & strictly higher than ^.  */
54
#if 1 ^ 0 & 0
55
#else
56
#error operator ^ has higher precedence than operator &
57
#endif
58
 
59
/* == (!=) strictly higher than &.  */
60
#if 0 & 0 == 0
61
#error operator & has higher precedence than operator ==
62
#endif
63
 
64
/* < (>, <=, >=) strictly higher than == (!=).  */
65
 
66
#if 0 == 0 < 0
67
#else
68
#error operator == has higher precedence than operator <
69
#endif
70
 
71
/* << (>>) strictly higher than < (>, <=, >=).  */
72
#if 1 < 1 << 1
73
#else
74
#error operator < has higher precedence than operator <<
75
#endif
76
 
77
/* Binary + (-) strictly higher than << (>>).  */
78
#if 0 << 0 + 1
79
#error operator << has higher precedence than binary +
80
#endif
81
 
82
/* Binary * (/, %) strictly higher than binary + (-).  */
83
#if 1 + 0 * 0
84
#else
85
#error binary + has higher precedence than binary *
86
#endif
87
 
88
/* Unary operators (!, ~, -, +) strictly higher than binary * (/, %).
89
   Equality is hard to detect because of right-associativity.  */
90
#if ~1 * 0
91
#error binary * has higher precedence than operator ~
92
#endif
93
 
94
/* () > Unary.  Unfortunately this requires an additional operator.  */
95
#if -(1 - 1)
96
#error unary - has higher precedence than operator ()
97
#endif

powered by: WebSVN 2.1.0

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