This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
PATCH for namespace/template support
- To: egcs at cygnus dot com
- Subject: PATCH for namespace/template support
- From: Mike Stump <mrs at kithrup dot com>
- Date: Sat, 9 May 1998 02:45:54 -0700 (PDT)
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);
+ }
--------------