shithub: mc

Download patch

ref: d9849c024427afe138fcfa43f6b650341572c12b
parent: cd7b9ddf130ed2198c3dfff0d56a5c30dc765310
author: Ori Bernstein <[email protected]>
date: Tue Feb 25 07:44:26 EST 2014

Write out use files.

--- a/mk/c.mk
+++ b/mk/c.mk
@@ -6,7 +6,7 @@
 _LIBINCPATHS=$(addprefix -I, $(dir $(DEPS)))
 _LIBPATHS=$(addprefix -l, $(patsubst lib%.a,%,$(notdir $(DEPS))))
 
-CFLAGS += -Wall -Werror -Wextra -Wno-unused-parameter -Wno-missing-field-initializers
+CFLAGS += -Wall -Werror -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wunreachable-code
 CFLAGS += -g
 CFLAGS += -MMD -MP -MF ${_DEPSDIR}/$(subst /,-,$*).d
 
--- a/parse/use.c
+++ b/parse/use.c
@@ -384,7 +384,7 @@
     n = rdint(fd);
     for (i = 0; i < n; i++)
         lappend(&tr->funcs, &tr->nfuncs, unpickle(fd));
-    htput(trmap, (void*)i, traittab[i]);
+    htput(trmap, (void*)uid, tr);
     return tr;
 }
 
@@ -774,7 +774,8 @@
             case 'R':
                 tr = traitunpickle(f);
                 puttrait(s, tr->name, tr);
-                printf("installing trait %s\n", namestr(tr->name));
+                for (i = 0; i < tr->nfuncs; i++)
+                    putdcl(s, tr->funcs[i]);
                 break;
             case 'T':
                 tid = rdint(f);
@@ -892,6 +893,8 @@
     k = htkeys(st->dcl, &n);
     for (i = 0; i < n; i++) {
         s = getdcl(st, k[i]);
+        if (s->decl.istraitfn)
+            continue;
         if (s && s->decl.isgeneric)
             wrbyte(f, 'G');
         else