From 2c65860667e202e182264d5c6dfe4c2961542f7d Mon Sep 17 00:00:00 2001 From: PiJoules <6019989+PiJoules@users.noreply.github.com> Date: Mon, 13 Nov 2023 12:31:49 -0800 Subject: [clang] Remove fixed point arithmetic error (#71884) Prior to this, clang would always report ``` compile with '-ffixed-point' to enable fixed point types ``` whenever it sees `_Accum`, `_Fract`, or `_Sat` when fixed point arithmetic is not enabled. This can break existing code that uses these as variable names and doesn't use fixed point arithmetic like in some microsoft headers (https://github.com/llvm/llvm-project/pull/67750#issuecomment-1775264907). Fixed point should not raise this error for these cases, so this removes the error altogether and defaults to the usual error clang gives where it can see these keywords as either unknown types or regular variables. --- clang/lib/Basic/IdentifierTable.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'clang/lib/Basic/IdentifierTable.cpp') diff --git a/clang/lib/Basic/IdentifierTable.cpp b/clang/lib/Basic/IdentifierTable.cpp index c4c5a6e..38150d1 100644 --- a/clang/lib/Basic/IdentifierTable.cpp +++ b/clang/lib/Basic/IdentifierTable.cpp @@ -108,7 +108,8 @@ namespace { KEYSYCL = 0x800000, KEYCUDA = 0x1000000, KEYHLSL = 0x2000000, - KEYMAX = KEYHLSL, // The maximum key + KEYFIXEDPOINT = 0x4000000, + KEYMAX = KEYFIXEDPOINT, // The maximum key KEYALLCXX = KEYCXX | KEYCXX11 | KEYCXX20, KEYALL = (KEYMAX | (KEYMAX-1)) & ~KEYNOMS18 & ~KEYNOOPENCL // KEYNOMS18 and KEYNOOPENCL are used to exclude. @@ -210,6 +211,8 @@ static KeywordStatus getKeywordStatusHelper(const LangOptions &LangOpts, case KEYNOMS18: // The disable behavior for this is handled in getKeywordStatus. return KS_Unknown; + case KEYFIXEDPOINT: + return LangOpts.FixedPoint ? KS_Enabled : KS_Disabled; default: llvm_unreachable("Unknown KeywordStatus flag"); } -- cgit v1.1