diff src/specifier.h @ 438:84b14dcb0985 r21-2-27

Import from CVS: tag r21-2-27
author cvs
date Mon, 13 Aug 2007 11:32:25 +0200
parents 9d177e8d4150
children 8de8e3f6228a
line wrap: on
line diff
--- a/src/specifier.h	Mon Aug 13 11:31:26 2007 +0200
+++ b/src/specifier.h	Mon Aug 13 11:32:25 2007 +0200
@@ -281,6 +281,15 @@
   assert (SPECIFIER_TYPE_P (sp, type));					\
   return (struct type##_specifier *) sp->data;				\
 }									\
+INLINE struct Lisp_Specifier *						\
+error_check_##type##_specifier_type (Lisp_Object obj);			\
+INLINE struct Lisp_Specifier *						\
+error_check_##type##_specifier_type (Lisp_Object obj)			\
+{									\
+  struct Lisp_Specifier *sp = XSPECIFIER (obj);				\
+  assert (SPECIFIER_TYPE_P (sp, type));					\
+  return sp;								\
+}									\
 DECLARE_NOTHING
 #else
 #define DECLARE_SPECIFIER_TYPE(type)				\
@@ -343,10 +352,19 @@
      : (sp)->data))
 #endif
 
-/* #### Need to create ERROR_CHECKING versions of these. */
+#ifdef ERROR_CHECK_TYPECHECK
+# define XSPECIFIER_TYPE(x, type)	\
+   error_check_##type##_specifier_type (x)
+# define XSETSPECIFIER_TYPE(x, p, type)	do		\
+{							\
+  XSETSPECIFIER (x, p);					\
+  assert (SPECIFIER_TYPEP (XSPECIFIER(x), type));	\
+} while (0)
+#else
+# define XSPECIFIER_TYPE(x, type) XSPECIFIER (x)
+# define XSETSPECIFIER_TYPE(x, p, type) XSETSPECIFIER (x, p)
+#endif /* ERROR_CHECK_TYPE_CHECK */
 
-#define XSPECIFIER_TYPE(x, type) XSPECIFIER (x)
-#define XSETSPECIFIER_TYPE(x, p, type) XSETSPECIFIER (x, p)
 #define SPECIFIER_TYPEP(x, type)				\
   (SPECIFIERP (x) && SPECIFIER_TYPE_P (XSPECIFIER (x), type))
 #define CHECK_SPECIFIER_TYPE(x, type) do {		\