shithub: mc

Download patch

ref: e30957d632fbeaf0056233e2d084678cfd39f568
parent: 397e7774d4a6a7353d1c2c2bc5c68f90ebacab75
author: Ori Bernstein <[email protected]>
date: Fri Sep 13 10:02:56 EDT 2013

Don't install generated ucons into stab.

    This creates spurious conflicts. We don't want spurious conflicts.

--- a/parse/parse.h
+++ b/parse/parse.h
@@ -137,6 +137,7 @@
 struct Ucon {
     int line;   /* line declared on */
     size_t id;  /* unique id */
+    int synth;  /* is it generated? */
     Node *name; /* ucon name */
     Type *utype;        /* type of the union this is an element of */
     Type *etype;        /* type for the element */
--- a/parse/specialize.c
+++ b/parse/specialize.c
@@ -80,11 +80,13 @@
             ret = tydup(t);
             htput(tsmap, t, ret);
             for (i = 0; i < t->nmemb; i++) {
-                if (ret->udecls[i]->etype) {
+                tmp = NULL;
+                if (ret->udecls[i]->etype)
                     tmp = tyspecialize(t->udecls[i]->etype, tsmap);
-                    ret->udecls[i] = mkucon(t->line, t->udecls[i]->name, ret, tmp);
-                }
+                ret->udecls[i] = mkucon(t->line, t->udecls[i]->name, ret, tmp);
                 ret->udecls[i]->utype = ret;
+                ret->udecls[i]->id = i;
+                ret->udecls[i]->synth = 1;
             }
             break;
         default:
--- a/parse/use.c
+++ b/parse/use.c
@@ -99,6 +99,7 @@
 {
     wrint(fd, uc->line);
     wrint(fd, uc->id);
+    wrbool(fd, uc->synth);
     pickle(uc->name, fd);
     wrbool(fd, uc->etype != NULL);
     if (uc->etype)
@@ -112,15 +113,18 @@
     Ucon *uc;
     size_t id;
     int line;
+    int synth;
 
     et = NULL;
     line = rdint(fd);
     id = rdint(fd);
+    synth = rdbool(fd);
     name = unpickle(fd);
     uc = mkucon(line, name, ut, et);
     if (rdbool(fd))
       rdtype(fd, &uc->etype);
     uc->id = id;
+    uc->synth = synth;
     return uc;
 }
 
@@ -636,7 +640,8 @@
                         puttype(s, t->name, t);
                 if (t->type == Tyunion)  {
                     for (i = 0; i < t->nmemb; i++)
-                        putucon(s, t->udecls[i]);
+                        if (!t->udecls[i]->synth)
+                            putucon(s, t->udecls[i]);
                 }
                 break;
             case EOF: