projects
/
cparser
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ast2firm: Use conv_to_storage_type().
[cparser]
/
attribute.c
diff --git
a/attribute.c
b/attribute.c
index
71f91d3
..
118f046
100644
(file)
--- a/
attribute.c
+++ b/
attribute.c
@@
-132,8
+132,7
@@
type_t *handle_attribute_mode(const attribute_t *attribute, type_t *orig_type)
* specific modes (according to gcc philosophy that is...) */
attribute_argument_t *arg = attribute->a.arguments;
if (arg == NULL) {
* specific modes (according to gcc philosophy that is...) */
attribute_argument_t *arg = attribute->a.arguments;
if (arg == NULL) {
- errorf(&attribute->source_position,
- "__attribute__((mode(X))) misses argument");
+ errorf(&attribute->pos, "__attribute__((mode(X))) misses argument");
return orig_type;
}
return orig_type;
}
@@
-152,8
+151,8
@@
type_t *handle_attribute_mode(const attribute_t *attribute, type_t *orig_type)
} else if (streq_underscore("DI", symbol_str)) {
akind = sign ? ATOMIC_TYPE_LONGLONG : ATOMIC_TYPE_ULONGLONG;
} else {
} else if (streq_underscore("DI", symbol_str)) {
akind = sign ? ATOMIC_TYPE_LONGLONG : ATOMIC_TYPE_ULONGLONG;
} else {
- source_position_t const *const pos = &attribute->source_position;
-
warningf(WARN_OTHER, pos, "ignoring unknown mode '%s'",
symbol_str);
+ warningf(WARN_OTHER, &attribute->pos, "ignoring unknown mode '%s'",
+
symbol_str);
return orig_type;
}
return orig_type;
}
@@
-162,12
+161,11
@@
type_t *handle_attribute_mode(const attribute_t *attribute, type_t *orig_type)
copy->atomic.akind = akind;
return identify_new_type(copy);
} else if (is_type_pointer(type)) {
copy->atomic.akind = akind;
return identify_new_type(copy);
} else if (is_type_pointer(type)) {
- source_position_t const *const pos = &attribute->source_position;
- warningf(WARN_OTHER, pos, "__attribute__((mode)) on pointers not implemented yet (ignored)");
+ warningf(WARN_OTHER, &attribute->pos, "__attribute__((mode)) on pointers not implemented yet (ignored)");
return type;
}
return type;
}
- errorf(&attribute->
source_position
,
+ errorf(&attribute->
pos
,
"__attribute__((mode)) only allowed on integer, enum or pointer type");
return orig_type;
}
"__attribute__((mode)) only allowed on integer, enum or pointer type");
return orig_type;
}
@@
-188,15
+186,11
@@
static void handle_attribute_aligned(const attribute_t *attribute,
}
if (!is_po2(alignment)) {
}
if (!is_po2(alignment)) {
- errorf(&attribute->source_position,
- "alignment must be a power of 2 but is %d\n",
- alignment);
+ errorf(&attribute->pos, "alignment must be a power of 2 but is %d", alignment);
return;
}
if (alignment <= 0) {
return;
}
if (alignment <= 0) {
- errorf(&attribute->source_position,
- "alignment must be bigger than 0 but is %d\n",
- alignment);
+ errorf(&attribute->pos, "alignment must be bigger than 0 but is %d", alignment);
return;
}
return;
}
@@
-214,7
+208,7
@@
static void handle_attribute_aligned(const attribute_t *attribute,
break;
default:
break;
default:
- warningf(WARN_OTHER, &attribute->
source_position
, "alignment attribute specification on '%N' ignored", entity);
+ warningf(WARN_OTHER, &attribute->
pos
, "alignment attribute specification on '%N' ignored", entity);
break;
}
}
break;
}
}
@@
-238,19
+232,19
@@
static void handle_attribute_visibility(const attribute_t *attribute,
* specific modes (according to gcc philosophy that is...) */
attribute_argument_t *arg = attribute->a.arguments;
if (arg == NULL) {
* specific modes (according to gcc philosophy that is...) */
attribute_argument_t *arg = attribute->a.arguments;
if (arg == NULL) {
- errorf(&attribute->
source_position
,
+ errorf(&attribute->
pos
,
"__attribute__((visibility(X))) misses argument");
return;
}
const char *string = get_argument_string(arg);
if (string == NULL) {
"__attribute__((visibility(X))) misses argument");
return;
}
const char *string = get_argument_string(arg);
if (string == NULL) {
- errorf(&attribute->
source_position
,
+ errorf(&attribute->
pos
,
"__attribute__((visibility(X))) argument is not a string");
return;
}
elf_visibility_tag_t visibility = get_elf_visibility_from_string(string);
if (visibility == ELF_VISIBILITY_ERROR) {
"__attribute__((visibility(X))) argument is not a string");
return;
}
elf_visibility_tag_t visibility = get_elf_visibility_from_string(string);
if (visibility == ELF_VISIBILITY_ERROR) {
- errorf(&attribute->
source_position
,
+ errorf(&attribute->
pos
,
"unknown visibility type '%s'", string);
return;
}
"unknown visibility type '%s'", string);
return;
}
@@
-264,7
+258,7
@@
static void handle_attribute_visibility(const attribute_t *attribute,
break;
default:
break;
default:
- warningf(WARN_OTHER, &attribute->
source_position
, "visibility attribute specification on '%N' ignored", entity);
+ warningf(WARN_OTHER, &attribute->
pos
, "visibility attribute specification on '%N' ignored", entity);
break;
}
}
break;
}
}
@@
-274,8
+268,8
@@
static void warn_arguments(const attribute_t *attribute)
if (attribute->a.arguments == NULL)
return;
if (attribute->a.arguments == NULL)
return;
-
source_position_t const *const pos = &attribute->source_position
;
- char
const *const what = get_attribute_name(attribute->kind);
+
position_t const *const pos = &attribute->pos
;
+ char const *const what = get_attribute_name(attribute->kind);
warningf(WARN_OTHER, pos, "attribute '%s' needs no arguments", what);
}
warningf(WARN_OTHER, pos, "attribute '%s' needs no arguments", what);
}
@@
-284,7
+278,7
@@
static void handle_attribute_packed_e(const attribute_t *attribute,
{
#if 0
if (entity->kind != ENTITY_STRUCT) {
{
#if 0
if (entity->kind != ENTITY_STRUCT) {
- warningf(WARN_OTHER, &attribute->
source_position
, "packed attribute on '%N' ignored", entity);
+ warningf(WARN_OTHER, &attribute->
pos
, "packed attribute on '%N' ignored", entity);
return;
}
#endif
return;
}
#endif
@@
-296,7
+290,7
@@
static void handle_attribute_packed_e(const attribute_t *attribute,
static void handle_attribute_packed(const attribute_t *attribute, type_t *type)
{
if (type->kind != TYPE_COMPOUND_STRUCT) {
static void handle_attribute_packed(const attribute_t *attribute, type_t *type)
{
if (type->kind != TYPE_COMPOUND_STRUCT) {
-
source_position_t const *const pos = &attribute->source_position
;
+
position_t const *const pos = &attribute->pos
;
warningf(WARN_OTHER, pos, "packed attribute on type '%T' ignored", type);
return;
}
warningf(WARN_OTHER, pos, "packed attribute on type '%T' ignored", type);
return;
}
@@
-311,8
+305,7
@@
static void handle_attribute_asm(const attribute_t *attribute,
assert (argument->kind == ATTRIBUTE_ARGUMENT_EXPRESSION);
expression_t *expression = argument->v.expression;
if (expression->kind != EXPR_STRING_LITERAL)
assert (argument->kind == ATTRIBUTE_ARGUMENT_EXPRESSION);
expression_t *expression = argument->v.expression;
if (expression->kind != EXPR_STRING_LITERAL)
- errorf(&attribute->source_position,
- "Invalid asm attribute expression");
+ errorf(&attribute->pos, "Invalid asm attribute expression");
symbol_t *sym = symbol_table_insert(expression->string_literal.value.begin);
entity->function.actual_name = sym;
assert(argument->next == NULL);
symbol_t *sym = symbol_table_insert(expression->string_literal.value.begin);
entity->function.actual_name = sym;
assert(argument->next == NULL);
@@
-334,7
+327,7
@@
void handle_entity_attributes(const attribute_t *attributes, entity_t *entity)
decl_modifiers_t modifiers = 0;
const attribute_t *attribute = attributes;
for ( ; attribute != NULL; attribute = attribute->next) {
decl_modifiers_t modifiers = 0;
const attribute_t *attribute = attributes;
for ( ; attribute != NULL; attribute = attribute->next) {
- switch(attribute->kind) {
+ switch
(attribute->kind) {
case ATTRIBUTE_GNU_CONST: modifiers |= DM_CONST; break;
case ATTRIBUTE_GNU_DEPRECATED: modifiers |= DM_DEPRECATED; break;
case ATTRIBUTE_GNU_NOINLINE: modifiers |= DM_NOINLINE; break;
case ATTRIBUTE_GNU_CONST: modifiers |= DM_CONST; break;
case ATTRIBUTE_GNU_DEPRECATED: modifiers |= DM_DEPRECATED; break;
case ATTRIBUTE_GNU_NOINLINE: modifiers |= DM_NOINLINE; break;
@@
-383,7
+376,7
@@
void handle_entity_attributes(const attribute_t *attributes, entity_t *entity)
}
if (modifiers != 0) {
}
if (modifiers != 0) {
- switch(entity->kind) {
+ switch
(entity->kind) {
case ENTITY_TYPEDEF:
entity->typedefe.modifiers |= modifiers;
break;
case ENTITY_TYPEDEF:
entity->typedefe.modifiers |= modifiers;
break;
@@
-435,7
+428,7
@@
type_t *handle_type_attributes(const attribute_t *attributes, type_t *type)
{
const attribute_t *attribute = attributes;
for ( ; attribute != NULL; attribute = attribute->next) {
{
const attribute_t *attribute = attributes;
for ( ; attribute != NULL; attribute = attribute->next) {
- switch(attribute->kind) {
+ switch
(attribute->kind) {
case ATTRIBUTE_GNU_PACKED:
handle_attribute_packed(attribute, type);
break;
case ATTRIBUTE_GNU_PACKED:
handle_attribute_packed(attribute, type);
break;
@@
-513,7
+506,7
@@
static bool attribute_argument_equal(const attribute_argument_t *arg1,
/* TODO */
return false;
}
/* TODO */
return false;
}
- panic("
Unknown argument type found
");
+ panic("
unknown argument type
");
}
static bool attribute_arguments_equal(const attribute_argument_t *args1,
}
static bool attribute_arguments_equal(const attribute_argument_t *args1,