1
0
forked from Mirror/wren

Fixes to make GCC happier.

This commit is contained in:
Bob Nystrom
2014-11-26 14:03:05 -08:00
parent f6cbb6ad75
commit 83c2013dfb
5 changed files with 13 additions and 4 deletions

View File

@ -27,7 +27,7 @@ debug: prep wrend
# Debug command-line interpreter.
wrend: $(DEBUG_OBJECTS)
$(CC) $(CFLAGS) $(DEBUG_CFLAGS) -Iinclude -o wrend $^
$(CC) $(CFLAGS) $(DEBUG_CFLAGS) -Iinclude -lm -o wrend $^
# Debug object files.
build/debug/%.o: src/%.c include/wren.h $(HEADERS)
@ -38,7 +38,7 @@ release: prep wren
# Release command-line interpreter.
wren: $(RELEASE_OBJECTS)
$(CC) $(CFLAGS) $(RELEASE_CFLAGS) -Iinclude -o wren $^
$(CC) $(CFLAGS) $(RELEASE_CFLAGS) -Iinclude -lm -o wren $^
# Release object files.
build/release/%.o: src/%.c include/wren.h $(HEADERS)

View File

@ -1,3 +1,5 @@
#define _GNU_SOURCE // Makes getline() available in GCC.
#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
@ -56,6 +58,10 @@ static int runFile(WrenVM* vm, const char* path)
case WREN_RESULT_SUCCESS: result = 0; break;
case WREN_RESULT_COMPILE_ERROR: result = 65; break; // EX_DATAERR.
case WREN_RESULT_RUNTIME_ERROR: result = 70; break; // EX_SOFTWARE.
default:
// Unreachable.
result = 255;
break;
}
wrenFreeVM(vm);

View File

@ -2248,6 +2248,9 @@ static int getNumArguments(const uint8_t* bytecode, const Value* constants,
// There are two bytes for the constant, then two for each upvalue.
return 2 + (loadedFn->numUpvalues * 2);
}
default:
UNREACHABLE();
}
}

View File

@ -159,7 +159,7 @@ ObjFiber* wrenNewFiber(WrenVM* vm, Obj* fn)
ObjFn* wrenNewFunction(WrenVM* vm, Value* constants, int numConstants,
int numUpvalues, int numParams,
u_int8_t* bytecode, int bytecodeLength,
uint8_t* bytecode, int bytecodeLength,
ObjString* debugSourcePath,
const char* debugName, int debugNameLength,
int* sourceLines)

View File

@ -564,7 +564,7 @@ ObjFiber* wrenNewFiber(WrenVM* vm, Obj* fn);
// copy [constants] into its own array.
ObjFn* wrenNewFunction(WrenVM* vm, Value* constants, int numConstants,
int numUpvalues, int numParams,
u_int8_t* bytecode, int bytecodeLength,
uint8_t* bytecode, int bytecodeLength,
ObjString* debugSourcePath,
const char* debugName, int debugNameLength,
int* sourceLines);