]> ocean-lang.org Git - ocean/blobdiff - csrc/oceani.mdc
oceani: var storage needs to be free last
[ocean] / csrc / oceani.mdc
index 59b8540122e2f75cd6ee471c3482a8bb8810380d..c3ec2a035d2c127863e0b2081f7b60ed2fc2ad4b 100644 (file)
@@ -167,10 +167,10 @@ structures can be used.
        };
        const char *options = "tpnbs";
 
-       static void pr_err(char *msg)
+       static void pr_err(char *msg)                   // NOTEST
        {
                fprintf(stderr, "%s\n", msg);           // NOTEST
-       }
+       }                                               // NOTEST
 
        int main(int argc, char *argv[])
        {
@@ -264,6 +264,7 @@ structures can be used.
                }
                ## free context vars
                ## free context types
+               ## free context storage
                exit(context.parse_error ? 1 : 0);
        }
 
@@ -530,8 +531,8 @@ Named type are stored in a simple linked list.  Objects of each type are
        {
                if (tl && tl->cmp_order)
                        return tl->cmp_order(tl, tr, left, right);
-               if (tl && tl->cmp_eq)
-                       return tl->cmp_eq(tl, tr, left, right);
+               if (tl && tl->cmp_eq)                   // NOTEST
+                       return tl->cmp_eq(tl, tr, left, right); // NOTEST
                return -1;                              // NOTEST
        }
 
@@ -618,9 +619,9 @@ A separate function encoding these cases will simplify some code later.
        static int type_compat(struct type *require, struct type *have, int rules)
        {
                if ((rules & Rboolok) && have == Tbool)
-                       return 1;
+                       return 1;       // NOTEST
                if ((rules & Rnolabel) && have == Tlabel)
-                       return 0;
+                       return 0;       // NOTEST
                if (!require || !have)
                        return 1;
 
@@ -772,7 +773,7 @@ A separate function encoding these cases will simplify some code later.
                t->size = size;
                t->align = size > sizeof(void*) ? sizeof(void*) : size;
                if (t->size & (t->align - 1))
-                       t->size = (t->size | (t->align - 1)) + 1;
+                       t->size = (t->size | (t->align - 1)) + 1;       // NOTEST
                return t;
        }
 
@@ -1268,7 +1269,7 @@ is started, so there is no need to allocate until the size is known.
                struct variable scratch;
 
                if (t->prepare_type)
-                       t->prepare_type(c, t, 1);
+                       t->prepare_type(c, t, 1);       // NOTEST
 
                if (c->global_size & (t->align - 1))
                        c->global_size = (c->global_size + t->align) & ~(t->align-1);
@@ -1318,7 +1319,7 @@ For this we have `scope_finalize()`.
                c->local = calloc(1, c->local_size);
        }
 
-###### free context vars
+###### free context storage
        free(context.global);
        free(context.local);
 
@@ -1375,7 +1376,7 @@ from the `exec_types` enum.
        static int __fput_loc(struct exec *loc, FILE *f)
        {
                if (!loc)
-                       return 0;               // NOTEST
+                       return 0;
                if (loc->line >= 0) {
                        fprintf(f, "%d:%d: ", loc->line, loc->column);
                        return 1;
@@ -1694,9 +1695,9 @@ with a const size by whether they are prepared at parse time or not.
                void *ptr = val->ptr;
 
                if (!val)
-                       return;
+                       return;                         // NOTEST
                if (!type->array.static_size) {
-                       val->array = calloc(type->array.size, 
+                       val->array = calloc(type->array.size,
                                            type->array.member->size);
                        ptr = val->array;
                }