: "r" (x));
return 31 - res;
#else
- x |= x >> 1;
+ x |= x >> 1;
x |= x >> 2;
x |= x >> 4;
x |= x >> 8;
char *xstrdup(const char *str)
{
- size_t len = strlen(str) + 1;
+ size_t len = strlen(str) + 1;
char *res = xmalloc(len);
memcpy(res, str, len);
case EXPR_UNARY_CAST: {
type_t *dest = skip_typeref(expression->base.type);
if (!is_type_pointer(dest) && (
- dest->kind != TYPE_ATOMIC ||
- !(get_atomic_type_flags(dest->atomic.akind) & ATOMIC_TYPE_FLAG_INTEGER) ||
- get_atomic_type_size(dest->atomic.akind) < get_atomic_type_size(get_intptr_kind())
+ dest->kind != TYPE_ATOMIC ||
+ !(get_atomic_type_flags(dest->atomic.akind) & ATOMIC_TYPE_FLAG_INTEGER) ||
+ get_atomic_type_size(dest->atomic.akind) < get_atomic_type_size(get_intptr_kind())
))
return false;
/* we're past the last member of the current sub-aggregate, try if we
* can ascend in the type hierarchy and continue with another subobject */
- size_t len = ARR_LEN(path->path);
+ size_t len = ARR_LEN(path->path);
if (len > 1) {
ascend_from_subtype(path);
switch(attribute->kind) {
case ATTRIBUTE_GNU_PACKED:
handle_attribute_packed(attribute, type);
- break;
+ break;
case ATTRIBUTE_GNU_CDECL:
case ATTRIBUTE_MS_CDECL:
type = change_calling_convention(type, CC_CDECL);
/**
* prints the firm version number
*/
-void print_firm_version(FILE *f) {
- const char *revision = ir_get_version_revision();
- const char *build = ir_get_version_build();
+void print_firm_version(FILE *f)
+{
+ const char *revision = ir_get_version_revision();
+ const char *build = ir_get_version_build();
- fprintf(f, "Firm C-Compiler using libFirm (%u.%u",
- ir_get_version_major(), ir_get_version_minor());
- if (revision[0] != 0) {
- fputc(' ', f);
- fputs(revision, f);
- }
- if(build[0] != 0) {
- fputc(' ', f);
- fputs(build, f);
- }
- fprintf(f, "}\n"
- "(C) 2005-2008 Michael Beck\n"
- "(C) 1995-2008 University of Karlsruhe\n"
- "Using ");
+ fprintf(f, "Firm C-Compiler using libFirm (%u.%u",
+ ir_get_version_major(), ir_get_version_minor());
+ if (revision[0] != 0) {
+ fputc(' ', f);
+ fputs(revision, f);
+ }
+ if (build[0] != 0) {
+ fputc(' ', f);
+ fputs(build, f);
+ }
+ fprintf(f, "}\n"
+ "(C) 2005-2008 Michael Beck\n"
+ "(C) 1995-2008 University of Karlsruhe\n"
+ "Using ");
} /* print_firm_version */
* Calls the specified backend.
* Code is written to file <file_name> ('.c' is substituted for '.asm')
*/
-void do_codegen(FILE *out, const char *file_name) {
- FILE *close_out = NULL;
- if (out == NULL) {
- char *asm_file_name = generate_asm_file_name(file_name);
+void do_codegen(FILE *out, const char *file_name)
+{
+ FILE *close_out = NULL;
+ if (out == NULL) {
+ char *asm_file_name = generate_asm_file_name(file_name);
- if ((out = fopen(asm_file_name, "w")) == NULL) {
- fprintf(stderr, "Could not open output file %s\n", asm_file_name);
- exit(1);
- }
- free(asm_file_name);
- close_out = out;
- }
+ if ((out = fopen(asm_file_name, "w")) == NULL) {
+ fprintf(stderr, "Could not open output file %s\n", asm_file_name);
+ exit(1);
+ }
+ free(asm_file_name);
+ close_out = out;
+ }
- switch (firm_be_opt.selection) {
+ switch (firm_be_opt.selection) {
#ifdef FIRM2C_BACKEND
- case BE_FIRM2C: {
- ir_timer_t *timer = ir_timer_new();
- timer_register(timer, "Firm: C-generating backend");
- timer_start(timer);
- generate_code_file(out);
- timer_stop(timer);
- break;
- }
+ case BE_FIRM2C: {
+ ir_timer_t *timer = ir_timer_new();
+ timer_register(timer, "Firm: C-generating backend");
+ timer_start(timer);
+ generate_code_file(out);
+ timer_stop(timer);
+ break;
+ }
#endif
- case BE_FIRM_BE: {
- ir_timer_t *timer = ir_timer_new();
- timer_register(timer, "Firm: backend");
- timer_start(timer);
- be_main(out, file_name);
- timer_stop(timer);
- break;
- }
+ case BE_FIRM_BE: {
+ ir_timer_t *timer = ir_timer_new();
+ timer_register(timer, "Firm: backend");
+ timer_start(timer);
+ be_main(out, file_name);
+ timer_stop(timer);
+ break;
+ }
- default:
- fprintf(stderr, "Fatal: Unknown backend %d\n", firm_be_opt.selection);
- } /* switch (firm_be_opt.selection) */
+ default:
+ fprintf(stderr, "Fatal: Unknown backend %d\n", firm_be_opt.selection);
+ } /* switch (firm_be_opt.selection) */
- if (close_out)
- fclose(close_out);
+ if (close_out)
+ fclose(close_out);
}
return ASSIGN_WARNING_POINTER_FROM_INT;
}
} else if ((is_type_arithmetic(type_left) && is_type_arithmetic(type_right)) ||
- (is_type_atomic(type_left, ATOMIC_TYPE_BOOL)
- && is_type_pointer(type_right))) {
+ (is_type_atomic(type_left, ATOMIC_TYPE_BOOL)
+ && is_type_pointer(type_right))) {
return ASSIGN_SUCCESS;
} else if ((is_type_compound(type_left) && is_type_compound(type_right))
|| (is_type_builtin(type_left) && is_type_builtin(type_right))) {
long array_size = type->array.size;
if (index >= array_size) {
errorf(&designator->source_position,
- "designator [%E] (%d) exceeds array size %d",
- array_index, index, array_size);
+ "designator [%E] (%d) exceeds array size %d",
+ array_index, index, array_size);
}
}
}
bool in_function_scope = current_function != NULL;
if (specifiers->thread_local || (
- specifiers->storage_class != STORAGE_CLASS_EXTERN &&
- specifiers->storage_class != STORAGE_CLASS_NONE &&
- (in_function_scope || specifiers->storage_class != STORAGE_CLASS_STATIC)
- )) {
+ specifiers->storage_class != STORAGE_CLASS_EXTERN &&
+ specifiers->storage_class != STORAGE_CLASS_NONE &&
+ (in_function_scope || specifiers->storage_class != STORAGE_CLASS_STATIC)
+ )) {
errorf(&env.source_position,
"invalid storage class for function '%Y'", env.symbol);
}
result_type = pointer_type;
} else {
if (is_type_valid(other_type)) {
- type_error_incompatible("while parsing conditional",
+ type_error_incompatible("while parsing conditional",
&expression->base.source_position, true_type, false_type);
}
result_type = type_error_type;
switch (CC) {
case ' ':
case '\t':
- if(do_print_spaces)
+ if (do_print_spaces)
counted_spaces++;
- next_char();
+ next_char();
continue;
case '/':
next_char();
switch(CC) {
case ' ':
case '\t':
- if(do_print_spaces)
+ if (do_print_spaces)
counted_spaces++;
- next_char();
+ next_char();
goto restart;
MATCH_NEWLINE(
if (old_definition != NULL) {
if (!pp_definitions_equal(old_definition, new_definition)) {
warningf(&input.position, "multiple definition of macro '%Y' (first defined %P)",
- symbol, &old_definition->source_position);
+ symbol, &old_definition->source_position);
} else {
/* reuse the old definition */
obstack_free(&pp_obstack, new_definition);
if ((*c & 0x80) == 0) {
/* 1 character encoding: 0b0??????? */
- result = *c++;
+ result = *c++;
} else if ((*c & 0xE0) == 0xC0) {
/* 2 character encoding: 0b110?????, 0b10?????? */
result = *c++ & 0x1F;