toplev.h revision 132718
1244769Sglebius/* toplev.h - Various declarations for functions found in toplev.c
2126258Smlaier   Copyright (C) 1998, 1999, 2000, 2001, 2003, 2004
3244769Sglebius   Free Software Foundation, Inc.
4126258Smlaier
5126258SmlaierThis file is part of GCC.
6126258Smlaier
7126258SmlaierGCC is free software; you can redistribute it and/or modify it under
8126258Smlaierthe terms of the GNU General Public License as published by the Free
9126258SmlaierSoftware Foundation; either version 2, or (at your option) any later
10126258Smlaierversion.
11126258Smlaier
12126258SmlaierGCC is distributed in the hope that it will be useful, but WITHOUT ANY
13126258SmlaierWARRANTY; without even the implied warranty of MERCHANTABILITY or
14126258SmlaierFITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15126258Smlaierfor more details.
16126258Smlaier
17126258SmlaierYou should have received a copy of the GNU General Public License
18126258Smlaieralong with GCC; see the file COPYING.  If not, write to the Free
19126258SmlaierSoftware Foundation, 59 Temple Place - Suite 330, Boston, MA
20126258Smlaier02111-1307, USA.  */
21126258Smlaier
22126258Smlaier#ifndef GCC_TOPLEV_H
23126258Smlaier#define GCC_TOPLEV_H
24126258Smlaier
25126258Smlaier/* If non-NULL, return one past-the-end of the matching SUBPART of
26126258Smlaier   the WHOLE string.  */
27126258Smlaier#define skip_leading_substring(whole,  part) \
28244769Sglebius   (strncmp (whole, part, strlen (part)) ? NULL : whole + strlen (part))
29223637Sbz
30223637Sbzextern int toplev_main (unsigned int, const char **);
31223637Sbzextern int read_integral_parameter (const char *, const char *, const int);
32223637Sbzextern void strip_off_ending (char *, int);
33223637Sbzextern const char *trim_filename (const char *);
34223637Sbzextern void _fatal_insn_not_found (rtx, const char *, int, const char *)
35223637Sbz     ATTRIBUTE_NORETURN;
36223637Sbzextern void _fatal_insn (const char *, rtx, const char *, int, const char *)
37223637Sbz     ATTRIBUTE_NORETURN;
38223637Sbz
39223637Sbz#define fatal_insn(msgid, insn) \
40223637Sbz	_fatal_insn (msgid, insn, __FILE__, __LINE__, __FUNCTION__)
41223637Sbz#define fatal_insn_not_found(insn) \
42223637Sbz	_fatal_insn_not_found (insn, __FILE__, __LINE__, __FUNCTION__)
43223637Sbz
44228814Sglebius/* If we haven't already defined a frontend specific diagnostics
45244769Sglebius   style, use the generic one.  */
46244769Sglebius#ifndef GCC_DIAG_STYLE
47228814Sglebius#define GCC_DIAG_STYLE __gcc_diag__
48244185Sglebius#endif
49228814Sglebius/* None of these functions are suitable for ATTRIBUTE_PRINTF, because
50228815Sglebius   each language front end can extend them with its own set of format
51228816Sglebius   specifiers.  We must use custom format checks.  */
52244113Sglebius#if GCC_VERSION >= 3004
53229961Sglebius#define ATTRIBUTE_GCC_DIAG(m, n) __attribute__ ((__format__ (GCC_DIAG_STYLE, m, n))) ATTRIBUTE_NONNULL(m)
54232685Sglebius#else
55229777Sglebius#define ATTRIBUTE_GCC_DIAG(m, n) ATTRIBUTE_NONNULL(m)
56233846Sglebius#endif
57233874Sglebiusextern void internal_error (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2)
58228814Sglebius     ATTRIBUTE_NORETURN;
59228814Sglebiusextern void warning (const char *, ...);
60240233Sglebiusextern void error (const char *, ...);
61240233Sglebiusextern void fatal_error (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2)
62240233Sglebius     ATTRIBUTE_NORETURN;
63126261Smlaierextern void pedwarn (const char *, ...);
64126261Smlaierextern void sorry (const char *, ...);
65126261Smlaierextern void inform (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2);
66153110Sru
67126258Smlaierextern void rest_of_decl_compilation (tree, const char *, int, int);
68223637Sbzextern void rest_of_type_compilation (tree, int);
69240233Sglebiusextern void rest_of_compilation (tree);
70223637Sbzextern void tree_rest_of_compilation (tree, bool);
71240233Sglebius
72240233Sglebiusextern void announce_function (tree);
73126258Smlaier
74129907Smlaierextern void error_for_asm (rtx, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
75130613Smlaierextern void warning_for_asm (rtx, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
76240233Sglebiusextern void warn_deprecated_use (tree);
77229850Sglebius
78240233Sglebius#ifdef BUFSIZ
79240233Sglebiusextern void output_quoted_string	(FILE *, const char *);
80223637Sbzextern void output_file_directive	(FILE *, const char *);
81126258Smlaier#endif
82240233Sglebius
83126258Smlaier#ifdef BUFSIZ
84130933Sbrooks  /* N.B. Unlike all the others, fnotice is just gettext+fprintf, and
85126258Smlaier     therefore it can have ATTRIBUTE_PRINTF.  */
86240233Sglebiusextern void fnotice			(FILE *, const char *, ...)
87240233Sglebius     ATTRIBUTE_PRINTF_2;
88223637Sbz#endif
89240233Sglebius
90171168Smlaierextern int wrapup_global_declarations (tree *, int);
91126258Smlaierextern void check_global_declarations (tree *, int);
92130613Smlaierextern void write_global_declarations (void);
93240233Sglebius
94130613Smlaier/* A unique local time stamp, might be zero if none is available.  */
95240233Sglebiusextern unsigned local_tick;
96240233Sglebius
97240233Sglebiusextern const char *progname;
98126258Smlaierextern const char *dump_base_name;
99223637Sbzextern const char *aux_base_name;
100223637Sbzextern const char *aux_info_file_name;
101223637Sbzextern const char *asm_file_name;
102246822Sglebiusextern bool exit_after_options;
103126258Smlaierextern bool version_flag;
104223637Sbz
105223637Sbzextern int target_flags_explicit;
106223637Sbz
107223637Sbz/* See toplev.c.  */
108223637Sbzextern int flag_loop_optimize;
109223637Sbzextern int flag_crossjumping;
110240233Sglebiusextern int flag_if_conversion;
111240233Sglebiusextern int flag_if_conversion2;
112240233Sglebiusextern int flag_delete_null_pointer_checks;
113240233Sglebiusextern int flag_keep_static_consts;
114240233Sglebiusextern int flag_peel_loops;
115240233Sglebiusextern int flag_rerun_cse_after_loop;
116240233Sglebiusextern int flag_thread_jumps;
117240233Sglebiusextern int flag_tracer;
118240233Sglebiusextern int flag_unroll_loops;
119240233Sglebiusextern int flag_unroll_all_loops;
120240233Sglebiusextern int flag_unswitch_loops;
121240233Sglebiusextern int flag_cprop_registers;
122240233Sglebiusextern int time_report;
123240233Sglebiusextern int flag_new_regalloc;
124223637Sbz
125240233Sglebius/* Things to do with target switches.  */
126223637Sbzextern void display_target_options (void);
127223637Sbzextern void print_version (FILE *, const char *);
128223637Sbzextern void set_target_switch (const char *);
129223637Sbzextern void * default_get_pch_validity (size_t *);
130223637Sbzextern const char * default_pch_valid_p (const void *, size_t);
131223637Sbz
132223637Sbz/* The hashtable, so that the C front ends can pass it to cpplib.  */
133223637Sbzextern struct ht *ident_hash;
134223637Sbz
135223637Sbz/* This function can be used by targets to set the flags originally
136223637Sbz    implied by -ffast-math and -fno-fast-math.  */
137223637Sbz
138223637Sbzextern void set_fast_math_flags         (int);
139223637Sbz
140223637Sbz/* Handle -d switch.  */
141223637Sbzextern void decode_d_option		(const char *);
142241056Sglebius
143223637Sbz/* Return true iff flags are set as if -ffast-math.  */
144223637Sbzextern bool fast_math_flags_set_p	(void);
145223637Sbz
146223637Sbz/* The following functions accept a wide integer argument.  Rather
147223637Sbz   than having to cast on every function call, we use a macro instead.  */
148241056Sglebius
149241056Sglebius#ifndef exact_log2
150241056Sglebius#define exact_log2(N) exact_log2_wide ((unsigned HOST_WIDE_INT) (N))
151241056Sglebius#define floor_log2(N) floor_log2_wide ((unsigned HOST_WIDE_INT) (N))
152223637Sbz#endif
153240233Sglebiusextern int exact_log2_wide             (unsigned HOST_WIDE_INT);
154223637Sbzextern int floor_log2_wide             (unsigned HOST_WIDE_INT);
155223637Sbz
156223637Sbz/* Functions used to get and set GCC's notion of in what directory
157223637Sbz   compilation was started.  */
158223637Sbz
159223637Sbzextern const char *get_src_pwd	       (void);
160223637Sbzextern bool set_src_pwd		       (const char *);
161240233Sglebius
162240233Sglebius#endif /* ! GCC_TOPLEV_H */
163223637Sbz