[project @ 2002-02-02 06:47:38 by sof]
authorsof <unknown>
Sat, 2 Feb 2002 06:47:38 +0000 (06:47 +0000)
committersof <unknown>
Sat, 2 Feb 2002 06:47:38 +0000 (06:47 +0000)
pprFCall: avoid/reduce name-capture problem (as was, safe calling
the C function id() would break.)

ghc/compiler/absCSyn/PprAbsC.lhs

index 6ac1449..3d322db 100644 (file)
@@ -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)