Print this page
make: fix GCC warnings
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/cmd/make/include/mk/defs.h
+++ new/usr/src/cmd/make/include/mk/defs.h
1 1 #ifndef _MK_DEFS_H
2 2 #define _MK_DEFS_H
3 3 /*
4 4 * CDDL HEADER START
5 5 *
6 6 * The contents of this file are subject to the terms of the
7 7 * Common Development and Distribution License (the "License").
8 8 * You may not use this file except in compliance with the License.
9 9 *
10 10 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
11 11 * or http://www.opensolaris.org/os/licensing.
12 12 * See the License for the specific language governing permissions
13 13 * and limitations under the License.
14 14 *
15 15 * When distributing Covered Code, include this CDDL HEADER in each
16 16 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
17 17 * If applicable, add the following below this CDDL HEADER, with the
18 18 * fields enclosed by brackets "[]" replaced with your own identifying
19 19 * information: Portions Copyright [yyyy] [name of copyright owner]
20 20 *
21 21 * CDDL HEADER END
22 22 */
23 23 /*
24 24 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
25 25 * Use is subject to license terms.
26 26 */
27 27
28 28 /*
29 29 * Included files
30 30 */
31 31 #ifdef DISTRIBUTED
32 32 # include <dm/Avo_AcknowledgeMsg.h>
33 33 # include <dm/Avo_DoJobMsg.h>
34 34 # include <dm/Avo_JobResultMsg.h>
35 35 #endif
36 36
37 37 #include <mksh/defs.h>
38 38
39 39 #if defined(DISTRIBUTED) || defined(MAKETOOL) /* tolik */
40 40 # include <rw/xdrstrea.h>
41 41 #endif
42 42
43 43
44 44 /*
45 45 * Defined macros
46 46 */
47 47
48 48 #define SKIPSPACE(x) while (*x && \
49 49 ((*x == (int) space_char) || \
50 50 (*x == (int) tab_char) || \
51 51 (*x == (int) comma_char))) { \
52 52 x++; \
53 53 }
54 54
55 55 #define SKIPWORD(x) while (*x && \
56 56 (*x != (int) space_char) && \
57 57 (*x != (int) tab_char) && \
58 58 (*x != (int) newline_char) && \
59 59 (*x != (int) comma_char) && \
60 60 (*x != (int) equal_char)) { \
61 61 x++; \
62 62 }
63 63
64 64 #define SKIPTOEND(x) while (*x && \
65 65 (*x != (int) newline_char)) { \
66 66 x++; \
67 67 }
68 68
69 69 #define PMAKE_DEF_MAX_JOBS 2 /* Default number of parallel jobs. */
70 70
71 71 #define OUT_OF_DATE(a,b) \
72 72 (((a) < (b)) || (((a) == file_doesnt_exist) && ((b) == file_doesnt_exist)))
73 73
74 74 #define OUT_OF_DATE_SEC(a,b) \
75 75 (((a).tv_sec < (b).tv_sec) || (((a).tv_sec == file_doesnt_exist.tv_sec) && ((b).tv_sec == file_doesnt_exist.tv_sec)))
76 76
77 77 #define SETVAR(name, value, append) \
78 78 setvar_daemon(name, value, append, no_daemon, \
79 79 true, debug_level)
80 80 #ifdef SUN5_0
81 81 #define MAX(a,b) (((a)>(b))?(a):(b))
82 82 /*
83 83 * New feature added to SUN5_0 make, invoke the vanilla svr4 make when
84 84 * the USE_SVR4_MAKE environment variable is set.
85 85 */
86 86 #define SVR4_MAKE "/usr/ccs/lib/svr4.make"
87 87 #define USE_SVR4_MAKE "USE_SVR4_MAKE"
88 88 #endif
89 89 /*
90 90 * The standard MAXHOSTNAMELEN is 64. We want 32.
91 91 */
92 92 #define MAX_HOSTNAMELEN 32
93 93
94 94
95 95 /*
96 96 * typedefs & structs
97 97 */
98 98 typedef enum {
99 99 no_state,
100 100 scan_name_state,
101 101 scan_command_state,
102 102 enter_dependencies_state,
103 103 enter_conditional_state,
104 104 enter_equal_state,
105 105 illegal_bytes_state,
106 106 illegal_eoln_state,
107 107 poorly_formed_macro_state,
108 108 exit_state
109 109 } Reader_state;
110 110
111 111 struct _Name_vector {
112 112 struct _Name *names[64];
113 113 struct _Chain *target_group[64];
114 114 short used;
115 115 struct _Name_vector *next;
116 116 };
117 117
118 118 struct _Running {
119 119 struct _Running *next;
120 120 Doname state;
121 121 struct _Name *target;
122 122 struct _Name *true_target;
123 123 struct _Property *command;
124 124 struct _Name *sprodep_value;
125 125 char *sprodep_env;
126 126 int recursion_level;
127 127 Boolean do_get;
128 128 Boolean implicit;
129 129 Boolean redo;
130 130 int auto_count;
131 131 struct _Name **automatics;
132 132 pid_t pid;
133 133 #ifdef TEAMWARE_MAKE_CMN
134 134 int job_msg_id;
135 135 #else
136 136 int host;
137 137 #endif
138 138 char *stdout_file;
139 139 char *stderr_file;
140 140 struct _Name *temp_file;
141 141 int conditional_cnt;
142 142 struct _Name **conditional_targets;
143 143 #ifdef TEAMWARE_MAKE_CMN
144 144 Boolean make_refd;
145 145 #endif
146 146 };
147 147
148 148 typedef enum {
149 149 serial_mode,
150 150 parallel_mode,
151 151 distributed_mode
152 152 } DMake_mode;
153 153
154 154 typedef enum {
155 155 txt1_mode,
156 156 txt2_mode,
157 157 html1_mode
158 158 } DMake_output_mode;
159 159
160 160 struct _Recursive_make {
161 161 struct _Recursive_make *next; /* Linked list */
162 162 wchar_t *target;/* Name of target */
163 163 wchar_t *oldline;/* Original line in .nse_depinfo */
164 164 wchar_t *newline;/* New line in .nse_depinfo */
165 165 wchar_t *cond_macrostring;
166 166 /* string built from value of
167 167 * conditional macros used by
168 168 * this target
169 169 */
170 170 Boolean removed;/* This target is no longer recursive*/
171 171 };
172 172
173 173 struct _Dyntarget {
174 174 struct _Dyntarget *next;
175 175 struct _Name *name;
176 176 };
177 177
178 178
179 179 /*
180 180 * Typedefs for all structs
181 181 */
182 182 typedef struct _Cmd_line *Cmd_line, Cmd_line_rec;
183 183 typedef struct _Dependency *Dependency, Dependency_rec;
184 184 typedef struct _Macro *Macro, Macro_rec;
185 185 typedef struct _Name_vector *Name_vector, Name_vector_rec;
186 186 typedef struct _Percent *Percent, Percent_rec;
187 187 typedef struct _Dyntarget *Dyntarget;
188 188 typedef struct _Recursive_make *Recursive_make, Recursive_make_rec;
189 189 typedef struct _Running *Running, Running_rec;
190 190
191 191
192 192 /*
193 193 * extern declarations for all global variables.
194 194 * The actual declarations are in globals.cc
195 195 */
196 196 extern Boolean allrules_read;
197 197 extern Name posix_name;
198 198 extern Name svr4_name;
199 199 extern Boolean sdot_target;
200 200 extern Boolean all_parallel;
201 201 extern Boolean assign_done;
202 202 extern Boolean build_failed_seen;
203 203 #ifdef DISTRIBUTED
204 204 extern Boolean building_serial;
205 205 #endif
206 206 extern Name built_last_make_run;
207 207 extern Name c_at;
208 208 #ifdef DISTRIBUTED
209 209 extern Boolean called_make;
210 210 #endif
211 211 extern Boolean command_changed;
212 212 extern Boolean commands_done;
213 213 extern Chain conditional_targets;
214 214 extern Name conditionals;
215 215 extern Boolean continue_after_error;
216 216 extern Property current_line;
217 217 extern Name current_make_version;
218 218 extern Name current_target;
219 219 extern short debug_level;
220 220 extern Cmd_line default_rule;
221 221 extern Name default_rule_name;
222 222 extern Name default_target_to_build;
223 223 extern Boolean depinfo_already_read;
224 224 extern Name dmake_group;
225 225 extern Name dmake_max_jobs;
226 226 extern Name dmake_mode;
227 227 extern DMake_mode dmake_mode_type;
228 228 extern Name dmake_output_mode;
229 229 extern DMake_output_mode output_mode;
230 230 extern Name dmake_odir;
231 231 extern Name dmake_rcfile;
232 232 extern Name done;
233 233 extern Name dot;
234 234 extern Name dot_keep_state;
235 235 extern Name dot_keep_state_file;
236 236 extern Name empty_name;
237 237 extern Boolean fatal_in_progress;
238 238 extern int file_number;
239 239 extern Name force;
240 240 extern Name ignore_name;
241 241 extern Boolean ignore_errors;
242 242 extern Boolean ignore_errors_all;
243 243 extern Name init;
244 244 extern int job_msg_id;
245 245 extern Boolean keep_state;
246 246 extern Name make_state;
247 247 #ifdef TEAMWARE_MAKE_CMN
248 248 extern timestruc_t make_state_before;
249 249 #endif
250 250 extern Boolean make_state_locked;
251 251 extern Dependency makefiles_used;
252 252 extern Name makeflags;
253 253 extern Name make_version;
254 254 extern char mbs_buffer2[];
255 255 extern char *mbs_ptr;
256 256 extern char *mbs_ptr2;
257 257 extern Boolean no_action_was_taken;
258 258 extern int mtool_msgs_fd;
259 259 extern Boolean no_parallel;
260 260 #ifdef SGE_SUPPORT
261 261 extern Boolean grid;
262 262 #endif
263 263 extern Name no_parallel_name;
264 264 extern Name not_auto;
265 265 extern Boolean only_parallel;
266 266 extern Boolean parallel;
267 267 extern Name parallel_name;
268 268 extern Name localhost_name;
269 269 extern int parallel_process_cnt;
270 270 extern Percent percent_list;
271 271 extern Dyntarget dyntarget_list;
272 272 extern Name plus;
273 273 extern Name pmake_machinesfile;
274 274 extern Name precious;
275 275 extern Name primary_makefile;
276 276 extern Boolean quest;
277 277 extern short read_trace_level;
278 278 extern Boolean reading_dependencies;
279 279 extern int recursion_level;
280 280 extern Name recursive_name;
281 281 extern short report_dependencies_level;
282 282 extern Boolean report_pwd;
283 283 extern Boolean rewrite_statefile;
284 284 extern Running running_list;
285 285 extern char *sccs_dir_path;
286 286 extern Name sccs_get_name;
287 287 extern Name sccs_get_posix_name;
288 288 extern Cmd_line sccs_get_rule;
289 289 extern Cmd_line sccs_get_org_rule;
290 290 extern Cmd_line sccs_get_posix_rule;
291 291 extern Name get_name;
292 292 extern Name get_posix_name;
293 293 extern Cmd_line get_rule;
294 294 extern Cmd_line get_posix_rule;
295 295 extern Boolean send_mtool_msgs;
296 296 extern Boolean all_precious;
297 297 extern Boolean report_cwd;
298 298 extern Boolean silent_all;
299 299 extern Boolean silent;
300 300 extern Name silent_name;
↓ open down ↓ |
300 lines elided |
↑ open up ↑ |
301 301 extern char *stderr_file;
302 302 extern char *stdout_file;
303 303 #ifdef SGE_SUPPORT
304 304 extern char script_file[];
305 305 #endif
306 306 extern Boolean stdout_stderr_same;
307 307 extern Dependency suffixes;
308 308 extern Name suffixes_name;
309 309 extern Name sunpro_dependencies;
310 310 extern Boolean target_variants;
311 -extern char *tmpdir;
312 -extern char *temp_file_directory;
311 +extern const char *tmpdir;
312 +extern const char *temp_file_directory;
313 313 extern Name temp_file_name;
314 314 extern short temp_file_number;
315 315 extern wchar_t *top_level_target;
316 316 extern Boolean touch;
317 317 extern Boolean trace_reader;
318 318 extern Boolean build_unconditional;
319 319 extern pathpt vroot_path;
320 320 extern Name wait_name;
321 321 extern wchar_t wcs_buffer2[];
322 322 extern wchar_t *wcs_ptr;
323 323 extern wchar_t *wcs_ptr2;
324 324 extern nl_catd catd;
325 325 extern long int hostid;
326 326
327 327 /*
328 328 * Declarations of system defined variables
329 329 */
330 330 #if !defined(linux)
331 331 /* On linux this variable is defined in 'signal.h' */
332 332 extern char *sys_siglist[];
333 333 #endif
334 334
335 335 /*
336 336 * Declarations of system supplied functions
337 337 */
338 338 extern int file_lock(char *, char *, int *, int);
339 339
340 340 /*
341 341 * Declarations of functions declared and used by make
342 342 */
343 343 extern void add_pending(Name target, int recursion_level, Boolean do_get, Boolean implicit, Boolean redo);
344 344 extern void add_running(Name target, Name true_target, Property command, int recursion_level, int auto_count, Name *automatics, Boolean do_get, Boolean implicit);
345 345 extern void add_serial(Name target, int recursion_level, Boolean do_get, Boolean implicit);
346 346 extern void add_subtree(Name target, int recursion_level, Boolean do_get, Boolean implicit);
347 347 extern void append_or_replace_macro_in_dyn_array(ASCII_Dyn_Array *Ar, char *macro);
348 348 #ifdef DISTRIBUTED
349 349 extern Doname await_dist(Boolean waitflg);
350 350 #endif
351 351 #ifdef TEAMWARE_MAKE_CMN
352 352 extern void await_parallel(Boolean waitflg);
353 353 #endif
354 354 extern void build_suffix_list(Name target_suffix);
355 355 extern Boolean check_auto_dependencies(Name target, int auto_count, Name *automatics);
356 356 extern void check_state(Name temp_file_name);
357 357 extern void cond_macros_into_string(Name np, String_rec *buffer);
358 358 extern void construct_target_string();
359 359 extern void create_xdrs_ptr(void);
360 360 extern void depvar_add_to_list (Name name, Boolean cmdline);
361 361 #ifdef DISTRIBUTED
362 362 extern void distribute_rxm(Avo_DoJobMsg *dmake_job_msg);
363 363 extern int getRxmMessage(void);
364 364 extern Avo_JobResultMsg* getJobResultMsg(void);
365 365 extern Avo_AcknowledgeMsg* getAcknowledgeMsg(void);
366 366 #endif
367 367 extern Doname doname(register Name target, register Boolean do_get, register Boolean implicit, register Boolean automatic = false);
368 368 extern Doname doname_check(register Name target, register Boolean do_get, register Boolean implicit, register Boolean automatic);
369 369 extern Doname doname_parallel(Name target, Boolean do_get, Boolean implicit);
370 370 extern Doname dosys(register Name command, register Boolean ignore_error, register Boolean call_make, Boolean silent_error, Boolean always_exec, Name target, Boolean redirect_out_err);
371 371 extern void dump_make_state(void);
372 372 extern void dump_target_list(void);
373 373 extern void enter_conditional(register Name target, Name name, Name value, register Boolean append);
374 374 extern void enter_dependencies(register Name target, Chain target_group, register Name_vector depes, register Cmd_line command, register Separator separator);
375 375 extern void enter_dependency(Property line, register Name depe, Boolean automatic);
376 376 extern void enter_equal(Name name, Name value, register Boolean append);
377 377 extern Percent enter_percent(register Name target, Chain target_group, register Name_vector depes, Cmd_line command);
378 378 extern Dyntarget enter_dyntarget(register Name target);
379 379 extern Name_vector enter_name(String string, Boolean tail_present, register wchar_t *string_start, register wchar_t *string_end, Name_vector current_names, Name_vector *extra_names, Boolean *target_group_seen);
380 380 extern Boolean exec_vp(register char *name, register char **argv, char **envp, register Boolean ignore_error);
381 381 extern Doname execute_parallel(Property line, Boolean waitflg, Boolean local = false);
382 382 extern Doname execute_serial(Property line);
383 383 extern timestruc_t& exists(register Name target);
384 384 extern void fatal(char *, ...);
385 385 extern void fatal_reader(char *, ...);
386 386 extern Doname find_ar_suffix_rule(register Name target, Name true_target, Property *command, Boolean rechecking);
387 387 extern Doname find_double_suffix_rule(register Name target, Property *command, Boolean rechecking);
388 388 extern Doname find_percent_rule(register Name target, Property *command, Boolean rechecking);
389 389 extern int find_run_directory (char *cmd, char *cwd, char *dir, char **pgm, char **run, char *path);
390 390 extern Doname find_suffix_rule(Name target, Name target_body, Name target_suffix, Property *command, Boolean rechecking);
391 391 extern Chain find_target_groups(register Name_vector target_list, register int i, Boolean reset);
392 392 extern void finish_children(Boolean docheck);
393 393 extern void finish_running(void);
394 394 extern void free_chain(Name_vector ptr);
395 395 extern void gather_recursive_deps(void);
396 396 extern char *get_current_path(void);
397 397 extern int get_job_msg_id(void);
398 398 extern FILE *get_mtool_msgs_fp(void);
399 399 #ifdef DISTRIBUTED
400 400 extern Boolean get_dmake_group_specified(void);
401 401 extern Boolean get_dmake_max_jobs_specified(void);
402 402 extern Boolean get_dmake_mode_specified(void);
403 403 extern Boolean get_dmake_odir_specified(void);
404 404 extern Boolean get_dmake_rcfile_specified(void);
405 405 extern Boolean get_pmake_machinesfile_specified(void);
406 406 #endif
407 407 #if defined(DISTRIBUTED) || defined(MAKETOOL) /* tolik */
408 408 extern XDR *get_xdrs_ptr(void);
409 409 #endif
410 410 extern wchar_t *getmem_wc(register int size);
411 411 #if !defined(linux)
412 412 /* On linux getwd(char *) is defined in 'unistd.h' */
413 413 #ifdef __cplusplus
414 414 extern "C" {
415 415 #endif
416 416 extern char *getwd(char *);
417 417 #ifdef __cplusplus
418 418 }
419 419 #endif
420 420 #endif
421 421 extern void handle_interrupt(int);
422 422 extern Boolean is_running(Name target);
423 423 extern void load_cached_names(void);
424 424 extern Boolean parallel_ok(Name target, Boolean line_prop_must_exists);
425 425 extern void print_dependencies(register Name target, register Property line);
426 426 extern void send_job_start_msg(Property line);
427 427 extern void send_rsrc_info_msg(int max_jobs, char *hostname, char *username);
428 428 extern void print_value(register Name value, Daemon daemon);
429 429 extern timestruc_t& read_archive(register Name target);
430 430 extern int read_dir(Name dir, wchar_t *pattern, Property line, wchar_t *library);
431 431 extern void read_directory_of_file(register Name file);
432 432 extern int read_make_machines(Name make_machines_name);
433 433 extern Boolean read_simple_file(register Name makefile_name, register Boolean chase_path, register Boolean doname_it, Boolean complain, Boolean must_exist, Boolean report_file, Boolean lock_makefile);
434 434 extern void remove_recursive_dep(Name target);
435 435 extern void report_recursive_dep(Name target, char *line);
436 436 extern void report_recursive_done(void);
437 437 extern void report_recursive_init(void);
438 438 extern Recursive_make find_recursive_target(Name target);
439 439 extern void reset_locals(register Name target, register Property old_locals, register Property conditional, register int index);
440 440 extern void set_locals(register Name target, register Property old_locals);
441 441 extern void setvar_append(register Name name, register Name value);
442 442 #ifdef DISTRIBUTED
443 443 extern void setvar_envvar(Avo_DoJobMsg *dmake_job_msg);
444 444 #else
445 445 extern void setvar_envvar(void);
446 446 #endif
447 447 extern void special_reader(Name target, register Name_vector depes, Cmd_line command);
448 448 extern void startup_rxm();
449 449 extern Doname target_can_be_built(register Name target);
450 450 extern char *time_to_string(const timestruc_t &time);
451 451 extern void update_target(Property line, Doname result);
452 452 extern void warning(char *, ...);
453 453 extern void write_state_file(int report_recursive, Boolean exiting);
454 454 extern Name vpath_translation(register Name cmd);
455 455
456 456 #define DEPINFO_FMT_VERSION "VERS2$"
457 457 #define VER_LEN strlen(DEPINFO_FMT_VERSION)
458 458
459 459 #ifdef NSE
460 460
461 461 /*
462 462 * NSE version for depinfo format
463 463 */
464 464 extern Boolean nse;
465 465 extern Name nse_backquote_seen;
466 466 extern Boolean nse_did_recursion;
467 467 extern Name nse_shell_var_used;
468 468 extern Boolean nse_watch_vars;
469 469 extern wchar_t current_makefile[MAXPATHLEN];
470 470 extern Boolean nse_depinfo_locked;
471 471 extern char nse_depinfo_lockfile[MAXPATHLEN];
472 472 extern Name derived_src;
473 473
474 474 extern void depvar_dep_macro_used(Name);
475 475 extern void depvar_rule_macro_used(Name);
476 476 extern Boolean nse_backquotes(wchar_t *);
477 477 extern void nse_check_cd(Property);
478 478 extern void nse_check_derived_src(Name, wchar_t *, Cmd_line);
479 479 extern void nse_check_file_backquotes(wchar_t *);
480 480 extern void nse_check_no_deps_no_rule(Name, Property, Property);
481 481 extern void nse_check_sccs(wchar_t *, wchar_t *);
482 482 extern void nse_dep_cmdmacro(wchar_t *);
483 483 extern int nse_exit_status(void);
484 484 extern void nse_init_source_suffixes(void);
485 485 extern void nse_no_makefile(Name);
486 486 extern void nse_rule_cmdmacro(wchar_t *);
487 487 extern void nse_wildcard(wchar_t *, wchar_t *);
488 488 #endif
489 489
490 490 #endif
↓ open down ↓ |
168 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX