Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#include "data.h"
-
-decl_union* init_decl_union(const char* name, decl_args* args) {
- decl_union* u = calloc(1, sizeof(*u));
+struct psi_decl_union* psi_decl_union_init(const char *name,
+ struct psi_plist *args)
+{
+ struct psi_decl_union *u = calloc(1, sizeof(*u));
-void free_decl_union(decl_union* u) {
- if (u->token) {
- free(u->token);
- }
- if (u->args) {
- free_decl_args(u->args);
+void psi_decl_union_free(struct psi_decl_union **u_ptr)
+{
+ if (*u_ptr) {
+ struct psi_decl_union *u = *u_ptr;
+
+ *u_ptr = NULL;
+ if (u->token) {
+ free(u->token);
+ }
+ if (u->args) {
+ psi_plist_free(u->args);
+ }
+ free(u->name);
+ free(u);
dprintf(fd, "union %s::(%zu, %zu)", unn->name, unn->align, unn->size);
dprintf(fd, "union %s::(%zu, %zu)", unn->name, unn->align, unn->size);
- if (unn->args && unn->args->count) {
- dump_decl_args_with_layout(fd, unn->args, 0);
+ if (psi_plist_count(unn->args)) {
+ psi_decl_type_dump_args_with_layout(fd, unn->args, 0);
size_t i, pos, len, size = 0, align;
size_t i, pos, len, size = 0, align;
data->error(data, u->token, PSI_WARNING,
data->error(data, u->token, PSI_WARNING,
if (darg->layout->pos != 0) {
data->error(data, darg->token, PSI_WARNING,
if (darg->layout->pos != 0) {
data->error(data, darg->token, PSI_WARNING,
- "Offset of %s.%s should be 0",
- u->name, darg->var->name);
+ "Offset of %s.%s should be 0", u->name,
+ darg->var->name);
- align = align_decl_arg(darg, &pos, &len);
- darg->layout = init_decl_struct_layout(pos, len);
-
+ align = psi_decl_arg_align(darg, &pos, &len);
+ darg->layout = psi_layout_init(pos, len);