bug fix: static link was not always removed
authorceriel <none@none>
Thu, 16 Nov 1989 14:57:15 +0000 (14:57 +0000)
committerceriel <none@none>
Thu, 16 Nov 1989 14:57:15 +0000 (14:57 +0000)
lang/pc/comp/declar.g
lang/pc/comp/def.c

index c04b274..4c7a007 100644 (file)
@@ -320,7 +320,8 @@ ProcedureHeading(register struct node **pnd; register struct type **ptp;)
        |
                /* empty */
                                { *ptp =
-                                   proc_type((struct paramlist *)0, (arith) 0);
+                                   proc_type((struct paramlist *)0,
+                                               (proclevel > 1) ? pointer_size : (arith) 0);
                                }
        ]
 ;
@@ -383,7 +384,7 @@ FunctionHeading(register struct node **pnd; register struct type **ptp;)
        struct node *fpl = NULLNODE;
        struct type *tp;
        struct paramlist *pr = 0;
-       arith nb_pars = 0;
+       arith nb_pars = (proclevel > 1) ? pointer_size : 0;
 } :
        FUNCTION
        IDENT                   { *pnd = MkLeaf(Name, &dot);
index 564d6af..861acc9 100644 (file)
@@ -157,7 +157,15 @@ DoDirective(directive, nd, tp, scl, function)
                df->df_type = tp;
                df->prc_vis = scl;
                df->prc_name = gen_proc_name(nd->nd_IDF, inp);
-               if( ext ) df->df_flags |= D_EXTERNAL;
+               if( ext ) {
+                       if (!(df->df_flags & D_EXTERNAL) && proclevel > 1)
+                               tp->prc_nbpar -= pointer_size;
+                       /* was added for static link which is not needed now.
+                          But make sure this is done only once (look at the
+                          D_EXTERNAL flag).
+                       */
+                       df->df_flags |= D_EXTERNAL;
+               }
                df->df_flags |= D_SET;
        }
 }