* diagnostic.c (warning): Accept parameter to classify warning option.
[official-gcc.git] / gcc / toplev.h
blobcf11d29441b3a1d2cb0d3362e489ceb3662c6b36
1 /* toplev.h - Various declarations for functions found in toplev.c
2 Copyright (C) 1998, 1999, 2000, 2001, 2003, 2004, 2005
3 Free Software Foundation, Inc.
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 2, or (at your option) any later
10 version.
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING. If not, write to the Free
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
20 02111-1307, USA. */
22 #ifndef GCC_TOPLEV_H
23 #define GCC_TOPLEV_H
25 /* If non-NULL, return one past-the-end of the matching SUBPART of
26 the WHOLE string. */
27 #define skip_leading_substring(whole, part) \
28 (strncmp (whole, part, strlen (part)) ? NULL : whole + strlen (part))
30 extern int toplev_main (unsigned int, const char **);
31 extern int read_integral_parameter (const char *, const char *, const int);
32 extern void strip_off_ending (char *, int);
33 extern const char *trim_filename (const char *);
34 extern void _fatal_insn_not_found (rtx, const char *, int, const char *)
35 ATTRIBUTE_NORETURN;
36 extern void _fatal_insn (const char *, rtx, const char *, int, const char *)
37 ATTRIBUTE_NORETURN;
39 #define fatal_insn(msgid, insn) \
40 _fatal_insn (msgid, insn, __FILE__, __LINE__, __FUNCTION__)
41 #define fatal_insn_not_found(insn) \
42 _fatal_insn_not_found (insn, __FILE__, __LINE__, __FUNCTION__)
44 /* If we haven't already defined a frontend specific diagnostics
45 style, use the generic one. */
46 #ifndef GCC_DIAG_STYLE
47 #define GCC_DIAG_STYLE __gcc_diag__
48 #define NO_FRONT_END_DIAG
49 #endif
50 /* None of these functions are suitable for ATTRIBUTE_PRINTF, because
51 each language front end can extend them with its own set of format
52 specifiers. We must use custom format checks. Note that at present
53 the front-end %D specifier is used in non-front-end code with some
54 functions, and those formats can only be checked in front-end code. */
55 #if GCC_VERSION >= 3005
56 #define ATTRIBUTE_GCC_DIAG(m, n) __attribute__ ((__format__ (GCC_DIAG_STYLE, m, n))) ATTRIBUTE_NONNULL(m)
57 #ifdef NO_FRONT_END_DIAG
58 #define ATTRIBUTE_GCC_FE_DIAG(m, n) ATTRIBUTE_NONNULL(m)
59 #else
60 #define ATTRIBUTE_GCC_FE_DIAG(m, n) __attribute__ ((__format__ (GCC_DIAG_STYLE, m, n))) ATTRIBUTE_NONNULL(m)
61 #endif
62 #else
63 #define ATTRIBUTE_GCC_DIAG(m, n) ATTRIBUTE_NONNULL(m)
64 #define ATTRIBUTE_GCC_FE_DIAG(m, n) ATTRIBUTE_NONNULL(m)
65 #endif
66 extern void internal_error (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2)
67 ATTRIBUTE_NORETURN;
68 extern void warning0 (const char *, ...) ATTRIBUTE_GCC_FE_DIAG(1,2);
69 extern void warning (int, const char *, ...) ATTRIBUTE_GCC_FE_DIAG(2,3);
70 extern void error (const char *, ...) ATTRIBUTE_GCC_FE_DIAG(1,2);
71 extern void fatal_error (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2)
72 ATTRIBUTE_NORETURN;
73 extern void pedwarn (const char *, ...) ATTRIBUTE_GCC_FE_DIAG(1,2);
74 extern void sorry (const char *, ...) ATTRIBUTE_GCC_FE_DIAG(1,2);
75 extern void inform (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2);
77 extern void rest_of_decl_compilation (tree, int, int);
78 extern void rest_of_type_compilation (tree, int);
79 extern void tree_rest_of_compilation (tree);
80 extern void init_tree_optimization_passes (void);
81 extern void finish_optimization_passes (void);
82 extern bool enable_rtl_dump_file (int);
84 extern void announce_function (tree);
86 extern void error_for_asm (rtx, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
87 extern void warning_for_asm (rtx, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
88 extern void warn_deprecated_use (tree);
90 #ifdef BUFSIZ
91 extern void output_quoted_string (FILE *, const char *);
92 extern void output_file_directive (FILE *, const char *);
93 #endif
95 #ifdef BUFSIZ
96 /* N.B. Unlike all the others, fnotice is just gettext+fprintf, and
97 therefore it can have ATTRIBUTE_PRINTF. */
98 extern void fnotice (FILE *, const char *, ...)
99 ATTRIBUTE_PRINTF_2;
100 #endif
102 extern int wrapup_global_declarations (tree *, int);
103 extern void check_global_declarations (tree *, int);
104 extern void write_global_declarations (void);
106 /* A unique local time stamp, might be zero if none is available. */
107 extern unsigned local_tick;
109 extern const char *progname;
110 extern const char *dump_base_name;
111 extern const char *aux_base_name;
112 extern const char *aux_info_file_name;
113 extern const char *asm_file_name;
114 extern bool exit_after_options;
116 extern int target_flags_explicit;
118 /* True if the user has tagged the function with the 'section'
119 attribute. */
121 extern bool user_defined_section_attribute;
123 /* See toplev.c. */
124 extern int flag_loop_optimize;
125 extern int flag_crossjumping;
126 extern int flag_if_conversion;
127 extern int flag_if_conversion2;
128 extern int flag_keep_static_consts;
129 extern int flag_peel_loops;
130 extern int flag_rerun_cse_after_loop;
131 extern int flag_thread_jumps;
132 extern int flag_tracer;
133 extern int flag_unroll_loops;
134 extern int flag_unroll_all_loops;
135 extern int flag_unswitch_loops;
136 extern int flag_cprop_registers;
137 extern int time_report;
138 extern int flag_tree_based_profiling;
140 /* Things to do with target switches. */
141 extern void display_target_options (void);
142 extern void print_version (FILE *, const char *);
143 extern void set_target_switch (const char *);
144 extern void * default_get_pch_validity (size_t *);
145 extern const char * default_pch_valid_p (const void *, size_t);
147 /* The hashtable, so that the C front ends can pass it to cpplib. */
148 extern struct ht *ident_hash;
150 /* This function can be used by targets to set the flags originally
151 implied by -ffast-math and -fno-fast-math. */
153 extern void set_fast_math_flags (int);
155 /* Handle -d switch. */
156 extern void decode_d_option (const char *);
158 /* Return true iff flags are set as if -ffast-math. */
159 extern bool fast_math_flags_set_p (void);
161 /* Return log2, or -1 if not exact. */
162 extern int exact_log2 (unsigned HOST_WIDE_INT);
164 /* Return floor of log2, with -1 for zero. */
165 extern int floor_log2 (unsigned HOST_WIDE_INT);
167 /* Inline versions of the above for speed. */
168 #if GCC_VERSION >= 3004
169 # if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
170 # define CLZ_HWI __builtin_clzl
171 # define CTZ_HWI __builtin_ctzl
172 # elif HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONGLONG
173 # define CLZ_HWI __builtin_clzll
174 # define CTZ_HWI __builtin_ctzll
175 # else
176 # define CLZ_HWI __builtin_clz
177 # define CTZ_HWI __builtin_ctz
178 # endif
180 extern inline int
181 floor_log2 (unsigned HOST_WIDE_INT x)
183 return x ? HOST_BITS_PER_WIDE_INT - 1 - (int) CLZ_HWI (x) : -1;
186 extern inline int
187 exact_log2 (unsigned HOST_WIDE_INT x)
189 return x == (x & -x) && x ? (int) CTZ_HWI (x) : -1;
191 #endif /* GCC_VERSION >= 3004 */
193 /* Functions used to get and set GCC's notion of in what directory
194 compilation was started. */
196 extern const char *get_src_pwd (void);
197 extern bool set_src_pwd (const char *);
199 #endif /* ! GCC_TOPLEV_H */