1
|
1 |
/*
|
|
2 |
* Copyright 2003-2006 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
|
20 |
* CA 95054 USA or visit www.sun.com if you need additional information or
|
|
21 |
* have any questions.
|
|
22 |
*
|
|
23 |
*/
|
|
24 |
|
|
25 |
// Construct enum of Flag_<cmdline-arg> constants.
|
|
26 |
|
|
27 |
// Parens left off in the following for the enum decl below.
|
|
28 |
#define FLAG_MEMBER(flag) Flag_##flag
|
|
29 |
|
|
30 |
#define RUNTIME_PRODUCT_FLAG_MEMBER(type, name, value, doc) FLAG_MEMBER(name),
|
|
31 |
#define RUNTIME_PD_PRODUCT_FLAG_MEMBER(type, name, doc) FLAG_MEMBER(name),
|
|
32 |
#define RUNTIME_DIAGNOSTIC_FLAG_MEMBER(type, name, value, doc) FLAG_MEMBER(name),
|
|
33 |
#define RUNTIME_MANAGEABLE_FLAG_MEMBER(type, name, value, doc) FLAG_MEMBER(name),
|
|
34 |
#define RUNTIME_PRODUCT_RW_FLAG_MEMBER(type, name, value, doc) FLAG_MEMBER(name),
|
|
35 |
#ifdef PRODUCT
|
|
36 |
#define RUNTIME_DEVELOP_FLAG_MEMBER(type, name, value, doc) /* flag is constant */
|
|
37 |
#define RUNTIME_PD_DEVELOP_FLAG_MEMBER(type, name, doc) /* flag is constant */
|
|
38 |
#define RUNTIME_NOTPRODUCT_FLAG_MEMBER(type, name, value, doc)
|
|
39 |
#else
|
|
40 |
#define RUNTIME_DEVELOP_FLAG_MEMBER(type, name, value, doc) FLAG_MEMBER(name),
|
|
41 |
#define RUNTIME_PD_DEVELOP_FLAG_MEMBER(type, name, doc) FLAG_MEMBER(name),
|
|
42 |
#define RUNTIME_NOTPRODUCT_FLAG_MEMBER(type, name, value, doc) FLAG_MEMBER(name),
|
|
43 |
#endif
|
|
44 |
|
|
45 |
#define C1_PRODUCT_FLAG_MEMBER(type, name, value, doc) FLAG_MEMBER(name),
|
|
46 |
#define C1_PD_PRODUCT_FLAG_MEMBER(type, name, doc) FLAG_MEMBER(name),
|
|
47 |
#ifdef PRODUCT
|
|
48 |
#define C1_DEVELOP_FLAG_MEMBER(type, name, value, doc) /* flag is constant */
|
|
49 |
#define C1_PD_DEVELOP_FLAG_MEMBER(type, name, doc) /* flag is constant */
|
|
50 |
#define C1_NOTPRODUCT_FLAG_MEMBER(type, name, value, doc)
|
|
51 |
#else
|
|
52 |
#define C1_DEVELOP_FLAG_MEMBER(type, name, value, doc) FLAG_MEMBER(name),
|
|
53 |
#define C1_PD_DEVELOP_FLAG_MEMBER(type, name, doc) FLAG_MEMBER(name),
|
|
54 |
#define C1_NOTPRODUCT_FLAG_MEMBER(type, name, value, doc) FLAG_MEMBER(name),
|
|
55 |
#endif
|
|
56 |
|
|
57 |
|
|
58 |
#define C2_PRODUCT_FLAG_MEMBER(type, name, value, doc) FLAG_MEMBER(name),
|
|
59 |
#define C2_PD_PRODUCT_FLAG_MEMBER(type, name, doc) FLAG_MEMBER(name),
|
|
60 |
#define C2_DIAGNOSTIC_FLAG_MEMBER(type, name, value, doc) FLAG_MEMBER(name),
|
|
61 |
#ifdef PRODUCT
|
|
62 |
#define C2_DEVELOP_FLAG_MEMBER(type, name, value, doc) /* flag is constant */
|
|
63 |
#define C2_PD_DEVELOP_FLAG_MEMBER(type, name, doc) /* flag is constant */
|
|
64 |
#define C2_NOTPRODUCT_FLAG_MEMBER(type, name, value, doc)
|
|
65 |
#else
|
|
66 |
#define C2_DEVELOP_FLAG_MEMBER(type, name, value, doc) FLAG_MEMBER(name),
|
|
67 |
#define C2_PD_DEVELOP_FLAG_MEMBER(type, name, doc) FLAG_MEMBER(name),
|
|
68 |
#define C2_NOTPRODUCT_FLAG_MEMBER(type, name, value, doc) FLAG_MEMBER(name),
|
|
69 |
#endif
|
|
70 |
|
|
71 |
typedef enum {
|
|
72 |
RUNTIME_FLAGS(RUNTIME_DEVELOP_FLAG_MEMBER, RUNTIME_PD_DEVELOP_FLAG_MEMBER, RUNTIME_PRODUCT_FLAG_MEMBER,
|
|
73 |
RUNTIME_PD_PRODUCT_FLAG_MEMBER, RUNTIME_DIAGNOSTIC_FLAG_MEMBER,
|
|
74 |
RUNTIME_NOTPRODUCT_FLAG_MEMBER, RUNTIME_MANAGEABLE_FLAG_MEMBER, RUNTIME_PRODUCT_RW_FLAG_MEMBER)
|
|
75 |
RUNTIME_OS_FLAGS(RUNTIME_DEVELOP_FLAG_MEMBER, RUNTIME_PD_DEVELOP_FLAG_MEMBER, RUNTIME_PRODUCT_FLAG_MEMBER,
|
|
76 |
RUNTIME_PD_PRODUCT_FLAG_MEMBER, RUNTIME_DIAGNOSTIC_FLAG_MEMBER,
|
|
77 |
RUNTIME_NOTPRODUCT_FLAG_MEMBER)
|
|
78 |
#ifdef COMPILER1
|
|
79 |
C1_FLAGS(C1_DEVELOP_FLAG_MEMBER, C1_PD_DEVELOP_FLAG_MEMBER, C1_PRODUCT_FLAG_MEMBER, C1_PD_PRODUCT_FLAG_MEMBER,
|
|
80 |
C1_NOTPRODUCT_FLAG_MEMBER)
|
|
81 |
#endif
|
|
82 |
#ifdef COMPILER2
|
|
83 |
C2_FLAGS(C2_DEVELOP_FLAG_MEMBER, C2_PD_DEVELOP_FLAG_MEMBER, C2_PRODUCT_FLAG_MEMBER, C2_PD_PRODUCT_FLAG_MEMBER,
|
|
84 |
C2_DIAGNOSTIC_FLAG_MEMBER, C2_NOTPRODUCT_FLAG_MEMBER)
|
|
85 |
#endif
|
|
86 |
NUM_CommandLineFlag
|
|
87 |
} CommandLineFlag;
|
|
88 |
|
|
89 |
// Construct enum of Flag_<cmdline-arg>_<type> constants.
|
|
90 |
|
|
91 |
#define FLAG_MEMBER_WITH_TYPE(flag,type) Flag_##flag##_##type
|
|
92 |
|
|
93 |
#define RUNTIME_PRODUCT_FLAG_MEMBER_WITH_TYPE(type, name, value, doc) FLAG_MEMBER_WITH_TYPE(name,type),
|
|
94 |
#define RUNTIME_PD_PRODUCT_FLAG_MEMBER_WITH_TYPE(type, name, doc) FLAG_MEMBER_WITH_TYPE(name,type),
|
|
95 |
#define RUNTIME_DIAGNOSTIC_FLAG_MEMBER_WITH_TYPE(type, name, value, doc) FLAG_MEMBER_WITH_TYPE(name,type),
|
|
96 |
#define RUNTIME_MANAGEABLE_FLAG_MEMBER_WITH_TYPE(type, name, value, doc) FLAG_MEMBER_WITH_TYPE(name,type),
|
|
97 |
#define RUNTIME_PRODUCT_RW_FLAG_MEMBER_WITH_TYPE(type, name, value, doc) FLAG_MEMBER_WITH_TYPE(name,type),
|
|
98 |
#ifdef PRODUCT
|
|
99 |
#define RUNTIME_DEVELOP_FLAG_MEMBER_WITH_TYPE(type, name, value, doc) /* flag is constant */
|
|
100 |
#define RUNTIME_PD_DEVELOP_FLAG_MEMBER_WITH_TYPE(type, name, doc) /* flag is constant */
|
|
101 |
#define RUNTIME_NOTPRODUCT_FLAG_MEMBER_WITH_TYPE(type, name, value, doc)
|
|
102 |
#else
|
|
103 |
#define RUNTIME_DEVELOP_FLAG_MEMBER_WITH_TYPE(type, name, value, doc) FLAG_MEMBER_WITH_TYPE(name,type),
|
|
104 |
#define RUNTIME_PD_DEVELOP_FLAG_MEMBER_WITH_TYPE(type, name, doc) FLAG_MEMBER_WITH_TYPE(name,type),
|
|
105 |
#define RUNTIME_NOTPRODUCT_FLAG_MEMBER_WITH_TYPE(type, name, value, doc) FLAG_MEMBER_WITH_TYPE(name,type),
|
|
106 |
#endif
|
|
107 |
|
|
108 |
#define C1_PRODUCT_FLAG_MEMBER_WITH_TYPE(type, name, value, doc) FLAG_MEMBER_WITH_TYPE(name,type),
|
|
109 |
#define C1_PD_PRODUCT_FLAG_MEMBER_WITH_TYPE(type, name, doc) FLAG_MEMBER_WITH_TYPE(name,type),
|
|
110 |
#ifdef PRODUCT
|
|
111 |
#define C1_DEVELOP_FLAG_MEMBER_WITH_TYPE(type, name, value, doc) /* flag is constant */
|
|
112 |
#define C1_PD_DEVELOP_FLAG_MEMBER_WITH_TYPE(type, name, doc) /* flag is constant */
|
|
113 |
#define C1_NOTPRODUCT_FLAG_MEMBER_WITH_TYPE(type, name, value, doc)
|
|
114 |
#else
|
|
115 |
#define C1_DEVELOP_FLAG_MEMBER_WITH_TYPE(type, name, value, doc) FLAG_MEMBER_WITH_TYPE(name,type),
|
|
116 |
#define C1_PD_DEVELOP_FLAG_MEMBER_WITH_TYPE(type, name, doc) FLAG_MEMBER_WITH_TYPE(name,type),
|
|
117 |
#define C1_NOTPRODUCT_FLAG_MEMBER_WITH_TYPE(type, name, value, doc) FLAG_MEMBER_WITH_TYPE(name,type),
|
|
118 |
#endif
|
|
119 |
|
|
120 |
|
|
121 |
#define C2_PRODUCT_FLAG_MEMBER_WITH_TYPE(type, name, value, doc) FLAG_MEMBER_WITH_TYPE(name,type),
|
|
122 |
#define C2_PD_PRODUCT_FLAG_MEMBER_WITH_TYPE(type, name, doc) FLAG_MEMBER_WITH_TYPE(name,type),
|
|
123 |
#define C2_DIAGNOSTIC_FLAG_MEMBER_WITH_TYPE(type, name, value, doc) FLAG_MEMBER_WITH_TYPE(name,type),
|
|
124 |
#ifdef PRODUCT
|
|
125 |
#define C2_DEVELOP_FLAG_MEMBER_WITH_TYPE(type, name, value, doc) /* flag is constant */
|
|
126 |
#define C2_PD_DEVELOP_FLAG_MEMBER_WITH_TYPE(type, name, doc) /* flag is constant */
|
|
127 |
#define C2_NOTPRODUCT_FLAG_MEMBER_WITH_TYPE(type, name, value, doc)
|
|
128 |
#else
|
|
129 |
#define C2_DEVELOP_FLAG_MEMBER_WITH_TYPE(type, name, value, doc) FLAG_MEMBER_WITH_TYPE(name,type),
|
|
130 |
#define C2_PD_DEVELOP_FLAG_MEMBER_WITH_TYPE(type, name, doc) FLAG_MEMBER_WITH_TYPE(name,type),
|
|
131 |
#define C2_NOTPRODUCT_FLAG_MEMBER_WITH_TYPE(type, name, value, doc) FLAG_MEMBER_WITH_TYPE(name,type),
|
|
132 |
#endif
|
|
133 |
|
|
134 |
typedef enum {
|
|
135 |
RUNTIME_FLAGS(RUNTIME_DEVELOP_FLAG_MEMBER_WITH_TYPE, RUNTIME_PD_DEVELOP_FLAG_MEMBER_WITH_TYPE,
|
|
136 |
RUNTIME_PRODUCT_FLAG_MEMBER_WITH_TYPE, RUNTIME_PD_PRODUCT_FLAG_MEMBER_WITH_TYPE,
|
|
137 |
RUNTIME_DIAGNOSTIC_FLAG_MEMBER_WITH_TYPE,
|
|
138 |
RUNTIME_NOTPRODUCT_FLAG_MEMBER_WITH_TYPE,
|
|
139 |
RUNTIME_MANAGEABLE_FLAG_MEMBER_WITH_TYPE,
|
|
140 |
RUNTIME_PRODUCT_RW_FLAG_MEMBER_WITH_TYPE)
|
|
141 |
RUNTIME_OS_FLAGS(RUNTIME_DEVELOP_FLAG_MEMBER_WITH_TYPE, RUNTIME_PD_DEVELOP_FLAG_MEMBER_WITH_TYPE,
|
|
142 |
RUNTIME_PRODUCT_FLAG_MEMBER_WITH_TYPE, RUNTIME_PD_PRODUCT_FLAG_MEMBER_WITH_TYPE,
|
|
143 |
RUNTIME_DIAGNOSTIC_FLAG_MEMBER_WITH_TYPE,
|
|
144 |
RUNTIME_NOTPRODUCT_FLAG_MEMBER_WITH_TYPE)
|
|
145 |
#ifdef COMPILER1
|
|
146 |
C1_FLAGS(C1_DEVELOP_FLAG_MEMBER_WITH_TYPE, C1_PD_DEVELOP_FLAG_MEMBER_WITH_TYPE, C1_PRODUCT_FLAG_MEMBER_WITH_TYPE,
|
|
147 |
C1_PD_PRODUCT_FLAG_MEMBER_WITH_TYPE, C1_NOTPRODUCT_FLAG_MEMBER_WITH_TYPE)
|
|
148 |
#endif
|
|
149 |
#ifdef COMPILER2
|
|
150 |
C2_FLAGS(C2_DEVELOP_FLAG_MEMBER_WITH_TYPE, C2_PD_DEVELOP_FLAG_MEMBER_WITH_TYPE, C2_PRODUCT_FLAG_MEMBER_WITH_TYPE,
|
|
151 |
C2_PD_PRODUCT_FLAG_MEMBER_WITH_TYPE, C2_DIAGNOSTIC_FLAG_MEMBER_WITH_TYPE, C2_NOTPRODUCT_FLAG_MEMBER_WITH_TYPE)
|
|
152 |
#endif
|
|
153 |
NUM_CommandLineFlagWithType
|
|
154 |
} CommandLineFlagWithType;
|
|
155 |
|
|
156 |
#define FLAG_IS_DEFAULT(name) (CommandLineFlagsEx::is_default(FLAG_MEMBER(name)))
|
|
157 |
|
|
158 |
#define FLAG_SET_DEFAULT(name, value) ((name) = (value))
|
|
159 |
|
|
160 |
#define FLAG_SET_CMDLINE(type, name, value) (CommandLineFlagsEx::type##AtPut(FLAG_MEMBER_WITH_TYPE(name,type), (type)(value), COMMAND_LINE))
|
|
161 |
#define FLAG_SET_ERGO(type, name, value) (CommandLineFlagsEx::type##AtPut(FLAG_MEMBER_WITH_TYPE(name,type), (type)(value), ERGONOMIC))
|
|
162 |
|
|
163 |
// Can't put the following in CommandLineFlags because
|
|
164 |
// of a circular dependency on the enum definition.
|
|
165 |
class CommandLineFlagsEx : CommandLineFlags {
|
|
166 |
public:
|
|
167 |
static void boolAtPut(CommandLineFlagWithType flag, bool value, FlagValueOrigin origin);
|
|
168 |
static void intxAtPut(CommandLineFlagWithType flag, intx value, FlagValueOrigin origin);
|
|
169 |
static void uintxAtPut(CommandLineFlagWithType flag, uintx value, FlagValueOrigin origin);
|
|
170 |
static void doubleAtPut(CommandLineFlagWithType flag, double value, FlagValueOrigin origin);
|
|
171 |
static void ccstrAtPut(CommandLineFlagWithType flag, ccstr value, FlagValueOrigin origin);
|
|
172 |
|
|
173 |
static bool is_default(CommandLineFlag flag);
|
|
174 |
};
|