[PATCH] D123627: Correctly diagnose prototype redeclaration errors in C

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 14 11:37:29 PDT 2022


aaron.ballman added a comment.

In D123627#3452424 <https://reviews.llvm.org/D123627#3452424>, @efriedma wrote:

> In D123627#3451373 <https://reviews.llvm.org/D123627#3451373>, @aaron.ballman wrote:
>
>> Thank you for letting me know -- I've speculatively fixed the issue in 726901d06aab2f92d684d28507711308368c29d6 <https://reviews.llvm.org/rT726901d06aab2f92d684d28507711308368c29d6>
>
> Can you also look into improving the error message?  Just saying "conflicting types for 'rintf'", with a note saying the previous declaration is at the exact same location, is going to confuse anyone who writes `float rintf(){}`.

FWIW, I agree with you that the diagnostic message is less than helpful. But it's consistent with the message we used in all of the other declaration situations (https://godbolt.org/z/e6hcc4Y3Y) which is why I didn't add a better diagnostic message.

The reason you get the weird behavior with the note pointing to the same line as the declaration is because `rintf()` is a predefined builtin: https://godbolt.org/z/j3W759M7a (note the same lovely diagnostic note behavior).

So yes, it'd be nice to get better diagnostic behavior in this area, but it's orthogonal to the changes here.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D123627/new/

https://reviews.llvm.org/D123627



More information about the cfe-commits mailing list