[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

kcl-low.lisp with gcc bug fix?



	When trying to compile PCL as is using gcc, I got fatal compiler errors
related to a line in the turbo-closure patch of kcl-low.lisp.
For the sake of gcc I had to change the expression
	cc->cc_env   to   cc->cc.cc_env
As someone who switches programming langauges a lot, my C may be rusty,
but I think the right-hand side is technically better, since it picks
out the cc union member and then the cc_env field.  Gcc likes it better.
It may be less portable, I don't know.

	In context, here is the change as found by
"diff -c7 kcl-low.lisp~ kcl-low.lisp"
on Unix (the ! flags the line in question):

*** kcl-low.lisp~       Wed Jun 13 10:21:49 1990
--- kcl-low.lisp        Thu Jun 14 12:33:33 1990
***************
*** 60,74 ****
  #-turbo-closure-env-size
  (clines "
  object cclosure_env_nthcdr (n,cc)
  int n; object cc;
  {  object env;
     if(n<0)return Cnil;
     if(type_of(cc)!=t_cclosure)return Cnil;
!    env=cc->cc_env;
     while(n-->0)
       {if(type_of(env)!=t_cons)return Cnil;
        env=env->c.c_cdr;}
     return env;
  }")
  
  #+turbo-closure-env-size
--- 60,74 ----
  #-turbo-closure-env-size
  (clines "
  object cclosure_env_nthcdr (n,cc)
  int n; object cc;
  {  object env;
     if(n<0)return Cnil;
     if(type_of(cc)!=t_cclosure)return Cnil;
!    env=cc->cc.cc_env;
     while(n-->0)
       {if(type_of(env)!=t_cons)return Cnil;
        env=env->c.c_cdr;}
     return env;
  }")
  
  #+turbo-closure-env-size

You might also want to change this in other spots, for example a few lines
below which are conditionally compiled with #+turbo-closure-env-size.

	Gary