Fixed portability problems with va_copy. In three places, calls to fstat
had to be replaced by calls to stat, because fileno is no longer available when forcing the compiler into pure c89 (or c99) mode. git-svn-id: svn://svn.cc65.org/cc65/trunk@3683 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
# Library dir
|
||||
COMMON = ../common
|
||||
|
||||
CFLAGS = -g -O2 -Wall -W -I$(COMMON)
|
||||
CFLAGS = -g -O2 -Wall -W -std=c89 -I$(COMMON)
|
||||
CC = gcc
|
||||
EBIND = emxbind
|
||||
LDFLAGS =
|
||||
@@ -56,6 +56,6 @@ zap: clean
|
||||
.PHONY: depend dep
|
||||
depend dep: $(OBJS:.o=.c)
|
||||
@echo "Creating dependency information"
|
||||
$(CC) -I$(COMMON) -MM $^ > .depend
|
||||
$(CC) $(CFLAGS) -MM $^ > .depend
|
||||
|
||||
|
||||
|
||||
@@ -142,7 +142,7 @@ void ObjWriteHeader (FILE* Obj, ObjHeader* H)
|
||||
Write32 (Obj, H->StrPoolOffs);
|
||||
Write32 (Obj, H->StrPoolSize);
|
||||
Write32 (Obj, H->AssertOffs);
|
||||
Write32 (Obj, H->AssertSize);
|
||||
Write32 (Obj, H->AssertSize);
|
||||
Write32 (Obj, H->ScopeOffs);
|
||||
Write32 (Obj, H->ScopeSize);
|
||||
}
|
||||
@@ -164,8 +164,15 @@ void ObjAdd (const char* Name)
|
||||
Error ("Could not open `%s': %s", Name, strerror (errno));
|
||||
}
|
||||
|
||||
/* Get the modification time of the object file */
|
||||
if (fstat (fileno (Obj), &StatBuf) != 0) {
|
||||
/* Get the modification time of the object file. There a race condition
|
||||
* here, since we cannot use fileno() (non standard identifier in standard
|
||||
* header file), and therefore not fstat. When using stat with the
|
||||
* file name, there's a risk that the file was deleted and recreated
|
||||
* while it was open. Since mtime and size are only used to check
|
||||
* if a file has changed in the debugger, we will ignore this problem
|
||||
* here.
|
||||
*/
|
||||
if (stat (Name, &StatBuf) != 0) {
|
||||
Error ("Cannot stat object file `%s': %s", Name, strerror (errno));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user