aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@yorick.cygnus.com>1999-03-16 19:34:49 +0000
committerJason Merrill <jason@gcc.gnu.org>1999-03-16 14:34:49 -0500
commitf921acee1dc1152b82af5ff8224e6e49e177fcb1 (patch)
tree6f51d19f4751f298188eb094b3a072c0d98cb937 /gcc
parent8fe57f78b614a55c9d29def19b7403f60d7c56a9 (diff)
downloadgcc-f921acee1dc1152b82af5ff8224e6e49e177fcb1.zip
gcc-f921acee1dc1152b82af5ff8224e6e49e177fcb1.tar.gz
gcc-f921acee1dc1152b82af5ff8224e6e49e177fcb1.tar.bz2
method.c (old_backref_index): Split out...
* method.c (old_backref_index): Split out... (flush_repeats): From here. Rename back from try_old_backref. (build_mangled_name): Put back some old-style repeat handling. From-SVN: r25809
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/method.c83
2 files changed, 67 insertions, 22 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 3bf63ff..5c6eb36 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+1999-03-16 Jason Merrill <jason@yorick.cygnus.com>
+
+ * method.c (old_backref_index): Split out...
+ (flush_repeats): From here. Rename back from try_old_backref.
+ (build_mangled_name): Put back some old-style repeat handling.
+
Mon Mar 15 21:57:16 1999 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* lex.c: Don't include setjmp.h.
diff --git a/gcc/cp/method.c b/gcc/cp/method.c
index 369dec6..096d662 100644
--- a/gcc/cp/method.c
+++ b/gcc/cp/method.c
@@ -57,7 +57,8 @@ static char *scratch_firstobj;
static void icat PROTO((HOST_WIDE_INT));
static void dicat PROTO((HOST_WIDE_INT, HOST_WIDE_INT));
-static int try_old_backref PROTO((tree));
+static int old_backref_index PROTO((tree));
+static int flush_repeats PROTO((int, tree));
static void build_overload_identifier PROTO((tree));
static void build_overload_nested_name PROTO((tree));
static void build_overload_int PROTO((tree, int));
@@ -299,17 +300,16 @@ dicat (lo, hi)
OB_PUTC ('0' + ulo);
}
-/* Old mangling style: If TYPE has already been used in the parameter list,
- emit a backward reference and return non-zero; otherwise, return 0. */
+/* Returns the index of TYPE in the typevec, or -1 if it's not there. */
static __inline int
-try_old_backref (type)
+old_backref_index (type)
tree type;
{
int tindex = 0;
if (! is_back_referenceable_type (type))
- return 0;
+ return -1;
/* The entry for this parm is at maxtype-1, so don't look there for
something to repeat. */
@@ -318,9 +318,40 @@ try_old_backref (type)
break;
if (tindex == maxtype - 1)
- return 0;
+ return -1;
+
+ return tindex;
+}
+
+/* Old mangling style: If TYPE has already been used in the parameter list,
+ emit a backward reference and return non-zero; otherwise, return 0.
+
+ NREPEATS is the number of repeats we've recorded of this type, or 0 if
+ this is the first time we've seen it and we're just looking to see if
+ it had been used before. */
+
+static __inline int
+flush_repeats (nrepeats, type)
+ int nrepeats;
+ tree type;
+{
+ int tindex = old_backref_index (type);
+
+ if (tindex == -1)
+ {
+ my_friendly_assert (nrepeats == 0, 990316);
+ return 0;
+ }
- OB_PUTC ('T');
+ if (nrepeats > 1)
+ {
+ OB_PUTC ('N');
+ icat (nrepeats);
+ if (nrepeats > 9)
+ OB_PUTC ('_');
+ }
+ else
+ OB_PUTC ('T');
icat (tindex);
if (tindex > 9)
OB_PUTC ('_');
@@ -1129,17 +1160,16 @@ build_mangled_name (parmtypes, begin, end)
if (old_style_repeats)
{
- /* Note that for bug-compatibility with 2.7.2, we can't build
- up repeats. So we call try_old_backref (formerly
- flush_repeats) every round, and only emit Tn codes. */
-
/* Every argument gets counted. */
my_friendly_assert (maxtype < typevec_size, 387);
typevec[maxtype++] = parmtype;
}
- else if (flag_do_squangling)
+
+ if (last_type && same_type_p (parmtype, last_type))
{
- if (last_type && same_type_p (parmtype, last_type))
+ if (flag_do_squangling
+ || (old_style_repeats
+ && is_back_referenceable_type (parmtype)))
{
/* The next type is the same as this one. Keep
track of the repetition, and output the repeat
@@ -1147,18 +1177,24 @@ build_mangled_name (parmtypes, begin, end)
nrepeats++;
continue;
}
- else if (nrepeats != 0)
- {
- /* Indicate how many times the previous parameter was
- repeated. */
- issue_nrepeats (nrepeats, last_type);
- nrepeats = 0;
- }
+ }
+ else if (nrepeats != 0)
+ {
+ /* Indicate how many times the previous parameter was
+ repeated. */
+ if (old_style_repeats)
+ flush_repeats (nrepeats, last_type);
+ else
+ issue_nrepeats (nrepeats, last_type);
+ nrepeats = 0;
}
last_type = parmtype;
- if (old_style_repeats && try_old_backref (parmtype))
+ /* Note that for bug-compatibility with 2.7.2, we can't build up
+ repeats of types other than the most recent one. So we call
+ flush_repeats every round, if we get this far. */
+ if (old_style_repeats && flush_repeats (0, parmtype))
continue;
/* Output the PARMTYPE. */
@@ -1169,7 +1205,10 @@ build_mangled_name (parmtypes, begin, end)
necessary. */
if (nrepeats != 0)
{
- issue_nrepeats (nrepeats, last_type);
+ if (old_style_repeats)
+ flush_repeats (nrepeats, last_type);
+ else
+ issue_nrepeats (nrepeats, last_type);
nrepeats = 0;
}