From 3764de9a27ba5aa1b720daa4704ec0804823ce2d Mon Sep 17 00:00:00 2001 From: Yatis Date: Wed, 14 Oct 2020 12:07:29 +0200 Subject: [PATCH] fix compilation error (common) --- include/unistd.h | 2 +- make/Makefile.default | 2 +- src/signal/arch/vhex/kill.S | 2 +- src/stdio/internal/printf.h | 6 +++--- src/stdio/internal/printf_actions.c | 13 ++++++++----- src/stdio/internal/printf_common.c | 4 ++++ src/stdio/internal/printf_options.c | 4 ++++ src/stdio/vdprintf.c | 6 +++++- src/stdio/vsnprintf.c | 4 ++++ src/unistd/arch/vhex/fork_execve.S | 2 +- 10 files changed, 32 insertions(+), 13 deletions(-) diff --git a/include/unistd.h b/include/unistd.h index 906c1a8..9262273 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -73,7 +73,7 @@ extern ssize_t pwrite (int __fd, const void *__buf, size_t __n, off_t __offset); ** or the end of the file (if WHENCE is SEEK_END). ** Return the new file position. */ -extern __off_t lseek (int __fd, off_t __offset, int __whence); +extern off_t lseek (int __fd, off_t __offset, int __whence); /* Close the file descriptor FD */ extern int close(int __fd); diff --git a/make/Makefile.default b/make/Makefile.default index eaeb448..4a6907a 100644 --- a/make/Makefile.default +++ b/make/Makefile.default @@ -34,7 +34,7 @@ #--- MAJOR := 0 MINOR := 2 -PATCH := 0 +PATCH := 1 EXTRAVERSION := -alpha diff --git a/src/signal/arch/vhex/kill.S b/src/signal/arch/vhex/kill.S index 683bad5..5a4129a 100644 --- a/src/signal/arch/vhex/kill.S +++ b/src/signal/arch/vhex/kill.S @@ -1,4 +1,4 @@ -#include __SUPPORT_VHEX_KERNEL +#ifdef __SUPPORT_VHEX_KERNEL #include .text .global _kill diff --git a/src/stdio/internal/printf.h b/src/stdio/internal/printf.h index 9dd4031..745565a 100644 --- a/src/stdio/internal/printf.h +++ b/src/stdio/internal/printf.h @@ -1,5 +1,5 @@ -#ifndef _SRC_STDIO_PRINTF_H__ -# define _SRC_STDIO_PRINTF_H__ +#ifndef _SRC_STDIO_INTERNAL_PRINTF_H__ +# define _SRC_STDIO_INTERNAL_PRINTF_H__ #include #include @@ -55,4 +55,4 @@ struct printf_opt // Internal symbols used to define all actions possibility extern void (*action[26])(struct printf_opt *opt, char n); -#endif /*_SRC_STDIO_PRINTF_H__*/ +#endif /*_SRC_STDIO_INTERNAL_PRINTF_H__*/ diff --git a/src/stdio/internal/printf_actions.c b/src/stdio/internal/printf_actions.c index 558c0da..14f6e1b 100644 --- a/src/stdio/internal/printf_actions.c +++ b/src/stdio/internal/printf_actions.c @@ -1,5 +1,9 @@ #include +// internal depency +// TODO: update path detection +#include "../src/stdio/internal/printf.h" + // Define all actions static void action_str(struct printf_opt *op, char n); static void action_ptr(struct printf_opt *op, char n); @@ -25,7 +29,7 @@ void (*action[26])(struct printf_opt *opt, char n) = { static void base_to_str(struct printf_opt *opt, uint32_t num, int base, int digits) { char *hexa = (opt->uppercase == 1) ? "0123456789ABCDEF" : "0123456789abcdef"; - + opt->digits = 0; while (num != 0 || opt->digits < digits) { @@ -131,7 +135,7 @@ static void action_ptr(struct printf_opt *opt, char n) opt->sign = '@'; opt->base[0] = '0'; opt->base[1] = 'x'; - base_to_str(opt, (uint32_t)va_arg(opt->ap, void*), 16, 8); + base_to_str(opt, (uintptr_t)va_arg(opt->ap, void*), 16, 8); disp_format(opt); } @@ -150,7 +154,7 @@ static void action_int(struct printf_opt *opt, char n) opt->sign = (opt->flags.plus == 1) ? '+' : ' '; } - // Generate / display number + // Generate / display number base_to_str(opt, num, 10, 1); disp_format(opt); } @@ -169,8 +173,7 @@ static void action_uint(struct printf_opt *opt, char n) } // Display extra symbols if needed - if (opt->flags.diez == 1) - { + if (opt->flags.diez == 1) { if (n == 'o') { opt->base[0] = '0'; } else if (n == 'x') { diff --git a/src/stdio/internal/printf_common.c b/src/stdio/internal/printf_common.c index 9f74655..fc15373 100644 --- a/src/stdio/internal/printf_common.c +++ b/src/stdio/internal/printf_common.c @@ -1,5 +1,9 @@ #include +// internal depency +// TODO: update path detection +#include "../src/stdio/internal/printf.h" + //TODO: precision handling int printf_common(struct printf_opt *opt, const char *restrict format) { diff --git a/src/stdio/internal/printf_options.c b/src/stdio/internal/printf_options.c index b6d174d..05eaa86 100644 --- a/src/stdio/internal/printf_options.c +++ b/src/stdio/internal/printf_options.c @@ -1,5 +1,9 @@ #include +// internal depency +// TODO: update path detection +#include "../src/stdio/internal/printf.h" + static int get_flags(struct printf_opt *opt, const char *restrict format) { int i; diff --git a/src/stdio/vdprintf.c b/src/stdio/vdprintf.c index a4454a0..1a8f445 100644 --- a/src/stdio/vdprintf.c +++ b/src/stdio/vdprintf.c @@ -1,6 +1,10 @@ #include #include +// internal depency +// TODO: update path detection +#include "../src/stdio/internal/printf.h" + // FIXME: // if the writte syscall do not return the same // number of bytes that requested, stop the function ! @@ -31,5 +35,5 @@ int vdprintf(int fd, const char *restrict format, va_list ap) opt.disp_char = &disp_char; opt.disp_fflush = &disp_fflush; va_copy(opt.ap, ap); - return (printf_common(&opt, format)); + return (printf_common(&opt, format)); } diff --git a/src/stdio/vsnprintf.c b/src/stdio/vsnprintf.c index 6489aeb..6d83871 100644 --- a/src/stdio/vsnprintf.c +++ b/src/stdio/vsnprintf.c @@ -1,5 +1,9 @@ #include +// internal depency +// TODO: update path detection +#include "../src/stdio/internal/printf.h" + static void disp_char(struct printf_opt *opt, char n) { // Check write possibility diff --git a/src/unistd/arch/vhex/fork_execve.S b/src/unistd/arch/vhex/fork_execve.S index b66f1e2..e5e10a5 100644 --- a/src/unistd/arch/vhex/fork_execve.S +++ b/src/unistd/arch/vhex/fork_execve.S @@ -1,4 +1,4 @@ -#include __SUPPORT_VHEX_KERNEL +#ifdef __SUPPORT_VHEX_KERNEL #include .text .global _fork_execve