From e3bef0bd84c1ef6b86f33b34a64f00fbd7fb0079 Mon Sep 17 00:00:00 2001 From: Sebastian Hack Date: Thu, 24 Feb 2005 15:23:47 +0000 Subject: [PATCH] Fixed irprintf for usage with libcore [r5247] --- ir/ir/Makefile.in | 4 +--- ir/ir/irprintf.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++ ir/ir/irprintf.h | 10 --------- 3 files changed, 57 insertions(+), 13 deletions(-) diff --git a/ir/ir/Makefile.in b/ir/ir/Makefile.in index 4dd4a1b66..695c8e609 100644 --- a/ir/ir/Makefile.in +++ b/ir/ir/Makefile.in @@ -29,12 +29,10 @@ SOURCES += Makefile.in \ irgwalk.c irgwalk_blk.c irdump.c irdumptxt.c irgopt.c irgopt_t.h irnode_t.h \ irmode.c irop.c irprog.c irflag.c irflag_t.h irgraph.c irprintf_t.h \ irmode_t.h irop_t.h irprog_t.h ircgcons.c ircgopt.c irreflect.c irarch.c \ - pseudo_irg.c irhooks.c iredges.c + pseudo_irg.c irhooks.c iredges.c irprintf.c ifeq ($(enable_libcore),yes) SOURCES += irargs.c -else -SOURCES += irprintf.c endif include $(topdir)/MakeRules diff --git a/ir/ir/irprintf.c b/ir/ir/irprintf.c index 5e1f23b02..7555c4ef7 100644 --- a/ir/ir/irprintf.c +++ b/ir/ir/irprintf.c @@ -34,6 +34,7 @@ #include +#include "firm_config.h" #include "ident.h" #include "irmode_t.h" #include "irnode_t.h" @@ -154,6 +155,8 @@ static const appender_t obst_appender = { obst_append_str }; +#ifndef WITH_LIBCORE + static void ir_common_vprintf(const appender_t *app, void *object, size_t limit, const char *fmt, va_list args); @@ -595,3 +598,56 @@ void ir_obst_vprintf(struct obstack *obst, const char *fmt, va_list args) { ir_common_vprintf(&obst_appender, obst, 0, fmt, args); } + +#else + +#include "irargs_t.h" + +void ir_printf(const char *fmt, ...) +{ + va_list args; + + va_start(args, fmt); + lc_evprintf(firm_get_arg_env(), fmt, args); + va_end(args); +} + +void ir_fprintf(FILE *f, const char *fmt, ...) +{ + va_list args; + + va_start(args, fmt); + lc_evfprintf(firm_get_arg_env(), f, fmt, args); + va_end(args); +} + +void ir_snprintf(char *buf, size_t n, const char *fmt, ...) +{ + va_list args; + + va_start(args, fmt); + lc_evsnprintf(firm_get_arg_env(), buf, n, fmt, args); + va_end(args); +} + +void ir_vprintf(const char *fmt, va_list args) +{ + lc_evprintf(firm_get_arg_env(), fmt, args); +} + +void ir_vfprintf(FILE *f, const char *fmt, va_list args) +{ + lc_evfprintf(firm_get_arg_env(), f, fmt, args); +} + +void ir_vsnprintf(char *buf, size_t len, const char *fmt, va_list args) +{ + lc_evsnprintf(firm_get_arg_env(), buf, len, fmt, args); +} + +void ir_obst_vprintf(struct obstack *obst, const char *fmt, va_list args) +{ + lc_evoprintf(firm_get_arg_env(), obst, fmt, args); +} + +#endif diff --git a/ir/ir/irprintf.h b/ir/ir/irprintf.h index d4496316a..a93c0bbb4 100644 --- a/ir/ir/irprintf.h +++ b/ir/ir/irprintf.h @@ -135,17 +135,7 @@ void ir_vsnprintf(char *buf, size_t len, const char *fmt, va_list args); void ir_obst_vprintf(struct obstack *obst, const char *fmt, va_list args); #ifdef WITH_LIBCORE -/* use libcore */ -#define ir_printf lc_printf -#define ir_fprintf lc_fprintf -#define ir_snprintf lc_snprintf -#define ir_vprintf lc_vprintf -#define ir_vfprintf lc_vfprintf -#define ir_vsnprintf lc_vsnprintf -#define ir_obst_vprintf lc_voprintf - #include - #endif /* WITH_LIBCORE */ #endif /* _IRPRINTF_H */ -- 2.20.1