type_t *handle_type_attributes(const attribute_t *attributes, type_t *type) { const attribute_t *attribute = attributes; for ( ; attribute != NULL; attribute = attribute->next) { switch (attribute->kind) { case ATTRIBUTE_GNU_PACKED: handle_attribute_packed(attribute, type); break; case ATTRIBUTE_GNU_CDECL: case ATTRIBUTE_MS_CDECL: type = change_calling_convention(type, CC_CDECL); break; case ATTRIBUTE_MS_STDCALL: case ATTRIBUTE_GNU_STDCALL: type = change_calling_convention(type, CC_STDCALL); break; case ATTRIBUTE_MS_FASTCALL: case ATTRIBUTE_GNU_FASTCALL: type = change_calling_convention(type, CC_FASTCALL); break; case ATTRIBUTE_MS_THISCALL: type = change_calling_convention(type, CC_THISCALL); break; case ATTRIBUTE_GNU_RETURNS_TWICE: case ATTRIBUTE_MS_RETURNS_TWICE: type = add_modifiers(type, DM_RETURNS_TWICE); break; case ATTRIBUTE_GNU_NORETURN: case ATTRIBUTE_MS_NORETURN: type = add_modifiers(type, DM_NORETURN); break; case ATTRIBUTE_GNU_MALLOC: case ATTRIBUTE_MS_ALLOCATE: type = add_modifiers(type, DM_MALLOC); break; case ATTRIBUTE_GNU_CONST: type = add_modifiers(type, DM_CONST); break; case ATTRIBUTE_GNU_PURE: type = add_modifiers(type, DM_PURE); break; case ATTRIBUTE_GNU_NOTHROW: case ATTRIBUTE_MS_NOTHROW: type = add_modifiers(type, DM_NOTHROW); break; case ATTRIBUTE_GNU_MODE: type = handle_attribute_mode(attribute, type); break; default: break; } } return type; }
type_t *handle_type_attributes(const attribute_t *attributes, type_t *type) { const attribute_t *attribute = attributes; for ( ; attribute != NULL; attribute = attribute->next) { switch (attribute->kind) { case ATTRIBUTE_GNU_PACKED: handle_attribute_packed(attribute, type); break; case ATTRIBUTE_GNU_CDECL: case ATTRIBUTE_MS_CDECL: type = change_calling_convention(type, CC_CDECL); break; case ATTRIBUTE_MS_STDCALL: case ATTRIBUTE_GNU_STDCALL: if (dialect.support_fastcall_stdcall) { type = change_calling_convention(type, CC_STDCALL); } else { warningf(WARN_OTHER, &attribute->pos, "Ignoring attribute 'stdcall' for this target"); } break; case ATTRIBUTE_MS_FASTCALL: case ATTRIBUTE_GNU_FASTCALL: if (dialect.support_fastcall_stdcall) { type = change_calling_convention(type, CC_FASTCALL); } else { warningf(WARN_OTHER, &attribute->pos, "Ignoring attribute 'fastcall' for this target"); } break; case ATTRIBUTE_MS_THISCALL: type = change_calling_convention(type, CC_THISCALL); break; case ATTRIBUTE_GNU_RETURNS_TWICE: case ATTRIBUTE_MS_RETURNS_TWICE: type = add_modifiers(type, DM_RETURNS_TWICE); break; case ATTRIBUTE_GNU_NORETURN: case ATTRIBUTE_MS_NORETURN: type = add_modifiers(type, DM_NORETURN); break; case ATTRIBUTE_GNU_MALLOC: case ATTRIBUTE_MS_ALLOCATE: type = add_modifiers(type, DM_MALLOC); break; case ATTRIBUTE_GNU_CONST: type = add_modifiers(type, DM_CONST); break; case ATTRIBUTE_GNU_PURE: type = add_modifiers(type, DM_PURE); break; case ATTRIBUTE_GNU_NOTHROW: case ATTRIBUTE_MS_NOTHROW: type = add_modifiers(type, DM_NOTHROW); break; case ATTRIBUTE_GNU_MODE: type = handle_attribute_mode(attribute, type); break; default: break; } } return type; }