fix compiler warnings

This commit is contained in:
nakst 2022-02-03 13:08:18 +00:00
parent 971d450760
commit 55b02855f0
2 changed files with 7 additions and 5 deletions

View File

@ -214,7 +214,7 @@ void PortGCC() {
assert SystemShellExecute("which xz"); assert SystemShellExecute("which xz");
// Check all the needed libraries are available. // Check all the needed libraries are available.
assert FileWriteAll("bin/test.c", "void main() {}"); assert FileWriteAll("bin/test.c", "int main() { return 0; }");
assert SystemShellExecute("gcc %libraryPath% -lmpc bin/test.c -o bin/test"); // If this fails, install mpc/libmpc/libmpc-dev. assert SystemShellExecute("gcc %libraryPath% -lmpc bin/test.c -o bin/test"); // If this fails, install mpc/libmpc/libmpc-dev.
assert SystemShellExecute("gcc %libraryPath% -lmpfr bin/test.c -o bin/test"); // If this fails, install mpfr/libmpfr/libmpfr-dev. assert SystemShellExecute("gcc %libraryPath% -lmpfr bin/test.c -o bin/test"); // If this fails, install mpfr/libmpfr/libmpfr-dev.
assert SystemShellExecute("gcc %libraryPath% -lgmp bin/test.c -o bin/test"); // If this fails, install gmp/libgmp/libgmp-dev. assert SystemShellExecute("gcc %libraryPath% -lgmp bin/test.c -o bin/test"); // If this fails, install gmp/libgmp/libgmp-dev.

View File

@ -4732,7 +4732,7 @@ int ExternalSystemShellExecuteWithWorkingDirectory(ExecutionContext *context, Va
pid_t pid = fork(); pid_t pid = fork();
if (pid == 0) { if (pid == 0) {
chdir(temporary); Assert(chdir(temporary) == 0);
exit(system(temporary2)); exit(system(temporary2));
} else if (pid < 0) { } else if (pid < 0) {
PrintDebug("Unable to fork(), got pid = %d, errno = %d.\n", pid, errno); PrintDebug("Unable to fork(), got pid = %d, errno = %d.\n", pid, errno);
@ -4758,7 +4758,7 @@ int ExternalSystemShellExecuteWithWorkingDirectory(ExecutionContext *context, Va
return 0; return 0;
} }
chdir(temporary); Assert(chdir(temporary) == 0);
returnValue->i = system(temporary2) == 0; returnValue->i = system(temporary2) == 0;
chdir(data); chdir(data);
free(temporary); free(temporary);
@ -5257,7 +5257,8 @@ int ExternalConsoleGetLine(ExecutionContext *context, Value *returnValue) {
#else #else
char *line = NULL; char *line = NULL;
size_t pos; size_t pos;
getline(&line, &pos, stdin); size_t unused = getline(&line, &pos, stdin);
(void) unused;
uintptr_t index = HeapAllocate(context); uintptr_t index = HeapAllocate(context);
context->heap[index].type = T_STR; context->heap[index].type = T_STR;
context->heap[index].bytes = strlen(line) - 1; context->heap[index].bytes = strlen(line) - 1;
@ -5502,8 +5503,9 @@ void *FileLoad(const char *path, size_t *length) {
fseek(file, 0, SEEK_SET); fseek(file, 0, SEEK_SET);
char *buffer = (char *) malloc(fileSize + 1); char *buffer = (char *) malloc(fileSize + 1);
buffer[fileSize] = 0; buffer[fileSize] = 0;
fread(buffer, 1, fileSize, file); size_t readBytes = fread(buffer, 1, fileSize, file);
fclose(file); fclose(file);
if (readBytes != fileSize) { free(buffer); return NULL; }
if (length) *length = fileSize; if (length) *length = fileSize;
return buffer; return buffer;
} }