diff options
Diffstat (limited to 'libguile/eval.c')
-rw-r--r-- | libguile/eval.c | 57 |
1 files changed, 22 insertions, 35 deletions
diff --git a/libguile/eval.c b/libguile/eval.c index 1b18c688a..0e92241a6 100644 --- a/libguile/eval.c +++ b/libguile/eval.c @@ -27,25 +27,9 @@ # include <config.h> #endif -#include "libguile/__scm.h" +#include <alloca.h> -/* This blob per the Autoconf manual (under "Particular Functions"). */ -#if HAVE_ALLOCA_H -# include <alloca.h> -#elif defined __GNUC__ -# define alloca __builtin_alloca -#elif defined _AIX -# define alloca __alloca -#elif defined _MSC_VER -# include <malloc.h> -# define alloca _alloca -#else -# include <stddef.h> -# ifdef __cplusplus -extern "C" -# endif -void *alloca (size_t); -#endif +#include "libguile/__scm.h" #include <assert.h> #include "libguile/_scm.h" @@ -874,26 +858,29 @@ macroexp (SCM x, SCM env) SCM_SETCAR (x, orig_sym); /* Undo memoizing effect of lookupcar */ res = scm_call_2 (SCM_MACRO_CODE (proc), x, env); - + if (scm_ilength (res) <= 0) - res = scm_list_2 (SCM_IM_BEGIN, res); - - /* njrev: Several queries here: (1) I don't see how it can be - correct that the SCM_SETCAR 2 lines below this comment needs - protection, but the SCM_SETCAR 6 lines above does not, so - something here is probably wrong. (2) macroexp() is now only - used in one place - scm_m_generalized_set_x - whereas all other - macro expansion happens through expand_user_macros. Therefore - (2.1) perhaps macroexp() could be eliminated completely now? - (2.2) Does expand_user_macros need any critical section - protection? */ + /* Result of expansion is not a list. */ + return (scm_list_2 (SCM_IM_BEGIN, res)); + else + { + /* njrev: Several queries here: (1) I don't see how it can be + correct that the SCM_SETCAR 2 lines below this comment needs + protection, but the SCM_SETCAR 6 lines above does not, so + something here is probably wrong. (2) macroexp() is now only + used in one place - scm_m_generalized_set_x - whereas all other + macro expansion happens through expand_user_macros. Therefore + (2.1) perhaps macroexp() could be eliminated completely now? + (2.2) Does expand_user_macros need any critical section + protection? */ - SCM_CRITICAL_SECTION_START; - SCM_SETCAR (x, SCM_CAR (res)); - SCM_SETCDR (x, SCM_CDR (res)); - SCM_CRITICAL_SECTION_END; + SCM_CRITICAL_SECTION_START; + SCM_SETCAR (x, SCM_CAR (res)); + SCM_SETCDR (x, SCM_CDR (res)); + SCM_CRITICAL_SECTION_END; - goto macro_tail; + goto macro_tail; + } } /* Start of the memoizers for the standard R5RS builtin macros. */ |