diff options
author | neil <neil@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-05-04 20:15:00 +0000 |
---|---|---|
committer | neil <neil@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-05-04 20:15:00 +0000 |
commit | 9a85d74bf1eccd35410ac36138d185ea9698d389 (patch) | |
tree | a2449890a6a273739539cb635907054553cde2bb /gcc/c-lex.c | |
parent | 40855b3039fe63b317142ae2cdb591b4fef02d95 (diff) | |
download | gcc-9a85d74bf1eccd35410ac36138d185ea9698d389.tar.gz |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@53165 138bc75d-0d04-0410-961f-82ee72b054a4
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 0c10f30672e..9679b607f97 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. */ |