The following code gives the below warnings:
void test_ok(void);
void test_warn();
void main() {
}
$ sdcc -mz80 ./prototype.c
./prototype.c:3: warning 283: function declarator with no prototype
./prototype.c:5: warning 283: function declarator with no prototype
$
$ gcc ./prototype.c
$
$ sdcc -v
SDCC : mcs51/z80/z180/r2k/r2ka/r3ka/gbz80/tlcs90/ez80_z80/z80n/ds390/pic16/pic14/TININative/ds400/hc08/s08/stm8/pdk13/pdk14/pdk15 4.1.0 #12072 (Linux)
I assume that this an intentional feature? I can suppress the error, so probably not a big deal, but my entire code base is written that (warning) way.
It is intentional. What did you mean by
?
In C up to C17 that is a function declaration without a prototype. This declaration gives no information on the type and number of arguments. E.g.
Would result in a call to test_warn where the first argument is an int (the char gets promoted to int), and the second is a char *.
However, in my experience, most users actually wanted the C2X meaning (which is the same as C++), i.e. test_warn should be a function that takes no arguments. So the warning tells them that what they wrote is very likely not what they meant. In C up to C17, function declarations without a prototype were obsolescent anyway, so it makes sense to warn about them.
If you meant test_warn to be a function that takes no arguments you should either state so using
or compile in C2X mode.