aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Stallman <rms@gnu.org>1993-11-01 06:38:43 +0000
committerRichard Stallman <rms@gnu.org>1993-11-01 06:38:43 +0000
commita3fb124a50a9a34f615fcbb82e6049104a77b6ea (patch)
tree1e6cf692b5b79ead447efff71aebbd1531a6d60c
parent568b388feb480ec060e28e27217a4330e8d34f8b (diff)
downloadgcc-a3fb124a50a9a34f615fcbb82e6049104a77b6ea.zip
gcc-a3fb124a50a9a34f615fcbb82e6049104a77b6ea.tar.gz
gcc-a3fb124a50a9a34f615fcbb82e6049104a77b6ea.tar.bz2
(do_ident): Substitute macros and output here.
(directive_table): Turn off the pass_thru field for #ident. From-SVN: r5959
-rw-r--r--gcc/cccp.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/gcc/cccp.c b/gcc/cccp.c
index b48672a..5bf8704 100644
--- a/gcc/cccp.c
+++ b/gcc/cccp.c
@@ -905,7 +905,7 @@ static struct directive directive_table[] = {
{ 4, do_sccs, "sccs", T_SCCS},
#endif
{ 6, do_pragma, "pragma", T_PRAGMA, 0, 0, 1},
- { 5, do_ident, "ident", T_IDENT, 0, 0, 1},
+ { 5, do_ident, "ident", T_IDENT},
{ 6, do_assert, "assert", T_ASSERT},
{ 8, do_unassert, "unassert", T_UNASSERT},
{ -1, 0, "", T_UNUSED},
@@ -6141,9 +6141,31 @@ static int
do_ident (buf, limit)
U_CHAR *buf, *limit;
{
+ FILE_BUF trybuf;
+ int len;
+ FILE_BUF *op = &outbuf;
+
/* Allow #ident in system headers, since that's not user's fault. */
if (pedantic && !instack[indepth].system_header_p)
pedwarn ("ANSI C does not allow `#ident'");
+
+ trybuf = expand_to_temp_buffer (buf, limit, 0, 0);
+ buf = (U_CHAR *) alloca (trybuf.bufp - trybuf.buf + 1);
+ bcopy (trybuf.buf, buf, trybuf.bufp - trybuf.buf);
+ limit = buf + (trybuf.bufp - trybuf.buf);
+ len = (limit - buf);
+ free (trybuf.buf);
+
+ /* Output directive name. */
+ check_expand (op, 8);
+ bcopy ("#ident ", op->bufp, 7);
+ op->bufp += 7;
+
+ /* Output the expanded argument line. */
+ check_expand (op, len);
+ bcopy (buf, op->bufp, len);
+ op->bufp += len;
+
return 0;
}