diff options
author | Mikael Djurfeldt <djurfeldt@nada.kth.se> | 2003-05-22 09:16:33 +0000 |
---|---|---|
committer | Mikael Djurfeldt <djurfeldt@nada.kth.se> | 2003-05-22 09:16:33 +0000 |
commit | 79f55b7c6bffcda9d315d27ecfbf60316b79135a (patch) | |
tree | 5dd5f3b6ce1b06c7cd18e0ce9bb8e4e88180f3df | |
parent | d97f609a4a485ccc8359a93ad3254b38a9c29c08 (diff) | |
download | guile-79f55b7c6bffcda9d315d27ecfbf60316b79135a.tar.gz |
* __scm.h (SCM_STACK_PTR): New macro. (Cast argument through
(void *) in order to avoid an aliasing warning; thanks to Bruce
Korb.)
* stackchk.h (SCM_STACK_OVERFLOW_P): Use SCM_STACK_PTR.
* threads.c (suspend, launch_thread, scm_threads_mark_stacks): Use
SCM_STACK_PTR.
* threads.c (scm_threads_mark_stacks): Bugfix: Changed
thread->base --> t->base.
* eval.c (SCM_CEVAL): Don't cast argument of SCM_STACK_OVERFLOW_P.
-rw-r--r-- | libguile/ChangeLog | 16 | ||||
-rw-r--r-- | libguile/__scm.h | 6 | ||||
-rw-r--r-- | libguile/eval.c | 3 | ||||
-rw-r--r-- | libguile/stackchk.h | 8 | ||||
-rw-r--r-- | libguile/threads.c | 13 |
5 files changed, 32 insertions, 14 deletions
diff --git a/libguile/ChangeLog b/libguile/ChangeLog index fcba17fb7..59f1bf375 100644 --- a/libguile/ChangeLog +++ b/libguile/ChangeLog @@ -1,3 +1,19 @@ +2003-05-22 Mikael Djurfeldt <djurfeldt@nada.kth.se> + + * __scm.h (SCM_STACK_PTR): New macro. (Cast argument through + (void *) in order to avoid an aliasing warning; thanks to Bruce + Korb.) + + * stackchk.h (SCM_STACK_OVERFLOW_P): Use SCM_STACK_PTR. + + * threads.c (suspend, launch_thread, scm_threads_mark_stacks): Use + SCM_STACK_PTR. + + * threads.c (scm_threads_mark_stacks): Bugfix: Changed + thread->base --> t->base. + + * eval.c (SCM_CEVAL): Don't cast argument of SCM_STACK_OVERFLOW_P. + 2003-05-20 Marius Vollmer <marius.vollmer@uni-dortmund.de> * deprecated.h, deprecated.c (scm_makstr, scm_makfromstr, diff --git a/libguile/__scm.h b/libguile/__scm.h index 195128a78..a2cf5de71 100644 --- a/libguile/__scm.h +++ b/libguile/__scm.h @@ -3,7 +3,7 @@ #ifndef SCM___SCM_H #define SCM___SCM_H -/* Copyright (C) 1995,1996,1998,1999,2000,2001,2002 Free Software Foundation, Inc. +/* Copyright (C) 1995,1996,1998,1999,2000,2001,2002, 2003 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -394,6 +394,10 @@ typedef short SCM_STACKITEM; #else typedef long SCM_STACKITEM; #endif + +/* Cast pointer through (void *) in order to avoid compiler warnings + when strict aliasing is enabled */ +#define SCM_STACK_PTR(ptr) ((SCM_STACKITEM *) (void *) (ptr)) #define SCM_ASYNC_TICK /*fixme* should change names */ \ diff --git a/libguile/eval.c b/libguile/eval.c index b5e06f7b6..82a696cf2 100644 --- a/libguile/eval.c +++ b/libguile/eval.c @@ -1962,8 +1962,7 @@ SCM_CEVAL (SCM x, SCM env) scm_last_debug_frame = &debug; #endif #ifdef EVAL_STACK_CHECKING - if (scm_stack_checking_enabled_p - && SCM_STACK_OVERFLOW_P ((SCM_STACKITEM *) &proc)) + if (scm_stack_checking_enabled_p && SCM_STACK_OVERFLOW_P (&proc)) { #ifdef DEVAL debug.info->e.exp = x; diff --git a/libguile/stackchk.h b/libguile/stackchk.h index 44f5c7ce2..938794114 100644 --- a/libguile/stackchk.h +++ b/libguile/stackchk.h @@ -3,7 +3,7 @@ #ifndef SCM_STACKCHK_H #define SCM_STACKCHK_H -/* Copyright (C) 1995,1996,1998,2000 Free Software Foundation, Inc. +/* Copyright (C) 1995,1996,1998,2000, 2003 Free Software Foundation, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -36,10 +36,12 @@ #ifdef STACK_CHECKING # if SCM_STACK_GROWS_UP # define SCM_STACK_OVERFLOW_P(s)\ - (s > ((SCM_STACKITEM *) SCM_BASE (scm_rootcont) + SCM_STACK_LIMIT)) + (SCM_STACK_PTR (s) \ + > ((SCM_STACKITEM *) SCM_BASE (scm_rootcont) + SCM_STACK_LIMIT)) # else # define SCM_STACK_OVERFLOW_P(s)\ - (s < ((SCM_STACKITEM *) SCM_BASE (scm_rootcont) - SCM_STACK_LIMIT)) + (SCM_STACK_PTR (s) \ + < ((SCM_STACKITEM *) SCM_BASE (scm_rootcont) - SCM_STACK_LIMIT)) # endif # define SCM_CHECK_STACK\ {\ diff --git a/libguile/threads.c b/libguile/threads.c index c001e3d8a..26d613ee2 100644 --- a/libguile/threads.c +++ b/libguile/threads.c @@ -216,7 +216,7 @@ suspend () scm_thread *c = SCM_CURRENT_THREAD; /* record top of stack for the GC */ - c->top = (SCM_STACKITEM *)&c; + c->top = SCM_STACK_PTR (&c); /* save registers. */ SCM_FLUSH_REGISTER_WINDOWS; setjmp (c->regs); @@ -331,7 +331,7 @@ really_launch (SCM_STACKITEM *base, launch_data *data) static void * launch_thread (void *p) { - really_launch ((SCM_STACKITEM *)&p, (launch_data *)p); + really_launch (SCM_STACK_PTR (&p), (launch_data *) p); return 0; } @@ -952,8 +952,7 @@ scm_threads_mark_stacks (void) /* stack_len is long rather than sizet in order to guarantee that &stack_len is long aligned */ #if SCM_STACK_GROWS_UP - stack_len = ((SCM_STACKITEM *) (&t) - - (SCM_STACKITEM *) thread->base); + stack_len = SCM_STACK_PTR (&t) - t->base; /* Protect from the C stack. This must be the first marking * done because it provides information about what objects @@ -973,8 +972,7 @@ scm_threads_mark_stacks (void) scm_mark_locations (((size_t) t->base, (sizet) stack_len)); #else - stack_len = ((SCM_STACKITEM *) t->base - - (SCM_STACKITEM *) (&t)); + stack_len = t->base - SCM_STACK_PTR (&t); /* Protect from the C stack. This must be the first marking * done because it provides information about what objects @@ -991,8 +989,7 @@ scm_threads_mark_stacks (void) ((size_t) sizeof scm_save_regs_gc_mark / sizeof (SCM_STACKITEM))); - scm_mark_locations ((SCM_STACKITEM *) &t, - stack_len); + scm_mark_locations (SCM_STACK_PTR (&t), stack_len); #endif } else |