return compound->irtype;
}
- symbol_t *symbol = compound->base.symbol;
+ symbol_t *type_symbol = compound->base.symbol;
ident *id;
- if (symbol != NULL) {
- id = new_id_from_str(symbol->string);
+ if (type_symbol != NULL) {
+ id = new_id_from_str(type_symbol->string);
} else {
if (is_union) {
id = id_unique("__anonymous_union.%u");
assert(call->function->kind == EXPR_REFERENCE);
reference_expression_t *builtin = &call->function->reference;
- type_t *type = skip_typeref(builtin->base.type);
- assert(is_type_pointer(type));
+ type_t *expr_type = skip_typeref(builtin->base.type);
+ assert(is_type_pointer(expr_type));
- type_t *function_type = skip_typeref(type->pointer.points_to);
+ type_t *function_type = skip_typeref(expr_type->pointer.points_to);
switch (builtin->entity->function.btk) {
case bk_gnu_builtin_alloca: {
expression_t *expression = argument->expression;
ir_node *arg_node = expression_to_firm(expression);
- type_t *type = skip_typeref(expression->base.type);
- if (!is_type_compound(type)) {
+ type_t *arg_type = skip_typeref(expression->base.type);
+ if (!is_type_compound(arg_type)) {
ir_mode *mode = get_ir_mode_storage(expression->base.type);
arg_node = create_conv(dbgi, arg_node, mode);
arg_node = do_strict_conv(dbgi, arg_node);
ir_node *value = expression_to_firm(initializer_value->value);
- type_t *type = initializer_value->value->base.type;
- ir_mode *mode = get_ir_mode_storage(type);
+ type_t *init_type = initializer_value->value->base.type;
+ ir_mode *mode = get_ir_mode_storage(init_type);
value = create_conv(dbgi, value, mode);
value = do_strict_conv(dbgi, value);
type_t *type = current_function_entity->declaration.type;
ir_type *func_irtype = get_ir_type(type);
-
ir_node *in[1];
int in_len;
if (get_method_n_ress(func_irtype) > 0) {
if (statement->value != NULL) {
ir_node *node = expression_to_firm(statement->value);
if (!is_compound_type(res_type)) {
- type_t *type = statement->value->base.type;
- ir_mode *mode = get_ir_mode_storage(type);
- node = create_conv(dbgi, node, mode);
- node = do_strict_conv(dbgi, node);
+ type_t *ret_value_type = statement->value->base.type;
+ ir_mode *mode = get_ir_mode_storage(ret_value_type);
+ node = create_conv(dbgi, node, mode);
+ node = do_strict_conv(dbgi, node);
}
in[0] = node;
} else {
}
if (needs_entity) {
- ir_entity *entity = get_method_value_param_ent(function_irtype, n);
- ident *id = new_id_from_str(parameter->base.symbol->string);
- set_entity_ident(entity, id);
+ ir_entity *param = get_method_value_param_ent(function_irtype, n);
+ ident *id = new_id_from_str(parameter->base.symbol->string);
+ set_entity_ident(param, id);
parameter->declaration.kind
= DECLARATION_KIND_PARAMETER_ENTITY;
- parameter->parameter.v.entity = entity;
+ parameter->parameter.v.entity = param;
continue;
}
int align_all = 4;
int offset = 0;
for (int i = 0; i < n; ++i) {
- ir_entity *entity = get_compound_member(frame_type, i);
- ir_type *entity_type = get_entity_type(entity);
+ ir_entity *member = get_compound_member(frame_type, i);
+ ir_type *entity_type = get_entity_type(member);
int align = get_type_alignment_bytes(entity_type);
if (align > align_all)
}
}
- set_entity_offset(entity, offset);
+ set_entity_offset(member, offset);
offset += get_type_size_bytes(entity_type);
}
set_type_size_bytes(frame_type, offset);
strstart(orig_opt, "align-functions=")) {
fprintf(stderr, "ignoring gcc option '-f%s'\n", orig_opt);
} else if (strstart(orig_opt, "visibility=")) {
- const char *arg = strchr(orig_opt, '=')+1;
+ const char *val = strchr(orig_opt, '=')+1;
elf_visibility_tag_t visibility
- = get_elf_visibility_from_string(arg);
+ = get_elf_visibility_from_string(val);
if (visibility == ELF_VISIBILITY_ERROR) {
fprintf(stderr, "invalid visibility '%s' specified\n",
- arg);
+ val);
argument_errors = true;
} else {
set_default_visibility(visibility);
GET_ARG_AFTER(opt, "-march=");
snprintf(arch_opt, sizeof(arch_opt), "%s-arch=%s", cpu_arch, opt);
int res = be_parse_arg(arch_opt);
+ snprintf(arch_opt, sizeof(arch_opt), "%s-opt=%s", cpu_arch, opt);
+ res &= be_parse_arg(arch_opt);
+
if (res == 0) {
fprintf(stderr, "Unknown architecture '%s'\n", arch_opt);
argument_errors = true;
- } else {
- snprintf(arch_opt, sizeof(arch_opt), "%s-opt=%s", cpu_arch, opt);
- int res = be_parse_arg(arch_opt);
- if (res == 0)
- argument_errors = true;
}
} else if (strstart(opt, "tune=")) {
GET_ARG_AFTER(opt, "-mtune=");
preprocessed_in = preprocess(filename, filetype);
if (mode == PreprocessOnly) {
copy_file(out, preprocessed_in);
- int result = pclose(preprocessed_in);
+ int pp_result = pclose(preprocessed_in);
fclose(out);
/* remove output file in case of error */
- if (out != stdout && result != EXIT_SUCCESS) {
+ if (out != stdout && pp_result != EXIT_SUCCESS) {
unlink(outname);
}
- return result;
+ return pp_result;
}
in = preprocessed_in;
parameter_type = not_promoted;
}
}
- function_parameter_t *const parameter
+ function_parameter_t *const function_parameter
= allocate_parameter(parameter_type);
- *anchor = parameter;
- anchor = ¶meter->next;
+ *anchor = function_parameter;
+ anchor = &function_parameter->next;
}
new_type->function.parameters = parameters;
case STATEMENT_DECLARATION: {
declaration_statement_t const *const decl = &stmt->declaration;
entity_t const * ent = decl->declarations_begin;
- entity_t const *const last = decl->declarations_end;
+ entity_t const *const last_decl = decl->declarations_end;
if (ent != NULL) {
for (;; ent = ent->base.next) {
if (ent->kind == ENTITY_VARIABLE &&
- ent->variable.initializer != NULL &&
- !initializer_returns(ent->variable.initializer)) {
+ ent->variable.initializer != NULL &&
+ !initializer_returns(ent->variable.initializer)) {
return;
}
- if (ent == last)
+ if (ent == last_decl)
break;
}
}
/* do default promotion for other arguments */
for (; argument != NULL; argument = argument->next) {
- type_t *type = argument->expression->base.type;
- if (!is_type_object(skip_typeref(type))) {
+ type_t *argument_type = argument->expression->base.type;
+ if (!is_type_object(skip_typeref(argument_type))) {
errorf(&argument->expression->base.source_position,
"call argument '%E' must not be void", argument->expression);
}
- type = get_default_promoted_type(type);
+ argument_type = get_default_promoted_type(argument_type);
argument->expression
- = create_implicit_cast(argument->expression, type);
+ = create_implicit_cast(argument->expression, argument_type);
}
check_format(call);
/* complex and imaginary types are set in init_types */
};
+static inline bool is_po2(unsigned x)
+{
+ return (x & (x-1)) == 0;
+}
+
void init_types(void)
{
obstack_init(type_obst);
if (long_double_size > 0) {
props[ATOMIC_TYPE_LONG_DOUBLE].size = long_double_size;
- props[ATOMIC_TYPE_LONG_DOUBLE].alignment = long_double_size;
+ if (is_po2(long_double_size)) {
+ props[ATOMIC_TYPE_LONG_DOUBLE].alignment = long_double_size;
+ }
} else {
props[ATOMIC_TYPE_LONG_DOUBLE] = props[ATOMIC_TYPE_DOUBLE];
}
} else {
print_string(", ");
}
- const type_t *const type = parameter->declaration.type;
- if (type == NULL) {
+ const type_t *const param_type = parameter->declaration.type;
+ if (param_type == NULL) {
print_string(parameter->base.symbol->string);
} else {
- print_type_ext(type, parameter->base.symbol, NULL);
+ print_type_ext(param_type, parameter->base.symbol, NULL);
}
}
}