diff options
author | Neil Booth <neil@daikokuya.demon.co.uk> | 2002-05-04 20:15:00 +0000 |
---|---|---|
committer | Neil Booth <neil@gcc.gnu.org> | 2002-05-04 20:15:00 +0000 |
commit | 3d90d2908e9a7ae8fbad9f248bb5517e74139e3b (patch) | |
tree | a2449890a6a273739539cb635907054553cde2bb /gcc/c-lex.c | |
parent | 625458d0b97e2665f53f56832778214e7e7ae6b6 (diff) | |
download | gcc-3d90d2908e9a7ae8fbad9f248bb5517e74139e3b.zip gcc-3d90d2908e9a7ae8fbad9f248bb5517e74139e3b.tar.gz gcc-3d90d2908e9a7ae8fbad9f248bb5517e74139e3b.tar.bz2 |
Makefile.in (c-lex.o): Update.
* Makefile.in (c-lex.o): Update.
* c-lex.c: Include target.h.
(cb_register_builtins): New.
(init_c_lex): Set builtins callback.
* c-lex.h (cpp_define, cpp_assert): New prototypes.
* cppinit.c (init_builtins): Use callback, including for
GXX_WEAK.
* cpplib.h (struct cpp_callbacks): New member.
* target-def.h (TARGET_REGISTER_CPP_BUILTINS): New.
(TARGET_INITIALIZER): Update.
* target.h (struct gcc_target): New hook.
* tree.c (default_register_cpp_builtins): New.
* tree.h (default_register_cpp_builtins): New.
doc:
* tm.texi (TARGET_REGISTER_CPP_BUILTINS): Document.
From-SVN: r53165
Diffstat (limited to 'gcc/c-lex.c')
-rw-r--r-- | gcc/c-lex.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/c-lex.c b/gcc/c-lex.c index 0c10f30..9679b60 100644 --- a/gcc/c-lex.c +++ b/gcc/c-lex.c @@ -39,6 +39,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "tm_p.h" #include "splay-tree.h" #include "debug.h" +#include "target.h" #ifdef MULTIBYTE_CHARS #include "mbchar.h" @@ -80,6 +81,7 @@ static tree lex_string PARAMS ((const unsigned char *, unsigned int, static tree lex_charconst PARAMS ((const cpp_token *)); static void update_header_times PARAMS ((const char *)); static int dump_one_header PARAMS ((splay_tree_node, void *)); +static void cb_register_builtins PARAMS ((cpp_reader *)); static void cb_line_change PARAMS ((cpp_reader *, const cpp_token *, int)); static void cb_ident PARAMS ((cpp_reader *, unsigned int, const cpp_string *)); @@ -121,6 +123,7 @@ init_c_lex (filename) cb->ident = cb_ident; cb->file_change = cb_file_change; cb->def_pragma = cb_def_pragma; + cb->register_builtins = cb_register_builtins; /* Set the debug callbacks if we can use them. */ if (debug_info_level == DINFO_LEVEL_VERBOSE @@ -225,6 +228,22 @@ dump_time_statistics () splay_tree_foreach (file_info_tree, dump_one_header, 0); } +/* Register preprocessor built-ins. */ +static void +cb_register_builtins (pfile) + cpp_reader *pfile; +{ + if (c_language == clk_cplusplus) + { + if (SUPPORTS_ONE_ONLY) + cpp_define (pfile, "__GXX_WEAK__"); + else + cpp_define (pfile, "__GXX_WEAK__=0"); + } + + (*targetm.register_cpp_builtins) (pfile); +} + /* Not yet handled: #pragma, #define, #undef. No need to deal with linemarkers under normal conditions. */ |