Print this page
cw: don't shadow pure pre-processing
cw(1onbld): --shadow not --secondary
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/tools/cw/cw.1onbld
+++ new/usr/src/tools/cw/cw.1onbld
1 1 .\"
2 2 .\" CDDL HEADER START
3 3 .\"
4 4 .\" The contents of this file are subject to the terms of the
5 5 .\" Common Development and Distribution License (the "License").
6 6 .\" You may not use this file except in compliance with the License.
7 7 .\"
8 8 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 .\" or http://www.opensolaris.org/os/licensing.
10 10 .\" See the License for the specific language governing permissions
11 11 .\" and limitations under the License.
12 12 .\"
13 13 .\" When distributing Covered Code, include this CDDL HEADER in each
14 14 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 .\" If applicable, add the following below this CDDL HEADER, with the
16 16 .\" fields enclosed by brackets "[]" replaced with your own identifying
17 17 .\" information: Portions Copyright [yyyy] [name of copyright owner]
18 18 .\"
19 19 .\" CDDL HEADER END
20 20 .\"
21 21 .\" Copyright 2010 Sun Microsystems, Inc. All rights reserved.
22 22 .\" Use is subject to license terms.
23 23 .\"
24 24 .Dd February 10, 2018
25 25 .Dt CW 1ONBLD
26 26 .Os
27 27 .Sh NAME
28 28 .Nm cw
29 29 .Nd invoke one or more compilers with argument translation
30 30 .Sh SYNOPSIS
31 31 .Nm cw
32 32 .Op Fl C
33 33 .Op Fl -versions
34 34 .Op Fl -noecho
35 35 .Fl -primary Ar compiler
36 36 .Op Fl -shadow Ar compiler ...
37 37 .Fl -
38 38 .Ar compiler args ...
39 39 .Sh DESCRIPTION
40 40 .Nm cw
41 41 is a facility for invoking one or more compilers, providing translation from
42 42 Sun style arguments as appropriate.
43 43 This allows the use of arbitrary compilers without the need to alter large
↓ open down ↓ |
43 lines elided |
↑ open up ↑ |
44 44 numbers of makefiles.
45 45 A mode called shadow compilation invokes multiple compilers so that warnings
46 46 and errors may be obtained from both.
47 47 See SHADOW COMPILATION for details.
48 48 This version of cw supports compilers with both Sun Studio 12 and GCC-style
49 49 command lines.
50 50 .Sh ARGUMENTS
51 51 Both the
52 52 .Fl -primary
53 53 and
54 -.Fl -secondary
54 +.Fl -shadow
55 55 parameters take a
56 56 .Em compiler specification .
57 57 This is a comma-separated list of the form
58 58 .Ar name,executable,style
59 59 Where
60 60 .Ar name
61 61 is a name for the compiler,
62 62 .Ar executable
63 63 is the full path to the compiler executable, and
64 64 .Ar style
65 65 is the style of command-line options the compiler expects, either
66 66 .Em sun
67 67 or
68 68 .Em gnu .
69 69 .Bl -tag -width indent
70 70 .It Fl -primary Ar compiler
71 71 Specify the compiler to be used primarily (that which is used for link-editing
72 72 and pre-processing, and whos objects we deliver).
73 73 .It Fl -shadow Ar compiler
74 74 Specify a shadow compiler, which builds sources for the sake of checking code
75 75 quality and compatibility, but has its output discarded.
76 76 .It Fl -noecho
77 77 Do not echo the actual command line of any compilers invoked.
78 78 .It Fl -versions
79 79 Request from each configured primary and shadow compiler its version
80 80 information.
81 81 .It Fl C
82 82 The sources being compiled are C++. This is necessary as it affects the
83 83 translation of compiler arguments.
84 84 .It Fl -
85 85 Arguments intended for the compilers themselves must be separated from those
86 86 of
87 87 .Nm cw
88 88 by a
89 89 .Fl - .
90 90 .It Fl _name=
91 91 .It Fl _style=
92 92 Parameters intended for the compiler be guarded with options of the form
93 93 .Fl _name=
94 94 and
95 95 .Fl _style=
96 96 Where
97 97 .Em name
98 98 and
99 99 .Em style
100 100 are those passed to
101 101 .Fl -primary
102 102 and
103 103 .Fl -shadow
104 104 this allows certain flags to be passed only to certain classes of compiler.
105 105 .Pp
106 106 For historical reasons, the
107 107 .Fl _style=
108 108 option is also translated such that a style of
109 109 .Em sun
110 110 may use the flag
111 111 .Fl _cc=
112 112 and a style of
113 113 .Em gnu
114 114 may use the flag
115 115 .Fl _gcc= ,
116 116 and when the
117 117 .Fl C
118 118 option is given and C++ is in use the style of
119 119 .Em sun
120 120 may use the flag
121 121 .Fl _CC=
122 122 and the style of
123 123 .Em gnu
124 124 may use the flag
125 125 .Fl _g++= .
↓ open down ↓ |
61 lines elided |
↑ open up ↑ |
126 126 .El
127 127 .Sh SHADOW COMPILATION
128 128 If
129 129 .Fl -shadow
130 130 compilers are specified
131 131 .Nm cw
132 132 will invoke shadow compiler, with the outputs modified (as well as any
133 133 translation for compiler style) as follows:
134 134 .Bl -enum
135 135 .It
136 -If none of
136 +If neither of
137 137 .Fl c ,
138 -.Fl E ,
139 -.Fl P ,
140 -or
141 138 .Fl S
142 -appears in the argument list (that is, linking is attempted), the shadow
143 -compilers will not be invoked.
144 -This is because the objects built with that compiler which would be linked
145 -have been previously discarded.
139 +appears in the argument list (that is, linking is attempted or only the
140 +pre-processor is invoked), the shadow compilers will not be invoked.
146 141 .It
147 142 If the
148 143 .Fl o Ar filename
149 144 option was provided, with or without a separating space, it will be replaced with
150 145 .Fl o Ar tempfile
151 146 .It
152 147 If the option
153 148 .Fl o
154 149 was not provided,
155 150 .Fl o Ar tempfile
156 151 will be added to the end of the argument list used to invoke
157 152 the shadow compilers.
↓ open down ↓ |
2 lines elided |
↑ open up ↑ |
158 153 .El
159 154 When shadow compilation is in effect,
160 155 .Nm cw
161 156 writes to standard error each compiler's standard error output following its
162 157 argument list.
163 158 Messages from the compilers will not be interleaved.
164 159 If
165 160 .Nm cw
166 161 is used to invoke the preprocessor and no output location is specified,
167 162 .Nm cw
168 -will write to standard output the primary compiler's standard output, and the
169 -secondary compiler's standard output will be discarded.
163 +will write to standard output the primary compiler's standard output.
170 164 .Pp
171 165 Because the Sun compilers write intermediate objects to fixed
172 166 filenames in the current directory when instructed to compile and
173 167 link multiple source files via a single command line, it would be
174 168 unsafe to invoke more than one compiler in this fashion.
175 169 Therefore
176 170 .Nm cw
177 171 does not accept multiple source files unless the preprocessor is to be
178 172 invoked.
179 173 An attempt to invoke
180 174 .Nm cw
181 175 in this manner will result in an error.
182 176 .Sh ARGUMENT TRANSLATION
183 177 If the compiler to be invoked is a GNU-style C or C++ compiler, a set of
184 178 default flags is added to the beginning of the argument list, and the
185 179 remaining arguments are translated to their closest appropriate
186 180 semantic equivalents and passed in the same order as their
187 181 counterparts given to
188 182 .Nm cw .
189 183 See the comments at the head of
190 184 .Pa usr/src/tools/cw/cw.c
191 185 for a detailed list of translations.
192 186 .Sh ENVIRONMENT
193 187 .Bl -tag -width indent
194 188 .It CW_SHADOW_SERIAL
195 189 If this variable is set in the environment, invoke the primary compiler, wait
196 190 for it to complete, then invoke the shadow compilers.
197 191 Normally the primary and shadow compilers are invoked in parallel.
198 192 .It CW_NO_EXEC
199 193 If this variable is set in the environment, write the usual output to
200 194 standard error but do not actually invoke any compiler.
201 195 This is useful for debugging the translation engine.
202 196 .El
203 197 .Sh EXIT STATUS
204 198 The following exit status values are returned:
205 199 .Bl -tag -width indent
206 200 .It 0
207 201 The primary compiler, and shadow compilers if invoked, both completed
208 202 successfully.
209 203 .It >0
210 204 A usage error occurred, or one or more compilers returned a nonzero
211 205 exit status.
212 206 .El
213 207 .Sh SEE ALSO
214 208 .Xr cc 1 ,
215 209 .Xr CC 1 ,
216 210 .Xr gcc 1
217 211 .Sh BUGS
218 212 The translations provided for gcc are not always exact and in some cases
219 213 reflect local policy rather than actual equivalence.
220 214 .Pp
221 215 Additional compiler types should be supported.
222 216 .Pp
223 217 The translation engine is hacky.
↓ open down ↓ |
44 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX