sym.c: allow for void functions but not variables
authorAlan Cox <alan@linux.intel.com>
Fri, 24 Jun 2016 16:59:15 +0000 (17:59 +0100)
committerAlan Cox <alan@linux.intel.com>
Fri, 24 Jun 2016 16:59:15 +0000 (17:59 +0100)
Applications/SmallC/sym.c

index 769b04e..bafbc79 100644 (file)
@@ -35,10 +35,14 @@ int declare_global(int type, int storage, TAG_SYMBOL *mtag, int otag, int is_str
                 multidef (sname);
             if (match ("(")) {
                 /* FIXME: We need to deal with pointer types properly here */
+                if (identity == POINTER)
+                    type = CINT;
                 newfunc_typed(storage, sname, type);
                 /* Can't int foo(x){blah),a=4; */
                 return 1;
             }
+            if (identity == VARIABLE && type == VOID)
+                error("cannot have void variables");
             if (match ("[")) {
                 dim = needsub ();
                 //if (dim || storage == EXTERN) {