aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Stallman <rms@gnu.org>1992-12-29 07:28:26 +0000
committerRichard Stallman <rms@gnu.org>1992-12-29 07:28:26 +0000
commit2b1a049f69b272fbd73de78c50deda03a867c6d8 (patch)
treebac77c890fcd77b1852c899ae4758a7871c285ae /gcc
parent0129f367821b40f1738b75f93531e55363adc6c6 (diff)
downloadgcc-2b1a049f69b272fbd73de78c50deda03a867c6d8.zip
gcc-2b1a049f69b272fbd73de78c50deda03a867c6d8.tar.gz
gcc-2b1a049f69b272fbd73de78c50deda03a867c6d8.tar.bz2
(make_definition): Pass NULL as 3rd arg to do_define.
From-SVN: r2977
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cccp.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/gcc/cccp.c b/gcc/cccp.c
index 887db79..6b2aaac 100644
--- a/gcc/cccp.c
+++ b/gcc/cccp.c
@@ -6902,7 +6902,8 @@ macroexpand (hp, op)
args = (struct argdata *) alloca ((nargs + 1) * sizeof (struct argdata));
for (i = 0; i < nargs; i++) {
- args[i].raw = args[i].expanded = (U_CHAR *) "";
+ args[i].raw = (U_CHAR *) "";
+ args[i].expanded = 0;
args[i].raw_length = args[i].expand_length
= args[i].stringified_length = 0;
args[i].free1 = args[i].free2 = 0;
@@ -6997,9 +6998,22 @@ macroexpand (hp, op)
xbuf_len += args[ap->argno].stringified_length;
else if (ap->raw_before || ap->raw_after || traditional)
xbuf_len += args[ap->argno].raw_length;
- else
- xbuf_len += args[ap->argno].expand_length;
+ else {
+ /* We have an ordinary (expanded) occurrence of the arg.
+ So compute its expansion, if we have not already. */
+ if (args[ap->argno].expanded == 0) {
+ FILE_BUF obuf;
+ obuf = expand_to_temp_buffer (args[ap->argno].raw,
+ args[ap->argno].raw + args[ap->argno].raw_length,
+ 1, 0);
+
+ args[ap->argno].expanded = obuf.buf;
+ args[ap->argno].expand_length = obuf.length;
+ args[ap->argno].free2 = obuf.buf;
+ }
+ xbuf_len += args[ap->argno].expand_length;
+ }
if (args[ap->argno].use_count < 10)
args[ap->argno].use_count++;
}
@@ -7291,18 +7305,9 @@ macarg (argptr, rest_args)
All this info goes into *ARGPTR. */
if (argptr != 0) {
- FILE_BUF obuf;
register U_CHAR *buf, *lim;
register int totlen;
- obuf = expand_to_temp_buffer (argptr->raw,
- argptr->raw + argptr->raw_length,
- 1, 0);
-
- argptr->expanded = obuf.buf;
- argptr->expand_length = obuf.length;
- argptr->free2 = obuf.buf;
-
buf = argptr->raw;
lim = buf + argptr->raw_length;
@@ -8321,7 +8326,8 @@ make_definition (str, op)
for (kt = directive_table; kt->type != T_DEFINE; kt++)
;
- do_define (buf, buf + strlen (buf) , op, kt);
+ /* Pass NULL instead of OP, since this is a "predefined" macro. */
+ do_define (buf, buf + strlen (buf), NULL, kt);
--indepth;
}