Subject: Re: bug#11935: XINT etc. should be functions

From: Paul Eggert <[email-masked]>
Date: Thu, 13 Jun 2013 09:30:25 -0700

On 06/06/13 09:36, Andreas Schwab wrote:
> Since it's only used in buffer.c it should be moved there.

Yes, that's a win, as it makes it clearer to the human
reader that the function is used and needed only by one
module, and it simplifies lisp.h.  Attached is a patch to do that
systematically for lisp.h; it assumes the patch I sent out earlier today
<http://bugs.gnu.org/11935#110>.  A side effect is that
this gives GCC -O2 a bit more chance to optimize, shrinking
the executable by 3k on my x86-64 platform.

=== modified file 'src/ChangeLog'
--- src/ChangeLog	2013-06-13 14:17:41 +0000
+++ src/ChangeLog	2013-06-13 16:27:13 +0000
@@ -1,5 +1,38 @@
 2013-06-13  Paul Eggert  <[email-masked]>
 
+	Move functions from lisp.h to individual modules when possible.
+	From a suggestion by Andreas Schwab in <http://bugs.gnu.org/11935#68>.
+	* alloc.c (XFLOAT_INIT, set_symbol_name):
+	* buffer.c (CHECK_OVERLAY):
+	* chartab.c (CHECK_CHAR_TABLE, set_char_table_ascii)
+	(set_char_table_parent):
+	* coding.c (CHECK_NATNUM_CAR, CHECK_NATNUM_CDR):
+	* data.c (BOOLFWDP, INTFWDP, KBOARD_OBJFWDP, OBJFWDP, XBOOLFWD)
+	(XKBOARD_OBJFWD, XINTFWD, XOBJFWD, CHECK_SUBR, set_blv_found)
+	(blv_value, set_blv_value, set_blv_where, set_blv_defcell)
+	(set_blv_valcell):
+	* emacs.c (setlocale) [!HAVE_SETLOCALE]:
+	* eval.c (specpdl_symbol, specpdl_old_value, specpdl_where)
+	(specpdl_arg, specpdl_func, backtrace_function, backtrace_nargs)
+	(backtrace_args, backtrace_debug_on_exit):
+	* floatfns.c (CHECK_FLOAT):
+	* fns.c (CHECK_HASH_TABLE, CHECK_LIST_END)
+	(set_hash_key_and_value, set_hash_next, set_hash_next_slot)
+	(set_hash_hash, set_hash_hash_slot, set_hash_index)
+	(set_hash_index_slot):
+	* keymap.c (CHECK_VECTOR_OR_CHAR_TABLE):
+	* marker.c (CHECK_MARKER):
+	* textprop.c (CHECK_STRING_OR_BUFFER):
+	* window.c (CHECK_WINDOW_CONFIGURATION):
+	Move here from lisp.h, and make these functions static rather than
+	extern inline.
+	* buffer.c (Qoverlayp):
+	* data.c (Qsubrp):
+	* fns.c (Qhash_table_p):
+	* window.c (Qwindow_configuration_p):
+	Now static.
+	* lisp.h: Remove the abovementioned defns and decls.
+
 	Use functions, not macros, for XINT etc. (Bug#11935).
 	In lisp.h, prefer functions to function-like macros, and
 	constants to object-like macros, when either will do.  This:

=== modified file 'src/alloc.c'
--- src/alloc.c	2013-06-05 04:38:04 +0000
+++ src/alloc.c	2013-06-13 15:38:41 +0000
@@ -363,6 +363,11 @@
   ((void *) (((uintptr_t) (ptr) + (ALIGNMENT) - 1) \
 	     & ~ ((ALIGNMENT) - 1)))
 
+static void
+XFLOAT_INIT (Lisp_Object f, double n)
+{
+  XFLOAT (f)->u.data = n;
+}
 
 
 /************************************************************************
@@ -3189,6 +3194,12 @@
 
 static struct Lisp_Symbol *symbol_free_list;
 
+static void
+set_symbol_name (Lisp_Object sym, Lisp_Object name)
+{
+  XSYMBOL (sym)->name = name;
+}
+
 DEFUN ("make-symbol", Fmake_symbol, Smake_symbol, 1, 1, 0,
        doc: /* Return a newly allocated uninterned symbol whose name is NAME.
 Its value is void, and its function definition and property list are nil.  */)

=== modified file 'src/buffer.c'
--- src/buffer.c	2013-06-05 04:38:04 +0000
+++ src/buffer.c	2013-06-13 15:56:46 +0000
@@ -134,7 +134,7 @@
 
 static Lisp_Object Qget_file_buffer;
 
-Lisp_Object Qoverlayp;
+static Lisp_Object Qoverlayp;
 
 Lisp_Object Qpriority, Qbefore_string, Qafter_string;
 
@@ -150,6 +150,12 @@
 static void modify_overlay (struct buffer *, ptrdiff_t, ptrdiff_t);
 static Lisp_Object buffer_lisp_local_variables (struct buffer *, bool);
 
+static void
+CHECK_OVERLAY (Lisp_Object x)
+{
+  CHECK_TYPE (OVERLAYP (x), Qoverlayp, x);
+}
+
 /* These setters are used only in this file, so they can be private.  */
 static void
 bset_abbrev_mode (struct buffer *b, Lisp_Object val)
@@ -1539,7 +1545,7 @@
 	  && BUFFER_LIVE_P (XBUFFER (b))
 	  && !BUFFER_HIDDEN_P (XBUFFER (b)));
 }
-	  
+
 DEFUN ("other-buffer", Fother_buffer, Sother_buffer, 0, 3, 0,
        doc: /* Return most recently selected buffer other than BUFFER.
 Buffers not visible in windows are preferred to visible buffers, unless

=== modified file 'src/chartab.c'
--- src/chartab.c	2012-09-24 12:23:25 +0000
+++ src/chartab.c	2013-06-13 15:38:16 +0000
@@ -84,6 +84,22 @@
   (STRINGP (OBJ) && SCHARS (OBJ) > 0	\
    && ((SREF (OBJ, 0) == 1 || (SREF (OBJ, 0) == 2))))
 
+static void
+CHECK_CHAR_TABLE (Lisp_Object x)
+{
+  CHECK_TYPE (CHAR_TABLE_P (x), Qchar_table_p, x);
+}
+
+static void
+set_char_table_ascii (Lisp_Object table, Lisp_Object val)
+{
+  XCHAR_TABLE (table)->ascii = val;
+}
+static void
+set_char_table_parent (Lisp_Object table, Lisp_Object val)
+{
+  XCHAR_TABLE (table)->parent = val;
+}
 
 DEFUN ("make-char-table", Fmake_char_table, Smake_char_table, 1, 2, 0,
        doc: /* Return a newly created char-table, with purpose PURPOSE.

=== modified file 'src/coding.c'
--- src/coding.c	2013-05-22 14:53:21 +0000
+++ src/coding.c	2013-06-13 15:38:16 +0000
@@ -655,6 +655,22 @@
     (charset_list) = CODING_ATTR_CHARSET_LIST (attrs);	\
   } while (0)
 
+static void
+CHECK_NATNUM_CAR (Lisp_Object x)
+{
+  Lisp_Object tmp = XCAR (x);
+  CHECK_NATNUM (tmp);
+  XSETCAR (x, tmp);
+}
+
+static void
+CHECK_NATNUM_CDR (Lisp_Object x)
+{
+  Lisp_Object tmp = XCDR (x);
+  CHECK_NATNUM (tmp);
+  XSETCDR (x, tmp);
+}
+
 
 /* Safely get one byte from the source text pointed by SRC which ends
    at SRC_END, and set C to that byte.  If there are not enough bytes

=== modified file 'src/data.c'
--- src/data.c	2013-06-05 04:38:04 +0000
+++ src/data.c	2013-06-13 15:56:52 +0000
@@ -76,7 +76,7 @@
 static Lisp_Object Qcompiled_function, Qframe;
 Lisp_Object Qbuffer;
 static Lisp_Object Qchar_table, Qbool_vector, Qhash_table;
-Lisp_Object Qsubrp;
+static Lisp_Object Qsubrp;
 static Lisp_Object Qmany, Qunevalled;
 Lisp_Object Qfont_spec, Qfont_entity, Qfont_object;
 static Lisp_Object Qdefun;
@@ -86,6 +86,94 @@
 
 static void swap_in_symval_forwarding (struct Lisp_Symbol *, struct Lisp_Buffer_Local_Value *);
 
+static bool
+BOOLFWDP (union Lisp_Fwd *a)
+{
+  return XFWDTYPE (a) == Lisp_Fwd_Bool;
+}
+static bool
+INTFWDP (union Lisp_Fwd *a)
+{
+  return XFWDTYPE (a) == Lisp_Fwd_Int;
+}
+static bool
+KBOARD_OBJFWDP (union Lisp_Fwd *a)
+{
+  return XFWDTYPE (a) == Lisp_Fwd_Kboard_Obj;
+}
+static bool
+OBJFWDP (union Lisp_Fwd *a)
+{
+  return XFWDTYPE (a) == Lisp_Fwd_Obj;
+}
+
+static struct Lisp_Boolfwd *
+XBOOLFWD (union Lisp_Fwd *a)
+{
+  eassert (BOOLFWDP (a));
+  return &a->u_boolfwd;
+}
+static struct Lisp_Kboard_Objfwd *
+XKBOARD_OBJFWD (union Lisp_Fwd *a)
+{
+  eassert (KBOARD_OBJFWDP (a));
+  return &a->u_kboard_objfwd;
+}
+static struct Lisp_Intfwd *
+XINTFWD (union Lisp_Fwd *a)
+{
+  eassert (INTFWDP (a));
+  return &a->u_intfwd;
+}
+static struct Lisp_Objfwd *
+XOBJFWD (union Lisp_Fwd *a)
+{
+  eassert (OBJFWDP (a));
+  return &a->u_objfwd;
+}
+
+static void
+CHECK_SUBR (Lisp_Object x)
+{
+  CHECK_TYPE (SUBRP (x), Qsubrp, x);
+}
+
+static void
+set_blv_found (struct Lisp_Buffer_Local_Value *blv, int found)
+{
+  eassert (found == !EQ (blv->defcell, blv->valcell));
+  blv->found = found;
+}
+
+static Lisp_Object
+blv_value (struct Lisp_Buffer_Local_Value *blv)
+{
+  return XCDR (blv->valcell);
+}
+
+static void
+set_blv_value (struct Lisp_Buffer_Local_Value *blv, Lisp_Object val)
+{
+  XSETCDR (blv->valcell, val);
+}
+
+static void
+set_blv_where (struct Lisp_Buffer_Local_Value *blv, Lisp_Object val)
+{
+  blv->where = val;
+}
+
+static void
+set_blv_defcell (struct Lisp_Buffer_Local_Value *blv, Lisp_Object val)
+{
+  blv->defcell = val;
+}
+
+static void
+set_blv_valcell (struct Lisp_Buffer_Local_Value *blv, Lisp_Object val)
+{
+  blv->valcell = val;
+}
 
 Lisp_Object
 wrong_type_argument (register Lisp_Object predicate, register Lisp_Object value)

=== modified file 'src/emacs.c'
--- src/emacs.c	2013-06-05 12:17:02 +0000
+++ src/emacs.c	2013-06-13 15:38:16 +0000
@@ -306,6 +306,13 @@
 static void *ns_pool;
 #endif
 
+#if !HAVE_SETLOCALE
+static char *
+setlocale (int cat, char const *locale)
+{
+  return 0;
+}
+#endif

 /* Report a fatal error due to signal SIG, output a backtrace of at

=== modified file 'src/eval.c'
--- src/eval.c	2013-06-05 04:38:04 +0000
+++ src/eval.c	2013-06-13 15:44:00 +0000
@@ -115,6 +115,69 @@
 static Lisp_Object funcall_lambda (Lisp_Object, ptrdiff_t, Lisp_Object *);
 static Lisp_Object apply_lambda (Lisp_Object fun, Lisp_Object args);
 
+static Lisp_Object
+specpdl_symbol (struct specbinding *pdl)
+{
+  eassert (pdl->kind >= SPECPDL_LET);
+  return pdl->v.let.symbol;
+}
+
+static Lisp_Object
+specpdl_old_value (struct specbinding *pdl)
+{
+  eassert (pdl->kind >= SPECPDL_LET);
+  return pdl->v.let.old_value;
+}
+
+static Lisp_Object
+specpdl_where (struct specbinding *pdl)
+{
+  eassert (pdl->kind > SPECPDL_LET);
+  return pdl->v.let.where;
+}
+
+static Lisp_Object
+specpdl_arg (struct specbinding *pdl)
+{
+  eassert (pdl->kind == SPECPDL_UNWIND);
+  return pdl->v.unwind.arg;
+}
+
+static specbinding_func
+specpdl_func (struct specbinding *pdl)
+{
+  eassert (pdl->kind == SPECPDL_UNWIND);
+  return pdl->v.unwind.func;
+}
+
+static Lisp_Object
+backtrace_function (struct specbinding *pdl)
+{
+  eassert (pdl->kind == SPECPDL_BACKTRACE);
+  return pdl->v.bt.function;
+}
+
+static ptrdiff_t
+backtrace_nargs (struct specbinding *pdl)
+{
+  eassert (pdl->kind == SPECPDL_BACKTRACE);
+  return pdl->v.bt.nargs;
+}
+
+static Lisp_Object *
+backtrace_args (struct specbinding *pdl)
+{
+  eassert (pdl->kind == SPECPDL_BACKTRACE);
+  return pdl->v.bt.args;
+}
+
+static bool
+backtrace_debug_on_exit (struct specbinding *pdl)
+{
+  eassert (pdl->kind == SPECPDL_BACKTRACE);
+  return pdl->v.bt.debug_on_exit;
+}
+
 /* Functions to modify slots of backtrace records.  */
 
 static void

=== modified file 'src/floatfns.c'
--- src/floatfns.c	2013-03-24 12:59:45 +0000
+++ src/floatfns.c	2013-06-13 15:38:16 +0000
@@ -41,6 +41,14 @@
 # define isnan(x) ((x) != (x))
 #endif
 
+/* Check that X is a floating point number.  */
+
+static void
+CHECK_FLOAT (Lisp_Object x)
+{
+  CHECK_TYPE (FLOATP (x), Qfloatp, x);
+}
+
 /* Extract a Lisp number as a `double', or signal an error.  */
 
 double

=== modified file 'src/fns.c'
--- src/fns.c	2013-06-05 04:38:04 +0000
+++ src/fns.c	2013-06-13 16:00:53 +0000
@@ -91,6 +91,12 @@
 
 /* Random data-structure functions.  */
 
+static void
+CHECK_LIST_END (Lisp_Object x, Lisp_Object y)
+{
+  CHECK_TYPE (NILP (x), Qlistp, y);
+}
+
 DEFUN ("length", Flength, Slength, 1, 1, 0,
        doc: /* Return the length of vector, list or string SEQUENCE.
 A byte-code function object is also allowed.
@@ -3335,7 +3341,7 @@
 
 /* Various symbols.  */
 
-Lisp_Object Qhash_table_p;
+static Lisp_Object Qhash_table_p;
 static Lisp_Object Qkey, Qvalue, Qeql;
 Lisp_Object Qeq, Qequal;
 Lisp_Object QCtest, QCsize, QCrehash_size, QCrehash_threshold, QCweakness;
@@ -3346,6 +3352,48 @@
 			       Utilities
  ***********************************************************************/
 
+static void
+CHECK_HASH_TABLE (Lisp_Object x)
+{
+  return CHECK_TYPE (HASH_TABLE_P (x), Qhash_table_p, x);
+}
+
+static void
+set_hash_key_and_value (struct Lisp_Hash_Table *h, Lisp_Object key_and_value)
+{
+  h->key_and_value = key_and_value;
+}
+static void
+set_hash_next (struct Lisp_Hash_Table *h, Lisp_Object next)
+{
+  h->next = next;
+}
+static void
+set_hash_next_slot (struct Lisp_Hash_Table *h, ptrdiff_t idx, Lisp_Object val)
+{
+  gc_aset (h->next, idx, val);
+}
+static void
+set_hash_hash (struct Lisp_Hash_Table *h, Lisp_Object hash)
+{
+  h->hash = hash;
+}
+static void
+set_hash_hash_slot (struct Lisp_Hash_Table *h, ptrdiff_t idx, Lisp_Object val)
+{
+  gc_aset (h->hash, idx, val);
+}
+static void
+set_hash_index (struct Lisp_Hash_Table *h, Lisp_Object index)
+{
+  h->index = index;
+}
+static void
+set_hash_index_slot (struct Lisp_Hash_Table *h, ptrdiff_t idx, Lisp_Object val)
+{
+  gc_aset (h->index, idx, val);
+}
+
 /* If OBJ is a Lisp hash table, return a pointer to its struct
    Lisp_Hash_Table.  Otherwise, signal an error.  */

=== modified file 'src/keymap.c'
--- src/keymap.c	2013-06-05 01:58:43 +0000
+++ src/keymap.c	2013-06-13 15:38:16 +0000
@@ -106,6 +106,12 @@
                              Lisp_Object, Lisp_Object, bool, bool);
 static void silly_event_symbol_error (Lisp_Object);
 static Lisp_Object get_keyelt (Lisp_Object, bool);
+
+static void
+CHECK_VECTOR_OR_CHAR_TABLE (Lisp_Object x)
+{
+  CHECK_TYPE (VECTORP (x) || CHAR_TABLE_P (x), Qvector_or_char_table_p, x);
+}
 
 /* Keymap object support - constructors and predicates.			*/

=== modified file 'src/lisp.h'
--- src/lisp.h	2013-06-13 00:07:44 +0000
+++ src/lisp.h	2013-06-13 16:02:41 +0000
@@ -715,7 +715,6 @@
 
 /* Defined in this file.  */
 union Lisp_Fwd;
-LISP_INLINE bool BOOLFWDP (union Lisp_Fwd *);
 LISP_INLINE bool BOOL_VECTOR_P (Lisp_Object);
 LISP_INLINE bool BUFFER_OBJFWDP (union Lisp_Fwd *);
 LISP_INLINE bool BUFFERP (Lisp_Object);
@@ -725,12 +724,9 @@
 LISP_INLINE bool (FLOATP) (Lisp_Object);
 LISP_INLINE bool functionp (Lisp_Object);
 LISP_INLINE bool (INTEGERP) (Lisp_Object);
-LISP_INLINE bool INTFWDP (union Lisp_Fwd *);
-LISP_INLINE bool KBOARD_OBJFWDP (union Lisp_Fwd *);
 LISP_INLINE bool (MARKERP) (Lisp_Object);
 LISP_INLINE bool (MISCP) (Lisp_Object);
 LISP_INLINE bool (NILP) (Lisp_Object);
-LISP_INLINE bool OBJFWDP (union Lisp_Fwd *);
 LISP_INLINE bool OVERLAYP (Lisp_Object);
 LISP_INLINE bool PROCESSP (Lisp_Object);
 LISP_INLINE bool PSEUDOVECTORP (Lisp_Object, int);
@@ -745,9 +741,6 @@
 LISP_INLINE bool WINDOWP (Lisp_Object);
 LISP_INLINE struct Lisp_Save_Value *XSAVE_VALUE (Lisp_Object);
 
-/* Defined in buffer.c.  */
-extern Lisp_Object Qoverlayp;
-
 /* Defined in chartab.c.  */
 extern Lisp_Object char_table_ref (Lisp_Object, int);
 extern void char_table_set (Lisp_Object, int, Lisp_Object);
@@ -756,7 +749,7 @@
 /* Defined in data.c.  */
 extern Lisp_Object Qarrayp, Qbufferp, Qbuffer_or_string_p, Qchar_table_p;
 extern Lisp_Object Qconsp, Qfloatp, Qintegerp, Qlambda, Qlistp, Qmarkerp, Qnil;
-extern Lisp_Object Qnumberp, Qsubrp, Qstringp, Qsymbolp, Qvectorp;
+extern Lisp_Object Qnumberp, Qstringp, Qsymbolp, Qvectorp;
 extern Lisp_Object Qvector_or_char_table_p, Qwholenump;
 extern Lisp_Object Ffboundp (Lisp_Object);
 extern _Noreturn Lisp_Object wrong_type_argument (Lisp_Object, Lisp_Object);
@@ -767,9 +760,6 @@
 /* Defined in eval.c.  */
 extern Lisp_Object Qautoload;
 
-/* Defined in fns.c  */
-extern Lisp_Object Qhash_table_p;
-
 /* Defined in floatfns.c.  */
 extern double extract_float (Lisp_Object);
 
@@ -777,7 +767,7 @@
 extern Lisp_Object Qprocessp;
 
 /* Defined in window.c.  */
-extern Lisp_Object Qwindowp, Qwindow_configuration_p;
+extern Lisp_Object Qwindowp;
 
 /* Defined in xdisp.c.  */
 extern Lisp_Object Qimage;
@@ -956,13 +946,6 @@
 
 typedef struct interval *INTERVAL;
 
-/* Complain if object is not string or buffer type.  */
-LISP_INLINE void
-CHECK_STRING_OR_BUFFER (Lisp_Object x)
-{
-  CHECK_TYPE (STRINGP (x) || BUFFERP (x), Qbuffer_or_string_p, x);
-}
-
 struct Lisp_Cons
   {
     /* Car of this cons cell.  */
@@ -1677,11 +1660,6 @@
 {
   return PSEUDOVECTORP (a, PVEC_HASH_TABLE);
 }
-LISP_INLINE void
-CHECK_HASH_TABLE (Lisp_Object x)
-{
-  return CHECK_TYPE (HASH_TABLE_P (x), Qhash_table_p, x);
-}
 
 /* Value is the key part of entry IDX in hash table H.  */
 LISP_INLINE Lisp_Object
@@ -2156,40 +2134,12 @@
   return a->u_intfwd.type;
 }
 
-LISP_INLINE struct Lisp_Intfwd *
-XINTFWD (union Lisp_Fwd *a)
-{
-  eassert (INTFWDP (a));
-  return &a->u_intfwd;
-}
-
-LISP_INLINE struct Lisp_Boolfwd *
-XBOOLFWD (union Lisp_Fwd *a)
-{
-  eassert (BOOLFWDP (a));
-  return &a->u_boolfwd;
-}
-
-LISP_INLINE struct Lisp_Objfwd *
-XOBJFWD (union Lisp_Fwd *a)
-{
-  eassert (OBJFWDP (a));
-  return &a->u_objfwd;
-}
-
 LISP_INLINE struct Lisp_Buffer_Objfwd *
 XBUFFER_OBJFWD (union Lisp_Fwd *a)
 {
   eassert (BUFFER_OBJFWDP (a));
   return &a->u_buffer_objfwd;
 }
-
-LISP_INLINE struct Lisp_Kboard_Objfwd *
-XKBOARD_OBJFWD (union Lisp_Fwd *a)
-{
-  eassert (KBOARD_OBJFWDP (a));
-  return &a->u_kboard_objfwd;
-}
 
 /* Lisp floating point type.  */
 struct Lisp_Float
@@ -2207,12 +2157,6 @@
   return XFLOAT (f)->u.data;
 }
 
-LISP_INLINE void
-XFLOAT_INIT (Lisp_Object f, double n)
-{
-  XFLOAT (f)->u.data = n;
-}
-
 /* Most hosts nowadays use IEEE floating point, so they use IEC 60559
    representations, have infinities and NaNs, and do not trap on
    exceptions.  Define IEEE_FLOATING_POINT if this host is one of the
@@ -2392,30 +2336,10 @@
 }
 
 LISP_INLINE bool
-INTFWDP (union Lisp_Fwd *a)
-{
-  return XFWDTYPE (a) == Lisp_Fwd_Int;
-}
-LISP_INLINE bool
-BOOLFWDP (union Lisp_Fwd *a)
-{
-  return XFWDTYPE (a) == Lisp_Fwd_Bool;
-}
-LISP_INLINE bool
-OBJFWDP (union Lisp_Fwd *a)
-{
-  return XFWDTYPE (a) == Lisp_Fwd_Obj;
-}
-LISP_INLINE bool
 BUFFER_OBJFWDP (union Lisp_Fwd *a)
 {
   return XFWDTYPE (a) == Lisp_Fwd_Buffer_Obj;
 }
-LISP_INLINE bool
-KBOARD_OBJFWDP (union Lisp_Fwd *a)
-{
-  return XFWDTYPE (a) == Lisp_Fwd_Kboard_Obj;
-}
 
 LISP_INLINE bool
 PSEUDOVECTOR_TYPEP (struct vectorlike_header *a, int code)
@@ -2532,11 +2456,6 @@
   lisp_h_CHECK_LIST_CONS (x, y);
 }
 LISP_INLINE void
-CHECK_LIST_END (Lisp_Object x, Lisp_Object y)
-{
-  CHECK_TYPE (NILP (x), Qlistp, y);
-}
-LISP_INLINE void
 CHECK_STRING (Lisp_Object x)
 {
   CHECK_TYPE (STRINGP (x), Qstringp, x);
@@ -2557,11 +2476,6 @@
   lisp_h_CHECK_SYMBOL (x);
 }
 LISP_INLINE void
-CHECK_CHAR_TABLE (Lisp_Object x)
-{
-  CHECK_TYPE (CHAR_TABLE_P (x), Qchar_table_p, x);
-}
-LISP_INLINE void
 CHECK_VECTOR (Lisp_Object x)
 {
   CHECK_TYPE (VECTORP (x), Qvectorp, x);
@@ -2577,11 +2491,6 @@
   CHECK_TYPE (ARRAYP (x), Qxxxp, x);
 }
 LISP_INLINE void
-CHECK_VECTOR_OR_CHAR_TABLE (Lisp_Object x)
-{
-  CHECK_TYPE (VECTORP (x) || CHAR_TABLE_P (x), Qvector_or_char_table_p, x);
-}
-LISP_INLINE void
 CHECK_BUFFER (Lisp_Object x)
 {
   CHECK_TYPE (BUFFERP (x), Qbufferp, x);
@@ -2592,21 +2501,11 @@
   CHECK_TYPE (WINDOWP (x), Qwindowp, x);
 }
 LISP_INLINE void
-CHECK_WINDOW_CONFIGURATION (Lisp_Object x)
-{
-  CHECK_TYPE (WINDOW_CONFIGURATIONP (x), Qwindow_configuration_p, x);
-}
-LISP_INLINE void
 CHECK_PROCESS (Lisp_Object x)
 {
   CHECK_TYPE (PROCESSP (x), Qprocessp, x);
 }
 LISP_INLINE void
-CHECK_SUBR (Lisp_Object x)
-{
-  CHECK_TYPE (SUBRP (x), Qsubrp, x);
-}
-LISP_INLINE void
 (CHECK_NUMBER) (Lisp_Object x)
 {
   lisp_h_CHECK_NUMBER (x);
@@ -2636,12 +2535,6 @@
       CHECK_RANGED_INTEGER (x, 0, TYPE_MAXIMUM (type));			\
   } while (0)
 
-LISP_INLINE void
-CHECK_MARKER (Lisp_Object x)
-{
-  CHECK_TYPE (MARKERP (x), Qmarkerp, x);
-}
-
 #define CHECK_NUMBER_COERCE_MARKER(x) \
   do { if (MARKERP ((x))) XSETFASTINT (x, marker_position (x)); \
     else CHECK_TYPE (INTEGERP (x), Qinteger_or_marker_p, x); } while (0)
@@ -2653,11 +2546,6 @@
 }
 
 LISP_INLINE void
-CHECK_FLOAT (Lisp_Object x)
-{
-  CHECK_TYPE (FLOATP (x), Qfloatp, x);
-}
-LISP_INLINE void
 CHECK_NUMBER_OR_FLOAT (Lisp_Object x)
 {
   CHECK_TYPE (FLOATP (x) || INTEGERP (x), Qnumberp, x);
@@ -2667,12 +2555,6 @@
   do { if (MARKERP (x)) XSETFASTINT (x, marker_position (x)); \
     else CHECK_TYPE (INTEGERP (x) || FLOATP (x), Qnumber_or_marker_p, x); } while (0)
 
-LISP_INLINE void
-CHECK_OVERLAY (Lisp_Object x)
-{
-  CHECK_TYPE (OVERLAYP (x), Qoverlayp, x);
-}
-
 /* Since we can't assign directly to the CAR or CDR fields of a cons
    cell, use these when checking that those fields contain numbers.  */
 LISP_INLINE void
@@ -2690,22 +2572,6 @@
   CHECK_NUMBER (tmp);
   XSETCDR (x, tmp);
 }
-
-LISP_INLINE void
-CHECK_NATNUM_CAR (Lisp_Object x)
-{
-  Lisp_Object tmp = XCAR (x);
-  CHECK_NATNUM (tmp);
-  XSETCAR (x, tmp);
-}
-
-LISP_INLINE void
-CHECK_NATNUM_CDR (Lisp_Object x)
-{
-  Lisp_Object tmp = XCDR (x);
-  CHECK_NATNUM (tmp);
-  XSETCDR (x, tmp);
-}
 
 /* Define a built-in function for calling from Lisp.
  `lname' should be the name to give the function in Lisp,
@@ -2932,33 +2798,6 @@
     } v;
   };
 
-LISP_INLINE Lisp_Object specpdl_symbol (struct specbinding *pdl)
-{ eassert (pdl->kind >= SPECPDL_LET); return pdl->v.let.symbol; }
-
-LISP_INLINE Lisp_Object specpdl_old_value (struct specbinding *pdl)
-{ eassert (pdl->kind >= SPECPDL_LET); return pdl->v.let.old_value; }
-
-LISP_INLINE Lisp_Object specpdl_where (struct specbinding *pdl)
-{ eassert (pdl->kind > SPECPDL_LET); return pdl->v.let.where; }
-
-LISP_INLINE Lisp_Object specpdl_arg (struct specbinding *pdl)
-{ eassert (pdl->kind == SPECPDL_UNWIND); return pdl->v.unwind.arg; }
-
-LISP_INLINE specbinding_func specpdl_func (struct specbinding *pdl)
-{ eassert (pdl->kind == SPECPDL_UNWIND); return pdl->v.unwind.func; }
-
-LISP_INLINE Lisp_Object backtrace_function (struct specbinding *pdl)
-{ eassert (pdl->kind == SPECPDL_BACKTRACE); return pdl->v.bt.function; }
-
-LISP_INLINE ptrdiff_t backtrace_nargs (struct specbinding *pdl)
-{ eassert (pdl->kind == SPECPDL_BACKTRACE); return pdl->v.bt.nargs; }
-
-LISP_INLINE Lisp_Object *backtrace_args (struct specbinding *pdl)
-{ eassert (pdl->kind == SPECPDL_BACKTRACE); return pdl->v.bt.args; }
-
-LISP_INLINE bool backtrace_debug_on_exit (struct specbinding *pdl)
-{ eassert (pdl->kind == SPECPDL_BACKTRACE); return pdl->v.bt.debug_on_exit; }
-
 extern struct specbinding *specpdl;
 extern struct specbinding *specpdl_ptr;
 extern ptrdiff_t specpdl_size;
@@ -3301,12 +3140,6 @@
 /* Functions to modify hash tables.  */
 
 LISP_INLINE void
-set_hash_key_and_value (struct Lisp_Hash_Table *h, Lisp_Object key_and_value)
-{
-  h->key_and_value = key_and_value;
-}
-
-LISP_INLINE void
 set_hash_key_slot (struct Lisp_Hash_Table *h, ptrdiff_t idx, Lisp_Object val)
 {
   gc_aset (h->key_and_value, 2 * idx, val);
@@ -3318,52 +3151,10 @@
   gc_aset (h->key_and_value, 2 * idx + 1, val);
 }
 
-LISP_INLINE void
-set_hash_next (struct Lisp_Hash_Table *h, Lisp_Object next)
-{
-  h->next = next;
-}
-
-LISP_INLINE void
-set_hash_next_slot (struct Lisp_Hash_Table *h, ptrdiff_t idx, Lisp_Object val)
-{
-  gc_aset (h->next, idx, val);
-}
-
-LISP_INLINE void
-set_hash_hash (struct Lisp_Hash_Table *h, Lisp_Object hash)
-{
-  h->hash = hash;
-}
-
-LISP_INLINE void
-set_hash_hash_slot (struct Lisp_Hash_Table *h, ptrdiff_t idx, Lisp_Object val)
-{
-  gc_aset (h->hash, idx, val);
-}
-
-LISP_INLINE void
-set_hash_index (struct Lisp_Hash_Table *h, Lisp_Object index)
-{
-  h->index = index;
-}
-
-LISP_INLINE void
-set_hash_index_slot (struct Lisp_Hash_Table *h, ptrdiff_t idx, Lisp_Object val)
-{
-  gc_aset (h->index, idx, val);
-}
-
 /* Use these functions to set Lisp_Object
    or pointer slots of struct Lisp_Symbol.  */
 
 LISP_INLINE void
-set_symbol_name (Lisp_Object sym, Lisp_Object name)
-{
-  XSYMBOL (sym)->name = name;
-}
-
-LISP_INLINE void
 set_symbol_function (Lisp_Object sym, Lisp_Object function)
 {
   XSYMBOL (sym)->function = function;
@@ -3390,43 +3181,6 @@
   return blv->found;
 }
 
-LISP_INLINE void
-set_blv_found (struct Lisp_Buffer_Local_Value *blv, int found)
-{
-  eassert (found == !EQ (blv->defcell, blv->valcell));
-  blv->found = found;
-}
-
-LISP_INLINE Lisp_Object
-blv_value (struct Lisp_Buffer_Local_Value *blv)
-{
-  return XCDR (blv->valcell);
-}
-
-LISP_INLINE void
-set_blv_value (struct Lisp_Buffer_Local_Value *blv, Lisp_Object val)
-{
-  XSETCDR (blv->valcell, val);
-}
-
-LISP_INLINE void
-set_blv_where (struct Lisp_Buffer_Local_Value *blv, Lisp_Object val)
-{
-  blv->where = val;
-}
-
-LISP_INLINE void
-set_blv_defcell (struct Lisp_Buffer_Local_Value *blv, Lisp_Object val)
-{
-  blv->defcell = val;
-}
-
-LISP_INLINE void
-set_blv_valcell (struct Lisp_Buffer_Local_Value *blv, Lisp_Object val)
-{
-  blv->valcell = val;
-}
-
 /* Set overlay's property list.  */
 
 LISP_INLINE void
@@ -3455,21 +3209,11 @@
    of setting slots directly.  */
 
 LISP_INLINE void
-set_char_table_ascii (Lisp_Object table, Lisp_Object val)
-{
-  XCHAR_TABLE (table)->ascii = val;
-}
-LISP_INLINE void
 set_char_table_defalt (Lisp_Object table, Lisp_Object val)
 {
   XCHAR_TABLE (table)->defalt = val;
 }
 LISP_INLINE void
-set_char_table_parent (Lisp_Object table, Lisp_Object val)
-{
-  XCHAR_TABLE (table)->parent = val;
-}
-LISP_INLINE void
 set_char_table_purpose (Lisp_Object table, Lisp_Object val)
 {
   XCHAR_TABLE (table)->purpose = val;
@@ -3525,7 +3269,6 @@
 
 extern Lisp_Object Qbuffer, Qinteger, Qsymbol;
 
-extern Lisp_Object Qsubrp;
 extern Lisp_Object Qfont_spec, Qfont_entity, Qfont_object;
 
 EXFUN (Fbyteorder, 0) ATTRIBUTE_CONST;
@@ -4110,7 +3853,6 @@
 extern Lisp_Object Vbuffer_alist;
 extern Lisp_Object set_buffer_if_live (Lisp_Object);
 extern Lisp_Object other_buffer_safely (Lisp_Object);
-extern Lisp_Object Qoverlayp;
 extern Lisp_Object Qpriority, Qwindow, Qbefore_string, Qafter_string;
 extern Lisp_Object get_truename_buffer (Lisp_Object);
 extern void init_buffer_once (void);
@@ -4274,7 +4016,6 @@
 void synchronize_system_messages_locale (void);
 void synchronize_system_time_locale (void);
 #else
-LISP_INLINE char *setlocale (int cat, char const *locale) { return 0; }
 LISP_INLINE void fixup_locale (void) {}
 LISP_INLINE void synchronize_system_messages_locale (void) {}
 LISP_INLINE void synchronize_system_time_locale (void) {}

=== modified file 'src/marker.c'
--- src/marker.c	2013-02-19 14:44:03 +0000
+++ src/marker.c	2013-06-13 15:38:16 +0000
@@ -127,6 +127,12 @@
     }									\
 }
 
+static void
+CHECK_MARKER (Lisp_Object x)
+{
+  CHECK_TYPE (MARKERP (x), Qmarkerp, x);
+}
+
 /* Return the byte position corresponding to CHARPOS in B.  */
 
 ptrdiff_t

=== modified file 'src/textprop.c'
--- src/textprop.c	2013-03-28 14:04:49 +0000
+++ src/textprop.c	2013-06-13 15:38:16 +0000
@@ -98,6 +98,14 @@
   set_buffer_internal (old);
 }
 
+/* Complain if object is not string or buffer type.  */
+
+static void
+CHECK_STRING_OR_BUFFER (Lisp_Object x)
+{
+  CHECK_TYPE (STRINGP (x) || BUFFERP (x), Qbuffer_or_string_p, x);
+}
+
 /* Extract the interval at the position pointed to by BEGIN from
    OBJECT, a string or buffer.  Additionally, check that the positions
    pointed to by BEGIN and END are within the bounds of OBJECT, and

=== modified file 'src/window.c'
--- src/window.c	2013-06-05 04:38:04 +0000
+++ src/window.c	2013-06-13 16:02:24 +0000
@@ -55,7 +55,7 @@
 
 Lisp_Object Qwindowp, Qwindow_live_p;
 static Lisp_Object Qwindow_valid_p;
-Lisp_Object Qwindow_configuration_p;
+static Lisp_Object Qwindow_configuration_p;
 static Lisp_Object Qrecord_window_buffer;
 static Lisp_Object Qwindow_deletable_p, Qdelete_window, Qdisplay_buffer;
 static Lisp_Object Qreplace_buffer_in_windows, Qget_mru_window;
@@ -131,6 +131,12 @@
 static EMACS_INT window_scroll_preserve_hpos;
 static EMACS_INT window_scroll_preserve_vpos;
 
+static void
+CHECK_WINDOW_CONFIGURATION (Lisp_Object x)
+{
+  CHECK_TYPE (WINDOW_CONFIGURATIONP (x), Qwindow_configuration_p, x);
+}
+
 /* These setters are used only in this file, so they can be private.  */
 static void
 wset_combination_limit (struct window *w, Lisp_Object val)