From: Michael Wallner Date: Thu, 26 Jul 2018 07:45:29 +0000 (+0200) Subject: extvar: skip decl registration X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=c0bdd904aa881aab010c3fd8d859a787d4dd779b;p=m6w6%2Fext-psi extvar: skip decl registration --- diff --git a/src/data.c b/src/data.c index 4f7168f..d5c9765 100644 --- a/src/data.c +++ b/src/data.c @@ -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"); } diff --git a/src/types/decl.c b/src/types/decl.c index 300f5bd..40d8c25 100644 --- a/src/types/decl.c +++ b/src/types/decl.c @@ -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 { diff --git a/src/types/decl.h b/src/types/decl.h index 1ab42f5..eb80802 100644 --- a/src/types/decl.h +++ b/src/types/decl.h @@ -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); diff --git a/src/types/decl_extvar.c b/src/types/decl_extvar.c index e49804c..efbec20 100644 --- a/src/types/decl_extvar.c +++ b/src/types/decl_extvar.c @@ -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; }