X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=type_t.h;h=a793f7aaf27ba388c8ff553cd030842e0ed55b83;hb=c4004b40b7e11ae7ff32c26b330e5f33a7abe2d3;hp=ba998979128a6eb04fe3a633cb2c659dbaf56b13;hpb=c04cde588f09e0ec62693477b885834c5aa7a88a;p=cparser diff --git a/type_t.h b/type_t.h index ba99897..a793f7a 100644 --- a/type_t.h +++ b/type_t.h @@ -1,6 +1,6 @@ /* * This file is part of cparser. - * Copyright (C) 2007-2008 Matthias Braun + * Copyright (C) 2007-2009 Matthias Braun * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -144,7 +144,6 @@ struct function_type_t { bool variadic : 1; bool unspecified_parameters : 1; bool kr_style_parameters : 1; - bool prototyped : 1; }; struct compound_type_t { @@ -289,4 +288,53 @@ static inline bool is_type_valid(const type_t *type) return type->kind != TYPE_ERROR; } +/** + * Allocate a type node of given kind and initialize all + * fields with zero. + * + * @param kind type kind to allocate + */ +type_t *allocate_type_zero(type_kind_t kind); + +/** + * Creates a return_type (func)(void) function type if not + * already exists. + * + * @param return_type the return type + */ +type_t *make_function_0_type(type_t *return_type); + +/** + * Creates a return_type (func)(argument_type) function type if not + * already exists. + * + * @param return_type the return type + * @param argument_type the argument type + */ +type_t *make_function_1_type(type_t *return_type, type_t *argument_type1); + + +/** + * Creates a return_type (func)(argument_type1,argument_type2) function type + * if not already exists. + */ +type_t *make_function_2_type(type_t *return_type, type_t *argument_type1, + type_t *argument_type2); + +/** + * Creates a return_type (func)(argument_type, ...) function type if not + * already exists. + * + * @param return_type the return type + * @param argument_type the argument type + */ +type_t *make_function_1_type_variadic(type_t *return_type, type_t *argument_type); + +/** + * Create a function type with n parameters + */ +type_t *make_function_type(type_t *return_type, int n_types, + type_t *const *argument_types, + decl_modifiers_t modifiers); + #endif