extvar: skip decl registration
authorMichael Wallner <mike@php.net>
Thu, 26 Jul 2018 07:45:29 +0000 (09:45 +0200)
committerMichael Wallner <mike@php.net>
Thu, 26 Jul 2018 07:45:29 +0000 (09:45 +0200)
src/data.c
src/types/decl.c
src/types/decl.h
src/types/decl_extvar.c

index 4f7168facd6a822bdf2d508a7cad845bc58fadd4..d5c9765a454471e29caea516c0d8d68de8d6cc19 100644 (file)
@@ -164,9 +164,6 @@ void psi_data_dump(int fd, struct psi_data *D)
        char *libname;
 
        if (D->file.filename) {
-               size_t i = 0;
-               char *libname;
-
                dprintf(fd, "// filename=%s (%u errors)\n", D->file.filename, D->errors);
        }
        while (psi_plist_get(D->file.libnames, i++, &libname)) {
@@ -234,8 +231,14 @@ void psi_data_dump(int fd, struct psi_data *D)
                struct psi_decl *decl;
 
                while (psi_plist_get(D->decls, i++, &decl)) {
+                       if (decl->extvar) {
+                               dprintf(fd, "/* extvar accessor\n");
+                       }
                        psi_decl_dump(fd, decl);
-                       dprintf(fd, "// %p \n", decl->sym);
+                       dprintf(fd, "\n");
+                       if (decl->extvar) {
+                               dprintf(fd, "   extvar accessor */\n");
+                       }
                }
                dprintf(fd, "\n");
        }
index 300f5bdd36b6e1a782285e54423dbfbb3e2064bf..40d8c251f0e484123277dfda6b97f4c517fbb97c 100644 (file)
@@ -66,7 +66,9 @@ void psi_decl_free(struct psi_decl **d_ptr)
 
 void psi_decl_dump(int fd, struct psi_decl *decl)
 {
-       psi_decl_abi_dump(fd, decl->abi);
+       if (decl->abi) {
+               psi_decl_abi_dump(fd, decl->abi);
+       }
        dprintf(fd, " ");
        /* FIXME: functions returning arrays */
        psi_decl_arg_dump(fd, decl->func, 0);
@@ -85,6 +87,9 @@ void psi_decl_dump(int fd, struct psi_decl *decl)
                        dprintf(fd, ", ...");
                }
        }
+       if (decl->func->var->array_size) {
+               dprintf(fd, ")[%zu]", decl->func->var->array_size);
+       }
        if (decl->redir) {
                dprintf(fd, ") __asm__ (\"%s\");", decl->redir);
        } else {
index 1ab42f57867d7aa27764d554264f090dbd0f67d6..eb808025ebff16a163bdef8582443b60e2daaf2d 100644 (file)
@@ -39,6 +39,7 @@ struct psi_decl {
        void *sym;
        void *info;
        unsigned varargs:1;
+       unsigned extvar:1;
 };
 
 struct psi_decl *psi_decl_init(struct psi_decl_arg *func, struct psi_plist *args);
index e49804c105b31b80ca21ea72591134e382d34ce8..efbec20768787543e22d4c56ee153dde11ef1dee 100644 (file)
@@ -129,6 +129,8 @@ struct psi_decl *psi_decl_extvar_setter(struct psi_decl_extvar *evar)
        func_var->name = realloc(func_var->name, strlen(evar->arg->var->name) + sizeof("_set"));
        strcat(func_var->name, "_set");
 
+       decl->extvar = 1;
+
        return decl;
 }
 
@@ -147,6 +149,8 @@ struct psi_decl *psi_decl_extvar_getter(struct psi_decl_extvar *evar)
        func_var->name = realloc(func_var->name, strlen(evar->arg->var->name) + sizeof("_get"));
        strcat(func_var->name, "_get");
 
+       decl->extvar = 1;
+
        return decl;
 }