2010-11-27 François Dumont <francois.cppdevs@free.fr>
[official-gcc.git] / gcc / toplev.c
blob1bfdbe22986f2b4efe1823e5f4688c80231fd152
1 /* Top level of GCC compilers (cc1, cc1plus, etc.)
2 Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
3 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
4 Free Software Foundation, Inc.
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
11 version.
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
22 /* This is the top level of cc1/c++.
23 It parses command args, opens files, invokes the various passes
24 in the proper order, and counts the time used by each.
25 Error messages and low-level interface to malloc also handled here. */
27 #include "config.h"
28 #include "system.h"
29 #include "coretypes.h"
30 #include "tm.h"
31 #include <signal.h>
33 #ifdef HAVE_SYS_TIMES_H
34 # include <sys/times.h>
35 #endif
37 #include "line-map.h"
38 #include "input.h"
39 #include "tree.h"
40 #include "realmpfr.h" /* For GMP/MPFR/MPC versions, in print_version. */
41 #include "version.h"
42 #include "rtl.h"
43 #include "tm_p.h"
44 #include "flags.h"
45 #include "insn-attr.h"
46 #include "insn-config.h"
47 #include "insn-flags.h"
48 #include "hard-reg-set.h"
49 #include "recog.h"
50 #include "output.h"
51 #include "except.h"
52 #include "function.h"
53 #include "toplev.h"
54 #include "expr.h"
55 #include "basic-block.h"
56 #include "intl.h"
57 #include "ggc.h"
58 #include "graph.h"
59 #include "regs.h"
60 #include "timevar.h"
61 #include "diagnostic.h"
62 #include "tree-diagnostic.h"
63 #include "tree-pretty-print.h"
64 #include "params.h"
65 #include "reload.h"
66 #include "ira.h"
67 #include "dwarf2asm.h"
68 #include "integrate.h"
69 #include "debug.h"
70 #include "target.h"
71 #include "langhooks.h"
72 #include "cfglayout.h"
73 #include "cfgloop.h"
74 #include "hosthooks.h"
75 #include "cgraph.h"
76 #include "opts.h"
77 #include "opts-diagnostic.h"
78 #include "coverage.h"
79 #include "value-prof.h"
80 #include "alloc-pool.h"
81 #include "tree-mudflap.h"
82 #include "tree-pass.h"
83 #include "gimple.h"
84 #include "tree-ssa-alias.h"
85 #include "plugin.h"
87 #if defined (DWARF2_UNWIND_INFO) || defined (DWARF2_DEBUGGING_INFO)
88 #include "dwarf2out.h"
89 #endif
91 #if defined(DBX_DEBUGGING_INFO) || defined(XCOFF_DEBUGGING_INFO)
92 #include "dbxout.h"
93 #endif
95 #ifdef SDB_DEBUGGING_INFO
96 #include "sdbout.h"
97 #endif
99 #ifdef XCOFF_DEBUGGING_INFO
100 #include "xcoffout.h" /* Needed for external data
101 declarations for e.g. AIX 4.x. */
102 #endif
104 static void general_init (const char *);
105 static void do_compile (void);
106 static void process_options (void);
107 static void backend_init (void);
108 static int lang_dependent_init (const char *);
109 static void init_asm_output (const char *);
110 static void finalize (bool);
112 static void crash_signal (int) ATTRIBUTE_NORETURN;
113 static void compile_file (void);
115 /* True if we don't need a backend (e.g. preprocessing only). */
116 static bool no_backend;
118 /* Length of line when printing switch values. */
119 #define MAX_LINE 75
121 /* Decoded options, and number of such options. */
122 struct cl_decoded_option *save_decoded_options;
123 unsigned int save_decoded_options_count;
125 /* Name of top-level original source file (what was input to cpp).
126 This comes from the #-command at the beginning of the actual input.
127 If there isn't any there, then this is the cc1 input file name. */
129 const char *main_input_filename;
131 /* Pointer to base name in main_input_filename, with directories and a
132 single final extension removed, and the length of this base
133 name. */
134 const char *main_input_basename;
135 int main_input_baselength;
137 /* Used to enable -fvar-tracking, -fweb and -frename-registers according
138 to optimize in process_options (). */
139 #define AUTODETECT_VALUE 2
141 /* Debug hooks - dependent upon command line options. */
143 const struct gcc_debug_hooks *debug_hooks;
145 /* True if this is the lto front end. This is used to disable
146 gimple generation and lowering passes that are normally run on the
147 output of a front end. These passes must be bypassed for lto since
148 they have already been done before the gimple was written. */
150 bool in_lto_p = false;
152 /* The FUNCTION_DECL for the function currently being compiled,
153 or 0 if between functions. */
154 tree current_function_decl;
156 /* Set to the FUNC_BEGIN label of the current function, or NULL
157 if none. */
158 const char * current_function_func_begin_label;
160 /* A random sequence of characters, unless overridden by user. */
161 static const char *flag_random_seed;
163 /* A local time stamp derived from the time of compilation. It will be
164 zero if the system cannot provide a time. It will be -1u, if the
165 user has specified a particular random seed. */
166 unsigned local_tick;
168 /* -f flags. */
170 /* Generate code for GNU or NeXT Objective-C runtime environment. */
172 #ifdef NEXT_OBJC_RUNTIME
173 int flag_next_runtime = 1;
174 #else
175 int flag_next_runtime = 0;
176 #endif
178 /* Nonzero means make permerror produce warnings instead of errors. */
180 int flag_permissive = 0;
182 /* When non-NULL, indicates that whenever space is allocated on the
183 stack, the resulting stack pointer must not pass this
184 address---that is, for stacks that grow downward, the stack pointer
185 must always be greater than or equal to this address; for stacks
186 that grow upward, the stack pointer must be less than this address.
187 At present, the rtx may be either a REG or a SYMBOL_REF, although
188 the support provided depends on the backend. */
189 rtx stack_limit_rtx;
191 /* Type of stack check. */
192 enum stack_check_type flag_stack_check = NO_STACK_CHECK;
194 /* True if the user has tagged the function with the 'section'
195 attribute. */
197 bool user_defined_section_attribute = false;
199 struct target_flag_state default_target_flag_state;
200 #if SWITCHABLE_TARGET
201 struct target_flag_state *this_target_flag_state = &default_target_flag_state;
202 #else
203 #define this_target_flag_state (&default_target_flag_state)
204 #endif
206 typedef struct
208 const char *const string;
209 int *const variable;
210 const int on_value;
212 lang_independent_options;
214 /* The user symbol prefix after having resolved same. */
215 const char *user_label_prefix;
217 static const param_info lang_independent_params[] = {
218 #define DEFPARAM(ENUM, OPTION, HELP, DEFAULT, MIN, MAX) \
219 { OPTION, DEFAULT, MIN, MAX, HELP },
220 #include "params.def"
221 #undef DEFPARAM
222 { NULL, 0, 0, 0, NULL }
225 /* Output files for assembler code (real compiler output)
226 and debugging dumps. */
228 FILE *asm_out_file;
229 FILE *aux_info_file;
230 FILE *stack_usage_file = NULL;
231 FILE *dump_file = NULL;
232 const char *dump_file_name;
234 /* The current working directory of a translation. It's generally the
235 directory from which compilation was initiated, but a preprocessed
236 file may specify the original directory in which it was
237 created. */
239 static const char *src_pwd;
241 /* Initialize src_pwd with the given string, and return true. If it
242 was already initialized, return false. As a special case, it may
243 be called with a NULL argument to test whether src_pwd has NOT been
244 initialized yet. */
246 bool
247 set_src_pwd (const char *pwd)
249 if (src_pwd)
251 if (strcmp (src_pwd, pwd) == 0)
252 return true;
253 else
254 return false;
257 src_pwd = xstrdup (pwd);
258 return true;
261 /* Return the directory from which the translation unit was initiated,
262 in case set_src_pwd() was not called before to assign it a
263 different value. */
265 const char *
266 get_src_pwd (void)
268 if (! src_pwd)
270 src_pwd = getpwd ();
271 if (!src_pwd)
272 src_pwd = ".";
275 return src_pwd;
278 /* Called when the start of a function definition is parsed,
279 this function prints on stderr the name of the function. */
280 void
281 announce_function (tree decl)
283 if (!quiet_flag)
285 if (rtl_dump_and_exit)
286 fprintf (stderr, "%s ",
287 identifier_to_locale (IDENTIFIER_POINTER (DECL_NAME (decl))));
288 else
289 fprintf (stderr, " %s",
290 identifier_to_locale (lang_hooks.decl_printable_name (decl, 2)));
291 fflush (stderr);
292 pp_needs_newline (global_dc->printer) = true;
293 diagnostic_set_last_function (global_dc, (diagnostic_info *) NULL);
297 /* Initialize local_tick with the time of day, or -1 if
298 flag_random_seed is set. */
300 static void
301 init_local_tick (void)
303 if (!flag_random_seed)
305 /* Get some more or less random data. */
306 #ifdef HAVE_GETTIMEOFDAY
308 struct timeval tv;
310 gettimeofday (&tv, NULL);
311 local_tick = tv.tv_sec * 1000 + tv.tv_usec / 1000;
313 #else
315 time_t now = time (NULL);
317 if (now != (time_t)-1)
318 local_tick = (unsigned) now;
320 #endif
322 else
323 local_tick = -1;
326 /* Set up a default flag_random_seed and local_tick, unless the user
327 already specified one. Must be called after init_local_tick. */
329 static void
330 init_random_seed (void)
332 unsigned HOST_WIDE_INT value;
333 static char random_seed[HOST_BITS_PER_WIDE_INT / 4 + 3];
335 value = local_tick ^ getpid ();
337 sprintf (random_seed, HOST_WIDE_INT_PRINT_HEX, value);
338 flag_random_seed = random_seed;
341 /* Obtain the random_seed string. Unless NOINIT, initialize it if
342 it's not provided in the command line. */
344 const char *
345 get_random_seed (bool noinit)
347 if (!flag_random_seed && !noinit)
348 init_random_seed ();
349 return flag_random_seed;
352 /* Modify the random_seed string to VAL. Return its previous
353 value. */
355 const char *
356 set_random_seed (const char *val)
358 const char *old = flag_random_seed;
359 flag_random_seed = val;
360 return old;
363 #if GCC_VERSION < 3004
365 /* The functions clz_hwi, ctz_hwi, ffs_hwi, floor_log2 and exact_log2
366 are defined as inline functions in toplev.h if GCC_VERSION >= 3004.
367 The definitions here are used for older versions of gcc. */
369 /* Given X, an unsigned number, return the largest int Y such that 2**Y <= X.
370 If X is 0, return -1. */
373 floor_log2 (unsigned HOST_WIDE_INT x)
375 int t = 0;
377 if (x == 0)
378 return -1;
380 if (HOST_BITS_PER_WIDE_INT > 64)
381 if (x >= (unsigned HOST_WIDE_INT) 1 << (t + 64))
382 t += 64;
383 if (HOST_BITS_PER_WIDE_INT > 32)
384 if (x >= ((unsigned HOST_WIDE_INT) 1) << (t + 32))
385 t += 32;
386 if (x >= ((unsigned HOST_WIDE_INT) 1) << (t + 16))
387 t += 16;
388 if (x >= ((unsigned HOST_WIDE_INT) 1) << (t + 8))
389 t += 8;
390 if (x >= ((unsigned HOST_WIDE_INT) 1) << (t + 4))
391 t += 4;
392 if (x >= ((unsigned HOST_WIDE_INT) 1) << (t + 2))
393 t += 2;
394 if (x >= ((unsigned HOST_WIDE_INT) 1) << (t + 1))
395 t += 1;
397 return t;
400 /* Return the logarithm of X, base 2, considering X unsigned,
401 if X is a power of 2. Otherwise, returns -1. */
404 exact_log2 (unsigned HOST_WIDE_INT x)
406 if (x != (x & -x))
407 return -1;
408 return floor_log2 (x);
411 /* Given X, an unsigned number, return the number of least significant bits
412 that are zero. When X == 0, the result is the word size. */
415 ctz_hwi (unsigned HOST_WIDE_INT x)
417 return x ? floor_log2 (x & -x) : HOST_BITS_PER_WIDE_INT;
420 /* Similarly for most significant bits. */
423 clz_hwi (unsigned HOST_WIDE_INT x)
425 return HOST_BITS_PER_WIDE_INT - 1 - floor_log2(x);
428 /* Similar to ctz_hwi, except that the least significant bit is numbered
429 starting from 1, and X == 0 yields 0. */
432 ffs_hwi (unsigned HOST_WIDE_INT x)
434 return 1 + floor_log2 (x & -x);
437 #endif /* GCC_VERSION < 3004 */
439 /* Handler for fatal signals, such as SIGSEGV. These are transformed
440 into ICE messages, which is much more user friendly. In case the
441 error printer crashes, reset the signal to prevent infinite recursion. */
443 static void
444 crash_signal (int signo)
446 signal (signo, SIG_DFL);
448 /* If we crashed while processing an ASM statement, then be a little more
449 graceful. It's most likely the user's fault. */
450 if (this_is_asm_operands)
452 output_operand_lossage ("unrecoverable error");
453 exit (FATAL_EXIT_CODE);
456 internal_error ("%s", strsignal (signo));
459 /* Output a quoted string. */
461 void
462 output_quoted_string (FILE *asm_file, const char *string)
464 #ifdef OUTPUT_QUOTED_STRING
465 OUTPUT_QUOTED_STRING (asm_file, string);
466 #else
467 char c;
469 putc ('\"', asm_file);
470 while ((c = *string++) != 0)
472 if (ISPRINT (c))
474 if (c == '\"' || c == '\\')
475 putc ('\\', asm_file);
476 putc (c, asm_file);
478 else
479 fprintf (asm_file, "\\%03o", (unsigned char) c);
481 putc ('\"', asm_file);
482 #endif
485 /* A subroutine of wrapup_global_declarations. We've come to the end of
486 the compilation unit. All deferred variables should be undeferred,
487 and all incomplete decls should be finalized. */
489 void
490 wrapup_global_declaration_1 (tree decl)
492 /* We're not deferring this any longer. Assignment is conditional to
493 avoid needlessly dirtying PCH pages. */
494 if (CODE_CONTAINS_STRUCT (TREE_CODE (decl), TS_DECL_WITH_VIS)
495 && DECL_DEFER_OUTPUT (decl) != 0)
496 DECL_DEFER_OUTPUT (decl) = 0;
498 if (TREE_CODE (decl) == VAR_DECL && DECL_SIZE (decl) == 0)
499 lang_hooks.finish_incomplete_decl (decl);
502 /* A subroutine of wrapup_global_declarations. Decide whether or not DECL
503 needs to be output. Return true if it is output. */
505 bool
506 wrapup_global_declaration_2 (tree decl)
508 if (TREE_ASM_WRITTEN (decl) || DECL_EXTERNAL (decl))
509 return false;
511 /* Don't write out static consts, unless we still need them.
513 We also keep static consts if not optimizing (for debugging),
514 unless the user specified -fno-keep-static-consts.
515 ??? They might be better written into the debug information.
516 This is possible when using DWARF.
518 A language processor that wants static constants to be always
519 written out (even if it is not used) is responsible for
520 calling rest_of_decl_compilation itself. E.g. the C front-end
521 calls rest_of_decl_compilation from finish_decl.
522 One motivation for this is that is conventional in some
523 environments to write things like:
524 static const char rcsid[] = "... version string ...";
525 intending to force the string to be in the executable.
527 A language processor that would prefer to have unneeded
528 static constants "optimized away" would just defer writing
529 them out until here. E.g. C++ does this, because static
530 constants are often defined in header files.
532 ??? A tempting alternative (for both C and C++) would be
533 to force a constant to be written if and only if it is
534 defined in a main file, as opposed to an include file. */
536 if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl))
538 struct varpool_node *node;
539 bool needed = true;
540 node = varpool_get_node (decl);
542 if (!node && flag_ltrans)
543 needed = false;
544 else if (node && node->finalized)
545 needed = false;
546 else if (node && node->alias)
547 needed = false;
548 else if (!cgraph_global_info_ready
549 && (TREE_USED (decl)
550 || TREE_USED (DECL_ASSEMBLER_NAME (decl))))
551 /* needed */;
552 else if (node && node->needed)
553 /* needed */;
554 else if (DECL_COMDAT (decl))
555 needed = false;
556 else if (TREE_READONLY (decl) && !TREE_PUBLIC (decl)
557 && (optimize || !flag_keep_static_consts
558 || DECL_ARTIFICIAL (decl)))
559 needed = false;
561 if (needed)
563 rest_of_decl_compilation (decl, 1, 1);
564 return true;
568 return false;
571 /* Do any final processing required for the declarations in VEC, of
572 which there are LEN. We write out inline functions and variables
573 that have been deferred until this point, but which are required.
574 Returns nonzero if anything was put out. */
576 bool
577 wrapup_global_declarations (tree *vec, int len)
579 bool reconsider, output_something = false;
580 int i;
582 for (i = 0; i < len; i++)
583 wrapup_global_declaration_1 (vec[i]);
585 /* Now emit any global variables or functions that we have been
586 putting off. We need to loop in case one of the things emitted
587 here references another one which comes earlier in the list. */
590 reconsider = false;
591 for (i = 0; i < len; i++)
592 reconsider |= wrapup_global_declaration_2 (vec[i]);
593 if (reconsider)
594 output_something = true;
596 while (reconsider);
598 return output_something;
601 /* A subroutine of check_global_declarations. Issue appropriate warnings
602 for the global declaration DECL. */
604 void
605 check_global_declaration_1 (tree decl)
607 /* Warn about any function declared static but not defined. We don't
608 warn about variables, because many programs have static variables
609 that exist only to get some text into the object file. */
610 if (TREE_CODE (decl) == FUNCTION_DECL
611 && DECL_INITIAL (decl) == 0
612 && DECL_EXTERNAL (decl)
613 && ! DECL_ARTIFICIAL (decl)
614 && ! TREE_NO_WARNING (decl)
615 && ! TREE_PUBLIC (decl)
616 && (warn_unused_function
617 || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))))
619 if (TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))
620 pedwarn (input_location, 0, "%q+F used but never defined", decl);
621 else
622 warning (OPT_Wunused_function, "%q+F declared %<static%> but never defined", decl);
623 /* This symbol is effectively an "extern" declaration now. */
624 TREE_PUBLIC (decl) = 1;
625 assemble_external (decl);
628 /* Warn about static fns or vars defined but not used. */
629 if (((warn_unused_function && TREE_CODE (decl) == FUNCTION_DECL)
630 /* We don't warn about "static const" variables because the
631 "rcs_id" idiom uses that construction. */
632 || (warn_unused_variable
633 && TREE_CODE (decl) == VAR_DECL && ! TREE_READONLY (decl)))
634 && ! DECL_IN_SYSTEM_HEADER (decl)
635 && ! TREE_USED (decl)
636 /* The TREE_USED bit for file-scope decls is kept in the identifier,
637 to handle multiple external decls in different scopes. */
638 && ! (DECL_NAME (decl) && TREE_USED (DECL_NAME (decl)))
639 && ! DECL_EXTERNAL (decl)
640 && ! TREE_PUBLIC (decl)
641 /* A volatile variable might be used in some non-obvious way. */
642 && ! TREE_THIS_VOLATILE (decl)
643 /* Global register variables must be declared to reserve them. */
644 && ! (TREE_CODE (decl) == VAR_DECL && DECL_REGISTER (decl))
645 /* Otherwise, ask the language. */
646 && lang_hooks.decls.warn_unused_global (decl))
647 warning ((TREE_CODE (decl) == FUNCTION_DECL)
648 ? OPT_Wunused_function
649 : OPT_Wunused_variable,
650 "%q+D defined but not used", decl);
653 /* Issue appropriate warnings for the global declarations in VEC (of
654 which there are LEN). */
656 void
657 check_global_declarations (tree *vec, int len)
659 int i;
661 for (i = 0; i < len; i++)
662 check_global_declaration_1 (vec[i]);
665 /* Emit debugging information for all global declarations in VEC. */
667 void
668 emit_debug_global_declarations (tree *vec, int len)
670 int i;
672 /* Avoid confusing the debug information machinery when there are errors. */
673 if (seen_error ())
674 return;
676 timevar_push (TV_SYMOUT);
677 for (i = 0; i < len; i++)
678 debug_hooks->global_decl (vec[i]);
679 timevar_pop (TV_SYMOUT);
682 /* Warn about a use of an identifier which was marked deprecated. */
683 void
684 warn_deprecated_use (tree node, tree attr)
686 const char *msg;
688 if (node == 0 || !warn_deprecated_decl)
689 return;
691 if (!attr)
693 if (DECL_P (node))
694 attr = DECL_ATTRIBUTES (node);
695 else if (TYPE_P (node))
697 tree decl = TYPE_STUB_DECL (node);
698 if (decl)
699 attr = lookup_attribute ("deprecated",
700 TYPE_ATTRIBUTES (TREE_TYPE (decl)));
704 if (attr)
705 attr = lookup_attribute ("deprecated", attr);
707 if (attr)
708 msg = TREE_STRING_POINTER (TREE_VALUE (TREE_VALUE (attr)));
709 else
710 msg = NULL;
712 if (DECL_P (node))
714 expanded_location xloc = expand_location (DECL_SOURCE_LOCATION (node));
715 if (msg)
716 warning (OPT_Wdeprecated_declarations,
717 "%qD is deprecated (declared at %s:%d): %s",
718 node, xloc.file, xloc.line, msg);
719 else
720 warning (OPT_Wdeprecated_declarations,
721 "%qD is deprecated (declared at %s:%d)",
722 node, xloc.file, xloc.line);
724 else if (TYPE_P (node))
726 tree what = NULL_TREE;
727 tree decl = TYPE_STUB_DECL (node);
729 if (TYPE_NAME (node))
731 if (TREE_CODE (TYPE_NAME (node)) == IDENTIFIER_NODE)
732 what = TYPE_NAME (node);
733 else if (TREE_CODE (TYPE_NAME (node)) == TYPE_DECL
734 && DECL_NAME (TYPE_NAME (node)))
735 what = DECL_NAME (TYPE_NAME (node));
738 if (decl)
740 expanded_location xloc
741 = expand_location (DECL_SOURCE_LOCATION (decl));
742 if (what)
744 if (msg)
745 warning (OPT_Wdeprecated_declarations,
746 "%qE is deprecated (declared at %s:%d): %s",
747 what, xloc.file, xloc.line, msg);
748 else
749 warning (OPT_Wdeprecated_declarations,
750 "%qE is deprecated (declared at %s:%d)", what,
751 xloc.file, xloc.line);
753 else
755 if (msg)
756 warning (OPT_Wdeprecated_declarations,
757 "type is deprecated (declared at %s:%d): %s",
758 xloc.file, xloc.line, msg);
759 else
760 warning (OPT_Wdeprecated_declarations,
761 "type is deprecated (declared at %s:%d)",
762 xloc.file, xloc.line);
765 else
767 if (what)
769 if (msg)
770 warning (OPT_Wdeprecated_declarations, "%qE is deprecated: %s",
771 what, msg);
772 else
773 warning (OPT_Wdeprecated_declarations, "%qE is deprecated", what);
775 else
777 if (msg)
778 warning (OPT_Wdeprecated_declarations, "type is deprecated: %s",
779 msg);
780 else
781 warning (OPT_Wdeprecated_declarations, "type is deprecated");
787 /* Compile an entire translation unit. Write a file of assembly
788 output and various debugging dumps. */
790 static void
791 compile_file (void)
793 /* Initialize yet another pass. */
795 ggc_protect_identifiers = true;
797 init_cgraph ();
798 init_final (main_input_filename);
799 coverage_init (aux_base_name);
800 statistics_init ();
801 invoke_plugin_callbacks (PLUGIN_START_UNIT, NULL);
803 timevar_push (TV_PARSE);
805 /* Call the parser, which parses the entire file (calling
806 rest_of_compilation for each function). */
807 lang_hooks.parse_file ();
809 /* Compilation is now finished except for writing
810 what's left of the symbol table output. */
811 timevar_pop (TV_PARSE);
813 if (flag_syntax_only || flag_wpa)
814 return;
816 ggc_protect_identifiers = false;
818 /* This must also call cgraph_finalize_compilation_unit. */
819 lang_hooks.decls.final_write_globals ();
821 if (seen_error ())
822 return;
824 varpool_assemble_pending_decls ();
825 finish_aliases_2 ();
827 /* Likewise for mudflap static object registrations. */
828 if (flag_mudflap)
829 mudflap_finish_file ();
831 output_shared_constant_pool ();
832 output_object_blocks ();
834 /* Write out any pending weak symbol declarations. */
835 weak_finish ();
837 /* This must be at the end before unwind and debug info.
838 Some target ports emit PIC setup thunks here. */
839 targetm.asm_out.code_end ();
841 /* Do dbx symbols. */
842 timevar_push (TV_SYMOUT);
844 #if defined DWARF2_DEBUGGING_INFO || defined DWARF2_UNWIND_INFO
845 if (dwarf2out_do_frame ())
846 dwarf2out_frame_finish ();
847 #endif
849 (*debug_hooks->finish) (main_input_filename);
850 timevar_pop (TV_SYMOUT);
852 /* Output some stuff at end of file if nec. */
854 dw2_output_indirect_constants ();
856 /* Flush any pending external directives. */
857 process_pending_assemble_externals ();
859 /* Emit LTO marker if LTO info has been previously emitted. This is
860 used by collect2 to determine whether an object file contains IL.
861 We used to emit an undefined reference here, but this produces
862 link errors if an object file with IL is stored into a shared
863 library without invoking lto1. */
864 if (flag_generate_lto)
866 #if defined ASM_OUTPUT_ALIGNED_DECL_COMMON
867 ASM_OUTPUT_ALIGNED_DECL_COMMON (asm_out_file, NULL_TREE,
868 "__gnu_lto_v1",
869 (unsigned HOST_WIDE_INT) 1, 8);
870 #elif defined ASM_OUTPUT_ALIGNED_COMMON
871 ASM_OUTPUT_ALIGNED_COMMON (asm_out_file, "__gnu_lto_v1",
872 (unsigned HOST_WIDE_INT) 1, 8);
873 #else
874 ASM_OUTPUT_COMMON (asm_out_file, "__gnu_lto_v1",
875 (unsigned HOST_WIDE_INT) 1,
876 (unsigned HOST_WIDE_INT) 1);
877 #endif
880 /* Attach a special .ident directive to the end of the file to identify
881 the version of GCC which compiled this code. The format of the .ident
882 string is patterned after the ones produced by native SVR4 compilers. */
883 #ifdef IDENT_ASM_OP
884 if (!flag_no_ident)
886 const char *pkg_version = "(GNU) ";
888 if (strcmp ("(GCC) ", pkgversion_string))
889 pkg_version = pkgversion_string;
890 fprintf (asm_out_file, "%s\"GCC: %s%s\"\n",
891 IDENT_ASM_OP, pkg_version, version_string);
893 #endif
895 /* Invoke registered plugin callbacks. */
896 invoke_plugin_callbacks (PLUGIN_FINISH_UNIT, NULL);
898 /* This must be at the end. Some target ports emit end of file directives
899 into the assembly file here, and hence we can not output anything to the
900 assembly file after this point. */
901 targetm.asm_out.file_end ();
904 /* Indexed by enum debug_info_type. */
905 const char *const debug_type_names[] =
907 "none", "stabs", "coff", "dwarf-2", "xcoff", "vms"
910 /* Print version information to FILE.
911 Each line begins with INDENT (for the case where FILE is the
912 assembler output file). */
914 void
915 print_version (FILE *file, const char *indent)
917 static const char fmt1[] =
918 #ifdef __GNUC__
919 N_("%s%s%s %sversion %s (%s)\n%s\tcompiled by GNU C version %s, ")
920 #else
921 N_("%s%s%s %sversion %s (%s) compiled by CC, ")
922 #endif
924 static const char fmt2[] =
925 N_("GMP version %s, MPFR version %s, MPC version %s\n");
926 static const char fmt3[] =
927 N_("%s%swarning: %s header version %s differs from library version %s.\n");
928 static const char fmt4[] =
929 N_("%s%sGGC heuristics: --param ggc-min-expand=%d --param ggc-min-heapsize=%d\n");
930 #ifndef __VERSION__
931 #define __VERSION__ "[?]"
932 #endif
933 fprintf (file,
934 file == stderr ? _(fmt1) : fmt1,
935 indent, *indent != 0 ? " " : "",
936 lang_hooks.name, pkgversion_string, version_string, TARGET_NAME,
937 indent, __VERSION__);
939 /* We need to stringify the GMP macro values. Ugh, gmp_version has
940 two string formats, "i.j.k" and "i.j" when k is zero. As of
941 gmp-4.3.0, GMP always uses the 3 number format. */
942 #define GCC_GMP_STRINGIFY_VERSION3(X) #X
943 #define GCC_GMP_STRINGIFY_VERSION2(X) GCC_GMP_STRINGIFY_VERSION3(X)
944 #define GCC_GMP_VERSION_NUM(X,Y,Z) (((X) << 16L) | ((Y) << 8) | (Z))
945 #define GCC_GMP_VERSION \
946 GCC_GMP_VERSION_NUM(__GNU_MP_VERSION, __GNU_MP_VERSION_MINOR, __GNU_MP_VERSION_PATCHLEVEL)
947 #if GCC_GMP_VERSION < GCC_GMP_VERSION_NUM(4,3,0) && __GNU_MP_VERSION_PATCHLEVEL == 0
948 #define GCC_GMP_STRINGIFY_VERSION GCC_GMP_STRINGIFY_VERSION2(__GNU_MP_VERSION) "." \
949 GCC_GMP_STRINGIFY_VERSION2(__GNU_MP_VERSION_MINOR)
950 #else
951 #define GCC_GMP_STRINGIFY_VERSION GCC_GMP_STRINGIFY_VERSION2(__GNU_MP_VERSION) "." \
952 GCC_GMP_STRINGIFY_VERSION2(__GNU_MP_VERSION_MINOR) "." \
953 GCC_GMP_STRINGIFY_VERSION2(__GNU_MP_VERSION_PATCHLEVEL)
954 #endif
955 fprintf (file,
956 file == stderr ? _(fmt2) : fmt2,
957 GCC_GMP_STRINGIFY_VERSION, MPFR_VERSION_STRING, MPC_VERSION_STRING);
958 if (strcmp (GCC_GMP_STRINGIFY_VERSION, gmp_version))
959 fprintf (file,
960 file == stderr ? _(fmt3) : fmt3,
961 indent, *indent != 0 ? " " : "",
962 "GMP", GCC_GMP_STRINGIFY_VERSION, gmp_version);
963 if (strcmp (MPFR_VERSION_STRING, mpfr_get_version ()))
964 fprintf (file,
965 file == stderr ? _(fmt3) : fmt3,
966 indent, *indent != 0 ? " " : "",
967 "MPFR", MPFR_VERSION_STRING, mpfr_get_version ());
968 if (strcmp (MPC_VERSION_STRING, mpc_get_version ()))
969 fprintf (file,
970 file == stderr ? _(fmt3) : fmt3,
971 indent, *indent != 0 ? " " : "",
972 "MPC", MPC_VERSION_STRING, mpc_get_version ());
973 fprintf (file,
974 file == stderr ? _(fmt4) : fmt4,
975 indent, *indent != 0 ? " " : "",
976 PARAM_VALUE (GGC_MIN_EXPAND), PARAM_VALUE (GGC_MIN_HEAPSIZE));
978 print_plugins_versions (file, indent);
981 #ifdef ASM_COMMENT_START
982 static int
983 print_to_asm_out_file (print_switch_type type, const char * text)
985 bool prepend_sep = true;
987 switch (type)
989 case SWITCH_TYPE_LINE_END:
990 putc ('\n', asm_out_file);
991 return 1;
993 case SWITCH_TYPE_LINE_START:
994 fputs (ASM_COMMENT_START, asm_out_file);
995 return strlen (ASM_COMMENT_START);
997 case SWITCH_TYPE_DESCRIPTIVE:
998 if (ASM_COMMENT_START[0] == 0)
999 prepend_sep = false;
1000 /* Drop through. */
1001 case SWITCH_TYPE_PASSED:
1002 case SWITCH_TYPE_ENABLED:
1003 if (prepend_sep)
1004 fputc (' ', asm_out_file);
1005 fputs (text, asm_out_file);
1006 /* No need to return the length here as
1007 print_single_switch has already done it. */
1008 return 0;
1010 default:
1011 return -1;
1014 #endif
1016 static int
1017 print_to_stderr (print_switch_type type, const char * text)
1019 switch (type)
1021 case SWITCH_TYPE_LINE_END:
1022 putc ('\n', stderr);
1023 return 1;
1025 case SWITCH_TYPE_LINE_START:
1026 return 0;
1028 case SWITCH_TYPE_PASSED:
1029 case SWITCH_TYPE_ENABLED:
1030 fputc (' ', stderr);
1031 /* Drop through. */
1033 case SWITCH_TYPE_DESCRIPTIVE:
1034 fputs (text, stderr);
1035 /* No need to return the length here as
1036 print_single_switch has already done it. */
1037 return 0;
1039 default:
1040 return -1;
1044 /* Print an option value and return the adjusted position in the line.
1045 ??? print_fn doesn't handle errors, eg disk full; presumably other
1046 code will catch a disk full though. */
1048 static int
1049 print_single_switch (print_switch_fn_type print_fn,
1050 int pos,
1051 print_switch_type type,
1052 const char * text)
1054 /* The ultrix fprintf returns 0 on success, so compute the result
1055 we want here since we need it for the following test. The +1
1056 is for the separator character that will probably be emitted. */
1057 int len = strlen (text) + 1;
1059 if (pos != 0
1060 && pos + len > MAX_LINE)
1062 print_fn (SWITCH_TYPE_LINE_END, NULL);
1063 pos = 0;
1066 if (pos == 0)
1067 pos += print_fn (SWITCH_TYPE_LINE_START, NULL);
1069 print_fn (type, text);
1070 return pos + len;
1073 /* Print active target switches using PRINT_FN.
1074 POS is the current cursor position and MAX is the size of a "line".
1075 Each line begins with INDENT and ends with TERM.
1076 Each switch is separated from the next by SEP. */
1078 static void
1079 print_switch_values (print_switch_fn_type print_fn)
1081 int pos = 0;
1082 size_t j;
1084 /* Fill in the -frandom-seed option, if the user didn't pass it, so
1085 that it can be printed below. This helps reproducibility. */
1086 if (!flag_random_seed)
1087 init_random_seed ();
1089 /* Print the options as passed. */
1090 pos = print_single_switch (print_fn, pos,
1091 SWITCH_TYPE_DESCRIPTIVE, _("options passed: "));
1093 for (j = 1; j < save_decoded_options_count; j++)
1095 switch (save_decoded_options[j].opt_index)
1097 case OPT_o:
1098 case OPT_d:
1099 case OPT_dumpbase:
1100 case OPT_dumpdir:
1101 case OPT_auxbase:
1102 case OPT_quiet:
1103 case OPT_version:
1104 /* Ignore these. */
1105 continue;
1108 pos = print_single_switch (print_fn, pos, SWITCH_TYPE_PASSED,
1109 save_decoded_options[j].orig_option_with_args_text);
1112 if (pos > 0)
1113 print_fn (SWITCH_TYPE_LINE_END, NULL);
1115 /* Print the -f and -m options that have been enabled.
1116 We don't handle language specific options but printing argv
1117 should suffice. */
1118 pos = print_single_switch (print_fn, 0,
1119 SWITCH_TYPE_DESCRIPTIVE, _("options enabled: "));
1121 for (j = 0; j < cl_options_count; j++)
1122 if ((cl_options[j].flags & CL_REPORT)
1123 && option_enabled (j, &global_options) > 0)
1124 pos = print_single_switch (print_fn, pos,
1125 SWITCH_TYPE_ENABLED, cl_options[j].opt_text);
1127 print_fn (SWITCH_TYPE_LINE_END, NULL);
1130 /* Open assembly code output file. Do this even if -fsyntax-only is
1131 on, because then the driver will have provided the name of a
1132 temporary file or bit bucket for us. NAME is the file specified on
1133 the command line, possibly NULL. */
1134 static void
1135 init_asm_output (const char *name)
1137 if (name == NULL && asm_file_name == 0)
1138 asm_out_file = stdout;
1139 else
1141 if (asm_file_name == 0)
1143 int len = strlen (dump_base_name);
1144 char *dumpname = XNEWVEC (char, len + 6);
1146 memcpy (dumpname, dump_base_name, len + 1);
1147 strip_off_ending (dumpname, len);
1148 strcat (dumpname, ".s");
1149 asm_file_name = dumpname;
1151 if (!strcmp (asm_file_name, "-"))
1152 asm_out_file = stdout;
1153 else
1154 asm_out_file = fopen (asm_file_name, "w+b");
1155 if (asm_out_file == 0)
1156 fatal_error ("can%'t open %s for writing: %m", asm_file_name);
1159 if (!flag_syntax_only)
1161 targetm.asm_out.file_start ();
1163 if (flag_record_gcc_switches)
1165 if (targetm.asm_out.record_gcc_switches)
1167 /* Let the target know that we are about to start recording. */
1168 targetm.asm_out.record_gcc_switches (SWITCH_TYPE_DESCRIPTIVE,
1169 NULL);
1170 /* Now record the switches. */
1171 print_switch_values (targetm.asm_out.record_gcc_switches);
1172 /* Let the target know that the recording is over. */
1173 targetm.asm_out.record_gcc_switches (SWITCH_TYPE_DESCRIPTIVE,
1174 NULL);
1176 else
1177 inform (input_location, "-frecord-gcc-switches is not supported by the current target");
1180 #ifdef ASM_COMMENT_START
1181 if (flag_verbose_asm)
1183 /* Print the list of switches in effect
1184 into the assembler file as comments. */
1185 print_version (asm_out_file, ASM_COMMENT_START);
1186 print_switch_values (print_to_asm_out_file);
1187 putc ('\n', asm_out_file);
1189 #endif
1193 /* Return true if the state of option OPTION should be stored in PCH files
1194 and checked by default_pch_valid_p. Store the option's current state
1195 in STATE if so. */
1197 static inline bool
1198 option_affects_pch_p (int option, struct cl_option_state *state)
1200 if ((cl_options[option].flags & CL_TARGET) == 0)
1201 return false;
1202 if (option_flag_var (option, &global_options) == &target_flags)
1203 if (targetm.check_pch_target_flags)
1204 return false;
1205 return get_option_state (&global_options, option, state);
1208 /* Default version of get_pch_validity.
1209 By default, every flag difference is fatal; that will be mostly right for
1210 most targets, but completely right for very few. */
1212 void *
1213 default_get_pch_validity (size_t *sz)
1215 struct cl_option_state state;
1216 size_t i;
1217 char *result, *r;
1219 *sz = 2;
1220 if (targetm.check_pch_target_flags)
1221 *sz += sizeof (target_flags);
1222 for (i = 0; i < cl_options_count; i++)
1223 if (option_affects_pch_p (i, &state))
1224 *sz += state.size;
1226 result = r = XNEWVEC (char, *sz);
1227 r[0] = flag_pic;
1228 r[1] = flag_pie;
1229 r += 2;
1230 if (targetm.check_pch_target_flags)
1232 memcpy (r, &target_flags, sizeof (target_flags));
1233 r += sizeof (target_flags);
1236 for (i = 0; i < cl_options_count; i++)
1237 if (option_affects_pch_p (i, &state))
1239 memcpy (r, state.data, state.size);
1240 r += state.size;
1243 return result;
1246 /* Return a message which says that a PCH file was created with a different
1247 setting of OPTION. */
1249 static const char *
1250 pch_option_mismatch (const char *option)
1252 char *r;
1254 asprintf (&r, _("created and used with differing settings of '%s'"), option);
1255 if (r == NULL)
1256 return _("out of memory");
1257 return r;
1260 /* Default version of pch_valid_p. */
1262 const char *
1263 default_pch_valid_p (const void *data_p, size_t len)
1265 struct cl_option_state state;
1266 const char *data = (const char *)data_p;
1267 size_t i;
1269 /* -fpic and -fpie also usually make a PCH invalid. */
1270 if (data[0] != flag_pic)
1271 return _("created and used with different settings of -fpic");
1272 if (data[1] != flag_pie)
1273 return _("created and used with different settings of -fpie");
1274 data += 2;
1276 /* Check target_flags. */
1277 if (targetm.check_pch_target_flags)
1279 int tf;
1280 const char *r;
1282 memcpy (&tf, data, sizeof (target_flags));
1283 data += sizeof (target_flags);
1284 len -= sizeof (target_flags);
1285 r = targetm.check_pch_target_flags (tf);
1286 if (r != NULL)
1287 return r;
1290 for (i = 0; i < cl_options_count; i++)
1291 if (option_affects_pch_p (i, &state))
1293 if (memcmp (data, state.data, state.size) != 0)
1294 return pch_option_mismatch (cl_options[i].opt_text);
1295 data += state.size;
1296 len -= state.size;
1299 return NULL;
1302 /* Default tree printer. Handles declarations only. */
1303 bool
1304 default_tree_printer (pretty_printer *pp, text_info *text, const char *spec,
1305 int precision, bool wide, bool set_locus, bool hash)
1307 tree t;
1309 /* FUTURE: %+x should set the locus. */
1310 if (precision != 0 || wide || hash)
1311 return false;
1313 switch (*spec)
1315 case 'E':
1316 t = va_arg (*text->args_ptr, tree);
1317 if (TREE_CODE (t) == IDENTIFIER_NODE)
1319 pp_identifier (pp, IDENTIFIER_POINTER (t));
1320 return true;
1322 break;
1324 case 'D':
1325 t = va_arg (*text->args_ptr, tree);
1326 if (DECL_DEBUG_EXPR_IS_FROM (t) && DECL_DEBUG_EXPR (t))
1327 t = DECL_DEBUG_EXPR (t);
1328 break;
1330 case 'F':
1331 case 'T':
1332 t = va_arg (*text->args_ptr, tree);
1333 break;
1335 case 'K':
1336 percent_K_format (text);
1337 return true;
1339 default:
1340 return false;
1343 if (set_locus && text->locus)
1344 *text->locus = DECL_SOURCE_LOCATION (t);
1346 if (DECL_P (t))
1348 const char *n = DECL_NAME (t)
1349 ? identifier_to_locale (lang_hooks.decl_printable_name (t, 2))
1350 : _("<anonymous>");
1351 pp_string (pp, n);
1353 else
1354 dump_generic_node (pp, t, 0, TDF_DIAGNOSTIC, 0);
1356 return true;
1359 /* A helper function; used as the reallocator function for cpp's line
1360 table. */
1361 static void *
1362 realloc_for_line_map (void *ptr, size_t len)
1364 return GGC_RESIZEVAR (void, ptr, len);
1367 /* A helper function: used as the allocator function for
1368 identifier_to_locale. */
1369 static void *
1370 alloc_for_identifier_to_locale (size_t len)
1372 return ggc_alloc_atomic (len);
1375 /* Output stack usage information. */
1376 void
1377 output_stack_usage (void)
1379 static bool warning_issued = false;
1380 enum stack_usage_kind_type { STATIC = 0, DYNAMIC, DYNAMIC_BOUNDED };
1381 const char *stack_usage_kind_str[] = {
1382 "static",
1383 "dynamic",
1384 "dynamic,bounded"
1386 HOST_WIDE_INT stack_usage = current_function_static_stack_size;
1387 enum stack_usage_kind_type stack_usage_kind;
1388 expanded_location loc;
1389 const char *raw_id, *id;
1391 if (stack_usage < 0)
1393 if (!warning_issued)
1395 warning (0, "-fstack-usage not supported for this target");
1396 warning_issued = true;
1398 return;
1401 stack_usage_kind = STATIC;
1403 /* Add the maximum amount of space pushed onto the stack. */
1404 if (current_function_pushed_stack_size > 0)
1406 stack_usage += current_function_pushed_stack_size;
1407 stack_usage_kind = DYNAMIC_BOUNDED;
1410 /* Now on to the tricky part: dynamic stack allocation. */
1411 if (current_function_allocates_dynamic_stack_space)
1413 if (current_function_has_unbounded_dynamic_stack_size)
1414 stack_usage_kind = DYNAMIC;
1415 else
1416 stack_usage_kind = DYNAMIC_BOUNDED;
1418 /* Add the size even in the unbounded case, this can't hurt. */
1419 stack_usage += current_function_dynamic_stack_size;
1422 loc = expand_location (DECL_SOURCE_LOCATION (current_function_decl));
1424 /* Strip the scope prefix if any. */
1425 raw_id = lang_hooks.decl_printable_name (current_function_decl, 2);
1426 id = strrchr (raw_id, '.');
1427 if (id)
1428 id++;
1429 else
1430 id = raw_id;
1432 fprintf (stack_usage_file,
1433 "%s:%d:%d:%s\t"HOST_WIDE_INT_PRINT_DEC"\t%s\n",
1434 lbasename (loc.file),
1435 loc.line,
1436 loc.column,
1438 stack_usage,
1439 stack_usage_kind_str[stack_usage_kind]);
1442 /* Open an auxiliary output file. */
1443 static FILE *
1444 open_auxiliary_file (const char *ext)
1446 char *filename;
1447 FILE *file;
1449 filename = concat (aux_base_name, ".", ext, NULL);
1450 file = fopen (filename, "w");
1451 if (!file)
1452 fatal_error ("can%'t open %s for writing: %m", filename);
1453 free (filename);
1454 return file;
1457 /* Initialization of the front end environment, before command line
1458 options are parsed. Signal handlers, internationalization etc.
1459 ARGV0 is main's argv[0]. */
1460 static void
1461 general_init (const char *argv0)
1463 const char *p;
1465 p = argv0 + strlen (argv0);
1466 while (p != argv0 && !IS_DIR_SEPARATOR (p[-1]))
1467 --p;
1468 progname = p;
1470 xmalloc_set_program_name (progname);
1472 hex_init ();
1474 /* Unlock the stdio streams. */
1475 unlock_std_streams ();
1477 gcc_init_libintl ();
1479 identifier_to_locale_alloc = alloc_for_identifier_to_locale;
1480 identifier_to_locale_free = ggc_free;
1482 /* Initialize the diagnostics reporting machinery, so option parsing
1483 can give warnings and errors. */
1484 diagnostic_initialize (global_dc, N_OPTS);
1485 diagnostic_starter (global_dc) = default_tree_diagnostic_starter;
1486 /* Set a default printer. Language specific initializations will
1487 override it later. */
1488 pp_format_decoder (global_dc->printer) = &default_tree_printer;
1489 global_dc->show_option_requested
1490 = global_options_init.x_flag_diagnostics_show_option;
1491 global_dc->show_column
1492 = global_options_init.x_flag_show_column;
1493 global_dc->internal_error = plugins_internal_error_function;
1494 global_dc->option_enabled = option_enabled;
1495 global_dc->option_state = &global_options;
1496 global_dc->option_name = option_name;
1498 /* Trap fatal signals, e.g. SIGSEGV, and convert them to ICE messages. */
1499 #ifdef SIGSEGV
1500 signal (SIGSEGV, crash_signal);
1501 #endif
1502 #ifdef SIGILL
1503 signal (SIGILL, crash_signal);
1504 #endif
1505 #ifdef SIGBUS
1506 signal (SIGBUS, crash_signal);
1507 #endif
1508 #ifdef SIGABRT
1509 signal (SIGABRT, crash_signal);
1510 #endif
1511 #if defined SIGIOT && (!defined SIGABRT || SIGABRT != SIGIOT)
1512 signal (SIGIOT, crash_signal);
1513 #endif
1514 #ifdef SIGFPE
1515 signal (SIGFPE, crash_signal);
1516 #endif
1518 /* Other host-specific signal setup. */
1519 (*host_hooks.extra_signals)();
1521 /* Initialize the garbage-collector, string pools and tree type hash
1522 table. */
1523 init_ggc ();
1524 init_stringpool ();
1525 line_table = ggc_alloc_line_maps ();
1526 linemap_init (line_table);
1527 line_table->reallocator = realloc_for_line_map;
1528 init_ttree ();
1530 /* Initialize register usage now so switches may override. */
1531 init_reg_sets ();
1533 /* Register the language-independent parameters. */
1534 add_params (lang_independent_params, LAST_PARAM);
1535 targetm.target_option.default_params ();
1537 /* This must be done after add_params but before argument processing. */
1538 init_ggc_heuristics();
1539 init_optimization_passes ();
1540 statistics_early_init ();
1541 finish_params ();
1544 /* Return true if the current target supports -fsection-anchors. */
1546 static bool
1547 target_supports_section_anchors_p (void)
1549 if (targetm.min_anchor_offset == 0 && targetm.max_anchor_offset == 0)
1550 return false;
1552 if (targetm.asm_out.output_anchor == NULL)
1553 return false;
1555 return true;
1558 /* Default the align_* variables to 1 if they're still unset, and
1559 set up the align_*_log variables. */
1560 static void
1561 init_alignments (void)
1563 if (align_loops <= 0)
1564 align_loops = 1;
1565 if (align_loops_max_skip > align_loops)
1566 align_loops_max_skip = align_loops - 1;
1567 align_loops_log = floor_log2 (align_loops * 2 - 1);
1568 if (align_jumps <= 0)
1569 align_jumps = 1;
1570 if (align_jumps_max_skip > align_jumps)
1571 align_jumps_max_skip = align_jumps - 1;
1572 align_jumps_log = floor_log2 (align_jumps * 2 - 1);
1573 if (align_labels <= 0)
1574 align_labels = 1;
1575 align_labels_log = floor_log2 (align_labels * 2 - 1);
1576 if (align_labels_max_skip > align_labels)
1577 align_labels_max_skip = align_labels - 1;
1578 if (align_functions <= 0)
1579 align_functions = 1;
1580 align_functions_log = floor_log2 (align_functions * 2 - 1);
1583 /* Process the options that have been parsed. */
1584 static void
1585 process_options (void)
1587 /* Just in case lang_hooks.post_options ends up calling a debug_hook.
1588 This can happen with incorrect pre-processed input. */
1589 debug_hooks = &do_nothing_debug_hooks;
1591 maximum_field_alignment = initial_max_fld_align * BITS_PER_UNIT;
1593 /* This replaces set_Wunused. */
1594 if (warn_unused_function == -1)
1595 warn_unused_function = warn_unused;
1596 if (warn_unused_label == -1)
1597 warn_unused_label = warn_unused;
1598 /* Wunused-parameter is enabled if both -Wunused -Wextra are enabled. */
1599 if (warn_unused_parameter == -1)
1600 warn_unused_parameter = (warn_unused && extra_warnings);
1601 if (warn_unused_variable == -1)
1602 warn_unused_variable = warn_unused;
1603 /* Wunused-but-set-parameter is enabled if both -Wunused -Wextra are
1604 enabled. */
1605 if (warn_unused_but_set_parameter == -1)
1606 warn_unused_but_set_parameter = (warn_unused && extra_warnings);
1607 if (warn_unused_but_set_variable == -1)
1608 warn_unused_but_set_variable = warn_unused;
1609 if (warn_unused_value == -1)
1610 warn_unused_value = warn_unused;
1612 /* This replaces set_Wextra. */
1613 if (warn_uninitialized == -1)
1614 warn_uninitialized = extra_warnings;
1616 /* Allow the front end to perform consistency checks and do further
1617 initialization based on the command line options. This hook also
1618 sets the original filename if appropriate (e.g. foo.i -> foo.c)
1619 so we can correctly initialize debug output. */
1620 no_backend = lang_hooks.post_options (&main_input_filename);
1622 /* Some machines may reject certain combinations of options. */
1623 targetm.target_option.override ();
1625 /* Avoid any informative notes in the second run of -fcompare-debug. */
1626 if (flag_compare_debug)
1627 diagnostic_inhibit_notes (global_dc);
1629 if (flag_section_anchors && !target_supports_section_anchors_p ())
1631 warning (OPT_fsection_anchors,
1632 "this target does not support %qs", "-fsection-anchors");
1633 flag_section_anchors = 0;
1636 if (flag_short_enums == 2)
1637 flag_short_enums = targetm.default_short_enums ();
1639 /* Set aux_base_name if not already set. */
1640 if (aux_base_name)
1642 else if (main_input_filename)
1644 char *name = xstrdup (lbasename (main_input_filename));
1646 strip_off_ending (name, strlen (name));
1647 aux_base_name = name;
1649 else
1650 aux_base_name = "gccaux";
1652 #ifndef HAVE_cloog
1653 if (flag_graphite
1654 || flag_loop_block
1655 || flag_loop_interchange
1656 || flag_loop_strip_mine
1657 || flag_graphite_identity
1658 || flag_loop_parallelize_all)
1659 sorry ("Graphite loop optimizations cannot be used");
1660 #endif
1662 /* Unrolling all loops implies that standard loop unrolling must also
1663 be done. */
1664 if (flag_unroll_all_loops)
1665 flag_unroll_loops = 1;
1667 /* web and rename-registers help when run after loop unrolling. */
1668 if (flag_web == AUTODETECT_VALUE)
1669 flag_web = flag_unroll_loops || flag_peel_loops;
1671 if (flag_rename_registers == AUTODETECT_VALUE)
1672 flag_rename_registers = flag_unroll_loops || flag_peel_loops;
1674 if (flag_non_call_exceptions)
1675 flag_asynchronous_unwind_tables = 1;
1676 if (flag_asynchronous_unwind_tables)
1677 flag_unwind_tables = 1;
1679 if (flag_value_profile_transformations)
1680 flag_profile_values = 1;
1682 /* Warn about options that are not supported on this machine. */
1683 #ifndef INSN_SCHEDULING
1684 if (flag_schedule_insns || flag_schedule_insns_after_reload)
1685 warning (0, "instruction scheduling not supported on this target machine");
1686 #endif
1687 #ifndef DELAY_SLOTS
1688 if (flag_delayed_branch)
1689 warning (0, "this target machine does not have delayed branches");
1690 #endif
1692 user_label_prefix = USER_LABEL_PREFIX;
1693 if (flag_leading_underscore != -1)
1695 /* If the default prefix is more complicated than "" or "_",
1696 issue a warning and ignore this option. */
1697 if (user_label_prefix[0] == 0 ||
1698 (user_label_prefix[0] == '_' && user_label_prefix[1] == 0))
1700 user_label_prefix = flag_leading_underscore ? "_" : "";
1702 else
1703 warning (0, "-f%sleading-underscore not supported on this target machine",
1704 flag_leading_underscore ? "" : "no-");
1707 /* If we are in verbose mode, write out the version and maybe all the
1708 option flags in use. */
1709 if (version_flag)
1711 print_version (stderr, "");
1712 if (! quiet_flag)
1713 print_switch_values (print_to_stderr);
1716 if (flag_syntax_only)
1718 write_symbols = NO_DEBUG;
1719 profile_flag = 0;
1722 if (flag_gtoggle)
1724 if (debug_info_level == DINFO_LEVEL_NONE)
1726 debug_info_level = DINFO_LEVEL_NORMAL;
1728 if (write_symbols == NO_DEBUG)
1729 write_symbols = PREFERRED_DEBUGGING_TYPE;
1731 else
1732 debug_info_level = DINFO_LEVEL_NONE;
1735 if (flag_dump_final_insns && !flag_syntax_only && !no_backend)
1737 FILE *final_output = fopen (flag_dump_final_insns, "w");
1738 if (!final_output)
1740 error ("could not open final insn dump file %qs: %m",
1741 flag_dump_final_insns);
1742 flag_dump_final_insns = NULL;
1744 else if (fclose (final_output))
1746 error ("could not close zeroed insn dump file %qs: %m",
1747 flag_dump_final_insns);
1748 flag_dump_final_insns = NULL;
1752 /* Unless over-ridden for the target, assume that all DWARF levels
1753 may be emitted, if DWARF2_DEBUG is selected. */
1754 if (dwarf_strict < 0)
1755 dwarf_strict = 0;
1757 /* A lot of code assumes write_symbols == NO_DEBUG if the debugging
1758 level is 0. */
1759 if (debug_info_level == DINFO_LEVEL_NONE)
1760 write_symbols = NO_DEBUG;
1762 if (write_symbols == NO_DEBUG)
1764 #if defined(DBX_DEBUGGING_INFO)
1765 else if (write_symbols == DBX_DEBUG)
1766 debug_hooks = &dbx_debug_hooks;
1767 #endif
1768 #if defined(XCOFF_DEBUGGING_INFO)
1769 else if (write_symbols == XCOFF_DEBUG)
1770 debug_hooks = &xcoff_debug_hooks;
1771 #endif
1772 #ifdef SDB_DEBUGGING_INFO
1773 else if (write_symbols == SDB_DEBUG)
1774 debug_hooks = &sdb_debug_hooks;
1775 #endif
1776 #ifdef DWARF2_DEBUGGING_INFO
1777 else if (write_symbols == DWARF2_DEBUG)
1778 debug_hooks = &dwarf2_debug_hooks;
1779 #endif
1780 #ifdef VMS_DEBUGGING_INFO
1781 else if (write_symbols == VMS_DEBUG || write_symbols == VMS_AND_DWARF2_DEBUG)
1782 debug_hooks = &vmsdbg_debug_hooks;
1783 #endif
1784 else
1785 error ("target system does not support the \"%s\" debug format",
1786 debug_type_names[write_symbols]);
1788 /* We know which debug output will be used so we can set flag_var_tracking
1789 and flag_var_tracking_uninit if the user has not specified them. */
1790 if (debug_info_level < DINFO_LEVEL_NORMAL
1791 || debug_hooks->var_location == do_nothing_debug_hooks.var_location)
1793 if (flag_var_tracking == 1
1794 || flag_var_tracking_uninit == 1)
1796 if (debug_info_level < DINFO_LEVEL_NORMAL)
1797 warning (0, "variable tracking requested, but useless unless "
1798 "producing debug info");
1799 else
1800 warning (0, "variable tracking requested, but not supported "
1801 "by this debug format");
1803 flag_var_tracking = 0;
1804 flag_var_tracking_uninit = 0;
1807 /* The debug hooks are used to implement -fdump-go-spec because it
1808 gives a simple and stable API for all the information we need to
1809 dump. */
1810 if (flag_dump_go_spec != NULL)
1811 debug_hooks = dump_go_spec_init (flag_dump_go_spec, debug_hooks);
1813 /* If the user specifically requested variable tracking with tagging
1814 uninitialized variables, we need to turn on variable tracking.
1815 (We already determined above that variable tracking is feasible.) */
1816 if (flag_var_tracking_uninit)
1817 flag_var_tracking = 1;
1819 if (flag_var_tracking == AUTODETECT_VALUE)
1820 flag_var_tracking = optimize >= 1;
1822 if (flag_var_tracking_assignments == AUTODETECT_VALUE)
1823 flag_var_tracking_assignments = flag_var_tracking
1824 && !(flag_selective_scheduling || flag_selective_scheduling2);
1826 if (flag_var_tracking_assignments_toggle)
1827 flag_var_tracking_assignments = !flag_var_tracking_assignments;
1829 if (flag_var_tracking_assignments && !flag_var_tracking)
1830 flag_var_tracking = flag_var_tracking_assignments = -1;
1832 if (flag_var_tracking_assignments
1833 && (flag_selective_scheduling || flag_selective_scheduling2))
1834 warning (0, "var-tracking-assignments changes selective scheduling");
1836 if (flag_tree_cselim == AUTODETECT_VALUE)
1837 #ifdef HAVE_conditional_move
1838 flag_tree_cselim = 1;
1839 #else
1840 flag_tree_cselim = 0;
1841 #endif
1843 /* If auxiliary info generation is desired, open the output file.
1844 This goes in the same directory as the source file--unlike
1845 all the other output files. */
1846 if (flag_gen_aux_info)
1848 aux_info_file = fopen (aux_info_file_name, "w");
1849 if (aux_info_file == 0)
1850 fatal_error ("can%'t open %s: %m", aux_info_file_name);
1853 if (! targetm.have_named_sections)
1855 if (flag_function_sections)
1857 warning (0, "-ffunction-sections not supported for this target");
1858 flag_function_sections = 0;
1860 if (flag_data_sections)
1862 warning (0, "-fdata-sections not supported for this target");
1863 flag_data_sections = 0;
1867 if (flag_function_sections && profile_flag)
1869 warning (0, "-ffunction-sections disabled; it makes profiling impossible");
1870 flag_function_sections = 0;
1873 #ifndef HAVE_prefetch
1874 if (flag_prefetch_loop_arrays > 0)
1876 warning (0, "-fprefetch-loop-arrays not supported for this target");
1877 flag_prefetch_loop_arrays = 0;
1879 #else
1880 if (flag_prefetch_loop_arrays > 0 && !HAVE_prefetch)
1882 warning (0, "-fprefetch-loop-arrays not supported for this target (try -march switches)");
1883 flag_prefetch_loop_arrays = 0;
1885 #endif
1887 /* This combination of options isn't handled for i386 targets and doesn't
1888 make much sense anyway, so don't allow it. */
1889 if (flag_prefetch_loop_arrays > 0 && optimize_size)
1891 warning (0, "-fprefetch-loop-arrays is not supported with -Os");
1892 flag_prefetch_loop_arrays = 0;
1895 /* The presence of IEEE signaling NaNs, implies all math can trap. */
1896 if (flag_signaling_nans)
1897 flag_trapping_math = 1;
1899 /* We cannot reassociate if we want traps or signed zeros. */
1900 if (flag_associative_math && (flag_trapping_math || flag_signed_zeros))
1902 warning (0, "-fassociative-math disabled; other options take precedence");
1903 flag_associative_math = 0;
1906 /* With -fcx-limited-range, we do cheap and quick complex arithmetic. */
1907 if (flag_cx_limited_range)
1908 flag_complex_method = 0;
1910 /* With -fcx-fortran-rules, we do something in-between cheap and C99. */
1911 if (flag_cx_fortran_rules)
1912 flag_complex_method = 1;
1914 /* Targets must be able to place spill slots at lower addresses. If the
1915 target already uses a soft frame pointer, the transition is trivial. */
1916 if (!FRAME_GROWS_DOWNWARD && flag_stack_protect)
1918 warning (0, "-fstack-protector not supported for this target");
1919 flag_stack_protect = 0;
1921 if (!flag_stack_protect)
1922 warn_stack_protect = 0;
1924 /* ??? Unwind info is not correct around the CFG unless either a frame
1925 pointer is present or A_O_A is set. Fixing this requires rewriting
1926 unwind info generation to be aware of the CFG and propagating states
1927 around edges. */
1928 if (flag_unwind_tables && !ACCUMULATE_OUTGOING_ARGS
1929 && flag_omit_frame_pointer)
1931 warning (0, "unwind tables currently require a frame pointer "
1932 "for correctness");
1933 flag_omit_frame_pointer = 0;
1936 /* Save the current optimization options. */
1937 optimization_default_node = build_optimization_node ();
1938 optimization_current_node = optimization_default_node;
1941 /* This function can be called multiple times to reinitialize the compiler
1942 back end when register classes or instruction sets have changed,
1943 before each function. */
1944 static void
1945 backend_init_target (void)
1947 /* Initialize alignment variables. */
1948 init_alignments ();
1950 /* This reinitializes hard_frame_pointer, and calls init_reg_modes_target()
1951 to initialize reg_raw_mode[]. */
1952 init_emit_regs ();
1954 /* This invokes target hooks to set fixed_reg[] etc, which is
1955 mode-dependent. */
1956 init_regs ();
1958 /* This depends on stack_pointer_rtx. */
1959 init_fake_stack_mems ();
1961 /* Sets static_base_value[HARD_FRAME_POINTER_REGNUM], which is
1962 mode-dependent. */
1963 init_alias_target ();
1965 /* Depends on HARD_FRAME_POINTER_REGNUM. */
1966 init_reload ();
1968 /* The following initialization functions need to generate rtl, so
1969 provide a dummy function context for them. */
1970 init_dummy_function_start ();
1972 /* rtx_cost is mode-dependent, so cached values need to be recomputed
1973 on a mode change. */
1974 init_expmed ();
1976 /* We may need to recompute regno_save_code[] and regno_restore_code[]
1977 after a mode change as well. */
1978 caller_save_initialized_p = false;
1980 expand_dummy_function_end ();
1983 /* Initialize the compiler back end. This function is called only once,
1984 when starting the compiler. */
1985 static void
1986 backend_init (void)
1988 init_emit_once ();
1990 init_rtlanal ();
1991 init_inline_once ();
1992 init_varasm_once ();
1993 save_register_info ();
1995 /* Initialize the target-specific back end pieces. */
1996 ira_init_once ();
1997 backend_init_target ();
2000 /* Initialize excess precision settings. */
2001 static void
2002 init_excess_precision (void)
2004 /* Adjust excess precision handling based on the target options. If
2005 the front end cannot handle it, flag_excess_precision_cmdline
2006 will already have been set accordingly in the post_options
2007 hook. */
2008 gcc_assert (flag_excess_precision_cmdline != EXCESS_PRECISION_DEFAULT);
2009 flag_excess_precision = flag_excess_precision_cmdline;
2010 if (flag_unsafe_math_optimizations)
2011 flag_excess_precision = EXCESS_PRECISION_FAST;
2012 if (flag_excess_precision == EXCESS_PRECISION_STANDARD)
2014 int flt_eval_method = TARGET_FLT_EVAL_METHOD;
2015 switch (flt_eval_method)
2017 case -1:
2018 case 0:
2019 /* Either the target acts unpredictably (-1) or has all the
2020 operations required not to have excess precision (0). */
2021 flag_excess_precision = EXCESS_PRECISION_FAST;
2022 break;
2023 case 1:
2024 case 2:
2025 /* In these cases, predictable excess precision makes
2026 sense. */
2027 break;
2028 default:
2029 /* Any other implementation-defined FLT_EVAL_METHOD values
2030 require the compiler to handle the associated excess
2031 precision rules in excess_precision_type. */
2032 gcc_unreachable ();
2037 /* Initialize things that are both lang-dependent and target-dependent.
2038 This function can be called more than once if target parameters change. */
2039 static void
2040 lang_dependent_init_target (void)
2042 /* This determines excess precision settings. */
2043 init_excess_precision ();
2045 /* This creates various _DECL nodes, so needs to be called after the
2046 front end is initialized. It also depends on the HAVE_xxx macros
2047 generated from the target machine description. */
2048 init_optabs ();
2050 /* The following initialization functions need to generate rtl, so
2051 provide a dummy function context for them. */
2052 init_dummy_function_start ();
2054 /* Do the target-specific parts of expr initialization. */
2055 init_expr_target ();
2057 /* Although the actions of these functions are language-independent,
2058 they use optabs, so we cannot call them from backend_init. */
2059 init_set_costs ();
2060 ira_init ();
2062 expand_dummy_function_end ();
2065 /* Language-dependent initialization. Returns nonzero on success. */
2066 static int
2067 lang_dependent_init (const char *name)
2069 location_t save_loc = input_location;
2070 if (dump_base_name == 0)
2071 dump_base_name = name && name[0] ? name : "gccdump";
2073 /* Other front-end initialization. */
2074 input_location = BUILTINS_LOCATION;
2075 if (lang_hooks.init () == 0)
2076 return 0;
2077 input_location = save_loc;
2079 init_asm_output (name);
2081 /* If stack usage information is desired, open the output file. */
2082 if (flag_stack_usage)
2083 stack_usage_file = open_auxiliary_file ("su");
2085 /* This creates various _DECL nodes, so needs to be called after the
2086 front end is initialized. */
2087 init_eh ();
2089 /* Do the target-specific parts of the initialization. */
2090 lang_dependent_init_target ();
2092 /* If dbx symbol table desired, initialize writing it and output the
2093 predefined types. */
2094 timevar_push (TV_SYMOUT);
2096 #if defined DWARF2_DEBUGGING_INFO || defined DWARF2_UNWIND_INFO
2097 if (dwarf2out_do_frame ())
2098 dwarf2out_frame_init ();
2099 #endif
2101 /* Now we have the correct original filename, we can initialize
2102 debug output. */
2103 (*debug_hooks->init) (name);
2105 timevar_pop (TV_SYMOUT);
2107 return 1;
2111 /* Reinitialize everything when target parameters, such as register usage,
2112 have changed. */
2113 void
2114 target_reinit (void)
2116 /* Reinitialize RTL backend. */
2117 backend_init_target ();
2119 /* Reinitialize lang-dependent parts. */
2120 lang_dependent_init_target ();
2123 void
2124 dump_memory_report (bool final)
2126 ggc_print_statistics ();
2127 stringpool_statistics ();
2128 dump_tree_statistics ();
2129 dump_gimple_statistics ();
2130 dump_rtx_statistics ();
2131 dump_alloc_pool_statistics ();
2132 dump_bitmap_statistics ();
2133 dump_vec_loc_statistics ();
2134 dump_ggc_loc_statistics (final);
2135 dump_alias_stats (stderr);
2136 dump_pta_stats (stderr);
2139 /* Clean up: close opened files, etc. */
2141 static void
2142 finalize (bool no_backend)
2144 /* Close the dump files. */
2145 if (flag_gen_aux_info)
2147 fclose (aux_info_file);
2148 if (seen_error ())
2149 unlink (aux_info_file_name);
2152 /* Close non-debugging input and output files. Take special care to note
2153 whether fclose returns an error, since the pages might still be on the
2154 buffer chain while the file is open. */
2156 if (asm_out_file)
2158 if (ferror (asm_out_file) != 0)
2159 fatal_error ("error writing to %s: %m", asm_file_name);
2160 if (fclose (asm_out_file) != 0)
2161 fatal_error ("error closing %s: %m", asm_file_name);
2162 if (flag_wpa)
2163 unlink_if_ordinary (asm_file_name);
2166 if (stack_usage_file)
2167 fclose (stack_usage_file);
2169 if (!no_backend)
2171 statistics_fini ();
2173 finish_optimization_passes ();
2175 ira_finish_once ();
2178 if (mem_report)
2179 dump_memory_report (true);
2181 /* Language-specific end of compilation actions. */
2182 lang_hooks.finish ();
2185 /* Initialize the compiler, and compile the input file. */
2186 static void
2187 do_compile (void)
2189 /* Initialize timing first. The C front ends read the main file in
2190 the post_options hook, and C++ does file timings. */
2191 if (time_report || !quiet_flag || flag_detailed_statistics)
2192 timevar_init ();
2193 timevar_start (TV_TOTAL);
2195 process_options ();
2197 /* Don't do any more if an error has already occurred. */
2198 if (!seen_error ())
2200 /* This must be run always, because it is needed to compute the FP
2201 predefined macros, such as __LDBL_MAX__, for targets using non
2202 default FP formats. */
2203 init_adjust_machine_modes ();
2205 /* Set up the back-end if requested. */
2206 if (!no_backend)
2207 backend_init ();
2209 /* Language-dependent initialization. Returns true on success. */
2210 if (lang_dependent_init (main_input_filename))
2211 compile_file ();
2213 finalize (no_backend);
2216 /* Stop timing and print the times. */
2217 timevar_stop (TV_TOTAL);
2218 timevar_print (stderr);
2221 /* Entry point of cc1, cc1plus, jc1, f771, etc.
2222 Exit code is FATAL_EXIT_CODE if can't open files or if there were
2223 any errors, or SUCCESS_EXIT_CODE if compilation succeeded.
2225 It is not safe to call this function more than once. */
2228 toplev_main (int argc, char **argv)
2230 expandargv (&argc, &argv);
2232 /* Initialization of GCC's environment, and diagnostics. */
2233 general_init (argv[0]);
2235 /* One-off initialization of options that does not need to be
2236 repeated when options are added for particular functions. */
2237 init_options_once ();
2239 /* Initialize global options structures; this must be repeated for
2240 each structure used for parsing options. */
2241 init_options_struct (&global_options, &global_options_set);
2242 lang_hooks.init_options_struct (&global_options);
2244 /* Convert the options to an array. */
2245 decode_cmdline_options_to_array_default_mask (argc,
2246 CONST_CAST2 (const char **,
2247 char **, argv),
2248 &save_decoded_options,
2249 &save_decoded_options_count);
2251 /* Perform language-specific options initialization. */
2252 lang_hooks.init_options (save_decoded_options_count, save_decoded_options);
2254 /* Parse the options and do minimal processing; basically just
2255 enough to default flags appropriately. */
2256 decode_options (&global_options, &global_options_set,
2257 save_decoded_options, save_decoded_options_count,
2258 UNKNOWN_LOCATION, global_dc);
2260 handle_common_deferred_options ();
2262 init_local_tick ();
2264 initialize_plugins ();
2266 if (version_flag)
2267 print_version (stderr, "");
2269 if (help_flag)
2270 print_plugins_help (stderr, "");
2272 /* Exit early if we can (e.g. -help). */
2273 if (!exit_after_options)
2274 do_compile ();
2276 if (warningcount || errorcount)
2277 print_ignored_options ();
2278 diagnostic_finish (global_dc);
2280 /* Invoke registered plugin callbacks if any. */
2281 invoke_plugin_callbacks (PLUGIN_FINISH, NULL);
2283 finalize_plugins ();
2284 if (seen_error ())
2285 return (FATAL_EXIT_CODE);
2287 return (SUCCESS_EXIT_CODE);