aboutsummaryrefslogtreecommitdiff
path: root/gcc/cppinit.c
diff options
context:
space:
mode:
authorNeil Booth <neil@daikokuya.co.uk>2002-06-19 05:40:08 +0000
committerNeil Booth <neil@gcc.gnu.org>2002-06-19 05:40:08 +0000
commit278c466207b2d592d8ea21234d6cb228b95bc246 (patch)
tree3c3d821dfd3b04ed9aaf9b7fbdf7297ca8b32a1f /gcc/cppinit.c
parent9d7b4c5a4ff06264dd94b5da29bd32ffc8e4435a (diff)
downloadgcc-278c466207b2d592d8ea21234d6cb228b95bc246.zip
gcc-278c466207b2d592d8ea21234d6cb228b95bc246.tar.gz
gcc-278c466207b2d592d8ea21234d6cb228b95bc246.tar.bz2
cpphash.h (struct cpp_reader): Make date and time strings.
* cpphash.h (struct cpp_reader): Make date and time strings. (_cpp_builtin_macro_text, _cpp_copy_replacement_text, _cpp_replacement_text_len): New. * cppinit.c (cpp_create_reader): Update. (init_builtins): Register appropriate builtins for -traditional-cpp. * cppmacro.c (new_number_token): Remove. (_cpp_builtin_macro_text): New. (builtin_macro): Use it. (cpp_macro_definition): Update to handle traditional macros. * cppmain.c (cb_line_change): Don't do column positioning for traditional output. * cpptrad.c (enum ls): Rename ls_fun_macro to ls_fun_open. New state ls_fun_close. (skip_whitespace): Fix. (maybe_start_funlike): Don't set state.parsing_args. (scan_out_logical_line): Remove duplicate error. Use lex_state rather than state.parsing_args. (push_replacement_text): Handle builtins. (_cpp_replacement_text_len, _cpp_copy_replacement_text): New. From-SVN: r54771
Diffstat (limited to 'gcc/cppinit.c')
-rw-r--r--gcc/cppinit.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/gcc/cppinit.c b/gcc/cppinit.c
index 411dbea..1df4bac 100644
--- a/gcc/cppinit.c
+++ b/gcc/cppinit.c
@@ -512,7 +512,6 @@ cpp_create_reader (lang)
pfile->state.save_comments = ! CPP_OPTION (pfile, discard_comments);
/* Set up static tokens. */
- pfile->date.type = CPP_EOF;
pfile->avoid_paste.type = CPP_PADDING;
pfile->avoid_paste.val.source = NULL;
pfile->eof.type = CPP_EOF;
@@ -640,6 +639,8 @@ static const struct builtin builtin_array[] =
B("__BASE_FILE__", BT_BASE_FILE),
B("__LINE__", BT_SPECLINE),
B("__INCLUDE_LEVEL__", BT_INCLUDE_LEVEL),
+ /* Keep builtins not used for -traditional-cpp at the end, and
+ update init_builtins() if any more are added. */
B("_Pragma", BT_PRAGMA),
B("__STDC__", BT_STDC),
};
@@ -684,10 +685,12 @@ init_builtins (pfile)
cpp_reader *pfile;
{
const struct builtin *b;
+ size_t n = ARRAY_SIZE (builtin_array);
- for(b = builtin_array;
- b < (builtin_array + ARRAY_SIZE (builtin_array));
- b++)
+ if (CPP_OPTION (pfile, traditional))
+ n -= 2;
+
+ for(b = builtin_array; b < builtin_array + n; b++)
{
cpp_hashnode *hp = cpp_lookup (pfile, b->name, b->len);
hp->type = NT_MACRO;