lua

A copy of the Lua development repository
Log | Files | Refs | README

commit 56699cd6036a52abaf62a2d3097538b883d1edcb
parent 8ede2c353cddc8024f75802bb2ab714e334f1f8e
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date:   Fri, 26 Sep 2014 11:08:56 -0300

small change to avoid bug in some versions of the clang compiler

Diffstat:
Mliolib.c | 9+++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/liolib.c b/liolib.c @@ -1,5 +1,5 @@ /* -** $Id: liolib.c,v 2.127 2014/06/30 19:48:08 roberto Exp roberto $ +** $Id: liolib.c,v 2.128 2014/07/29 16:01:00 roberto Exp roberto $ ** Standard I/O (and system) library ** See Copyright Notice in lua.h */ @@ -193,9 +193,14 @@ static LStream *newprefile (lua_State *L) { } +/* +** Calls the 'close' function from a file handle. The 'volatile' avoids +** a bug in some verisions of the Clang compiler (e.g., clang 3.0 for +** 32 bits). +*/ static int aux_close (lua_State *L) { LStream *p = tolstream(L); - lua_CFunction cf = p->closef; + volatile lua_CFunction cf = p->closef; p->closef = NULL; /* mark stream as closed */ return (*cf)(L); /* close it */ }