return true;
}
+bool psi_decl_arg_is_pointer(struct psi_decl_arg *darg)
+{
+ if (darg->var->pointer_level) {
+ if (darg->var->array_size) {
+ return darg->var->pointer_level > 1;
+ }
+ return true;
+ } else if (psi_decl_type_is_weak(darg->type) && darg->type->real.def) {
+ return psi_decl_arg_is_pointer(darg->type->real.def);
+ }
+ return false;
+}
+
size_t psi_decl_arg_align(struct psi_decl_arg *darg, size_t *pos, size_t *len)
{
size_t align = psi_decl_arg_get_align(darg);
{
size_t align;
- if (darg->var->pointer_level
- && (!darg->var->array_size || darg->var->pointer_level > 1)) {
+ if (psi_decl_arg_is_pointer(darg)) {
align = psi_t_alignment(PSI_T_POINTER);
} else {
align = psi_decl_type_get_align(darg->type);
if (darg->var->array_size && darg->var->pointer_level > 1) {
size = psi_t_size(PSI_T_POINTER) * darg->var->array_size;
- } else if (!darg->var->array_size && darg->var->pointer_level) {
+ } else if (psi_decl_arg_is_pointer(darg)) {
size = psi_t_size(PSI_T_POINTER);
} else {
switch (real->type) {
bool psi_decl_arg_validate(struct psi_data *data, struct psi_decl_arg *arg, struct psi_validate_scope *scope);
bool psi_decl_arg_validate_typedef(struct psi_data *data, struct psi_decl_arg *def, struct psi_validate_scope *scope);
+bool psi_decl_arg_is_pointer(struct psi_decl_arg *darg);
+
size_t psi_decl_arg_align(struct psi_decl_arg *darg, size_t *pos, size_t *len);
size_t psi_decl_arg_get_align(struct psi_decl_arg *darg);
size_t psi_decl_arg_get_size(struct psi_decl_arg *darg);
bool psi_decl_struct_validate(struct psi_data *data, struct psi_decl_struct *s,
struct psi_validate_scope *scope)
{
- size_t i, pos, len, size, align;
+ size_t i, pos = 0, len = 0;
struct psi_decl_arg *darg, *prev_arg;
if (!s) {
psi_validate_scope_add_struct(scope, s->name, s);
for (i = 0; psi_plist_get(s->args, i, &darg); ++i) {
+ size_t align;
+
darg->var->arg = darg;
if (!psi_decl_arg_validate(data, darg, scope)) {
}
if (psi_plist_count(s->args)) {
+ size_t size;
+
psi_plist_sort(s->args, psi_layout_sort_cmp, NULL);
psi_plist_get(s->args, psi_plist_count(s->args) - 1, &darg);