Merge pull request #21110 from jketema/jketema/rm-decimal

C++: Remove decimal floating point types
This commit is contained in:
Jeroen Ketema
2026-01-14 10:58:39 +01:00
committed by GitHub
20 changed files with 13678 additions and 3888 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,2 @@
description: Remove _Decimal{32,64,128} types
compatibility: full

View File

@@ -0,0 +1,4 @@
---
category: breaking
---
* The `_Decimal32`, `_Decimal64`, and `_Decimal128` types are no longer exposed as builtin types. Support for these gcc-specific types was incomplete, and are generally not used in C/C++ codebases.

View File

@@ -802,15 +802,6 @@ private predicate floatingPointTypeMapping(
// _Complex __float128
kind = 39 and base = 2 and domain = TComplexDomain() and realKind = 38 and extended = false
or
// _Decimal32
kind = 40 and base = 10 and domain = TRealDomain() and realKind = 40 and extended = false
or
// _Decimal64
kind = 41 and base = 10 and domain = TRealDomain() and realKind = 41 and extended = false
or
// _Decimal128
kind = 42 and base = 10 and domain = TRealDomain() and realKind = 42 and extended = false
or
// _Float32
kind = 45 and base = 2 and domain = TRealDomain() and realKind = 45 and extended = false
or
@@ -871,9 +862,8 @@ private predicate floatingPointTypeMapping(
/**
* The C/C++ floating point types. See 4.5. This includes `float`, `double` and `long double`, the
* fixed-size floating-point types like `_Float32`, the extended-precision floating-point types like
* `_Float64x`, and the decimal floating-point types like `_Decimal32`. It also includes the complex
* and imaginary versions of all of these types.
* fixed-size floating-point types like `_Float32`, and the extended-precision floating-point types
* like `_Float64x`. It also includes the complex and imaginary versions of all of these types.
*/
class FloatingPointType extends ArithmeticType {
final int base;
@@ -991,42 +981,6 @@ class Float128Type extends RealNumberType, BinaryFloatingPointType {
override string getAPrimaryQlClass() { result = "Float128Type" }
}
/**
* The GNU C `_Decimal32` primitive type. This is not standard C/C++.
* ```
* _Decimal32 d32;
* ```
*/
class Decimal32Type extends RealNumberType, DecimalFloatingPointType {
Decimal32Type() { builtintypes(underlyingElement(this), _, 40, _, _, _) }
override string getAPrimaryQlClass() { result = "Decimal32Type" }
}
/**
* The GNU C `_Decimal64` primitive type. This is not standard C/C++.
* ```
* _Decimal64 d64;
* ```
*/
class Decimal64Type extends RealNumberType, DecimalFloatingPointType {
Decimal64Type() { builtintypes(underlyingElement(this), _, 41, _, _, _) }
override string getAPrimaryQlClass() { result = "Decimal64Type" }
}
/**
* The GNU C `_Decimal128` primitive type. This is not standard C/C++.
* ```
* _Decimal128 d128;
* ```
*/
class Decimal128Type extends RealNumberType, DecimalFloatingPointType {
Decimal128Type() { builtintypes(underlyingElement(this), _, 42, _, _, _) }
override string getAPrimaryQlClass() { result = "Decimal128Type" }
}
/**
* The C/C++ `void` type. See 4.7.
* ```

View File

@@ -617,9 +617,9 @@ case @builtintype.kind of
| 37 = @signed_int128 // signed __int128
| 38 = @float128 // __float128
| 39 = @complex_float128 // _Complex __float128
| 40 = @decimal32 // _Decimal32
| 41 = @decimal64 // _Decimal64
| 42 = @decimal128 // _Decimal128
// ... 40 _Decimal32
// ... 41 _Decimal64
// ... 42 _Decimal128
| 43 = @char16_t
| 44 = @char32_t
| 45 = @std_float32 // _Float32

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,11 @@
class BuiltinType extends @builtintype {
string toString() { none() }
}
predicate isDecimalBuiltinType(BuiltinType type) { builtintypes(type, _, [40, 41, 42], _, _, _) }
from BuiltinType type, string name, int kind, int kind_new, int size, int sign, int alignment
where
builtintypes(type, name, kind, size, sign, alignment) and
if isDecimalBuiltinType(type) then kind_new = 1 else kind_new = kind
select type, name, kind_new, size, sign, alignment

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,3 @@
description: Remove _Decimal{32,64,128} types
compatibility: partial
builtintypes.rel: run builtintypes.qlo

View File

@@ -1,5 +0,0 @@
_Decimal32 d32;
_Decimal64 d64;
_Decimal128 d128;

View File

@@ -1,7 +0,0 @@
| file://:0:0:0:0 | fp_offset | file://:0:0:0:0 | unsigned int |
| file://:0:0:0:0 | gp_offset | file://:0:0:0:0 | unsigned int |
| file://:0:0:0:0 | overflow_arg_area | file://:0:0:0:0 | void * |
| file://:0:0:0:0 | reg_save_area | file://:0:0:0:0 | void * |
| types.c:2:12:2:14 | d32 | file://:0:0:0:0 | _Decimal32 |
| types.c:3:12:3:14 | d64 | file://:0:0:0:0 | _Decimal64 |
| types.c:4:13:4:16 | d128 | file://:0:0:0:0 | _Decimal128 |

View File

@@ -1,5 +0,0 @@
import cpp
from Variable v, Type t
where t = v.getType()
select v, t

View File

@@ -1,6 +1,4 @@
double dd = 1.0d;
double dD = 1.0D;
double df = 1.0f;
double dF = 1.0F;
double di = 1.0i;

View File

@@ -1,14 +1,12 @@
| literals.c:2:13:2:16 | 1.0 |
| literals.c:3:13:3:16 | 1.0 |
| literals.c:4:13:4:16 | 1.0 |
| literals.c:5:13:5:16 | 1.0 |
| literals.c:4:13:4:16 | (0.0,1.0i) |
| literals.c:5:13:5:16 | (0.0,1.0i) |
| literals.c:6:13:6:16 | (0.0,1.0i) |
| literals.c:7:13:7:16 | (0.0,1.0i) |
| literals.c:8:13:8:16 | (0.0,1.0i) |
| literals.c:9:13:9:16 | (0.0,1.0i) |
| literals.c:8:13:8:16 | 1.0 |
| literals.c:9:13:9:16 | 1.0 |
| literals.c:10:13:10:16 | 1.0 |
| literals.c:11:13:11:16 | 1.0 |
| literals.c:12:13:12:16 | 1.0 |
| literals.c:13:13:13:16 | 1.0 |
| literals.c:14:13:14:16 | 1.0 |
| literals.c:15:13:15:16 | 1.0 |

View File

@@ -12,9 +12,6 @@
| file://:0:0:0:0 | _Complex float |
| file://:0:0:0:0 | _Complex long double |
| file://:0:0:0:0 | _Complex std::float16_t |
| file://:0:0:0:0 | _Decimal32 |
| file://:0:0:0:0 | _Decimal64 |
| file://:0:0:0:0 | _Decimal128 |
| file://:0:0:0:0 | _Float16 |
| file://:0:0:0:0 | _Float32 |
| file://:0:0:0:0 | _Float32x |

View File

@@ -32,9 +32,6 @@
| file://:0:0:0:0 | _Complex float | 8 |
| file://:0:0:0:0 | _Complex long double | 32 |
| file://:0:0:0:0 | _Complex std::float16_t | 4 |
| file://:0:0:0:0 | _Decimal32 | 4 |
| file://:0:0:0:0 | _Decimal64 | 8 |
| file://:0:0:0:0 | _Decimal128 | 16 |
| file://:0:0:0:0 | _Float16 | 2 |
| file://:0:0:0:0 | _Float32 | 4 |
| file://:0:0:0:0 | _Float32x | 8 |

View File

@@ -14,9 +14,6 @@
| file://:0:0:0:0 | _Complex float | _Complex float |
| file://:0:0:0:0 | _Complex long double | _Complex long double |
| file://:0:0:0:0 | _Complex std::float16_t | _Complex std::float16_t |
| file://:0:0:0:0 | _Decimal32 | _Decimal32 |
| file://:0:0:0:0 | _Decimal64 | _Decimal64 |
| file://:0:0:0:0 | _Decimal128 | _Decimal128 |
| file://:0:0:0:0 | _Float16 | _Float16 |
| file://:0:0:0:0 | _Float32 | _Float32 |
| file://:0:0:0:0 | _Float32x | _Float32x |

View File

@@ -13,9 +13,6 @@
| _Complex float | BinaryFloatingPointType, ComplexNumberType, GuardConditionImpl | | | | |
| _Complex long double | BinaryFloatingPointType, ComplexNumberType, GuardConditionImpl | | | | |
| _Complex std::float16_t | BinaryFloatingPointType, ComplexNumberType, GuardConditionImpl | | | | |
| _Decimal32 | Decimal32Type, GuardConditionImpl | | | | |
| _Decimal64 | Decimal64Type, GuardConditionImpl | | | | |
| _Decimal128 | Decimal128Type, GuardConditionImpl | | | | |
| _Float16 | BinaryFloatingPointType, GuardConditionImpl, RealNumberType | | | | |
| _Float32 | BinaryFloatingPointType, GuardConditionImpl, RealNumberType | | | | |
| _Float32x | BinaryFloatingPointType, GuardConditionImpl, RealNumberType | | | | |