From 4a947922aefc90d6b08fa83165cbede3d18feb66 Mon Sep 17 00:00:00 2001 From: "N.N." Date: Thu, 14 May 2009 01:04:31 +0000 Subject: make gcc globally shut up about (v)asprintf return values, yet make the return values usable if we want to. svn path=/trunk/; revision=11335 --- desiredata/src/desire.h | 6 ++++++ desiredata/src/kernel.c | 6 ------ 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'desiredata/src') diff --git a/desiredata/src/desire.h b/desiredata/src/desire.h index cbe28e4c..eb1ef989 100644 --- a/desiredata/src/desire.h +++ b/desiredata/src/desire.h @@ -360,4 +360,10 @@ EXTERN int pd_stackn; EXTERN int gstack_empty(); /* that's a completely different stack: see pd_pushsym,pd_popsym */ +class Error {}; +class VeryUnlikelyError : Error {}; +int throw_if_negative(int n) {if (n<0) throw VeryUnlikelyError(); else return n;} +#define asprintf(ARGS...) throw_if_negative( asprintf(ARGS)) +#define vasprintf(ARGS...) throw_if_negative(vasprintf(ARGS)) + #endif /* __DESIRE_H */ diff --git a/desiredata/src/kernel.c b/desiredata/src/kernel.c index c5fd2b68..25577f41 100644 --- a/desiredata/src/kernel.c +++ b/desiredata/src/kernel.c @@ -36,12 +36,6 @@ #define a_gpointer a_w.w_gpointer #define a_index a_w.w_index -class Error {}; -class VeryUnlikelyError : Error {}; - -#define asprintf(ARGS...) do {if ( asprintf(ARGS)<0) throw VeryUnlikelyError();} while(0) -#define vasprintf(ARGS...) do {if (vasprintf(ARGS)<0) throw VeryUnlikelyError();} while(0) - using namespace std; /* T.Grill - bit alignment for signal vectors (must be a multiple of 8!) */ -- cgit v1.2.1