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 4f7168f..d5c9765 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 300f5bd..40d8c25 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 1ab42f5..eb80802 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 e49804c..efbec20 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;
 }