diff options
author | Andy Wingo <wingo@pobox.com> | 2019-02-22 15:01:29 +0100 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2019-02-22 15:11:29 +0100 |
commit | 61a8c9300daeb730fe5094f889bf13241942be84 (patch) | |
tree | be251a985ba9d03b04e73f68d1679799298b002d /libguile/macros.c | |
parent | c537f938d1c809eb26e42c66bcc2b67ee4f47300 (diff) | |
download | guile-61a8c9300daeb730fe5094f889bf13241942be84.tar.gz |
Fix race when expanding syntax-parameterize and define-syntax-parameter
* libguile/macros.c (scm_i_make_primitive_macro): Give primitive macros
a primitive-macro macro-type.
* module/ice-9/psyntax.scm (put-global-definition-hook)
(get-global-definition-hook): Inline into uses.
(make-binding): Change format of lexically defined or rebound syntax
parameters to just be the transformer, not a list of the transformer.
(resolve-identifier, expand-install-global, expand-body)
(syntax-parameterize): Adapt to use the variable object (box) holding
the top-level syntax parameter as the "key" for lookups into the
lexical environment, instead of a fresh object associated with the
syntax transformer.
* module/ice-9/psyntax-pp.scm: Regenerate.
Fixes #27476, a horrible race when one thread is expanding a
syntax-parameterize form including uses, and another thread is expanding
the corresponding define-syntax-parameter. See
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=27476#102.
Diffstat (limited to 'libguile/macros.c')
-rw-r--r-- | libguile/macros.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libguile/macros.c b/libguile/macros.c index 70373e80b..e26ed651c 100644 --- a/libguile/macros.c +++ b/libguile/macros.c @@ -1,4 +1,4 @@ -/* Copyright 1995-1998,2000-2003,2006,2008-2012,2018 +/* Copyright 1995-1998,2000-2003,2006,2008-2012,2018-2019 Free Software Foundation, Inc. This file is part of Guile. @@ -64,6 +64,8 @@ macro_print (SCM macro, SCM port, scm_print_state *pstate) return 1; } +SCM_SYMBOL (sym_primitive_macro, "primitive-macro"); + /* Return a mmacro that is known to be one of guile's built in macros. */ SCM scm_i_make_primitive_macro (const char *name, scm_t_macro_primitive fn) @@ -71,7 +73,7 @@ scm_i_make_primitive_macro (const char *name, scm_t_macro_primitive fn) SCM z = scm_words (scm_tc16_macro, 5); SCM_SET_SMOB_DATA_N (z, 1, (scm_t_bits)fn); SCM_SET_SMOB_OBJECT_N (z, 2, scm_from_utf8_symbol (name)); - SCM_SET_SMOB_OBJECT_N (z, 3, SCM_BOOL_F); + SCM_SET_SMOB_OBJECT_N (z, 3, sym_primitive_macro); SCM_SET_SMOB_OBJECT_N (z, 4, SCM_BOOL_F); return z; } |