From: sof Date: Sat, 2 Feb 2002 06:47:38 +0000 (+0000) Subject: [project @ 2002-02-02 06:47:38 by sof] X-Git-Tag: Approximately_9120_patches~186 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;ds=sidebyside;h=8f9254738df67b6bca4c7588eadde902956890ce;p=ghc-hetmet.git [project @ 2002-02-02 06:47:38 by sof] pprFCall: avoid/reduce name-capture problem (as was, safe calling the C function id() would break.) --- diff --git a/ghc/compiler/absCSyn/PprAbsC.lhs b/ghc/compiler/absCSyn/PprAbsC.lhs index 6ac1449..3d322db 100644 --- a/ghc/compiler/absCSyn/PprAbsC.lhs +++ b/ghc/compiler/absCSyn/PprAbsC.lhs @@ -982,9 +982,11 @@ pprFCall call@(CCall (CCallSpec target cconv safety)) uniq args results vol_regs ] where (pp_saves, pp_restores) = ppr_vol_regs vol_regs + ppr_uniq_token = text "tok_" <> ppr uniq (pp_save_context, pp_restore_context) - | playSafe safety = ( text "{ I_ id; SUSPEND_THREAD(id);" - , text "RESUME_THREAD(id);}" + | playSafe safety = ( text "{ I_" <+> ppr_uniq_token <> + text "; SUSPEND_THREAD" <> parens ppr_uniq_token <> semi + , text "RESUME_THREAD" <> parens ppr_uniq_token <> text ";}" ) | otherwise = ( pp_basic_saves $$ pp_saves, pp_basic_restores $$ pp_restores)