llvm-project/clang/test/Frontend/fixed_point_as_variables.c
PiJoules 2c65860667
[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.
2023-11-13 12:31:49 -08:00

12 lines
316 B
C

// RUN: %clang_cc1 -x c -verify %s
// RUN: %clang_cc1 -x c -verify %s -ffixed-point -DFIXED_POINT=1
int _Accum;
#ifdef FIXED_POINT
// expected-error@4{{cannot combine with previous 'int' declaration specifier}}
// expected-warning@4{{declaration does not declare anything}}
#else
// expected-no-diagnostics
#endif