diff --git a/src/starkernel/vm/host/shim.c b/src/starkernel/vm/host/shim.c index 14e0fb2..2d26879 100644 --- a/src/starkernel/vm/host/shim.c +++ b/src/starkernel/vm/host/shim.c @@ -1098,6 +1098,11 @@ int vfprintf(FILE *stream, const char *fmt, va_list args) { int puts(const char *s) { console_println(s ? s : ""); return 0; } /** @brief Kernel @c putchar(): emit one character to the console; returns @p c. */ int putchar(int c) { console_putc((char)c); return c; } +/** @brief Kernel @c putc(): ignores stream, same as @c putchar(). GCC's -O2 + * folds @c putchar(c) / @c fputc(c, stdout) call sites into @c putc(c, stdout) + * (FABRIC.md item 4.5d) -- this symbol was never needed at -O0 because that + * fold pass is inactive there. */ +int putc(int c, FILE *stream) { (void)stream; return putchar(c); } /** @brief Kernel @c fflush(): no-op (console writes are synchronous); returns 0. */ int fflush(FILE *stream) { (void)stream; return 0; } /** @brief Kernel @c fputs(): ignores stream, prints @p s + newline to console. */ @@ -1204,6 +1209,11 @@ const unsigned short ** __ctype_b_loc(void) { /** @brief Kernel @c getchar(): always returns -1 (EOF) — no stdin in kernel. */ int getchar(void) { return -1; } +/** @brief Kernel @c getc(): ignores stream, same as @c getchar(). GCC's -O2 + * folds @c getchar() call sites into @c getc(stdin) (FABRIC.md item 4.5d) -- + * this symbol was never needed at -O0 because that fold pass is inactive + * there. */ +int getc(FILE *stream) { (void)stream; return getchar(); } /* ----------------------------------------------------------------------------- * Misc platform stubs