public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* PATCH for namespace/template support
@ 1998-05-09  3:34 Mike Stump
  1998-05-09 11:06 ` Martin von Loewis
  0 siblings, 1 reply; 2+ messages in thread
From: Mike Stump @ 1998-05-09  3:34 UTC (permalink / raw)
  To: egcs

Here is a simple one.  Martin, let us know if it is wrong/incomplete.

Sat May  9 02:31:07 1998  Mike Stump  <mrs@wrs.com>

	* tree.c (mapcar): Add OVERLOAD support.

Doing diffs in .:
*** ./cp/tree.c.~1~	Fri May  8 22:53:32 1998
--- ./cp/tree.c	Sat May  9 02:30:55 1998
*************** mapcar (t, func)
*** 1590,1595 ****
--- 1590,1604 ----
  	return t;
        }
  
+     case OVERLOAD:
+       {
+ 	tree chain = OVL_CHAIN (t);
+ 	t = copy_node (t);
+ 	OVL_FUNCTION (t) = mapcar (OVL_FUNCTION (t), func);
+ 	OVL_CHAIN (t) = mapcar (chain, func);
+ 	return t;
+       }
+ 
      case TREE_VEC:
        {
  	int len = TREE_VEC_LENGTH (t);
*** ./testsuite/g++.old-deja/g++.mike/ns15.C.~1~	Sat May  9 02:39:39 1998
--- ./testsuite/g++.old-deja/g++.mike/ns15.C	Sat May  9 02:39:25 1998
***************
*** 0 ****
--- 1,31 ----
+ // Build don't link:
+ 
+ #include <stdio.h>
+ #include <stdlib.h>
+ 
+ #define MAX 256
+ #define MAXSTATE 1000000
+ 
+ struct R {
+   int count;
+   int state1;
+   int state2;
+ };
+ 
+ int cmp_d(const R* a, const R* b) {
+   return a->count > b->count;
+ }
+ 
+ namespace CXX {
+   template<class T, int i1, int i2>
+     inline void qsort (T b[i1][i2], int (*cmp)(const T*, const T*)) {
+     ::qsort ((void*)b, i1*i2, sizeof(T), (int (*)(const void *, const void *))cmp);
+   }
+ }
+ 
+ using namespace CXX;
+ 
+ void sort_machine() {
+   struct R d[MAX][MAX];
+   qsort<R,MAX> (d, cmp_d);
+ }
--------------

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: PATCH for namespace/template support
  1998-05-09  3:34 PATCH for namespace/template support Mike Stump
@ 1998-05-09 11:06 ` Martin von Loewis
  0 siblings, 0 replies; 2+ messages in thread
From: Martin von Loewis @ 1998-05-09 11:06 UTC (permalink / raw)
  To: mrs; +Cc: egcs

> Sat May  9 02:31:07 1998  Mike Stump  <mrs@wrs.com>
> 
> 	* tree.c (mapcar): Add OVERLOAD support.

Thanks, this change looks OK. 

There are probably some more places where the code checks for
TREE_LIST when it is really looking for overloaded functions.

For example, there is a dubious check in the CALL_EXPR case of mapcar.
I could not find build_call_declarator mentioned in the comment, but
if somebody wants to put an overloaded function into operand two, this
would now be an OVERLOAD node.

Martin

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1998-05-09 11:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-05-09  3:34 PATCH for namespace/template support Mike Stump
1998-05-09 11:06 ` Martin von Loewis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).