From b1b4c10d608c3b2ae1e48167a9df6eee0a038390 Mon Sep 17 00:00:00 2001 From: Michael Beck Date: Wed, 20 Aug 2003 12:47:48 +0000 Subject: [PATCH 1/1] Added prefix to variadicity [r1731] --- ir/ir/irvrfy.c | 2 +- ir/tr/type.c | 15 ++++++++++++++- ir/tr/type.h | 7 +++++-- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/ir/ir/irvrfy.c b/ir/ir/irvrfy.c index beeb0c0ce..3359106c9 100644 --- a/ir/ir/irvrfy.c +++ b/ir/ir/irvrfy.c @@ -365,7 +365,7 @@ int irn_vrfy_irg(ir_node *n, ir_graph *irg) /* Compare arguments of node with those of type */ mt = get_Call_type(n); - if (get_method_variadicity(mt) == variadic) { + if (get_method_variadicity(mt) == variadicity_variadic) { ASSERT_AND_RET( get_Call_n_params(n) >= get_method_n_params(mt), "Number of args for Call doesn't match number of args in variadic type.", diff --git a/ir/tr/type.c b/ir/tr/type.c index 916dad305..865e85561 100644 --- a/ir/tr/type.c +++ b/ir/tr/type.c @@ -858,7 +858,7 @@ INLINE type *new_type_method (ident *name, int n_param, int n_res) { res->attr.ma.n_res = n_res; res->attr.ma.res_type = (type **) xmalloc (sizeof (type *) * n_res); res->attr.ma.value_ress = NULL; - res->attr.ma.variadicity = non_variadic; + res->attr.ma.variadicity = variadicity_non_variadic; return res; } @@ -943,6 +943,19 @@ entity *get_method_value_res_ent(type *method, int pos) { return get_struct_member(method->attr.ma.value_ress, pos); } +/* Returns the null-terminated name of this variadicity. */ +const char *get_variadicity_name(variadicity vari) +{ +#define X(a) case a: return #a + switch (vari) { + X(variadicity_non_variadic); + X(variadicity_variadic); + default: + return "BAD VALUE"; + } +#undef X +} + variadicity get_method_variadicity(type *method) { assert(method && (method->type_op == type_method)); diff --git a/ir/tr/type.h b/ir/tr/type.h index b8d0fd6a5..3b3b33a4d 100644 --- a/ir/tr/type.h +++ b/ir/tr/type.h @@ -554,10 +554,13 @@ entity *get_method_value_res_ent(type *method, int pos); * non_variadic. */ typedef enum variadicity { - non_variadic, /**< non variadic */ - variadic /**< variadic */ + variadicity_non_variadic, /**< non variadic */ + variadicity_variadic /**< variadic */ } variadicity; +/** Returns the null-terminated name of this variadicity. */ +const char *get_variadicity_name(variadicity vari); + /** Returns the variadicity of a method. */ variadicity get_method_variadicity(type *method); -- 2.20.1