From unknown Tue Jun 17 20:08:00 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#25128 <25128@debbugs.gnu.org> To: bug#25128 <25128@debbugs.gnu.org> Subject: Status: Reorder lisp.h to declare types before using them Reply-To: bug#25128 <25128@debbugs.gnu.org> Date: Wed, 18 Jun 2025 03:08:00 +0000 retitle 25128 Reorder lisp.h to declare types before using them reassign 25128 emacs submitter 25128 Paul Eggert severity 25128 wishlist tag 25128 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Wed Dec 07 02:19:47 2016 Received: (at submit) by debbugs.gnu.org; 7 Dec 2016 07:19:47 +0000 Received: from localhost ([127.0.0.1]:58764 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cEWW1-0001am-UO for submit@debbugs.gnu.org; Wed, 07 Dec 2016 02:19:47 -0500 Received: from eggs.gnu.org ([208.118.235.92]:35327) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cEWVz-0001aZ-Bk for submit@debbugs.gnu.org; Wed, 07 Dec 2016 02:19:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cEWVq-0006np-OY for submit@debbugs.gnu.org; Wed, 07 Dec 2016 02:19:38 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:39880) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cEWVq-0006ni-KI for submit@debbugs.gnu.org; Wed, 07 Dec 2016 02:19:34 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54510) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cEWVm-0003Hf-69 for bug-gnu-emacs@gnu.org; Wed, 07 Dec 2016 02:19:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cEWVg-0006kz-UL for bug-gnu-emacs@gnu.org; Wed, 07 Dec 2016 02:19:30 -0500 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:44576) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cEWVg-0006hb-H6 for bug-gnu-emacs@gnu.org; Wed, 07 Dec 2016 02:19:24 -0500 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 9B8DA1600A4 for ; Tue, 6 Dec 2016 23:19:22 -0800 (PST) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id nEXJWkm2QBDH for ; Tue, 6 Dec 2016 23:19:19 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id B6A231600B7 for ; Tue, 6 Dec 2016 23:19:19 -0800 (PST) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id eR_ZX2fBhq88 for ; Tue, 6 Dec 2016 23:19:19 -0800 (PST) Received: from [192.168.1.9] (unknown [47.153.178.162]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 8C5581600AD for ; Tue, 6 Dec 2016 23:19:19 -0800 (PST) To: Emacs bug reports and feature requests From: Paul Eggert Subject: Reorder lisp.h to declare types before using them Organization: UCLA Computer Science Department Message-ID: <04822678-e178-4b23-1a5b-ff452cbd88a3@cs.ucla.edu> Date: Tue, 6 Dec 2016 23:19:19 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------783770E7FF0F264671CCFE29" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) This is a multi-part message in MIME format. --------------783770E7FF0F264671CCFE29 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Tags: patch Attached is a patch to reorder src/lisp.h so that more types are declared= before=20 use. The main motivation is to eventually add support for=20 -fcheck-pointer-bounds; future changes will need access to type sizes (e.= g.,=20 XCONS might need sizeof (struct Lisp_Cons)), which should be easy after t= his=20 change. Also, the change shortens lisp.h a bit and (if you ask me) makes = it=20 easier to read, since the basic functions for a type are now declared nex= t to=20 the type. I would like to install this soon, and am posting this as a bug report to= give=20 Eli and others a heads-up, in case some MS-Windows module now needs to in= clude=20 process.h. This may be needed because XPROCESS is now defined in process.= h=20 instead of lisp.h; similarly for buffer.h, window.h, termhooks.h. --------------783770E7FF0F264671CCFE29 Content-Type: text/x-diff; name="0001-Reorder-lisp.h-to-declare-types-before-using-them.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename*0="0001-Reorder-lisp.h-to-declare-types-before-using-them.patch" =46rom d9627a9df1ef0e27df0e7eefa40aad85eeeb056c Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 6 Dec 2016 22:12:43 -0800 Subject: [PATCH] Reorder lisp.h to declare types before using them Reorder lisp.h to put basic functions for types to be after the corresponding type definitions. This is a more-common programming style in C, and will make it easier to port Emacs to gcc -fcheck-pointer-bounds, since the functions now have access to the corresponding types' sizes. This patch does not change the code; it just moves declarations and definitions and removes no-longer-needed forward declarations. * src/buffer.c, src/data.c, src/image.c: Include process.h, for PROCESSP. * src/buffer.h (BUFFERP, CHECK_BUFFER, XBUFFER): * src/process.h (PROCESSP, CHECK_PROCESS, XPROCESS): * src/terminal.h (TERMINALP, XTERMINAL): * src/window.h (WINDOWP, CHECK_WINDOW, XWINDOW): Move here from lisp.h. * src/intervals.h: Include buffer.h, for BUFFERP. * src/lisp.h: Reorder declarations and definitions as described above. Move some symbols to other headers (noted above). Remove forward decls that are no longer needed. --- src/buffer.c | 1 + src/buffer.h | 19 ++ src/data.c | 1 + src/image.c | 1 + src/intervals.h | 3 + src/lisp.h | 832 +++++++++++++++++++++++++-------------------------= ------ src/process.h | 19 ++ src/termhooks.h | 13 + src/window.h | 19 ++ 9 files changed, 448 insertions(+), 460 deletions(-) diff --git a/src/buffer.c b/src/buffer.c index 6815aa7..0ae0221 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -32,6 +32,7 @@ along with GNU Emacs. If not, see . */ =20 #include "lisp.h" #include "intervals.h" +#include "process.h" #include "systime.h" #include "window.h" #include "commands.h" diff --git a/src/buffer.h b/src/buffer.h index 6ac161c..a8ca6a3 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -881,6 +881,25 @@ struct buffer Lisp_Object undo_list_; }; =20 +INLINE bool +BUFFERP (Lisp_Object a) +{ + return PSEUDOVECTORP (a, PVEC_BUFFER); +} + +INLINE void +CHECK_BUFFER (Lisp_Object x) +{ + CHECK_TYPE (BUFFERP (x), Qbufferp, x); +} + +INLINE struct buffer * +XBUFFER (Lisp_Object a) +{ + eassert (BUFFERP (a)); + return XUNTAG (a, Lisp_Vectorlike); +} + /* Most code should use these functions to set Lisp fields in struct buffer. (Some setters that are private to a single .c file are defined as static in those files.) */ diff --git a/src/data.c b/src/data.c index 64cd8b2..405234e 100644 --- a/src/data.c +++ b/src/data.c @@ -31,6 +31,7 @@ along with GNU Emacs. If not, see . */ #include "character.h" #include "buffer.h" #include "keyboard.h" +#include "process.h" #include "frame.h" #include "keymap.h" =20 diff --git a/src/image.c b/src/image.c index 89572b8..45010e7 100644 --- a/src/image.c +++ b/src/image.c @@ -36,6 +36,7 @@ along with GNU Emacs. If not, see . */ =20 #include "lisp.h" #include "frame.h" +#include "process.h" #include "window.h" #include "buffer.h" #include "dispextern.h" diff --git a/src/intervals.h b/src/intervals.h index 9a38d84..b56c050 100644 --- a/src/intervals.h +++ b/src/intervals.h @@ -19,6 +19,9 @@ along with GNU Emacs. If not, see . */ #ifndef EMACS_INTERVALS_H #define EMACS_INTERVALS_H =20 +#include "buffer.h" +#include "lisp.h" + INLINE_HEADER_BEGIN =20 /* Basic data type for use of intervals. */ diff --git a/src/lisp.h b/src/lisp.h index b9c6289..c3eaf42 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -258,6 +258,11 @@ DEFINE_GDB_SYMBOL_BEGIN (bool, USE_LSB_TAG) #define USE_LSB_TAG (VAL_MAX / 2 < INTPTR_MAX) DEFINE_GDB_SYMBOL_END (USE_LSB_TAG) =20 +/* Mask for the value (as opposed to the type bits) of a Lisp object. *= / +DEFINE_GDB_SYMBOL_BEGIN (EMACS_INT, VALMASK) +# define VALMASK (USE_LSB_TAG ? - (1 << GCTYPEBITS) : VAL_MAX) +DEFINE_GDB_SYMBOL_END (VALMASK) + #if !USE_LSB_TAG && !defined WIDE_EMACS_INT # error "USE_LSB_TAG not supported on this platform; please report this.= " \ "Try 'configure --with-wide-int' to work around the problem." @@ -556,42 +561,9 @@ enum CHECK_LISP_OBJECT_TYPE { CHECK_LISP_OBJECT_TYPE= =3D false }; /* Forward declarations. */ =20 /* Defined in this file. */ -union Lisp_Fwd; -INLINE bool BOOL_VECTOR_P (Lisp_Object); -INLINE bool BUFFER_OBJFWDP (union Lisp_Fwd *); -INLINE bool BUFFERP (Lisp_Object); -INLINE bool CHAR_TABLE_P (Lisp_Object); -INLINE Lisp_Object CHAR_TABLE_REF_ASCII (Lisp_Object, ptrdiff_t); -INLINE bool (CONSP) (Lisp_Object); -INLINE bool (FLOATP) (Lisp_Object); -INLINE bool (INTEGERP) (Lisp_Object); -INLINE bool (MARKERP) (Lisp_Object); -INLINE bool (MISCP) (Lisp_Object); -INLINE bool (NILP) (Lisp_Object); -INLINE bool OVERLAYP (Lisp_Object); -INLINE bool PROCESSP (Lisp_Object); -INLINE bool PSEUDOVECTORP (Lisp_Object, int); -INLINE bool SAVE_VALUEP (Lisp_Object); -INLINE bool FINALIZERP (Lisp_Object); - -#ifdef HAVE_MODULES -INLINE bool USER_PTRP (Lisp_Object); -INLINE struct Lisp_User_Ptr *(XUSER_PTR) (Lisp_Object); -#endif =20 INLINE void set_sub_char_table_contents (Lisp_Object, ptrdiff_t, Lisp_Object); -INLINE bool STRINGP (Lisp_Object); -INLINE bool SUB_CHAR_TABLE_P (Lisp_Object); -INLINE bool SUBRP (Lisp_Object); -INLINE bool (SYMBOLP) (Lisp_Object); -INLINE bool (VECTORLIKEP) (Lisp_Object); -INLINE bool WINDOWP (Lisp_Object); -INLINE bool TERMINALP (Lisp_Object); -INLINE struct Lisp_Save_Value *XSAVE_VALUE (Lisp_Object); -INLINE struct Lisp_Finalizer *XFINALIZER (Lisp_Object); -INLINE struct Lisp_Symbol *(XSYMBOL) (Lisp_Object); -INLINE void *(XUNTAG) (Lisp_Object, int); =20 /* Defined in chartab.c. */ extern Lisp_Object char_table_ref (Lisp_Object, int); @@ -600,8 +572,6 @@ extern void char_table_set (Lisp_Object, int, Lisp_Ob= ject); /* Defined in data.c. */ extern _Noreturn void wrong_type_argument (Lisp_Object, Lisp_Object); extern _Noreturn void wrong_choice (Lisp_Object, Lisp_Object); -extern void notify_variable_watchers (Lisp_Object symbol, Lisp_Object ne= wval, - Lisp_Object operation, Lisp_Object= where); =20 =20 #ifdef CANNOT_DUMP @@ -618,6 +588,56 @@ extern bool initialized; extern double extract_float (Lisp_Object); =20 =0C +/* Low-level conversion and type checking. */ + +/* Convert a Lisp_Object to the corresponding EMACS_INT and vice versa. + At the machine level, these operations are no-ops. */ + +INLINE EMACS_INT +(XLI) (Lisp_Object o) +{ + return lisp_h_XLI (o); +} + +INLINE Lisp_Object +(XIL) (EMACS_INT i) +{ + return lisp_h_XIL (i); +} + +/* Extract A's type. */ + +INLINE enum Lisp_Type +(XTYPE) (Lisp_Object a) +{ +#if USE_LSB_TAG + return lisp_h_XTYPE (a); +#else + EMACS_UINT i =3D XLI (a); + return USE_LSB_TAG ? i & ~VALMASK : i >> VALBITS; +#endif +} + +INLINE void +(CHECK_TYPE) (int ok, Lisp_Object predicate, Lisp_Object x) +{ + lisp_h_CHECK_TYPE (ok, predicate, x); +} + +/* Extract A's pointer value, assuming A's type is TYPE. */ + +INLINE void * +(XUNTAG) (Lisp_Object a, int type) +{ +#if USE_LSB_TAG + return lisp_h_XUNTAG (a, type); +#else + intptr_t i =3D USE_LSB_TAG ? XLI (a) - type : XLI (a) & VALMASK; + return (void *) i; +#endif +} + +=0C /* Interned state of a symbol. */ =20 enum symbol_interned @@ -746,6 +766,10 @@ struct Lisp_Symbol DEFINE_GDB_SYMBOL_BEGIN (Lisp_Object, name) \ DEFINE_GDB_SYMBOL_END (LISPSYM_INITIALLY (name)) =20 +/* The index of the C-defined Lisp symbol SYM. + This can be used in a static initializer. */ +#define SYMBOL_INDEX(sym) i##sym + /* By default, define macros for Qt, etc., as this leads to a bit better performance in the core Emacs interpreter. A plugin can define DEFINE_NON_NIL_Q_SYMBOL_MACROS to be false, to be portable to @@ -756,19 +780,43 @@ struct Lisp_Symbol =20 #include "globals.h" =20 -/* Convert a Lisp_Object to the corresponding EMACS_INT and vice versa. - At the machine level, these operations are no-ops. */ +INLINE bool +(SYMBOLP) (Lisp_Object x) +{ + return lisp_h_SYMBOLP (x); +} =20 -INLINE EMACS_INT -(XLI) (Lisp_Object o) +INLINE struct Lisp_Symbol * +(XSYMBOL) (Lisp_Object a) { - return lisp_h_XLI (o); +#if USE_LSB_TAG + return lisp_h_XSYMBOL (a); +#else + eassert (SYMBOLP (a)); + intptr_t i =3D (intptr_t) XUNTAG (a, Lisp_Symbol); + void *p =3D (char *) lispsym + i; + return p; +#endif } =20 INLINE Lisp_Object -(XIL) (EMACS_INT i) +make_lisp_symbol (struct Lisp_Symbol *sym) { - return lisp_h_XIL (i); + Lisp_Object a =3D XIL (TAG_SYMOFFSET ((char *) sym - (char *) lispsym)= ); + eassert (XSYMBOL (a) =3D=3D sym); + return a; +} + +INLINE Lisp_Object +builtin_lisp_symbol (int index) +{ + return make_lisp_symbol (lispsym + index); +} + +INLINE void +(CHECK_SYMBOL) (Lisp_Object x) +{ + lisp_h_CHECK_SYMBOL (x); } =20 /* In the size word of a vector, this bit means the vector has been mark= ed. */ @@ -836,11 +884,6 @@ enum More_Lisp_Bits XCONS (tem) is the struct Lisp_Cons * pointing to the memory for that cons. */ =20 -/* Mask for the value (as opposed to the type bits) of a Lisp object. *= / -DEFINE_GDB_SYMBOL_BEGIN (EMACS_INT, VALMASK) -# define VALMASK (USE_LSB_TAG ? - (1 << GCTYPEBITS) : VAL_MAX) -DEFINE_GDB_SYMBOL_END (VALMASK) - /* Largest and smallest representable fixnum values. These are the C values. They are macros for use in static initializers. */ #define MOST_POSITIVE_FIXNUM (EMACS_INT_MAX >> INTTYPEBITS) @@ -868,24 +911,6 @@ INLINE EMACS_INT return n; } =20 -INLINE struct Lisp_Symbol * -(XSYMBOL) (Lisp_Object a) -{ - return lisp_h_XSYMBOL (a); -} - -INLINE enum Lisp_Type -(XTYPE) (Lisp_Object a) -{ - return lisp_h_XTYPE (a); -} - -INLINE void * -(XUNTAG) (Lisp_Object a, int type) -{ - return lisp_h_XUNTAG (a, type); -} - #else /* ! USE_LSB_TAG */ =20 /* Although compiled only if ! USE_LSB_TAG, the following functions @@ -937,24 +962,6 @@ XFASTINT (Lisp_Object a) return n; } =20 -/* Extract A's type. */ -INLINE enum Lisp_Type -XTYPE (Lisp_Object a) -{ - EMACS_UINT i =3D XLI (a); - return USE_LSB_TAG ? i & ~VALMASK : i >> VALBITS; -} - -/* Extract A's value as a symbol. */ -INLINE struct Lisp_Symbol * -XSYMBOL (Lisp_Object a) -{ - eassert (SYMBOLP (a)); - intptr_t i =3D (intptr_t) XUNTAG (a, Lisp_Symbol); - void *p =3D (char *) lispsym + i; - return p; -} - /* Extract A's pointer value, assuming A's type is TYPE. */ INLINE void * XUNTAG (Lisp_Object a, int type) @@ -1014,97 +1021,6 @@ clip_to_bounds (ptrdiff_t lower, EMACS_INT num, pt= rdiff_t upper) } =0C =20 -/* Extract a value or address from a Lisp_Object. */ - -INLINE struct Lisp_Cons * -(XCONS) (Lisp_Object a) -{ - return lisp_h_XCONS (a); -} - -INLINE struct Lisp_Vector * -XVECTOR (Lisp_Object a) -{ - eassert (VECTORLIKEP (a)); - return XUNTAG (a, Lisp_Vectorlike); -} - -INLINE struct Lisp_String * -XSTRING (Lisp_Object a) -{ - eassert (STRINGP (a)); - return XUNTAG (a, Lisp_String); -} - -/* The index of the C-defined Lisp symbol SYM. - This can be used in a static initializer. */ -#define SYMBOL_INDEX(sym) i##sym - -INLINE struct Lisp_Float * -XFLOAT (Lisp_Object a) -{ - eassert (FLOATP (a)); - return XUNTAG (a, Lisp_Float); -} - -/* Pseudovector types. */ - -INLINE struct Lisp_Process * -XPROCESS (Lisp_Object a) -{ - eassert (PROCESSP (a)); - return XUNTAG (a, Lisp_Vectorlike); -} - -INLINE struct window * -XWINDOW (Lisp_Object a) -{ - eassert (WINDOWP (a)); - return XUNTAG (a, Lisp_Vectorlike); -} - -INLINE struct terminal * -XTERMINAL (Lisp_Object a) -{ - eassert (TERMINALP (a)); - return XUNTAG (a, Lisp_Vectorlike); -} - -INLINE struct Lisp_Subr * -XSUBR (Lisp_Object a) -{ - eassert (SUBRP (a)); - return XUNTAG (a, Lisp_Vectorlike); -} - -INLINE struct buffer * -XBUFFER (Lisp_Object a) -{ - eassert (BUFFERP (a)); - return XUNTAG (a, Lisp_Vectorlike); -} - -INLINE struct Lisp_Char_Table * -XCHAR_TABLE (Lisp_Object a) -{ - eassert (CHAR_TABLE_P (a)); - return XUNTAG (a, Lisp_Vectorlike); -} - -INLINE struct Lisp_Sub_Char_Table * -XSUB_CHAR_TABLE (Lisp_Object a) -{ - eassert (SUB_CHAR_TABLE_P (a)); - return XUNTAG (a, Lisp_Vectorlike); -} - -INLINE struct Lisp_Bool_Vector * -XBOOL_VECTOR (Lisp_Object a) -{ - eassert (BOOL_VECTOR_P (a)); - return XUNTAG (a, Lisp_Vectorlike); -} - /* Construct a Lisp_Object from a value or address. */ =20 INLINE Lisp_Object @@ -1115,18 +1031,10 @@ make_lisp_ptr (void *ptr, enum Lisp_Type type) return a; } =20 -INLINE Lisp_Object -make_lisp_symbol (struct Lisp_Symbol *sym) -{ - Lisp_Object a =3D XIL (TAG_SYMOFFSET ((char *) sym - (char *) lispsym)= ); - eassert (XSYMBOL (a) =3D=3D sym); - return a; -} - -INLINE Lisp_Object -builtin_lisp_symbol (int index) +INLINE bool +(INTEGERP) (Lisp_Object x) { - return make_lisp_symbol (lispsym + index); + return lisp_h_INTEGERP (x); } =20 #define XSETINT(a, b) ((a) =3D make_number (b)) @@ -1191,14 +1099,6 @@ make_pointer_integer (void *p) return a; } =20 -/* Type checking. */ - -INLINE void -(CHECK_TYPE) (int ok, Lisp_Object predicate, Lisp_Object x) -{ - lisp_h_CHECK_TYPE (ok, predicate, x); -} - /* See the macros in intervals.h. */ =20 typedef struct interval *INTERVAL; @@ -1218,22 +1118,46 @@ struct GCALIGNED Lisp_Cons } u; }; =20 -/* Take the car or cdr of something known to be a cons cell. */ -/* The _addr functions shouldn't be used outside of the minimal set - of code that has to know what a cons cell looks like. Other code not= - part of the basic lisp implementation should assume that the car and = cdr - fields are not accessible. (What if we want to switch to - a copying collector someday? Cached cons cell field addresses may be= - invalidated at arbitrary points.) */ -INLINE Lisp_Object * -xcar_addr (Lisp_Object c) +INLINE bool +(NILP) (Lisp_Object x) { - return &XCONS (c)->car; + return lisp_h_NILP (x); } -INLINE Lisp_Object * -xcdr_addr (Lisp_Object c) + +INLINE bool +(CONSP) (Lisp_Object x) { - return &XCONS (c)->u.cdr; + return lisp_h_CONSP (x); +} + +INLINE void +CHECK_CONS (Lisp_Object x) +{ + CHECK_TYPE (CONSP (x), Qconsp, x); +} + +INLINE struct Lisp_Cons * +(XCONS) (Lisp_Object a) +{ + return lisp_h_XCONS (a); +} + +/* Take the car or cdr of something known to be a cons cell. */ +/* The _addr functions shouldn't be used outside of the minimal set + of code that has to know what a cons cell looks like. Other code not= + part of the basic lisp implementation should assume that the car and = cdr + fields are not accessible. (What if we want to switch to + a copying collector someday? Cached cons cell field addresses may be= + invalidated at arbitrary points.) */ +INLINE Lisp_Object * +xcar_addr (Lisp_Object c) +{ + return &XCONS (c)->car; +} +INLINE Lisp_Object * +xcdr_addr (Lisp_Object c) +{ + return &XCONS (c)->u.cdr; } =20 /* Use these from normal code. */ @@ -1307,6 +1231,25 @@ struct GCALIGNED Lisp_String unsigned char *data; }; =20 +INLINE bool +STRINGP (Lisp_Object x) +{ + return XTYPE (x) =3D=3D Lisp_String; +} + +INLINE void +CHECK_STRING (Lisp_Object x) +{ + CHECK_TYPE (STRINGP (x), Qstringp, x); +} + +INLINE struct Lisp_String * +XSTRING (Lisp_Object a) +{ + eassert (STRINGP (a)); + return XUNTAG (a, Lisp_String); +} + /* True if STR is a multibyte string. */ INLINE bool STRING_MULTIBYTE (Lisp_Object str) @@ -1441,6 +1384,62 @@ struct Lisp_Vector Lisp_Object contents[FLEXIBLE_ARRAY_MEMBER]; }; =20 +INLINE bool +(VECTORLIKEP) (Lisp_Object x) +{ + return lisp_h_VECTORLIKEP (x); +} + +INLINE struct Lisp_Vector * +XVECTOR (Lisp_Object a) +{ + eassert (VECTORLIKEP (a)); + return XUNTAG (a, Lisp_Vectorlike); +} + +INLINE ptrdiff_t +ASIZE (Lisp_Object array) +{ + ptrdiff_t size =3D XVECTOR (array)->header.size; + eassume (0 <=3D size); + return size; +} + +INLINE bool +VECTORP (Lisp_Object x) +{ + return VECTORLIKEP (x) && ! (ASIZE (x) & PSEUDOVECTOR_FLAG); +} + +INLINE void +CHECK_VECTOR (Lisp_Object x) +{ + CHECK_TYPE (VECTORP (x), Qvectorp, x); +} + +/* A pseudovector is like a vector, but has other non-Lisp components. = */ + +INLINE bool +PSEUDOVECTOR_TYPEP (struct vectorlike_header *a, int code) +{ + return ((a->size & (PSEUDOVECTOR_FLAG | PVEC_TYPE_MASK)) + =3D=3D (PSEUDOVECTOR_FLAG | (code << PSEUDOVECTOR_AREA_BITS))); +} + +/* True if A is a pseudovector whose code is CODE. */ +INLINE bool +PSEUDOVECTORP (Lisp_Object a, int code) +{ + if (! VECTORLIKEP (a)) + return false; + else + { + /* Converting to struct vectorlike_header * avoids aliasing issues= =2E */ + struct vectorlike_header *h =3D XUNTAG (a, Lisp_Vectorlike); + return PSEUDOVECTOR_TYPEP (h, code); + } +} + /* A boolvector is a kind of vectorlike, with contents like a string. *= / =20 struct Lisp_Bool_Vector @@ -1457,6 +1456,51 @@ struct Lisp_Bool_Vector bits_word data[FLEXIBLE_ARRAY_MEMBER]; }; =20 +/* Some handy constants for calculating sizes + and offsets, mostly of vectorlike objects. */ + +enum + { + header_size =3D offsetof (struct Lisp_Vector, contents), + bool_header_size =3D offsetof (struct Lisp_Bool_Vector, data), + word_size =3D sizeof (Lisp_Object) + }; + +/* The number of data words and bytes in a bool vector with SIZE bits. = */ + +INLINE EMACS_INT +bool_vector_words (EMACS_INT size) +{ + eassume (0 <=3D size && size <=3D EMACS_INT_MAX - (BITS_PER_BITS_WORD = - 1)); + return (size + BITS_PER_BITS_WORD - 1) / BITS_PER_BITS_WORD; +} + +INLINE EMACS_INT +bool_vector_bytes (EMACS_INT size) +{ + eassume (0 <=3D size && size <=3D EMACS_INT_MAX - (BITS_PER_BITS_WORD = - 1)); + return (size + BOOL_VECTOR_BITS_PER_CHAR - 1) / BOOL_VECTOR_BITS_PER_C= HAR; +} + +INLINE bool +BOOL_VECTOR_P (Lisp_Object a) +{ + return PSEUDOVECTORP (a, PVEC_BOOL_VECTOR); +} + +INLINE void +CHECK_BOOL_VECTOR (Lisp_Object x) +{ + CHECK_TYPE (BOOL_VECTOR_P (x), Qbool_vector_p, x); +} + +INLINE struct Lisp_Bool_Vector * +XBOOL_VECTOR (Lisp_Object a) +{ + eassert (BOOL_VECTOR_P (a)); + return XUNTAG (a, Lisp_Vectorlike); +} + INLINE EMACS_INT bool_vector_size (Lisp_Object a) { @@ -1477,22 +1521,6 @@ bool_vector_uchar_data (Lisp_Object a) return (unsigned char *) bool_vector_data (a); } =20 -/* The number of data words and bytes in a bool vector with SIZE bits. = */ - -INLINE EMACS_INT -bool_vector_words (EMACS_INT size) -{ - eassume (0 <=3D size && size <=3D EMACS_INT_MAX - (BITS_PER_BITS_WORD = - 1)); - return (size + BITS_PER_BITS_WORD - 1) / BITS_PER_BITS_WORD; -} - -INLINE EMACS_INT -bool_vector_bytes (EMACS_INT size) -{ - eassume (0 <=3D size && size <=3D EMACS_INT_MAX - (BITS_PER_BITS_WORD = - 1)); - return (size + BOOL_VECTOR_BITS_PER_CHAR - 1) / BOOL_VECTOR_BITS_PER_C= HAR; -} - /* True if A's Ith bit is set. */ =20 INLINE bool @@ -1525,16 +1553,6 @@ bool_vector_set (Lisp_Object a, EMACS_INT i, bool = b) *addr &=3D ~ (1 << (i % BOOL_VECTOR_BITS_PER_CHAR)); } =20 -/* Some handy constants for calculating sizes - and offsets, mostly of vectorlike objects. */ - -enum - { - header_size =3D offsetof (struct Lisp_Vector, contents), - bool_header_size =3D offsetof (struct Lisp_Bool_Vector, data), - word_size =3D sizeof (Lisp_Object) - }; - /* Conveniences for dealing with Lisp arrays. */ =20 INLINE Lisp_Object @@ -1550,14 +1568,6 @@ aref_addr (Lisp_Object array, ptrdiff_t idx) } =20 INLINE ptrdiff_t -ASIZE (Lisp_Object array) -{ - ptrdiff_t size =3D XVECTOR (array)->header.size; - eassume (0 <=3D size); - return size; -} - -INLINE ptrdiff_t gc_asize (Lisp_Object array) { /* Like ASIZE, but also can be used in the garbage collector. */ @@ -1674,6 +1684,19 @@ struct Lisp_Char_Table Lisp_Object extras[FLEXIBLE_ARRAY_MEMBER]; }; =20 +INLINE bool +CHAR_TABLE_P (Lisp_Object a) +{ + return PSEUDOVECTORP (a, PVEC_CHAR_TABLE); +} + +INLINE struct Lisp_Char_Table * +XCHAR_TABLE (Lisp_Object a) +{ + eassert (CHAR_TABLE_P (a)); + return XUNTAG (a, Lisp_Vectorlike); +} + struct Lisp_Sub_Char_Table { /* HEADER.SIZE is the vector's size field, which also holds the @@ -1695,6 +1718,19 @@ struct Lisp_Sub_Char_Table Lisp_Object contents[FLEXIBLE_ARRAY_MEMBER]; }; =20 +INLINE bool +SUB_CHAR_TABLE_P (Lisp_Object a) +{ + return PSEUDOVECTORP (a, PVEC_SUB_CHAR_TABLE); +} + +INLINE struct Lisp_Sub_Char_Table * +XSUB_CHAR_TABLE (Lisp_Object a) +{ + eassert (SUB_CHAR_TABLE_P (a)); + return XUNTAG (a, Lisp_Vectorlike); +} + INLINE Lisp_Object CHAR_TABLE_REF_ASCII (Lisp_Object ct, ptrdiff_t idx) { @@ -1760,6 +1796,19 @@ struct Lisp_Subr EMACS_INT doc; }; =20 +INLINE bool +SUBRP (Lisp_Object a) +{ + return PSEUDOVECTORP (a, PVEC_SUBR); +} + +INLINE struct Lisp_Subr * +XSUBR (Lisp_Object a) +{ + eassert (SUBRP (a)); + return XUNTAG (a, Lisp_Vectorlike); +} + enum char_table_specials { /* This is the number of slots that every char table must have. Thi= s @@ -2070,6 +2119,25 @@ struct Lisp_Misc_Any /* Supertype of all Misc typ= es. */ unsigned spacer : 15; }; =20 +INLINE bool +(MISCP) (Lisp_Object x) +{ + return lisp_h_MISCP (x); +} + +INLINE struct Lisp_Misc_Any * +XMISCANY (Lisp_Object a) +{ + eassert (MISCP (a)); + return XUNTAG (a, Lisp_Misc); +} + +INLINE enum Lisp_Misc_Type +XMISCTYPE (Lisp_Object a) +{ + return XMISCANY (a)->type; +} + struct Lisp_Marker { ENUM_BF (Lisp_Misc_Type) type : 16; /* =3D Lisp_Misc_Marker */ @@ -2227,6 +2295,19 @@ struct Lisp_Save_Value } data[SAVE_VALUE_SLOTS]; }; =20 +INLINE bool +SAVE_VALUEP (Lisp_Object x) +{ + return MISCP (x) && XMISCTYPE (x) =3D=3D Lisp_Misc_Save_Value; +} + +INLINE struct Lisp_Save_Value * +XSAVE_VALUE (Lisp_Object a) +{ + eassert (SAVE_VALUEP (a)); + return XUNTAG (a, Lisp_Misc); +} + /* Return the type of V's Nth saved value. */ INLINE int save_type (struct Lisp_Save_Value *v, int n) @@ -2307,6 +2388,19 @@ struct Lisp_Finalizer Lisp_Object function; }; =20 +INLINE bool +FINALIZERP (Lisp_Object x) +{ + return MISCP (x) && XMISCTYPE (x) =3D=3D Lisp_Misc_Finalizer; +} + +INLINE struct Lisp_Finalizer * +XFINALIZER (Lisp_Object a) +{ + eassert (FINALIZERP (a)); + return XUNTAG (a, Lisp_Misc); +} + /* A miscellaneous object, when it's on the free list. */ struct Lisp_Free { @@ -2338,53 +2432,44 @@ XMISC (Lisp_Object a) return XUNTAG (a, Lisp_Misc); } =20 -INLINE struct Lisp_Misc_Any * -XMISCANY (Lisp_Object a) -{ - eassert (MISCP (a)); - return & XMISC (a)->u_any; -} - -INLINE enum Lisp_Misc_Type -XMISCTYPE (Lisp_Object a) +INLINE bool +(MARKERP) (Lisp_Object x) { - return XMISCANY (a)->type; + return lisp_h_MARKERP (x); } =20 INLINE struct Lisp_Marker * XMARKER (Lisp_Object a) { eassert (MARKERP (a)); - return & XMISC (a)->u_marker; + return XUNTAG (a, Lisp_Misc); } =20 -INLINE struct Lisp_Overlay * -XOVERLAY (Lisp_Object a) +INLINE bool +OVERLAYP (Lisp_Object x) { - eassert (OVERLAYP (a)); - return & XMISC (a)->u_overlay; + return MISCP (x) && XMISCTYPE (x) =3D=3D Lisp_Misc_Overlay; } =20 -INLINE struct Lisp_Save_Value * -XSAVE_VALUE (Lisp_Object a) +INLINE struct Lisp_Overlay * +XOVERLAY (Lisp_Object a) { - eassert (SAVE_VALUEP (a)); - return & XMISC (a)->u_save_value; + eassert (OVERLAYP (a)); + return XUNTAG (a, Lisp_Misc); } =20 -INLINE struct Lisp_Finalizer * -XFINALIZER (Lisp_Object a) +#ifdef HAVE_MODULES +INLINE bool +USER_PTRP (Lisp_Object x) { - eassert (FINALIZERP (a)); - return & XMISC (a)->u_finalizer; + return MISCP (x) && XMISCTYPE (x) =3D=3D Lisp_Misc_User_Ptr; } =20 -#ifdef HAVE_MODULES INLINE struct Lisp_User_Ptr * XUSER_PTR (Lisp_Object a) { eassert (USER_PTRP (a)); - return & XMISC (a)->u_user_ptr; + return XUNTAG (a, Lisp_Misc); } #endif =20 @@ -2502,6 +2587,12 @@ XFWDTYPE (union Lisp_Fwd *a) return a->u_intfwd.type; } =20 +INLINE bool +BUFFER_OBJFWDP (union Lisp_Fwd *a) +{ + return XFWDTYPE (a) =3D=3D Lisp_Fwd_Buffer_Obj; +} + INLINE struct Lisp_Buffer_Objfwd * XBUFFER_OBJFWD (union Lisp_Fwd *a) { @@ -2519,6 +2610,19 @@ struct Lisp_Float } u; }; =20 +INLINE bool +(FLOATP) (Lisp_Object x) +{ + return lisp_h_FLOATP (x); +} + +INLINE struct Lisp_Float * +XFLOAT (Lisp_Object a) +{ + eassert (FLOATP (a)); + return XUNTAG (a, Lisp_Float); +} + INLINE double XFLOAT_DATA (Lisp_Object f) { @@ -2582,12 +2686,6 @@ enum char_bits /* Data type checking. */ =20 INLINE bool -(NILP) (Lisp_Object x) -{ - return lisp_h_NILP (x); -} - -INLINE bool NUMBERP (Lisp_Object x) { return INTEGERP (x) || FLOATP (x); @@ -2610,109 +2708,11 @@ RANGED_INTEGERP (intmax_t lo, Lisp_Object x, int= max_t hi) && XINT (x) <=3D TYPE_MAXIMUM (type)) =20 INLINE bool -(CONSP) (Lisp_Object x) -{ - return lisp_h_CONSP (x); -} -INLINE bool -(FLOATP) (Lisp_Object x) -{ - return lisp_h_FLOATP (x); -} -INLINE bool -(MISCP) (Lisp_Object x) -{ - return lisp_h_MISCP (x); -} -INLINE bool -(SYMBOLP) (Lisp_Object x) -{ - return lisp_h_SYMBOLP (x); -} -INLINE bool -(INTEGERP) (Lisp_Object x) -{ - return lisp_h_INTEGERP (x); -} -INLINE bool -(VECTORLIKEP) (Lisp_Object x) -{ - return lisp_h_VECTORLIKEP (x); -} -INLINE bool -(MARKERP) (Lisp_Object x) -{ - return lisp_h_MARKERP (x); -} - -INLINE bool -STRINGP (Lisp_Object x) -{ - return XTYPE (x) =3D=3D Lisp_String; -} -INLINE bool -VECTORP (Lisp_Object x) -{ - return VECTORLIKEP (x) && ! (ASIZE (x) & PSEUDOVECTOR_FLAG); -} -INLINE bool -OVERLAYP (Lisp_Object x) -{ - return MISCP (x) && XMISCTYPE (x) =3D=3D Lisp_Misc_Overlay; -} -INLINE bool -SAVE_VALUEP (Lisp_Object x) -{ - return MISCP (x) && XMISCTYPE (x) =3D=3D Lisp_Misc_Save_Value; -} - -INLINE bool -FINALIZERP (Lisp_Object x) -{ - return MISCP (x) && XMISCTYPE (x) =3D=3D Lisp_Misc_Finalizer; -} - -#ifdef HAVE_MODULES -INLINE bool -USER_PTRP (Lisp_Object x) -{ - return MISCP (x) && XMISCTYPE (x) =3D=3D Lisp_Misc_User_Ptr; -} -#endif - -INLINE bool AUTOLOADP (Lisp_Object x) { return CONSP (x) && EQ (Qautoload, XCAR (x)); } =20 -INLINE bool -BUFFER_OBJFWDP (union Lisp_Fwd *a) -{ - return XFWDTYPE (a) =3D=3D Lisp_Fwd_Buffer_Obj; -} - -INLINE bool -PSEUDOVECTOR_TYPEP (struct vectorlike_header *a, int code) -{ - return ((a->size & (PSEUDOVECTOR_FLAG | PVEC_TYPE_MASK)) - =3D=3D (PSEUDOVECTOR_FLAG | (code << PSEUDOVECTOR_AREA_BITS))); -} - -/* True if A is a pseudovector whose code is CODE. */ -INLINE bool -PSEUDOVECTORP (Lisp_Object a, int code) -{ - if (! VECTORLIKEP (a)) - return false; - else - { - /* Converting to struct vectorlike_header * avoids aliasing issues= =2E */ - struct vectorlike_header *h =3D XUNTAG (a, Lisp_Vectorlike); - return PSEUDOVECTOR_TYPEP (h, code); - } -} - =20 /* Test for specific pseudovector types. */ =20 @@ -2723,60 +2723,12 @@ WINDOW_CONFIGURATIONP (Lisp_Object a) } =20 INLINE bool -PROCESSP (Lisp_Object a) -{ - return PSEUDOVECTORP (a, PVEC_PROCESS); -} - -INLINE bool -WINDOWP (Lisp_Object a) -{ - return PSEUDOVECTORP (a, PVEC_WINDOW); -} - -INLINE bool -TERMINALP (Lisp_Object a) -{ - return PSEUDOVECTORP (a, PVEC_TERMINAL); -} - -INLINE bool -SUBRP (Lisp_Object a) -{ - return PSEUDOVECTORP (a, PVEC_SUBR); -} - -INLINE bool COMPILEDP (Lisp_Object a) { return PSEUDOVECTORP (a, PVEC_COMPILED); } =20 INLINE bool -BUFFERP (Lisp_Object a) -{ - return PSEUDOVECTORP (a, PVEC_BUFFER); -} - -INLINE bool -CHAR_TABLE_P (Lisp_Object a) -{ - return PSEUDOVECTORP (a, PVEC_CHAR_TABLE); -} - -INLINE bool -SUB_CHAR_TABLE_P (Lisp_Object a) -{ - return PSEUDOVECTORP (a, PVEC_SUB_CHAR_TABLE); -} - -INLINE bool -BOOL_VECTOR_P (Lisp_Object a) -{ - return PSEUDOVECTORP (a, PVEC_BOOL_VECTOR); -} - -INLINE bool FRAMEP (Lisp_Object a) { return PSEUDOVECTORP (a, PVEC_FRAME); @@ -2809,42 +2761,16 @@ INLINE void } =20 INLINE void -(CHECK_SYMBOL) (Lisp_Object x) -{ - lisp_h_CHECK_SYMBOL (x); -} - -INLINE void (CHECK_NUMBER) (Lisp_Object x) { lisp_h_CHECK_NUMBER (x); } =20 INLINE void -CHECK_STRING (Lisp_Object x) -{ - CHECK_TYPE (STRINGP (x), Qstringp, x); -} -INLINE void CHECK_STRING_CAR (Lisp_Object x) { CHECK_TYPE (STRINGP (XCAR (x)), Qstringp, XCAR (x)); } -INLINE void -CHECK_CONS (Lisp_Object x) -{ - CHECK_TYPE (CONSP (x), Qconsp, x); -} -INLINE void -CHECK_VECTOR (Lisp_Object x) -{ - CHECK_TYPE (VECTORP (x), Qvectorp, x); -} -INLINE void -CHECK_BOOL_VECTOR (Lisp_Object x) -{ - CHECK_TYPE (BOOL_VECTOR_P (x), Qbool_vector_p, x); -} /* This is a bit special because we always need size afterwards. */ INLINE ptrdiff_t CHECK_VECTOR_OR_STRING (Lisp_Object x) @@ -2861,23 +2787,6 @@ CHECK_ARRAY (Lisp_Object x, Lisp_Object predicate)= CHECK_TYPE (ARRAYP (x), predicate, x); } INLINE void -CHECK_BUFFER (Lisp_Object x) -{ - CHECK_TYPE (BUFFERP (x), Qbufferp, x); -} -INLINE void -CHECK_WINDOW (Lisp_Object x) -{ - CHECK_TYPE (WINDOWP (x), Qwindowp, x); -} -#ifdef subprocesses -INLINE void -CHECK_PROCESS (Lisp_Object x) -{ - CHECK_TYPE (PROCESSP (x), Qprocessp, x); -} -#endif -INLINE void CHECK_NATNUM (Lisp_Object x) { CHECK_TYPE (NATNUMP (x), Qwholenump, x); @@ -3380,6 +3289,8 @@ set_sub_char_table_contents (Lisp_Object table, ptr= diff_t idx, Lisp_Object val) } =20 /* Defined in data.c. */ +extern void notify_variable_watchers (Lisp_Object, Lisp_Object, + Lisp_Object, Lisp_Object); extern Lisp_Object indirect_function (Lisp_Object); extern Lisp_Object find_symbol_value (Lisp_Object); enum Arith_Comparison { @@ -4194,6 +4105,7 @@ extern bool inhibit_window_system; extern bool running_asynch_code; =20 /* Defined in process.c. */ +struct Lisp_Process; extern void kill_buffer_processes (Lisp_Object); extern int wait_reading_process_output (intmax_t, int, int, bool, Lisp_O= bject, struct Lisp_Process *, int); diff --git a/src/process.h b/src/process.h index 24c6282..8f28ddb 100644 --- a/src/process.h +++ b/src/process.h @@ -199,6 +199,25 @@ struct Lisp_Process #endif }; =20 +INLINE bool +PROCESSP (Lisp_Object a) +{ + return PSEUDOVECTORP (a, PVEC_PROCESS); +} + +INLINE void +CHECK_PROCESS (Lisp_Object x) +{ + CHECK_TYPE (PROCESSP (x), Qprocessp, x); +} + +INLINE struct Lisp_Process * +XPROCESS (Lisp_Object a) +{ + eassert (PROCESSP (a)); + return XUNTAG (a, Lisp_Vectorlike); +} + /* Every field in the preceding structure except for the first two must be a Lisp_Object, for GC's sake. */ =20 diff --git a/src/termhooks.h b/src/termhooks.h index 03416cb..81e06d9 100644 --- a/src/termhooks.h +++ b/src/termhooks.h @@ -654,6 +654,19 @@ struct terminal void (*delete_terminal_hook) (struct terminal *); }; =20 +INLINE bool +TERMINALP (Lisp_Object a) +{ + return PSEUDOVECTORP (a, PVEC_TERMINAL); +} + +INLINE struct terminal * +XTERMINAL (Lisp_Object a) +{ + eassert (TERMINALP (a)); + return XUNTAG (a, Lisp_Vectorlike); +} + /* Most code should use these functions to set Lisp fields in struct terminal. */ INLINE void diff --git a/src/window.h b/src/window.h index 4a102f2..717f972 100644 --- a/src/window.h +++ b/src/window.h @@ -397,6 +397,25 @@ struct window ptrdiff_t window_end_bytepos; }; =20 +INLINE bool +WINDOWP (Lisp_Object a) +{ + return PSEUDOVECTORP (a, PVEC_WINDOW); +} + +INLINE void +CHECK_WINDOW (Lisp_Object x) +{ + CHECK_TYPE (WINDOWP (x), Qwindowp, x); +} + +INLINE struct window * +XWINDOW (Lisp_Object a) +{ + eassert (WINDOWP (a)); + return XUNTAG (a, Lisp_Vectorlike); +} + /* Most code should use these functions to set Lisp fields in struct window. */ INLINE void --=20 2.9.3 --------------783770E7FF0F264671CCFE29-- From debbugs-submit-bounces@debbugs.gnu.org Wed Dec 07 11:09:01 2016 Received: (at 25128) by debbugs.gnu.org; 7 Dec 2016 16:09:01 +0000 Received: from localhost ([127.0.0.1]:59416 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cEemD-0000ea-Gl for submit@debbugs.gnu.org; Wed, 07 Dec 2016 11:09:01 -0500 Received: from eggs.gnu.org ([208.118.235.92]:58452) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cEemC-0000eH-PX for 25128@debbugs.gnu.org; Wed, 07 Dec 2016 11:09:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cEem3-0007Lj-OA for 25128@debbugs.gnu.org; Wed, 07 Dec 2016 11:08:55 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_50,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:52758) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cEem3-0007Lf-KS; Wed, 07 Dec 2016 11:08:51 -0500 Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:1417 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1cEem2-0007W0-Vd; Wed, 07 Dec 2016 11:08:51 -0500 Date: Wed, 07 Dec 2016 18:09:15 +0200 Message-Id: <83r35jiuvo.fsf@gnu.org> From: Eli Zaretskii To: Paul Eggert In-reply-to: <04822678-e178-4b23-1a5b-ff452cbd88a3@cs.ucla.edu> (message from Paul Eggert on Tue, 6 Dec 2016 23:19:19 -0800) Subject: Re: bug#25128: Reorder lisp.h to declare types before using them References: <04822678-e178-4b23-1a5b-ff452cbd88a3@cs.ucla.edu> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -8.0 (--------) X-Debbugs-Envelope-To: 25128 Cc: 25128@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Eli Zaretskii Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -8.0 (--------) > From: Paul Eggert > Date: Tue, 6 Dec 2016 23:19:19 -0800 > > Attached is a patch to reorder src/lisp.h so that more types are declared before > use. The main motivation is to eventually add support for > -fcheck-pointer-bounds; future changes will need access to type sizes (e.g., > XCONS might need sizeof (struct Lisp_Cons)), which should be easy after this > change. Also, the change shortens lisp.h a bit and (if you ask me) makes it > easier to read, since the basic functions for a type are now declared next to > the type. > > I would like to install this soon, and am posting this as a bug report to give > Eli and others a heads-up, in case some MS-Windows module now needs to include > process.h. This may be needed because XPROCESS is now defined in process.h > instead of lisp.h; similarly for buffer.h, window.h, termhooks.h. Thanks. I'd appreciate if someone could beat me to it, as I'm busy merging and testing the concurrency branch, hopefully soon to land on master. In any case, could you please wait with pushing this for a few days until concurrency actually lands? I'm in the last stages of testing the merge, and it would minimize the impact of the final merging. The changes in lisp.h due to concurrency are very few, FWIW, so I don't believe it will require you to make changes in your patch due to the merge. TIA From debbugs-submit-bounces@debbugs.gnu.org Wed Dec 07 11:30:59 2016 Received: (at 25128) by debbugs.gnu.org; 7 Dec 2016 16:30:59 +0000 Received: from localhost ([127.0.0.1]:59439 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cEf7T-000272-Bu for submit@debbugs.gnu.org; Wed, 07 Dec 2016 11:30:59 -0500 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:47506) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cEf7R-0001yh-Cj for 25128@debbugs.gnu.org; Wed, 07 Dec 2016 11:30:57 -0500 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 20DA51600CD; Wed, 7 Dec 2016 08:30:51 -0800 (PST) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id Obn1q1eDVW9h; Wed, 7 Dec 2016 08:30:50 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 6E8EA1600D1; Wed, 7 Dec 2016 08:30:50 -0800 (PST) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id zdDj2SDzbDes; Wed, 7 Dec 2016 08:30:50 -0800 (PST) Received: from [192.168.1.9] (unknown [47.153.178.162]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 537241600CD; Wed, 7 Dec 2016 08:30:50 -0800 (PST) Subject: Re: bug#25128: Reorder lisp.h to declare types before using them To: Eli Zaretskii References: <04822678-e178-4b23-1a5b-ff452cbd88a3@cs.ucla.edu> <83r35jiuvo.fsf@gnu.org> From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: Date: Wed, 7 Dec 2016 08:30:49 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <83r35jiuvo.fsf@gnu.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -3.0 (---) X-Debbugs-Envelope-To: 25128 Cc: 25128@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.0 (---) Eli Zaretskii wrote: > could you please wait with pushing this for a few days > until concurrency actually lands? That shouldn't be a problem. It should give me more time to polish the -fcheck-pointer-bounds stuff. From debbugs-submit-bounces@debbugs.gnu.org Sun Dec 25 12:38:25 2016 Received: (at 25128-done) by debbugs.gnu.org; 25 Dec 2016 17:38:25 +0000 Received: from localhost ([127.0.0.1]:54901 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cLCkb-0001hq-7n for submit@debbugs.gnu.org; Sun, 25 Dec 2016 12:38:25 -0500 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:49178) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cLCkY-0001hX-FL for 25128-done@debbugs.gnu.org; Sun, 25 Dec 2016 12:38:23 -0500 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 9C7141600A8 for <25128-done@debbugs.gnu.org>; Sun, 25 Dec 2016 09:38:15 -0800 (PST) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id DvUU5XjNg-gM for <25128-done@debbugs.gnu.org>; Sun, 25 Dec 2016 09:38:15 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id EE5231600AE for <25128-done@debbugs.gnu.org>; Sun, 25 Dec 2016 09:38:14 -0800 (PST) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id rHwifPVace6n for <25128-done@debbugs.gnu.org>; Sun, 25 Dec 2016 09:38:14 -0800 (PST) Received: from [192.168.1.9] (unknown [47.153.178.162]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id D3DEA1600A8 for <25128-done@debbugs.gnu.org>; Sun, 25 Dec 2016 09:38:14 -0800 (PST) Subject: Re: bug#25128: Reorder lisp.h to declare types before using them References: <04822678-e178-4b23-1a5b-ff452cbd88a3@cs.ucla.edu> <83r35jiuvo.fsf@gnu.org> From: Paul Eggert Organization: UCLA Computer Science Department To: 25128-done@debbugs.gnu.org Message-ID: <79183a94-7a2c-18a2-9fa6-e2e4ead47ab9@cs.ucla.edu> Date: Sun, 25 Dec 2016 09:38:14 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.1 (---) X-Debbugs-Envelope-To: 25128-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.1 (---) I installed this patch, after fixing it up to work with the concurrency b= ranch. From debbugs-submit-bounces@debbugs.gnu.org Sun Dec 25 13:00:41 2016 Received: (at 25128) by debbugs.gnu.org; 25 Dec 2016 18:00:41 +0000 Received: from localhost ([127.0.0.1]:54912 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cLD69-0002Io-4f for submit@debbugs.gnu.org; Sun, 25 Dec 2016 13:00:41 -0500 Received: from eggs.gnu.org ([208.118.235.92]:49177) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cLD68-0002IZ-Ab for 25128@debbugs.gnu.org; Sun, 25 Dec 2016 13:00:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cLD5Y-0007CT-GO for 25128@debbugs.gnu.org; Sun, 25 Dec 2016 13:00:35 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=5.0 tests=BAYES_05,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:60917) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cLD5Y-0007CO-AD; Sun, 25 Dec 2016 13:00:04 -0500 Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:2124 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1cLD5W-0001Bn-L6; Sun, 25 Dec 2016 13:00:04 -0500 Date: Sun, 25 Dec 2016 19:59:38 +0200 Message-Id: <83a8bjyjn9.fsf@gnu.org> From: Eli Zaretskii To: Paul Eggert In-reply-to: <79183a94-7a2c-18a2-9fa6-e2e4ead47ab9@cs.ucla.edu> (message from Paul Eggert on Sun, 25 Dec 2016 09:38:14 -0800) Subject: Re: bug#25128: Reorder lisp.h to declare types before using them References: <04822678-e178-4b23-1a5b-ff452cbd88a3@cs.ucla.edu> <83r35jiuvo.fsf@gnu.org> <79183a94-7a2c-18a2-9fa6-e2e4ead47ab9@cs.ucla.edu> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -8.1 (--------) X-Debbugs-Envelope-To: 25128 Cc: 25128@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Eli Zaretskii Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -8.1 (--------) > From: Paul Eggert > Date: Sun, 25 Dec 2016 09:38:14 -0800 > > I installed this patch, after fixing it up to work with the concurrency branch. Thanks. However, it breaks the MS-Windows 32-bit build --with-wide-int: In file included from scroll.c:25:0: lisp.h:1001:1: error: redefinition of 'XUNTAG' XUNTAG (Lisp_Object a, int type) ^ In file included from scroll.c:25:0: lisp.h:630:2: note: previous definition of 'XUNTAG' was here (XUNTAG) (Lisp_Object a, int type) ^ and similarly in all the other files in src. In case this matters, the compiler switches are CFLAGS = -O0 -gdwarf-4 -g3 Let me know if I can help by providing further information. (A 64-bit GNU/Linux build succeeds, not surprisingly.) From debbugs-submit-bounces@debbugs.gnu.org Sun Dec 25 13:15:35 2016 Received: (at 25128) by debbugs.gnu.org; 25 Dec 2016 18:15:35 +0000 Received: from localhost ([127.0.0.1]:54918 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cLDKZ-0002eu-I1 for submit@debbugs.gnu.org; Sun, 25 Dec 2016 13:15:35 -0500 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:51568) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cLDKX-0002ei-Uw for 25128@debbugs.gnu.org; Sun, 25 Dec 2016 13:15:34 -0500 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 5AA271600A8; Sun, 25 Dec 2016 10:15:28 -0800 (PST) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id RtTuu2EMkhm6; Sun, 25 Dec 2016 10:15:27 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 909621600AE; Sun, 25 Dec 2016 10:15:27 -0800 (PST) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id GItdXehTgn8f; Sun, 25 Dec 2016 10:15:27 -0800 (PST) Received: from [192.168.1.9] (unknown [47.153.178.162]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 678901600A8; Sun, 25 Dec 2016 10:15:27 -0800 (PST) Subject: Re: bug#25128: Reorder lisp.h to declare types before using them To: Eli Zaretskii References: <04822678-e178-4b23-1a5b-ff452cbd88a3@cs.ucla.edu> <83r35jiuvo.fsf@gnu.org> <79183a94-7a2c-18a2-9fa6-e2e4ead47ab9@cs.ucla.edu> <83a8bjyjn9.fsf@gnu.org> From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: Date: Sun, 25 Dec 2016 10:15:27 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <83a8bjyjn9.fsf@gnu.org> Content-Type: multipart/mixed; boundary="------------3EEF414C284977C7AAB8C6FA" X-Spam-Score: -3.1 (---) X-Debbugs-Envelope-To: 25128 Cc: 25128@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.1 (---) This is a multi-part message in MIME format. --------------3EEF414C284977C7AAB8C6FA Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Eli Zaretskii wrote: > However, it breaks the MS-Windows 32-bit build --with-wide-int: Sorry about that. Should be fixed now, with the attached: --------------3EEF414C284977C7AAB8C6FA Content-Type: text/x-diff; name="0001-Fix-typo-in-lisp.h-reordering-patch.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-Fix-typo-in-lisp.h-reordering-patch.patch" >From 8c0f6ba65d4a277b0e99c3ce15c82f308d964f04 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 25 Dec 2016 10:12:39 -0800 Subject: [PATCH] Fix typo in lisp.h reordering patch * src/lisp.h (XUNTAG) [!USE_LSB_TAG]: Remove duplicate defn. Reported by Eli Zaretskii (Bug#25128#19). --- src/lisp.h | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/lisp.h b/src/lisp.h index 23d3ae4..dc2c7a6 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -996,14 +996,6 @@ XFASTINT (Lisp_Object a) return n; } -/* Extract A's pointer value, assuming A's type is TYPE. */ -INLINE void * -XUNTAG (Lisp_Object a, int type) -{ - intptr_t i = USE_LSB_TAG ? XLI (a) - type : XLI (a) & VALMASK; - return (void *) i; -} - #endif /* ! USE_LSB_TAG */ /* Extract A's value as an unsigned integer. */ -- 2.7.4 --------------3EEF414C284977C7AAB8C6FA-- From debbugs-submit-bounces@debbugs.gnu.org Sun Dec 25 13:20:17 2016 Received: (at 25128) by debbugs.gnu.org; 25 Dec 2016 18:20:17 +0000 Received: from localhost ([127.0.0.1]:54924 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cLDP7-0002mI-5Y for submit@debbugs.gnu.org; Sun, 25 Dec 2016 13:20:17 -0500 Received: from eggs.gnu.org ([208.118.235.92]:51607) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cLDP5-0002m6-NC for 25128@debbugs.gnu.org; Sun, 25 Dec 2016 13:20:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cLDOx-0004Cw-HL for 25128@debbugs.gnu.org; Sun, 25 Dec 2016 13:20:10 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:32815) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cLDOx-0004Cq-ET; Sun, 25 Dec 2016 13:20:07 -0500 Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:2151 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1cLDOw-0001mJ-FH; Sun, 25 Dec 2016 13:20:07 -0500 Date: Sun, 25 Dec 2016 20:19:49 +0200 Message-Id: <838tr3yipm.fsf@gnu.org> From: Eli Zaretskii To: Paul Eggert In-reply-to: (message from Paul Eggert on Sun, 25 Dec 2016 10:15:27 -0800) Subject: Re: bug#25128: Reorder lisp.h to declare types before using them References: <04822678-e178-4b23-1a5b-ff452cbd88a3@cs.ucla.edu> <83r35jiuvo.fsf@gnu.org> <79183a94-7a2c-18a2-9fa6-e2e4ead47ab9@cs.ucla.edu> <83a8bjyjn9.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -8.1 (--------) X-Debbugs-Envelope-To: 25128 Cc: 25128@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Eli Zaretskii Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -8.1 (--------) > Cc: 25128@debbugs.gnu.org > From: Paul Eggert > Date: Sun, 25 Dec 2016 10:15:27 -0800 > > Eli Zaretskii wrote: > > However, it breaks the MS-Windows 32-bit build --with-wide-int: > > Sorry about that. Should be fixed now, with the attached: Thanks, builds cleanly now. From unknown Tue Jun 17 20:08:00 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 23 Jan 2017 12:24:03 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator