* goops.h (SCM_NUMBER_OF_SLOTS): don't SCM_UNPACK the result.
* backtrace.c ("display_backtrace_body"): SCM_PACK before SCM_EQ_P
(display_frame): idem.
(display_backtrace_file_and_line): idem.
* tags.h (SCM_UNPACK): stricter typechecking on SCM_UNPACK
arguments.
+2004-03-28 Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+ * gc.h (SCM_GC_CELL_TYPE): SCM_GC_CELL_TYPE uses SCM_GC_CELL_OBJECT.
+
+ * goops.h (SCM_NUMBER_OF_SLOTS): don't SCM_UNPACK the result.
+
+ * backtrace.c ("display_backtrace_body"): SCM_PACK before SCM_EQ_P
+ (display_frame): idem.
+ (display_backtrace_file_and_line): idem.
+
+ * tags.h (SCM_UNPACK): stricter typechecking on SCM_UNPACK
+ arguments.
+
2004-03-26 Kevin Ryde <user42@zip.com.au>
* filesys.c (scm_getcwd, scm_readlink): Avoid memory leak on errors.
display_backtrace_get_file_line (frame, &file, &line);
- if (SCM_EQ_P (SCM_SHOW_FILE_NAME, sym_base))
+ if (SCM_EQ_P (SCM_PACK (SCM_SHOW_FILE_NAME), sym_base))
{
if (SCM_FALSEP (file))
{
}
/* display file name and line number */
- if (!SCM_FALSEP (SCM_SHOW_FILE_NAME))
+ if (!SCM_FALSEP (SCM_PACK (SCM_SHOW_FILE_NAME)))
display_backtrace_file_and_line (frame, port, pstate);
/* Check size of frame number. */
last_file = SCM_UNDEFINED;
for (i = 0; i < n; ++i)
{
- if (!SCM_EQ_P (SCM_SHOW_FILE_NAME, sym_base))
+ if (!SCM_EQ_P (SCM_PACK (SCM_SHOW_FILE_NAME), sym_base))
display_backtrace_file (frame, &last_file, a->port, pstate);
display_frame (frame, nfield, indentation, sport, a->port, pstate);
static SCM
with_traps_inner (void *data)
{
- SCM thunk = SCM_PACK (data);
+ SCM thunk = SCM_PACK ((scm_t_bits) data);
return scm_call_0 (thunk);
}
{
register long i;
register SCM ptr;
- scm_t_bits cell_type;
+ SCM cell_type;
ptr = p;
scm_mark_dependencies_again:
(((scm_t_bits *) SCM2PTR (x)) [n] = (scm_t_bits) (v))
#define SCM_GC_SET_CELL_OBJECT(x, n, v) \
(((scm_t_bits *) SCM2PTR (x)) [n] = SCM_UNPACK (v))
-#define SCM_GC_CELL_TYPE(x) SCM_GC_CELL_WORD (x, 0)
+#define SCM_GC_CELL_TYPE(x) SCM_GC_CELL_OBJECT (x, 0) /* ugh - only used once. */
/* Except for the garbage collector, no part of guile should ever run over a
#define SCM_CLASS_OF(x) SCM_STRUCT_VTABLE (x)
#define SCM_ACCESSORS_OF(x) (SCM_PACK (SCM_STRUCT_VTABLE_DATA (x)[scm_si_getters_n_setters]))
#define SCM_NUMBER_OF_SLOTS(x) \
- (SCM_UNPACK (SCM_STRUCT_DATA (x)[scm_struct_i_n_words]) \
- - scm_struct_n_extra_words)
+ ((SCM_STRUCT_DATA (x)[scm_struct_i_n_words]) - scm_struct_n_extra_words)
#define SCM_CLASSP(x) \
(SCM_STRUCTP (x) && SCM_STRUCT_VTABLE_FLAGS (x) & SCM_CLASSF_METACLASS)
* type checking while still resulting in very efficient code.
*/
typedef struct scm_unused_struct * SCM;
-# define SCM_UNPACK(x) ((scm_t_bits) (x))
+
+/*
+ The 0?: constructions makes sure that the code is never executed,
+ and that there is no performance hit. However, the alternative is
+ compiled, and does generate a warning when used with the wrong
+ pointer type.
+ */
+# define SCM_UNPACK(x) ((scm_t_bits) (0? (*(SCM*)0=(x)): x))
+
+/*
+ There is no typechecking on SCM_PACK, since all kinds of types
+ (unsigned long, void*) go in SCM_PACK
+ */
# define SCM_PACK(x) ((SCM) (x))
+
#else
/* This should be used as a fall back solution for machines on which casting
* to a pointer may lead to loss of bit information, e. g. in the three least
*/
typedef scm_t_bits SCM;
# define SCM_UNPACK(x) (x)
-# define SCM_PACK(x) ((scm_t_bits) (x))
+# define SCM_PACK(x) ((SCM) (x))
#endif