toplev.h revision 132718
1240116Smarcel/* toplev.h - Various declarations for functions found in toplev.c 2240116Smarcel Copyright (C) 1998, 1999, 2000, 2001, 2003, 2004 3240116Smarcel Free Software Foundation, Inc. 4240116Smarcel 5240116SmarcelThis file is part of GCC. 6240116Smarcel 7240116SmarcelGCC is free software; you can redistribute it and/or modify it under 8240116Smarcelthe terms of the GNU General Public License as published by the Free 9240116SmarcelSoftware Foundation; either version 2, or (at your option) any later 10240116Smarcelversion. 11240116Smarcel 12240116SmarcelGCC is distributed in the hope that it will be useful, but WITHOUT ANY 13240116SmarcelWARRANTY; without even the implied warranty of MERCHANTABILITY or 14240116SmarcelFITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15240116Smarcelfor more details. 16240116Smarcel 17240116SmarcelYou should have received a copy of the GNU General Public License 18240116Smarcelalong with GCC; see the file COPYING. If not, write to the Free 19240116SmarcelSoftware Foundation, 59 Temple Place - Suite 330, Boston, MA 20240116Smarcel02111-1307, USA. */ 21240116Smarcel 22240116Smarcel#ifndef GCC_TOPLEV_H 23240116Smarcel#define GCC_TOPLEV_H 24240116Smarcel 25240116Smarcel/* If non-NULL, return one past-the-end of the matching SUBPART of 26240116Smarcel the WHOLE string. */ 27240116Smarcel#define skip_leading_substring(whole, part) \ 28240116Smarcel (strncmp (whole, part, strlen (part)) ? NULL : whole + strlen (part)) 29240116Smarcel 30240116Smarcelextern int toplev_main (unsigned int, const char **); 31240116Smarcelextern int read_integral_parameter (const char *, const char *, const int); 32240116Smarcelextern void strip_off_ending (char *, int); 33240116Smarcelextern const char *trim_filename (const char *); 34240116Smarcelextern void _fatal_insn_not_found (rtx, const char *, int, const char *) 35240116Smarcel ATTRIBUTE_NORETURN; 36240116Smarcelextern void _fatal_insn (const char *, rtx, const char *, int, const char *) 37240116Smarcel ATTRIBUTE_NORETURN; 38240116Smarcel 39240116Smarcel#define fatal_insn(msgid, insn) \ 40240116Smarcel _fatal_insn (msgid, insn, __FILE__, __LINE__, __FUNCTION__) 41240116Smarcel#define fatal_insn_not_found(insn) \ 42240116Smarcel _fatal_insn_not_found (insn, __FILE__, __LINE__, __FUNCTION__) 43240116Smarcel 44240116Smarcel/* If we haven't already defined a frontend specific diagnostics 45240116Smarcel style, use the generic one. */ 46240116Smarcel#ifndef GCC_DIAG_STYLE 47240116Smarcel#define GCC_DIAG_STYLE __gcc_diag__ 48240116Smarcel#endif 49240116Smarcel/* None of these functions are suitable for ATTRIBUTE_PRINTF, because 50240116Smarcel each language front end can extend them with its own set of format 51240116Smarcel specifiers. We must use custom format checks. */ 52240116Smarcel#if GCC_VERSION >= 3004 53240116Smarcel#define ATTRIBUTE_GCC_DIAG(m, n) __attribute__ ((__format__ (GCC_DIAG_STYLE, m, n))) ATTRIBUTE_NONNULL(m) 54240116Smarcel#else 55240116Smarcel#define ATTRIBUTE_GCC_DIAG(m, n) ATTRIBUTE_NONNULL(m) 56240116Smarcel#endif 57240116Smarcelextern void internal_error (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2) 58240116Smarcel ATTRIBUTE_NORETURN; 59240116Smarcelextern void warning (const char *, ...); 60240116Smarcelextern void error (const char *, ...); 61240116Smarcelextern void fatal_error (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2) 62240116Smarcel ATTRIBUTE_NORETURN; 63240116Smarcelextern void pedwarn (const char *, ...); 64240116Smarcelextern void sorry (const char *, ...); 65240116Smarcelextern void inform (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2); 66240116Smarcel 67240116Smarcelextern void rest_of_decl_compilation (tree, const char *, int, int); 68240116Smarcelextern void rest_of_type_compilation (tree, int); 69240116Smarcelextern void rest_of_compilation (tree); 70240116Smarcelextern void tree_rest_of_compilation (tree, bool); 71240116Smarcel 72240116Smarcelextern void announce_function (tree); 73240116Smarcel 74240116Smarcelextern void error_for_asm (rtx, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3); 75240116Smarcelextern void warning_for_asm (rtx, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3); 76240116Smarcelextern void warn_deprecated_use (tree); 77240116Smarcel 78240116Smarcel#ifdef BUFSIZ 79240116Smarcelextern void output_quoted_string (FILE *, const char *); 80240116Smarcelextern void output_file_directive (FILE *, const char *); 81240116Smarcel#endif 82240116Smarcel 83240116Smarcel#ifdef BUFSIZ 84240116Smarcel /* N.B. Unlike all the others, fnotice is just gettext+fprintf, and 85240116Smarcel therefore it can have ATTRIBUTE_PRINTF. */ 86240116Smarcelextern void fnotice (FILE *, const char *, ...) 87240116Smarcel ATTRIBUTE_PRINTF_2; 88240116Smarcel#endif 89240116Smarcel 90240116Smarcelextern int wrapup_global_declarations (tree *, int); 91240116Smarcelextern void check_global_declarations (tree *, int); 92240116Smarcelextern void write_global_declarations (void); 93240116Smarcel 94240116Smarcel/* A unique local time stamp, might be zero if none is available. */ 95240116Smarcelextern unsigned local_tick; 96240116Smarcel 97240116Smarcelextern const char *progname; 98240116Smarcelextern const char *dump_base_name; 99240116Smarcelextern const char *aux_base_name; 100240116Smarcelextern const char *aux_info_file_name; 101240116Smarcelextern const char *asm_file_name; 102240116Smarcelextern bool exit_after_options; 103240116Smarcelextern bool version_flag; 104240116Smarcel 105240116Smarcelextern int target_flags_explicit; 106240116Smarcel 107240116Smarcel/* See toplev.c. */ 108240116Smarcelextern int flag_loop_optimize; 109240116Smarcelextern int flag_crossjumping; 110240116Smarcelextern int flag_if_conversion; 111240116Smarcelextern int flag_if_conversion2; 112240116Smarcelextern int flag_delete_null_pointer_checks; 113240116Smarcelextern int flag_keep_static_consts; 114240116Smarcelextern int flag_peel_loops; 115240116Smarcelextern int flag_rerun_cse_after_loop; 116240116Smarcelextern int flag_thread_jumps; 117240116Smarcelextern int flag_tracer; 118240116Smarcelextern int flag_unroll_loops; 119240116Smarcelextern int flag_unroll_all_loops; 120240116Smarcelextern int flag_unswitch_loops; 121240116Smarcelextern int flag_cprop_registers; 122240116Smarcelextern int time_report; 123240116Smarcelextern int flag_new_regalloc; 124240116Smarcel 125240116Smarcel/* Things to do with target switches. */ 126240116Smarcelextern void display_target_options (void); 127240116Smarcelextern void print_version (FILE *, const char *); 128240116Smarcelextern void set_target_switch (const char *); 129240116Smarcelextern void * default_get_pch_validity (size_t *); 130240116Smarcelextern const char * default_pch_valid_p (const void *, size_t); 131240116Smarcel 132240116Smarcel/* The hashtable, so that the C front ends can pass it to cpplib. */ 133240116Smarcelextern struct ht *ident_hash; 134240116Smarcel 135240116Smarcel/* This function can be used by targets to set the flags originally 136240116Smarcel implied by -ffast-math and -fno-fast-math. */ 137240116Smarcel 138240116Smarcelextern void set_fast_math_flags (int); 139240116Smarcel 140240116Smarcel/* Handle -d switch. */ 141240116Smarcelextern void decode_d_option (const char *); 142240116Smarcel 143240116Smarcel/* Return true iff flags are set as if -ffast-math. */ 144240116Smarcelextern bool fast_math_flags_set_p (void); 145240116Smarcel 146240116Smarcel/* The following functions accept a wide integer argument. Rather 147240116Smarcel than having to cast on every function call, we use a macro instead. */ 148240116Smarcel 149240116Smarcel#ifndef exact_log2 150240116Smarcel#define exact_log2(N) exact_log2_wide ((unsigned HOST_WIDE_INT) (N)) 151240116Smarcel#define floor_log2(N) floor_log2_wide ((unsigned HOST_WIDE_INT) (N)) 152240116Smarcel#endif 153240116Smarcelextern int exact_log2_wide (unsigned HOST_WIDE_INT); 154240116Smarcelextern int floor_log2_wide (unsigned HOST_WIDE_INT); 155240116Smarcel 156240116Smarcel/* Functions used to get and set GCC's notion of in what directory 157240116Smarcel compilation was started. */ 158240116Smarcel 159240116Smarcelextern const char *get_src_pwd (void); 160240116Smarcelextern bool set_src_pwd (const char *); 161240116Smarcel 162240116Smarcel#endif /* ! GCC_TOPLEV_H */ 163240116Smarcel