diff options
author | Zack Weinberg <zack@wolery.cumb.org> | 2000-08-09 19:41:12 +0000 |
---|---|---|
committer | Zack Weinberg <zack@gcc.gnu.org> | 2000-08-09 19:41:12 +0000 |
commit | 9ec7291f1ffab5af0ffcbc0037046d3cf7730217 (patch) | |
tree | d5bb51bad6a6b24f2b2de095f7c7474492e78f9a /gcc/cpplib.c | |
parent | 9cc82a019817f8eaf807831dd34afc8701d37ee0 (diff) | |
download | gcc-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/cpplib.c')
-rw-r--r-- | gcc/cpplib.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/gcc/cpplib.c b/gcc/cpplib.c index 1ce9bbf..9daee3e 100644 --- a/gcc/cpplib.c +++ b/gcc/cpplib.c @@ -477,7 +477,7 @@ do_line (pfile) /* C99 raised the minimum limit on #line numbers. */ unsigned int cap = CPP_OPTION (pfile, c99) ? 2147483647 : 32767; int action_number = 0; - int enter = 0, leave = 0; + int enter = 0, leave = 0, rename = 0; enum cpp_ttype type; const U_CHAR *str; char *fname; @@ -492,7 +492,7 @@ do_line (pfile) if (type != CPP_NUMBER || strtoul_for_line (str, len, &new_lineno)) { cpp_error (pfile, "token after #line is not a positive integer"); - goto done; + return; } if (CPP_PEDANTIC (pfile) && (new_lineno == 0 || new_lineno > cap)) @@ -511,7 +511,7 @@ do_line (pfile) { cpp_error (pfile, "second token after #line is not a string"); ip->lineno = old_lineno; /* malformed #line should have no effect */ - goto done; + return; } fname = alloca (len + 1); @@ -520,6 +520,7 @@ do_line (pfile) if (strcmp (fname, ip->nominal_fname)) { + rename = 1; if (!strcmp (fname, ip->inc->name)) ip->nominal_fname = ip->inc->name; else @@ -527,7 +528,7 @@ do_line (pfile) } if (read_line_number (pfile, &action_number) == 0) - return; + goto done; if (CPP_PEDANTIC (pfile)) cpp_pedwarn (pfile, "garbage at end of #line"); @@ -555,13 +556,13 @@ do_line (pfile) read_line_number (pfile, &action_number); } + done: if (enter && pfile->cb.enter_file) (*pfile->cb.enter_file) (pfile); if (leave && pfile->cb.leave_file) (*pfile->cb.leave_file) (pfile); - - done: - return; + if (rename && pfile->cb.rename_file) + (*pfile->cb.rename_file) (pfile); } /* @@ -610,7 +611,7 @@ do_ident (pfile) if (str->type == CPP_STRING && _cpp_get_token (pfile)->type == CPP_EOF) { if (pfile->cb.ident) - (*pfile->cb.ident) (pfile, str); + (*pfile->cb.ident) (pfile, str->val.str.text, str->val.str.len); return; } |