[cmds] Add ekermit to distribution images by ghaerr · Pull Request #2557 · ghaerr/elks (original) (raw)
Builds ekermit and adds to compressed 1440k and larger images.
The original contribution displayed a large number of compiler warnings. This PR cleans some of the easier messages up, and includes a LOCALFLAGS modification to silence others. In general, it would be nice to fix the remaining issues so that the ELKS build produces less warnings, something we've worked hard on reducing for years.
@tyama501, thank you for the contribution. I'm unable to test, so I didn't try to fix further errors which might affect usability.
The current warning list is:
ia16-elf-gcc -mcmodel=small -melks-libc -mtune=i8086 -Wall -Os -mno-segment-relocation-stuff -fno-inline -fno-builtin-printf -fno-builtin-fprintf -Wextra -Wtype-limits -Wno-unused-parameter -Wno-sign-compare -Wno-empty-body -Wno-implicit-int -Wno-parentheses -DNO_LP -DELKS -Wno-unused-variable -Wno-unused-but-set-variable -Wno-pointer-sign -I/Users/greg/net/elks-gh/include -I/Users/greg/net/elks-gh/libc/include -I/Users/greg/net/elks-gh/elks/include -c -o main.o main.c
main.c: In function ‘main’:
main.c:388:14: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
k.dbf = db ? dodebug : 0; /* for debugging */
^
ia16-elf-gcc -mcmodel=small -melks-libc -mtune=i8086 -Wall -Os -mno-segment-relocation-stuff -fno-inline -fno-builtin-printf -fno-builtin-fprintf -Wextra -Wtype-limits -Wno-unused-parameter -Wno-sign-compare -Wno-empty-body -Wno-implicit-int -Wno-parentheses -DNO_LP -DELKS -Wno-unused-variable -Wno-unused-but-set-variable -Wno-pointer-sign -I/Users/greg/net/elks-gh/include -I/Users/greg/net/elks-gh/libc/include -I/Users/greg/net/elks-gh/elks/include -c -o kermit.o kermit.c
kermit.c: In function ‘spar’:
kermit.c:1099:26: warning: ‘y’ may be used uninitialized in this function [-Wmaybe-uninitialized]
x = xunchar(s[y+1]);
^
kermit.c: In function ‘rpar’:
kermit.c:1168:9: warning: ‘b’ may be used uninitialized in this function [-Wmaybe-uninitialized]
k->bct = b;
~~~~~~~^~~
kermit.c: In function ‘decode’:
kermit.c:1236:10: warning: ‘p’ may be used uninitialized in this function [-Wmaybe-uninitialized]
*p = '\0'; /* terminate the string */
~~~^~~~~~
kermit.c: In function ‘gattr’:
kermit.c:1340:15: warning: ‘fsizek’ may be used uninitialized in this function [-Wmaybe-uninitialized]
} else if (fsizek > -1L) {
^
kermit.c:1338:8: warning: ‘fsize’ may be used uninitialized in this function [-Wmaybe-uninitialized]
if (fsize > -1L) { /* Remember the file size */
^
kermit.c: In function ‘kermit’:
kermit.c:732:14: warning: ‘s’ may be used uninitialized in this function [-Wmaybe-uninitialized]
rc = ack(k, k->r_seq, s);
~~~^~~~~~~~~~~~~~~~~~~~~
ia16-elf-gcc -mcmodel=small -melks-libc -mtune=i8086 -Wall -Os -mno-segment-relocation-stuff -fno-inline -fno-builtin-printf -fno-builtin-fprintf -Wextra -Wtype-limits -Wno-unused-parameter -Wno-sign-compare -Wno-empty-body -Wno-implicit-int -Wno-parentheses -DNO_LP -DELKS -Wno-unused-variable -Wno-unused-but-set-variable -Wno-pointer-sign -I/Users/greg/net/elks-gh/include -I/Users/greg/net/elks-gh/libc/include -I/Users/greg/net/elks-gh/elks/include -c -o elksio.o elksio.c
elksio.c: In function ‘fileinfo’:
elksio.c:513:19: warning: comparison is always true due to limited range of data type [-Wtype-limits]
while (count < SCANSIZ && !isbinary) { /* Scan this much */
^
In file included from elksio.c:59:0:
elksio.c: In function ‘readfile’:
debug.h:34:56: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
#define debug(a,b,c,d) dodebug(a,(UCHAR *)b,(UCHAR *)c,(long)(d))
^
elksio.c:581:5: note: in expansion of macro ‘debug’
debug(DB_LOG,"readfile exit zinptr",0,k->zinptr);
^~~~~
ia16-elf-gcc -o ekermit -mcmodel=small -melks-libc -mtune=i8086 -Wall -Os -mno-segment-relocation-stuff -fno-inline -fno-builtin-printf -fno-builtin-fprintf main.o kermit.o elksio.o
In some cases, the "maybe uninitialized" warnings can be removed by setting the variable to 0 on declaration, but one must be somewhat careful, as this could also be a warning of bad programming. I realize that e-kermit is ancient and it may be lots of work to fix all these. If so, that's ok, but thought to mention it.