texterm icon indicating copy to clipboard operation
texterm copied to clipboard

Multiple Compiletime Errors

Open JohnAlexINL opened this issue 5 months ago • 0 comments

In order of encountering them:

texterm$ make
mkdir -p src obj
rm -f texterm obj/*.o sample
cc -Wall -Werror -Wpedantic -Wextra -c -o obj/editor.o src/editor.c
src/editor.c: In function ‘editor_refresh_screen’:
src/editor.c:199:50: error: ‘snprintf’ output may be truncated before the last format character [-Werror=format-truncation=]
  199 |     snprintf(curpos, sizeof(curpos), "\x1b[%d;%dH", editor.cy - editor.rowoff + 1, editor.rx - editor.coloff + 1);
      |                                                  ^
src/editor.c:199:5: note: ‘snprintf’ output between 7 and 17 bytes into a destination of size 16
  199 |     snprintf(curpos, sizeof(curpos), "\x1b[%d;%dH", editor.cy - editor.rowoff + 1, editor.rx - editor.coloff + 1);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make: *** [Makefile:34: obj/editor.o] Error 1

Hotpatched by increasing the sizeof the curpos char[] to 32, proceeded.

texterm$ make
mkdir -p src obj
rm -f texterm obj/*.o sample
cc -Wall -Werror -Wpedantic -Wextra -c -o obj/editor.o src/editor.c
cc -Wall -Werror -Wpedantic -Wextra -c -o obj/highlight.o src/highlight.c
In file included from src/highlight.c:9:
src/languages.h:7:10: fatal error: languages/c.h: No such file or directory
    7 | #include "languages/c.h"
      |          ^~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:30: obj/highlight.o] Error 1

Makes a lot of sense, there is no languages directory. but c.h is in syntaxes and it would make sense if this directory just changed names at some point, so. Hotpatching by changing its name.

After these two tweaks, compilation succeeds. Following this up with a patch

JohnAlexINL avatar Nov 27 '25 03:11 JohnAlexINL