odin-lang / Odin

Odin Programming Language
https://odin-lang.org
BSD 3-Clause "New" or "Revised" License
6.1k stars 550 forks source link

Fix `#warning` directive #3795

Closed Feoramund closed 1 week ago

Feoramund commented 1 week ago

#warning was added in dab3c832e00a3186bddc79585d9ba7ee10d39eaf but cannot actually be used, because it's an unrecognized directive. This should fix it. I did run into one issue though, which is where if I try to assign a #warning to a variable, the warning itself shadows the underlying error that would arise. I verified this with -ignore-warnings and ran into an assertion failure, which I have also handled in this PR.

Kelimion commented 1 week ago

We're discussing whether to even keep this and @(warning), as most places where you'd use a warning you'd be better off with an error, and the one place you're not we already have @(deprecated) for.

Feoramund commented 1 week ago

Warnings are vanishingly rare in the Odin compiler, I'll admit. I'm surprised to see one, if I ever do.

Kelimion commented 1 week ago

@gingerBill decided to remove warning in c0987394840d63fae627c1623ea2661c31adc9b9, so I'm closing this.