From c789200f5be50079b46482cf24c346bef94ddeb0 Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Sat, 1 Feb 2014 15:40:43 +0900 Subject: [PATCH] add gensym macro --- include/picrin.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/picrin.h b/include/picrin.h index dbe58f12..1cd42654 100644 --- a/include/picrin.h +++ b/include/picrin.h @@ -42,6 +42,14 @@ extern "C" { #define FALLTHROUGH ((void)0) #define UNUSED(v) ((void)(v)) +#define GENSYM2__(x,y) x##y +#define GENSYM1__(x,y) GENSYM2__(x,y) +#if defined(__COUNTER__) +# define GENSYM(x) GENSYM1__(x,__COUNTER__) +#else +# define GENSYM(x) GENSYM1__(x,__LINE__) +#endif + #include "config.h" #include "picrin/value.h"