leech@phi.cs.unc.edu (Jonathan Leech) (10/03/88)
The following code demonstrated an interesting problem I
encountered with cfront 1.2.1: under certain conditions, an old-style
function definition will not match a (correct) prototype declaration.
// tst.c
char *_ent_char( int, char *, char *, int );
char *_ent_char(i, p, q, j)
int i;
#ifdef BUG
char *p, *q;
#else
char *p;
char *q;
#endif
int j;
{
return(p);
}
Script started on Sun Oct 2 21:34:22 1988
% CC -c tst.c
"tst.c", line 3: warning: old style definition of _ent_char()
"tst.c", line 14: warning: i not used
"tst.c", line 14: warning: q not used
"tst.c", line 14: warning: j not used
% CC -c -DBUG tst.c
"tst.c", line 3: warning: old style definition of _ent_char()
"tst.c", line 14: error: _ent_char() type mismatch: char *(int , char *, char *, int ) and char *(int , char *, int , int ... )
1 error
% ^D
script done on Sun Oct 2 21:34:58 1988
Obviously this is easy to code around - don't post followups on
how to do so!
This came up when trying to run cfront over a 25000 line old C
program as an enhanced version of lint. I don't recommend this
procedure for the faint at heart since cfront is not truly downwards
compatible with old C code.
--
Jon Leech (leech@cs.unc.edu) __@/
``Are there any more questions, besides the ones from the
liberal communists?''
- George Uribe, natl. director of "Students For America"