diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2024-01-28 00:15:38 -0800 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2024-01-28 00:26:44 -0800 |
commit | fcf69960e89b826841a8c6ccc2af4019b5dc5e31 (patch) | |
tree | df65946d20838709f7f26deb5138ca8e925e5117 /src/lisp.h | |
parent | 99a122b5b816f6c5dd2acc67eeca13eb4d1d8cd5 (diff) | |
download | emacs-fcf69960e89b826841a8c6ccc2af4019b5dc5e31.tar.gz |
* src/lisp.h: Improve TAG_PTR comments.
Diffstat (limited to 'src/lisp.h')
-rw-r--r-- | src/lisp.h | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/lisp.h b/src/lisp.h index eb78176aed6..db886c65204 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -303,6 +303,9 @@ DEFINE_GDB_SYMBOL_END (VALMASK) #define LISP_WORDS_ARE_POINTERS (EMACS_INT_MAX == INTPTR_MAX) #if LISP_WORDS_ARE_POINTERS +/* TAG_PTR casts to Lisp_Word and can be used in static initializers, + so this typedef assumes static initializers can contain casts to pointers. + All Emacs targets support this extension to the C standard. */ typedef struct Lisp_X *Lisp_Word; #else typedef EMACS_INT Lisp_Word; @@ -931,12 +934,14 @@ typedef EMACS_UINT Lisp_Word_tag; #define LISP_WORD_TAG(tag) \ ((Lisp_Word_tag) (tag) << (USE_LSB_TAG ? 0 : VALBITS)) -/* An initializer for a Lisp_Object that contains TAG along with PTR. */ -#define TAG_PTR(tag, ptr) \ - LISP_INITIALLY ((Lisp_Word) ((uintptr_t) (ptr) + LISP_WORD_TAG (tag))) +/* An initializer for a Lisp_Object that contains TAG along with P. + P can be a pointer or an integer. The result is usable in a static + initializer if TAG and P are both integer constant expressions. */ +#define TAG_PTR(tag, p) \ + LISP_INITIALLY ((Lisp_Word) ((uintptr_t) (p) + LISP_WORD_TAG (tag))) /* LISPSYM_INITIALLY (Qfoo) is equivalent to Qfoo except it is - designed for use as an initializer, even for a constant initializer. */ + designed for use as a (possibly static) initializer. */ #define LISPSYM_INITIALLY(name) \ TAG_PTR (Lisp_Symbol, (intptr_t) ((i##name) * sizeof *lispsym)) |