CeDOS - Commit 050e6dfe

Making the compiler stricter
Celina Sophie Kalus
Tue, 25 Apr 2023 17:01:20 +0200
6 files changed, 12 insertions(+), 13 deletions(-)
M include/assert.hinclude/assert.h

@@ -1,6 +1,8 @@

#ifndef ASSERT_H #define ASSERT_H +#include "cedos/core.h" + #include <stdint.h> #define assert(cond) if (!(cond)) { kpanic("Assertion failed: " #cond); }
M include/cedos/fat.hinclude/cedos/fat.h

@@ -3,12 +3,12 @@ #define FAT_H

#include <stdint.h> +#include "cedos/file.h" + void FAT_init(); -//void *FAT_read_sector_offset(uint32_t lba, uint32_t *offset); -//void *FAT_read_cluster(uint16_t cluster, void *buffer); -//uint16_t FAT_next_cluster(uint16_t cluster); -int FAT_root_dir_next(int index, char *fname_buffer, uint16_t *first_cluster, uint32_t *file_size); -uint32_t FAT_read_file(const char *fname, void *buffer); int FAT_dir_next(int fd, int index, char *fname_buffer); +int FAT_openat(FILE *root, FILE *handle, const char *fname, int flags); +uint32_t FAT_read(FILE *file, void *buffer, int count); + #endif
M include/cedos/file.hinclude/cedos/file.h

@@ -17,6 +17,7 @@ uint32_t fat_cluster;

fpos_t pos; } FILE; +int file_init(); int file_open(const char *pathname, int flags); int file_openat(int fd, const char *fname, int flags); int file_read(int fd, char *buffer, uint32_t size);
M makefilemakefile

@@ -27,7 +27,9 @@

# common flags CCFLAGS := $(CCFLAGS) -Wno-write-strings CCFLAGS := $(CCFLAGS) -Qn +CCFLAGS := $(CCFLAGS) -pedantic -Wold-style-definition CCFLAGS := $(CCFLAGS) -Wall -Wextra -fno-exceptions +CCFLAGS := $(CCFLAGS) -Werror-implicit-function-declaration CCFLAGS := $(CCFLAGS) -nostdlib -nostartfiles -ffreestanding CCFLAGS := $(CCFLAGS) -mgeneral-regs-only -mno-red-zone CCFLAGS := $(CCFLAGS) --prefix=$(CROSS_COMP)
M src/libcedos/cedos.csrc/libcedos/cedos.c

@@ -20,12 +20,6 @@ interrupt(0x30, res, 3, 0, 0, 0);

return res; } -int file_openat(int fd, const char *fname, int flags) { - volatile uint32_t res = 0; - interrupt(0x30, res, 6, fd, fname, flags); - return res; -} - int sc_file_read(int fd, char *buffer, uint32_t size) { volatile uint32_t res = 0; interrupt(0x30, res, 0, fd, buffer, size);

@@ -49,7 +43,7 @@ volatile uint32_t res = 0;

interrupt(0x30, res, 5, pid, 0, 0); } -int sc_file_open(char *pathname, int flags) { +int sc_file_open(char *pathname, uint32_t flags) { volatile uint32_t res = 0; interrupt(0x30, res, 6, pathname, flags, 0); return res;
M src/libcedos/include/cedos.hsrc/libcedos/include/cedos.h

@@ -15,7 +15,7 @@ void graphics_set_mode(int mode);

int sc_file_read(int fd, char *buffer, uint32_t size); int sc_file_write(int fd, char *buffer, uint32_t size); -int sc_file_openat(int fd, char *buffer, uint32_t size); +int sc_file_open(char *buffer, uint32_t flags); void hard_reset();