I have lots of code that results in constructs like this:
extern void foo(int);
void foo(int const x) { /* do something */ }
gcc and icc have no problem with this even in their strictest
settings, and I'm pretty sure I've used it with other compilers over
the years. tcc 0.9.21 however rejects it because it sees "int" as not
being compatible with "int const".
According to N869 6.7.5.3 #11:
[...]
(In the determination of type compatibility and of a composite type,
each parameter declared with function or array type is taken as
having the adjusted type and each parameter declared with qualified
type is taken as having the unqualified version of its declared
type.)
The way I read this, qualifiers are supposed to be ignored when comparing
function parameters for compatibility. The following patch implements
this for tcc.
-Dave Dodge
[...]