+/*
+ * This file is part of cparser.
+ * Copyright (C) 2007-2008 Matthias Braun <matze@braunis.de>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
#include <config.h>
#include <stdio.h>
#include <assert.h>
+
#include "type_t.h"
+#include "symbol_t.h"
#include "type_hash.h"
#include "adt/error.h"
static FILE *out;
struct obstack *type_obst = &_type_obst;
static int type_visited = 0;
-static bool print_implicit_array_size = true;
+static bool print_implicit_array_size = false;
static void intern_print_type_pre(const type_t *type, bool top);
static void intern_print_type_post(const type_t *type, bool top);
fprintf(out, "%s", entry->symbol->string);
if(entry->init.initializer != NULL) {
fprintf(out, " = ");
- print_expression(entry->init.enum_value);
+
+ /* skip the implicit cast */
+ expression_t *expression = entry->init.enum_value;
+ if(expression->kind == EXPR_UNARY_CAST_IMPLICIT) {
+ expression = expression->unary.value;
+ }
+ print_expression(expression);
}
fprintf(out, ",\n");
}
type->kind = TYPE_ATOMIC;
type->base.qualifiers = qualifiers;
+ type->base.alignment = 0;
type->atomic.akind = atype;
+ /* TODO: set the aligmnent depending on the atype here */
+
return identify_new_type(type);
}
type->kind = TYPE_POINTER;
type->base.qualifiers = qualifiers;
+ type->base.alignment = 0;
type->pointer.points_to = points_to;
return identify_new_type(type);
type->kind = TYPE_ARRAY;
type->base.qualifiers = qualifiers;
+ type->base.alignment = 0;
type->array.element_type = element_type;
type->array.size = size;
type->array.size_constant = true;