Sirraide wrote:

Oh wait, I see this is a case of the declaration and definition not matching. 
That is indeed bad, but there is no good way of distinguishing this from a 
declaration that actually matches the definition. You could put that 
declaration in a header, include it in one file, and then... not do that in 
another file and implement a completely different function with the same name. 
That would run into the same problem.

I don’t know what the C term for this is, but in C++, situations like these are 
called IFNDR (ill-formed, **no diagnostic required**), because there is no good 
way of diagnosing this. This would have to be done at link time, and linkers 
don’t know a thing about the C type system. 

Simply diagnosing every extern declaration is not a solution for this and is 
going to lead to a lot of false positives—probably even mostly false positives 
because I’d expect that the people that actually do this take care to make sure 
the declaration and definition match.

https://github.com/llvm/llvm-project/pull/109714
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to