Subject: Re: how to correct for compiler errors
To: Henry Nelson <henry@irm.nara.kindai.ac.jp>
From: Matthias Buelow <mkb@mukappabeta.de>
List: netbsd-help
Date: 04/11/2001 17:22:35
Henry Nelson <henry@irm.nara.kindai.ac.jp> writes:

>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);

Provide a prototype for stralloc() before this...

>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);"

Provide a prototype for fa_xp() before this...

Sorry but it boils down to this :)
In the first case, the function is probably extern but the compiler
has seen no prototype before and so registers the function as returning
`int', then checks the types and notes that *tmpfiles is probably not
of type int.
In the second case, the static function is used before its definition,
and in this case, again, the compiler registers the function when it's
called, and does so as if it had an (implicit) `extern' qualifier.


mkb