mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-11 06:20:23 +02:00
* Make the compiler warn about code like SCM_CELL_WORD (x, n) = y.
This commit is contained in:
parent
cbaadf0202
commit
f706a58b67
2 changed files with 22 additions and 15 deletions
|
@ -1,3 +1,14 @@
|
|||
2000-07-10 Dirk Herrmann <D.Herrmann@tu-bs.de>
|
||||
|
||||
* gc.h (SCM_CELL_WORD, SCM_CELL_OBJECT): Treat the referenced
|
||||
object as const in order to make the compiler warn about code like
|
||||
SCM_CELL_WORD (x, n) = y. Instead, SCM_SET_CELL_WORD (x, n, y)
|
||||
should be used.
|
||||
|
||||
(SCM_CELL_WORD_LOC, SCM_CARLOC, SCM_CDRLOC): Return the address
|
||||
as an address to a non-const object, since these macros are used
|
||||
to allow direct write access to objects.
|
||||
|
||||
2000-07-07 Dirk Herrmann <D.Herrmann@tu-bs.de>
|
||||
|
||||
* hashtab.c (scm_hash_fn_create_handle_x): Signal an error if the
|
||||
|
|
|
@ -92,33 +92,29 @@ typedef scm_cell * SCM_CELLPTR;
|
|||
#define SCM_VALIDATE_CELL(cell, expr) expr
|
||||
#endif
|
||||
|
||||
#define SCM_CELL_WORD(x, n) \
|
||||
SCM_VALIDATE_CELL ((x), \
|
||||
((scm_bits_t *) SCM2PTR (x)) [n])
|
||||
#define SCM_CELL_WORD(x, n) \
|
||||
SCM_VALIDATE_CELL ((x), ((const scm_bits_t *) SCM2PTR (x)) [n])
|
||||
#define SCM_CELL_WORD_0(x) SCM_CELL_WORD (x, 0)
|
||||
#define SCM_CELL_WORD_1(x) SCM_CELL_WORD (x, 1)
|
||||
#define SCM_CELL_WORD_2(x) SCM_CELL_WORD (x, 2)
|
||||
#define SCM_CELL_WORD_3(x) SCM_CELL_WORD (x, 3)
|
||||
|
||||
#define SCM_CELL_OBJECT(x, n) \
|
||||
SCM_VALIDATE_CELL ((x), \
|
||||
SCM_PACK (((scm_bits_t *) SCM2PTR (x)) [n]))
|
||||
#define SCM_CELL_OBJECT(x, n) \
|
||||
SCM_VALIDATE_CELL ((x), SCM_PACK (((const scm_bits_t *) SCM2PTR (x)) [n]))
|
||||
#define SCM_CELL_OBJECT_0(x) SCM_CELL_OBJECT (x, 0)
|
||||
#define SCM_CELL_OBJECT_1(x) SCM_CELL_OBJECT (x, 1)
|
||||
#define SCM_CELL_OBJECT_2(x) SCM_CELL_OBJECT (x, 2)
|
||||
#define SCM_CELL_OBJECT_3(x) SCM_CELL_OBJECT (x, 3)
|
||||
|
||||
#define SCM_SET_CELL_WORD(x, n, v) \
|
||||
SCM_VALIDATE_CELL ((x), \
|
||||
((scm_bits_t *) SCM2PTR (x)) [n] = (scm_bits_t) (v))
|
||||
#define SCM_SET_CELL_WORD(x, n, v) \
|
||||
SCM_VALIDATE_CELL ((x), ((scm_bits_t *) SCM2PTR (x)) [n] = (scm_bits_t) (v))
|
||||
#define SCM_SET_CELL_WORD_0(x, v) SCM_SET_CELL_WORD (x, 0, v)
|
||||
#define SCM_SET_CELL_WORD_1(x, v) SCM_SET_CELL_WORD (x, 1, v)
|
||||
#define SCM_SET_CELL_WORD_2(x, v) SCM_SET_CELL_WORD (x, 2, v)
|
||||
#define SCM_SET_CELL_WORD_3(x, v) SCM_SET_CELL_WORD (x, 3, v)
|
||||
|
||||
#define SCM_SET_CELL_OBJECT(x, n, v) \
|
||||
SCM_VALIDATE_CELL ((x), \
|
||||
((scm_bits_t *) SCM2PTR (x)) [n] = SCM_UNPACK (v))
|
||||
#define SCM_SET_CELL_OBJECT(x, n, v) \
|
||||
SCM_VALIDATE_CELL ((x), ((scm_bits_t *) SCM2PTR (x)) [n] = SCM_UNPACK (v))
|
||||
#define SCM_SET_CELL_OBJECT_0(x, v) SCM_SET_CELL_OBJECT (x, 0, v)
|
||||
#define SCM_SET_CELL_OBJECT_1(x, v) SCM_SET_CELL_OBJECT (x, 1, v)
|
||||
#define SCM_SET_CELL_OBJECT_2(x, v) SCM_SET_CELL_OBJECT (x, 2, v)
|
||||
|
@ -136,9 +132,9 @@ typedef scm_cell * SCM_CELLPTR;
|
|||
#define SCM_SETOR_CDR(x, y)\
|
||||
(SCM_SETCDR ((x), SCM_PACK (SCM_UNPACK (SCM_CDR (x)) | (y))))
|
||||
|
||||
#define SCM_CELL_WORD_LOC(x, n) (&SCM_CELL_WORD (x, n))
|
||||
#define SCM_CARLOC(x) ((SCM *) (&(((scm_bits_t *) SCM2PTR (x)) [0])))
|
||||
#define SCM_CDRLOC(x) ((SCM *) (&(((scm_bits_t *) SCM2PTR (x)) [1])))
|
||||
#define SCM_CELL_WORD_LOC(x, n) ((scm_bits_t *) & SCM_CELL_WORD (x, n))
|
||||
#define SCM_CARLOC(x) ((SCM *) SCM_CELL_WORD_LOC ((x), 0))
|
||||
#define SCM_CDRLOC(x) ((SCM *) SCM_CELL_WORD_LOC ((x), 1))
|
||||
|
||||
|
||||
/* SCM_PTR_LT and friends define how to compare two SCM_CELLPTRs (which may
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue