Browse Source

new macro to check conditions on expression macros

Roberto Ierusalimschy 23 năm trước cách đây
mục cha
commit
8fd0f6a82b
2 tập tin đã thay đổi với 8 bổ sung2 xóa
  1. 6 1
      llimits.h
  2. 2 1
      ltests.h

+ 6 - 1
llimits.h

@@ -1,5 +1,5 @@
 /*
 /*
-** $Id: llimits.h,v 1.42 2002/03/26 20:46:10 roberto Exp roberto $
+** $Id: llimits.h,v 1.43 2002/04/23 14:59:35 roberto Exp roberto $
 ** Limits, basic types, and some other `installation-dependent' definitions
 ** Limits, basic types, and some other `installation-dependent' definitions
 ** See Copyright Notice in lua.h
 ** See Copyright Notice in lua.h
 */
 */
@@ -83,6 +83,11 @@ union L_Umaxalign { LUSER_ALIGNMENT_T u; void *s; long l; };
 #endif
 #endif
 
 
 
 
+#ifndef check_exp
+#define check_exp(c,e)	(e)
+#endif
+
+
 #ifndef UNUSED
 #ifndef UNUSED
 #define UNUSED(x)	((void)(x))	/* to avoid warnings */
 #define UNUSED(x)	((void)(x))	/* to avoid warnings */
 #endif
 #endif

+ 2 - 1
ltests.h

@@ -1,5 +1,5 @@
 /*
 /*
-** $Id: ltests.h,v 1.12 2002/03/08 19:17:59 roberto Exp roberto $
+** $Id: ltests.h,v 1.13 2002/06/11 16:26:12 roberto Exp roberto $
 ** Internal Header for Debugging of the Lua Implementation
 ** Internal Header for Debugging of the Lua Implementation
 ** See Copyright Notice in lua.h
 ** See Copyright Notice in lua.h
 */
 */
@@ -18,6 +18,7 @@
 #undef NDEBUG
 #undef NDEBUG
 #include <assert.h>
 #include <assert.h>
 #define lua_assert(c)           assert(c)
 #define lua_assert(c)           assert(c)
+#define check_exp(c,e)		(lua_assert(c), (e))
 #define api_check(L, o)		lua_assert(o)
 #define api_check(L, o)		lua_assert(o)