diff options
author | Neil Booth <neil@daikokuya.demon.co.uk> | 2001-11-26 23:44:54 +0000 |
---|---|---|
committer | Neil Booth <neil@gcc.gnu.org> | 2001-11-26 23:44:54 +0000 |
commit | 4d6baafa31576db4b1f5bc2d79913c9ce96e3a61 (patch) | |
tree | c1a2c9c7c2d1ce0412550e13966b5458cdbb8bbe /gcc/c-common.c | |
parent | d4b4b319a23400caa59bbf0e2db01a8f0e38b34e (diff) | |
download | gcc-4d6baafa31576db4b1f5bc2d79913c9ce96e3a61.zip gcc-4d6baafa31576db4b1f5bc2d79913c9ce96e3a61.tar.gz gcc-4d6baafa31576db4b1f5bc2d79913c9ce96e3a61.tar.bz2 |
cppfiles.c (stack_include_file): Don't optimize zero-length files.
* cppfiles.c (stack_include_file): Don't optimize zero-length
files.
(read_include_file): NUL-terminate read files.
* cpplex.c (handle_newline, skip_escaped_newlines,
get_effective_char, skip_whitespace, parse_identifier,
parse_identifier_slow, parse_number, parse_string,
_cpp_lex_direct): Optimize for the fact that buffers are guaranteed
NUL-terminated.
* cpplib.c (destringize_and_run, cpp_define, handle_assertion):
Be sure buffers are NUL terminated.
* cppmacro.c (warn_of_redefinition): Kill compile warning.
* c-common.c: Include tree-inline.h.
(c_language): Move separate definitions here.
(c_common_init_options, c_common_post_options): New.
(c_common_lang_init): Rename c_common_init.
* c-common.h (c_common_lang_init): Similarly.
(c_common_init_options, c_common_post_options): New.
* c-lang.c (c_post_options): Move body to c_common_post_options.
(c_init_options): Use c_common_init_options.
(c_init): Update.
* langhooks.def: Rearrange.
* langhooks.h: Rearrange, and improve comments.
* toplev.c (do_compile): New function.
(toplev_main): Use it.
(lang_independent_f_options, parse_options_and_default_flags,
process_options): Remove trailing periods.
* Makefile.in: Update.
cp: * decl2.c (c_language): Move to c-common.c.
* lex.c (cxx_post_options, cxx_init_options): Use c-common.c
functions.
(cxx_init): Update.
objc: * objc-act.c (objc_post_options, objc_init_options): Use c-common.c
functions.
(ojbc_init): Update.
From-SVN: r47362
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r-- | gcc/c-common.c | 59 |
1 files changed, 51 insertions, 8 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c index dde1af3..a7d005b 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -30,6 +30,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "ggc.h" #include "expr.h" #include "c-common.h" +#include "tree-inline.h" #include "diagnostic.h" #include "tm_p.h" #include "obstack.h" @@ -79,6 +80,10 @@ cpp_reader *parse_in; /* Declared in c-lex.h. */ : "long long unsigned int")) #endif +/* The variant of the C language being processed. */ + +enum c_language_kind c_language; + /* The following symbols are subsumed in the c_global_trees array, and listed here individually for documentation purposes. @@ -2371,7 +2376,7 @@ c_common_nodes_and_builtins () tree va_list_arg_type_node; /* We must initialize this before any builtin functions (which might have - attributes) are declared. (c_common_lang_init is too late.) */ + attributes) are declared. (c_common_init is too late.) */ format_attribute_table = c_format_attribute_table; /* Define `int' and `char' first so that dbx will output them first. */ @@ -3858,17 +3863,43 @@ static bool c_attrs_initialized = false; static void c_init_attributes PARAMS ((void)); -/* Do the parts of lang_init common to C and C++. */ -const char * -c_common_lang_init (filename) - const char *filename; +/* Common initialization before parsing options. */ +void +c_common_init_options (lang) + enum c_language_kind lang; { - filename = init_c_lex (filename); + c_language = lang; + parse_in = cpp_create_reader (lang == clk_c ? CLK_GNUC89: + lang == clk_cplusplus ? CLK_GNUCXX: CLK_OBJC); - init_pragma (); + /* Mark as "unspecified" (see c_common_post_options). */ + flag_bounds_check = -1; +} + +/* Post-switch processing. */ +void +c_common_post_options () +{ + cpp_post_options (parse_in); + + /* Use tree inlining if possible. Function instrumentation is only + done in the RTL level, so we disable tree inlining. */ + if (! flag_instrument_function_entry_exit) + { + if (!flag_no_inline) + { + flag_inline_trees = 1; + flag_no_inline = 1; + } + if (flag_inline_functions) + { + flag_inline_trees = 2; + flag_inline_functions = 0; + } + } /* If still "unspecified", make it match -fbounded-pointers. */ - if (flag_bounds_check < 0) + if (flag_bounds_check == -1) flag_bounds_check = flag_bounded_pointers; /* Special format checking options don't work without -Wformat; warn if @@ -3883,6 +3914,18 @@ c_common_lang_init (filename) warning ("-Wformat-security ignored without -Wformat"); if (warn_missing_format_attribute && !warn_format) warning ("-Wmissing-format-attribute ignored without -Wformat"); +} + +/* Front end initialization common to C, ObjC and C++. */ +const char * +c_common_init (filename) + const char *filename; +{ + /* Do this before initializing pragmas, as then cpplib's hash table + has been set up. */ + filename = init_c_lex (filename); + + init_pragma (); if (!c_attrs_initialized) c_init_attributes (); |