Jim Pick <jim@jimpick.com> wrote: > Turbo Fredriksson <turbo@tripnet.se> writes: > > > I have found a bug in 'sgml-tools'... return type of `main' is not `int' > > > > It will not build. No wonder, I wouldn't eater, one can (or should not anyway), > > have a function as void, if it returns a value... 'exit(0)'... > > I thought that was just a warning, not an error. Am I wrong? > > Can you post a bit of code? ----- s n i p ----- make[2]: Entering directory `/home/turbo/src/Build/sgml-tools-1.0.7/rtf-fix' gcc -g -O2 -o rtf2rtf rtf2rtf.c -lfl rtf2rtf.l:56: initializer element is not constant rtf2rtf.l:57: initializer element is not constant rtf2rtf.l: In function `main': rtf2rtf.l:385: warning: return type of `main' is not `int' make[2]: *** [rtf2rtf] Error 1 make[2]: Leaving directory `/home/turbo/src/Build/sgml-tools-1.0.7/rtf-fix' make[1]: *** [all] Error 255 make[1]: Leaving directory `/home/turbo/src/Build/sgml-tools-1.0.7' make: *** [build] Error 2 ----- s n i p ----- It turned out that it's these lines that is faulty: FILE *out = stdout; FILE *idx_fp = stdout; stdout is not initialized any where... On my i386, they are initialized in 'stdio.h', but that does not seem to happen on the netwinder. If I add these lines to the source, I get an error... #ifndef stdout #error stdout not defined #endif ----- s n i p ----- [root@gandalf sgml-tools-1.0.7]# grep stdout /usr/include/stdio.h extern FILE *stdout; /* Standard output stream. */ #define stdout _IO_stdout /* Write formatted output to stdout. */ /* Write formatted output to stdout from argument list ARG. */ return vfprintf (stdout, __fmt, __arg); /* Write a character to stdout. */ return _IO_putc (__c, stdout); return _IO_putc_unlocked (__c, stdout); /* Write a string, followed by a newline, to stdout. */ ----- s n i p ----- And _IO_stdout is defined in 'libio.h', which 'stdio.h' includes. ----- s n i p ----- [root@gandalf sgml-tools-1.0.7]# grep _IO_stdout /usr/include/libio.h #define _IO_stdout ((_IO_FILE*)(&_IO_2_1_stdout_)) extern _IO_FILE *_IO_stdout; ----- s n i p ----- -- ----------------------------------------------------------------------- Turbo __ _ Debian GNU Unix _IS_ user friendly - it's just ^^^^^ / /(_)_ __ _ ___ __ selective about who its friends are / / | | '_ \| | | \ \/ / papadoc.nocrew.org _ /// / /__| | | | | |_| |> < Turbo Fredriksson turbo@tripnet.se \\\/ \____/_|_| |_|\__,_/_/\_\ Surrey/B.C./Canada (604)572-3523 Debian Certified Linux Developer PGP#788CD1A9 www5.tripnet.se/~turbo ------- PGP: B7 92 93 0E 06 94 D6 22 98 1F 0B 5B FE 33 A1 0B -------- -- South Africa Ft. Meade Albanian Kennedy Semtex Mossad quiche BATF nuclear Cocaine NSA Legion of Doom smuggle FBI Honduras
Attachment:
pgp7qjva2LeNl.pgp
Description: PGP signature