Subject: how to correct for compiler errors
To: None <netbsd-help@netbsd.org>
From: Henry Nelson <henry@irm.nara.kindai.ac.jp>
List: netbsd-help
Date: 04/11/2001 13:50:54
There are a bunch of tiny but essential utilities I'm building for the
first time on NetBSD. (The final stage of escape from Solaris. Yippee!)
I keep getting the same kinds of compiler warnings (both NetBSD 1.4.3
and 1.5), but not being a programmer I don't know how to correct for them.
Two very frequent ones are "assignment makes pointer from integer without
a cast" and "`xxx_yyy' was declared implicitly `extern' and later `static'".
Is there someone who could advise me on corrections using the examples
below so that "egcs-1.1.1" doesn't issue warnings.
1) The warning:
windows.c: In function `fopentmpfile':
windows.c:151: warning: assignment makes pointer from integer without a cast
1) The "offending" code:
if( fp = fdopen(fd,FOPEN_RWB) ){
==>> tmpfiles[tmpfilex++] = stralloc(path);
LV("fopentmpfile(%s) %x/%d",path,fp,fileno(fp));
}else LE("cannot fdopen(%d) %s",fd,path);
2) The warning:
TLX.c:555: warning: `fa_xp' was declared implicitly `extern' and later `static'
TLX.c:488: warning: previous declaration of `fa_xp'
2) The "offending" code:
==>> static fa_xp(ofsp,regexp,class)
(the previous declaration was: "return fa_xp(fa_root,regexp,class);"
(Actually, in the second case I've just been changing all those "static"s
to "extern". It works as far as shutting the compiler up, but is it messing
up the code? Should I be going the other direction?)
Thanks a lot.
henry nelson