aboutsummaryrefslogtreecommitdiff
path: root/gcc/cppmain.c
diff options
context:
space:
mode:
authorZack Weinberg <zack@wolery.cumb.org>2000-08-09 19:41:12 +0000
committerZack Weinberg <zack@gcc.gnu.org>2000-08-09 19:41:12 +0000
commit9ec7291f1ffab5af0ffcbc0037046d3cf7730217 (patch)
treed5bb51bad6a6b24f2b2de095f7c7474492e78f9a /gcc/cppmain.c
parent9cc82a019817f8eaf807831dd34afc8701d37ee0 (diff)
downloadgcc-9ec7291f1ffab5af0ffcbc0037046d3cf7730217.zip
gcc-9ec7291f1ffab5af0ffcbc0037046d3cf7730217.tar.gz
gcc-9ec7291f1ffab5af0ffcbc0037046d3cf7730217.tar.bz2
configure.in (--enable-c-cpplib): Uncomment.
* configure.in (--enable-c-cpplib): Uncomment. Use AC_DEFINE instead of extra_c_flags. (--enable-c-mbchar): Use AC_DEFINE instead of extra_c_flags. * configure: Regenerate. * config.in: Regenerate. * cpperror.c (cpp_type2name): New function. * cpplex.c (lex_line): If we issued an error for an invalid preprocessing directive, discard that logical line. * cpplib.c (do_line): Call a hook function if the current file is renamed by #line. (do_ident): Pass the contents of the string, not the entire token, to the callback function. * cpplib.h (CPP_LAST_PUNCTUATOR): New #define. (cb.rename_file): New hook function. (cb.ident): Adjust prototype. (cpp_type2name): Prototype. * cppmacro.c (dump_macro_args): Correct precedence lossage. * cppmain.c (cb_ident): Update for changed interface. (cb_rename_file): New function. (main): Set rename callback. From-SVN: r35593
Diffstat (limited to 'gcc/cppmain.c')
-rw-r--r--gcc/cppmain.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/gcc/cppmain.c b/gcc/cppmain.c
index 8b6bbce..6196c46 100644
--- a/gcc/cppmain.c
+++ b/gcc/cppmain.c
@@ -39,9 +39,11 @@ static void cb_undef PARAMS ((cpp_reader *, cpp_hashnode *));
static void cb_include PARAMS ((cpp_reader *, const unsigned char *,
const unsigned char *, unsigned int, int));
-static void cb_ident PARAMS ((cpp_reader *, const cpp_token *));
+static void cb_ident PARAMS ((cpp_reader *, const unsigned char *,
+ unsigned int));
static void cb_enter_file PARAMS ((cpp_reader *));
static void cb_leave_file PARAMS ((cpp_reader *));
+static void cb_rename_file PARAMS ((cpp_reader *));
static void cb_def_pragma PARAMS ((cpp_reader *));
static void do_pragma_implementation PARAMS ((cpp_reader *));
@@ -90,6 +92,7 @@ main (argc, argv)
{
pfile->cb.enter_file = cb_enter_file;
pfile->cb.leave_file = cb_leave_file;
+ pfile->cb.rename_file = cb_rename_file;
}
if (CPP_OPTION (pfile, dump_includes))
pfile->cb.include = cb_include;
@@ -132,12 +135,12 @@ main (argc, argv)
/* Callbacks */
static void
-cb_ident (pfile, token)
+cb_ident (pfile, str, len)
cpp_reader *pfile;
- const cpp_token *token;
+ const unsigned char *str;
+ unsigned int len;
{
- cpp_printf (pfile, &parse_out, "#ident \"%.*s\"\n",
- (int) token->val.str.len, token->val.str.text);
+ cpp_printf (pfile, &parse_out, "#ident \"%.*s\"\n", (int) len, str);
}
static void
@@ -209,6 +212,19 @@ cb_leave_file (pfile)
}
static void
+cb_rename_file (pfile)
+ cpp_reader *pfile;
+{
+ cpp_buffer *ip = CPP_BUFFER (pfile);
+
+ cpp_printf (pfile, &parse_out, "# %u \"%s\"%s\n", ip->lineno,
+ ip->nominal_fname, cpp_syshdr_flags (pfile, ip));
+
+ parse_out.lineno = ip->lineno;
+ parse_out.last_fname = ip->nominal_fname;
+}
+
+static void
cb_def_pragma (pfile)
cpp_reader *pfile;
{