1 /*
 2  * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
 3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 4  *
 5  * This code is free software; you can redistribute it and/or modify it
 6  * under the terms of the GNU General Public License version 2 only, as
 7  * published by the Free Software Foundation.
 8  *
 9  * This code is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12  * version 2 for more details (a copy is included in the LICENSE file that
13  * accompanied this code).
14  *
15  * You should have received a copy of the GNU General Public License version
16  * 2 along with this work; if not, write to the Free Software Foundation,
17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18  *
19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20  * or visit www.oracle.com if you need additional information or have any
21  * questions.
22  */
23 
24 #include "constants_aux.h"
25 
26 #define ZERO 0
27 #define ONE ZERO + 1 //backward ref
28 #define THREE ONE + TWO /* forward ref */
29 #define TWO ONE + ONE
30 
31 #define FOUR (long long)0x1L + THREE //hack: force long carrier
32 #define FIVE (long long)0x1UL + FOUR //hack: force long carrier
33 
34 #define SIX ONE +\
35               TWO +\
36               THREE
37 
38 #define STR "Hello" // a string
39 
40 #define ID(x) x //function-like
41 #define SUM(x,y) x + y //function-like
42 
43 #define BLOCK_BEGIN { //not a constant
44 #define BLOCK_END } //not a constant
45 
46 #define INTEGER_MAX_VALUE Integer.MAX_VALUE //constant in Java, not in C
47 #define QUOTE "QUOTE" //should be ok
48 
49 #define FLOAT_VALUE 1.32F;
50 #define DOUBLE_VALUE 1.32;
51 
52 #define CYCLIC_1 1 + CYCLIC_1 //cycle
53 
54 #define CYCLIC_2 1 + TEMP //indirect cycle
55 #define TEMP 1 + CYCLIC_2
56 
57 #define CHAR_VALUE 'h'
58 #define MULTICHAR_VALUE 'hh'
59 
60 #define BOOL_VALUE (_Bool)1
61 //we should have tests for char and shorts, but these are likely to be platform dependent
62 
63 #define SUB SUP + 2 //dependency
64 
65 #define ZERO_PTR (void*)0;
66 #define F_PTR (void*) 0xFFFFFFFFFFFFFFFFLL; // all 1s
67 
68 #define ARRAY { 0, 1, 2, 3, 4, 5 }