diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2005-10-24 15:39:21 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2005-10-24 15:39:21 -0200 |
commit | caf3cfc6ac3214c6116559c205a21d482a65fe79 (patch) | |
tree | ce0c4042ca462217420a003d976c63fa410adc8e | |
parent | ff7638b0eddc64b95222a9b7a20c3a7268468031 (diff) | |
download | lua-caf3cfc6ac3214c6116559c205a21d482a65fe79.tar.gz lua-caf3cfc6ac3214c6116559c205a21d482a65fe79.tar.bz2 lua-caf3cfc6ac3214c6116559c205a21d482a65fe79.zip |
try to ensure that macros actually use their arguments
-rw-r--r-- | luaconf.h | 34 |
1 files changed, 17 insertions, 17 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: luaconf.h,v 1.68 2005/09/19 13:49:12 roberto Exp roberto $ | 2 | ** $Id: luaconf.h,v 1.69 2005/10/13 12:22:53 roberto Exp roberto $ |
3 | ** Configuration file for Lua | 3 | ** Configuration file for Lua |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -266,17 +266,17 @@ | |||
266 | #include <stdio.h> | 266 | #include <stdio.h> |
267 | #include <readline/readline.h> | 267 | #include <readline/readline.h> |
268 | #include <readline/history.h> | 268 | #include <readline/history.h> |
269 | #define lua_readline(L,b,p) (((b)=readline(p)) != NULL) | 269 | #define lua_readline(L,b,p) ((void)L, ((b)=readline(p)) != NULL) |
270 | #define lua_saveline(L,idx) \ | 270 | #define lua_saveline(L,idx) \ |
271 | if (lua_strlen(L,idx) > 0) /* non-empty line? */ \ | 271 | if (lua_strlen(L,idx) > 0) /* non-empty line? */ \ |
272 | add_history(lua_tostring(L, idx)); /* add it to history */ | 272 | add_history(lua_tostring(L, idx)); /* add it to history */ |
273 | #define lua_freeline(L,b) free(b) | 273 | #define lua_freeline(L,b) ((void)L, free(b)) |
274 | #else | 274 | #else |
275 | #define lua_readline(L,b,p) \ | 275 | #define lua_readline(L,b,p) \ |
276 | (fputs(p, stdout), fflush(stdout), /* show prompt */ \ | 276 | (fputs(p, stdout), fflush(stdout), /* show prompt */ \ |
277 | fgets(b, LUA_MAXINPUT, stdin) != NULL) /* get line */ | 277 | fgets(b, LUA_MAXINPUT, stdin) != NULL) /* get line */ |
278 | #define lua_saveline(L,idx) ((void)0) | 278 | #define lua_saveline(L,idx) ((void)L, (void)idx, (void)0) |
279 | #define lua_freeline(L,b) ((void)0) | 279 | #define lua_freeline(L,b) ((void)L, (void)b, (void)0) |
280 | #endif | 280 | #endif |
281 | 281 | ||
282 | #endif | 282 | #endif |
@@ -368,10 +368,10 @@ | |||
368 | */ | 368 | */ |
369 | #if defined(LUA_USE_APICHECK) | 369 | #if defined(LUA_USE_APICHECK) |
370 | #include <assert.h> | 370 | #include <assert.h> |
371 | #define luai_apicheck(L,o) assert(o) | 371 | #define luai_apicheck(L,o) { (void)L; assert(o); } |
372 | #else | 372 | #else |
373 | /* (By default lua_assert is empty, so luai_apicheck is also empty.) */ | 373 | /* (By default lua_assert is empty, so luai_apicheck is also empty.) */ |
374 | #define luai_apicheck(L,o) lua_assert(o) | 374 | #define luai_apicheck(L,o) { (void)L; lua_assert(o); } |
375 | #endif | 375 | #endif |
376 | 376 | ||
377 | 377 | ||
@@ -546,16 +546,16 @@ union luai_Cast { double l_d; long l_l; }; | |||
546 | */ | 546 | */ |
547 | #if defined(LUA_CORE) | 547 | #if defined(LUA_CORE) |
548 | #include <math.h> | 548 | #include <math.h> |
549 | #define luai_numadd(L,a,b) ((a)+(b)) | 549 | #define luai_numadd(a,b) ((a)+(b)) |
550 | #define luai_numsub(L,a,b) ((a)-(b)) | 550 | #define luai_numsub(a,b) ((a)-(b)) |
551 | #define luai_nummul(L,a,b) ((a)*(b)) | 551 | #define luai_nummul(a,b) ((a)*(b)) |
552 | #define luai_numdiv(L,a,b) ((a)/(b)) | 552 | #define luai_numdiv(a,b) ((a)/(b)) |
553 | #define luai_nummod(L,a,b) ((a) - floor((a)/(b))*(b)) | 553 | #define luai_nummod(a,b) ((a) - floor((a)/(b))*(b)) |
554 | #define luai_numpow(L,a,b) pow(a,b) | 554 | #define luai_numpow(a,b) (pow(a,b)) |
555 | #define luai_numunm(L,a) (-(a)) | 555 | #define luai_numunm(a) (-(a)) |
556 | #define luai_numeq(L,a,b) ((a)==(b)) | 556 | #define luai_numeq(a,b) ((a)==(b)) |
557 | #define luai_numlt(L,a,b) ((a)<(b)) | 557 | #define luai_numlt(a,b) ((a)<(b)) |
558 | #define luai_numle(L,a,b) ((a)<=(b)) | 558 | #define luai_numle(a,b) ((a)<=(b)) |
559 | #endif | 559 | #endif |
560 | 560 | ||
561 | /* }================================================================== */ | 561 | /* }================================================================== */ |