[clang] [clang] Remove fixed point arithmetic error (PR #71884)

via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 14 13:26:30 PST 2023


PiJoules wrote:

> I'm happy with the basic idea here of making fixed-point an opt-in feature. It'd be nice to preserve the special diagnostic that tells the user that they need to use `-ffixed-point`, though. Do we have any existing parsing paths that recognize unrecognized identifiers that are written as apparent type specifiers?

None that I've found. The order of operations seems to be (1) determine what keywords are allowed, then (2) lex allowed keywords and set the appropriate properties on tokens, then (3) handle the token based on if it's an identifier or keyword. What I initially wanted was something where `-ffixed-point` was not passed, but clang would warn on instances of `_Fract/_Accum/_Sat` keywords but still process them as regular identifiers. This would require either (1) always setting them as keywords then once we lex them, re-pipe them through one of the right the identifier path, or (2) treat them as regular identifiers (ie. `_Fract/_Accum/_Sat` are not keywords and disabled) but have some checks every time we lex an identifier token to check for these specific keywords. The former seemed too non-trivial since there's a bunch of "identifier" code paths. The later seemed more doable but would require extra manual string checks every time `Lex` was called.

I'd be fine with doing either in a later patch and making a TODO issue for improving the diagnostics.

https://github.com/llvm/llvm-project/pull/71884


More information about the cfe-commits mailing list